[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230302-max9867-v1-3-aa9f7f25db5e@skidata.com>
Date: Thu, 02 Mar 2023 12:55:03 +0100
From: richard.leitner@...ux.dev
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Ladislav Michl <ladis@...ux-mips.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Benjamin Bara <benjamin.bara@...data.com>
Cc: alsa-devel@...a-project.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
Richard Leitner <richard.leitner@...data.com>
Subject: [PATCH 3/3] ASoC: maxim,max9867: add "mclk" support
From: Benjamin Bara <benjamin.bara@...data.com>
Add basic support for the codecs mclk by enabling it during probing.
Signed-off-by: Benjamin Bara <benjamin.bara@...data.com>
---
sound/soc/codecs/max9867.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c
index e161ab037bf7..b92dd61bb2b2 100644
--- a/sound/soc/codecs/max9867.c
+++ b/sound/soc/codecs/max9867.c
@@ -6,6 +6,7 @@
// Copyright 2018 Ladislav Michl <ladis@...ux-mips.org>
//
+#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
@@ -16,6 +17,7 @@
#include "max9867.h"
struct max9867_priv {
+ struct clk *mclk;
struct regmap *regmap;
const struct snd_pcm_hw_constraint_list *constraints;
unsigned int sysclk, pclk;
@@ -663,8 +665,18 @@ static int max9867_i2c_probe(struct i2c_client *i2c)
dev_info(&i2c->dev, "device revision: %x\n", reg);
ret = devm_snd_soc_register_component(&i2c->dev, &max9867_component,
max9867_dai, ARRAY_SIZE(max9867_dai));
- if (ret < 0)
+ if (ret < 0) {
dev_err(&i2c->dev, "Failed to register component: %d\n", ret);
+ return ret;
+ }
+
+ max9867->mclk = devm_clk_get(&i2c->dev, "mclk");
+ if (IS_ERR(max9867->mclk))
+ return PTR_ERR(max9867->mclk);
+ ret = clk_prepare_enable(max9867->mclk);
+ if (ret < 0)
+ dev_err(&i2c->dev, "Failed to enable MCLK: %d\n", ret);
+
return ret;
}
--
2.39.2
Powered by blists - more mailing lists