Commit 278982b5 authored by oder_chiou@realtek.com's avatar oder_chiou@realtek.com Committed by Mark Brown

ASoC: rt5663: Seprate the DC offset between headphone and headset

The patch seprates the DC offset between headphone and headset.
Signed-off-by: default avatarOder Chiou <oder_chiou@realtek.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c1bbaff6
...@@ -14,8 +14,11 @@ Optional properties: ...@@ -14,8 +14,11 @@ Optional properties:
- "realtek,dc_offset_l_manual" - "realtek,dc_offset_l_manual"
- "realtek,dc_offset_r_manual" - "realtek,dc_offset_r_manual"
- "realtek,dc_offset_l_manual_mic"
- "realtek,dc_offset_r_manual_mic"
Based on the different PCB layout, add the manual offset value to Based on the different PCB layout, add the manual offset value to
compensate the DC offset for each L and R channel. compensate the DC offset for each L and R channel, and they are different
between headphone and headset.
Pins on the device (for linking into audio routes) for RT5663: Pins on the device (for linking into audio routes) for RT5663:
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
struct rt5663_platform_data { struct rt5663_platform_data {
unsigned int dc_offset_l_manual; unsigned int dc_offset_l_manual;
unsigned int dc_offset_r_manual; unsigned int dc_offset_r_manual;
unsigned int dc_offset_l_manual_mic;
unsigned int dc_offset_r_manual_mic;
}; };
#endif #endif
......
...@@ -1570,9 +1570,43 @@ static int rt5663_jack_detect(struct snd_soc_codec *codec, int jack_insert) ...@@ -1570,9 +1570,43 @@ static int rt5663_jack_detect(struct snd_soc_codec *codec, int jack_insert)
case 2: case 2:
rt5663->jack_type = SND_JACK_HEADSET; rt5663->jack_type = SND_JACK_HEADSET;
rt5663_enable_push_button_irq(codec, true); rt5663_enable_push_button_irq(codec, true);
if (rt5663->pdata.dc_offset_l_manual_mic) {
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_2,
rt5663->pdata.dc_offset_l_manual_mic >>
16);
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_3,
rt5663->pdata.dc_offset_l_manual_mic &
0xffff);
}
if (rt5663->pdata.dc_offset_r_manual_mic) {
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_5,
rt5663->pdata.dc_offset_r_manual_mic >>
16);
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_6,
rt5663->pdata.dc_offset_r_manual_mic &
0xffff);
}
break; break;
default: default:
rt5663->jack_type = SND_JACK_HEADPHONE; rt5663->jack_type = SND_JACK_HEADPHONE;
if (rt5663->pdata.dc_offset_l_manual) {
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_2,
rt5663->pdata.dc_offset_l_manual >> 16);
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_3,
rt5663->pdata.dc_offset_l_manual &
0xffff);
}
if (rt5663->pdata.dc_offset_r_manual) {
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_5,
rt5663->pdata.dc_offset_r_manual >> 16);
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_6,
rt5663->pdata.dc_offset_r_manual &
0xffff);
}
break; break;
} }
} else { } else {
...@@ -3133,6 +3167,10 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) ...@@ -3133,6 +3167,10 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev)
&rt5663->pdata.dc_offset_l_manual); &rt5663->pdata.dc_offset_l_manual);
device_property_read_u32(dev, "realtek,dc_offset_r_manual", device_property_read_u32(dev, "realtek,dc_offset_r_manual",
&rt5663->pdata.dc_offset_r_manual); &rt5663->pdata.dc_offset_r_manual);
device_property_read_u32(dev, "realtek,dc_offset_l_manual_mic",
&rt5663->pdata.dc_offset_l_manual_mic);
device_property_read_u32(dev, "realtek,dc_offset_r_manual_mic",
&rt5663->pdata.dc_offset_r_manual_mic);
return 0; return 0;
} }
...@@ -3221,20 +3259,6 @@ static int rt5663_i2c_probe(struct i2c_client *i2c, ...@@ -3221,20 +3259,6 @@ static int rt5663_i2c_probe(struct i2c_client *i2c,
dev_err(&i2c->dev, "%s:Unknown codec type\n", __func__); dev_err(&i2c->dev, "%s:Unknown codec type\n", __func__);
} }
if (rt5663->pdata.dc_offset_l_manual) {
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_2,
rt5663->pdata.dc_offset_l_manual >> 16);
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_3,
rt5663->pdata.dc_offset_l_manual & 0xffff);
}
if (rt5663->pdata.dc_offset_r_manual) {
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_5,
rt5663->pdata.dc_offset_r_manual >> 16);
regmap_write(rt5663->regmap, RT5663_MIC_DECRO_6,
rt5663->pdata.dc_offset_r_manual & 0xffff);
}
/* GPIO1 as IRQ */ /* GPIO1 as IRQ */
regmap_update_bits(rt5663->regmap, RT5663_GPIO_1, RT5663_GP1_PIN_MASK, regmap_update_bits(rt5663->regmap, RT5663_GPIO_1, RT5663_GP1_PIN_MASK,
RT5663_GP1_PIN_IRQ); RT5663_GP1_PIN_IRQ);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment