^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Pinctrl for Cirrus Logic CS47L15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2018-2019 Cirrus Logic, Inc. and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Cirrus Logic International Semiconductor Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/mfd/madera/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "pinctrl-madera.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * The alt func groups are the most commonly used functions we place these at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * the lower function indexes for convenience, and the less commonly used gpio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * functions at higher indexes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * To stay consistent with the datasheet the function names are the same as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * the group names for that function's pins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * Note - all 1 less than in datasheet because these are zero-indexed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) static const unsigned int cs47l15_aif1_pins[] = { 0, 1, 2, 3 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static const unsigned int cs47l15_aif2_pins[] = { 4, 5, 6, 7 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static const unsigned int cs47l15_aif3_pins[] = { 8, 9, 10, 11 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static const unsigned int cs47l15_spk1_pins[] = { 12, 13, 14 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static const struct madera_pin_groups cs47l15_pin_groups[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) { "aif1", cs47l15_aif1_pins, ARRAY_SIZE(cs47l15_aif1_pins) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) { "aif2", cs47l15_aif2_pins, ARRAY_SIZE(cs47l15_aif2_pins) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) { "aif3", cs47l15_aif3_pins, ARRAY_SIZE(cs47l15_aif3_pins) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) { "pdmspk1", cs47l15_spk1_pins, ARRAY_SIZE(cs47l15_spk1_pins) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) const struct madera_pin_chip cs47l15_pin_chip = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .n_pins = CS47L15_NUM_GPIOS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) .pin_groups = cs47l15_pin_groups,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .n_pin_groups = ARRAY_SIZE(cs47l15_pin_groups),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) };