Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Richard Fitzgerald and committed by
Linus Walleij
b0bca3e4 f134b851

+51
+3
drivers/pinctrl/cirrus/Kconfig
··· 15 15 select PINMUX 16 16 select GENERIC_PINCONF 17 17 18 + config PINCTRL_CS47L15 19 + bool 20 + 18 21 config PINCTRL_CS47L35 19 22 bool 20 23
+3
drivers/pinctrl/cirrus/Makefile
··· 3 3 obj-$(CONFIG_PINCTRL_LOCHNAGAR) += pinctrl-lochnagar.o 4 4 5 5 pinctrl-madera-objs := pinctrl-madera-core.o 6 + ifeq ($(CONFIG_PINCTRL_CS47L15),y) 7 + pinctrl-madera-objs += pinctrl-cs47l15.o 8 + endif 6 9 ifeq ($(CONFIG_PINCTRL_CS47L35),y) 7 10 pinctrl-madera-objs += pinctrl-cs47l35.o 8 11 endif
+40
drivers/pinctrl/cirrus/pinctrl-cs47l15.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Pinctrl for Cirrus Logic CS47L15 4 + * 5 + * Copyright (C) 2018-2019 Cirrus Logic, Inc. and 6 + * Cirrus Logic International Semiconductor Ltd. 7 + */ 8 + 9 + #include <linux/err.h> 10 + #include <linux/mfd/madera/core.h> 11 + 12 + #include "pinctrl-madera.h" 13 + 14 + /* 15 + * The alt func groups are the most commonly used functions we place these at 16 + * the lower function indexes for convenience, and the less commonly used gpio 17 + * functions at higher indexes. 18 + * 19 + * To stay consistent with the datasheet the function names are the same as 20 + * the group names for that function's pins 21 + * 22 + * Note - all 1 less than in datasheet because these are zero-indexed 23 + */ 24 + static const unsigned int cs47l15_aif1_pins[] = { 0, 1, 2, 3 }; 25 + static const unsigned int cs47l15_aif2_pins[] = { 4, 5, 6, 7 }; 26 + static const unsigned int cs47l15_aif3_pins[] = { 8, 9, 10, 11 }; 27 + static const unsigned int cs47l15_spk1_pins[] = { 12, 13, 14 }; 28 + 29 + static const struct madera_pin_groups cs47l15_pin_groups[] = { 30 + { "aif1", cs47l15_aif1_pins, ARRAY_SIZE(cs47l15_aif1_pins) }, 31 + { "aif2", cs47l15_aif2_pins, ARRAY_SIZE(cs47l15_aif2_pins) }, 32 + { "aif3", cs47l15_aif3_pins, ARRAY_SIZE(cs47l15_aif3_pins) }, 33 + { "pdmspk1", cs47l15_spk1_pins, ARRAY_SIZE(cs47l15_spk1_pins) }, 34 + }; 35 + 36 + const struct madera_pin_chip cs47l15_pin_chip = { 37 + .n_pins = CS47L15_NUM_GPIOS, 38 + .pin_groups = cs47l15_pin_groups, 39 + .n_pin_groups = ARRAY_SIZE(cs47l15_pin_groups), 40 + };
+4
drivers/pinctrl/cirrus/pinctrl-madera-core.c
··· 1004 1004 pdev->dev.of_node = madera->dev->of_node; 1005 1005 1006 1006 switch (madera->type) { 1007 + case CS47L15: 1008 + if (IS_ENABLED(CONFIG_PINCTRL_CS47L15)) 1009 + priv->chip = &cs47l15_pin_chip; 1010 + break; 1007 1011 case CS47L35: 1008 1012 if (IS_ENABLED(CONFIG_PINCTRL_CS47L35)) 1009 1013 priv->chip = &cs47l35_pin_chip;
+1
drivers/pinctrl/cirrus/pinctrl-madera.h
··· 30 30 struct pinctrl_dev *pctl; 31 31 }; 32 32 33 + extern const struct madera_pin_chip cs47l15_pin_chip; 33 34 extern const struct madera_pin_chip cs47l35_pin_chip; 34 35 extern const struct madera_pin_chip cs47l85_pin_chip; 35 36 extern const struct madera_pin_chip cs47l90_pin_chip;