18 #include <linux/module.h>
20 #include <linux/i2c.h>
21 #include <linux/slab.h>
35 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
52 static const unsigned int max9850_tlv[] = {
76 &max9850_mixer_controls[0],
91 {
"Output Mixer",
NULL,
"DAC"},
92 {
"Output Mixer",
"Line In Switch",
"Line Input"},
95 {
"Headphone Output",
NULL,
"Output Mixer"},
96 {
"HPL",
NULL,
"Headphone Output"},
97 {
"HPR",
NULL,
"Headphone Output"},
98 {
"OUTL",
NULL,
"Output Mixer"},
99 {
"OUTR",
NULL,
"Output Mixer"},
102 {
"Line Input",
NULL,
"INL"},
103 {
"Line Input",
NULL,
"INR"},
106 {
"Output Mixer",
NULL,
"Charge Pump 1"},
107 {
"Output Mixer",
NULL,
"Charge Pump 2"},
108 {
"Output Mixer",
NULL,
"SHDN"},
109 {
"DAC",
NULL,
"MCLK"},
117 struct max9850_priv *max9850 = snd_soc_codec_get_drvdata(codec);
126 lrclk_div = (1 << 22);
152 static int max9850_set_dai_sysclk(
struct snd_soc_dai *codec_dai,
153 int clk_id,
unsigned int freq,
int dir)
156 struct max9850_priv *max9850 = snd_soc_codec_get_drvdata(codec);
159 if (freq <= 13000000)
161 else if (freq <= 26000000)
163 else if (freq <= 40000000)
172 static int max9850_set_dai_fmt(
struct snd_soc_dai *codec_dai,
unsigned int fmt)
225 static int max9850_set_bias_level(
struct snd_soc_codec *codec,
240 "Failed to sync cache: %d\n", ret);
252 #define MAX9850_RATES SNDRV_PCM_RATE_8000_48000
254 #define MAX9850_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
255 SNDRV_PCM_FMTBIT_S24_LE)
258 .hw_params = max9850_hw_params,
259 .set_sysclk = max9850_set_dai_sysclk,
260 .set_fmt = max9850_set_dai_fmt,
264 .name =
"max9850-hifi",
266 .stream_name =
"Playback",
272 .ops = &max9850_dai_ops,
290 #define max9850_suspend NULL
291 #define max9850_resume NULL
300 dev_err(codec->
dev,
"Failed to set cache I/O: %d\n", ret);
315 .probe = max9850_probe,
318 .set_bias_level = max9850_set_bias_level,
320 .reg_word_size =
sizeof(
u8),
326 .dapm_widgets = max9850_dapm_widgets,
327 .num_dapm_widgets =
ARRAY_SIZE(max9850_dapm_widgets),
328 .dapm_routes = max9850_dapm_routes,
329 .num_dapm_routes =
ARRAY_SIZE(max9850_dapm_routes),
343 i2c_set_clientdata(i2c, max9850);
346 &soc_codec_dev_max9850, &max9850_dai, 1);
362 static struct i2c_driver max9850_i2c_driver = {
367 .probe = max9850_i2c_probe,
369 .id_table = max9850_i2c_id,