@@ -6,6 +6,7 @@
// Copyright 2018 Ladislav Michl <ladis@linux-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;
}