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