Skip to contentSkip to conversation

ASoC: rt5640: Remove the pre-allocated size of reg_default

PATCH Applied Oder Chiou 2 participants 13 messages Mar 28, 2014 – Mar 31, 2014

Subsystems (3)
lore
Share & tools
lore

Oder Chiou

author maintainer
#0 lore raw

PATCH 1/6 ASoC: rt5640: Remove the pre-allocated size of reg_default

In order to prevent the redundant memory usage, the pre-allocated size of reg_default should be remove.

---
 sound/soc/codecs/rt5640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt5640.c +1 -1
index cf041e3..9427511 100644
@@ -59,7 +59,7 @@ static struct reg_default init_list[] = {
 };
 #define RT5640_INIT_REG_LEN ARRAY_SIZE(init_list)
 
-static const struct reg_default rt5640_reg[RT5640_VENDOR_ID2 + 1] = {
+static const struct reg_default rt5640_reg[] = {
 	{ 0x00, 0x000e },
 	{ 0x01, 0xc8c8 },
 	{ 0x02, 0xc8c8 },
Signature · 1 line
1.8.1.1.439.g50a6b54
author maintainer
#1 lore raw

PATCH 2/6 ASoC: rt5640: Rename the function of clock checking

In order to identify clearly, the patch renames the function "check_sysclk1_source" to "is_sys_clk_from_pll".

---
 sound/soc/codecs/rt5640.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
sound/soc/codecs/rt5640.c +9 -9
index 9427511..2afce49 100644
@@ -480,7 +480,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 	return idx;
 }
 
-static int check_sysclk1_source(struct snd_soc_dapm_widget *source,
+static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
 			 struct snd_soc_dapm_widget *sink)
 {
 	unsigned int val;
@@ -1273,22 +1273,22 @@ static const struct snd_soc_dapm_route rt5640_dapm_routes[] = {
 	{"Stereo ADC MIXL", "ADC1 Switch", "Stereo ADC L1 Mux"},
 	{"Stereo ADC MIXL", "ADC2 Switch", "Stereo ADC L2 Mux"},
 	{"Stereo ADC MIXL", NULL, "Stereo Filter"},
-	{"Stereo Filter", NULL, "PLL1", check_sysclk1_source},
+	{"Stereo Filter", NULL, "PLL1", is_sys_clk_from_pll},
 
 	{"Stereo ADC MIXR", "ADC1 Switch", "Stereo ADC R1 Mux"},
 	{"Stereo ADC MIXR", "ADC2 Switch", "Stereo ADC R2 Mux"},
 	{"Stereo ADC MIXR", NULL, "Stereo Filter"},
-	{"Stereo Filter", NULL, "PLL1", check_sysclk1_source},
+	{"Stereo Filter", NULL, "PLL1", is_sys_clk_from_pll},
 
 	{"Mono ADC MIXL", "ADC1 Switch", "Mono ADC L1 Mux"},
 	{"Mono ADC MIXL", "ADC2 Switch", "Mono ADC L2 Mux"},
 	{"Mono ADC MIXL", NULL, "Mono Left Filter"},
-	{"Mono Left Filter", NULL, "PLL1", check_sysclk1_source},
+	{"Mono Left Filter", NULL, "PLL1", is_sys_clk_from_pll},
 
 	{"Mono ADC MIXR", "ADC1 Switch", "Mono ADC R1 Mux"},
 	{"Mono ADC MIXR", "ADC2 Switch", "Mono ADC R2 Mux"},
 	{"Mono ADC MIXR", NULL, "Mono Right Filter"},
-	{"Mono Right Filter", NULL, "PLL1", check_sysclk1_source},
+	{"Mono Right Filter", NULL, "PLL1", is_sys_clk_from_pll},
 
 	{"IF2 ADC L", NULL, "Mono ADC MIXL"},
 	{"IF2 ADC R", NULL, "Mono ADC MIXR"},
@@ -1377,13 +1377,13 @@ static const struct snd_soc_dapm_route rt5640_dapm_routes[] = {
 	{"DIG MIXR", "DAC R2 Switch", "DAC R2 Mux"},
 
 	{"DAC L1", NULL, "Stereo DAC MIXL"},
-	{"DAC L1", NULL, "PLL1", check_sysclk1_source},
+	{"DAC L1", NULL, "PLL1", is_sys_clk_from_pll},
 	{"DAC R1", NULL, "Stereo DAC MIXR"},
-	{"DAC R1", NULL, "PLL1", check_sysclk1_source},
+	{"DAC R1", NULL, "PLL1", is_sys_clk_from_pll},
 	{"DAC L2", NULL, "Mono DAC MIXL"},
-	{"DAC L2", NULL, "PLL1", check_sysclk1_source},
+	{"DAC L2", NULL, "PLL1", is_sys_clk_from_pll},
 	{"DAC R2", NULL, "Mono DAC MIXR"},
-	{"DAC R2", NULL, "PLL1", check_sysclk1_source},
+	{"DAC R2", NULL, "PLL1", is_sys_clk_from_pll},
 
 	{"SPK MIXL", "REC MIXL Switch", "RECMIXL"},
 	{"SPK MIXL", "INL Switch", "INL VOL"},
Signature · 1 line
1.8.1.1.439.g50a6b54
maintainer Applied
#2 lore raw

Re: [PATCH 2/6] ASoC: rt5640: Rename the function of clock checking

Quoted 2 lines · Oder Chiou

In order to identify clearly, the patch renames the function "check_sysclk1_source" to "is_sys_clk_from_pll".

Applied, thanks.

author maintainer
#3 lore raw

PATCH 3/6 ASoC: rt5640: Remove the unused or incorrect setting of clock source

In reply to Oder Chiou

The patch removes the unused or incorrect setting of clock source.

---
 sound/soc/codecs/rt5640.c | 8 +-------
 sound/soc/codecs/rt5640.h | 2 --
 2 files changed, 1 insertion(+), 9 deletions(-)
sound/soc/codecs/rt5640.c +1 -7
index 2afce49..096edfe 100644
@@ -487,7 +487,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
 
 	val = snd_soc_read(source->codec, RT5640_GLB_CLK);
 	val &= RT5640_SCLK_SRC_MASK;
-	if (val == RT5640_SCLK_SRC_PLL1 || val == RT5640_SCLK_SRC_PLL1T)
+	if (val == RT5640_SCLK_SRC_PLL1)
 		return 1;
 	else
 		return 0;
@@ -1694,12 +1694,6 @@ static int rt5640_set_dai_sysclk(struct snd_soc_dai *dai,
 	case RT5640_SCLK_S_PLL1:
 		reg_val |= RT5640_SCLK_SRC_PLL1;
 		break;
-	case RT5640_SCLK_S_PLL1_TK:
-		reg_val |= RT5640_SCLK_SRC_PLL1T;
-		break;
-	case RT5640_SCLK_S_RCCLK:
-		reg_val |= RT5640_SCLK_SRC_RCCLK;
-		break;
 	default:
 		dev_err(codec->dev, "Invalid clock id (%d)\n", clk_id);
 		return -EINVAL;
sound/soc/codecs/rt5640.h +0 -2
index 5e8df25a..cbd07b5 100644
@@ -976,8 +976,6 @@
 #define RT5640_SCLK_SRC_SFT			14
 #define RT5640_SCLK_SRC_MCLK			(0x0 << 14)
 #define RT5640_SCLK_SRC_PLL1			(0x1 << 14)
-#define RT5640_SCLK_SRC_PLL1T			(0x2 << 14)
-#define RT5640_SCLK_SRC_RCCLK			(0x3 << 14) /* 15MHz */
 #define RT5640_PLL1_SRC_MASK			(0x3 << 12)
 #define RT5640_PLL1_SRC_SFT			12
 #define RT5640_PLL1_SRC_MCLK			(0x0 << 12)
Signature · 1 line
1.8.1.1.439.g50a6b54
maintainer Applied
#4 lore raw

Re: [PATCH 3/6] ASoC: rt5640: Remove the unused or incorrect setting of clock source

Quoted 1 line · Oder Chiou

The patch removes the unused or incorrect setting of clock source.

Applied, thanks.

author maintainer
#5 lore raw

PATCH 4/6 ASoC: rt5640: Remove the unused field in private data

In reply to Oder Chiou

The patch removes the unused field in private data.

---
 sound/soc/codecs/rt5640.h | 1 -
 1 file changed, 1 deletion(-)
sound/soc/codecs/rt5640.h +0 -1
index cbd07b5..d7bd525 100644
@@ -2095,7 +2095,6 @@ struct rt5640_priv {
 	int pll_in;
 	int pll_out;
 
-	int dmic_en;
 	bool hp_mute;
 };
 
Signature · 1 line
1.8.1.1.439.g50a6b54
maintainer Applied
#6 lore raw

Re: [PATCH 4/6] ASoC: rt5640: Remove the unused field in private data

Quoted 1 line · Oder Chiou

The patch removes the unused field in private data.

Applied, thanks.

author maintainer
#7 lore raw

PATCH 5/6 ASoC: rt5640: Remove the unnecessary parentheses

In reply to Oder Chiou

The patch removes the unnecessary parentheses.

---
 sound/soc/codecs/rt5640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt5640.c +1 -1
index 096edfe..b5014a2 100644
@@ -2102,7 +2102,7 @@ static int rt5640_i2c_probe(struct i2c_client *i2c,
 	}
 
 	regmap_read(rt5640->regmap, RT5640_VENDOR_ID2, &val);
-	if ((val != RT5640_DEVICE_ID)) {
+	if (val != RT5640_DEVICE_ID) {
 		dev_err(&i2c->dev,
 			"Device with ID register %x is not rt5640/39\n", val);
 		return -ENODEV;
Signature · 1 line
1.8.1.1.439.g50a6b54
maintainer Applied
#8 lore raw

Re: [PATCH 5/6] ASoC: rt5640: Remove the unnecessary parentheses

Quoted 1 line · Oder Chiou

The patch removes the unnecessary parentheses.

Applied, thanks.

author maintainer
#9 lore raw

PATCH 6/6 ASoC: rt5640: Change the setting method of idle_bias_off

In reply to Oder Chiou

The patch moves the idle_bias_off setting to struct "soc_codec_dev_rt5640".

---
 sound/soc/codecs/rt5640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt5640.c +1 -1
index b5014a2..2a349b0 100644
@@ -1879,7 +1879,6 @@ static int rt5640_probe(struct snd_soc_codec *codec)
 
 	rt5640->codec = codec;
 
-	codec->dapm.idle_bias_off = 1;
 	rt5640_set_bias_level(codec, SND_SOC_BIAS_OFF);
 
 	snd_soc_update_bits(codec, RT5640_DUMMY1, 0x0301, 0x0301);
@@ -1988,6 +1987,7 @@ static struct snd_soc_codec_driver soc_codec_dev_rt5640 = {
 	.suspend = rt5640_suspend,
 	.resume = rt5640_resume,
 	.set_bias_level = rt5640_set_bias_level,
+	.idle_bias_off = true,
 	.controls = rt5640_snd_controls,
 	.num_controls = ARRAY_SIZE(rt5640_snd_controls),
 	.dapm_widgets = rt5640_dapm_widgets,
Signature · 1 line
1.8.1.1.439.g50a6b54
maintainer
#10 lore raw

Re: [PATCH 6/6] ASoC: rt5640: Change the setting method of idle_bias_off

Quoted 1 line · Oder Chiou

The patch moves the idle_bias_off setting to struct "soc_codec_dev_rt5640".

This doesn't seem to apply against current code, can you please check and resend?

author maintainer
#11 lore raw

Re: [PATCH 6/6] ASoC: rt5640: Change the setting methodofidle_bias_off

Quoted 11 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, March 28, 2014 8:54 PM
To: Oder Chiou
Cc: [email protected]; [email protected]; Bard Liao; Flove
Subject: Re: [PATCH 6/6] ASoC: rt5640: Change the setting method ofidle_bias_off

Quoted 1 line · Oder Chiou

The patch moves the idle_bias_off setting to struct "soc_codec_dev_rt5640".

This doesn't seem to apply against current code, can you please check and resend?

I've resent it, thank you.

maintainer Applied
#12 lore raw
In reply to Oder Chiou
Quoted 2 lines · Oder Chiou

In order to prevent the redundant memory usage, the pre-allocated size of reg_default should be remove.

Applied, thanks.