18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Pinctrl for Cirrus Logic CS47L92
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2018-2019 Cirrus Logic, Inc. and
68c2ecf20Sopenharmony_ci *                         Cirrus Logic International Semiconductor Ltd.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/err.h>
108c2ecf20Sopenharmony_ci#include <linux/mfd/madera/core.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include "pinctrl-madera.h"
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/*
158c2ecf20Sopenharmony_ci * The alt func groups are the most commonly used functions we place these at
168c2ecf20Sopenharmony_ci * the lower function indexes for convenience, and the less commonly used gpio
178c2ecf20Sopenharmony_ci * functions at higher indexes.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * To stay consistent with the datasheet the function names are the same as
208c2ecf20Sopenharmony_ci * the group names for that function's pins
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Note - all 1 less than in datasheet because these are zero-indexed
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_cistatic const unsigned int cs47l92_spk1_pins[] = { 2, 3 };
258c2ecf20Sopenharmony_cistatic const unsigned int cs47l92_aif1_pins[] = { 4, 5, 6, 7 };
268c2ecf20Sopenharmony_cistatic const unsigned int cs47l92_aif2_pins[] = { 8, 9, 10, 11 };
278c2ecf20Sopenharmony_cistatic const unsigned int cs47l92_aif3_pins[] = { 12, 13, 14, 15 };
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic const struct madera_pin_groups cs47l92_pin_groups[] = {
308c2ecf20Sopenharmony_ci	{ "aif1", cs47l92_aif1_pins, ARRAY_SIZE(cs47l92_aif1_pins) },
318c2ecf20Sopenharmony_ci	{ "aif2", cs47l92_aif2_pins, ARRAY_SIZE(cs47l92_aif2_pins) },
328c2ecf20Sopenharmony_ci	{ "aif3", cs47l92_aif3_pins, ARRAY_SIZE(cs47l92_aif3_pins) },
338c2ecf20Sopenharmony_ci	{ "pdmspk1", cs47l92_spk1_pins, ARRAY_SIZE(cs47l92_spk1_pins) },
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciconst struct madera_pin_chip cs47l92_pin_chip = {
378c2ecf20Sopenharmony_ci	.n_pins = CS47L92_NUM_GPIOS,
388c2ecf20Sopenharmony_ci	.pin_groups = cs47l92_pin_groups,
398c2ecf20Sopenharmony_ci	.n_pin_groups = ARRAY_SIZE(cs47l92_pin_groups),
408c2ecf20Sopenharmony_ci};
41