Re: [PATCH 1/5] ASoC: simple_card_utils: add asoc_simple_card_clk_enable/disable()

2017-06-08 Thread Kuninori Morimoto

Hi Mark

> > +#define asoc_simple_card_clk_enable(dai) clk_prepare_enable((dai)->clk)
> > +#define asoc_simple_card_clk_disable(dai) clk_disable_unprepare((dai)->clk)
> 
> Could we make these static inline functions instead please?  It
> shouldn't make any difference to the generated code but it's a bit more
> type safe.

OK, will do in v2

Best regards
---
Kuninori Morimoto


Re: [PATCH 1/5] ASoC: simple_card_utils: add asoc_simple_card_clk_enable/disable()

2017-06-08 Thread Mark Brown
On Wed, Jun 07, 2017 at 12:29:05AM +, Kuninori Morimoto wrote:

> +#define asoc_simple_card_clk_enable(dai) clk_prepare_enable((dai)->clk)
> +#define asoc_simple_card_clk_disable(dai) clk_disable_unprepare((dai)->clk)

Could we make these static inline functions instead please?  It
shouldn't make any difference to the generated code but it's a bit more
type safe.


signature.asc
Description: PGP signature


[PATCH 1/5] ASoC: simple_card_utils: add asoc_simple_card_clk_enable/disable()

2017-06-06 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Current simple-card-utils sets asoc_simple_dai::clk via
asoc_simple_card_parse_clk(), and requested parameter is only
simple_dai. But current simple card drivers are using
simple_dai::clk directly for clk_enable/disable.
Encapsulation is one of simple card util's purpose.
Let's encapsulate it.

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h | 2 ++
 sound/soc/generic/simple-card-utils.c | 6 ++
 2 files changed, 8 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 108cae4..9e8e829 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -45,6 +45,8 @@ int asoc_simple_card_parse_clk(struct device *dev,
   struct device_node *dai_of_node,
   struct asoc_simple_dai *simple_dai,
   const char *name);
+#define asoc_simple_card_clk_enable(dai) clk_prepare_enable((dai)->clk)
+#define asoc_simple_card_clk_disable(dai) clk_disable_unprepare((dai)->clk)
 
 #define asoc_simple_card_parse_cpu(node, dai_link, 
\
   list_name, cells_name, is_single_link)   
\
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index d9d8b8a..f7df08b 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -128,6 +128,12 @@ int asoc_simple_card_parse_clk(struct device *dev,
clk = devm_get_clk_from_child(dev, node, NULL);
if (!IS_ERR(clk)) {
simple_dai->sysclk = clk_get_rate(clk);
+
+   /*
+* This enables
+*  asoc_simple_card_clk_enable()
+*  asoc_simple_card_clk_disable()
+*/
simple_dai->clk = clk;
} else if (!of_property_read_u32(node, "system-clock-frequency", )) 
{
simple_dai->sysclk = val;
-- 
1.9.1