From: Charles Keepax Date: Mon, 22 Jul 2019 09:10:15 +0000 (+0100) Subject: pinctrl: madera: Add configuration for Cirrus Logic CS47L92 X-Git-Tag: v5.15~5482^2~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1db8da7c28131ceb3200732e429eb9d30ce5929;p=platform%2Fkernel%2Flinux-starfive.git pinctrl: madera: Add configuration for Cirrus Logic CS47L92 This adds the pinctrl configuration for the CS47L92 codec to the madera pinctrl driver. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20190722091015.20884-3-ckeepax@opensource.cirrus.com Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/cirrus/Kconfig b/drivers/pinctrl/cirrus/Kconfig index ef01a0b..f1806fd 100644 --- a/drivers/pinctrl/cirrus/Kconfig +++ b/drivers/pinctrl/cirrus/Kconfig @@ -26,3 +26,6 @@ config PINCTRL_CS47L85 config PINCTRL_CS47L90 bool + +config PINCTRL_CS47L92 + bool diff --git a/drivers/pinctrl/cirrus/Makefile b/drivers/pinctrl/cirrus/Makefile index 491bcb6..a484518 100644 --- a/drivers/pinctrl/cirrus/Makefile +++ b/drivers/pinctrl/cirrus/Makefile @@ -15,5 +15,8 @@ endif ifeq ($(CONFIG_PINCTRL_CS47L90),y) pinctrl-madera-objs += pinctrl-cs47l90.o endif +ifeq ($(CONFIG_PINCTRL_CS47L92),y) +pinctrl-madera-objs += pinctrl-cs47l92.o +endif obj-$(CONFIG_PINCTRL_MADERA) += pinctrl-madera.o diff --git a/drivers/pinctrl/cirrus/pinctrl-cs47l92.c b/drivers/pinctrl/cirrus/pinctrl-cs47l92.c new file mode 100644 index 0000000..4e40973 --- /dev/null +++ b/drivers/pinctrl/cirrus/pinctrl-cs47l92.c @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Pinctrl for Cirrus Logic CS47L92 + * + * Copyright (C) 2018-2019 Cirrus Logic, Inc. and + * Cirrus Logic International Semiconductor Ltd. + */ + +#include +#include + +#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[] = { + { "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) }, + { "pdmspk1", cs47l92_spk1_pins, ARRAY_SIZE(cs47l92_spk1_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), +}; diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c index 64281ad..e2f72dc 100644 --- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c +++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c @@ -396,6 +396,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, @@ -1022,6 +1032,12 @@ static int madera_pin_probe(struct platform_device *pdev) if (IS_ENABLED(CONFIG_PINCTRL_CS47L90)) priv->chip = &cs47l90_pin_chip; break; + case CS42L92: + case CS47L92: + case CS47L93: + if (IS_ENABLED(CONFIG_PINCTRL_CS47L92)) + priv->chip = &cs47l92_pin_chip; + break; default: break; } diff --git a/drivers/pinctrl/cirrus/pinctrl-madera.h b/drivers/pinctrl/cirrus/pinctrl-madera.h index a10f023..c16a4dc 100644 --- a/drivers/pinctrl/cirrus/pinctrl-madera.h +++ b/drivers/pinctrl/cirrus/pinctrl-madera.h @@ -34,5 +34,6 @@ 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; +extern const struct madera_pin_chip cs47l92_pin_chip; #endif