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