All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver
@ 2014-06-03  2:56 Axel Lin
  2014-06-03  2:58 ` [PATCH 2/3] ASoC: rt5677: Convert to use rl6231_get_clk_info Axel Lin
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Axel Lin @ 2014-06-03  2:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Oder Chiou, alsa-devel, Liam Girdwood

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/rt5677.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 833231e..60fff7f 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -3480,18 +3480,7 @@ static struct i2c_driver rt5677_i2c_driver = {
 	.remove   = rt5677_i2c_remove,
 	.id_table = rt5677_i2c_id,
 };
-
-static int __init rt5677_modinit(void)
-{
-	return i2c_add_driver(&rt5677_i2c_driver);
-}
-module_init(rt5677_modinit);
-
-static void __exit rt5677_modexit(void)
-{
-	i2c_del_driver(&rt5677_i2c_driver);
-}
-module_exit(rt5677_modexit);
+module_i2c_driver(rt5677_i2c_driver);
 
 MODULE_DESCRIPTION("ASoC RT5677 driver");
 MODULE_AUTHOR("Oder Chiou <oder_chiou@realtek.com>");
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] ASoC: rt5677: Convert to use rl6231_get_clk_info
  2014-06-03  2:56 [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver Axel Lin
@ 2014-06-03  2:58 ` Axel Lin
  2014-06-09 20:17   ` Mark Brown
  2014-06-03  2:58 ` [PATCH 3/3] ASoC: rt5677: Convert to use rl6231_calc_dmic_clk Axel Lin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Axel Lin @ 2014-06-03  2:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Oder Chiou, alsa-devel, Liam Girdwood

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/Kconfig  |  2 ++
 sound/soc/codecs/rt5677.c | 18 ++----------------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index cbfa1e1..9d88845 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -445,9 +445,11 @@ config SND_SOC_RL6231
 	default y if SND_SOC_RT5640=y
 	default y if SND_SOC_RT5645=y
 	default y if SND_SOC_RT5651=y
+	default y if SND_SOC_RT5677=y
 	default m if SND_SOC_RT5640=m
 	default m if SND_SOC_RT5645=m
 	default m if SND_SOC_RT5651=m
+	default m if SND_SOC_RT5677=m
 
 config SND_SOC_RT5631
 	tristate
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 60fff7f..1ffc689 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -27,6 +27,7 @@
 #include <sound/initval.h>
 #include <sound/tlv.h>
 
+#include "rl6231.h"
 #include "rt5677.h"
 
 #define RT5677_DEVICE_ID 0x6327
@@ -2798,21 +2799,6 @@ static const struct snd_soc_dapm_route
rt5677_dapm_routes[] = {
 	{ "PDM2R", NULL, "PDM2 R Mux" },
 };
 
