pinctrl: madera: Add support for CS47L92/CS47L93
authorStuart Henderson <stuarth@opensource.wolfsonmicro.com>
Fri, 21 Apr 2017 16:27:04 +0000 (17:27 +0100)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:26 +0000 (20:22 +0300)
Change-Id: If672f6bf4924fb3e9d15e91442dfc3348542533c
Signed-off-by: Stuart Henderson <stuarth@opensource.wolfsonmicro.com>
drivers/pinctrl/cirrus/Kconfig
drivers/pinctrl/cirrus/Makefile
drivers/pinctrl/cirrus/pinctrl-cs47l92.c [new file with mode: 0644]
drivers/pinctrl/cirrus/pinctrl-madera.c
drivers/pinctrl/cirrus/pinctrl-madera.h

index 093527eaf2eb177509b27468e3404a339c83061a..20c437521f5cd6ab03bf56a7ea5648771b6f71b8 100644 (file)
@@ -13,3 +13,5 @@ config PINCTRL_CS47L85
 config PINCTRL_CS47L90
        bool
 
+config PINCTRL_CS47L92
+       bool
index 49d50f0e9b75c56d8e8e7e069d75b9e9244a93a0..f5b973b77c8defffce242ee1d664d7b640a6a1ba 100644 (file)
@@ -9,4 +9,7 @@ endif
 ifeq ($(CONFIG_PINCTRL_CS47L90),y)
 obj-$(CONFIG_PINCTRL_MADERA)   += pinctrl-cs47l90.o
 endif
+ifeq ($(CONFIG_PINCTRL_CS47L92),y)
+obj-$(CONFIG_PINCTRL_MADERA)   += pinctrl-cs47l92.o
+endif
 
diff --git a/drivers/pinctrl/cirrus/pinctrl-cs47l92.c b/drivers/pinctrl/cirrus/pinctrl-cs47l92.c
new file mode 100644 (file)
index 0000000..8a4295d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Pinctrl for Cirrus Logic CS47L92
+ *
+ * Copyright 2016-2017 Cirrus Logic
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/err.h>
+#include <linux/module.h>
+
+#include <linux/mfd/madera/core.h>
+
+#include "pinctrl-madera.h"
+
+/*
+ * The alt func groups are the most commonly used functions we place these at
+ * the lower function indexes for convenience, and the less commonly used gpio
+ * functions at higher indexes.
+ *
+ * To stay consistent with the datasheet the function names are the same as
+ * the group names for that function's pins
+ *
+ * Note - all 1 less than in datasheet because these are zero-indexed
+ */
+static const unsigned int cs47l92_spk1_pins[] = { 2, 3 };
+static const unsigned int cs47l92_aif1_pins[] = { 4, 5, 6, 7 };
+static const unsigned int cs47l92_aif2_pins[] = { 8, 9, 10, 11 };
+static const unsigned int cs47l92_aif3_pins[] = { 12, 13, 14, 15 };
+
+static const struct madera_pin_groups cs47l92_pin_groups[] = {
+       { "pdmspk1", cs47l92_spk1_pins, ARRAY_SIZE(cs47l92_spk1_pins) },
+       { "aif1", cs47l92_aif1_pins, ARRAY_SIZE(cs47l92_aif1_pins) },
+       { "aif2", cs47l92_aif2_pins, ARRAY_SIZE(cs47l92_aif2_pins) },
+       { "aif3", cs47l92_aif3_pins, ARRAY_SIZE(cs47l92_aif3_pins) },
+};
+
+const struct madera_pin_chip cs47l92_pin_chip = {
+       .n_pins = CS47L92_NUM_GPIOS,
+       .pin_groups = cs47l92_pin_groups,
+       .n_pin_groups = ARRAY_SIZE(cs47l92_pin_groups),
+};
+
index 38880ebb991534f27dccee64ed757a8aa755037b..451d4df9d415a76d4d64e3fc73c0e4da87209fa8 100644 (file)
@@ -398,6 +398,16 @@ static const struct {
                .group_names = madera_pin_single_group_names,
                .func = 0x157
        },
+       {
+               .name = "aux-pdm-clk",
+               .group_names = madera_pin_single_group_names,
+               .func = 0x280
+       },
+       {
+               .name = "aux-pdm-dat",
+               .group_names = madera_pin_single_group_names,
+               .func = 0x281
+       },
 };
 
 static u16 madera_pin_make_drv_str(struct madera_pin_private *priv,
@@ -1018,6 +1028,11 @@ static int madera_pin_probe(struct platform_device *pdev)
                if (IS_ENABLED(CONFIG_PINCTRL_CS47L90))
                        priv->chip = &cs47l90_pin_chip;
                break;
+       case CS47L92:
+       case CS47L93:
+               if (IS_ENABLED(CONFIG_PINCTRL_CS47L92))
+                       priv->chip = &cs47l92_pin_chip;
+               break;
        default:
                break;
        }
index 1991dfdffb7c7c6554c798fba973f9bb6702873c..21aacd544e23cd30a73366c3453a52177f4cccb9 100644 (file)
@@ -36,6 +36,7 @@ struct madera_pin_private {
 extern const struct madera_pin_chip cs47l35_pin_chip;
 extern const struct madera_pin_chip cs47l85_pin_chip;
 extern const struct madera_pin_chip cs47l90_pin_chip;
+extern const struct madera_pin_chip cs47l92_pin_chip;
 
 #endif