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 diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
20 index e3398e37a7a6..45c3e44d8f40 100644
21 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
22 +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
23 @@ -507,6 +507,7 @@ struct pmic_wrapper;
24 struct pwrap_slv_type {
27 + const struct regmap_config *regmap;
28 /* Flags indicating the capability for the target slave */
31 @@ -1149,7 +1150,7 @@ static irqreturn_t pwrap_interrupt(int irqno, void *dev_id)
35 -static const struct regmap_config pwrap_regmap_config = {
36 +static const struct regmap_config pwrap_regmap_config16 = {
40 @@ -1158,9 +1159,19 @@ static const struct regmap_config pwrap_regmap_config = {
41 .max_register = 0xffff,
44 +static const struct regmap_config pwrap_regmap_config32 = {
48 + .reg_read = pwrap_regmap_read,
49 + .reg_write = pwrap_regmap_write,
50 + .max_register = 0xffff,
53 static const struct pwrap_slv_type pmic_mt6323 = {
54 .dew_regs = mt6323_regs,
56 + .regmap = &pwrap_regmap_config16,
57 .caps = PWRAP_SLV_CAP_SPI | PWRAP_SLV_CAP_DUALIO |
58 PWRAP_SLV_CAP_SECURITY,
59 .pwrap_read = pwrap_read16,
60 @@ -1170,6 +1181,7 @@ static const struct pwrap_slv_type pmic_mt6323 = {
61 static const struct pwrap_slv_type pmic_mt6380 = {
64 + .regmap = &pwrap_regmap_config32,
66 .pwrap_read = pwrap_read32,
67 .pwrap_write = pwrap_write32,
68 @@ -1178,6 +1190,7 @@ static const struct pwrap_slv_type pmic_mt6380 = {
69 static const struct pwrap_slv_type pmic_mt6397 = {
70 .dew_regs = mt6397_regs,
72 + .regmap = &pwrap_regmap_config16,
73 .caps = PWRAP_SLV_CAP_SPI | PWRAP_SLV_CAP_DUALIO |
74 PWRAP_SLV_CAP_SECURITY,
75 .pwrap_read = pwrap_read16,
76 @@ -1189,9 +1202,14 @@ static const struct of_device_id of_slave_match_tbl[] = {
77 .compatible = "mediatek,mt6323",
80 + /* The MT6380 PMIC only implements a regulator, so we bind it
81 + * directly instead of using a MFD.
83 + .compatible = "mediatek,mt6380-regulator",
84 + .data = &pmic_mt6380,
86 .compatible = "mediatek,mt6397",
92 @@ -1372,7 +1390,7 @@ static int pwrap_probe(struct platform_device *pdev)
96 - wrp->regmap = devm_regmap_init(wrp->dev, NULL, wrp, &pwrap_regmap_config);
97 + wrp->regmap = devm_regmap_init(wrp->dev, NULL, wrp, wrp->slave->regmap);
98 if (IS_ERR(wrp->regmap)) {
99 ret = PTR_ERR(wrp->regmap);