Commit bc1c8e4e authored by Jack Yu's avatar Jack Yu Committed by Mark Brown

ASoC: rt1015: Remove unnecessary flush work on rt1015 driver

Remove workqueue of flush work in rt1015 driver since we don't need it
after internal discussion, and there is no impact on performance
without this workqueue.
Signed-off-by: default avatarJack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/3ef458a6ad754589b96d6a94abda1e55@realtek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 71869335
...@@ -547,31 +547,6 @@ static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol, ...@@ -547,31 +547,6 @@ static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol,
return 0; return 0;
} }
static void rt1015_flush_work(struct work_struct *work)
{
struct rt1015_priv *rt1015 = container_of(work, struct rt1015_priv,
flush_work.work);
struct snd_soc_component *component = rt1015->component;
unsigned int val, i;
for (i = 0; i < 200; ++i) {
usleep_range(1000, 1500);
dev_dbg(component->dev, "Flush DAC (retry:%u)\n", i);
regmap_read(rt1015->regmap, RT1015_CLK_DET, &val);
if (val & 0x800)
break;
}
regmap_write(rt1015->regmap, RT1015_SYS_RST1, 0x0597);
regmap_write(rt1015->regmap, RT1015_SYS_RST1, 0x05f7);
regmap_write(rt1015->regmap, RT1015_MAN_I2C, 0x0028);
if (val & 0x800)
dev_dbg(component->dev, "Flush DAC completed.\n");
else
dev_warn(component->dev, "Fail to flush DAC data.\n");
}
static const struct snd_kcontrol_new rt1015_snd_controls[] = { static const struct snd_kcontrol_new rt1015_snd_controls[] = {
SOC_SINGLE_TLV("DAC Playback Volume", RT1015_DAC1, RT1015_DAC_VOL_SFT, SOC_SINGLE_TLV("DAC Playback Volume", RT1015_DAC1, RT1015_DAC_VOL_SFT,
127, 0, dac_vol_tlv), 127, 0, dac_vol_tlv),
...@@ -630,10 +605,6 @@ static int r1015_dac_event(struct snd_soc_dapm_widget *w, ...@@ -630,10 +605,6 @@ static int r1015_dac_event(struct snd_soc_dapm_widget *w,
} }
break; break;
case SND_SOC_DAPM_POST_PMU:
regmap_write(rt1015->regmap, RT1015_MAN_I2C, 0x00a8);
break;
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
if (rt1015->bypass_boost == RT1015_Enable_Boost) { if (rt1015->bypass_boost == RT1015_Enable_Boost) {
snd_soc_component_write(component, snd_soc_component_write(component,
...@@ -653,8 +624,6 @@ static int r1015_dac_event(struct snd_soc_dapm_widget *w, ...@@ -653,8 +624,6 @@ static int r1015_dac_event(struct snd_soc_dapm_widget *w,
RT1015_SYS_RST2, 0x0b9a); RT1015_SYS_RST2, 0x0b9a);
} }
rt1015->dac_is_used = 0; rt1015->dac_is_used = 0;
cancel_delayed_work_sync(&rt1015->flush_work);
break; break;
default: default:
...@@ -687,8 +656,6 @@ static int rt1015_amp_drv_event(struct snd_soc_dapm_widget *w, ...@@ -687,8 +656,6 @@ static int rt1015_amp_drv_event(struct snd_soc_dapm_widget *w,
} }
break; break;
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
if (rt1015->hw_config == RT1015_HW_28)
schedule_delayed_work(&rt1015->flush_work, msecs_to_jiffies(10));
msleep(rt1015->pdata.power_up_delay_ms); msleep(rt1015->pdata.power_up_delay_ms);
break; break;
default: default:
...@@ -702,7 +669,7 @@ static const struct snd_soc_dapm_widget rt1015_dapm_widgets[] = { ...@@ -702,7 +669,7 @@ static const struct snd_soc_dapm_widget rt1015_dapm_widgets[] = {
NULL, 0), NULL, 0),
SND_SOC_DAPM_AIF_IN("AIFRX", "AIF Playback", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_IN("AIFRX", "AIF Playback", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_DAC_E("DAC", NULL, SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_DAC_E("DAC", NULL, SND_SOC_NOPM, 0, 0,
r1015_dac_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | r1015_dac_event, SND_SOC_DAPM_PRE_PMU |
SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_OUT_DRV_E("Amp Drv", SND_SOC_NOPM, 0, 0, NULL, 0, SND_SOC_DAPM_OUT_DRV_E("Amp Drv", SND_SOC_NOPM, 0, 0, NULL, 0,
rt1015_amp_drv_event, SND_SOC_DAPM_PRE_PMU | rt1015_amp_drv_event, SND_SOC_DAPM_PRE_PMU |
...@@ -1028,7 +995,6 @@ static int rt1015_probe(struct snd_soc_component *component) ...@@ -1028,7 +995,6 @@ static int rt1015_probe(struct snd_soc_component *component)
snd_soc_component_get_drvdata(component); snd_soc_component_get_drvdata(component);
rt1015->component = component; rt1015->component = component;
INIT_DELAYED_WORK(&rt1015->flush_work, rt1015_flush_work);
return 0; return 0;
} }
...@@ -1037,7 +1003,6 @@ static void rt1015_remove(struct snd_soc_component *component) ...@@ -1037,7 +1003,6 @@ static void rt1015_remove(struct snd_soc_component *component)
{ {
struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component); struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
cancel_delayed_work_sync(&rt1015->flush_work);
regmap_write(rt1015->regmap, RT1015_RESET, 0); regmap_write(rt1015->regmap, RT1015_RESET, 0);
} }
...@@ -1180,8 +1145,6 @@ static int rt1015_i2c_probe(struct i2c_client *i2c, ...@@ -1180,8 +1145,6 @@ static int rt1015_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
rt1015->hw_config = (i2c->addr == 0x29) ? RT1015_HW_29 : RT1015_HW_28;
ret = regmap_read(rt1015->regmap, RT1015_DEVICE_ID, &val); ret = regmap_read(rt1015->regmap, RT1015_DEVICE_ID, &val);
if (ret) { if (ret) {
dev_err(&i2c->dev, dev_err(&i2c->dev,
......
...@@ -444,8 +444,6 @@ struct rt1015_priv { ...@@ -444,8 +444,6 @@ struct rt1015_priv {
int bypass_boost; int bypass_boost;
int dac_is_used; int dac_is_used;
int cali_done; int cali_done;
int hw_config;
struct delayed_work flush_work;
}; };
#endif /* __RT1015_H__ */ #endif /* __RT1015_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment