diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-12 08:57:12 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-12 08:57:12 -0400 |
commit | 8c7df02167854288e20f76915348ffdc9a11e5c2 (patch) | |
tree | 4299a71a97276ce8e30d0ccc8fe27a3bbe99ed2b | |
parent | 406554fe8d77487d064fb6f9ad584b32fd376141 (diff) | |
parent | 959b6250dbf8398e3c63544f771ff1682a09987e (diff) |
Merge remote-tracking branch 'asoc/topic/max98090' into asoc-next
-rw-r--r-- | sound/soc/codecs/max98090.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index fc176044994d..ce0d36412c97 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c | |||
@@ -23,8 +23,6 @@ | |||
23 | #include <sound/max98090.h> | 23 | #include <sound/max98090.h> |
24 | #include "max98090.h" | 24 | #include "max98090.h" |
25 | 25 | ||
26 | #include <linux/version.h> | ||
27 | |||
28 | #define DEBUG | 26 | #define DEBUG |
29 | #define EXTMIC_METHOD | 27 | #define EXTMIC_METHOD |
30 | #define EXTMIC_METHOD_TEST | 28 | #define EXTMIC_METHOD_TEST |
@@ -509,16 +507,16 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol, | |||
509 | return 0; | 507 | return 0; |
510 | } | 508 | } |
511 | 509 | ||
512 | static const char * max98090_perf_pwr_text[] = | 510 | static const char *max98090_perf_pwr_text[] = |
513 | { "High Performance", "Low Power" }; | 511 | { "High Performance", "Low Power" }; |
514 | static const char * max98090_pwr_perf_text[] = | 512 | static const char *max98090_pwr_perf_text[] = |
515 | { "Low Power", "High Performance" }; | 513 | { "Low Power", "High Performance" }; |
516 | 514 | ||
517 | static const struct soc_enum max98090_vcmbandgap_enum = | 515 | static const struct soc_enum max98090_vcmbandgap_enum = |
518 | SOC_ENUM_SINGLE(M98090_REG_BIAS_CONTROL, M98090_VCM_MODE_SHIFT, | 516 | SOC_ENUM_SINGLE(M98090_REG_BIAS_CONTROL, M98090_VCM_MODE_SHIFT, |
519 | ARRAY_SIZE(max98090_pwr_perf_text), max98090_pwr_perf_text); | 517 | ARRAY_SIZE(max98090_pwr_perf_text), max98090_pwr_perf_text); |
520 | 518 | ||
521 | static const char * max98090_osr128_text[] = { "64*fs", "128*fs" }; | 519 | static const char *max98090_osr128_text[] = { "64*fs", "128*fs" }; |
522 | 520 | ||
523 | static const struct soc_enum max98090_osr128_enum = | 521 | static const struct soc_enum max98090_osr128_enum = |
524 | SOC_ENUM_SINGLE(M98090_REG_ADC_CONTROL, M98090_OSR128_SHIFT, | 522 | SOC_ENUM_SINGLE(M98090_REG_ADC_CONTROL, M98090_OSR128_SHIFT, |
@@ -535,28 +533,28 @@ static const struct soc_enum max98090_filter_dmic34mode_enum = | |||
535 | M98090_FLT_DMIC34MODE_SHIFT, | 533 | M98090_FLT_DMIC34MODE_SHIFT, |
536 | ARRAY_SIZE(max98090_mode_text), max98090_mode_text); | 534 | ARRAY_SIZE(max98090_mode_text), max98090_mode_text); |
537 | 535 | ||
538 | static const char * max98090_drcatk_text[] = | 536 | static const char *max98090_drcatk_text[] = |
539 | { "0.5ms", "1ms", "5ms", "10ms", "25ms", "50ms", "100ms", "200ms" }; | 537 | { "0.5ms", "1ms", "5ms", "10ms", "25ms", "50ms", "100ms", "200ms" }; |
540 | 538 | ||
541 | static const struct soc_enum max98090_drcatk_enum = | 539 | static const struct soc_enum max98090_drcatk_enum = |
542 | SOC_ENUM_SINGLE(M98090_REG_DRC_TIMING, M98090_DRCATK_SHIFT, | 540 | SOC_ENUM_SINGLE(M98090_REG_DRC_TIMING, M98090_DRCATK_SHIFT, |
543 | ARRAY_SIZE(max98090_drcatk_text), max98090_drcatk_text); | 541 | ARRAY_SIZE(max98090_drcatk_text), max98090_drcatk_text); |
544 | 542 | ||
545 | static const char * max98090_drcrls_text[] = | 543 | static const char *max98090_drcrls_text[] = |
546 | { "8s", "4s", "2s", "1s", "0.5s", "0.25s", "0.125s", "0.0625s" }; | 544 | { "8s", "4s", "2s", "1s", "0.5s", "0.25s", "0.125s", "0.0625s" }; |
547 | 545 | ||
548 | static const struct soc_enum max98090_drcrls_enum = | 546 | static const struct soc_enum max98090_drcrls_enum = |
549 | SOC_ENUM_SINGLE(M98090_REG_DRC_TIMING, M98090_DRCRLS_SHIFT, | 547 | SOC_ENUM_SINGLE(M98090_REG_DRC_TIMING, M98090_DRCRLS_SHIFT, |
550 | ARRAY_SIZE(max98090_drcrls_text), max98090_drcrls_text); | 548 | ARRAY_SIZE(max98090_drcrls_text), max98090_drcrls_text); |
551 | 549 | ||
552 | static const char * max98090_alccmp_text[] = | 550 | static const char *max98090_alccmp_text[] = |
553 | { "1:1", "1:1.5", "1:2", "1:4", "1:INF" }; | 551 | { "1:1", "1:1.5", "1:2", "1:4", "1:INF" }; |
554 | 552 | ||
555 | static const struct soc_enum max98090_alccmp_enum = | 553 | static const struct soc_enum max98090_alccmp_enum = |
556 | SOC_ENUM_SINGLE(M98090_REG_DRC_COMPRESSOR, M98090_DRCCMP_SHIFT, | 554 | SOC_ENUM_SINGLE(M98090_REG_DRC_COMPRESSOR, M98090_DRCCMP_SHIFT, |
557 | ARRAY_SIZE(max98090_alccmp_text), max98090_alccmp_text); | 555 | ARRAY_SIZE(max98090_alccmp_text), max98090_alccmp_text); |
558 | 556 | ||
559 | static const char * max98090_drcexp_text[] = { "1:1", "2:1", "3:1" }; | 557 | static const char *max98090_drcexp_text[] = { "1:1", "2:1", "3:1" }; |
560 | 558 | ||
561 | static const struct soc_enum max98090_drcexp_enum = | 559 | static const struct soc_enum max98090_drcexp_enum = |
562 | SOC_ENUM_SINGLE(M98090_REG_DRC_EXPANDER, M98090_DRCEXP_SHIFT, | 560 | SOC_ENUM_SINGLE(M98090_REG_DRC_EXPANDER, M98090_DRCEXP_SHIFT, |
@@ -859,7 +857,7 @@ static const struct soc_enum mic2_mux_enum = | |||
859 | static const struct snd_kcontrol_new max98090_mic2_mux = | 857 | static const struct snd_kcontrol_new max98090_mic2_mux = |
860 | SOC_DAPM_ENUM("MIC2 Mux", mic2_mux_enum); | 858 | SOC_DAPM_ENUM("MIC2 Mux", mic2_mux_enum); |
861 | 859 | ||
862 | static const char * max98090_micpre_text[] = { "Off", "On" }; | 860 | static const char *max98090_micpre_text[] = { "Off", "On" }; |
863 | 861 | ||
864 | static const struct soc_enum max98090_pa1en_enum = | 862 | static const struct soc_enum max98090_pa1en_enum = |
865 | SOC_ENUM_SINGLE(M98090_REG_MIC1_INPUT_LEVEL, M98090_MIC_PA1EN_SHIFT, | 863 | SOC_ENUM_SINGLE(M98090_REG_MIC1_INPUT_LEVEL, M98090_MIC_PA1EN_SHIFT, |
@@ -1703,9 +1701,8 @@ static int max98090_dai_set_fmt(struct snd_soc_dai *codec_dai, | |||
1703 | * seen for the case of TDM mode. The remaining cases have | 1701 | * seen for the case of TDM mode. The remaining cases have |
1704 | * normal logic. | 1702 | * normal logic. |
1705 | */ | 1703 | */ |
1706 | if (max98090->tdm_slots > 1) { | 1704 | if (max98090->tdm_slots > 1) |
1707 | regval ^= M98090_BCI_MASK; | 1705 | regval ^= M98090_BCI_MASK; |
1708 | } | ||
1709 | 1706 | ||
1710 | snd_soc_write(codec, | 1707 | snd_soc_write(codec, |
1711 | M98090_REG_INTERFACE_FORMAT, regval); | 1708 | M98090_REG_INTERFACE_FORMAT, regval); |
@@ -2059,17 +2056,14 @@ static irqreturn_t max98090_interrupt(int irq, void *data) | |||
2059 | if (!active) | 2056 | if (!active) |
2060 | return IRQ_NONE; | 2057 | return IRQ_NONE; |
2061 | 2058 | ||
2062 | if (active & M98090_CLD_MASK) { | 2059 | if (active & M98090_CLD_MASK) |
2063 | dev_err(codec->dev, "M98090_CLD_MASK\n"); | 2060 | dev_err(codec->dev, "M98090_CLD_MASK\n"); |
2064 | } | ||
2065 | 2061 | ||
2066 | if (active & M98090_SLD_MASK) { | 2062 | if (active & M98090_SLD_MASK) |
2067 | dev_dbg(codec->dev, "M98090_SLD_MASK\n"); | 2063 | dev_dbg(codec->dev, "M98090_SLD_MASK\n"); |
2068 | } | ||
2069 | 2064 | ||
2070 | if (active & M98090_ULK_MASK) { | 2065 | if (active & M98090_ULK_MASK) |
2071 | dev_err(codec->dev, "M98090_ULK_MASK\n"); | 2066 | dev_err(codec->dev, "M98090_ULK_MASK\n"); |
2072 | } | ||
2073 | 2067 | ||
2074 | if (active & M98090_JDET_MASK) { | 2068 | if (active & M98090_JDET_MASK) { |
2075 | dev_dbg(codec->dev, "M98090_JDET_MASK\n"); | 2069 | dev_dbg(codec->dev, "M98090_JDET_MASK\n"); |
@@ -2080,13 +2074,11 @@ static irqreturn_t max98090_interrupt(int irq, void *data) | |||
2080 | msecs_to_jiffies(100)); | 2074 | msecs_to_jiffies(100)); |
2081 | } | 2075 | } |
2082 | 2076 | ||
2083 | if (active & M98090_DRCACT_MASK) { | 2077 | if (active & M98090_DRCACT_MASK) |
2084 | dev_dbg(codec->dev, "M98090_DRCACT_MASK\n"); | 2078 | dev_dbg(codec->dev, "M98090_DRCACT_MASK\n"); |
2085 | } | ||
2086 | 2079 | ||
2087 | if (active & M98090_DRCCLP_MASK) { | 2080 | if (active & M98090_DRCCLP_MASK) |
2088 | dev_err(codec->dev, "M98090_DRCCLP_MASK\n"); | 2081 | dev_err(codec->dev, "M98090_DRCCLP_MASK\n"); |
2089 | } | ||
2090 | 2082 | ||
2091 | return IRQ_HANDLED; | 2083 | return IRQ_HANDLED; |
2092 | } | 2084 | } |
@@ -2324,7 +2316,7 @@ static int max98090_i2c_probe(struct i2c_client *i2c, | |||
2324 | max98090->pdata = i2c->dev.platform_data; | 2316 | max98090->pdata = i2c->dev.platform_data; |
2325 | max98090->irq = i2c->irq; | 2317 | max98090->irq = i2c->irq; |
2326 | 2318 | ||
2327 | max98090->regmap = regmap_init_i2c(i2c, &max98090_regmap); | 2319 | max98090->regmap = devm_regmap_init_i2c(i2c, &max98090_regmap); |
2328 | if (IS_ERR(max98090->regmap)) { | 2320 | if (IS_ERR(max98090->regmap)) { |
2329 | ret = PTR_ERR(max98090->regmap); | 2321 | ret = PTR_ERR(max98090->regmap); |
2330 | dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); | 2322 | dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); |
@@ -2334,18 +2326,13 @@ static int max98090_i2c_probe(struct i2c_client *i2c, | |||
2334 | ret = snd_soc_register_codec(&i2c->dev, | 2326 | ret = snd_soc_register_codec(&i2c->dev, |
2335 | &soc_codec_dev_max98090, max98090_dai, | 2327 | &soc_codec_dev_max98090, max98090_dai, |
2336 | ARRAY_SIZE(max98090_dai)); | 2328 | ARRAY_SIZE(max98090_dai)); |
2337 | if (ret < 0) | ||
2338 | regmap_exit(max98090->regmap); | ||
2339 | |||
2340 | err_enable: | 2329 | err_enable: |
2341 | return ret; | 2330 | return ret; |
2342 | } | 2331 | } |
2343 | 2332 | ||
2344 | static int max98090_i2c_remove(struct i2c_client *client) | 2333 | static int max98090_i2c_remove(struct i2c_client *client) |
2345 | { | 2334 | { |
2346 | struct max98090_priv *max98090 = dev_get_drvdata(&client->dev); | ||
2347 | snd_soc_unregister_codec(&client->dev); | 2335 | snd_soc_unregister_codec(&client->dev); |
2348 | regmap_exit(max98090->regmap); | ||
2349 | return 0; | 2336 | return 0; |
2350 | } | 2337 | } |
2351 | 2338 | ||
@@ -2369,7 +2356,7 @@ static int max98090_runtime_suspend(struct device *dev) | |||
2369 | return 0; | 2356 | return 0; |
2370 | } | 2357 | } |
2371 | 2358 | ||
2372 | static struct dev_pm_ops max98090_pm = { | 2359 | static const struct dev_pm_ops max98090_pm = { |
2373 | SET_RUNTIME_PM_OPS(max98090_runtime_suspend, | 2360 | SET_RUNTIME_PM_OPS(max98090_runtime_suspend, |
2374 | max98090_runtime_resume, NULL) | 2361 | max98090_runtime_resume, NULL) |
2375 | }; | 2362 | }; |