mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
codec: fixed audio codec tlv320adc3101 input mode error
PD#150798: codec: fixed audio codec tlv320adc3101 input mode add single end and differential input for S400&S420 Change-Id: I83086663b38e322425f6719247c89877504f22f5 Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
This commit is contained in:
@@ -877,6 +877,7 @@
|
||||
compatible = "ti,tlv320adc3101";
|
||||
#sound-dai-cells = <0>;
|
||||
reg = <0x19>;
|
||||
differential_pair = <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
@@ -877,6 +877,7 @@
|
||||
compatible = "ti,tlv320adc3101";
|
||||
#sound-dai-cells = <0>;
|
||||
reg = <0x19>;
|
||||
differential_pair = <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
@@ -708,6 +708,7 @@
|
||||
compatible = "ti,tlv320adc3101";
|
||||
#sound-dai-cells = <0>;
|
||||
reg = <0x19>;
|
||||
differential_pair = <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
@@ -707,6 +707,7 @@
|
||||
compatible = "ti,tlv320adc3101";
|
||||
#sound-dai-cells = <0>;
|
||||
reg = <0x19>;
|
||||
differential_pair = <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
@@ -709,6 +709,7 @@
|
||||
compatible = "ti,tlv320adc3101";
|
||||
#sound-dai-cells = <0>;
|
||||
reg = <0x19>;
|
||||
differential_pair = <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
@@ -67,6 +67,11 @@ struct adc3101_priv {
|
||||
int codec_mask;
|
||||
struct i2c_client *client[4];
|
||||
u8 page_no;
|
||||
/* differential_pair
|
||||
* 0: Single-ended;
|
||||
* 1: Differential Pair;
|
||||
*/
|
||||
unsigned int differential_pair;
|
||||
};
|
||||
|
||||
enum{
|
||||
@@ -523,14 +528,20 @@ static int adc3101_hw_params(struct snd_pcm_substream *substream,
|
||||
pr_info("%s iface1 = %02x\n", __func__, data);
|
||||
|
||||
snd_soc_write(codec, ADC3101_MICBIAS, 0x50);
|
||||
/* 0x3f: differential, 0xFC:single input */
|
||||
snd_soc_write(codec, ADC3101_LMICPGANIN, 0x3F);
|
||||
/* 0x3f: differential input */
|
||||
snd_soc_write(codec, ADC3101_RMICPGANIN, 0x3F);
|
||||
/* 0x3f: differential, 0xFC:single input */
|
||||
snd_soc_write(codec, ADC3101_LMICPGAPIN, 0x3F);
|
||||
/* 0x3f: differential input */
|
||||
snd_soc_write(codec, ADC3101_RMICPGAPIN, 0x3F);
|
||||
|
||||
if (adc3101->differential_pair == 1) {
|
||||
pr_info("%s differential pair\n", __func__);
|
||||
snd_soc_write(codec, ADC3101_LMICPGANIN, 0x33); //54
|
||||
snd_soc_write(codec, ADC3101_RMICPGANIN, 0x33); //57
|
||||
snd_soc_write(codec, ADC3101_LMICPGAPIN, 0x3F); //52
|
||||
snd_soc_write(codec, ADC3101_RMICPGAPIN, 0x3F); //55
|
||||
} else {
|
||||
pr_info("%s single end\n", __func__);
|
||||
snd_soc_write(codec, ADC3101_LMICPGANIN, 0x3F); //54
|
||||
snd_soc_write(codec, ADC3101_RMICPGANIN, 0x3F); //57
|
||||
snd_soc_write(codec, ADC3101_LMICPGAPIN, 0xCF); //52
|
||||
snd_soc_write(codec, ADC3101_RMICPGAPIN, 0xCF); //55
|
||||
}
|
||||
snd_soc_write(codec, ADC3101_LMICPGAVOL, lr_gain);
|
||||
snd_soc_write(codec, ADC3101_RMICPGAVOL, lr_gain);
|
||||
snd_soc_write(codec, ADC3101_ADCSETUP, 0xc2);
|
||||
@@ -822,6 +833,13 @@ static int adc3101_i2c_probe(struct i2c_client *i2c,
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
ret = of_property_read_u32(i2c->dev.of_node, "differential_pair",
|
||||
&adc3101->differential_pair);
|
||||
if (ret) {
|
||||
pr_err("failed to get differential_pair, set it default\n");
|
||||
adc3101->differential_pair = 0;
|
||||
ret = 0;
|
||||
}
|
||||
pr_info("%s i2c:%p\n", __func__, i2c);
|
||||
ret = snd_soc_register_codec(&i2c->dev,
|
||||
&soc_codec_dev_adc3101, adc3101_dai, 1);
|
||||
|
||||
Reference in New Issue
Block a user