summaryrefslogtreecommitdiff
authorGongwei Chen <gongwei.chen@amlogic.com>2019-05-29 08:03:16 (GMT)
committer Gongwei Chen <gongwei.chen@amlogic.com>2019-05-29 09:36:43 (GMT)
commit6d1f0c910513b0a4a35e6860779eb3507e5216c4 (patch)
tree42fdbd293828df6e7b3977123d051895f9cc1a2c
parent7eb8805d5031a8d48ef96983801b3c65785d5455 (diff)
downloadcommon-6d1f0c910513b0a4a35e6860779eb3507e5216c4.zip
common-6d1f0c910513b0a4a35e6860779eb3507e5216c4.tar.gz
common-6d1f0c910513b0a4a35e6860779eb3507e5216c4.tar.bz2
audio: Speaker has no sound [1/1]
PD#IPTV-3107 Problem: Speaker has no sound Solution: modify dts and ad82584f Verify: Verify by Android P S905D3 AC202 Change-Id: I3dc77e5f0ba6e776b5d5ac4f34de4da9a16ec84d Signed-off-by: GongWei Chen <gongwei.chen@amlogic.com>
Diffstat
-rw-r--r--MAINTAINERS1
-rw-r--r--arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts16
-rw-r--r--arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts14
-rw-r--r--arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts11
-rw-r--r--arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts16
-rw-r--r--sound/soc/amlogic/auge/ddr_mngr.c1
-rw-r--r--sound/soc/amlogic/auge/spdif.c26
-rw-r--r--sound/soc/amlogic/auge/spdif.h32
-rw-r--r--sound/soc/amlogic/auge/tdm.c7
-rw-r--r--sound/soc/codecs/amlogic/ad82584f.c14
10 files changed, 28 insertions, 110 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index ea44e65..48f467e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13806,6 +13806,7 @@ M: Xing Wang <xing.wang@amlogic.com>
M: Zhe Wang <Zhe.Wang@amlogic.com>
M: Shuai Li <shuai.li@amlogic.com>
M: Jian Xu <jian.xu@amlogic.com>
+M: Jian Xu <jian.xu@amlogic.com>
F: arch/arm64/boot/dts/amlogic/*
F: arch/arm/boot/dts/amlogic/*
F: arch/arm64/configs/meson64_defconfig
diff --git a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts
index dd13e39..ba3fba1 100644
--- a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts
+++ b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts
@@ -675,7 +675,7 @@
system-clock-frequency = <12288000>;
};
tdmccodec: codec {
- sound-dai = <&dummy_codec>;
+ sound-dai = <&dummy_codec &dummy_codec>;
};
};
@@ -1106,7 +1106,8 @@
#sound-dai-cells = <0>;
reg = <0x31>;
status = "okay";
- reset_pin = <&gpio GPIOAO_9 0>;
+ reset_pin = <&gpio_ao GPIOAO_9 0>;
+ enable_pin = <&gpio GPIOC_4 0>;
no_mclk;
};
@@ -1162,12 +1163,6 @@
*/
samesource_sel = <3>;
- /*enable default mclk(12.288M), before extern codec start*/
- start_clk_enable = <1>;
-
- /*tdm clk tuning enable*/
- clk_tuning_enable = <1>;
-
status = "okay";
};
@@ -1255,10 +1250,7 @@
interrupt-names = "irq_spdifin";
pinctrl-names = "spdif_pins";
- pinctrl-0 = <&spdifout>; /* bob remove &spdifin*/
-
- /*spdif clk tuning enable*/
- clk_tuning_enable = <1>;
+ pinctrl-0 = <&spdifout>;/* bob remove &spdifin*/
status = "okay";
};
diff --git a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
index c95c9f2..862dd6d 100644
--- a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
+++ b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
@@ -675,7 +675,7 @@
system-clock-frequency = <12288000>;
};
tdmccodec: codec {
- sound-dai = <&dummy_codec>;
+ sound-dai = <&dummy_codec &dummy_codec>;
};
};
@@ -1106,7 +1106,8 @@
#sound-dai-cells = <0>;
reg = <0x31>;
status = "okay";
- reset_pin = <&gpio GPIOAO_9 0>;
+ reset_pin = <&gpio_ao GPIOAO_9 0>;
+ enable_pin = <&gpio GPIOC_4 0>;
no_mclk;
};
@@ -1162,12 +1163,6 @@
*/
samesource_sel = <3>;
- /*enable default mclk(12.288M), before extern codec start*/
- start_clk_enable = <1>;
-
- /*tdm clk tuning enable*/
- clk_tuning_enable = <1>;
-
status = "okay";
};
@@ -1257,9 +1252,6 @@
pinctrl-names = "spdif_pins";
pinctrl-0 = <&spdifout>;/* bob remove &spdifin*/
- /*spdif clk tuning enable*/
- clk_tuning_enable = <1>;
-
status = "okay";
};
spdifb: spdif@1 {
diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts
index d7dd72c..da2c43f 100644
--- a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts
+++ b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts
@@ -673,7 +673,7 @@
system-clock-frequency = <12288000>;
};
tdmccodec: codec {
- sound-dai = <&dummy_codec>;
+ sound-dai = <&dummy_codec &dummy_codec>;
};
};
@@ -1105,7 +1105,8 @@
#sound-dai-cells = <0>;
reg = <0x31>;
status = "okay";
- reset_pin = <&gpio GPIOAO_9 0>;
+ reset_pin = <&gpio_ao GPIOAO_9 0>;
+ enable_pin = <&gpio GPIOC_4 0>;
no_mclk;
};
@@ -1158,7 +1159,6 @@
* 4: spdifout_b;
*/
samesource_sel = <3>;
-
/*enable default mclk(12.288M), before extern codec start*/
start_clk_enable = <1>;
@@ -1252,10 +1252,7 @@
interrupt-names = "irq_spdifin";
pinctrl-names = "spdif_pins";
- pinctrl-0 = <&spdifout /* &spdifin */>;
-
- /*spdif clk tuning enable*/
- clk_tuning_enable = <1>;
+ pinctrl-0 = <&spdifout>;/* bob remove &spdifin*/
status = "okay";
};
diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
index b9af802..cf218dc 100644
--- a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
+++ b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
@@ -673,7 +673,7 @@
system-clock-frequency = <12288000>;
};
tdmccodec: codec {
- sound-dai = <&dummy_codec>;
+ sound-dai = <&dummy_codec &dummy_codec>;
};
};
@@ -1105,7 +1105,8 @@
#sound-dai-cells = <0>;
reg = <0x31>;
status = "okay";
- reset_pin = <&gpio GPIOAO_9 0>;
+ reset_pin = <&gpio_ao GPIOAO_9 0>;
+ enable_pin = <&gpio GPIOC_4 0>;
no_mclk;
};
@@ -1159,12 +1160,6 @@
*/
samesource_sel = <3>;
- /*enable default mclk(12.288M), before extern codec start*/
- start_clk_enable = <1>;
-
- /*tdm clk tuning enable*/
- clk_tuning_enable = <1>;
-
status = "okay";
};
@@ -1252,10 +1247,7 @@
interrupt-names = "irq_spdifin";
pinctrl-names = "spdif_pins";
- pinctrl-0 = <&spdifout /* &spdifin */>;
-
- /*spdif clk tuning enable*/
- clk_tuning_enable = <1>;
+ pinctrl-0 = <&spdifout>;/* bob remove &spdifin*/
status = "okay";
};
diff --git a/sound/soc/amlogic/auge/ddr_mngr.c b/sound/soc/amlogic/auge/ddr_mngr.c
index 756167b..deae7d1 100644
--- a/sound/soc/amlogic/auge/ddr_mngr.c
+++ b/sound/soc/amlogic/auge/ddr_mngr.c
@@ -1031,7 +1031,6 @@ int aml_check_sharebuffer_valid(struct frddr *fr, int ss_sel)
if (frddrs[i].in_use
&& (frddrs[i].fifo_id != current_fifo_id)
&& (frddrs[i].dest == ss_sel)) {
-
ret = 0;
break;
}
diff --git a/sound/soc/amlogic/auge/spdif.c b/sound/soc/amlogic/auge/spdif.c
index 7663244b..acc4822 100644
--- a/sound/soc/amlogic/auge/spdif.c
+++ b/sound/soc/amlogic/auge/spdif.c
@@ -38,7 +38,6 @@
#include "spdif_match_table.c"
#include "resample.h"
#include "resample_hw.h"
-#include "spdif.h"
#define DRV_NAME "snd_spdif"
@@ -49,7 +48,6 @@
/*#define __SPDIFIN_INSERT_CHNUM__*/
/*#define __SPDIFIN_AUDIO_TYPE_HW__*/
-struct aml_spdif *spdif_priv[2];
static int aml_dai_set_spdif_sysclk(struct snd_soc_dai *cpu_dai,
int clk_id, unsigned int freq, int dir);
@@ -117,7 +115,6 @@ struct aml_spdif {
bool mute;
enum SPDIF_SRC spdifin_src;
int clk_tuning_enable;
- bool on;
};
static const struct snd_pcm_hardware aml_spdif_hardware = {
@@ -325,20 +322,6 @@ int spdifin_source_set_enum(
return 0;
}
-
-int spdif_set_audio_clk(int id,
- struct clk *clk_src, int rate, int same)
-{
- if (spdif_priv[id]->on && same) {
- pr_debug("spdif priority");
- return 0;
- }
-
- clk_set_parent(spdif_priv[id]->clk_spdifout, clk_src);
- clk_set_rate(spdif_priv[id]->clk_spdifout, rate);
- return 0;
-}
-
static int spdif_clk_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
@@ -767,7 +750,6 @@ static int aml_spdif_open(struct snd_pcm_substream *substream)
snd_soc_set_runtime_hwparams(substream, &aml_spdif_hardware);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- p_spdif->on = true;
p_spdif->fddr = aml_audio_register_frddr(dev,
p_spdif->actrl,
aml_spdif_ddr_isr, substream, false);
@@ -812,7 +794,6 @@ static int aml_spdif_close(struct snd_pcm_substream *substream)
pr_info("%s\n", __func__);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- p_spdif->on = false;
aml_audio_unregister_frddr(p_spdif->dev, substream);
} else {
aml_audio_unregister_toddr(p_spdif->dev, substream);
@@ -1348,13 +1329,8 @@ static void aml_set_spdifclk(struct aml_spdif *p_spdif)
mpll_freq = p_spdif->sysclk_freq * 58 / 2; /* 96k */
#endif
clk_set_rate(p_spdif->sysclk, mpll_freq);
- /*
clk_set_rate(p_spdif->clk_spdifout,
p_spdif->sysclk_freq);
- */
- spdif_set_audio_clk(p_spdif->id,
- p_spdif->sysclk,
- p_spdif->sysclk_freq, 0);
ret = clk_prepare_enable(p_spdif->sysclk);
if (ret) {
@@ -1624,7 +1600,7 @@ static int aml_spdif_platform_probe(struct platform_device *pdev)
dev_err(dev, "devm_snd_soc_register_component failed\n");
return ret;
}
- spdif_priv[aml_spdif->id] = aml_spdif;
+
pr_info("%s, register soc platform\n", __func__);
return devm_snd_soc_register_platform(dev, &aml_spdif_platform);
diff --git a/sound/soc/amlogic/auge/spdif.h b/sound/soc/amlogic/auge/spdif.h
deleted file mode 100644
index 66e36d8..0000000
--- a/sound/soc/amlogic/auge/spdif.h
+++ b/dev/null
@@ -1,32 +0,0 @@
-/*
- * sound/soc/amlogic/auge/spdif.h
- *
- * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- */
-
-#ifndef __AML_SPDIF_H__
-#define __AML_SPDIF_H__
-#include <linux/clk.h>
-#if 0
-enum SPDIF_ID {
- SPDIF_A,
- SPDIF_B,
- SPDIF_ID_CNT
-};
-#endif
-
-extern int spdif_set_audio_clk(int id,
- struct clk *clk_src, int rate, int same);
-
-#endif
diff --git a/sound/soc/amlogic/auge/tdm.c b/sound/soc/amlogic/auge/tdm.c
index a37ad3d..e4af0e5 100644
--- a/sound/soc/amlogic/auge/tdm.c
+++ b/sound/soc/amlogic/auge/tdm.c
@@ -43,8 +43,6 @@
#include "spdif_hw.h"
#include "tdm_match_table.c"
#include "effects_v2.h"
-#include "spdif.h"
-
/*#define __PTM_TDM_CLK__*/
@@ -491,9 +489,6 @@ static int aml_dai_tdm_prepare(struct snd_pcm_substream *substream,
fr, p_tdm->samesource_sel,
p_tdm->lane_ss,
p_tdm->chipinfo->reset_reg_offset);
- /* sharebuffer default uses spdif_a */
- spdif_set_audio_clk(p_tdm->samesource_sel - 3,
- p_tdm->clk, runtime->rate*128, 1);
}
/* i2s source to hdmix */
@@ -959,7 +954,6 @@ static int aml_dai_tdm_hw_params(struct snd_pcm_substream *substream,
&& (aml_check_sharebuffer_valid(p_tdm->fddr,
p_tdm->samesource_sel))
&& p_tdm->en_share) {
-#if 0
int mux = 0, ratio = 0;
sharebuffer_get_mclk_fs_ratio(p_tdm->samesource_sel,
@@ -975,7 +969,6 @@ static int aml_dai_tdm_hw_params(struct snd_pcm_substream *substream,
rate * ratio);
clk_prepare_enable(p_tdm->samesrc_clk);
}
-#endif
}
if (!p_tdm->contns_clk && !IS_ERR(p_tdm->mclk)) {
diff --git a/sound/soc/codecs/amlogic/ad82584f.c b/sound/soc/codecs/amlogic/ad82584f.c
index aa87176..d0aaa05 100644
--- a/sound/soc/codecs/amlogic/ad82584f.c
+++ b/sound/soc/codecs/amlogic/ad82584f.c
@@ -600,7 +600,7 @@ struct ad82584f_priv {
unsigned char Ch2_vol;
unsigned char master_vol;
unsigned char mute_val;
-
+ unsigned int inited;
#ifdef CONFIG_HAS_EARLYSUSPEND
struct early_suspend early_suspend;
#endif
@@ -699,6 +699,7 @@ static int ad82584f_set_bias_level(struct snd_soc_codec *codec,
return 0;
}
+static int ad82584f_init(struct snd_soc_codec *codec);
static int ad82584f_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
@@ -713,6 +714,14 @@ static int ad82584f_prepare(struct snd_pcm_substream *substream,
/*unmute,default power-on is mute.*/
snd_soc_write(codec, 0x02, 0x00);
+#else
+ struct snd_soc_codec *codec = dai->codec;
+ struct ad82584f_priv *ad82584f = snd_soc_codec_get_drvdata(codec);
+
+ if (ad82584f->inited == 0) {
+ ad82584f_init(codec);
+ ad82584f->inited = 1;
+ }
#endif
return 0;
@@ -763,7 +772,6 @@ static int reset_ad82584f_GPIO(struct snd_soc_codec *codec)
struct ad82584f_priv *ad82584f = snd_soc_codec_get_drvdata(codec);
struct ad82584f_platform_data *pdata = ad82584f->pdata;
int ret = 0;
-
if (pdata->reset_pin < 0)
return 0;
@@ -1000,7 +1008,7 @@ static int ad82584f_i2c_probe(struct i2c_client *i2c,
return -ENOMEM;
}
ad82584f->pdata = pdata;
-
+ ad82584f->inited = 0;
ad82584f_parse_dt(ad82584f, i2c->dev.of_node);
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ad82584f,