1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
From 87c18e7aa2071dc0c95b76360671c3b3f2dcedec Mon Sep 17 00:00:00 2001
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date: Sat, 26 Feb 2022 21:52:08 +0300
Subject: [PATCH 5/5] mfd: qcom-qca639x: Add support for WCN6855
Add support for powering up WCN6855 WiFi/BT chip.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Upstream-Status: Inappropriate
---
drivers/mfd/qcom-qca639x.c | 49 ++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/drivers/mfd/qcom-qca639x.c b/drivers/mfd/qcom-qca639x.c
index 4de860e9bbd0..16ff767a34b0 100644
--- a/drivers/mfd/qcom-qca639x.c
+++ b/drivers/mfd/qcom-qca639x.c
@@ -44,10 +44,38 @@ static const struct qca_cfg_data qca6390_cfg_data = {
.num_vregs = ARRAY_SIZE(qca6390_vregs),
};
+static const struct vreg wcn6855_vregs[] = {
+ /* 2.8 V */
+ { "vddasd" }, /* external antenna switch */
+
+ /* 0.95 V */
+ { "vddaon" },
+ { "vddcx" },
+ { "vddmx" },
+
+ /* 1.9 V - 2.1 V */
+ { "vddrfa1" },
+
+ /* 1.35 V */
+ { "vddrfa2" },
+
+ /* 2.2 V, optional */
+ { "vddrfa3" },
+
+ /* 1.8 V */
+ { "vddio" },
+};
+
+static const struct qca_cfg_data wcn6855_cfg_data = {
+ .vregs = wcn6855_vregs,
+ .num_vregs = ARRAY_SIZE(wcn6855_vregs),
+};
+
struct qca_data {
size_t num_vregs;
struct device *dev;
struct generic_pm_domain pd;
+ struct gpio_desc *xo_clk_gpio;
struct gpio_desc *wlan_en_gpio;
struct gpio_desc *bt_en_gpio;
struct regulator_bulk_data regulators[];
@@ -71,11 +99,24 @@ static int qca_power_on(struct generic_pm_domain *domain)
/* Wait for 1ms before toggling enable pins. */
msleep(1);
+ if (data->xo_clk_gpio) {
+ gpiod_set_value(data->xo_clk_gpio, 1);
+
+ /*XO CLK must be asserted for some time before WLAN_EN */
+ usleep_range(100, 200);
+ }
+
if (data->wlan_en_gpio)
gpiod_set_value(data->wlan_en_gpio, 1);
if (data->bt_en_gpio)
gpiod_set_value(data->bt_en_gpio, 1);
+ if (data->xo_clk_gpio) {
+ /* Assert XO CLK ~(2-5)ms before off for valid latch in HW */
+ usleep_range(2000, 5000);
+ gpiod_set_value(data->xo_clk_gpio, 0);
+ }
+
/* Wait for all power levels to stabilize */
msleep(6);
@@ -126,11 +167,18 @@ static int qca_probe(struct platform_device *pdev)
return ret;
for (i = 0; i < data->num_vregs; i++) {
+ if (!cfg->vregs[i].load_uA)
+ continue;
+
ret = regulator_set_load(data->regulators[i].consumer, cfg->vregs[i].load_uA);
if (ret)
return ret;
}
+ data->xo_clk_gpio = devm_gpiod_get_optional(&pdev->dev, "xo-clk", GPIOD_OUT_LOW);
+ if (IS_ERR(data->xo_clk_gpio))
+ return PTR_ERR(data->xo_clk_gpio);
+
data->wlan_en_gpio = devm_gpiod_get_optional(&pdev->dev, "wlan-en", GPIOD_OUT_LOW);
if (IS_ERR(data->wlan_en_gpio))
return PTR_ERR(data->wlan_en_gpio);
@@ -169,6 +217,7 @@ static int qca_remove(struct platform_device *pdev)
static const struct of_device_id qca_of_match[] = {
{ .compatible = "qcom,qca6390", .data = &qca6390_cfg_data },
+ { .compatible = "qcom,wcn6855", .data = &wcn6855_cfg_data },
{ },
};
--
2.39.2
|