aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/max98090.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/max98090.c')
-rw-r--r--sound/soc/codecs/max98090.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 1fd31efa6664..906534d18d3f 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -255,6 +255,7 @@ static struct reg_default max98090_reg[] = {
255static bool max98090_volatile_register(struct device *dev, unsigned int reg) 255static bool max98090_volatile_register(struct device *dev, unsigned int reg)
256{ 256{
257 switch (reg) { 257 switch (reg) {
258 case M98090_REG_SOFTWARE_RESET:
258 case M98090_REG_DEVICE_STATUS: 259 case M98090_REG_DEVICE_STATUS:
259 case M98090_REG_JACK_STATUS: 260 case M98090_REG_JACK_STATUS:
260 case M98090_REG_REVISION_ID: 261 case M98090_REG_REVISION_ID:
@@ -389,6 +390,7 @@ static const DECLARE_TLV_DB_SCALE(max98090_alc_tlv, -1500, 100, 0);
389static const DECLARE_TLV_DB_SCALE(max98090_alcmakeup_tlv, 0, 100, 0); 390static const DECLARE_TLV_DB_SCALE(max98090_alcmakeup_tlv, 0, 100, 0);
390static const DECLARE_TLV_DB_SCALE(max98090_alccomp_tlv, -3100, 100, 0); 391static const DECLARE_TLV_DB_SCALE(max98090_alccomp_tlv, -3100, 100, 0);
391static const DECLARE_TLV_DB_SCALE(max98090_drcexp_tlv, -6600, 100, 0); 392static const DECLARE_TLV_DB_SCALE(max98090_drcexp_tlv, -6600, 100, 0);
393static const DECLARE_TLV_DB_SCALE(max98090_sdg_tlv, 50, 200, 0);
392 394
393static const unsigned int max98090_mixout_tlv[] = { 395static const unsigned int max98090_mixout_tlv[] = {
394 TLV_DB_RANGE_HEAD(2), 396 TLV_DB_RANGE_HEAD(2),
@@ -426,7 +428,7 @@ static const unsigned int max98090_rcv_lout_tlv[] = {
426static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol, 428static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol,
427 struct snd_ctl_elem_value *ucontrol) 429 struct snd_ctl_elem_value *ucontrol)
428{ 430{
429 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 431 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
430 struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec); 432 struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
431 struct soc_mixer_control *mc = 433 struct soc_mixer_control *mc =
432 (struct soc_mixer_control *)kcontrol->private_value; 434 (struct soc_mixer_control *)kcontrol->private_value;
@@ -466,7 +468,7 @@ static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol,
466static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol, 468static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
467 struct snd_ctl_elem_value *ucontrol) 469 struct snd_ctl_elem_value *ucontrol)
468{ 470{
469 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 471 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
470 struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec); 472 struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
471 struct soc_mixer_control *mc = 473 struct soc_mixer_control *mc =
472 (struct soc_mixer_control *)kcontrol->private_value; 474 (struct soc_mixer_control *)kcontrol->private_value;
@@ -665,7 +667,7 @@ static const struct snd_kcontrol_new max98090_snd_controls[] = {
665 SOC_SINGLE_EXT_TLV("Digital Sidetone Volume", 667 SOC_SINGLE_EXT_TLV("Digital Sidetone Volume",
666 M98090_REG_ADC_SIDETONE, M98090_DVST_SHIFT, 668 M98090_REG_ADC_SIDETONE, M98090_DVST_SHIFT,
667 M98090_DVST_NUM - 1, 1, max98090_get_enab_tlv, 669 M98090_DVST_NUM - 1, 1, max98090_get_enab_tlv,
668 max98090_put_enab_tlv, max98090_micboost_tlv), 670 max98090_put_enab_tlv, max98090_sdg_tlv),
669 SOC_SINGLE_TLV("Digital Coarse Volume", M98090_REG_DAI_PLAYBACK_LEVEL, 671 SOC_SINGLE_TLV("Digital Coarse Volume", M98090_REG_DAI_PLAYBACK_LEVEL,
670 M98090_DVG_SHIFT, M98090_DVG_NUM - 1, 0, 672 M98090_DVG_SHIFT, M98090_DVG_NUM - 1, 0,
671 max98090_dvg_tlv), 673 max98090_dvg_tlv),
@@ -2372,6 +2374,8 @@ static int max98090_runtime_resume(struct device *dev)
2372 2374
2373 regcache_cache_only(max98090->regmap, false); 2375 regcache_cache_only(max98090->regmap, false);
2374 2376
2377 max98090_reset(max98090);
2378
2375 regcache_sync(max98090->regmap); 2379 regcache_sync(max98090->regmap);
2376 2380
2377 return 0; 2381 return 0;
@@ -2387,9 +2391,34 @@ static int max98090_runtime_suspend(struct device *dev)
2387} 2391}
2388#endif 2392#endif
2389 2393
2394#ifdef CONFIG_PM
2395static int max98090_resume(struct device *dev)
2396{
2397 struct max98090_priv *max98090 = dev_get_drvdata(dev);
2398 unsigned int status;
2399
2400 regcache_mark_dirty(max98090->regmap);
2401
2402 max98090_reset(max98090);
2403
2404 /* clear IRQ status */
2405 regmap_read(max98090->regmap, M98090_REG_DEVICE_STATUS, &status);
2406
2407 regcache_sync(max98090->regmap);
2408
2409 return 0;
2410}
2411
2412static int max98090_suspend(struct device *dev)
2413{
2414 return 0;
2415}
2416#endif
2417
2390static const struct dev_pm_ops max98090_pm = { 2418static const struct dev_pm_ops max98090_pm = {
2391 SET_RUNTIME_PM_OPS(max98090_runtime_suspend, 2419 SET_RUNTIME_PM_OPS(max98090_runtime_suspend,
2392 max98090_runtime_resume, NULL) 2420 max98090_runtime_resume, NULL)
2421 SET_SYSTEM_SLEEP_PM_OPS(max98090_suspend, max98090_resume)
2393}; 2422};
2394 2423
2395static const struct i2c_device_id max98090_i2c_id[] = { 2424static const struct i2c_device_id max98090_i2c_id[] = {