static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41)
{
struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
- bool internal_boost = false;
int ret;
if (!cs35l41->hw_cfg.valid)
return -EINVAL;
- if (hw_cfg->vspk_always_on) {
+ switch (hw_cfg->bst_type) {
+ case CS35L41_INT_BOOST:
+ cs35l41->reg_seq = &cs35l41_hda_reg_seq_int_bst;
+ ret = cs35l41_boost_config(cs35l41->dev, cs35l41->regmap,
+ hw_cfg->bst_ind, hw_cfg->bst_cap, hw_cfg->bst_ipk);
+ if (ret)
+ return ret;
+ break;
+ case CS35L41_EXT_BOOST:
+ cs35l41->reg_seq = &cs35l41_hda_reg_seq_ext_bst;
+ break;
+ case CS35L41_EXT_BOOST_NO_VSPK_SWITCH:
cs35l41->reg_seq = &cs35l41_hda_reg_seq_no_bst;
- return 0;
+ break;
+ default:
+ dev_err(cs35l41->dev, "Boost type %d not supported\n", hw_cfg->bst_type);
+ return -EINVAL;
}
- if (hw_cfg->bst_ind > 0 || hw_cfg->bst_cap > 0 || hw_cfg->bst_ipk > 0)
- internal_boost = true;
-
if (hw_cfg->gpio1.valid) {
switch (hw_cfg->gpio1.func) {
case CS35L41_NOT_USED:
cs35l41_gpio_config(cs35l41->regmap, hw_cfg);
- if (internal_boost) {
- cs35l41->reg_seq = &cs35l41_hda_reg_seq_int_bst;
- ret = cs35l41_boost_config(cs35l41->dev, cs35l41->regmap,
- hw_cfg->bst_ind, hw_cfg->bst_cap, hw_cfg->bst_ipk);
- if (ret)
- return ret;
- } else {
- cs35l41->reg_seq = &cs35l41_hda_reg_seq_ext_bst;
- }
-
return cs35l41_hda_channel_map(cs35l41->dev, 0, NULL, 1, &hw_cfg->spk_pos);
}
else
hw_cfg->bst_cap = -1;
+ if (hw_cfg->bst_ind > 0 || hw_cfg->bst_cap > 0 || hw_cfg->bst_ipk > 0)
+ hw_cfg->bst_type = CS35L41_INT_BOOST;
+ else
+ hw_cfg->bst_type = CS35L41_EXT_BOOST;
+
hw_cfg->valid = true;
put_device(physdev);
/* check I2C address to assign the index */
cs35l41->index = id == 0x40 ? 0 : 1;
cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
- cs35l41->hw_cfg.vspk_always_on = true;
+ cs35l41->hw_cfg.bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH;
cs35l41->hw_cfg.valid = true;
put_device(physdev);
return 0;
err:
- if (!cs35l41->hw_cfg.vspk_always_on)
+ if (cs35l41->hw_cfg.bst_type != CS35L41_EXT_BOOST_NO_VSPK_SWITCH)
gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
gpiod_put(cs35l41->reset_gpio);
component_del(cs35l41->dev, &cs35l41_hda_comp_ops);
- if (!cs35l41->hw_cfg.vspk_always_on)
+ if (cs35l41->hw_cfg.bst_type != CS35L41_EXT_BOOST_NO_VSPK_SWITCH)
gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
gpiod_put(cs35l41->reset_gpio);
}