diff options
| author | Richard Fitzgerald <rf@opensource.cirrus.com> | 2018-05-21 05:59:56 -0400 |
|---|---|---|
| committer | Lee Jones <lee.jones@linaro.org> | 2018-06-05 06:14:56 -0400 |
| commit | 16b27467f46c1e0dbf093f53971aeb5decbaff4e (patch) | |
| tree | 585644f02c55a33c2c24645f10d8c057c5726369 | |
| parent | 2b49088cdba7dd59693887532e4058ee33b42d87 (diff) | |
mfd: madera: Add common support for Cirrus Logic Madera codecs
This adds the generic core support for Cirrus Logic "Madera" class codecs.
These are complex audio codec SoCs with a variety of digital and analogue
I/O, onboard audio processing and DSPs, and other features.
These codecs are all based off a common set of hardware IP so can be
supported by a core of common code (with a few minor device-to-device
variations).
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Nikesh Oswal <Nikesh.Oswal@cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
| -rw-r--r-- | MAINTAINERS | 3 | ||||
| -rw-r--r-- | drivers/mfd/Kconfig | 29 | ||||
| -rw-r--r-- | drivers/mfd/Makefile | 5 | ||||
| -rw-r--r-- | drivers/mfd/madera-core.c | 609 | ||||
| -rw-r--r-- | drivers/mfd/madera-i2c.c | 140 | ||||
| -rw-r--r-- | drivers/mfd/madera-spi.c | 139 | ||||
| -rw-r--r-- | drivers/mfd/madera.h | 44 | ||||
| -rw-r--r-- | include/linux/mfd/madera/core.h | 187 | ||||
| -rw-r--r-- | include/linux/mfd/madera/pdata.h | 59 |
9 files changed, 1215 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 6e5bb62acea2..7b8e857d6b33 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -3487,7 +3487,10 @@ L: patches@opensource.cirrus.com | |||
| 3487 | T: git https://github.com/CirrusLogic/linux-drivers.git | 3487 | T: git https://github.com/CirrusLogic/linux-drivers.git |
| 3488 | W: https://github.com/CirrusLogic/linux-drivers/wiki | 3488 | W: https://github.com/CirrusLogic/linux-drivers/wiki |
| 3489 | S: Supported | 3489 | S: Supported |
| 3490 | F: Documentation/devicetree/bindings/mfd/madera.txt | ||
| 3490 | F: include/linux/mfd/madera/* | 3491 | F: include/linux/mfd/madera/* |
| 3492 | F: drivers/mfd/madera* | ||
| 3493 | F: drivers/mfd/cs47l* | ||
| 3491 | 3494 | ||
| 3492 | CLEANCACHE API | 3495 | CLEANCACHE API |
| 3493 | M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 3496 | M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index b860eb5aa194..f5ca392f8bc2 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -232,6 +232,35 @@ config MFD_CROS_EC_CHARDEV | |||
| 232 | If you have a supported Chromebook, choose Y or M here. | 232 | If you have a supported Chromebook, choose Y or M here. |
| 233 | The module will be called cros_ec_dev. | 233 | The module will be called cros_ec_dev. |
| 234 | 234 | ||
| 235 | config MFD_MADERA | ||
| 236 | tristate "Cirrus Logic Madera codecs" | ||
| 237 | select MFD_CORE | ||
| 238 | select REGMAP | ||
| 239 | select REGMAP_IRQ | ||
| 240 | select MADERA_IRQ | ||
| 241 | select PINCTRL | ||
| 242 | select PINCTRL_MADERA | ||
| 243 | help | ||
| 244 | Support for the Cirrus Logic Madera platform audio codecs | ||
| 245 | |||
| 246 | config MFD_MADERA_I2C | ||
| 247 | tristate "Cirrus Logic Madera codecs with I2C" | ||
| 248 | depends on MFD_MADERA | ||
| 249 | depends on I2C | ||
| 250 | select REGMAP_I2C | ||
| 251 | help | ||
| 252 | Support for the Cirrus Logic Madera platform audio SoC | ||
| 253 | core functionality controlled via I2C. | ||
| 254 | |||
| 255 | config MFD_MADERA_SPI | ||
| 256 | tristate "Cirrus Logic Madera codecs with SPI" | ||
| 257 | depends on MFD_MADERA | ||
| 258 | depends on SPI_MASTER | ||
| 259 | select REGMAP_SPI | ||
| 260 | help | ||
| 261 | Support for the Cirrus Logic Madera platform audio SoC | ||
| 262 | core functionality controlled via SPI. | ||
| 263 | |||
| 235 | config MFD_ASIC3 | 264 | config MFD_ASIC3 |
| 236 | bool "Compaq ASIC3" | 265 | bool "Compaq ASIC3" |
| 237 | depends on GPIOLIB && ARM | 266 | depends on GPIOLIB && ARM |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index d9d2cf0d32ef..0a89a6a6d793 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
| @@ -73,6 +73,11 @@ wm8994-objs := wm8994-core.o wm8994-irq.o wm8994-regmap.o | |||
| 73 | obj-$(CONFIG_MFD_WM8994) += wm8994.o | 73 | obj-$(CONFIG_MFD_WM8994) += wm8994.o |
| 74 | obj-$(CONFIG_MFD_WM97xx) += wm97xx-core.o | 74 | obj-$(CONFIG_MFD_WM97xx) += wm97xx-core.o |
| 75 | 75 | ||
| 76 | madera-objs := madera-core.o | ||
| 77 | obj-$(CONFIG_MFD_MADERA) += madera.o | ||
| 78 | obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o | ||
| 79 | obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o | ||
| 80 | |||
| 76 | obj-$(CONFIG_TPS6105X) += tps6105x.o | 81 | obj-$(CONFIG_TPS6105X) += tps6105x.o |
| 77 | obj-$(CONFIG_TPS65010) += tps65010.o | 82 | obj-$(CONFIG_TPS65010) += tps65010.o |
| 78 | obj-$(CONFIG_TPS6507X) += tps6507x.o | 83 | obj-$(CONFIG_TPS6507X) += tps6507x.o |
diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c new file mode 100644 index 000000000000..8cfea969b060 --- /dev/null +++ b/drivers/mfd/madera-core.c | |||
| @@ -0,0 +1,609 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | /* | ||
| 3 | * Core MFD support for Cirrus Logic Madera codecs | ||
| 4 | * | ||
| 5 | * Copyright (C) 2015-2018 Cirrus Logic | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; version 2. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/device.h> | ||
| 13 | #include <linux/delay.h> | ||
| 14 | #include <linux/err.h> | ||
| 15 | #include <linux/gpio.h> | ||
| 16 | #include <linux/mfd/core.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | #include <linux/notifier.h> | ||
| 19 | #include <linux/of.h> | ||
| 20 | #include <linux/of_gpio.h> | ||
| 21 | #include <linux/platform_device.h> | ||
| 22 | #include <linux/pm_runtime.h> | ||
| 23 | #include <linux/regmap.h> | ||
| 24 | #include <linux/regulator/consumer.h> | ||
| 25 | #include <linux/regulator/machine.h> | ||
| 26 | #include <linux/regulator/of_regulator.h> | ||
| 27 | |||
| 28 | #include <linux/mfd/madera/core.h> | ||
| 29 | #include <linux/mfd/madera/registers.h> | ||
| 30 | |||
| 31 | #include "madera.h" | ||
| 32 | |||
| 33 | #define CS47L35_SILICON_ID 0x6360 | ||
| 34 | #define CS47L85_SILICON_ID 0x6338 | ||
| 35 | #define CS47L90_SILICON_ID 0x6364 | ||
| 36 | |||
| 37 | #define MADERA_32KZ_MCLK2 1 | ||
| 38 | |||
| 39 | static const char * const madera_core_supplies[] = { | ||
| 40 | "AVDD", | ||
| 41 | "DBVDD1", | ||
| 42 | }; | ||
| 43 | |||
| 44 | static const struct mfd_cell madera_ldo1_devs[] = { | ||
| 45 | { .name = "madera-ldo1" }, | ||
| 46 | }; | ||
| 47 | |||
| 48 | static const char * const cs47l35_supplies[] = { | ||
| 49 | "MICVDD", | ||
| 50 | "DBVDD2", | ||
| 51 | "CPVDD1", | ||
| 52 | "CPVDD2", | ||
| 53 | "SPKVDD", | ||
| 54 | }; | ||
| 55 | |||
| 56 | static const struct mfd_cell cs47l35_devs[] = { | ||
| 57 | { .name = "madera-pinctrl", }, | ||
| 58 | { .name = "madera-irq", }, | ||
| 59 | { .name = "madera-micsupp", }, | ||
| 60 | { .name = "madera-gpio", }, | ||
| 61 | { .name = "madera-extcon", }, | ||
| 62 | { | ||
| 63 | .name = "cs47l35-codec", | ||
| 64 | .parent_supplies = cs47l35_supplies, | ||
| 65 | .num_parent_supplies = ARRAY_SIZE(cs47l35_supplies), | ||
| 66 | }, | ||
| 67 | }; | ||
| 68 | |||
| 69 | static const char * const cs47l85_supplies[] = { | ||
| 70 | "MICVDD", | ||
| 71 | "DBVDD2", | ||
| 72 | "DBVDD3", | ||
| 73 | "DBVDD4", | ||
| 74 | "CPVDD1", | ||
| 75 | "CPVDD2", | ||
| 76 | "SPKVDDL", | ||
| 77 | "SPKVDDR", | ||
| 78 | }; | ||
| 79 | |||
| 80 | static const struct mfd_cell cs47l85_devs[] = { | ||
| 81 | { .name = "madera-pinctrl", }, | ||
| 82 | { .name = "madera-irq", }, | ||
| 83 | { .name = "madera-micsupp" }, | ||
| 84 | { .name = "madera-gpio", }, | ||
| 85 | { .name = "madera-extcon", }, | ||
| 86 | { | ||
| 87 | .name = "cs47l85-codec", | ||
| 88 | .parent_supplies = cs47l85_supplies, | ||
| 89 | .num_parent_supplies = ARRAY_SIZE(cs47l85_supplies), | ||
| 90 | }, | ||
| 91 | }; | ||
| 92 | |||
| 93 | static const char * const cs47l90_supplies[] = { | ||
| 94 | "MICVDD", | ||
| 95 | "DBVDD2", | ||
| 96 | "DBVDD3", | ||
| 97 | "DBVDD4", | ||
| 98 | "CPVDD1", | ||
| 99 | "CPVDD2", | ||
| 100 | }; | ||
| 101 | |||
| 102 | static const struct mfd_cell cs47l90_devs[] = { | ||
| 103 | { .name = "madera-pinctrl", }, | ||
| 104 | { .name = "madera-irq", }, | ||
| 105 | { .name = "madera-micsupp", }, | ||
| 106 | { .name = "madera-gpio", }, | ||
| 107 | { .name = "madera-extcon", }, | ||
| 108 | { | ||
| 109 | .name = "cs47l90-codec", | ||
| 110 | .parent_supplies = cs47l90_supplies, | ||
| 111 | .num_parent_supplies = ARRAY_SIZE(cs47l90_supplies), | ||
| 112 | }, | ||
| 113 | }; | ||
| 114 | |||
| 115 | /* Used by madera-i2c and madera-spi drivers */ | ||
| 116 | const char *madera_name_from_type(enum madera_type type) | ||
| 117 | { | ||
| 118 | switch (type) { | ||
| 119 | case CS47L35: | ||
| 120 | return "CS47L35"; | ||
| 121 | case CS47L85: | ||
| 122 | return "CS47L85"; | ||
| 123 | case CS47L90: | ||
| 124 | return "CS47L90"; | ||
| 125 | case CS47L91: | ||
| 126 | return "CS47L91"; | ||
| 127 | case WM1840: | ||
| 128 | return "WM1840"; | ||
| 129 | default: | ||
| 130 | return "Unknown"; | ||
