说明
- 声卡原理图
- 相关寄存器
修改源码
diff --git a/arch/arm/boot/dts/rk3126-adaline.dts b/arch/arm/boot/dts/rk3126-adaline.dts
index 4fdca97..e4937d9 100755
--- a/arch/arm/boot/dts/rk3126-adaline.dts
+++ b/arch/arm/boot/dts/rk3126-adaline.dts
@@ -343,6 +346,8 @@
&codec {
spk_ctl_io = <&gpio2 GPIO_B1 GPIO_ACTIVE_HIGH>;
spk-mute-delay = <200>;
hp-mute-delay = <100>;
+ supports-adclr-swap;
+ supports-daclr-swap;
};
diff --git a/sound/soc/codecs/rk312x_codec.c b/sound/soc/codecs/rk312x_codec.c
index 1322702..f75c314 100755
--- a/sound/soc/codecs/rk312x_codec.c
+++ b/sound/soc/codecs/rk312x_codec.c
@@ -119,6 +119,9 @@ struct rk312x_codec_priv {
struct work_struct work;
struct delayed_work init_delayed_work;
struct delayed_work hpdet_work;
+
+ bool is_support_adclr_swap;
+ bool is_support_daclr_swap;
};
static struct rk312x_codec_priv *rk312x_priv;
@@ -1668,10 +1671,19 @@ static int rk312x_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
+#if 0
adc_aif1 |= RK312x_ADC_SWAP_DIS;
adc_aif2 |= RK312x_ADC_RST_DIS;
dac_aif1 |= RK312x_DAC_SWAP_DIS;
dac_aif2 |= RK312x_DAC_RST_DIS;
+#else
+ adc_aif1 |= (rk312x->is_support_adclr_swap == 1) ?
+ RK312x_ADC_SWAP_EN : RK312x_ADC_SWAP_DIS;
+ adc_aif2 |= RK312x_ADC_RST_DIS;
+ dac_aif1 |= (rk312x->is_support_daclr_swap == 1) ?
+ RK312x_DAC_SWAP_EN : RK312x_DAC_SWAP_DIS;
+ dac_aif2 |= RK312x_DAC_RST_DIS;
+#endif
rk312x->rate = rate;
@@ -2435,6 +2447,21 @@ static struct snd_soc_codec_driver soc_codec_dev_rk312x = {
.reg_cache_step = sizeof(unsigned int),
};
+static inline int rk312x_codec_parse_dts(struct device *dev,
+ struct rk312x_codec_priv *rk312x)
+{
+ struct device_node *np = dev->of_node;
+
+ rk312x->is_support_adclr_swap = 0;
+ rk312x->is_support_daclr_swap = 0;
+ if (of_find_property(np, "supports-adclr-swap", NULL))
+ rk312x->is_support_adclr_swap = 1;
+ if (of_find_property(np, "supports-daclr-swap", NULL))
+ rk312x->is_support_daclr_swap = 1;
+
+ return 0;
+}
+
static int rk312x_platform_probe(struct platform_device *pdev)
{
struct device_node *rk312x_np = pdev->dev.of_node;
@@ -2451,6 +2478,8 @@ static int rk312x_platform_probe(struct platform_device *pdev)
rk312x_priv = rk312x;