[Bugfix][T106BUG-582][codec] Fixed the problem that the baseline version of codec 3104 plays recordings without sound.
Only Configure: No
Affected branch: master
Affected module: codec
Is it affected on both ZXIC and MTK:only zxic
Self-test: Yes
Doc Update:No
Change-Id: I88338a59ef54854ac7f581df86d0c1784bac7cb8
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
index d441a1a..b4124b6 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
@@ -486,17 +486,19 @@
status = "disabled";
};
codec_ti3104: ti3104@18 {
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
compatible = "ti,tlv320aic3104";
- reg = <0x18>;
- reset-gpios = <&bgpio 122 GPIO_ACTIVE_HIGH>;/*RST*/
+ reg = <0x18>;
+ //reset-gpios = <&bgpio 122 GPIO_ACTIVE_HIGH>;/*RST*/
ai3x-micbias-vg = <MICBIAS_2_0V>;
- clocks = <&clkc CLKOUT1_CLK>;
- clock-names = "clk_out";
- pinctrl-names = "clk_out","reset_gpio122";
- pinctrl-0 = <&clk1_func_pins>;
+ clocks = <&clkc CLKOUT2_CLK>;
+ clock-names = "clk_out";
+ pinctrl-names = "clk_out","reset_gpio122";
+ pinctrl-0 = <&clk2_func_pins>;
pinctrl-1 = <&codec_reset_pins>;
status = "disabled";
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
};
codec_max9867: max9867@18 {
compatible = "maxim,max9867";
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c
index 3690409..165d46d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c
@@ -1203,13 +1203,15 @@
regmap_read(info->regmap, AIC3X_PAGE_SELECT, &pre_page);
regmap_write(info->regmap, AIC3X_PAGE_SELECT, 0);
- for (i = regmin; i < regmax; i++) {
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
+ for (i = regmin; i <= regmax; i++) {
//val = snd_soc_component_read(info->component, i);
regmap_read(info->regmap, i, &val);
dev_info(dev,"cocec reg read ,Reg(%d)=0x%x \n",i, val);
}
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
regmap_write(info->regmap, AIC3X_PAGE_SELECT, pre_page);
return count;
@@ -1255,23 +1257,18 @@
dev_info(dev, "%s:cmd_str=%s \n",__func__,cmd_str);
-
ret = strcmp(cmd_str,"reg_read");
if( ret == 0)
{
dev_info(dev, "reg_read start\n");
- if(param1 > 1){
- dev_err(dev, "reg_read param invalidate fail,param1=%d \n",param1);
- return -1;
- }
- regpage = param1;
- if(param2 > regmax){
- dev_err(dev, "reg_read param invalidate fail,param2=%d \n",param2);
- return -1;
- }
-
-
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
+ if(param1 < 0 || param1 > 109){
+ dev_err(dev, "reg_read param invalidate fail,param1=%d \n",param1);
+ return -1;
+ }
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
+
regmap_read(info->regmap, AIC3X_PAGE_SELECT, &pre_page);
regmap_write(info->regmap, AIC3X_PAGE_SELECT, regpage);
@@ -1295,17 +1292,14 @@
//u32 offset = param1;
//u32 mask = param2;
dev_info(dev, "reg_write start\n");
- if(param1 > 1){
- dev_err(dev, "reg_write param invalidate fail,param1=%d \n",param1);
- return -1;
- }
- regpage = param1;
- if(param2 > regmax){
- dev_err(dev, "reg_write param invalidate fail,param1=%d \n",param1);
- return -1;
- }
-
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
+ if(param1 < 0 || param1 > 109){
+ dev_err(dev, "reg_write param invalidate fail,param1=%d \n",param1);
+ return -1;
+ }
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
+
regmap_read(info->regmap, AIC3X_PAGE_SELECT, &pre_page);
regmap_write(info->regmap, AIC3X_PAGE_SELECT, regpage);
@@ -1842,23 +1836,25 @@
.no_capture_mute = 1,
};
+//yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
static struct snd_soc_dai_driver aic3x_dai = {
.name = "tlv320aic3x-hifi",
.playback = {
.stream_name = "Playback",
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = AIC3X_RATES,
.formats = AIC3X_FORMATS,},
.capture = {
.stream_name = "Capture",
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = AIC3X_RATES,
.formats = AIC3X_FORMATS,},
.ops = &aic3x_dai_ops,
.symmetric_rates = 1,
};
+//yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
static void aic3x_mono_init(struct snd_soc_component *component)
{
@@ -2045,6 +2041,40 @@
return 0;
}
+//yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
+static int component_open(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream)
+{
+ int ret = 0;
+ struct aic3x_priv *info = snd_soc_component_get_drvdata(component);
+ printk("Enter into %s()\n", __func__);
+
+ if(info->clk != NULL) {
+ ret = clk_enable(info->clk);
+ if(ret) {
+ pr_err("failed to enable clkout");
+ }
+ }
+ pr_info("%s:clk en end!\n", __func__);
+
+ return ret;
+}
+
+static int component_close(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream)
+{
+ int ret = 0;
+ struct aic3x_priv *info = snd_soc_component_get_drvdata(component);
+ printk("Enter into %s()\n", __func__);
+
+ if(info->clk != NULL) {
+ clk_disable(info->clk);
+ }
+ pr_info("%s:clk dis end!\n", __func__);
+
+ return ret;
+}
+
static const struct snd_soc_component_driver soc_component_dev_aic3x = {
.set_bias_level = aic3x_set_bias_level,
.probe = aic3x_probe,
@@ -2057,7 +2087,10 @@
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
+ .open = component_open,
+ .close = component_close,
};
+//yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
static void aic3x_configure_ocmv(struct i2c_client *client)
{
@@ -2252,7 +2285,6 @@
#endif
-
pr_info( "alsa %s:end\n",__func__);
return 0;