mfd: madera: Add support for CS47L92/CS47L93
authorStuart Henderson <stuarth@opensource.wolfsonmicro.com>
Tue, 25 Apr 2017 15:47:13 +0000 (16:47 +0100)
committer강신형 <s47.kang@samsung.com>
Tue, 19 Jun 2018 07:04:09 +0000 (16:04 +0900)
Change-Id: I412aa97649bb8df5174270a514e3142837782b14
Signed-off-by: Stuart Henderson <stuarth@opensource.wolfsonmicro.com>
Documentation/devicetree/bindings/mfd/madera.txt
drivers/mfd/Kconfig
drivers/mfd/madera-core.c
drivers/mfd/madera-i2c.c
drivers/mfd/madera-spi.c
drivers/mfd/madera.h
include/linux/mfd/madera/core.h

index 81886f35c4e86d90871431b650ea1c5aac4a4bcb..2fadb7ec1cacf03b3ee6baeb67cdca4c4f25ff3e 100644 (file)
@@ -15,6 +15,8 @@ Required properties:
         "cirrus,cs47l85"
         "cirrus,cs47l90"
         "cirrus,cs47l91"
+        "cirrus,cs47l92"
+        "cirrus,cs47l93"
         "cirrus,wm1840"
 
   - reg : I2C slave address when connected using I2C, chip select number when
index 6dd81413f341c89a382d0c12e389b83e8e839fb1..246b295d772e42fd284751b46010aa9dc1238826 100644 (file)
@@ -274,6 +274,7 @@ config MFD_CS47L90
 
 config MFD_CS47L92
        bool "Cirrus Logic CS47L92/93"
+       select PINCTRL_CS47L92
        depends on MFD_MADERA
        help
          Support for Cirrus Logic CS47L92 and CS47L93 Smart Codecs
index 0980977628f96e00b8e19e3becf0c4e0eb5d9949..1cd586e2e3da9c4a905419338593edfc23d3008d 100644 (file)
@@ -34,6 +34,7 @@
 #define CS47L35_SILICON_ID     0x6360
 #define CS47L85_SILICON_ID     0x6338
 #define CS47L90_SILICON_ID     0x6364
+#define CS47L92_SILICON_ID     0x6371
 
 #define MADERA_32KZ_MCLK2      1
 
@@ -113,6 +114,26 @@ static const struct mfd_cell cs47l90_devs[] = {
        },
 };
 
