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

Commit 1b3a5b0e authored by Prashanth Bhatta's avatar Prashanth Bhatta
Browse files

cnss: Make bus bandwidth request optional



If device tree entry doesn't exist for bus bandwidth then
initialization of cnss driver fails. If device tree entry doesn't
exist then cnss driver needs to handle this case gracefully.
Modified driver to ignore the bus bandwidth request if device
tree entry doesn't exist.

Change-Id: Ib0e0d04d34d72bea633c74f436eeec625b986347
Signed-off-by: default avatarPrashanth Bhatta <bhattap@codeaurora.org>
parent 7bbebd78
Loading
Loading
Loading
Loading
+25 −12
Original line number Diff line number Diff line
@@ -546,6 +546,7 @@ void cnss_wlan_unregister_driver(struct cnss_wlan_driver *driver)
		return;
	}

	if (penv->bus_client)
		msm_bus_scale_client_update_request(penv->bus_client, 0);

	if (!pdev) {
@@ -969,22 +970,25 @@ static int cnss_probe(struct platform_device *pdev)
	if (ret)
		goto err_pci_reg;

	penv->bus_scale_table = 0;
	penv->bus_scale_table = msm_bus_cl_get_pdata(pdev);
	if (!penv->bus_scale_table)
		goto err_bus_scale;

	penv->bus_client = msm_bus_scale_register_client
	    (penv->bus_scale_table);
	if (!penv->bus_client)
	if (penv->bus_scale_table)  {
		penv->bus_client =
			msm_bus_scale_register_client(penv->bus_scale_table);

		if (!penv->bus_client) {
			pr_err("Failed to register with bus_scale client\n");
			goto err_bus_reg;
		}
	}

	pr_info("cnss: Platform driver probed successfully.\n");
	return ret;

err_bus_reg:
	if (penv->bus_scale_table)
		msm_bus_cl_clear_pdata(penv->bus_scale_table);

err_bus_scale:
	pci_unregister_driver(&cnss_wlan_pci_driver);

err_pci_reg:
@@ -1010,6 +1014,12 @@ static int cnss_remove(struct platform_device *pdev)
	struct cnss_wlan_vreg_info *vreg_info = &penv->vreg_info;
	struct cnss_wlan_gpio_info *gpio_info = &penv->gpio_info;

	if (penv->bus_client)
		msm_bus_scale_unregister_client(penv->bus_client);

	if (penv->bus_scale_table)
		msm_bus_cl_clear_pdata(penv->bus_scale_table);

	cnss_wlan_gpio_set(gpio_info, WLAN_EN_LOW);
	if (cnss_wlan_vreg_set(vreg_info, VREG_OFF))
		pr_err("Failed to turn OFF wlan vreg\n");
@@ -1065,9 +1075,12 @@ int cnss_request_bus_bandwidth(int bandwidth)
{
	int ret = 0;

	if (!penv || !penv->bus_client)
	if (!penv)
		return -ENODEV;

	if (!penv->bus_client)
		return -ENOSYS;

	switch (bandwidth) {
	case CNSS_BUS_WIDTH_NONE:
	case CNSS_BUS_WIDTH_LOW: