ASoC: rt1015: Remove unnecessary flush work on rt1015 driver
authorJack Yu <jack.yu@realtek.com>
Mon, 26 Jul 2021 09:15:41 +0000 (09:15 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 26 Jul 2021 17:57:19 +0000 (18:57 +0100)
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: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/3ef458a6ad754589b96d6a94abda1e55@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt1015.c
sound/soc/codecs/rt1015.h

index 9238f12..b3e69bf 100644 (file)
@@ -547,31 +547,6 @@ static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol,
        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[] = {
        SOC_SINGLE_TLV("DAC Playback Volume", RT1015_DAC1, RT1015_DAC_VOL_SFT,
                127, 0, dac_vol_tlv),
@@ -630,10 +605,6 @@ static int r1015_dac_event(struct snd_soc_dapm_widget *w,
                }
                break;
 
-       case SND_SOC_DAPM_POST_PMU:
-               regmap_write(rt1015->regmap, RT1015_MAN_I2C, 0x00a8);
-               break;
-
        case SND_SOC_DAPM_POST_PMD:
                if (rt1015->bypass_boost == RT1015_Enable_Boost) {
                        snd_soc_component_write(component,
@@ -653,8 +624,6 @@ static int r1015_dac_event(struct snd_soc_dapm_widget *w,
                                RT1015_SYS_RST2, 0x0b9a);
                }
                rt1015->dac_is_used = 0;
-
-               cancel_delayed_work_sync(&rt1015->flush_work);
                break;
 
        default:
@@ -687,8 +656,6 @@ static int rt1015_amp_drv_event(struct snd_soc_dapm_widget *w,
                }
                break;
        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);
                break;
        default:
@@ -702,7 +669,7 @@ static const struct snd_soc_dapm_widget rt1015_dapm_widgets[] = {
                NULL, 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,
-               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_OUT_DRV_E("Amp Drv", SND_SOC_NOPM, 0, 0, NULL, 0,
                        rt1015_amp_drv_event, SND_SOC_DAPM_PRE_PMU |
@@ -1028,7 +995,6 @@ static int rt1015_probe(struct snd_soc_component *component)
                snd_soc_component_get_drvdata(component);
 
        rt1015->component = component;
-       INIT_DELAYED_WORK(&rt1015->flush_work, rt1015_flush_work);
 
        return 0;
 }
@@ -1037,7 +1003,6 @@ static void rt1015_remove(struct snd_soc_component *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);
 }
 
@@ -1180,8 +1145,6 @@ static int rt1015_i2c_probe(struct i2c_client *i2c,
                return ret;
        }
 
-       rt1015->hw_config = (i2c->addr == 0x29) ? RT1015_HW_29 : RT1015_HW_28;
-
        ret = regmap_read(rt1015->regmap, RT1015_DEVICE_ID, &val);
        if (ret) {
                dev_err(&i2c->dev,
index 1434453..c9f636a 100644 (file)
@@ -444,8 +444,6 @@ struct rt1015_priv {
        int bypass_boost;
        int dac_is_used;
        int cali_done;
-       int hw_config;
-       struct delayed_work flush_work;
 };
 
 #endif /* __RT1015_H__ */