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

Commit 142bf6bf authored by Govind Singh's avatar Govind Singh
Browse files

net: cnss: enable rome_vreg_dsrc regulator for dsrc



rome_vreg_dsrc regulator is a fixed regulator and this regulator
is control by PMIC gpio4. This is being used as vdd supply for
the wlan DSRC module based on sdio interface. Enable rome_vreg_dsrc
voltage regulators to enable the power up support in CNSS SDIO
platform driver.

Change-Id: I7c6032b706d468cc57b5304a3627f526935fb3a3
Signed-off-by: default avatarGovind Singh <govinds@codeaurora.org>
parent c7444f53
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -2,21 +2,23 @@


This platform driver adds support for the CNSS subsystem used for SDIO
This platform driver adds support for the CNSS subsystem used for SDIO
based Wi-Fi devices. It also adds support to manage two 1.8V voltage
based Wi-Fi devices. It also adds support to manage two 1.8V voltage
regulators and WLAN power enable 3.3V PMIC GPIO. The main purpose of this
regulators and WLAN power enable 3.3V regulators. The main purpose of this
device tree entry below is to invoke the CNSS SDIO platform driver
device tree entry below is to invoke the CNSS SDIO platform driver
and provide handle to the WLAN power enable 3.3V pmic GPIO and two 1.8V
and provide handle to the WLAN power enable 3.3V pmic GPIO and two 1.8V
PMIC voltage regulator resources.
PMIC voltage regulator resources.


Required properties:
Required properties:
  - compatible: "qcom,cnss_sdio"
  - compatible: "qcom,cnss_sdio"
  - wlan-pmic-gpio: 3.3V PMIC GPIO for external power supply.
  - vdd-wlan-supply: phandle to the WLAN vdd regulator device tree node.
  - vdd-wlan-dsrc-supply: phandle to the WLAN dsrc vdd regulator device tree node.
  - vdd-wlan-io-supply: phandle to the WLAN IO regulator device tree node.
  - vdd-wlan-io-supply: phandle to the WLAN IO regulator device tree node.
  - vdd-wlan-xtal-supply: phandle to the WLAM XTAL regulator device tree node.
  - vdd-wlan-xtal-supply: phandle to the WLAM XTAL regulator device tree node.


Example:
Example:
	qcom,cnss-sdio {
	qcom,cnss-sdio {
		compatible = "qcom,cnss_sdio";
		compatible = "qcom,cnss_sdio";
		cnss_sdio,wlan-pmic-gpio = <&pm8019_gpios 3 0>;
		vdd-wlan-supply = <&rome_vreg>;
		vdd-wlan-dsrc-supply = <&sdcard_ext_vreg>;
		vdd-wlan-io-supply = <&mdm9607_l11>;
		vdd-wlan-io-supply = <&mdm9607_l11>;
		vdd-wlan-xtal-supply = <&mdm9607_l2>;
		vdd-wlan-xtal-supply = <&mdm9607_l2>;
	};
	};
+51 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/slab.h>
#include <linux/slab.h>


#define WLAN_VREG_NAME		"vdd-wlan"
#define WLAN_VREG_NAME		"vdd-wlan"
#define WLAN_VREG_DSRC_NAME	"vdd-wlan-dsrc"
#define WLAN_VREG_IO_NAME	"vdd-wlan-io"
#define WLAN_VREG_IO_NAME	"vdd-wlan-io"
#define WLAN_VREG_XTAL_NAME	"vdd-wlan-xtal"
#define WLAN_VREG_XTAL_NAME	"vdd-wlan-xtal"


@@ -53,6 +54,7 @@ struct cnss_sdio_regulator {
	struct regulator *wlan_io;
	struct regulator *wlan_io;
	struct regulator *wlan_xtal;
	struct regulator *wlan_xtal;
	struct regulator *wlan_vreg;
	struct regulator *wlan_vreg;
	struct regulator *wlan_vreg_dsrc;
};
};


static struct cnss_sdio_data {
static struct cnss_sdio_data {
@@ -217,6 +219,40 @@ static int cnss_sdio_configure_wlan_enable_regulator(void)


err_vdd_vreg_regulator:
err_vdd_vreg_regulator:
	regulator_put(cnss_pdata->regulator.wlan_vreg);
	regulator_put(cnss_pdata->regulator.wlan_vreg);

	return error;
}

static int cnss_sdio_configure_wlan_enable_dsrc_regulator(void)
{
	int error;
	struct device *dev = &cnss_pdata->pdev->dev;

	if (of_get_property(
		cnss_pdata->pdev->dev.of_node,
		WLAN_VREG_DSRC_NAME "-supply", NULL)) {
		cnss_pdata->regulator.wlan_vreg_dsrc = regulator_get(
			&cnss_pdata->pdev->dev, WLAN_VREG_DSRC_NAME);
		if (IS_ERR(cnss_pdata->regulator.wlan_vreg_dsrc)) {
			error = PTR_ERR(cnss_pdata->regulator.wlan_vreg_dsrc);
			dev_err(dev, "VDD-VREG-DSRC get failed error=%d\n",
				error);
			return error;
		}

		error = regulator_enable(cnss_pdata->regulator.wlan_vreg_dsrc);
		if (error) {
			dev_err(dev, "VDD-VREG-DSRC enable failed error=%d\n",
				error);
			goto err_vdd_vreg_dsrc_regulator;
		}
	}

	return 0;

err_vdd_vreg_dsrc_regulator:
	regulator_put(cnss_pdata->regulator.wlan_vreg_dsrc);

	return error;
	return error;
}
}


@@ -301,6 +337,8 @@ static void cnss_sdio_release_resource(void)
		regulator_put(cnss_pdata->regulator.wlan_vreg);
		regulator_put(cnss_pdata->regulator.wlan_vreg);
	if (cnss_pdata->regulator.wlan_io)
	if (cnss_pdata->regulator.wlan_io)
		regulator_put(cnss_pdata->regulator.wlan_io);
		regulator_put(cnss_pdata->regulator.wlan_io);
	if (cnss_pdata->regulator.wlan_vreg_dsrc)
		regulator_put(cnss_pdata->regulator.wlan_vreg_dsrc);
}
}


static int cnss_sdio_probe(struct platform_device *pdev)
static int cnss_sdio_probe(struct platform_device *pdev)
@@ -348,9 +386,22 @@ static int cnss_sdio_probe(struct platform_device *pdev)
		}
		}
	}
	}


	if (of_get_property(
		cnss_pdata->pdev->dev.of_node,
			WLAN_VREG_DSRC_NAME "-supply", NULL)) {
		error = cnss_sdio_configure_wlan_enable_dsrc_regulator();
		if (error) {
			dev_err(&pdev->dev,
				"Failed to enable wlan dsrc enable regulator\n");
			goto err_wlan_dsrc_enable_regulator;
		}
	}

	dev_info(&pdev->dev, "CNSS SDIO Driver registered");
	dev_info(&pdev->dev, "CNSS SDIO Driver registered");
	return 0;
	return 0;


err_wlan_dsrc_enable_regulator:
	regulator_put(cnss_pdata->regulator.wlan_vreg_dsrc);
err_wlan_enable_regulator:
err_wlan_enable_regulator:
	regulator_put(cnss_pdata->regulator.wlan_vreg);
	regulator_put(cnss_pdata->regulator.wlan_vreg);
err_wlan_enable_gpio:
err_wlan_enable_gpio: