xref: /linux/drivers/pinctrl/cirrus/pinctrl-cs47l35.c (revision e9f0878c4b2004ac19581274c1ae4c61ae3ca70e)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Pinctrl for Cirrus Logic CS47L35
4  *
5  * Copyright (C) 2016-2017 Cirrus Logic
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by the
9  * Free Software Foundation; version 2.
10  */
11 
12 #include <linux/err.h>
13 #include <linux/mfd/madera/core.h>
14 
15 #include "pinctrl-madera.h"
16 
17 /*
18  * The alt func groups are the most commonly used functions we place these at
19  * the lower function indexes for convenience, and the less commonly used gpio
20  * functions at higher indexes.
21  *
22  * To stay consistent with the datasheet the function names are the same as
23  * the group names for that function's pins
24  *
25  * Note - all 1 less than in datasheet because these are zero-indexed
26  */
27 static const unsigned int cs47l35_aif3_pins[] = { 0, 1, 2, 3 };
28 static const unsigned int cs47l35_spk_pins[] = { 4, 5 };
29 static const unsigned int cs47l35_aif1_pins[] = { 7, 8, 9, 10 };
30 static const unsigned int cs47l35_aif2_pins[] = { 11, 12, 13, 14 };
31 static const unsigned int cs47l35_mif1_pins[] = { 6, 15 };
32 
33 static const struct madera_pin_groups cs47l35_pin_groups[] = {
34 	{ "aif1", cs47l35_aif1_pins, ARRAY_SIZE(cs47l35_aif1_pins) },
35 	{ "aif2", cs47l35_aif2_pins, ARRAY_SIZE(cs47l35_aif2_pins) },
36 	{ "aif3", cs47l35_aif3_pins, ARRAY_SIZE(cs47l35_aif3_pins) },
37 	{ "mif1", cs47l35_mif1_pins, ARRAY_SIZE(cs47l35_mif1_pins) },
38 	{ "pdmspk1", cs47l35_spk_pins, ARRAY_SIZE(cs47l35_spk_pins) },
39 };
40 
41 const struct madera_pin_chip cs47l35_pin_chip = {
42 	.n_pins = CS47L35_NUM_GPIOS,
43 	.pin_groups = cs47l35_pin_groups,
44 	.n_pin_groups = ARRAY_SIZE(cs47l35_pin_groups),
45 };
46