File Index
Files and directories
Sign in
FILE

pinctrl-sc8280xp-lpass-lpi.c

File preview with syntax highlighting.

linux-6.19.14/drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c 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
 12enum 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
 48static const struct pinctrl_pin_desc sc8280xp_lpi_pins[] = {
 49	PINCTRL_PIN(0, "gpio0"),
 50	PINCTRL_PIN(1, "gpio1"),
 51	PINCTRL_PIN(2, "gpio2"),
 52	PINCTRL_PIN(3, "gpio3"),
 53	PINCTRL_PIN(4, "gpio4"),
 54	PINCTRL_PIN(5, "gpio5"),
 55	PINCTRL_PIN(6, "gpio6"),
 56	PINCTRL_PIN(7, "gpio7"),
 57	PINCTRL_PIN(8, "gpio8"),
 58	PINCTRL_PIN(9, "gpio9"),
 59	PINCTRL_PIN(10, "gpio10"),
 60	PINCTRL_PIN(11, "gpio11"),
 61	PINCTRL_PIN(12, "gpio12"),
 62	PINCTRL_PIN(13, "gpio13"),
 63	PINCTRL_PIN(14, "gpio14"),
 64	PINCTRL_PIN(15, "gpio15"),
 65	PINCTRL_PIN(16, "gpio16"),
 66	PINCTRL_PIN(17, "gpio17"),
 67	PINCTRL_PIN(18, "gpio18"),
 68};
 69
 70static const char * const swr_tx_clk_groups[] = { "gpio0" };
 71static const char * const swr_tx_data_groups[] = { "gpio1", "gpio2", "gpio14" };
 72static const char * const swr_rx_clk_groups[] = { "gpio3" };
 73static const char * const swr_rx_data_groups[] = { "gpio4", "gpio5" };
 74static const char * const dmic1_clk_groups[] = { "gpio6" };
 75static const char * const dmic1_data_groups[] = { "gpio7" };
 76static const char * const dmic2_clk_groups[] = { "gpio8" };
 77static const char * const dmic2_data_groups[] = { "gpio9" };
 78static const char * const dmic4_clk_groups[] = { "gpio17" };
 79static const char * const dmic4_data_groups[] = { "gpio18" };
 80static const char * const i2s2_clk_groups[] = { "gpio10" };
 81static const char * const i2s2_ws_groups[] = { "gpio11" };
 82static const char * const dmic3_clk_groups[] = { "gpio12" };
 83static const char * const dmic3_data_groups[] = { "gpio13" };
 84static const char * const qua_mi2s_sclk_groups[] = { "gpio0" };
 85static const char * const qua_mi2s_ws_groups[] = { "gpio1" };
 86static const char * const qua_mi2s_data_groups[] = { "gpio2", "gpio3", "gpio4", "gpio5" };
 87static const char * const i2s1_clk_groups[] = { "gpio6" };
 88static const char * const i2s1_ws_groups[] = { "gpio7" };
 89static const char * const i2s1_data_groups[] = { "gpio8", "gpio9" };
 90static const char * const wsa_swr_clk_groups[] = { "gpio10" };
 91static const char * const wsa_swr_data_groups[] = { "gpio11" };
 92static const char * const wsa2_swr_clk_groups[] = { "gpio15" };
 93static const char * const wsa2_swr_data_groups[] = { "gpio16" };
 94static const char * const i2s2_data_groups[] = { "gpio15", "gpio16" };
 95static const char * const i2s3_clk_groups[] = { "gpio12"};
 96static const char * const i2s3_ws_groups[] = { "gpio13"};
 97static const char * const i2s3_data_groups[] = { "gpio17", "gpio18"};
 98static const char * const ext_mclk1_c_groups[] = { "gpio5" };
 99static const char * const ext_mclk1_b_groups[] = { "gpio9" };
