aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/cs42l51.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index eb40bff54cec..fd2bd74024c1 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -21,6 +21,7 @@
21 * - master mode *NOT* supported 21 * - master mode *NOT* supported
22 */ 22 */
23 23
24#include <linux/clk.h>
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
26#include <sound/core.h> 27#include <sound/core.h>
@@ -41,6 +42,7 @@ enum master_slave_mode {
41 42
42struct cs42l51_private { 43struct cs42l51_private {
43 unsigned int mclk; 44 unsigned int mclk;
45 struct clk *mclk_handle;
44 unsigned int audio_mode; /* The mode (I2S or left-justified) */ 46 unsigned int audio_mode; /* The mode (I2S or left-justified) */
45 enum master_slave_mode func; 47 enum master_slave_mode func;
46}; 48};
@@ -492,9 +494,13 @@ static int cs42l51_component_probe(struct snd_soc_component *component)
492{ 494{
493 int ret, reg; 495 int ret, reg;
494 struct snd_soc_dapm_context *dapm; 496 struct snd_soc_dapm_context *dapm;
497 struct cs42l51_private *cs42l51;
495 498
499 cs42l51 = snd_soc_component_get_drvdata(component);
496 dapm = snd_soc_component_get_dapm(component); 500 dapm = snd_soc_component_get_dapm(component);
497 snd_soc_dapm_new_controls(dapm, cs42l51_dapm_mclk_widgets, 1); 501
502 if (cs42l51->mclk_handle)
503 snd_soc_dapm_new_controls(dapm, cs42l51_dapm_mclk_widgets, 1);
498 504
499 /* 505 /*
500 * DAC configuration 506 * DAC configuration
@@ -548,6 +554,13 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap)
548 554
549 dev_set_drvdata(dev, cs42l51); 555 dev_set_drvdata(dev, cs42l51);
550 556
557 cs42l51->mclk_handle = devm_clk_get(dev, "MCLK");
558 if (IS_ERR(cs42l51->mclk_handle)) {
559 if (PTR_ERR(cs42l51->mclk_handle) != -ENOENT)
560 return PTR_ERR(cs42l51->mclk_handle);
561 cs42l51->mclk_handle = NULL;
562 }
563
551 /* Verify that we have a CS42L51 */ 564 /* Verify that we have a CS42L51 */
552 ret = regmap_read(regmap, CS42L51_CHIP_REV_ID, &val); 565 ret = regmap_read(regmap, CS42L51_CHIP_REV_ID, &val);
553 if (ret < 0) { 566 if (ret < 0) {