17 #include <linux/module.h>
18 #include <linux/i2c.h>
19 #include <linux/slab.h>
30 static const uint8_t lm4857_default_regs[] = {
31 0x00, 0x00, 0x00, 0x00,
42 #define LM4857_WAKEUP 5
43 #define LM4857_EPGAIN 4
55 data = (reg << 6) | value;
58 dev_err(codec->
dev,
"Failed to write register: %d\n", ret);
78 static int lm4857_get_mode(
struct snd_kcontrol *kcontrol,
82 struct lm4857 *
lm4857 = snd_soc_codec_get_drvdata(codec);
84 ucontrol->
value.integer.value[0] = lm4857->
mode;
89 static int lm4857_set_mode(
struct snd_kcontrol *kcontrol,
93 struct lm4857 *
lm4857 = snd_soc_codec_get_drvdata(codec);
104 static int lm4857_set_bias_level(
struct snd_soc_codec *codec,
107 struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec);
125 static const char *lm4857_mode[] = {
128 "Loudspeaker + Headphone",
132 static const struct soc_enum lm4857_mode_enum =
161 lm4857_get_mode, lm4857_set_mode),
176 struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec);
203 .write = lm4857_write,
205 .probe = lm4857_probe,
206 .reg_cache_size =
ARRAY_SIZE(lm4857_default_regs),
207 .reg_word_size =
sizeof(
uint8_t),
215 struct lm4857 *lm4857;
222 i2c_set_clientdata(i2c, lm4857);
243 static struct i2c_driver lm4857_i2c_driver = {
248 .probe = lm4857_i2c_probe,
250 .id_table = lm4857_i2c_id,