100static const char * const ext_mclk1_a_groups[] = { "gpio13" };
101
102static const struct lpi_pingroup sc8280xp_groups[] = {
103	LPI_PINGROUP(0, 0, swr_tx_clk, qua_mi2s_sclk, _, _),
104	LPI_PINGROUP(1, 2, swr_tx_data, qua_mi2s_ws, _, _),
105	LPI_PINGROUP(2, 4, swr_tx_data, qua_mi2s_data, _, _),
106	LPI_PINGROUP(3, 8, swr_rx_clk, qua_mi2s_data, _, _),
107	LPI_PINGROUP(4, 10, swr_rx_data, qua_mi2s_data, _, _),
108	LPI_PINGROUP(5, 12, swr_rx_data, ext_mclk1_c, qua_mi2s_data, _),
109	LPI_PINGROUP(6, LPI_NO_SLEW, dmic1_clk, i2s1_clk, _,  _),
110	LPI_PINGROUP(7, LPI_NO_SLEW, dmic1_data, i2s1_ws, _, _),
111	LPI_PINGROUP(8, LPI_NO_SLEW, dmic2_clk, i2s1_data, _, _),
112	LPI_PINGROUP(9, LPI_NO_SLEW, dmic2_data, i2s1_data, ext_mclk1_b, _),
113	LPI_PINGROUP(10, 16, i2s2_clk, wsa_swr_clk, _, _),
114	LPI_PINGROUP(11, 18, i2s2_ws, wsa_swr_data, _, _),
115	LPI_PINGROUP(12, LPI_NO_SLEW, dmic3_clk, i2s3_clk, _, _),
116	LPI_PINGROUP(13, LPI_NO_SLEW, dmic3_data, i2s3_ws, ext_mclk1_a, _),
117	LPI_PINGROUP(14, 6, swr_tx_data, _, _, _),
118	LPI_PINGROUP(15, 20, i2s2_data, wsa2_swr_clk, _, _),
119	LPI_PINGROUP(16, 22, i2s2_data, wsa2_swr_data, _, _),
120	LPI_PINGROUP(17, LPI_NO_SLEW, dmic4_clk, i2s3_data, _, _),
121	LPI_PINGROUP(18, LPI_NO_SLEW, dmic4_data, i2s3_data, _, _),
122};
123
124static const struct lpi_function sc8280xp_functions[] = {
125	LPI_FUNCTION(dmic1_clk),
126	LPI_FUNCTION(dmic1_data),
127	LPI_FUNCTION(dmic2_clk),
128	LPI_FUNCTION(dmic2_data),
129	LPI_FUNCTION(dmic3_clk),
130	LPI_FUNCTION(dmic3_data),
131	LPI_FUNCTION(dmic4_clk),
132	LPI_FUNCTION(dmic4_data),
133	LPI_FUNCTION(i2s1_clk),
134	LPI_FUNCTION(i2s1_data),
135	LPI_FUNCTION(i2s1_ws),
136	LPI_FUNCTION(i2s2_clk),
137	LPI_FUNCTION(i2s2_data),
138	LPI_FUNCTION(i2s2_ws),
139	LPI_FUNCTION(i2s3_clk),
140	LPI_FUNCTION(i2s3_data),
141	LPI_FUNCTION(i2s3_ws),
142	LPI_FUNCTION(qua_mi2s_data),
143	LPI_FUNCTION(qua_mi2s_sclk),
144	LPI_FUNCTION(qua_mi2s_ws),
145	LPI_FUNCTION(swr_rx_clk),
146	LPI_FUNCTION(swr_rx_data),
147	LPI_FUNCTION(swr_tx_clk),
148	LPI_FUNCTION(swr_tx_data),
149	LPI_FUNCTION(wsa_swr_clk),
150	LPI_FUNCTION(wsa_swr_data),
151	LPI_FUNCTION(wsa2_swr_clk),
152	LPI_FUNCTION(wsa2_swr_data),
153	LPI_FUNCTION(ext_mclk1_a),
154	LPI_FUNCTION(ext_mclk1_b),
155	LPI_FUNCTION(ext_mclk1_c),
156};
157
158static const struct lpi_pinctrl_variant_data sc8280xp_lpi_data = {
159	.pins = sc8280xp_lpi_pins,
160	.npins = ARRAY_SIZE(sc8280xp_lpi_pins),
161	.groups = sc8280xp_groups,
162	.ngroups = ARRAY_SIZE(sc8280xp_groups),
163	.functions = sc8280xp_functions,
164	.nfunctions = ARRAY_SIZE(sc8280xp_functions),
165};
166
167static const struct of_device_id lpi_pinctrl_of_match[] = {
168	{
169	       .compatible = "qcom,sc8280xp-lpass-lpi-pinctrl",
170	       .data = &sc8280xp_lpi_data,
171	},
172	{ }
173};
174MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match);
175
176static struct platform_driver lpi_pinctrl_driver = {
177	.driver = {
178		   .name = "qcom-sc8280xp-lpass-lpi-pinctrl",
179		   .of_match_table = lpi_pinctrl_of_match,
180	},
181	.probe = lpi_pinctrl_probe,
182	.remove = lpi_pinctrl_remove,
183};
184
185module_platform_driver(lpi_pinctrl_driver);
186MODULE_DESCRIPTION("QTI SC8280XP LPI GPIO pin control driver");
187MODULE_LICENSE("GPL");
~/ Read-only file preview.