aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/Kconfig6
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/dummy.c102
3 files changed, 109 insertions, 0 deletions
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");