-static int get_clk_info(int sclk, int rate)
-{
-	int i, pd[] = {1, 2, 3, 4, 6, 8, 12, 16};
-
-	if (sclk <= 0 || rate <= 0)
-		return -EINVAL;
-
-	rate = rate << 8;
-	for (i = 0; i < ARRAY_SIZE(pd); i++)
-		if (sclk == rate * pd[i])
-			return i;
-
-	return -EINVAL;
-}
-
 static int rt5677_hw_params(struct snd_pcm_substream *substream,
 	struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
 {
@@ -2822,7 +2808,7 @@ static int rt5677_hw_params(struct
snd_pcm_substream *substream,
 	int pre_div, bclk_ms, frame_size;
 
 	rt5677->lrck[dai->id] = params_rate(params);
-	pre_div = get_clk_info(rt5677->sysclk, rt5677->lrck[dai->id]);
+	pre_div = rl6231_get_clk_info(rt5677->sysclk, rt5677->lrck[dai->id]);
 	if (pre_div < 0) {
 		dev_err(codec->dev, "Unsupported clock setting\n");
 		return -EINVAL;
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] ASoC: rt5677: Convert to use rl6231_calc_dmic_clk
  2014-06-03  2:56 [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver Axel Lin
  2014-06-03  2:58 ` [PATCH 2/3] ASoC: rt5677: Convert to use rl6231_get_clk_info Axel Lin
@ 2014-06-03  2:58 ` Axel Lin
  2014-06-09 20:16   ` Mark Brown
  2014-06-09  2:24 ` [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver Oder Chiou
  2014-06-09 20:15 ` Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Axel Lin @ 2014-06-03  2:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Oder Chiou, alsa-devel, Liam Girdwood

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/rt5677.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 1ffc689..45f99a8 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -637,21 +637,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 {
 	struct snd_soc_codec *codec = w->codec;
 	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
-	int div[] = {2, 3, 4, 6, 8, 12}, idx = -EINVAL, i;
-	int rate, red, bound, temp;
-
-	rate = rt5677->sysclk;
-	red = 3000000 * 12;
-	for (i = 0; i < ARRAY_SIZE(div); i++) {
-		bound = div[i] * 3000000;
-		if (rate > bound)
-			continue;
-		temp = bound - rate;
-		if (temp < red) {
-			red = temp;
-			idx = i;
-		}
-	}
+	int idx = rl6231_calc_dmic_clk(rt5677->sysclk);
 
 	if (idx < 0)
 		dev_err(codec->dev, "Failed to set DMIC clock\n");
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver
  2014-06-03  2:56 [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver Axel Lin
  2014-06-03  2:58 ` [PATCH 2/3] ASoC: rt5677: Convert to use rl6231_get_clk_info Axel Lin
  2014-06-03  2:58 ` [PATCH 3/3] ASoC: rt5677: Convert to use rl6231_calc_dmic_clk Axel Lin
@ 2014-06-09  2:24 ` Oder Chiou
  2014-06-09 20:15 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Oder Chiou @ 2014-06-09  2:24 UTC (permalink / raw)
  To: Axel Lin, Mark Brown; +Cc: Oder Chiou, alsa-devel, Liam Girdwood

> -----Original Message-----
> From: Axel Lin [mailto:axel.lin@ingics.com]
> Sent: Tuesday, June 03, 2014 10:57 AM
> To: Mark Brown
> Cc: Oder Chiou; Liam Girdwood; alsa-devel@alsa-project.org
> Subject: [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  sound/soc/codecs/rt5677.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index
> 833231e..60fff7f 100644
> --- a/sound/soc/codecs/rt5677.c
> +++ b/sound/soc/codecs/rt5677.c
> @@ -3480,18 +3480,7 @@ static struct i2c_driver rt5677_i2c_driver = {
>  	.remove   = rt5677_i2c_remove,
>  	.id_table = rt5677_i2c_id,
>  };
> -
> -static int __init rt5677_modinit(void)
> -{
> -	return i2c_add_driver(&rt5677_i2c_driver);
> -}
> -module_init(rt5677_modinit);
> -
> -static void __exit rt5677_modexit(void) -{
> -	i2c_del_driver(&rt5677_i2c_driver);
> -}
> -module_exit(rt5677_modexit);
> +module_i2c_driver(rt5677_i2c_driver);
> 
>  MODULE_DESCRIPTION("ASoC RT5677 driver");  MODULE_AUTHOR("Oder
> Chiou <oder_chiou@realtek.com>");
> --
> 1.8.3.2
> 
> 

Tested-by: Oder Chiou <oder_chiou@realtek.com>

Thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver
  2014-06-03  2:56 [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver Axel Lin
                   ` (2 preceding siblings ...)
  2014-06-09  2:24 ` [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver Oder Chiou
@ 2014-06-09 20:15 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-06-09 20:15 UTC (permalink / raw)
  To: Axel Lin; +Cc: Oder Chiou, alsa-devel, Liam Girdwood


[-- Attachment #1.1: Type: text/plain, Size: 124 bytes --]

On Tue, Jun 03, 2014 at 10:56:41AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] ASoC: rt5677: Convert to use rl6231_calc_dmic_clk
  2014-06-03  2:58 ` [PATCH 3/3] ASoC: rt5677: Convert to use rl6231_calc_dmic_clk Axel Lin
@ 2014-06-09 20:16   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-06-09 20:16 UTC (permalink / raw)
  To: Axel Lin; +Cc: Oder Chiou, alsa-devel, Liam Girdwood


[-- Attachment #1.1: Type: text/plain, Size: 124 bytes --]

On Tue, Jun 03, 2014 at 10:58:58AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] ASoC: rt5677: Convert to use rl6231_get_clk_info
  2014-06-03  2:58 ` [PATCH 2/3] ASoC: rt5677: Convert to use rl6231_get_clk_info Axel Lin
@ 2014-06-09 20:17   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-06-09 20:17 UTC (permalink / raw)
  To: Axel Lin; +Cc: Oder Chiou, alsa-devel, Liam Girdwood


[-- Attachment #1.1: Type: text/plain, Size: 290 bytes --]

On Tue, Jun 03, 2014 at 10:58:08AM +0800, Axel Lin wrote:

>  #define RT5677_DEVICE_ID 0x6327
> @@ -2798,21 +2799,6 @@ static const struct snd_soc_dapm_route
> rt5677_dapm_routes[] = {

Your mailer has corrupted this patch by word wrapping the line above -
can you please check and resend?

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-06-09 20:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-03  2:56 [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver Axel Lin
2014-06-03  2:58 ` [PATCH 2/3] ASoC: rt5677: Convert to use rl6231_get_clk_info Axel Lin
2014-06-09 20:17   ` Mark Brown
2014-06-03  2:58 ` [PATCH 3/3] ASoC: rt5677: Convert to use rl6231_calc_dmic_clk Axel Lin
2014-06-09 20:16   ` Mark Brown
2014-06-09  2:24 ` [PATCH 1/3] ASoC: rt5677: Convert to use module_i2c_driver Oder Chiou
2014-06-09 20:15 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.