Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b805671 authored by Komal Seelam's avatar Komal Seelam
Browse files

cnss: Add Support to load driver based on target attached



In Next Generation platforms; we support driver load at the bootup
based on the target attached.
Platform Driver(PD) exports the target revision read in pcie probe
to userspace through sys interface wlan_setup.

cnss-daemon in user space loads the driver based on the target revision
read from the sys file.

This change creates the sys interface to export the target parameters.

CRs-Fixed: 732694
Change-Id: Ia364f9c5df6116b9ca6ed28f545c3f0dd244386b
Signed-off-by: default avatarKomal Kumar <kseelam@codeaurora.org>
parent edf9ef3a
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -944,6 +944,18 @@ int cnss_get_fw_image(dma_addr_t *fw_image, u32 *image_size)
}
EXPORT_SYMBOL(cnss_get_fw_image);

static ssize_t wlan_setup_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	if (!penv)
		return -ENODEV;

	return scnprintf(buf, PAGE_SIZE, "%u\n", penv->revision_id);
}

static DEVICE_ATTR(wlan_setup, S_IRUSR,
			wlan_setup_show, NULL);

static int cnss_wlan_pci_probe(struct pci_dev *pdev,
			       const struct pci_device_id *id)
{
@@ -1009,6 +1021,13 @@ static int cnss_wlan_pci_probe(struct pci_dev *pdev,

	cnss_wlan_fw_mem_alloc(pdev);

	ret = device_create_file(&penv->pldev->dev, &dev_attr_wlan_setup);

	if (ret) {
		pr_err("Can't Create Device file\n");
		goto err_pcie_suspend;
	}

	if (penv->revision_id != QCA6174_FW_3_0 ||
		penv->revision_id != QCA6174_FW_3_2) {
		pr_debug("Code-swap not enabled: %d\n", penv->revision_id);
@@ -1051,7 +1070,13 @@ err_pcie_suspend:

static void cnss_wlan_pci_remove(struct pci_dev *pdev)
{
	struct device *dev;

	if (!penv)
		return;

	dev = &penv->pldev->dev;
	device_remove_file(dev, &dev_attr_wlan_setup);
}

static int cnss_wlan_pci_suspend(struct pci_dev *pdev, pm_message_t state)