aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2020-08-18 10:07:18 +0530
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2020-08-18 10:07:18 +0530
commitc2467dea2bf50b308d4f3fa4bad1090b3868b237 (patch)
treeb2e34a4d15a58f8f045aa0c98fbd9388beacf9cb
parent598e1cc29d35761d955dc5697a91fd568bebf707 (diff)
download96b-common-c2467dea2bf50b308d4f3fa4bad1090b3868b237.tar.gz
[TEMP]: Add a dummy driver to handle the poweron for QCA6391
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-rw-r--r--arch/arm64/boot/dts/qcom/qrb5165-rb5.dts45
-rw-r--r--drivers/misc/Kconfig6
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/dummy.c102
4 files changed, 154 insertions, 0 deletions
diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
index 849728e5cb22..5d981123b0ca 100644
--- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
+++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
@@ -229,6 +229,21 @@
regulator-always-on;
vin-supply = <&vph_pwr>;
};
+
+ dummy {
+ compatible = "qcom-dummy";
+ vddaon-supply = <&vreg_s6a_0p95>;
+ vddpmu-supply = <&vreg_s2f_0p95>;
+ vddrfa1-supply = <&vreg_s2f_0p95>;
+ vddrfa2-supply = <&vreg_s8c_1p3>;
+ vddrfa3-supply = <&vreg_s5a_1p9>;
+ vddpcie1-supply = <&vreg_s8c_1p3>;
+ vddpcie2-supply = <&vreg_s5a_1p9>;
+ vddio-supply = <&vreg_s4a_1p8>;
+ pinctrl-names = "wlan_en_active", "bt_en_active";
+ pinctrl-0 = <&wlan_default_state>;
+ pinctrl-1 = <&bt_default_state>;
+ };
};
&apps_rsc {
@@ -242,6 +257,13 @@
vdd-l5-l6-supply = <&vreg_bob>;
vdd-l7-supply = <&vreg_s4a_1p8>;
+ vreg_s2f_0p95: smps2 {
+ regulator-name = "vreg_s2f_0p95";
+ regulator-min-microvolt = <512000>;
+ regulator-max-microvolt = <1100000>;
+ regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
+ };
+
vreg_l1f_cam_dvdd1_1p1: ldo1 {
regulator-name = "vreg_l1f_cam_dvdd1_1p1";
regulator-min-microvolt = <1104000>;
@@ -1171,6 +1193,29 @@
bias-pull-up;
};
};
+
+ wlan_default_state: wlan-default-state {
+ wlan-en {
+ pins = "gpio20";
+ function = "gpio";
+
+ drive-strength = <16>;
+ output-high;
+ bias-pull-up;
+ };
+ };
+
+ bt_default_state: bt-default-state {
+ bt-en {
+ pins = "gpio21";
+ function = "gpio";
+
+ drive-strength = <2>;
+ output-low;
+ bias-pull-down;
+ };
+ };
+
};
&uart12 {
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index e1b1ba5e2b92..42d958b04439 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -263,6 +263,12 @@ config QCOM_FASTRPC
applications DSP processor. Say M if you want to enable this
module.
+config QCOM_DUMMY
+ tristate "Qualcomm dummy"
+ depends on ARCH_QCOM || COMPILE_TEST
+ help
+ module.
+
config SGI_GRU
tristate "SGI GRU driver"
depends on X86_UV && SMP
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c7bd01ac6291..feeb205fa332 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -57,3 +57,4 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o
obj-$(CONFIG_HABANA_AI) += habanalabs/
obj-$(CONFIG_UACCE) += uacce/
obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o
+obj-$(CONFIG_QCOM_DUMMY) += dummy.o
diff --git a/drivers/misc/dummy.c b/drivers/misc/dummy.c
new file mode 100644
index 000000000000..b5d4db5f6fdb
--- /dev/null
+++ b/drivers/misc/dummy.c
@@ -0,0 +1,102 @@
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/regulator/consumer.h>
+
+struct vreg {
+ const char *name;
+ int minvolt;
+ int maxvolt;
+} vregs [8] = {
+ { "vddio", 1800000, 1800000 },
+ { "vddaon", 950000, 950000 },
+ { "vddpmu", 950000, 950000 },
+ { "vddrfa1", 950000, 950000 },
+ { "vddrfa2", 1380000, 1380000 },
+ { "vddrfa3", 2000000, 2000000 },
+ { "vddpcie1", 1350000, 1350000 },
+ { "vddpcie2", 2000000, 2000000 },
+};
+
+static int dummy_probe(struct platform_device *pdev)
+{
+ struct regulator_bulk_data regulators[8];
+ struct device *dev = &pdev->dev;
+ int i, ret;
+ struct pinctrl *pinctrl;
+ struct pinctrl_state *wlan_en_active;
+ struct pinctrl_state *bt_en_active;
+
+ for (i = 0; i < ARRAY_SIZE(regulators); i++)
+ regulators[i].supply = vregs[i].name;
+ ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(regulators), regulators);
+ if (ret < 0)
+ return ret;
+
+ ret = regulator_bulk_enable(ARRAY_SIZE(regulators), regulators);
+ if (ret)
+ return ret;
+
+ pinctrl = devm_pinctrl_get(dev);
+ if (IS_ERR_OR_NULL(pinctrl)) {
+ ret = PTR_ERR(pinctrl);
+ pr_err("Failed to get pinctrl, err = %d\n", ret);
+ return ret;
+ }
+
+ wlan_en_active = pinctrl_lookup_state(pinctrl, "wlan_en_active");
+ if (IS_ERR_OR_NULL(wlan_en_active)) {
+ ret = PTR_ERR(wlan_en_active);
+ pr_err("Failed to get wlan_en_active, err = %d\n", ret);
+ return ret;
+ }
+
+ bt_en_active = pinctrl_lookup_state(pinctrl, "bt_en_active");
+ if (IS_ERR_OR_NULL(bt_en_active)) {
+ ret = PTR_ERR(bt_en_active);
+ pr_err("Failed to get bt_en_active, err = %d\n", ret);
+ return ret;
+ }
+
+ ret = pinctrl_select_state(pinctrl, wlan_en_active);
+ if (ret) {
+ pr_err("Failed to select wlan pinctrl state");
+ return ret;
+ }
+ udelay(1000);
+
+ ret = pinctrl_select_state(pinctrl, bt_en_active);
+ if (ret) {
+ pr_err("Failed to select bt pinctrl state");
+ return ret;
+ }
+ udelay(1000);
+
+ return 0;
+}
+
+static int dummy_remove(struct platform_device *pdev)
+{
+ return 0;
+}
+
+static const struct of_device_id dummy_of_match[] = {
+ { .compatible = "qcom,dummy" },
+};
+
+static struct platform_driver dummy_driver = {
+ .probe = dummy_probe,
+ .remove = dummy_remove,
+ .driver = {
+ .name = "dummy",
+ .of_match_table = dummy_of_match,
+ },
+};
+
+module_platform_driver(dummy_driver);
+MODULE_LICENSE("GPL v2");