xref: /linux/drivers/pinctrl/cirrus/pinctrl-cs47l35.c (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
1*4cb8df37SCharles Keepax // SPDX-License-Identifier: GPL-2.0-only
2218d72a7SRichard Fitzgerald /*
3218d72a7SRichard Fitzgerald  * Pinctrl for Cirrus Logic CS47L35
4218d72a7SRichard Fitzgerald  *
5218d72a7SRichard Fitzgerald  * Copyright (C) 2016-2017 Cirrus Logic
6218d72a7SRichard Fitzgerald  */
7218d72a7SRichard Fitzgerald 
8218d72a7SRichard Fitzgerald #include <linux/err.h>
9218d72a7SRichard Fitzgerald #include <linux/mfd/madera/core.h>
10218d72a7SRichard Fitzgerald 
11218d72a7SRichard Fitzgerald #include "pinctrl-madera.h"
12218d72a7SRichard Fitzgerald 
13218d72a7SRichard Fitzgerald /*
14218d72a7SRichard Fitzgerald  * The alt func groups are the most commonly used functions we place these at
15218d72a7SRichard Fitzgerald  * the lower function indexes for convenience, and the less commonly used gpio
16218d72a7SRichard Fitzgerald  * functions at higher indexes.
17218d72a7SRichard Fitzgerald  *
18218d72a7SRichard Fitzgerald  * To stay consistent with the datasheet the function names are the same as
19218d72a7SRichard Fitzgerald  * the group names for that function's pins
20218d72a7SRichard Fitzgerald  *
21218d72a7SRichard Fitzgerald  * Note - all 1 less than in datasheet because these are zero-indexed
22218d72a7SRichard Fitzgerald  */
23218d72a7SRichard Fitzgerald static const unsigned int cs47l35_aif3_pins[] = { 0, 1, 2, 3 };
24218d72a7SRichard Fitzgerald static const unsigned int cs47l35_spk_pins[] = { 4, 5 };
25218d72a7SRichard Fitzgerald static const unsigned int cs47l35_aif1_pins[] = { 7, 8, 9, 10 };
26218d72a7SRichard Fitzgerald static const unsigned int cs47l35_aif2_pins[] = { 11, 12, 13, 14 };
27218d72a7SRichard Fitzgerald static const unsigned int cs47l35_mif1_pins[] = { 6, 15 };
28218d72a7SRichard Fitzgerald 
29218d72a7SRichard Fitzgerald static const struct madera_pin_groups cs47l35_pin_groups[] = {
30218d72a7SRichard Fitzgerald 	{ "aif1", cs47l35_aif1_pins, ARRAY_SIZE(cs47l35_aif1_pins) },
31218d72a7SRichard Fitzgerald 	{ "aif2", cs47l35_aif2_pins, ARRAY_SIZE(cs47l35_aif2_pins) },
32218d72a7SRichard Fitzgerald 	{ "aif3", cs47l35_aif3_pins, ARRAY_SIZE(cs47l35_aif3_pins) },
33218d72a7SRichard Fitzgerald 	{ "mif1", cs47l35_mif1_pins, ARRAY_SIZE(cs47l35_mif1_pins) },
34218d72a7SRichard Fitzgerald 	{ "pdmspk1", cs47l35_spk_pins, ARRAY_SIZE(cs47l35_spk_pins) },
35218d72a7SRichard Fitzgerald };
36218d72a7SRichard Fitzgerald 
37218d72a7SRichard Fitzgerald const struct madera_pin_chip cs47l35_pin_chip = {
38218d72a7SRichard Fitzgerald 	.n_pins = CS47L35_NUM_GPIOS,
39218d72a7SRichard Fitzgerald 	.pin_groups = cs47l35_pin_groups,
40218d72a7SRichard Fitzgerald 	.n_pin_groups = ARRAY_SIZE(cs47l35_pin_groups),
41218d72a7SRichard Fitzgerald };
42