ASoC: RT286: remove test code
Subsystems (3)
PATCH 1/3 ASoC: RT286: remove test code
From: Bard Liao <[email protected]>
Remove test code.
Signed-off-by Bard Liao <[email protected]>
--- sound/soc/codecs/rt286.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/rt286.c +0 -1
@@ -993,7 +993,6 @@ static int rt286_probe(struct snd_soc_codec *codec) codec->dapm.bias_level =SND_SOC_BIAS_OFF ; rt286->codec = codec; - rt286->i2c->irq =0 ;if (rt286->i2c->irq) {snd_soc_update_bits (codec,RT286_IRQ_CTRL ,0x2 ,0x2 );
Signature · 1 line
1.8.1.1.439.g50a6b54
PATCH 2/3 ASoC: RT286: check ID in i2c level
From: Bard Liao <[email protected]>
Move ID check from asoc level to i2c level.
Signed-off-by Bard Liao <[email protected]>
--- sound/soc/codecs/rt286.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
sound/soc/codecs/rt286.c +8 -8
@@ -952,14 +952,6 @@ static int rt286_probe(struct snd_soc_codec *codec)struct rt286_priv *rt286 =snd_soc_codec_get_drvdata (codec);int i, ret; - ret =snd_soc_read (codec, -RT286_GET_PARAM (AC_NODE_ROOT ,AC_PAR_VENDOR_ID )); -if (ret !=RT286_VENDOR_ID ) { -dev_err (codec->dev, -"Device with ID register %x is not rt286\n" , ret); -return -ENODEV ; - } -snd_soc_write (codec,RT286_SET_AUDIO_POWER ,AC_PWRST_D3 );for (i =0 ; i <RT286_POWER_REG_LEN ; i++)
@@ -1164,6 +1156,14 @@ static int rt286_i2c_probe(struct i2c_client *i2c,return ret; } +regmap_read (rt286->regmap, +RT286_GET_PARAM (AC_NODE_ROOT ,AC_PAR_VENDOR_ID ), &ret); +if (ret !=RT286_VENDOR_ID ) { +dev_err (&i2c->dev, +"Device with ID register %x is not rt286\n" , ret); +return -ENODEV ; + } + rt286->index_cache = rt286_index_def; rt286->i2c = i2c;i2c_set_clientdata (i2c, rt286);
Signature · 1 line
1.8.1.1.439.g50a6b54
PATCH 3/3 ASoC: RT286: move initial settings to _i2c_probe
In reply to [email protected]From: Bard Liao <[email protected]>
Move codec initial settings from asoc probe to i2c probe.
Signed-off-by Bard Liao <[email protected]>
--- sound/soc/codecs/rt286.c | 99 ++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 50 deletions(-)
sound/soc/codecs/rt286.c +49 -50
@@ -950,59 +950,10 @@ static irqreturn_t rt286_irq(int irq, void *data)static int rt286_probe (struct snd_soc_codec *codec) {struct rt286_priv *rt286 =snd_soc_codec_get_drvdata (codec); -int i, ret; - -snd_soc_write (codec,RT286_SET_AUDIO_POWER ,AC_PWRST_D3 ); - -for (i =0 ; i <RT286_POWER_REG_LEN ; i++) -snd_soc_write (codec, -RT286_SET_POWER (rt286_support_power_controls[i]), -AC_PWRST_D1 ); - -if (!rt286->pdata.cbj_en) { -snd_soc_write (codec,RT286_CBJ_CTRL2 ,0x0000 ); -snd_soc_write (codec,RT286_MIC1_DET_CTRL ,0x0816 ); -snd_soc_write (codec,RT286_MISC_CTRL1 ,0x0000 ); -snd_soc_update_bits (codec, -RT286_CBJ_CTRL1 ,0xf000 ,0xb000 ); - }else { -snd_soc_update_bits (codec, -RT286_CBJ_CTRL1 ,0xf000 ,0x5000 ); - } - -mdelay (10 ); - -if (!rt286->pdata.gpio2_en) -snd_soc_write (codec,RT286_SET_DMIC2_DEFAULT ,0x4000 ); -else -snd_soc_write (codec,RT286_SET_DMIC2_DEFAULT ,0 ); - -mdelay (10 ); - -/*Power down LDO2*/ -snd_soc_update_bits (codec,RT286_POWER_CTRL2 ,0x8 ,0x0 ); codec->dapm.bias_level =SND_SOC_BIAS_OFF ; rt286->codec = codec; -if (rt286->i2c->irq) { -snd_soc_update_bits (codec, -RT286_IRQ_CTRL ,0x2 ,0x2 ); - -INIT_DELAYED_WORK (&rt286->jack_detect_work, - rt286_jack_detect_work); -schedule_delayed_work (&rt286->jack_detect_work, -msecs_to_jiffies (1250 )); - - ret =request_threaded_irq (rt286->i2c->irq,NULL , rt286_irq, -IRQF_TRIGGER_HIGH |IRQF_ONESHOT ,"rt286" , rt286); -if (ret !=0 ) { -dev_err (codec->dev, -"Failed to reguest IRQ: %d\n" , ret); -return ret; - } - } -return 0 ; }
@@ -1141,7 +1092,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c, {struct rt286_platform_data *pdata =dev_get_platdata (&i2c->dev);struct rt286_priv *rt286; -int ret; +int i, ret; rt286 =devm_kzalloc (&i2c->dev,sizeof (*rt286),GFP_KERNEL );
@@ -1171,6 +1122,54 @@ static int rt286_i2c_probe(struct i2c_client *i2c,if (pdata) rt286->pdata = *pdata; +regmap_write (rt286->regmap,RT286_SET_AUDIO_POWER ,AC_PWRST_D3 ); + +for (i =0 ; i <RT286_POWER_REG_LEN ; i++) +regmap_write (rt286->regmap, +RT286_SET_POWER (rt286_support_power_controls[i]), +AC_PWRST_D1 ); + +if (!rt286->pdata.cbj_en) { +regmap_write (rt286->regmap,RT286_CBJ_CTRL2 ,0x0000 ); +regmap_write (rt286->regmap,RT286_MIC1_DET_CTRL ,0x0816 ); +regmap_write (rt286->regmap,RT286_MISC_CTRL1 ,0x0000 ); +regmap_update_bits (rt286->regmap, +RT286_CBJ_CTRL1 ,0xf000 ,0xb000 ); + }else { +regmap_update_bits (rt286->regmap, +RT286_CBJ_CTRL1 ,0xf000 ,0x5000 ); + } + +mdelay (10 ); + +if (!rt286->pdata.gpio2_en) +regmap_write (rt286->regmap,RT286_SET_DMIC2_DEFAULT ,0x4000 ); +else +regmap_write (rt286->regmap,RT286_SET_DMIC2_DEFAULT ,0 ); + +mdelay (10 ); + +/*Power down LDO2*/ +regmap_update_bits (rt286->regmap,RT286_POWER_CTRL2 ,0x8 ,0x0 ); + +if (rt286->i2c->irq) { +regmap_update_bits (rt286->regmap, +RT286_IRQ_CTRL ,0x2 ,0x2 ); + +INIT_DELAYED_WORK (&rt286->jack_detect_work, + rt286_jack_detect_work); +schedule_delayed_work (&rt286->jack_detect_work, +msecs_to_jiffies (1250 )); + + ret =request_threaded_irq (rt286->i2c->irq,NULL , rt286_irq, +IRQF_TRIGGER_HIGH |IRQF_ONESHOT ,"rt286" , rt286); +if (ret !=0 ) { +dev_err (&i2c->dev, +"Failed to reguest IRQ: %d\n" , ret); +return ret; + } + } + ret =snd_soc_register_codec (&i2c->dev, &soc_codec_dev_rt286, rt286_dai,ARRAY_SIZE (rt286_dai));
Signature · 1 line
1.8.1.1.439.g50a6b54
Quoted 3 lines · On Mon, Jul 07, 2014 at 04:48:36PM +0800, [email protected] wrote:
From: Bard Liao <[email protected]>
Remove test code.
Applied all, thanks.