mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
Regression: suspend twice with internal codec [1/1]
PD#SWPL-207769 Problem: 1. pm soc and pm use the same time 2. base:https://scgit.amlogic.com/#/c/501712 Solution: 1. keep the pm soc use for codecs 2. remove cache sync when save in user setting Verify: t5m Change-Id: Iea9ad5ea0f295e06966190f112e353517986b499 Signed-off-by: qing.zhang <qing.zhang@amlogic.com> (cherry picked from commit 12be0fd24f49ebedae9bcfd3be06f49d9c6b21ee)
This commit is contained in:
@@ -1131,6 +1131,7 @@ static int aml_card_parse_gpios(struct device_node *node,
|
||||
struct snd_soc_card *soc_card = &priv->snd_card;
|
||||
enum of_gpio_flags flags;
|
||||
int gpio;
|
||||
int state;
|
||||
bool active_low;
|
||||
unsigned int sleep_time = 500;
|
||||
unsigned int spk_mute_sleep_time = 200;
|
||||
@@ -1191,6 +1192,13 @@ static int aml_card_parse_gpios(struct device_node *node,
|
||||
"high" : "low");
|
||||
}
|
||||
}
|
||||
if (gpio_is_valid(priv->hp_jack.gpio.gpio)) {
|
||||
gpio_direction_input(priv->hp_jack.gpio.gpio);
|
||||
state = gpiod_set_pull(gpio_to_desc(priv->hp_jack.gpio.gpio),
|
||||
GPIOD_PULL_DIS);
|
||||
if (state)
|
||||
pr_err("set hp_jack gpiod pull failed, ret %d\n", state);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1649,42 +1657,10 @@ static void aml_card_platform_shutdown(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HIBERNATION
|
||||
static int aml_card_platform_restore(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||
struct aml_card_data *priv = snd_soc_card_get_drvdata(card);
|
||||
int state;
|
||||
|
||||
priv->av_mute_enable = 0;
|
||||
priv->spk_mute_enable = 0;
|
||||
aml_card_parse_gpios(pdev->dev.of_node, priv);
|
||||
|
||||
gpio_direction_input(priv->hp_jack.gpio.gpio);
|
||||
state = gpiod_set_pull(gpio_to_desc(priv->hp_jack.gpio.gpio), GPIOD_PULL_DIS);
|
||||
if (state)
|
||||
pr_err("set hp_jack gpiod pull failed, ret %d\n", state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops meson_card_pm_ops = {
|
||||
/* use the same as suspend, because the restore
|
||||
* will enable the clk and default setting
|
||||
*/
|
||||
.restore = aml_card_platform_restore,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct platform_driver aml_card = {
|
||||
.driver = {
|
||||
.name = "asoc-aml-card",
|
||||
#ifdef CONFIG_HIBERNATION
|
||||
.pm = &meson_card_pm_ops,
|
||||
#else
|
||||
.pm = &snd_soc_pm_ops,
|
||||
#endif
|
||||
.of_match_table = auge_of_match,
|
||||
#if IS_ENABLED(CONFIG_AMLOGIC_BOOT_TIME)
|
||||
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
|
||||
|
||||
@@ -1024,22 +1024,6 @@ static void ad82128_i2c_shutdown(struct i2c_client *client)
|
||||
|
||||
}
|
||||
|
||||
static int aml_ad82128_platform_resume(struct device *dev)
|
||||
{
|
||||
struct ad82128_data *data = dev_get_drvdata(dev);
|
||||
|
||||
ad82128_resume(data->component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_ad82128_platform_suspend(struct device *dev)
|
||||
{
|
||||
struct ad82128_data *data = dev_get_drvdata(dev);
|
||||
|
||||
ad82128_suspend(data->component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_ad82128_platform_restore(struct device *dev)
|
||||
{
|
||||
struct ad82128_data *data = dev_get_drvdata(dev);
|
||||
@@ -1074,8 +1058,6 @@ static const struct dev_pm_ops meson_ad82128_pm_ops = {
|
||||
*/
|
||||
.restore = aml_ad82128_platform_restore,
|
||||
.freeze = aml_ad82128_platform_freeze,
|
||||
.suspend = aml_ad82128_platform_suspend,
|
||||
.resume = aml_ad82128_platform_resume,
|
||||
};
|
||||
|
||||
static const struct i2c_device_id ad82128_id[] = {
|
||||
|
||||
@@ -647,6 +647,29 @@ static void aml_a1_acodec_shutdown(struct platform_device *pdev)
|
||||
a1_acodec_remove(component);
|
||||
}
|
||||
|
||||
static int aml_a1_acodec_restore(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct a1_acodec_priv *aml_acodec = platform_get_drvdata(pdev);
|
||||
|
||||
schedule_work(&aml_acodec->work);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_a1_acodec_freeze(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct a1_acodec_priv *aml_acodec = platform_get_drvdata(pdev);
|
||||
|
||||
cancel_work_sync(&aml_acodec->work);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops meson_a1_acodec_pm_ops = {
|
||||
.restore = aml_a1_acodec_restore,
|
||||
.freeze = aml_a1_acodec_freeze,
|
||||
};
|
||||
|
||||
static const struct of_device_id aml_a1_acodec_dt_match[] = {
|
||||
{
|
||||
.compatible = "amlogic, a1_acodec",
|
||||
@@ -664,6 +687,7 @@ static struct platform_driver aml_a1_acodec_platform_driver = {
|
||||
.name = "a1_acodec",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = aml_a1_acodec_dt_match,
|
||||
.pm = &meson_a1_acodec_pm_ops,
|
||||
},
|
||||
.probe = aml_a1_acodec_probe,
|
||||
.remove = aml_a1_acodec_remove,
|
||||
|
||||
@@ -793,8 +793,7 @@ static int am_acodec_dai_set_bias_level
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (component->dapm.bias_level == SND_SOC_BIAS_OFF)
|
||||
snd_soc_component_cache_sync(component);
|
||||
snd_soc_component_cache_sync(component);
|
||||
break;
|
||||
|
||||
case SND_SOC_BIAS_OFF:
|
||||
|
||||
@@ -633,9 +633,6 @@ static int aml_T9015_acodec_platform_freeze(struct device *dev)
|
||||
static const struct dev_pm_ops meson_T9015_pm_ops = {
|
||||
.restore = aml_T9015_acodec_platform_restore,
|
||||
.freeze = aml_T9015_acodec_platform_freeze,
|
||||
.suspend = aml_T9015_acodec_platform_restore,
|
||||
.resume = aml_T9015_acodec_platform_freeze,
|
||||
|
||||
};
|
||||
|
||||
static struct platform_driver aml_T9015_codec_platform_driver = {
|
||||
|
||||
@@ -663,11 +663,9 @@ static int tl1_acodec_dai_set_bias_level
|
||||
break;
|
||||
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (component->dapm.bias_level == SND_SOC_BIAS_OFF) {
|
||||
snd_soc_component_cache_sync(component);
|
||||
snd_soc_component_write(component, ACODEC_0, tl1_acodec_init_list[0].def);
|
||||
snd_soc_component_write(component, ACODEC_8, tl1_acodec_init_list[8].def);
|
||||
}
|
||||
snd_soc_component_cache_sync(component);
|
||||
snd_soc_component_write(component, ACODEC_0, tl1_acodec_init_list[0].def);
|
||||
snd_soc_component_write(component, ACODEC_8, tl1_acodec_init_list[8].def);
|
||||
break;
|
||||
|
||||
case SND_SOC_BIAS_OFF:
|
||||
@@ -1176,24 +1174,6 @@ static const struct of_device_id aml_tl1_acodec_dt_match[] = {
|
||||
{},
|
||||
};
|
||||
|
||||
static int aml_acodec_platform_suspend(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct tl1_acodec_priv *aml_acodec = platform_get_drvdata(pdev);
|
||||
|
||||
tl1_acodec_suspend(aml_acodec->component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_acodec_platform_resume(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct tl1_acodec_priv *aml_acodec = platform_get_drvdata(pdev);
|
||||
|
||||
tl1_acodec_resume(aml_acodec->component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_acodec_platform_restore(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
@@ -1220,8 +1200,6 @@ static int aml_acodec_platform_freeze(struct device *dev)
|
||||
static const struct dev_pm_ops meson_acodec_pm_ops = {
|
||||
.restore = aml_acodec_platform_restore,
|
||||
.freeze = aml_acodec_platform_freeze,
|
||||
.suspend = aml_acodec_platform_suspend,
|
||||
.resume = aml_acodec_platform_resume,
|
||||
};
|
||||
|
||||
static struct platform_driver aml_tl1_acodec_platform_driver = {
|
||||
|
||||
@@ -877,22 +877,6 @@ static int tas5707_i2c_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_tas5707_platform_suspend(struct device *dev)
|
||||
{
|
||||
struct tas5707_priv *tas5707 = dev_get_drvdata(dev);
|
||||
|
||||
tas5707_resume(tas5707->component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_tas5707_platform_resume(struct device *dev)
|
||||
{
|
||||
struct tas5707_priv *tas5707 = dev_get_drvdata(dev);
|
||||
|
||||
tas5707_suspend(tas5707->component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_tas5707_platform_restore(struct device *dev)
|
||||
{
|
||||
struct tas5707_priv *tas5707 = dev_get_drvdata(dev);
|
||||
@@ -926,8 +910,6 @@ static const struct dev_pm_ops meson_tas5707_pm_ops = {
|
||||
*/
|
||||
.restore = aml_tas5707_platform_restore,
|
||||
.freeze = aml_tas5707_platform_freeze,
|
||||
.suspend = aml_tas5707_platform_suspend,
|
||||
.resume = aml_tas5707_platform_resume,
|
||||
};
|
||||
|
||||
static const struct i2c_device_id tas5707_i2c_id[] = {
|
||||
|
||||
@@ -1263,22 +1263,6 @@ static void tas5805m_i2c_shutdown(struct i2c_client *i2c)
|
||||
gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_LOW);
|
||||
}
|
||||
|
||||
static int aml_tas5805m_platform_suspend(struct device *dev)
|
||||
{
|
||||
struct tas5805m_priv *data = dev_get_drvdata(dev);
|
||||
|
||||
tas5805m_snd_suspend(data->component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_tas5805m_platform_resume(struct device *dev)
|
||||
{
|
||||
struct tas5805m_priv *data = dev_get_drvdata(dev);
|
||||
|
||||
tas5805m_snd_resume(data->component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aml_tas5805m_platform_restore(struct device *dev)
|
||||
{
|
||||
struct tas5805m_priv *data = dev_get_drvdata(dev);
|
||||
@@ -1312,8 +1296,6 @@ static const struct dev_pm_ops meson_tas5805m_pm_ops = {
|
||||
*/
|
||||
.restore = aml_tas5805m_platform_restore,
|
||||
.freeze = aml_tas5805m_platform_freeze,
|
||||
.suspend = aml_tas5805m_platform_suspend,
|
||||
.resume = aml_tas5805m_platform_resume,
|
||||
};
|
||||
|
||||
static const struct i2c_device_id tas5805m_i2c_id[] = {
|
||||
|
||||
Reference in New Issue
Block a user