Lines Matching +full:gpio1 +full:- +full:cfg

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 …{ "103C8A6E", 4, EXTERNAL, { CS35L41_LEFT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_RIGHT }, 0, -1, -1…
55 { "103C8BB3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
56 { "103C8BB4", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
57 { "103C8BDD", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
58 { "103C8BDE", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
59 { "103C8BDF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
60 { "103C8BE0", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
61 { "103C8BE1", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
62 { "103C8BE2", 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 { "103C8BE7", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
67 { "103C8BE8", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
68 { "103C8BE9", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
69 { "103C8B3A", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
70 { "103C8C15", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4000, 24 },
71 { "103C8C16", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4000, 24 },
72 { "103C8C17", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4000, 24 },
73 { "103C8C4D", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
74 { "103C8C4E", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
75 { "103C8C4F", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
76 { "103C8C50", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
77 { "103C8C51", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
78 { "103C8CDD", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
79 { "103C8CDE", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 3900, 24 },
81 { "10431433", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
82 { "10431463", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
83 { "10431473", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
84 { "10431483", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
87 { "104314E3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
88 { "10431503", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
89 { "10431533", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
91 { "10431663", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
92 { "10431683", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
96 { "104317F3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
98 { "104318D3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
99 { "10431A83", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
106 { "10431D1F", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
109 { "10431E12", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
110 { "10431EE2", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
111 { "10431F12", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
112 { "10431F1F", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 0, 0, 0 },
119 { "17AA3865", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
120 { "17AA3866", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
121 { "17AA386E", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
122 { "17AA386F", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
123 { "17AA3877", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
124 { "17AA3878", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
125 { "17AA38A9", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
126 { "17AA38AB", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
127 { "17AA38B4", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
128 { "17AA38B5", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
129 { "17AA38B6", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
130 { "17AA38B7", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
131 …{ "17AA38C7", 4, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT }, 0, 2, -1,…
132 …{ "17AA38C8", 4, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT }, 0, 2, -1,…
133 { "17AA38F9", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
134 { "17AA38FA", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
152 if (cs35l41->dacpi->driver_gpios) in cs35l41_add_gpios()
183 gpio_mapping[reset_index].name = "reset-gpios"; in cs35l41_add_gpios()
197 gpio_mapping[spkid_index].name = "spk-id-gpios"; in cs35l41_add_gpios()
211 gpio_mapping[csgpio_index].name = "cs-gpios"; in cs35l41_add_gpios()
217 cs_gpio_params->crs_entry_index = cs_gpio_index; in cs35l41_add_gpios()
229 return -ENOMEM; in cs35l41_add_gpios()
235 struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg; in generic_dsd_config()
236 const struct cs35l41_config *cfg; in generic_dsd_config() local
243 for (cfg = cs35l41_config_table; cfg->ssid; cfg++) { in generic_dsd_config()
244 if (!strcasecmp(cfg->ssid, cs35l41->acpi_subsystem_id)) in generic_dsd_config()
248 if (!cfg->ssid) in generic_dsd_config()
249 return -ENOENT; in generic_dsd_config()
251 if (!cs35l41->dacpi || cs35l41->dacpi != ACPI_COMPANION(physdev)) { in generic_dsd_config()
252 dev_err(cs35l41->dev, "ACPI Device does not match, cannot override _DSD.\n"); in generic_dsd_config()
253 return -ENODEV; in generic_dsd_config()
256 dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id); in generic_dsd_config()
258 dsd_found = acpi_dev_has_props(cs35l41->dacpi); in generic_dsd_config()
261 ret = cs35l41_add_gpios(cs35l41, physdev, cfg->reset_gpio_index, in generic_dsd_config()
262 cfg->spkid_gpio_index, cfg->cs_gpio_index, in generic_dsd_config()
263 cfg->num_amps); in generic_dsd_config()
265 dev_err(cs35l41->dev, "Error adding GPIO mapping: %d\n", ret); in generic_dsd_config()
268 } else if (cfg->reset_gpio_index >= 0 || cfg->spkid_gpio_index >= 0) { in generic_dsd_config()
269 dev_warn(cs35l41->dev, "Cannot add Reset/Speaker ID/SPI CS GPIO Mapping, " in generic_dsd_config()
273 if (cs35l41->control_bus == SPI) { in generic_dsd_config()
274 cs35l41->index = id; in generic_dsd_config()
279 * default number of chip selects without using cs-gpios in generic_dsd_config()
284 if (IS_ENABLED(CONFIG_SPI) && cfg->cs_gpio_index >= 0) { in generic_dsd_config()
285 spi = to_spi_device(cs35l41->dev); in generic_dsd_config()
287 if (cfg->num_amps != 2) { in generic_dsd_config()
288 dev_warn(cs35l41->dev, in generic_dsd_config()
290 cfg->num_amps); in generic_dsd_config()
292 dev_warn(cs35l41->dev, in generic_dsd_config()
301 dev_err(cs35l41->dev, in generic_dsd_config()
307 cs35l41->cs_gpio = cs_gpiod; in generic_dsd_config()
316 if (cfg->num_amps > 2) in generic_dsd_config()
319 * subtracting 0x40 would give zero-based index in generic_dsd_config()
321 cs35l41->index = id - 0x40; in generic_dsd_config()
324 cs35l41->index = id == 0x40 ? 0 : 1; in generic_dsd_config()
327 cs35l41->reset_gpio = fwnode_gpiod_get_index(acpi_fwnode_handle(cs35l41->dacpi), "reset", in generic_dsd_config()
328 cs35l41->index, GPIOD_OUT_LOW, in generic_dsd_config()
329 "cs35l41-reset"); in generic_dsd_config()
330 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, cs35l41->index, cfg->num_amps, -1); in generic_dsd_config()
332 hw_cfg->spk_pos = cfg->channel[cs35l41->index]; in generic_dsd_config()
334 cs35l41->channel_index = 0; in generic_dsd_config()
335 for (i = 0; i < cs35l41->index; i++) in generic_dsd_config()
336 if (cfg->channel[i] == hw_cfg->spk_pos) in generic_dsd_config()
337 cs35l41->channel_index++; in generic_dsd_config()
339 if (cfg->boost_type == INTERNAL) { in generic_dsd_config()
340 hw_cfg->bst_type = CS35L41_INT_BOOST; in generic_dsd_config()
341 hw_cfg->bst_ind = cfg->boost_ind_nanohenry; in generic_dsd_config()
342 hw_cfg->bst_ipk = cfg->boost_peak_milliamp; in generic_dsd_config()
343 hw_cfg->bst_cap = cfg->boost_cap_microfarad; in generic_dsd_config()
344 hw_cfg->gpio1.func = CS35L41_NOT_USED; in generic_dsd_config()
345 hw_cfg->gpio1.valid = true; in generic_dsd_config()
347 hw_cfg->bst_type = CS35L41_EXT_BOOST; in generic_dsd_config()
348 hw_cfg->bst_ind = -1; in generic_dsd_config()
349 hw_cfg->bst_ipk = -1; in generic_dsd_config()
350 hw_cfg->bst_cap = -1; in generic_dsd_config()
351 hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH; in generic_dsd_config()
352 hw_cfg->gpio1.valid = true; in generic_dsd_config()
355 hw_cfg->gpio2.func = CS35L41_INTERRUPT; in generic_dsd_config()
356 hw_cfg->gpio2.valid = true; in generic_dsd_config()
357 hw_cfg->valid = true; in generic_dsd_config()
363 * Systems 103C8C66, 103C8C67, 103C8C68, 103C8C6A use a dual speaker id system - each speaker has
369 struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg; in hp_i2c_int_2amp_dual_spkid()
372 if (acpi_dev_has_props(cs35l41->dacpi)) in hp_i2c_int_2amp_dual_spkid()
373 return -ENOENT; in hp_i2c_int_2amp_dual_spkid()
376 cs35l41->index = id == 0x40 ? 0 : 1; in hp_i2c_int_2amp_dual_spkid()
377 cs35l41->channel_index = 0; in hp_i2c_int_2amp_dual_spkid()
378 cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH); in hp_i2c_int_2amp_dual_spkid()
379 if (cs35l41->index == 0) in hp_i2c_int_2amp_dual_spkid()
380 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 1); in hp_i2c_int_2amp_dual_spkid()
382 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2); in hp_i2c_int_2amp_dual_spkid()
383 hw_cfg->spk_pos = cs35l41->index; in hp_i2c_int_2amp_dual_spkid()
384 hw_cfg->gpio2.func = CS35L41_INTERRUPT; in hp_i2c_int_2amp_dual_spkid()
385 hw_cfg->gpio2.valid = true; in hp_i2c_int_2amp_dual_spkid()
386 hw_cfg->valid = true; in hp_i2c_int_2amp_dual_spkid()
388 hw_cfg->bst_type = CS35L41_INT_BOOST; in hp_i2c_int_2amp_dual_spkid()
389 hw_cfg->bst_ind = 1000; in hp_i2c_int_2amp_dual_spkid()
390 hw_cfg->bst_ipk = 4100; in hp_i2c_int_2amp_dual_spkid()
391 hw_cfg->bst_cap = 24; in hp_i2c_int_2amp_dual_spkid()
392 hw_cfg->gpio1.func = CS35L41_NOT_USED; in hp_i2c_int_2amp_dual_spkid()
393 hw_cfg->gpio1.valid = true; in hp_i2c_int_2amp_dual_spkid()
400 * And devices created by serial-multi-instantiate don't have their device struct
408 struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg; in lenovo_legion_no_acpi()
411 cs35l41->index = id == 0x40 ? 0 : 1; in lenovo_legion_no_acpi()
412 cs35l41->channel_index = 0; in lenovo_legion_no_acpi()
413 cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH); in lenovo_legion_no_acpi()
414 cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2); in lenovo_legion_no_acpi()
415 hw_cfg->spk_pos = cs35l41->index; in lenovo_legion_no_acpi()
416 hw_cfg->gpio2.func = CS35L41_INTERRUPT; in lenovo_legion_no_acpi()
417 hw_cfg->gpio2.valid = true; in lenovo_legion_no_acpi()
418 hw_cfg->valid = true; in lenovo_legion_no_acpi()
421 hw_cfg->bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH; in lenovo_legion_no_acpi()
423 hw_cfg->bst_type = CS35L41_EXT_BOOST; in lenovo_legion_no_acpi()
424 hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH; in lenovo_legion_no_acpi()
425 hw_cfg->gpio1.valid = true; in lenovo_legion_no_acpi()
436 ret = cs35l41_add_gpios(cs35l41, physdev, -1, 2, -1, 2); in missing_speaker_id_gpio2()
438 dev_err(cs35l41->dev, "Error adding GPIO mapping: %d\n", ret); in missing_speaker_id_gpio2()
563 for (model = cs35l41_prop_model_table; model->hid; model++) { in cs35l41_add_dsd_properties()
564 if (!strcmp(model->hid, hid) && in cs35l41_add_dsd_properties()
565 (!model->ssid || in cs35l41_add_dsd_properties()
566 (cs35l41->acpi_subsystem_id && in cs35l41_add_dsd_properties()
567 !strcasecmp(model->ssid, cs35l41->acpi_subsystem_id)))) in cs35l41_add_dsd_properties()
568 return model->add_prop(cs35l41, physdev, id, hid); in cs35l41_add_dsd_properties()
571 return -ENOENT; in cs35l41_add_dsd_properties()