xref: /openbmc/linux/drivers/pinctrl/cirrus/pinctrl-cs47l92.c (revision 976e3645923bdd2fe7893aae33fd7a21098bfb28)
1*a1db8da7SCharles Keepax // SPDX-License-Identifier: GPL-2.0-only
2*a1db8da7SCharles Keepax /*
3*a1db8da7SCharles Keepax  * Pinctrl for Cirrus Logic CS47L92
4*a1db8da7SCharles Keepax  *
5*a1db8da7SCharles Keepax  * Copyright (C) 2018-2019 Cirrus Logic, Inc. and
6*a1db8da7SCharles Keepax  *                         Cirrus Logic International Semiconductor Ltd.
7*a1db8da7SCharles Keepax  */
8*a1db8da7SCharles Keepax 
9*a1db8da7SCharles Keepax #include <linux/err.h>
10*a1db8da7SCharles Keepax #include <linux/mfd/madera/core.h>
11*a1db8da7SCharles Keepax 
12*a1db8da7SCharles Keepax #include "pinctrl-madera.h"
13*a1db8da7SCharles Keepax 
14*a1db8da7SCharles Keepax /*
15*a1db8da7SCharles Keepax  * The alt func groups are the most commonly used functions we place these at
16*a1db8da7SCharles Keepax  * the lower function indexes for convenience, and the less commonly used gpio
17*a1db8da7SCharles Keepax  * functions at higher indexes.
18*a1db8da7SCharles Keepax  *
19*a1db8da7SCharles Keepax  * To stay consistent with the datasheet the function names are the same as
20*a1db8da7SCharles Keepax  * the group names for that function's pins
21*a1db8da7SCharles Keepax  *
22*a1db8da7SCharles Keepax  * Note - all 1 less than in datasheet because these are zero-indexed
23*a1db8da7SCharles Keepax  */
24*a1db8da7SCharles Keepax static const unsigned int cs47l92_spk1_pins[] = { 2, 3 };
25*a1db8da7SCharles Keepax static const unsigned int cs47l92_aif1_pins[] = { 4, 5, 6, 7 };
26*a1db8da7SCharles Keepax static const unsigned int cs47l92_aif2_pins[] = { 8, 9, 10, 11 };
27*a1db8da7SCharles Keepax static const unsigned int cs47l92_aif3_pins[] = { 12, 13, 14, 15 };
28*a1db8da7SCharles Keepax 
29*a1db8da7SCharles Keepax static const struct madera_pin_groups cs47l92_pin_groups[] = {
30*a1db8da7SCharles Keepax 	{ "aif1", cs47l92_aif1_pins, ARRAY_SIZE(cs47l92_aif1_pins) },
31*a1db8da7SCharles Keepax 	{ "aif2", cs47l92_aif2_pins, ARRAY_SIZE(cs47l92_aif2_pins) },
32*a1db8da7SCharles Keepax 	{ "aif3", cs47l92_aif3_pins, ARRAY_SIZE(cs47l92_aif3_pins) },
33*a1db8da7SCharles Keepax 	{ "pdmspk1", cs47l92_spk1_pins, ARRAY_SIZE(cs47l92_spk1_pins) },
34*a1db8da7SCharles Keepax };
35*a1db8da7SCharles Keepax 
36*a1db8da7SCharles Keepax const struct madera_pin_chip cs47l92_pin_chip = {
37*a1db8da7SCharles Keepax 	.n_pins = CS47L92_NUM_GPIOS,
38*a1db8da7SCharles Keepax 	.pin_groups = cs47l92_pin_groups,
39*a1db8da7SCharles Keepax 	.n_pin_groups = ARRAY_SIZE(cs47l92_pin_groups),
40*a1db8da7SCharles Keepax };
41