+static const char * const cs47l92_supplies[] = {
+       "MICVDD",
+       "CPVDD1",
+       "CPVDD2",
+};
+
+static const struct mfd_cell cs47l92_devs[] = {
+       { .name = "madera-pinctrl" },
+       { .name = "madera-irq", },
+       { .name = "madera-micsupp", },
+       { .name = "madera-gpio" },
+       { .name = "madera-extcon" },
+       {
+               .name = "cs47l92-codec",
+               .parent_supplies = cs47l92_supplies,
+               .num_parent_supplies = ARRAY_SIZE(cs47l92_supplies),
+       },
+};
+
+
 const char *madera_name_from_type(enum madera_type type)
 {
        switch (type) {
@@ -124,6 +145,10 @@ const char *madera_name_from_type(enum madera_type type)
                return "CS47L90";
        case CS47L91:
                return "CS47L91";
+       case CS47L92:
+               return "CS47L92";
+       case CS47L93:
+               return "CS47L93";
        case WM1840:
                return "WM1840";
        default:
@@ -278,6 +303,8 @@ unsigned int madera_get_num_micbias(struct madera *madera)
                return 4;
        case CS47L90:
        case CS47L91:
+       case CS47L92:
+       case CS47L93:
                return 2;
        default:
                dev_warn(madera->dev, "No micbias known for codec %s\n",
@@ -304,6 +331,20 @@ unsigned int madera_get_num_childbias(struct madera *madera,
        case CS47L90:
        case CS47L91:
                return 4;
+       case CS47L92:
+       case CS47L93:
+               switch (micbias) {
+               case 1:
+                       return 4;
+               case 2:
+                       return 2;
+               default:
+                       dev_warn(madera->dev,
+                                "No child micbias for codec %s, micbias %u\n",
+                                madera_name_from_type(madera->type),
+                                micbias);
+                       return 0;
+               }
        default:
                dev_warn(madera->dev, "No child micbias known for codec %s\n",
                         madera_name_from_type(madera->type));
@@ -318,6 +359,8 @@ const struct of_device_id madera_of_match[] = {
        { .compatible = "cirrus,cs47l85", .data = (void *)CS47L85 },
        { .compatible = "cirrus,cs47l90", .data = (void *)CS47L90 },
        { .compatible = "cirrus,cs47l91", .data = (void *)CS47L91 },
+       { .compatible = "cirrus,cs47l92", .data = (void *)CS47L92 },
+       { .compatible = "cirrus,cs47l93", .data = (void *)CS47L93 },
        { .compatible = "cirrus,wm1840", .data = (void *)WM1840 },
        {},
 };
@@ -547,6 +590,8 @@ int madera_dev_init(struct madera *madera)
        case CS47L35:
        case CS47L90:
        case CS47L91:
+       case CS47L92:
+       case CS47L93:
                break;
        case CS47L85:
        case WM1840:
@@ -617,6 +662,7 @@ int madera_dev_init(struct madera *madera)
        case CS47L35_SILICON_ID:
        case CS47L85_SILICON_ID:
        case CS47L90_SILICON_ID:
+       case CS47L92_SILICON_ID:
                break;
        default:
                dev_err(madera->dev, "Unknown device ID: %x\n", hwid);
@@ -689,6 +735,20 @@ int madera_dev_init(struct madera *madera)
                        }
                }
                break;
+       case CS47L92_SILICON_ID:
+               if (IS_ENABLED(CONFIG_MFD_CS47L92)) {
+                       switch (madera->type) {
+                       case CS47L92:
+                       case CS47L93:
+                               patch_fn = cs47l92_patch;
+                               mfd_devs = cs47l92_devs;
+                               n_devs = ARRAY_SIZE(cs47l92_devs);
+                               break;
+                       default:
+                               break;
+                       }
+               }
+               break;
        default:
                break;
        }
index 20e4cd45826a12eccb3e1b91eb8fae87602ee6a4..37708bcfd697d704a2ddb94c04f9bdcd9c651234 100644 (file)
@@ -54,6 +54,13 @@ static int madera_i2c_probe(struct i2c_client *i2c,
                        regmap_32bit_config = &cs47l90_32bit_i2c_regmap;
                }
                break;
+       case CS47L92:
+       case CS47L93:
+               if (IS_ENABLED(CONFIG_MFD_CS47L92)) {
+                       regmap_16bit_config = &cs47l92_16bit_i2c_regmap;
+                       regmap_32bit_config = &cs47l92_32bit_i2c_regmap;
+               }
+               break;
        default:
                dev_err(&i2c->dev,
                        "Unknown Madera I2C device type %ld\n", type);
@@ -108,6 +115,8 @@ static const struct i2c_device_id madera_i2c_id[] = {
        { "cs47l85", CS47L85 },
        { "cs47l90", CS47L90 },
        { "cs47l91", CS47L91 },
+       { "cs47l92", CS47L92 },
+       { "cs47l93", CS47L93 },
        { "wm1840", WM1840 },
        { }
 };
index 375bb367d6d8aba661229ff95dbd1066a8de9ab3..41f8d9eebe29ecf8f613666fff9a53f5cce3b75a 100644 (file)
@@ -54,6 +54,13 @@ static int madera_spi_probe(struct spi_device *spi)
                        regmap_32bit_config = &cs47l90_32bit_spi_regmap;
                }
                break;
+       case CS47L92:
+       case CS47L93:
+               if (IS_ENABLED(CONFIG_MFD_CS47L92)) {
+                       regmap_16bit_config = &cs47l92_16bit_spi_regmap;
+                       regmap_32bit_config = &cs47l92_32bit_spi_regmap;
+               }
+               break;
        default:
                dev_err(&spi->dev,
                        "Unknown Madera SPI device type %ld\n", type);
@@ -108,6 +115,8 @@ static const struct spi_device_id madera_spi_ids[] = {
        { "cs47l85", CS47L85 },
        { "cs47l90", CS47L90 },
        { "cs47l91", CS47L91 },
+       { "cs47l92", CS47L92 },
+       { "cs47l93", CS47L93 },
        { "wm1840", WM1840 },
        { },
 };
index 6d1b5b81c1456440defb0d57fb9da0bca7758023..9a481747afd47acc3c37342316444d505f4aa47a 100644 (file)
@@ -49,4 +49,10 @@ extern const struct regmap_config cs47l90_16bit_i2c_regmap;
 extern const struct regmap_config cs47l90_32bit_i2c_regmap;
 int cs47l90_patch(struct madera *madera);
 
+extern const struct regmap_config cs47l92_16bit_spi_regmap;
+extern const struct regmap_config cs47l92_32bit_spi_regmap;
+extern const struct regmap_config cs47l92_16bit_i2c_regmap;
+extern const struct regmap_config cs47l92_32bit_i2c_regmap;
+int cs47l92_patch(struct madera *madera);
+
 #endif
index 268ec4f1786780981560d40ad3e6cb068e869e1c..af58820748506c8ed7fa1249923fb59380a999ec 100644 (file)
@@ -36,6 +36,7 @@ enum madera_type {
 #define CS47L35_NUM_GPIOS              16
 #define CS47L85_NUM_GPIOS              40
 #define CS47L90_NUM_GPIOS              38
+#define CS47L92_NUM_GPIOS              16
 
 
 /* Notifier events */