summaryrefslogtreecommitdiff
path: root/sound/pci/hda/cs35l41_hda.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/cs35l41_hda.c')
-rw-r--r--sound/pci/hda/cs35l41_hda.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
index f853530eb385..0dac622805c4 100644
--- a/sound/pci/hda/cs35l41_hda.c
+++ b/sound/pci/hda/cs35l41_hda.c
@@ -210,20 +210,30 @@ static const struct component_ops cs35l41_hda_comp_ops = {
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:
@@ -256,16 +266,6 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41)
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);
}
@@ -363,6 +363,11 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
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);
@@ -388,7 +393,7 @@ no_acpi_dsd:
/* 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);
@@ -515,7 +520,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
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);
@@ -529,7 +534,7 @@ void cs35l41_hda_remove(struct device *dev)
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);
}