audio: A4/A5 power on audio output noise [1/1]

PD#SWPL-131815

Problem:
1.AED resume has not restore the AED parameters such as volume gain、
slew count、mute、Clip、mixer、EQ、DRC、DC cut and ND.
2.resample can not work when power domain reset

Solution:
1.need restore AED parameters when suspend/resume,
once the audio power domain is reset.
2.need restore the resample parameters.

Verify:
A4

Change-Id: I4cbf0a70293fbc5e38a3bcd19aa048d3fbcea514
Signed-off-by: shaohui.sheng <shaohui.sheng@amlogic.com>
This commit is contained in:
shaohui.sheng
2023-08-07 20:49:05 +08:00
committed by gerrit autosubmit
parent c48e7843e4
commit 2f023dfc43
2 changed files with 45 additions and 8 deletions
+31 -4
View File
@@ -23,6 +23,7 @@
#define DRV_NAME "Effects"
//#define DEBUG
#define AED_REG_NUM 13
/*
* AED Diagram
@@ -62,12 +63,31 @@ struct audioeffect {
int lane_mask;
int ch_mask;
/*which module should be effected */
/* which module should be effected */
int effect_module;
unsigned int syssrc_clk_rate;
/* store user setting */
u32 user_setting[AED_REG_NUM];
};
struct audioeffect *s_effect;
/* Restore AED register parameters after standby */
static unsigned int aed_restore_list[AED_REG_NUM] = {
AED_EQ_VOLUME,
AED_EQ_VOLUME_SLEW_CNT,
AED_MUTE,
AED_MIX0_LL,
AED_MIX0_RL,
AED_MIX0_LR,
AED_MIX0_RR,
AED_CLIP_THD,
AED_DC_EN,
AED_ND_CNTL,
AED_EQ_EN,
AED_MDRC_CNTL,
AED_DRC_CNTL,
};
static struct audioeffect *get_audioeffects(void)
{
@@ -745,6 +765,10 @@ static int effect_platform_probe(struct platform_device *pdev)
static int effect_platform_suspend(struct platform_device *pdev, pm_message_t state)
{
struct audioeffect *p_effect = dev_get_drvdata(&pdev->dev);
int i = 0;
for (i = 0; i < ARRAY_SIZE(aed_restore_list); i++)
p_effect->user_setting[i] = eqdrc_read(aed_restore_list[i]);
aml_set_aed(0, p_effect->effect_module);
@@ -760,11 +784,11 @@ static int effect_platform_resume(struct platform_device *pdev)
{
struct audioeffect *p_effect = dev_get_drvdata(&pdev->dev);
int ret;
audiobus_write(EE_AUDIO_CLK_GATE_EN0, 0xffffffff);
audiobus_update_bits(EE_AUDIO_CLK_GATE_EN1, 0x7, 0x7);
int i = 0;
if (!IS_ERR(p_effect->clk)) {
audiobus_write(EE_AUDIO_CLK_GATE_EN0, 0xffffffff);
audiobus_update_bits(EE_AUDIO_CLK_GATE_EN1, 0x7, 0x7);
ret = clk_set_parent(p_effect->clk, NULL);
if (ret) {
dev_warn(&pdev->dev, "Can't set eqdrc clock parent as null\n");
@@ -784,6 +808,9 @@ static int effect_platform_resume(struct platform_device *pdev)
}
effect_init(pdev);
for (i = 0; i < ARRAY_SIZE(aed_restore_list); i++)
eqdrc_write(aed_restore_list[i], p_effect->user_setting[i]);
pr_debug("%s\n", __func__);
return 0;
}
+14 -4
View File
@@ -16,6 +16,11 @@
#include <linux/amlogic/iomap.h>
#include <linux/timer.h>
#include <linux/amlogic/pm.h>
#include <linux/amlogic/power_domain.h>
#include <linux/io.h>
#include <linux/of_device.h>
#include <linux/pm_domain.h>
#include <linux/platform_device.h>
#include <sound/soc.h>
#include <sound/tlv.h>
@@ -835,7 +840,7 @@ static int resample_platform_suspend(struct platform_device *pdev,
struct audioresample *p_resample = dev_get_drvdata(&pdev->dev);
if (p_resample->suspend_clk_off && !is_pm_s2idle_mode()) {
/*warning:parent clk already close */
/* warning:parent clk already close */
if (__clk_is_enabled(p_resample->sclk)) {
if (!IS_ERR(p_resample->clk)) {
while (__clk_is_enabled(p_resample->clk))
@@ -843,7 +848,7 @@ static int resample_platform_suspend(struct platform_device *pdev,
}
}
}
pr_info("%s resample:(%d)\n", __func__, p_resample->id);
return 0;
}
@@ -853,22 +858,27 @@ static int resample_platform_resume(struct platform_device *pdev)
int ret = 0;
if (p_resample->suspend_clk_off && !is_pm_s2idle_mode()) {
audiobus_write(EE_AUDIO_CLK_GATE_EN0, 0xffffffff);
audiobus_write(EE_AUDIO_CLK_GATE_EN1, 0xffffffff);
if (!IS_ERR(p_resample->sclk) && !IS_ERR(p_resample->pll)) {
clk_set_parent(p_resample->sclk, NULL);
ret = clk_set_parent(p_resample->sclk, p_resample->pll);
if (ret)
dev_err(p_resample->dev, "Can't resume set p_resample->sclk parent clock\n");
}
if (!IS_ERR(p_resample->clk) && !IS_ERR(p_resample->sclk)) {
clk_set_parent(p_resample->clk, NULL);
ret = clk_set_parent(p_resample->clk, p_resample->sclk);
if (ret)
dev_err(p_resample->dev, "Can't resume set p_resample->clk clock\n");
new_resample_init(p_resample);
resample_clk_set(p_resample, DEFAULT_SPK_SAMPLERATE);
ret = clk_prepare_enable(p_resample->clk);
if (ret)
dev_err(p_resample->dev, "Can't resume enable earc clk_tx_dmac\n");
dev_err(p_resample->dev, "Can't resume enable p_resample->clk\n");
}
}
pr_info("%s resample:(%d)\n", __func__, p_resample->id);
return 0;
}