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 */
34 { "10251826", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
35 { "1025182C", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
36 { "10251844", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
39 { "10280BEB", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 0, 0, 0 },
40 …{ "10280C4D", 4, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT }, 0, 1, -1,…
44 * Since this laptop has valid ACPI, we do not need to handle cs-gpios, since that already exists
47 { "103C89C6", 2, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, -1, -1, -1, 1000, 4500, 24 },
48 { "103C8A28", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
49 { "103C8A29", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
50 { "103C8A2A", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
51 { "103C8A2B", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
52 { "103C8A2C", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
53 { "103C8A2D", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
54 { "103C8A2E", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
55 { "103C8A30", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
56 { "103C8A31", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
57 …{ "103C8A6E", 4, EXTERNAL, { CS35L41_LEFT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_RIGHT }, 0, -1, -1…
58 { "103C8BB3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
59 { "103C8BB4", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
60 { "103C8BDD", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
61 { "103C8BDE", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
62 { "103C8BDF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
63 { "103C8BE0", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
64 { "103C8BE1", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
65 { "103C8BE2", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
66 { "103C8BE3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
67 { "103C8BE5", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
68 { "103C8BE6", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
69 { "103C8BE7", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
70 { "103C8BE8", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
71 { "103C8BE9", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
72 { "103C8B3A", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
73 { "103C8C15", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4000, 24 },
74 { "103C8C16", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4000, 24 },
75 { "103C8C17", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4000, 24 },
76 { "103C8C4D", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
77 { "103C8C4E", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
78 { "103C8C4F", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
79 { "103C8C50", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
80 { "103C8C51", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
81 { "103C8CDD", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
82 { "103C8CDE", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 3900, 24 },
84 { "10431433", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
85 { "10431463", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
86 { "10431473", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
87 { "10431483", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
90 { "104314E3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
91 { "10431503", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
92 { "10431533", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
94 { "10431663", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
95 { "10431683", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
99 { "104317F3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
101 { "104318D3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
102 { "10431A83", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
109 { "10431D1F", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
112 { "10431E12", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
113 { "10431EE2", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
114 { "10431F12", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
115 { "10431F1F", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 0, 0, 0 },
122 { "17AA3865", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
123 { "17AA3866", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
124 { "17AA386E", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
125 { "17AA386F", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
126 { "17AA3877", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
127 { "17AA3878", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
128 { "17AA38A9", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
129 { "17AA38AB", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
130 { "17AA38B4", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
131 { "17AA38B5", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
132 { "17AA38B6", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
133 { "17AA38B7", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
134 …{ "17AA38C7", 4, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT }, 0, 2, -1,…
135 …{ "17AA38C8", 4, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT }, 0, 2, -1,…
136 { "17AA38F9", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
137 { "17AA38FA", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
138 …{ "17AA3929", 4, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT }, 0, 2, -1,…
139 …{ "17AA392B", 4, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT }, 0, 2, -1,…
157 if (cs35l41->dacpi->driver_gpios) in cs35l41_add_gpios()
178 /* must include termination entry */ in cs35l41_add_gpios()
188 gpio_mapping[reset_index].name = "reset-gpios"; in cs35l41_add_gpios()
202 gpio_mapping[spkid_index].name = "spk-id-gpios"; in cs35l41_add_gpios()
216 gpio_mapping[csgpio_index].name = "cs-gpios"; in cs35l41_add_gpios()
222 cs_gpio_params->crs_entry_index = cs_gpio_index; in cs35l41_add_gpios()
234 return -ENOMEM; in cs35l41_add_gpios()
240 struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg; in generic_dsd_config()
248 for (cfg = cs35l41_config_table; cfg->ssid; cfg++) { in generic_dsd_config()
249 if (!strcasecmp(cfg->ssid, cs35l41->acpi_subsystem_id)) in generic_dsd_config()
253 if (!cfg->ssid) in generic_dsd_config()
254 return -ENOENT; in generic_dsd_config()
256 if (!cs35l41->dacpi || cs35l41->dacpi != ACPI_COMPANION(physdev)) { in generic_dsd_config()
257 dev_err(cs35l41->dev, "ACPI Device does not match, cannot override _DSD.\n"); in generic_dsd_config()
258 return -ENODEV; in generic_dsd_config()
261 dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id); in generic_dsd_config()
263 dsd_found = acpi_dev_has_props(cs35l41->dacpi); in generic_dsd_config()
266 ret = cs35l41_add_gpios(cs35l41, physdev, cfg->reset_gpio_index, in generic_dsd_config()
267 cfg->spkid_gpio_index, cfg->cs_gpio_index, in generic_dsd_config()
268 cfg->num_amps); in generic_dsd_config()
270 dev_err(cs35l41->dev, "Error adding GPIO mapping: %d\n", ret); in generic_dsd_config()
273 } else if (cfg->reset_gpio_index >= 0 || cfg->spkid_gpio_index >= 0) { in generic_dsd_config()
274 dev_warn(cs35l41->dev, "Cannot add Reset/Speaker ID/SPI CS GPIO Mapping, " in generic_dsd_config()
278 if (cs35l41->control_bus == SPI) { in generic_dsd_config()
279 cs35l41->index = id; in generic_dsd_config()
284 * default number of chip selects without using cs-gpios in generic_dsd_config()
289 if (IS_ENABLED(CONFIG_SPI) && cfg->cs_gpio_index >= 0) { in generic_dsd_config()
290 spi = to_spi_device(cs35l41->dev); in generic_dsd_config()
292 if (cfg->num_amps != 2) { in generic_dsd_config()
293 dev_warn(cs35l41->dev, in generic_dsd_config()
295 cfg->num_amps); in generic_dsd_config()
297 dev_warn(cs35l41->dev, in generic_dsd_config()
306 dev_err(cs35l41->dev, in generic_dsd_config()
312 cs35l41->cs_gpio = cs_gpiod; in generic_dsd_config()
321 if (cfg->num_amps > 2) in generic_dsd_config()
324 * subtracting 0x40 would give zero-based index in generic_dsd_config()
326 cs35l41->index = id - 0x40; in generic_dsd_config()
329 cs35l41->index = id == 0x40 ? 0 : 1; in generic_dsd_config()
332 cs35l41->reset_gpio = fwnode_gpiod_get_index(acpi_fwnode_handle(cs35l41->dacpi), "reset", in generic_dsd_config()
333 cs35l41->index, GPIOD_OUT_LOW, in generic_dsd_config()
334 "cs35l41-reset"); in generic_dsd_config()
335 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, cs35l41->index, cfg->num_amps, -1); in generic_dsd_config()
337 hw_cfg->spk_pos = cfg->channel[cs35l41->index]; in generic_dsd_config()
339 cs35l41->channel_index = 0; in generic_dsd_config()
340 for (i = 0; i < cs35l41->index; i++) in generic_dsd_config()
341 if (cfg->channel[i] == hw_cfg->spk_pos) in generic_dsd_config()
342 cs35l41->channel_index++; in generic_dsd_config()
344 if (cfg->boost_type == INTERNAL) { in generic_dsd_config()
345 hw_cfg->bst_type = CS35L41_INT_BOOST; in generic_dsd_config()
346 hw_cfg->bst_ind = cfg->boost_ind_nanohenry; in generic_dsd_config()
347 hw_cfg->bst_ipk = cfg->boost_peak_milliamp; in generic_dsd_config()
348 hw_cfg->bst_cap = cfg->boost_cap_microfarad; in generic_dsd_config()
349 hw_cfg->gpio1.func = CS35L41_NOT_USED; in generic_dsd_config()
350 hw_cfg->gpio1.valid = true; in generic_dsd_config()
352 hw_cfg->bst_type = CS35L41_EXT_BOOST; in generic_dsd_config()
353 hw_cfg->bst_ind = -1; in generic_dsd_config()
354 hw_cfg->bst_ipk = -1; in generic_dsd_config()
355 hw_cfg->bst_cap = -1; in generic_dsd_config()
356 hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH; in generic_dsd_config()
357 hw_cfg->gpio1.valid = true; in generic_dsd_config()
360 hw_cfg->gpio2.func = CS35L41_INTERRUPT; in generic_dsd_config()
361 hw_cfg->gpio2.valid = true; in generic_dsd_config()
362 hw_cfg->valid = true; in generic_dsd_config()
368 * Systems 103C8C66, 103C8C67, 103C8C68, 103C8C6A use a dual speaker id system - each speaker has
374 struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg; in hp_i2c_int_2amp_dual_spkid()
377 if (acpi_dev_has_props(cs35l41->dacpi)) in hp_i2c_int_2amp_dual_spkid()
378 return -ENOENT; in hp_i2c_int_2amp_dual_spkid()
381 cs35l41->index = id == 0x40 ? 0 : 1; in hp_i2c_int_2amp_dual_spkid()
382 cs35l41->channel_index = 0; in hp_i2c_int_2amp_dual_spkid()
383 cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH); in hp_i2c_int_2amp_dual_spkid()
384 if (cs35l41->index == 0) in hp_i2c_int_2amp_dual_spkid()
385 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 1); in hp_i2c_int_2amp_dual_spkid()
387 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2); in hp_i2c_int_2amp_dual_spkid()
388 hw_cfg->spk_pos = cs35l41->index; in hp_i2c_int_2amp_dual_spkid()
389 hw_cfg->gpio2.func = CS35L41_INTERRUPT; in hp_i2c_int_2amp_dual_spkid()
390 hw_cfg->gpio2.valid = true; in hp_i2c_int_2amp_dual_spkid()
391 hw_cfg->valid = true; in hp_i2c_int_2amp_dual_spkid()
393 hw_cfg->bst_type = CS35L41_INT_BOOST; in hp_i2c_int_2amp_dual_spkid()
394 hw_cfg->bst_ind = 1000; in hp_i2c_int_2amp_dual_spkid()
395 hw_cfg->bst_ipk = 4100; in hp_i2c_int_2amp_dual_spkid()
396 hw_cfg->bst_cap = 24; in hp_i2c_int_2amp_dual_spkid()
397 hw_cfg->gpio1.func = CS35L41_NOT_USED; in hp_i2c_int_2amp_dual_spkid()
398 hw_cfg->gpio1.valid = true; in hp_i2c_int_2amp_dual_spkid()
405 * And devices created by serial-multi-instantiate don't have their device struct
413 struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg; in lenovo_legion_no_acpi()
416 cs35l41->index = id == 0x40 ? 0 : 1; in lenovo_legion_no_acpi()
417 cs35l41->channel_index = 0; in lenovo_legion_no_acpi()
418 cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH); in lenovo_legion_no_acpi()
419 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2); in lenovo_legion_no_acpi()
420 hw_cfg->spk_pos = cs35l41->index; in lenovo_legion_no_acpi()
421 hw_cfg->gpio2.func = CS35L41_INTERRUPT; in lenovo_legion_no_acpi()
422 hw_cfg->gpio2.valid = true; in lenovo_legion_no_acpi()
423 hw_cfg->valid = true; in lenovo_legion_no_acpi()
426 hw_cfg->bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH; in lenovo_legion_no_acpi()
428 hw_cfg->bst_type = CS35L41_EXT_BOOST; in lenovo_legion_no_acpi()
429 hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH; in lenovo_legion_no_acpi()
430 hw_cfg->gpio1.valid = true; in lenovo_legion_no_acpi()
441 ret = cs35l41_add_gpios(cs35l41, physdev, -1, 2, -1, 2); in missing_speaker_id_gpio2()
443 dev_err(cs35l41->dev, "Error adding GPIO mapping: %d\n", ret); in missing_speaker_id_gpio2()
573 for (model = cs35l41_prop_model_table; model->hid; model++) { in cs35l41_add_dsd_properties()
574 if (!strcmp(model->hid, hid) && in cs35l41_add_dsd_properties()
575 (!model->ssid || in cs35l41_add_dsd_properties()
576 (cs35l41->acpi_subsystem_id && in cs35l41_add_dsd_properties()
577 !strcasecmp(model->ssid, cs35l41->acpi_subsystem_id)))) in cs35l41_add_dsd_properties()
578 return model->add_prop(cs35l41, physdev, id, hid); in cs35l41_add_dsd_properties()
581 return -ENOENT; in cs35l41_add_dsd_properties()