1 From 81c54afc5bc918ea3ed65cc356236b302b1f21ca Mon Sep 17 00:00:00 2001
2 From: Sean Wang <sean.wang@mediatek.com>
3 Date: Wed, 18 Oct 2017 16:28:46 +0800
4 Subject: [PATCH 120/224] soc: mediatek: pwrap: add MediaTek MT6380 as one
7 Add MediaTek MT6380 regulator becoming one of PMIC wrapper slave
8 and also add extra new regmap_config of 32-bit mode for MT6380
9 since old regmap_config of 16-bit mode can't be fit into the need.
11 Signed-off-by: Chenglin Xu <chenglin.xu@mediatek.com>
12 Signed-off-by: Chen Zhong <chen.zhong@mediatek.com>
13 Signed-off-by: Sean Wang <sean.wang@mediatek.com>
14 Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
16 drivers/soc/mediatek/mtk-pmic-wrap.c | 24 +++++++++++++++++++++---
17 1 file changed, 21 insertions(+), 3 deletions(-)
19 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
20 +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
21 @@ -507,6 +507,7 @@ struct pmic_wrapper;
22 struct pwrap_slv_type {
25 + const struct regmap_config *regmap;
26 /* Flags indicating the capability for the target slave */
29 @@ -1149,7 +1150,7 @@ static irqreturn_t pwrap_interrupt(int i
33 -static const struct regmap_config pwrap_regmap_config = {
34 +static const struct regmap_config pwrap_regmap_config16 = {
38 @@ -1158,9 +1159,19 @@ static const struct regmap_config pwrap_
39 .max_register = 0xffff,
42 +static const struct regmap_config pwrap_regmap_config32 = {
46 + .reg_read = pwrap_regmap_read,
47 + .reg_write = pwrap_regmap_write,
48 + .max_register = 0xffff,
51 static const struct pwrap_slv_type pmic_mt6323 = {
52 .dew_regs = mt6323_regs,
54 + .regmap = &pwrap_regmap_config16,
55 .caps = PWRAP_SLV_CAP_SPI | PWRAP_SLV_CAP_DUALIO |
56 PWRAP_SLV_CAP_SECURITY,
57 .pwrap_read = pwrap_read16,
58 @@ -1170,6 +1181,7 @@ static const struct pwrap_slv_type pmic_
59 static const struct pwrap_slv_type pmic_mt6380 = {
62 + .regmap = &pwrap_regmap_config32,
64 .pwrap_read = pwrap_read32,
65 .pwrap_write = pwrap_write32,
66 @@ -1178,6 +1190,7 @@ static const struct pwrap_slv_type pmic_
67 static const struct pwrap_slv_type pmic_mt6397 = {
68 .dew_regs = mt6397_regs,
70 + .regmap = &pwrap_regmap_config16,
71 .caps = PWRAP_SLV_CAP_SPI | PWRAP_SLV_CAP_DUALIO |
72 PWRAP_SLV_CAP_SECURITY,
73 .pwrap_read = pwrap_read16,
74 @@ -1189,9 +1202,14 @@ static const struct of_device_id of_slav
75 .compatible = "mediatek,mt6323",
78 + /* The MT6380 PMIC only implements a regulator, so we bind it
79 + * directly instead of using a MFD.
81 + .compatible = "mediatek,mt6380-regulator",
82 + .data = &pmic_mt6380,
84 .compatible = "mediatek,mt6397",
90 @@ -1372,7 +1390,7 @@ static int pwrap_probe(struct platform_d
94 - wrp->regmap = devm_regmap_init(wrp->dev, NULL, wrp, &pwrap_regmap_config);
95 + wrp->regmap = devm_regmap_init(wrp->dev, NULL, wrp, wrp->slave->regmap);
96 if (IS_ERR(wrp->regmap)) {
97 ret = PTR_ERR(wrp->regmap);