From 818f76831992198121c8949789c71a1adb02e329 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Mon, 17 Oct 2016 15:15:18 +0000 Subject: ASoC: rk3399_gru_sound: Fix non static symbol warning Fixes the following sparse warning: sound/soc/rockchip/rk3399_gru_sound.c:41:14: warning: symbol 'rt5514_dmic_delay' was not declared. Should it be static? Signed-off-by: Wei Yongjun Signed-off-by: Mark Brown --- sound/soc/rockchip/rk3399_gru_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 9ed735a6cf49..0cbd23555ba4 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -38,7 +38,7 @@ #define SOUND_FS 256 -unsigned int rt5514_dmic_delay; +static unsigned int rt5514_dmic_delay; static struct snd_soc_jack rockchip_sound_jack; -- cgit v1.2.3 From 705e9994a437bbdaf655612f3526e3567db56bdd Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 15 Oct 2016 16:55:47 +0200 Subject: ASoC: rockchip: constify snd_soc_ops structures Check for snd_soc_ops structures that are only stored in the ops field of a snd_soc_dai_link structure. This field is declared const, so snd_soc_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_soc_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_dai_link e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i, e; position p; @@ struct snd_soc_dai_link e[] = { ..., { .ops = &i@p, }, ..., }; @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_soc_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_soc_ops i = { ... }; // The effect on the layout of the .o files is shown by the following output of the size command, first before then after the transformation: text data bss dec hex filename 5027 2488 416 7931 1efb sound/soc/rockchip/rk3399_gru_sound.o 5219 2312 416 7947 1f0b sound/soc/rockchip/rk3399_gru_sound.o text data bss dec hex filename 3499 1648 384 5531 159b sound/soc/rockchip/rockchip_max98090.o 3563 1584 384 5531 159b sound/soc/rockchip/rockchip_max98090.o text data bss dec hex filename 3455 1536 384 5375 14ff sound/soc/rockchip/rockchip_rt5645.o 3519 1480 384 5383 1507 sound/soc/rockchip/rockchip_rt5645.o Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/rockchip/rk3399_gru_sound.c | 6 +++--- sound/soc/rockchip/rockchip_max98090.c | 2 +- sound/soc/rockchip/rockchip_rt5645.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 0cbd23555ba4..3475c61a5fa0 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -228,15 +228,15 @@ static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd) return 0; } -static struct snd_soc_ops rockchip_sound_max98357a_ops = { +static const struct snd_soc_ops rockchip_sound_max98357a_ops = { .hw_params = rockchip_sound_max98357a_hw_params, }; -static struct snd_soc_ops rockchip_sound_rt5514_ops = { +static const struct snd_soc_ops rockchip_sound_rt5514_ops = { .hw_params = rockchip_sound_rt5514_hw_params, }; -static struct snd_soc_ops rockchip_sound_da7219_ops = { +static const struct snd_soc_ops rockchip_sound_da7219_ops = { .hw_params = rockchip_sound_da7219_hw_params, }; diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index e70ffad07184..789d6f1e2b5f 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -119,7 +119,7 @@ static int rk_aif1_hw_params(struct snd_pcm_substream *substream, return ret; } -static struct snd_soc_ops rk_aif1_ops = { +static const struct snd_soc_ops rk_aif1_ops = { .hw_params = rk_aif1_hw_params, }; diff --git a/sound/soc/rockchip/rockchip_rt5645.c b/sound/soc/rockchip/rockchip_rt5645.c index 440a8026346a..9e0c17805807 100644 --- a/sound/soc/rockchip/rockchip_rt5645.c +++ b/sound/soc/rockchip/rockchip_rt5645.c @@ -135,7 +135,7 @@ static int rk_init(struct snd_soc_pcm_runtime *runtime) &headset_jack); } -static struct snd_soc_ops rk_aif1_ops = { +static const struct snd_soc_ops rk_aif1_ops = { .hw_params = rk_aif1_hw_params, }; -- cgit v1.2.3 From b058b176dd26546bcef8f8b774f1542b2907af5f Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Fri, 7 Oct 2016 10:59:51 +0300 Subject: ASoC: rl6347a: Use dev_err for I2C communication error prints It's difficult to guess from bunch of "ret=-121" errors what driver and device actually caused them. Since struct i2c_client has the dev pointer use that for dev_err() with meaningful error message. Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown --- sound/soc/codecs/rl6347a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/rl6347a.c b/sound/soc/codecs/rl6347a.c index a4b910efbd45..8f571cf8edd4 100644 --- a/sound/soc/codecs/rl6347a.c +++ b/sound/soc/codecs/rl6347a.c @@ -51,7 +51,7 @@ int rl6347a_hw_write(void *context, unsigned int reg, unsigned int value) if (ret == 4) return 0; else - pr_err("ret=%d\n", ret); + dev_err(&client->dev, "I2C error %d\n", ret); if (ret < 0) return ret; else -- cgit v1.2.3 From 4774e27ab8206f4a959a8c9054f55545e2dff42c Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Mon, 31 Oct 2016 17:19:54 +0800 Subject: ASoC: rt286: remove unnecessary selection in Kconfig SND_SOC_RT5663 is not required for SND_SOC_RT286. Signed-off-by: Bard Liao Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index c67667bb970f..22aaf63616a2 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -672,7 +672,6 @@ config SND_SOC_RL6347A config SND_SOC_RT286 tristate - select SND_SOC_RT5663 depends on I2C config SND_SOC_RT298 -- cgit v1.2.3 From 59b01131407780764f5286c1085a27675ee4898f Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 15 Nov 2016 15:25:50 +0800 Subject: ASoC: rl6231: add 19.2M to 4.096M pll preset table Add a pll mapping table for 19.2M in and 4.096M out. Signed-off-by: Bard Liao Signed-off-by: Mark Brown --- sound/soc/codecs/rl6231.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/codecs/rl6231.c b/sound/soc/codecs/rl6231.c index 1dc68ab08a17..7b447d0b173a 100644 --- a/sound/soc/codecs/rl6231.c +++ b/sound/soc/codecs/rl6231.c @@ -102,6 +102,7 @@ struct pll_calc_map { }; static const struct pll_calc_map pll_preset_table[] = { + {19200000, 4096000, 23, 14, 1, false}, {19200000, 24576000, 3, 30, 3, false}, }; -- cgit v1.2.3 From e3d62cb8c70ff5ff946051484b1cdb38523d8b95 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Mon, 28 Nov 2016 13:24:06 +0800 Subject: ASoC: rt298: disable IRQ when jack is NULL Disable IRQ when jack is NULL in rt298_mic_detect. So machine driver can use it in suspend/resume. Signed-off-by: Bard Liao Reviewed-by: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/codecs/rt298.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 55558643166f..6c4ac5b04665 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -321,11 +321,31 @@ static void rt298_jack_detect_work(struct work_struct *work) int rt298_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) { struct rt298_priv *rt298 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_dapm_context *dapm; + bool hp = false; + bool mic = false; + int status = 0; + + /* If jack in NULL, disable HS jack */ + if (!jack) { + regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0); + dapm = snd_soc_codec_get_dapm(codec); + snd_soc_dapm_disable_pin(dapm, "LDO1"); + snd_soc_dapm_sync(dapm); + return 0; + } rt298->jack = jack; + regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); - /* Send an initial empty report */ - snd_soc_jack_report(rt298->jack, 0, + rt298_jack_detect(rt298, &hp, &mic); + if (hp == true) + status |= SND_JACK_HEADPHONE; + + if (mic == true) + status |= SND_JACK_MICROPHONE; + + snd_soc_jack_report(rt298->jack, status, SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); return 0; -- cgit v1.2.3