Skip to content

Commit dc7d486

Browse files
charleskeepaxSamuel Ortiz
authored andcommitted
mfd: arizona: Integrate wm8997 into Arizona mfd
The wm8997 is a compact, high-performance audio hub CODEC with SLIMbus interfacing, for smartphones, tablets and other portable audio devices based on the Arizona platform. This patch integrates the wm8997 into the Arizona mfd. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
1 parent f3799e9 commit dc7d486

8 files changed

Lines changed: 1582 additions & 0 deletions

File tree

‎drivers/mfd/Kconfig‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,12 @@ config MFD_WM5110
10471047
help
10481048
Support for Wolfson Microelectronics WM5110 low power audio SoC
10491049

1050+
config MFD_WM8997
1051+
bool "Support Wolfson Microelectronics WM8997"
1052+
depends on MFD_ARIZONA
1053+
help
1054+
Support for Wolfson Microelectronics WM8997 low power audio SoC
1055+
10501056
config MFD_WM8400
10511057
bool "Wolfson Microelectronics WM8400"
10521058
select MFD_CORE

‎drivers/mfd/Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ endif
4343
ifneq ($(CONFIG_MFD_WM5110),n)
4444
obj-$(CONFIG_MFD_ARIZONA) += wm5110-tables.o
4545
endif
46+
ifneq ($(CONFIG_MFD_WM8997),n)
47+
obj-$(CONFIG_MFD_ARIZONA) += wm8997-tables.o
48+
endif
4649
obj-$(CONFIG_MFD_WM8400) += wm8400-core.o
4750
wm831x-objs := wm831x-core.o wm831x-irq.o wm831x-otp.o
4851
wm831x-objs += wm831x-auxadc.o

‎drivers/mfd/arizona-core.c‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ static int arizona_of_get_core_pdata(struct arizona *arizona)
554554
const struct of_device_id arizona_of_match[] = {
555555
{ .compatible = "wlf,wm5102", .data = (void *)WM5102 },
556556
{ .compatible = "wlf,wm5110", .data = (void *)WM5110 },
557+
{ .compatible = "wlf,wm8997", .data = (void *)WM8997 },
557558
{},
558559
};
559560
EXPORT_SYMBOL_GPL(arizona_of_match);
@@ -586,6 +587,15 @@ static struct mfd_cell wm5110_devs[] = {
586587
{ .name = "wm5110-codec" },
587588
};
588589

590+
static struct mfd_cell wm8997_devs[] = {
591+
{ .name = "arizona-micsupp" },
592+
{ .name = "arizona-extcon" },
593+
{ .name = "arizona-gpio" },
594+
{ .name = "arizona-haptics" },
595+
{ .name = "arizona-pwm" },
596+
{ .name = "wm8997-codec" },
597+
};
598+
589599
int arizona_dev_init(struct arizona *arizona)
590600
{
591601
struct device *dev = arizona->dev;
@@ -608,6 +618,7 @@ int arizona_dev_init(struct arizona *arizona)
608618
switch (arizona->type) {
609619
case WM5102:
610620
case WM5110:
621+
case WM8997:
611622
for (i = 0; i < ARRAY_SIZE(wm5102_core_supplies); i++)
612623
arizona->core_supplies[i].supply
613624
= wm5102_core_supplies[i];
@@ -683,6 +694,7 @@ int arizona_dev_init(struct arizona *arizona)
683694
switch (reg) {
684695
case 0x5102:
685696
case 0x5110:
697+
case 0x8997:
686698
break;
687699
default:
688700
dev_err(arizona->dev, "Unknown device ID: %x\n", reg);
@@ -767,6 +779,17 @@ int arizona_dev_init(struct arizona *arizona)
767779
}
768780
apply_patch = wm5110_patch;
769781
break;
782+
#endif
783+
#ifdef CONFIG_MFD_WM8997
784+
case 0x8997:
785+
type_name = "WM8997";
786+
if (arizona->type != WM8997) {
787+
dev_err(arizona->dev, "WM8997 registered as %d\n",
788+
arizona->type);
789+
arizona->type = WM8997;
790+
}
791+
apply_patch = wm8997_patch;
792+
break;
770793
#endif
771794
default:
772795
dev_err(arizona->dev, "Unknown device ID %x\n", reg);
@@ -934,6 +957,10 @@ int arizona_dev_init(struct arizona *arizona)
934957
ret = mfd_add_devices(arizona->dev, -1, wm5110_devs,
935958
ARRAY_SIZE(wm5110_devs), NULL, 0, NULL);
936959
break;
960+
case WM8997:
961+
ret = mfd_add_devices(arizona->dev, -1, wm8997_devs,
962+
ARRAY_SIZE(wm8997_devs), NULL, 0, NULL);
963+
break;
937964
}
938965

939966
if (ret != 0) {

‎drivers/mfd/arizona-i2c.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ static int arizona_i2c_probe(struct i2c_client *i2c,
4444
case WM5110:
4545
regmap_config = &wm5110_i2c_regmap;
4646
break;
47+
#endif
48+
#ifdef CONFIG_MFD_WM8997
49+
case WM8997:
50+
regmap_config = &wm8997_i2c_regmap;
51+
break;
4752
#endif
4853
default:
4954
dev_err(&i2c->dev, "Unknown device type %ld\n",
@@ -80,6 +85,7 @@ static int arizona_i2c_remove(struct i2c_client *i2c)
8085
static const struct i2c_device_id arizona_i2c_id[] = {
8186
{ "wm5102", WM5102 },
8287
{ "wm5110", WM5110 },
88+
{ "wm8997", WM8997 },
8389
{ }
8490
};
8591
MODULE_DEVICE_TABLE(i2c, arizona_i2c_id);

‎drivers/mfd/arizona-irq.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ int arizona_irq_init(struct arizona *arizona)
208208
ctrlif_error = false;
209209
break;
210210
#endif
211+
#ifdef CONFIG_MFD_WM8997
212+
case WM8997:
213+
aod = &wm8997_aod;
214+
irq = &wm8997_irq;
215+
216+
ctrlif_error = false;
217+
break;
218+
#endif
211219
default:
212220
BUG_ON("Unknown Arizona class device" == NULL);
213221
return -EINVAL;

‎drivers/mfd/arizona.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ extern const struct regmap_config wm5102_spi_regmap;
2525
extern const struct regmap_config wm5110_i2c_regmap;
2626
extern const struct regmap_config wm5110_spi_regmap;
2727

28+
extern const struct regmap_config wm8997_i2c_regmap;
29+
2830
extern const struct dev_pm_ops arizona_pm_ops;
2931

3032
extern const struct of_device_id arizona_of_match[];
@@ -35,6 +37,9 @@ extern const struct regmap_irq_chip wm5102_irq;
3537
extern const struct regmap_irq_chip wm5110_aod;
3638
extern const struct regmap_irq_chip wm5110_irq;
3739

40+
extern const struct regmap_irq_chip wm8997_aod;
41+
extern const struct regmap_irq_chip wm8997_irq;
42+
3843
int arizona_dev_init(struct arizona *arizona);
3944
int arizona_dev_exit(struct arizona *arizona);
4045
int arizona_irq_init(struct arizona *arizona);

0 commit comments

Comments
 (0)