Loading Documentation/devicetree/bindings/sound/rt5514.txt +5 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,11 @@ Required properties: - reg : The I2C address of the device. Optional properties: - clocks: The phandle of the master clock to the CODEC - clock-names: Should be "mclk" Pins on the device (for linking into audio routes) for RT5514: * DMIC1L Loading sound/soc/codecs/rt5514.c +32 −0 Original line number Diff line number Diff line Loading @@ -799,10 +799,41 @@ static int rt5514_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, return 0; } static int rt5514_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); int ret; switch (level) { case SND_SOC_BIAS_PREPARE: if (IS_ERR(rt5514->mclk)) break; if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) { clk_disable_unprepare(rt5514->mclk); } else { ret = clk_prepare_enable(rt5514->mclk); if (ret) return ret; } break; default: break; } return 0; } static int rt5514_probe(struct snd_soc_codec *codec) { struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); rt5514->mclk = devm_clk_get(codec->dev, "mclk"); if (PTR_ERR(rt5514->mclk) == -EPROBE_DEFER) return -EPROBE_DEFER; rt5514->codec = codec; return 0; Loading Loading @@ -858,6 +889,7 @@ struct snd_soc_dai_driver rt5514_dai[] = { static struct snd_soc_codec_driver soc_codec_dev_rt5514 = { .probe = rt5514_probe, .idle_bias_off = true, .set_bias_level = rt5514_set_bias_level, .controls = rt5514_snd_controls, .num_controls = ARRAY_SIZE(rt5514_snd_controls), .dapm_widgets = rt5514_dapm_widgets, Loading sound/soc/codecs/rt5514.h +3 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,8 @@ #ifndef __RT5514_H__ #define __RT5514_H__ #include <linux/clk.h> #define RT5514_DEVICE_ID 0x10ec5514 #define RT5514_RESET 0x2000 Loading Loading @@ -240,6 +242,7 @@ enum { struct rt5514_priv { struct snd_soc_codec *codec; struct regmap *i2c_regmap, *regmap; struct clk *mclk; int sysclk; int sysclk_src; int lrck; Loading Loading
Documentation/devicetree/bindings/sound/rt5514.txt +5 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,11 @@ Required properties: - reg : The I2C address of the device. Optional properties: - clocks: The phandle of the master clock to the CODEC - clock-names: Should be "mclk" Pins on the device (for linking into audio routes) for RT5514: * DMIC1L Loading
sound/soc/codecs/rt5514.c +32 −0 Original line number Diff line number Diff line Loading @@ -799,10 +799,41 @@ static int rt5514_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, return 0; } static int rt5514_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); int ret; switch (level) { case SND_SOC_BIAS_PREPARE: if (IS_ERR(rt5514->mclk)) break; if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) { clk_disable_unprepare(rt5514->mclk); } else { ret = clk_prepare_enable(rt5514->mclk); if (ret) return ret; } break; default: break; } return 0; } static int rt5514_probe(struct snd_soc_codec *codec) { struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); rt5514->mclk = devm_clk_get(codec->dev, "mclk"); if (PTR_ERR(rt5514->mclk) == -EPROBE_DEFER) return -EPROBE_DEFER; rt5514->codec = codec; return 0; Loading Loading @@ -858,6 +889,7 @@ struct snd_soc_dai_driver rt5514_dai[] = { static struct snd_soc_codec_driver soc_codec_dev_rt5514 = { .probe = rt5514_probe, .idle_bias_off = true, .set_bias_level = rt5514_set_bias_level, .controls = rt5514_snd_controls, .num_controls = ARRAY_SIZE(rt5514_snd_controls), .dapm_widgets = rt5514_dapm_widgets, Loading
sound/soc/codecs/rt5514.h +3 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,8 @@ #ifndef __RT5514_H__ #define __RT5514_H__ #include <linux/clk.h> #define RT5514_DEVICE_ID 0x10ec5514 #define RT5514_RESET 0x2000 Loading Loading @@ -240,6 +242,7 @@ enum { struct rt5514_priv { struct snd_soc_codec *codec; struct regmap *i2c_regmap, *regmap; struct clk *mclk; int sysclk; int sysclk_src; int lrck; Loading