1ef4ba63fSStefan Binding // SPDX-License-Identifier: GPL-2.0
2ef4ba63fSStefan Binding //
3ef4ba63fSStefan Binding // CS35L41 ALSA HDA Property driver
4ef4ba63fSStefan Binding //
5ef4ba63fSStefan Binding // Copyright 2023 Cirrus Logic, Inc.
6ef4ba63fSStefan Binding //
7ef4ba63fSStefan Binding // Author: Stefan Binding <sbinding@opensource.cirrus.com>
8ef4ba63fSStefan Binding
98c4c216dSStefan Binding #include <linux/acpi.h>
10ef4ba63fSStefan Binding #include <linux/gpio/consumer.h>
11ef4ba63fSStefan Binding #include <linux/string.h>
12ef4ba63fSStefan Binding #include "cs35l41_hda_property.h"
138c4c216dSStefan Binding #include <linux/spi/spi.h>
148c4c216dSStefan Binding
158c4c216dSStefan Binding #define MAX_AMPS 4
168c4c216dSStefan Binding
178c4c216dSStefan Binding struct cs35l41_config {
188c4c216dSStefan Binding const char *ssid;
198c4c216dSStefan Binding int num_amps;
208c4c216dSStefan Binding enum {
218c4c216dSStefan Binding INTERNAL,
228c4c216dSStefan Binding EXTERNAL
238c4c216dSStefan Binding } boost_type;
248c4c216dSStefan Binding u8 channel[MAX_AMPS];
258c4c216dSStefan Binding int reset_gpio_index; /* -1 if no reset gpio */
268c4c216dSStefan Binding int spkid_gpio_index; /* -1 if no spkid gpio */
278c4c216dSStefan Binding int cs_gpio_index; /* -1 if no cs gpio, or cs-gpios already exists, max num amps == 2 */
288c4c216dSStefan Binding int boost_ind_nanohenry; /* Required if boost_type == Internal */
298c4c216dSStefan Binding int boost_peak_milliamp; /* Required if boost_type == Internal */
308c4c216dSStefan Binding int boost_cap_microfarad; /* Required if boost_type == Internal */
318c4c216dSStefan Binding };
328c4c216dSStefan Binding
338c4c216dSStefan Binding static const struct cs35l41_config cs35l41_config_table[] = {
34d110858aSStefan Binding { "10280B27", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
35d110858aSStefan Binding { "10280B28", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
36d110858aSStefan Binding { "10280BEB", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 0, 0, 0 },
37d110858aSStefan Binding { "10280C4D", 4, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT }, 0, 1, -1, 1000, 4500, 24 },
388c4c216dSStefan Binding /*
398c4c216dSStefan Binding * Device 103C89C6 does have _DSD, however it is setup to use the wrong boost type.
408c4c216dSStefan Binding * We can override the _DSD to correct the boost type here.
418c4c216dSStefan Binding * Since this laptop has valid ACPI, we do not need to handle cs-gpios, since that already exists
428c4c216dSStefan Binding * in the ACPI. The Reset GPIO is also valid, so we can use the Reset defined in _DSD.
438c4c216dSStefan Binding */
44d110858aSStefan Binding { "103C89C6", 2, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, -1, -1, -1, 1000, 4500, 24 },
457d65d701SLorenz Brun { "103C8A28", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
467d65d701SLorenz Brun { "103C8A29", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
477d65d701SLorenz Brun { "103C8A2A", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
487d65d701SLorenz Brun { "103C8A2B", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
497d65d701SLorenz Brun { "103C8A2C", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
507d65d701SLorenz Brun { "103C8A2D", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
517d65d701SLorenz Brun { "103C8A2E", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
527d65d701SLorenz Brun { "103C8A30", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
537d65d701SLorenz Brun { "103C8A31", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
5433e5e648SStefan Binding { "103C8A6E", 4, EXTERNAL, { CS35L41_LEFT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_RIGHT }, 0, -1, -1, 0, 0, 0 },
557d65d701SLorenz Brun { "103C8BB3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
567d65d701SLorenz Brun { "103C8BB4", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
5733e5e648SStefan Binding { "103C8BDD", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
5833e5e648SStefan Binding { "103C8BDE", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
597d65d701SLorenz Brun { "103C8BDF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
607d65d701SLorenz Brun { "103C8BE0", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
617d65d701SLorenz Brun { "103C8BE1", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
627d65d701SLorenz Brun { "103C8BE2", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
637d65d701SLorenz Brun { "103C8BE3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
647d65d701SLorenz Brun { "103C8BE5", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
657d65d701SLorenz Brun { "103C8BE6", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
6633e5e648SStefan Binding { "103C8BE7", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
6733e5e648SStefan Binding { "103C8BE8", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
6833e5e648SStefan Binding { "103C8BE9", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
697d65d701SLorenz Brun { "103C8B3A", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
7033e5e648SStefan Binding { "103C8C15", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4000, 24 },
7133e5e648SStefan Binding { "103C8C16", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4000, 24 },
7233e5e648SStefan Binding { "103C8C17", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4000, 24 },
73ce35d1bdSStefan Binding { "103C8C4D", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
74ce35d1bdSStefan Binding { "103C8C4E", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
7533e5e648SStefan Binding { "103C8C4F", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
7633e5e648SStefan Binding { "103C8C50", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
7733e5e648SStefan Binding { "103C8C51", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
7833e5e648SStefan Binding { "103C8CDD", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
7933e5e648SStefan Binding { "103C8CDE", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 3900, 24 },
80d110858aSStefan Binding { "104312AF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
81d110858aSStefan Binding { "10431433", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
82d110858aSStefan Binding { "10431463", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
83d110858aSStefan Binding { "10431473", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
84d110858aSStefan Binding { "10431483", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
85d110858aSStefan Binding { "10431493", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
86d110858aSStefan Binding { "104314D3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
87d110858aSStefan Binding { "104314E3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
88d110858aSStefan Binding { "10431503", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
89d110858aSStefan Binding { "10431533", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
90d110858aSStefan Binding { "10431573", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
91d110858aSStefan Binding { "10431663", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
92be220d2eSChhayly Leang { "10431683", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
93c16dfab3SKenzo Gomez { "104316A3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
94d110858aSStefan Binding { "104316D3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
95d110858aSStefan Binding { "104316F3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
96d110858aSStefan Binding { "104317F3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
97d110858aSStefan Binding { "10431863", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
98d110858aSStefan Binding { "104318D3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
99b603d956SStefan Binding { "10431A83", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
1004bfea1dcSStefan Binding { "10431B93", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
101d110858aSStefan Binding { "10431C9F", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
102d110858aSStefan Binding { "10431CAF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
103d110858aSStefan Binding { "10431CCF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
104d110858aSStefan Binding { "10431CDF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
105d110858aSStefan Binding { "10431CEF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
106d110858aSStefan Binding { "10431D1F", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
107d110858aSStefan Binding { "10431DA2", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
108d110858aSStefan Binding { "10431E02", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
109706c1fa1SJean-Loïc Charroud { "10431E12", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
110d110858aSStefan Binding { "10431EE2", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
111d110858aSStefan Binding { "10431F12", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
112d110858aSStefan Binding { "10431F1F", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 0, 0, 0 },
113d110858aSStefan Binding { "10431F62", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
1144bfea1dcSStefan Binding { "10433A20", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
1154bfea1dcSStefan Binding { "10433A30", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
1164bfea1dcSStefan Binding { "10433A40", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
1174bfea1dcSStefan Binding { "10433A50", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
1180bfe1050SLuke D. Jones { "10433A60", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
1197a62ab91SStefan Binding { "17AA3865", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
1207a62ab91SStefan Binding { "17AA3866", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
12131855545SJunhao Pei { "17AA386E", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
12224b6332cSTomasz Kudela { "17AA386F", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
1234a1a8065SStefan Binding { "17AA3877", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
1244a1a8065SStefan Binding { "17AA3878", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
12537d9d5ffSStefan Binding { "17AA38A9", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
12637d9d5ffSStefan Binding { "17AA38AB", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
127ba7053b4SDorian Cruveiller { "17AA38B4", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
128ba7053b4SDorian Cruveiller { "17AA38B5", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
129ba7053b4SDorian Cruveiller { "17AA38B6", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
130ba7053b4SDorian Cruveiller { "17AA38B7", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
1310f74758cSDmitry Savin { "17AA38C7", 4, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT }, 0, 2, -1, 1000, 4500, 24 },
1320f74758cSDmitry Savin { "17AA38C8", 4, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT }, 0, 2, -1, 1000, 4500, 24 },
13382f3daedSStefan Binding { "17AA38F9", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
13482f3daedSStefan Binding { "17AA38FA", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
1358c4c216dSStefan Binding {}
1368c4c216dSStefan Binding };
1378c4c216dSStefan Binding
cs35l41_add_gpios(struct cs35l41_hda * cs35l41,struct device * physdev,int reset_gpio,int spkid_gpio,int cs_gpio_index,int num_amps)1388c4c216dSStefan Binding static int cs35l41_add_gpios(struct cs35l41_hda *cs35l41, struct device *physdev, int reset_gpio,
1398c4c216dSStefan Binding int spkid_gpio, int cs_gpio_index, int num_amps)
1408c4c216dSStefan Binding {
141ed7326a2SStefan Binding struct acpi_gpio_mapping *gpio_mapping = NULL;
142ed7326a2SStefan Binding struct acpi_gpio_params *reset_gpio_params = NULL;
143ed7326a2SStefan Binding struct acpi_gpio_params *spkid_gpio_params = NULL;
144ed7326a2SStefan Binding struct acpi_gpio_params *cs_gpio_params = NULL;
1458c4c216dSStefan Binding unsigned int num_entries = 0;
1468c4c216dSStefan Binding unsigned int reset_index, spkid_index, csgpio_index;
1478c4c216dSStefan Binding int i;
1488c4c216dSStefan Binding
1498c4c216dSStefan Binding /*
1508c4c216dSStefan Binding * GPIO Mapping only needs to be done once, since it would be available for subsequent amps
1518c4c216dSStefan Binding */
1528c4c216dSStefan Binding if (cs35l41->dacpi->driver_gpios)
1538c4c216dSStefan Binding return 0;
1548c4c216dSStefan Binding
1558c4c216dSStefan Binding if (reset_gpio >= 0) {
1568c4c216dSStefan Binding reset_index = num_entries;
1578c4c216dSStefan Binding num_entries++;
1588c4c216dSStefan Binding }
1598c4c216dSStefan Binding
1608c4c216dSStefan Binding if (spkid_gpio >= 0) {
1618c4c216dSStefan Binding spkid_index = num_entries;
1628c4c216dSStefan Binding num_entries++;
1638c4c216dSStefan Binding }
1648c4c216dSStefan Binding
1658c4c216dSStefan Binding if ((cs_gpio_index >= 0) && (num_amps == 2)) {
1668c4c216dSStefan Binding csgpio_index = num_entries;
1678c4c216dSStefan Binding num_entries++;
1688c4c216dSStefan Binding }
1698c4c216dSStefan Binding
1708c4c216dSStefan Binding if (!num_entries)
1718c4c216dSStefan Binding return 0;
1728c4c216dSStefan Binding
1738c4c216dSStefan Binding /* must include termination entry */
1748c4c216dSStefan Binding num_entries++;
1758c4c216dSStefan Binding
1768c4c216dSStefan Binding gpio_mapping = devm_kcalloc(physdev, num_entries, sizeof(struct acpi_gpio_mapping),
1778c4c216dSStefan Binding GFP_KERNEL);
1788c4c216dSStefan Binding
1798c4c216dSStefan Binding if (!gpio_mapping)
1808c4c216dSStefan Binding goto err;
1818c4c216dSStefan Binding
1828c4c216dSStefan Binding if (reset_gpio >= 0) {
1838c4c216dSStefan Binding gpio_mapping[reset_index].name = "reset-gpios";
1848c4c216dSStefan Binding reset_gpio_params = devm_kcalloc(physdev, num_amps, sizeof(struct acpi_gpio_params),
1858c4c216dSStefan Binding GFP_KERNEL);
1868c4c216dSStefan Binding if (!reset_gpio_params)
1878c4c216dSStefan Binding goto err;
1888c4c216dSStefan Binding
1898c4c216dSStefan Binding for (i = 0; i < num_amps; i++)
1908c4c216dSStefan Binding reset_gpio_params[i].crs_entry_index = reset_gpio;
1918c4c216dSStefan Binding
1928c4c216dSStefan Binding gpio_mapping[reset_index].data = reset_gpio_params;
1938c4c216dSStefan Binding gpio_mapping[reset_index].size = num_amps;
1948c4c216dSStefan Binding }
1958c4c216dSStefan Binding
1968c4c216dSStefan Binding if (spkid_gpio >= 0) {
1978c4c216dSStefan Binding gpio_mapping[spkid_index].name = "spk-id-gpios";
1988c4c216dSStefan Binding spkid_gpio_params = devm_kcalloc(physdev, num_amps, sizeof(struct acpi_gpio_params),
1998c4c216dSStefan Binding GFP_KERNEL);
2008c4c216dSStefan Binding if (!spkid_gpio_params)
2018c4c216dSStefan Binding goto err;
2028c4c216dSStefan Binding
2038c4c216dSStefan Binding for (i = 0; i < num_amps; i++)
2048c4c216dSStefan Binding spkid_gpio_params[i].crs_entry_index = spkid_gpio;
2058c4c216dSStefan Binding
2068c4c216dSStefan Binding gpio_mapping[spkid_index].data = spkid_gpio_params;
2078c4c216dSStefan Binding gpio_mapping[spkid_index].size = num_amps;
2088c4c216dSStefan Binding }
2098c4c216dSStefan Binding
2108c4c216dSStefan Binding if ((cs_gpio_index >= 0) && (num_amps == 2)) {
2118c4c216dSStefan Binding gpio_mapping[csgpio_index].name = "cs-gpios";
2128c4c216dSStefan Binding /* only one GPIO CS is supported without using _DSD, obtained using index 0 */
2138c4c216dSStefan Binding cs_gpio_params = devm_kzalloc(physdev, sizeof(struct acpi_gpio_params), GFP_KERNEL);
2148c4c216dSStefan Binding if (!cs_gpio_params)
2158c4c216dSStefan Binding goto err;
2168c4c216dSStefan Binding
2178c4c216dSStefan Binding cs_gpio_params->crs_entry_index = cs_gpio_index;
2188c4c216dSStefan Binding
2198c4c216dSStefan Binding gpio_mapping[csgpio_index].data = cs_gpio_params;
2208c4c216dSStefan Binding gpio_mapping[csgpio_index].size = 1;
2218c4c216dSStefan Binding }
2228c4c216dSStefan Binding
2238c4c216dSStefan Binding return devm_acpi_dev_add_driver_gpios(physdev, gpio_mapping);
2248c4c216dSStefan Binding err:
2258c4c216dSStefan Binding devm_kfree(physdev, gpio_mapping);
2268c4c216dSStefan Binding devm_kfree(physdev, reset_gpio_params);
2278c4c216dSStefan Binding devm_kfree(physdev, spkid_gpio_params);
2288c4c216dSStefan Binding devm_kfree(physdev, cs_gpio_params);
2298c4c216dSStefan Binding return -ENOMEM;
2308c4c216dSStefan Binding }
2318c4c216dSStefan Binding
generic_dsd_config(struct cs35l41_hda * cs35l41,struct device * physdev,int id,const char * hid)2328c4c216dSStefan Binding static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
2338c4c216dSStefan Binding const char *hid)
2348c4c216dSStefan Binding {
2358c4c216dSStefan Binding struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
2368c4c216dSStefan Binding const struct cs35l41_config *cfg;
2378c4c216dSStefan Binding struct gpio_desc *cs_gpiod;
2388c4c216dSStefan Binding struct spi_device *spi;
2398c4c216dSStefan Binding bool dsd_found;
2408c4c216dSStefan Binding int ret;
241135096ebSStefan Binding int i;
2428c4c216dSStefan Binding
2438c4c216dSStefan Binding for (cfg = cs35l41_config_table; cfg->ssid; cfg++) {
2448c4c216dSStefan Binding if (!strcasecmp(cfg->ssid, cs35l41->acpi_subsystem_id))
2458c4c216dSStefan Binding break;
2468c4c216dSStefan Binding }
2478c4c216dSStefan Binding
2488c4c216dSStefan Binding if (!cfg->ssid)
2498c4c216dSStefan Binding return -ENOENT;
2508c4c216dSStefan Binding
2518c4c216dSStefan Binding if (!cs35l41->dacpi || cs35l41->dacpi != ACPI_COMPANION(physdev)) {
2528c4c216dSStefan Binding dev_err(cs35l41->dev, "ACPI Device does not match, cannot override _DSD.\n");
2538c4c216dSStefan Binding return -ENODEV;
2548c4c216dSStefan Binding }
2558c4c216dSStefan Binding
2568c4c216dSStefan Binding dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id);
2578c4c216dSStefan Binding
2588c4c216dSStefan Binding dsd_found = acpi_dev_has_props(cs35l41->dacpi);
2598c4c216dSStefan Binding
2608c4c216dSStefan Binding if (!dsd_found) {
2618c4c216dSStefan Binding ret = cs35l41_add_gpios(cs35l41, physdev, cfg->reset_gpio_index,
2628c4c216dSStefan Binding cfg->spkid_gpio_index, cfg->cs_gpio_index,
2638c4c216dSStefan Binding cfg->num_amps);
2648c4c216dSStefan Binding if (ret) {
2658c4c216dSStefan Binding dev_err(cs35l41->dev, "Error adding GPIO mapping: %d\n", ret);
2668c4c216dSStefan Binding return ret;
2678c4c216dSStefan Binding }
2688c4c216dSStefan Binding } else if (cfg->reset_gpio_index >= 0 || cfg->spkid_gpio_index >= 0) {
2698c4c216dSStefan Binding dev_warn(cs35l41->dev, "Cannot add Reset/Speaker ID/SPI CS GPIO Mapping, "
2708c4c216dSStefan Binding "_DSD already exists.\n");
2718c4c216dSStefan Binding }
2728c4c216dSStefan Binding
273d110858aSStefan Binding if (cs35l41->control_bus == SPI) {
2748c4c216dSStefan Binding cs35l41->index = id;
275916d0517SStefan Binding
2768c4c216dSStefan Binding /*
2778c4c216dSStefan Binding * Manually set the Chip Select for the second amp <cs_gpio_index> in the node.
2788c4c216dSStefan Binding * This is only supported for systems with 2 amps, since we cannot expand the
2798c4c216dSStefan Binding * default number of chip selects without using cs-gpios
2808c4c216dSStefan Binding * The CS GPIO must be set high prior to communicating with the first amp (which
2818c4c216dSStefan Binding * uses a native chip select), to ensure the second amp does not clash with the
2828c4c216dSStefan Binding * first.
2838c4c216dSStefan Binding */
2848c14dbf3SArnd Bergmann if (IS_ENABLED(CONFIG_SPI) && cfg->cs_gpio_index >= 0) {
2858c4c216dSStefan Binding spi = to_spi_device(cs35l41->dev);
2868c4c216dSStefan Binding
2878c4c216dSStefan Binding if (cfg->num_amps != 2) {
2888c4c216dSStefan Binding dev_warn(cs35l41->dev,
2898c4c216dSStefan Binding "Cannot update SPI CS, Number of Amps (%d) != 2\n",
2908c4c216dSStefan Binding cfg->num_amps);
2918c4c216dSStefan Binding } else if (dsd_found) {
2928c4c216dSStefan Binding dev_warn(cs35l41->dev,
2938c4c216dSStefan Binding "Cannot update SPI CS, _DSD already exists.\n");
2948c4c216dSStefan Binding } else {
2958c4c216dSStefan Binding /*
2968c4c216dSStefan Binding * This is obtained using driver_gpios, since only one GPIO for CS
2978c4c216dSStefan Binding * exists, this can be obtained using index 0.
2988c4c216dSStefan Binding */
2998c4c216dSStefan Binding cs_gpiod = gpiod_get_index(physdev, "cs", 0, GPIOD_OUT_LOW);
3008c4c216dSStefan Binding if (IS_ERR(cs_gpiod)) {
3018c4c216dSStefan Binding dev_err(cs35l41->dev,
3028c4c216dSStefan Binding "Unable to get Chip Select GPIO descriptor\n");
3038c4c216dSStefan Binding return PTR_ERR(cs_gpiod);
3048c4c216dSStefan Binding }
3058c4c216dSStefan Binding if (id == 1) {
3068c4c216dSStefan Binding spi_set_csgpiod(spi, 0, cs_gpiod);
3078c4c216dSStefan Binding cs35l41->cs_gpio = cs_gpiod;
3088c4c216dSStefan Binding } else {
3098c4c216dSStefan Binding gpiod_set_value_cansleep(cs_gpiod, true);
3108c4c216dSStefan Binding gpiod_put(cs_gpiod);
3118c4c216dSStefan Binding }
3128c4c216dSStefan Binding spi_setup(spi);
3138c4c216dSStefan Binding }
3148c4c216dSStefan Binding }
3158c4c216dSStefan Binding } else {
3168c4c216dSStefan Binding if (cfg->num_amps > 2)
3178c4c216dSStefan Binding /*
3188c4c216dSStefan Binding * i2c addresses for 3/4 amps are used in order: 0x40, 0x41, 0x42, 0x43,
3198c4c216dSStefan Binding * subtracting 0x40 would give zero-based index
3208c4c216dSStefan Binding */
3218c4c216dSStefan Binding cs35l41->index = id - 0x40;
3228c4c216dSStefan Binding else
3238c4c216dSStefan Binding /* i2c addr 0x40 for first amp (always), 0x41/0x42 for 2nd amp */
3248c4c216dSStefan Binding cs35l41->index = id == 0x40 ? 0 : 1;
3258c4c216dSStefan Binding }
3268c4c216dSStefan Binding
3278c4c216dSStefan Binding cs35l41->reset_gpio = fwnode_gpiod_get_index(acpi_fwnode_handle(cs35l41->dacpi), "reset",
3288c4c216dSStefan Binding cs35l41->index, GPIOD_OUT_LOW,
3298c4c216dSStefan Binding "cs35l41-reset");
3308c4c216dSStefan Binding cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, cs35l41->index, cfg->num_amps, -1);
3318c4c216dSStefan Binding
3328c4c216dSStefan Binding hw_cfg->spk_pos = cfg->channel[cs35l41->index];
3338c4c216dSStefan Binding
334135096ebSStefan Binding cs35l41->channel_index = 0;
335135096ebSStefan Binding for (i = 0; i < cs35l41->index; i++)
336135096ebSStefan Binding if (cfg->channel[i] == hw_cfg->spk_pos)
337135096ebSStefan Binding cs35l41->channel_index++;
338135096ebSStefan Binding
3398c4c216dSStefan Binding if (cfg->boost_type == INTERNAL) {
3408c4c216dSStefan Binding hw_cfg->bst_type = CS35L41_INT_BOOST;
3418c4c216dSStefan Binding hw_cfg->bst_ind = cfg->boost_ind_nanohenry;
3428c4c216dSStefan Binding hw_cfg->bst_ipk = cfg->boost_peak_milliamp;
3438c4c216dSStefan Binding hw_cfg->bst_cap = cfg->boost_cap_microfarad;
3448c4c216dSStefan Binding hw_cfg->gpio1.func = CS35L41_NOT_USED;
3458c4c216dSStefan Binding hw_cfg->gpio1.valid = true;
3468c4c216dSStefan Binding } else {
3478c4c216dSStefan Binding hw_cfg->bst_type = CS35L41_EXT_BOOST;
3488c4c216dSStefan Binding hw_cfg->bst_ind = -1;
3498c4c216dSStefan Binding hw_cfg->bst_ipk = -1;
3508c4c216dSStefan Binding hw_cfg->bst_cap = -1;
3518c4c216dSStefan Binding hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
3528c4c216dSStefan Binding hw_cfg->gpio1.valid = true;
3538c4c216dSStefan Binding }
3548c4c216dSStefan Binding
3558c4c216dSStefan Binding hw_cfg->gpio2.func = CS35L41_INTERRUPT;
3568c4c216dSStefan Binding hw_cfg->gpio2.valid = true;
3578c4c216dSStefan Binding hw_cfg->valid = true;
3588c4c216dSStefan Binding
3598c4c216dSStefan Binding return 0;
3608c4c216dSStefan Binding }
361ef4ba63fSStefan Binding
362ef4ba63fSStefan Binding /*
36392bf7367SStefan Binding * Systems 103C8C66, 103C8C67, 103C8C68, 103C8C6A use a dual speaker id system - each speaker has
36492bf7367SStefan Binding * its own speaker id.
36592bf7367SStefan Binding */
hp_i2c_int_2amp_dual_spkid(struct cs35l41_hda * cs35l41,struct device * physdev,int id,const char * hid)36692bf7367SStefan Binding static int hp_i2c_int_2amp_dual_spkid(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
36792bf7367SStefan Binding const char *hid)
36892bf7367SStefan Binding {
36992bf7367SStefan Binding struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
37092bf7367SStefan Binding
37192bf7367SStefan Binding /* If _DSD exists for this laptop, we cannot support it through here */
37292bf7367SStefan Binding if (acpi_dev_has_props(cs35l41->dacpi))
37392bf7367SStefan Binding return -ENOENT;
37492bf7367SStefan Binding
37592bf7367SStefan Binding /* check I2C address to assign the index */
37692bf7367SStefan Binding cs35l41->index = id == 0x40 ? 0 : 1;
37792bf7367SStefan Binding cs35l41->channel_index = 0;
37892bf7367SStefan Binding cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
37992bf7367SStefan Binding if (cs35l41->index == 0)
38092bf7367SStefan Binding cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 1);
38192bf7367SStefan Binding else
38292bf7367SStefan Binding cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
38392bf7367SStefan Binding hw_cfg->spk_pos = cs35l41->index;
38492bf7367SStefan Binding hw_cfg->gpio2.func = CS35L41_INTERRUPT;
38592bf7367SStefan Binding hw_cfg->gpio2.valid = true;
38692bf7367SStefan Binding hw_cfg->valid = true;
38792bf7367SStefan Binding
38892bf7367SStefan Binding hw_cfg->bst_type = CS35L41_INT_BOOST;
38992bf7367SStefan Binding hw_cfg->bst_ind = 1000;
39092bf7367SStefan Binding hw_cfg->bst_ipk = 4100;
39192bf7367SStefan Binding hw_cfg->bst_cap = 24;
39292bf7367SStefan Binding hw_cfg->gpio1.func = CS35L41_NOT_USED;
39392bf7367SStefan Binding hw_cfg->gpio1.valid = true;
39492bf7367SStefan Binding
39592bf7367SStefan Binding return 0;
39692bf7367SStefan Binding }
39792bf7367SStefan Binding
39892bf7367SStefan Binding /*
399ef4ba63fSStefan Binding * Device CLSA010(0/1) doesn't have _DSD so a gpiod_get by the label reset won't work.
400ef4ba63fSStefan Binding * And devices created by serial-multi-instantiate don't have their device struct
401ef4ba63fSStefan Binding * pointing to the correct fwnode, so acpi_dev must be used here.
402ef4ba63fSStefan Binding * And devm functions expect that the device requesting the resource has the correct
403ef4ba63fSStefan Binding * fwnode.
404ef4ba63fSStefan Binding */
lenovo_legion_no_acpi(struct cs35l41_hda * cs35l41,struct device * physdev,int id,const char * hid)405ef4ba63fSStefan Binding static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
406ef4ba63fSStefan Binding const char *hid)
407ef4ba63fSStefan Binding {
408ef4ba63fSStefan Binding struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
409ef4ba63fSStefan Binding
410ef4ba63fSStefan Binding /* check I2C address to assign the index */
411ef4ba63fSStefan Binding cs35l41->index = id == 0x40 ? 0 : 1;
412ef4ba63fSStefan Binding cs35l41->channel_index = 0;
413ef4ba63fSStefan Binding cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
414ef4ba63fSStefan Binding cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
415ef4ba63fSStefan Binding hw_cfg->spk_pos = cs35l41->index;
416ef4ba63fSStefan Binding hw_cfg->gpio2.func = CS35L41_INTERRUPT;
417ef4ba63fSStefan Binding hw_cfg->gpio2.valid = true;
418ef4ba63fSStefan Binding hw_cfg->valid = true;
419ef4ba63fSStefan Binding
420ef4ba63fSStefan Binding if (strcmp(hid, "CLSA0100") == 0) {
421ef4ba63fSStefan Binding hw_cfg->bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH;
422ef4ba63fSStefan Binding } else if (strcmp(hid, "CLSA0101") == 0) {
423ef4ba63fSStefan Binding hw_cfg->bst_type = CS35L41_EXT_BOOST;
424ef4ba63fSStefan Binding hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
425ef4ba63fSStefan Binding hw_cfg->gpio1.valid = true;
426ef4ba63fSStefan Binding }
427ef4ba63fSStefan Binding
428ef4ba63fSStefan Binding return 0;
429ef4ba63fSStefan Binding }
430ef4ba63fSStefan Binding
missing_speaker_id_gpio2(struct cs35l41_hda * cs35l41,struct device * physdev,int id,const char * hid)431*5f9f982dSStefan Binding static int missing_speaker_id_gpio2(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
432*5f9f982dSStefan Binding const char *hid)
433*5f9f982dSStefan Binding {
434*5f9f982dSStefan Binding int ret;
435*5f9f982dSStefan Binding
436*5f9f982dSStefan Binding ret = cs35l41_add_gpios(cs35l41, physdev, -1, 2, -1, 2);
437*5f9f982dSStefan Binding if (ret) {
438*5f9f982dSStefan Binding dev_err(cs35l41->dev, "Error adding GPIO mapping: %d\n", ret);
439*5f9f982dSStefan Binding return ret;
440*5f9f982dSStefan Binding }
441*5f9f982dSStefan Binding
442*5f9f982dSStefan Binding return cs35l41_hda_parse_acpi(cs35l41, physdev, id);
443*5f9f982dSStefan Binding }
444*5f9f982dSStefan Binding
445ef4ba63fSStefan Binding struct cs35l41_prop_model {
446ef4ba63fSStefan Binding const char *hid;
447ef4ba63fSStefan Binding const char *ssid;
448ef4ba63fSStefan Binding int (*add_prop)(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
449ef4ba63fSStefan Binding const char *hid);
450ef4ba63fSStefan Binding };
451ef4ba63fSStefan Binding
4522e6f9790SYang Yingliang static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
453ef4ba63fSStefan Binding { "CLSA0100", NULL, lenovo_legion_no_acpi },
454ef4ba63fSStefan Binding { "CLSA0101", NULL, lenovo_legion_no_acpi },
455ee694e7dSStefan Binding { "CSC3551", "10280B27", generic_dsd_config },
456ee694e7dSStefan Binding { "CSC3551", "10280B28", generic_dsd_config },
457ee694e7dSStefan Binding { "CSC3551", "10280BEB", generic_dsd_config },
458ee694e7dSStefan Binding { "CSC3551", "10280C4D", generic_dsd_config },
4598c4c216dSStefan Binding { "CSC3551", "103C89C6", generic_dsd_config },
4607d65d701SLorenz Brun { "CSC3551", "103C8A28", generic_dsd_config },
4617d65d701SLorenz Brun { "CSC3551", "103C8A29", generic_dsd_config },
4627d65d701SLorenz Brun { "CSC3551", "103C8A2A", generic_dsd_config },
4637d65d701SLorenz Brun { "CSC3551", "103C8A2B", generic_dsd_config },
4647d65d701SLorenz Brun { "CSC3551", "103C8A2C", generic_dsd_config },
4657d65d701SLorenz Brun { "CSC3551", "103C8A2D", generic_dsd_config },
4667d65d701SLorenz Brun { "CSC3551", "103C8A2E", generic_dsd_config },
4677d65d701SLorenz Brun { "CSC3551", "103C8A30", generic_dsd_config },
4687d65d701SLorenz Brun { "CSC3551", "103C8A31", generic_dsd_config },
46933e5e648SStefan Binding { "CSC3551", "103C8A6E", generic_dsd_config },
4707d65d701SLorenz Brun { "CSC3551", "103C8BB3", generic_dsd_config },
4717d65d701SLorenz Brun { "CSC3551", "103C8BB4", generic_dsd_config },
47233e5e648SStefan Binding { "CSC3551", "103C8BDD", generic_dsd_config },
47333e5e648SStefan Binding { "CSC3551", "103C8BDE", generic_dsd_config },
4747d65d701SLorenz Brun { "CSC3551", "103C8BDF", generic_dsd_config },
4757d65d701SLorenz Brun { "CSC3551", "103C8BE0", generic_dsd_config },
4767d65d701SLorenz Brun { "CSC3551", "103C8BE1", generic_dsd_config },
4777d65d701SLorenz Brun { "CSC3551", "103C8BE2", generic_dsd_config },
4787d65d701SLorenz Brun { "CSC3551", "103C8BE3", generic_dsd_config },
4797d65d701SLorenz Brun { "CSC3551", "103C8BE5", generic_dsd_config },
4807d65d701SLorenz Brun { "CSC3551", "103C8BE6", generic_dsd_config },
48133e5e648SStefan Binding { "CSC3551", "103C8BE7", generic_dsd_config },
48233e5e648SStefan Binding { "CSC3551", "103C8BE8", generic_dsd_config },
48333e5e648SStefan Binding { "CSC3551", "103C8BE9", generic_dsd_config },
4847d65d701SLorenz Brun { "CSC3551", "103C8B3A", generic_dsd_config },
48533e5e648SStefan Binding { "CSC3551", "103C8C15", generic_dsd_config },
48633e5e648SStefan Binding { "CSC3551", "103C8C16", generic_dsd_config },
48733e5e648SStefan Binding { "CSC3551", "103C8C17", generic_dsd_config },
488ce35d1bdSStefan Binding { "CSC3551", "103C8C4D", generic_dsd_config },
489ce35d1bdSStefan Binding { "CSC3551", "103C8C4E", generic_dsd_config },
49033e5e648SStefan Binding { "CSC3551", "103C8C4F", generic_dsd_config },
49133e5e648SStefan Binding { "CSC3551", "103C8C50", generic_dsd_config },
49233e5e648SStefan Binding { "CSC3551", "103C8C51", generic_dsd_config },
49392bf7367SStefan Binding { "CSC3551", "103C8C66", hp_i2c_int_2amp_dual_spkid },
49492bf7367SStefan Binding { "CSC3551", "103C8C67", hp_i2c_int_2amp_dual_spkid },
49592bf7367SStefan Binding { "CSC3551", "103C8C68", hp_i2c_int_2amp_dual_spkid },
49692bf7367SStefan Binding { "CSC3551", "103C8C6A", hp_i2c_int_2amp_dual_spkid },
49733e5e648SStefan Binding { "CSC3551", "103C8CDD", generic_dsd_config },
49833e5e648SStefan Binding { "CSC3551", "103C8CDE", generic_dsd_config },
499b257187bSStefan Binding { "CSC3551", "104312AF", generic_dsd_config },
500b592ed2eSStefan Binding { "CSC3551", "10431433", generic_dsd_config },
501b592ed2eSStefan Binding { "CSC3551", "10431463", generic_dsd_config },
502b592ed2eSStefan Binding { "CSC3551", "10431473", generic_dsd_config },
503b592ed2eSStefan Binding { "CSC3551", "10431483", generic_dsd_config },
504b592ed2eSStefan Binding { "CSC3551", "10431493", generic_dsd_config },
505b592ed2eSStefan Binding { "CSC3551", "104314D3", generic_dsd_config },
506b592ed2eSStefan Binding { "CSC3551", "104314E3", generic_dsd_config },
507b592ed2eSStefan Binding { "CSC3551", "10431503", generic_dsd_config },
508b592ed2eSStefan Binding { "CSC3551", "10431533", generic_dsd_config },
509b592ed2eSStefan Binding { "CSC3551", "10431573", generic_dsd_config },
510b592ed2eSStefan Binding { "CSC3551", "10431663", generic_dsd_config },
511be220d2eSChhayly Leang { "CSC3551", "10431683", generic_dsd_config },
512c16dfab3SKenzo Gomez { "CSC3551", "104316A3", generic_dsd_config },
5132b35b66dSStefan Binding { "CSC3551", "104316D3", generic_dsd_config },
5142b35b66dSStefan Binding { "CSC3551", "104316F3", generic_dsd_config },
515b592ed2eSStefan Binding { "CSC3551", "104317F3", generic_dsd_config },
5162b35b66dSStefan Binding { "CSC3551", "10431863", generic_dsd_config },
5172b35b66dSStefan Binding { "CSC3551", "104318D3", generic_dsd_config },
518*5f9f982dSStefan Binding { "CSC3551", "10431A63", missing_speaker_id_gpio2 },
519b603d956SStefan Binding { "CSC3551", "10431A83", generic_dsd_config },
5204bfea1dcSStefan Binding { "CSC3551", "10431B93", generic_dsd_config },
521b592ed2eSStefan Binding { "CSC3551", "10431C9F", generic_dsd_config },
522b592ed2eSStefan Binding { "CSC3551", "10431CAF", generic_dsd_config },
523b592ed2eSStefan Binding { "CSC3551", "10431CCF", generic_dsd_config },
524b592ed2eSStefan Binding { "CSC3551", "10431CDF", generic_dsd_config },
525b592ed2eSStefan Binding { "CSC3551", "10431CEF", generic_dsd_config },
526b592ed2eSStefan Binding { "CSC3551", "10431D1F", generic_dsd_config },
527b257187bSStefan Binding { "CSC3551", "10431DA2", generic_dsd_config },
528b257187bSStefan Binding { "CSC3551", "10431E02", generic_dsd_config },
529706c1fa1SJean-Loïc Charroud { "CSC3551", "10431E12", generic_dsd_config },
530b257187bSStefan Binding { "CSC3551", "10431EE2", generic_dsd_config },
531b257187bSStefan Binding { "CSC3551", "10431F12", generic_dsd_config },
5322b35b66dSStefan Binding { "CSC3551", "10431F1F", generic_dsd_config },
533b257187bSStefan Binding { "CSC3551", "10431F62", generic_dsd_config },
5344bfea1dcSStefan Binding { "CSC3551", "10433A20", generic_dsd_config },
5354bfea1dcSStefan Binding { "CSC3551", "10433A30", generic_dsd_config },
5364bfea1dcSStefan Binding { "CSC3551", "10433A40", generic_dsd_config },
5374bfea1dcSStefan Binding { "CSC3551", "10433A50", generic_dsd_config },
5380bfe1050SLuke D. Jones { "CSC3551", "10433A60", generic_dsd_config },
5397a62ab91SStefan Binding { "CSC3551", "17AA3865", generic_dsd_config },
5407a62ab91SStefan Binding { "CSC3551", "17AA3866", generic_dsd_config },
54131855545SJunhao Pei { "CSC3551", "17AA386E", generic_dsd_config },
54224b6332cSTomasz Kudela { "CSC3551", "17AA386F", generic_dsd_config },
543b67a7dc4SChristian Bendiksen { "CSC3551", "17AA3877", generic_dsd_config },
544b67a7dc4SChristian Bendiksen { "CSC3551", "17AA3878", generic_dsd_config },
54537d9d5ffSStefan Binding { "CSC3551", "17AA38A9", generic_dsd_config },
54637d9d5ffSStefan Binding { "CSC3551", "17AA38AB", generic_dsd_config },
547ba7053b4SDorian Cruveiller { "CSC3551", "17AA38B4", generic_dsd_config },
548ba7053b4SDorian Cruveiller { "CSC3551", "17AA38B5", generic_dsd_config },
549ba7053b4SDorian Cruveiller { "CSC3551", "17AA38B6", generic_dsd_config },
550ba7053b4SDorian Cruveiller { "CSC3551", "17AA38B7", generic_dsd_config },
551b32f92d1SStefan Binding { "CSC3551", "17AA38C7", generic_dsd_config },
552b32f92d1SStefan Binding { "CSC3551", "17AA38C8", generic_dsd_config },
55382f3daedSStefan Binding { "CSC3551", "17AA38F9", generic_dsd_config },
55482f3daedSStefan Binding { "CSC3551", "17AA38FA", generic_dsd_config },
555ef4ba63fSStefan Binding {}
556ef4ba63fSStefan Binding };
557ef4ba63fSStefan Binding
cs35l41_add_dsd_properties(struct cs35l41_hda * cs35l41,struct device * physdev,int id,const char * hid)558ef4ba63fSStefan Binding int cs35l41_add_dsd_properties(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
559ef4ba63fSStefan Binding const char *hid)
560ef4ba63fSStefan Binding {
561ef4ba63fSStefan Binding const struct cs35l41_prop_model *model;
562ef4ba63fSStefan Binding
56340989679STakashi Iwai for (model = cs35l41_prop_model_table; model->hid; model++) {
564ef4ba63fSStefan Binding if (!strcmp(model->hid, hid) &&
565ef4ba63fSStefan Binding (!model->ssid ||
566ef4ba63fSStefan Binding (cs35l41->acpi_subsystem_id &&
5678c4c216dSStefan Binding !strcasecmp(model->ssid, cs35l41->acpi_subsystem_id))))
568ef4ba63fSStefan Binding return model->add_prop(cs35l41, physdev, id, hid);
569ef4ba63fSStefan Binding }
570ef4ba63fSStefan Binding
571ef4ba63fSStefan Binding return -ENOENT;
572ef4ba63fSStefan Binding }
573