diff mbox

[RFC,1/2] ASoC: add support of mclk clock providers in wm8894 driver

Message ID 1513270438-18523-2-git-send-email-olivier.moysan@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Olivier MOYSAN Dec. 14, 2017, 4:53 p.m. UTC
Wolfson wm8994 codec bindings exposes MCLK1 and MCLK1 clocks.
This patch adds support of MCLK1 and MCLK2 in mfd driver.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
---
 drivers/mfd/wm8994-core.c        | 9 +++++++++
 include/linux/mfd/wm8994/pdata.h | 6 ++++++
 2 files changed, 15 insertions(+)

Comments

Mark Brown Dec. 14, 2017, 5:30 p.m. UTC | #1
On Thu, Dec 14, 2017 at 05:53:57PM +0100, Olivier Moysan wrote:

> +	pdata->mclk1 = devm_clk_get(wm8994->dev, "MCLK1");
> +	if (IS_ERR(pdata->mclk1))
> +		pdata->mclk1 = NULL;

These should special case -EPROBE_DEFER so we defer properly if we need
to (and ideally log an error in case there was a MCLK and we legit ran
into an error).
Charles Keepax Dec. 15, 2017, 11:51 a.m. UTC | #2
On Thu, Dec 14, 2017 at 05:30:25PM +0000, Mark Brown wrote:
> On Thu, Dec 14, 2017 at 05:53:57PM +0100, Olivier Moysan wrote:
> 
> > +	pdata->mclk1 = devm_clk_get(wm8994->dev, "MCLK1");
> > +	if (IS_ERR(pdata->mclk1))
> > +		pdata->mclk1 = NULL;
> 
> These should special case -EPROBE_DEFER so we defer properly if we need
> to (and ideally log an error in case there was a MCLK and we legit ran
> into an error).

We probably want the special case on there being no clock at all
which should silently proceed as this code does and then actual
errors and PROBE_DEFERs can log and fail.

Thanks,
Charles
diff mbox

Patch

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 953d079..f1ff9d8 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -12,6 +12,7 @@ 
  *
  */
 
+#include <linux/clk.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -310,6 +311,14 @@  static int wm8994_set_pdata_from_of(struct wm8994 *wm8994)
 	if (pdata->ldo[1].enable < 0)
 		pdata->ldo[1].enable = 0;
 
+	pdata->mclk1 = devm_clk_get(wm8994->dev, "MCLK1");
+	if (IS_ERR(pdata->mclk1))
+		pdata->mclk1 = NULL;
+
+	pdata->mclk2 = devm_clk_get(wm8994->dev, "MCLK2");
+	if (IS_ERR(pdata->mclk2))
+		pdata->mclk2 = NULL;
+
 	return 0;
 }
 #else
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 90c6052..8037d26 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -233,6 +233,12 @@  struct wm8994_pdata {
 	 * GPIO for the IRQ pin if host only supports edge triggering
 	 */
 	int irq_gpio;
+
+	/* MCLK1 clock provider */
+	struct clk *mclk1;
+
+	/* MCLK2 clock provider */
+	struct clk *mclk2;
 };
 
 #endif