Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: qcom: Add sc8280xp lpass lpi pinctrl driver

Add pinctrl driver to support pin configuration for LPASS
(Low Power Audio SubSystem) LPI (Low Power Island) pinctrl
on SC8280XP.

This IP is an additional pin control block for Audio Pins on top the
existing SoC Top level pin-controller.

Hardware setup looks like:

TLMM GPIO[189 - 207] --> LPASS LPI GPIO [0 - 18]

This pin controller has some similarities compared to Top level
msm SoC Pin controller like 'each pin belongs to a single group'
and so on. However this one is intended to control only audio
pins in particular, which can not be configured/touched by the
Top level SoC pin controller except setting them as gpios.
Apart from this, slew rate is also available in this block for
certain pins which are connected to SLIMbus or SoundWire Bus.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220817113747.9111-3-srinivas.kandagatla@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Srinivas Kandagatla and committed by
Linus Walleij
67f40373 958bb025

+217
+9
drivers/pinctrl/qcom/Kconfig
··· 399 399 Qualcomm Technologies Inc LPASS (Low Power Audio SubSystem) LPI 400 400 (Low Power Island) found on the Qualcomm Technologies Inc SM8450 platform. 401 401 402 + config PINCTRL_SC8280XP_LPASS_LPI 403 + tristate "Qualcomm Technologies Inc SC8280XP LPASS LPI pin controller driver" 404 + depends on GPIOLIB 405 + depends on PINCTRL_LPASS_LPI 406 + help 407 + This is the pinctrl, pinmux, pinconf and gpiolib driver for the 408 + Qualcomm Technologies Inc LPASS (Low Power Audio SubSystem) LPI 409 + (Low Power Island) found on the Qualcomm Technologies Inc SC8280XP platform. 410 + 402 411 config PINCTRL_LPASS_LPI 403 412 tristate "Qualcomm Technologies Inc LPASS LPI pin controller driver" 404 413 select PINMUX
+1
drivers/pinctrl/qcom/Makefile
··· 46 46 obj-$(CONFIG_PINCTRL_SM8350) += pinctrl-sm8350.o 47 47 obj-$(CONFIG_PINCTRL_SM8450) += pinctrl-sm8450.o 48 48 obj-$(CONFIG_PINCTRL_SM8450_LPASS_LPI) += pinctrl-sm8450-lpass-lpi.o 49 + obj-$(CONFIG_PINCTRL_SC8280XP_LPASS_LPI) += pinctrl-sc8280xp-lpass-lpi.o 49 50 obj-$(CONFIG_PINCTRL_LPASS_LPI) += pinctrl-lpass-lpi.o
+207
drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright (c) 2022 Linaro Ltd. 4 + */ 5 + 6 + #include <linux/gpio/driver.h> 7 + #include <linux/module.h> 8 + #include <linux/platform_device.h> 9 + 10 + #include "pinctrl-lpass-lpi.h" 11 + 12 + enum lpass_lpi_functions { 13 + LPI_MUX_dmic1_clk, 14 + LPI_MUX_dmic1_data, 15 + LPI_MUX_dmic2_clk, 16 + LPI_MUX_dmic2_data, 17 + LPI_MUX_dmic3_clk, 18 + LPI_MUX_dmic3_data, 19 + LPI_MUX_dmic4_clk, 20 + LPI_MUX_dmic4_data, 21 + LPI_MUX_i2s1_clk, 22 + LPI_MUX_i2s1_data, 23 + LPI_MUX_i2s1_ws, 24 + LPI_MUX_i2s2_clk, 25 + LPI_MUX_i2s2_data, 26 + LPI_MUX_i2s2_ws, 27 + LPI_MUX_i2s3_clk, 28 + LPI_MUX_i2s3_data, 29 + LPI_MUX_i2s3_ws, 30 + LPI_MUX_qua_mi2s_data, 31 + LPI_MUX_qua_mi2s_sclk, 32 + LPI_MUX_qua_mi2s_ws, 33 + LPI_MUX_swr_rx_clk, 34 + LPI_MUX_swr_rx_data, 35 + LPI_MUX_swr_tx_clk, 36 + LPI_MUX_swr_tx_data, 37 + LPI_MUX_wsa_swr_clk, 38 + LPI_MUX_wsa_swr_data, 39 + LPI_MUX_wsa2_swr_clk, 40 + LPI_MUX_wsa2_swr_data, 41 + LPI_MUX_ext_mclk1_a, 42 + LPI_MUX_ext_mclk1_b, 43 + LPI_MUX_ext_mclk1_c, 44 + LPI_MUX_gpio, 45 + LPI_MUX__, 46 + }; 47 + 48 + static int gpio0_pins[] = { 0 }; 49 + static int gpio1_pins[] = { 1 }; 50 + static int gpio2_pins[] = { 2 }; 51 + static int gpio3_pins[] = { 3 }; 52 + static int gpio4_pins[] = { 4 }; 53 + static int gpio5_pins[] = { 5 }; 54 + static int gpio6_pins[] = { 6 }; 55 + static int gpio7_pins[] = { 7 }; 56 + static int gpio8_pins[] = { 8 }; 57 + static int gpio9_pins[] = { 9 }; 58 + static int gpio10_pins[] = { 10 }; 59 + static int gpio11_pins[] = { 11 }; 60 + static int gpio12_pins[] = { 12 }; 61 + static int gpio13_pins[] = { 13 }; 62 + static int gpio14_pins[] = { 14 }; 63 + static int gpio15_pins[] = { 15 }; 64 + static int gpio16_pins[] = { 16 }; 65 + static int gpio17_pins[] = { 17 }; 66 + static int gpio18_pins[] = { 18 }; 67 + 68 + static const struct pinctrl_pin_desc sc8280xp_lpi_pins[] = { 69 + PINCTRL_PIN(0, "gpio0"), 70 + PINCTRL_PIN(1, "gpio1"), 71 + PINCTRL_PIN(2, "gpio2"), 72 + PINCTRL_PIN(3, "gpio3"), 73 + PINCTRL_PIN(4, "gpio4"), 74 + PINCTRL_PIN(5, "gpio5"), 75 + PINCTRL_PIN(6, "gpio6"), 76 + PINCTRL_PIN(7, "gpio7"), 77 + PINCTRL_PIN(8, "gpio8"), 78 + PINCTRL_PIN(9, "gpio9"), 79 + PINCTRL_PIN(10, "gpio10"), 80 + PINCTRL_PIN(11, "gpio11"), 81 + PINCTRL_PIN(12, "gpio12"), 82 + PINCTRL_PIN(13, "gpio13"), 83 + PINCTRL_PIN(14, "gpio14"), 84 + PINCTRL_PIN(15, "gpio15"), 85 + PINCTRL_PIN(16, "gpio16"), 86 + PINCTRL_PIN(17, "gpio17"), 87 + PINCTRL_PIN(18, "gpio18"), 88 + }; 89 + 90 + static const char * const swr_tx_clk_groups[] = { "gpio0" }; 91 + static const char * const swr_tx_data_groups[] = { "gpio1", "gpio2", "gpio14" }; 92 + static const char * const swr_rx_clk_groups[] = { "gpio3" }; 93 + static const char * const swr_rx_data_groups[] = { "gpio4", "gpio5" }; 94 + static const char * const dmic1_clk_groups[] = { "gpio6" }; 95 + static const char * const dmic1_data_groups[] = { "gpio7" }; 96 + static const char * const dmic2_clk_groups[] = { "gpio8" }; 97 + static const char * const dmic2_data_groups[] = { "gpio9" }; 98 + static const char * const dmic4_clk_groups[] = { "gpio17" }; 99 + static const char * const dmic4_data_groups[] = { "gpio18" }; 100 + static const char * const i2s2_clk_groups[] = { "gpio10" }; 101 + static const char * const i2s2_ws_groups[] = { "gpio11" }; 102 + static const char * const dmic3_clk_groups[] = { "gpio12" }; 103 + static const char * const dmic3_data_groups[] = { "gpio13" }; 104 + static const char * const qua_mi2s_sclk_groups[] = { "gpio0" }; 105 + static const char * const qua_mi2s_ws_groups[] = { "gpio1" }; 106 + static const char * const qua_mi2s_data_groups[] = { "gpio2", "gpio3", "gpio4", "gpio5" }; 107 + static const char * const i2s1_clk_groups[] = { "gpio6" }; 108 + static const char * const i2s1_ws_groups[] = { "gpio7" }; 109 + static const char * const i2s1_data_groups[] = { "gpio8", "gpio9" }; 110 + static const char * const wsa_swr_clk_groups[] = { "gpio10" }; 111 + static const char * const wsa_swr_data_groups[] = { "gpio11" }; 112 + static const char * const wsa2_swr_clk_groups[] = { "gpio15" }; 113 + static const char * const wsa2_swr_data_groups[] = { "gpio16" }; 114 + static const char * const i2s2_data_groups[] = { "gpio15", "gpio16" }; 115 + static const char * const i2s3_clk_groups[] = { "gpio12"}; 116 + static const char * const i2s3_ws_groups[] = { "gpio13"}; 117 + static const char * const i2s3_data_groups[] = { "gpio17", "gpio18"}; 118 + static const char * const ext_mclk1_c_groups[] = { "gpio5" }; 119 + static const char * const ext_mclk1_b_groups[] = { "gpio9" }; 120 + static const char * const ext_mclk1_a_groups[] = { "gpio13" }; 121 + 122 + static const struct lpi_pingroup sc8280xp_groups[] = { 123 + LPI_PINGROUP(0, 0, swr_tx_clk, qua_mi2s_sclk, _, _), 124 + LPI_PINGROUP(1, 2, swr_tx_data, qua_mi2s_ws, _, _), 125 + LPI_PINGROUP(2, 4, swr_tx_data, qua_mi2s_data, _, _), 126 + LPI_PINGROUP(3, 8, swr_rx_clk, qua_mi2s_data, _, _), 127 + LPI_PINGROUP(4, 10, swr_rx_data, qua_mi2s_data, _, _), 128 + LPI_PINGROUP(5, 12, swr_rx_data, ext_mclk1_c, qua_mi2s_data, _), 129 + LPI_PINGROUP(6, LPI_NO_SLEW, dmic1_clk, i2s1_clk, _, _), 130 + LPI_PINGROUP(7, LPI_NO_SLEW, dmic1_data, i2s1_ws, _, _), 131 + LPI_PINGROUP(8, LPI_NO_SLEW, dmic2_clk, i2s1_data, _, _), 132 + LPI_PINGROUP(9, LPI_NO_SLEW, dmic2_data, i2s1_data, ext_mclk1_b, _), 133 + LPI_PINGROUP(10, 16, i2s2_clk, wsa_swr_clk, _, _), 134 + LPI_PINGROUP(11, 18, i2s2_ws, wsa_swr_data, _, _), 135 + LPI_PINGROUP(12, LPI_NO_SLEW, dmic3_clk, i2s3_clk, _, _), 136 + LPI_PINGROUP(13, LPI_NO_SLEW, dmic3_data, i2s3_ws, ext_mclk1_a, _), 137 + LPI_PINGROUP(14, 6, swr_tx_data, _, _, _), 138 + LPI_PINGROUP(15, 20, i2s2_data, wsa2_swr_clk, _, _), 139 + LPI_PINGROUP(16, 22, i2s2_data, wsa2_swr_data, _, _), 140 + LPI_PINGROUP(17, LPI_NO_SLEW, dmic4_clk, i2s3_data, _, _), 141 + LPI_PINGROUP(18, LPI_NO_SLEW, dmic4_data, i2s3_data, _, _), 142 + }; 143 + 144 + static const struct lpi_function sc8280xp_functions[] = { 145 + LPI_FUNCTION(dmic1_clk), 146 + LPI_FUNCTION(dmic1_data), 147 + LPI_FUNCTION(dmic2_clk), 148 + LPI_FUNCTION(dmic2_data), 149 + LPI_FUNCTION(dmic3_clk), 150 + LPI_FUNCTION(dmic3_data), 151 + LPI_FUNCTION(dmic4_clk), 152 + LPI_FUNCTION(dmic4_data), 153 + LPI_FUNCTION(i2s1_clk), 154 + LPI_FUNCTION(i2s1_data), 155 + LPI_FUNCTION(i2s1_ws), 156 + LPI_FUNCTION(i2s2_clk), 157 + LPI_FUNCTION(i2s2_data), 158 + LPI_FUNCTION(i2s2_ws), 159 + LPI_FUNCTION(i2s3_clk), 160 + LPI_FUNCTION(i2s3_data), 161 + LPI_FUNCTION(i2s3_ws), 162 + LPI_FUNCTION(qua_mi2s_data), 163 + LPI_FUNCTION(qua_mi2s_sclk), 164 + LPI_FUNCTION(qua_mi2s_ws), 165 + LPI_FUNCTION(swr_rx_clk), 166 + LPI_FUNCTION(swr_rx_data), 167 + LPI_FUNCTION(swr_tx_clk), 168 + LPI_FUNCTION(swr_tx_data), 169 + LPI_FUNCTION(wsa_swr_clk), 170 + LPI_FUNCTION(wsa_swr_data), 171 + LPI_FUNCTION(wsa2_swr_clk), 172 + LPI_FUNCTION(wsa2_swr_data), 173 + LPI_FUNCTION(ext_mclk1_a), 174 + LPI_FUNCTION(ext_mclk1_b), 175 + LPI_FUNCTION(ext_mclk1_c), 176 + }; 177 + 178 + static const struct lpi_pinctrl_variant_data sc8280xp_lpi_data = { 179 + .pins = sc8280xp_lpi_pins, 180 + .npins = ARRAY_SIZE(sc8280xp_lpi_pins), 181 + .groups = sc8280xp_groups, 182 + .ngroups = ARRAY_SIZE(sc8280xp_groups), 183 + .functions = sc8280xp_functions, 184 + .nfunctions = ARRAY_SIZE(sc8280xp_functions), 185 + }; 186 + 187 + static const struct of_device_id lpi_pinctrl_of_match[] = { 188 + { 189 + .compatible = "qcom,sc8280xp-lpass-lpi-pinctrl", 190 + .data = &sc8280xp_lpi_data, 191 + }, 192 + { } 193 + }; 194 + MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match); 195 + 196 + static struct platform_driver lpi_pinctrl_driver = { 197 + .driver = { 198 + .name = "qcom-sc8280xp-lpass-lpi-pinctrl", 199 + .of_match_table = lpi_pinctrl_of_match, 200 + }, 201 + .probe = lpi_pinctrl_probe, 202 + .remove = lpi_pinctrl_remove, 203 + }; 204 + 205 + module_platform_driver(lpi_pinctrl_driver); 206 + MODULE_DESCRIPTION("QTI SC8280XP LPI GPIO pin control driver"); 207 + MODULE_LICENSE("GPL");