diff options
author | Richard Fitzgerald <rf@opensource.cirrus.com> | 2019-07-22 12:10:14 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2019-08-05 12:47:14 +0300 |
commit | b0bca3e4ee934a3f06e6ddb4337c679f54575009 (patch) | |
tree | 125ba4cf97ad64934fc0f2090a63d68768c89f02 | |
parent | f134b8517736bddc52955fef08e70bde7d408c0b (diff) | |
download | linux-b0bca3e4ee934a3f06e6ddb4337c679f54575009.tar.xz |
pinctrl: madera: Add configuration for Cirrus Logic CS47L15
This adds the pinctrl configuration for the CS47L15 codec to
the madera pinctrl driver.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20190722091015.20884-2-ckeepax@opensource.cirrus.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/cirrus/Kconfig | 3 | ||||
-rw-r--r-- | drivers/pinctrl/cirrus/Makefile | 3 | ||||
-rw-r--r-- | drivers/pinctrl/cirrus/pinctrl-cs47l15.c | 40 | ||||
-rw-r--r-- | drivers/pinctrl/cirrus/pinctrl-madera-core.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/cirrus/pinctrl-madera.h | 1 |
5 files changed, 51 insertions, 0 deletions
diff --git a/drivers/pinctrl/cirrus/Kconfig b/drivers/pinctrl/cirrus/Kconfig index e546a6b75b4d..ef01a0b06273 100644 --- a/drivers/pinctrl/cirrus/Kconfig +++ b/drivers/pinctrl/cirrus/Kconfig @@ -15,6 +15,9 @@ config PINCTRL_MADERA select PINMUX select GENERIC_PINCONF +config PINCTRL_CS47L15 + bool + config PINCTRL_CS47L35 bool diff --git a/drivers/pinctrl/cirrus/Makefile b/drivers/pinctrl/cirrus/Makefile index 0c5deb62153e..491bcb658d8e 100644 --- a/drivers/pinctrl/cirrus/Makefile +++ b/drivers/pinctrl/cirrus/Makefile @@ -3,6 +3,9 @@ obj-$(CONFIG_PINCTRL_LOCHNAGAR) += pinctrl-lochnagar.o pinctrl-madera-objs := pinctrl-madera-core.o +ifeq ($(CONFIG_PINCTRL_CS47L15),y) +pinctrl-madera-objs += pinctrl-cs47l15.o +endif ifeq ($(CONFIG_PINCTRL_CS47L35),y) pinctrl-madera-objs += pinctrl-cs47l35.o endif diff --git a/drivers/pinctrl/cirrus/pinctrl-cs47l15.c b/drivers/pinctrl/cirrus/pinctrl-cs47l15.c new file mode 100644 index 000000000000..a4bfec5281d0 --- /dev/null +++ b/drivers/pinctrl/cirrus/pinctrl-cs47l15.c @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Pinctrl for Cirrus Logic CS47L15 + * + * Copyright (C) 2018-2019 Cirrus Logic, Inc. and + * Cirrus Logic International Semiconductor Ltd. + */ + +#include <linux/err.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), +}; diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c index 0c7fa1febc80..64281ad5c1b9 100644 --- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c +++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c @@ -1004,6 +1004,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; diff --git a/drivers/pinctrl/cirrus/pinctrl-madera.h b/drivers/pinctrl/cirrus/pinctrl-madera.h index 4ae13918316f..a10f0238dd92 100644 --- a/drivers/pinctrl/cirrus/pinctrl-madera.h +++ b/drivers/pinctrl/cirrus/pinctrl-madera.h @@ -30,6 +30,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; |