Lines Matching +full:termination +full:- +full:gpios
1 // SPDX-License-Identifier: GPL-2.0
25 int reset_gpio_index; /* -1 if no reset gpio */
26 int spkid_gpio_index; /* -1 if no spkid gpio */
27 int cs_gpio_index; /* -1 if no cs gpio, or cs-gpios already exists, max num amps == 2 */
36 { "10280BEB", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 0, 0, 0 },
37 …{ "10280C4D", 4, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT }, 0, 1, -1,…
41 * Since this laptop has valid ACPI, we do not need to handle cs-gpios, since that already exists
44 { "103C89C6", 2, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, -1, -1, -1, 1000, 4500, 24 },
45 { "103C8A28", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
46 { "103C8A29", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
47 { "103C8A2A", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
48 { "103C8A2B", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
49 { "103C8A2C", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
50 { "103C8A2D", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
51 { "103C8A2E", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
52 { "103C8A30", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
53 { "103C8A31", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
54 { "103C8BB3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
55 { "103C8BB4", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
56 { "103C8BDF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
57 { "103C8BE0", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
58 { "103C8BE1", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
59 { "103C8BE2", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
60 { "103C8BE9", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
61 { "103C8BDD", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
62 { "103C8BDE", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
63 { "103C8BE3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
64 { "103C8BE5", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
65 { "103C8BE6", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
66 { "103C8B3A", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
68 { "10431433", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
69 { "10431463", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
70 { "10431473", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
71 { "10431483", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
74 { "104314E3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
75 { "10431503", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
76 { "10431533", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
78 { "10431663", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
79 { "10431683", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
83 { "104317F3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
85 { "104318D3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
86 { "10431A83", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
92 { "10431D1F", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
95 { "10431E12", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
96 { "10431EE2", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
97 { "10431F12", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
98 { "10431F1F", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 0, 0, 0 },
100 { "17AA386F", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
101 { "17AA38A9", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
102 { "17AA38AB", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
103 { "17AA38B4", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
104 { "17AA38B5", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
105 { "17AA38B6", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
106 { "17AA38B7", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
124 if (cs35l41->dacpi->driver_gpios) in cs35l41_add_gpios()
145 /* must include termination entry */ in cs35l41_add_gpios()
155 gpio_mapping[reset_index].name = "reset-gpios"; in cs35l41_add_gpios()
169 gpio_mapping[spkid_index].name = "spk-id-gpios"; in cs35l41_add_gpios()
183 gpio_mapping[csgpio_index].name = "cs-gpios"; in cs35l41_add_gpios()
189 cs_gpio_params->crs_entry_index = cs_gpio_index; in cs35l41_add_gpios()
201 return -ENOMEM; in cs35l41_add_gpios()
207 struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg; in generic_dsd_config()
214 for (cfg = cs35l41_config_table; cfg->ssid; cfg++) { in generic_dsd_config()
215 if (!strcasecmp(cfg->ssid, cs35l41->acpi_subsystem_id)) in generic_dsd_config()
219 if (!cfg->ssid) in generic_dsd_config()
220 return -ENOENT; in generic_dsd_config()
222 if (!cs35l41->dacpi || cs35l41->dacpi != ACPI_COMPANION(physdev)) { in generic_dsd_config()
223 dev_err(cs35l41->dev, "ACPI Device does not match, cannot override _DSD.\n"); in generic_dsd_config()
224 return -ENODEV; in generic_dsd_config()
227 dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id); in generic_dsd_config()
229 dsd_found = acpi_dev_has_props(cs35l41->dacpi); in generic_dsd_config()
232 ret = cs35l41_add_gpios(cs35l41, physdev, cfg->reset_gpio_index, in generic_dsd_config()
233 cfg->spkid_gpio_index, cfg->cs_gpio_index, in generic_dsd_config()
234 cfg->num_amps); in generic_dsd_config()
236 dev_err(cs35l41->dev, "Error adding GPIO mapping: %d\n", ret); in generic_dsd_config()
239 } else if (cfg->reset_gpio_index >= 0 || cfg->spkid_gpio_index >= 0) { in generic_dsd_config()
240 dev_warn(cs35l41->dev, "Cannot add Reset/Speaker ID/SPI CS GPIO Mapping, " in generic_dsd_config()
244 if (cs35l41->control_bus == SPI) { in generic_dsd_config()
245 cs35l41->index = id; in generic_dsd_config()
250 * default number of chip selects without using cs-gpios in generic_dsd_config()
255 if (IS_ENABLED(CONFIG_SPI) && cfg->cs_gpio_index >= 0) { in generic_dsd_config()
256 spi = to_spi_device(cs35l41->dev); in generic_dsd_config()
258 if (cfg->num_amps != 2) { in generic_dsd_config()
259 dev_warn(cs35l41->dev, in generic_dsd_config()
261 cfg->num_amps); in generic_dsd_config()
263 dev_warn(cs35l41->dev, in generic_dsd_config()
272 dev_err(cs35l41->dev, in generic_dsd_config()
278 cs35l41->cs_gpio = cs_gpiod; in generic_dsd_config()
287 if (cfg->num_amps > 2) in generic_dsd_config()
290 * subtracting 0x40 would give zero-based index in generic_dsd_config()
292 cs35l41->index = id - 0x40; in generic_dsd_config()
295 cs35l41->index = id == 0x40 ? 0 : 1; in generic_dsd_config()
298 if (cfg->num_amps == 3) in generic_dsd_config()
300 cs35l41->channel_index = 0; in generic_dsd_config()
306 cs35l41->channel_index = cs35l41->index / 2; in generic_dsd_config()
308 cs35l41->reset_gpio = fwnode_gpiod_get_index(acpi_fwnode_handle(cs35l41->dacpi), "reset", in generic_dsd_config()
309 cs35l41->index, GPIOD_OUT_LOW, in generic_dsd_config()
310 "cs35l41-reset"); in generic_dsd_config()
311 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, cs35l41->index, cfg->num_amps, -1); in generic_dsd_config()
313 hw_cfg->spk_pos = cfg->channel[cs35l41->index]; in generic_dsd_config()
315 if (cfg->boost_type == INTERNAL) { in generic_dsd_config()
316 hw_cfg->bst_type = CS35L41_INT_BOOST; in generic_dsd_config()
317 hw_cfg->bst_ind = cfg->boost_ind_nanohenry; in generic_dsd_config()
318 hw_cfg->bst_ipk = cfg->boost_peak_milliamp; in generic_dsd_config()
319 hw_cfg->bst_cap = cfg->boost_cap_microfarad; in generic_dsd_config()
320 hw_cfg->gpio1.func = CS35L41_NOT_USED; in generic_dsd_config()
321 hw_cfg->gpio1.valid = true; in generic_dsd_config()
323 hw_cfg->bst_type = CS35L41_EXT_BOOST; in generic_dsd_config()
324 hw_cfg->bst_ind = -1; in generic_dsd_config()
325 hw_cfg->bst_ipk = -1; in generic_dsd_config()
326 hw_cfg->bst_cap = -1; in generic_dsd_config()
327 hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH; in generic_dsd_config()
328 hw_cfg->gpio1.valid = true; in generic_dsd_config()
331 hw_cfg->gpio2.func = CS35L41_INTERRUPT; in generic_dsd_config()
332 hw_cfg->gpio2.valid = true; in generic_dsd_config()
333 hw_cfg->valid = true; in generic_dsd_config()
340 * And devices created by serial-multi-instantiate don't have their device struct
348 struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg; in lenovo_legion_no_acpi()
351 cs35l41->index = id == 0x40 ? 0 : 1; in lenovo_legion_no_acpi()
352 cs35l41->channel_index = 0; in lenovo_legion_no_acpi()
353 cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH); in lenovo_legion_no_acpi()
354 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2); in lenovo_legion_no_acpi()
355 hw_cfg->spk_pos = cs35l41->index; in lenovo_legion_no_acpi()
356 hw_cfg->gpio2.func = CS35L41_INTERRUPT; in lenovo_legion_no_acpi()
357 hw_cfg->gpio2.valid = true; in lenovo_legion_no_acpi()
358 hw_cfg->valid = true; in lenovo_legion_no_acpi()
361 hw_cfg->bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH; in lenovo_legion_no_acpi()
363 hw_cfg->bst_type = CS35L41_EXT_BOOST; in lenovo_legion_no_acpi()
364 hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH; in lenovo_legion_no_acpi()
365 hw_cfg->gpio1.valid = true; in lenovo_legion_no_acpi()
456 for (model = cs35l41_prop_model_table; model->hid; model++) { in cs35l41_add_dsd_properties()
457 if (!strcmp(model->hid, hid) && in cs35l41_add_dsd_properties()
458 (!model->ssid || in cs35l41_add_dsd_properties()
459 (cs35l41->acpi_subsystem_id && in cs35l41_add_dsd_properties()
460 !strcasecmp(model->ssid, cs35l41->acpi_subsystem_id)))) in cs35l41_add_dsd_properties()
461 return model->add_prop(cs35l41, physdev, id, hid); in cs35l41_add_dsd_properties()
464 return -ENOENT; in cs35l41_add_dsd_properties()