mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 08:44:21 +08:00
ASoC: rt1015p: delay 300ms after SDB pulling high for calibration
RT1015p needs 300ms delay after SDB pulling high for internal calibration during the power on sequence. Delays 300ms right before data sends out to avoid data truncated. Assuming the calibration state gets lost after system suspend. Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Link: https://lore.kernel.org/r/20201211051224.2307349-3-tzungbi@google.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
4ab9301710
commit
f102d0d173
@ -4,6 +4,7 @@
|
||||
//
|
||||
// Copyright 2020 The Linux Foundation. All rights reserved.
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/gpio.h>
|
||||
@ -19,6 +20,7 @@
|
||||
|
||||
struct rt1015p_priv {
|
||||
struct gpio_desc *sdb;
|
||||
bool calib_done;
|
||||
};
|
||||
|
||||
static int rt1015p_sdb_event(struct snd_soc_dapm_widget *w,
|
||||
@ -36,6 +38,11 @@ static int rt1015p_sdb_event(struct snd_soc_dapm_widget *w,
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
gpiod_set_value_cansleep(rt1015p->sdb, 1);
|
||||
dev_dbg(component->dev, "set sdb to 1");
|
||||
|
||||
if (!rt1015p->calib_done) {
|
||||
msleep(300);
|
||||
rt1015p->calib_done = true;
|
||||
}
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
gpiod_set_value_cansleep(rt1015p->sdb, 0);
|
||||
@ -60,7 +67,20 @@ static const struct snd_soc_dapm_route rt1015p_dapm_routes[] = {
|
||||
{"Speaker", NULL, "SDB"},
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int rt1015p_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
struct rt1015p_priv *rt1015p = snd_soc_component_get_drvdata(component);
|
||||
|
||||
rt1015p->calib_done = false;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define rt1015p_suspend NULL
|
||||
#endif
|
||||
|
||||
static const struct snd_soc_component_driver rt1015p_component_driver = {
|
||||
.suspend = rt1015p_suspend,
|
||||
.dapm_widgets = rt1015p_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(rt1015p_dapm_widgets),
|
||||
.dapm_routes = rt1015p_dapm_routes,
|
||||
|
Loading…
Reference in New Issue
Block a user