pinctrl: madera: Add support for cs47l15
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Fri, 2 Mar 2018 11:19:44 +0000 (11:19 +0000)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:28 +0000 (20:22 +0300)
Change-Id: I75bfd5405cb5f9c3f2acdf8302ed933a067a74ff
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
drivers/pinctrl/cirrus/Kconfig
drivers/pinctrl/cirrus/Makefile
drivers/pinctrl/cirrus/pinctrl-cs47l15.c [new file with mode: 0644]
drivers/pinctrl/cirrus/pinctrl-madera.c
drivers/pinctrl/cirrus/pinctrl-madera.h

index 20c437521f5cd6ab03bf56a7ea5648771b6f71b8..5c5510a6ce004c43078b37d7cc7e612f20bde14a 100644 (file)
@@ -4,6 +4,9 @@ config PINCTRL_MADERA
        select GENERIC_PINCONF
        default y if MFD_MADERA=y
 
+config PINCTRL_CS47L15
+       bool
+
 config PINCTRL_CS47L35
        bool
 
index f5b973b77c8defffce242ee1d664d7b640a6a1ba..c1f9b0502bb002c15e32061e16c4e385ca45f333 100644 (file)
@@ -1,5 +1,8 @@
 # Cirrus Logic pinctrl drivers
 obj-$(CONFIG_PINCTRL_MADERA)   += pinctrl-madera.o
+ifeq ($(CONFIG_PINCTRL_CS47L15),y)
+obj-$(CONFIG_PINCTRL_MADERA)   += pinctrl-cs47l15.o
+endif
 ifeq ($(CONFIG_PINCTRL_CS47L35),y)
 obj-$(CONFIG_PINCTRL_MADERA)   += pinctrl-cs47l35.o
 endif
diff --git a/drivers/pinctrl/cirrus/pinctrl-cs47l15.c b/drivers/pinctrl/cirrus/pinctrl-cs47l15.c
new file mode 100644 (file)
index 0000000..069b037
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Pinctrl for Cirrus Logic CS47L15
+ *
+ * Copyright 2018 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 cs47l15_aif1_pins[] = { 0, 1, 2, 3 };
+static const unsigned int cs47l15_aif2_pins[] = { 4, 5, 6, 7 };
+static const unsigned int cs47l15_aif3_pins[] = { 8, 9, 10, 11 };
+static const unsigned int cs47l15_spk1_pins[] = { 12, 13, 14 };
+
+static const struct madera_pin_groups cs47l15_pin_groups[] = {
+       { "aif1", cs47l15_aif1_pins, ARRAY_SIZE(cs47l15_aif1_pins) },
+       { "aif2", cs47l15_aif2_pins, ARRAY_SIZE(cs47l15_aif2_pins) },
+       { "aif3", cs47l15_aif3_pins, ARRAY_SIZE(cs47l15_aif3_pins) },
+       { "pdmspk1", cs47l15_spk1_pins, ARRAY_SIZE(cs47l15_spk1_pins) },
+};
+
+const struct madera_pin_chip cs47l15_pin_chip = {
+       .n_pins = CS47L15_NUM_GPIOS,
+       .pin_groups = cs47l15_pin_groups,
+       .n_pin_groups = ARRAY_SIZE(cs47l15_pin_groups),
+};
index 451d4df9d415a76d4d64e3fc73c0e4da87209fa8..1869d58e130cdf204d0969e1bde48c7c923b1f58 100644 (file)
@@ -1014,6 +1014,10 @@ static int madera_pin_probe(struct platform_device *pdev)
        pdev->dev.of_node = madera->dev->of_node;
 
        switch (madera->type) {
+       case CS47L15:
+               if (IS_ENABLED(CONFIG_PINCTRL_CS47L15))
+                       priv->chip = &cs47l15_pin_chip;
+               break;
        case CS47L35:
                if (IS_ENABLED(CONFIG_PINCTRL_CS47L35))
                        priv->chip = &cs47l35_pin_chip;
index 21aacd544e23cd30a73366c3453a52177f4cccb9..1d6c954f67dda4645a3b2ad4e5ed74c63bcdc29d 100644 (file)
@@ -33,6 +33,7 @@ struct madera_pin_private {
        struct pinctrl_dev *pctl;
 };
 
+extern const struct madera_pin_chip cs47l15_pin_chip;
 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;