diff options
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/wm9081.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 2103623a0776..7883f3ed797b 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -167,7 +167,7 @@ struct wm9081_priv { | |||
167 | int fll_fref; | 167 | int fll_fref; |
168 | int fll_fout; | 168 | int fll_fout; |
169 | int tdm_width; | 169 | int tdm_width; |
170 | struct wm9081_retune_mobile_config *retune; | 170 | struct wm9081_pdata pdata; |
171 | }; | 171 | }; |
172 | 172 | ||
173 | static int wm9081_volatile_register(struct snd_soc_codec *codec, unsigned int reg) | 173 | static int wm9081_volatile_register(struct snd_soc_codec *codec, unsigned int reg) |
@@ -1082,21 +1082,22 @@ static int wm9081_hw_params(struct snd_pcm_substream *substream, | |||
1082 | aif4 |= wm9081->bclk / wm9081->fs; | 1082 | aif4 |= wm9081->bclk / wm9081->fs; |
1083 | 1083 | ||
1084 | /* Apply a ReTune Mobile configuration if it's in use */ | 1084 | /* Apply a ReTune Mobile configuration if it's in use */ |
1085 | if (wm9081->retune) { | 1085 | if (wm9081->pdata.num_retune_configs) { |
1086 | struct wm9081_retune_mobile_config *retune = wm9081->retune; | 1086 | struct wm9081_pdata *pdata = &wm9081->pdata; |
1087 | struct wm9081_retune_mobile_setting *s; | 1087 | struct wm9081_retune_mobile_setting *s; |
1088 | int eq1; | 1088 | int eq1; |
1089 | 1089 | ||
1090 | best = 0; | 1090 | best = 0; |
1091 | best_val = abs(retune->configs[0].rate - wm9081->fs); | 1091 | best_val = abs(pdata->retune_configs[0].rate - wm9081->fs); |
1092 | for (i = 0; i < retune->num_configs; i++) { | 1092 | for (i = 0; i < pdata->num_retune_configs; i++) { |
1093 | cur_val = abs(retune->configs[i].rate - wm9081->fs); | 1093 | cur_val = abs(pdata->retune_configs[i].rate - |
1094 | wm9081->fs); | ||
1094 | if (cur_val < best_val) { | 1095 | if (cur_val < best_val) { |
1095 | best_val = cur_val; | 1096 | best_val = cur_val; |
1096 | best = i; | 1097 | best = i; |
1097 | } | 1098 | } |
1098 | } | 1099 | } |
1099 | s = &retune->configs[best]; | 1100 | s = &pdata->retune_configs[best]; |
1100 | 1101 | ||
1101 | dev_dbg(codec->dev, "ReTune Mobile %s tuned for %dHz\n", | 1102 | dev_dbg(codec->dev, "ReTune Mobile %s tuned for %dHz\n", |
1102 | s->name, s->rate); | 1103 | s->name, s->rate); |
@@ -1255,6 +1256,14 @@ static int wm9081_probe(struct snd_soc_codec *codec) | |||
1255 | return ret; | 1256 | return ret; |
1256 | } | 1257 | } |
1257 | 1258 | ||
1259 | reg = 0; | ||
1260 | if (wm9081->pdata.irq_high) | ||
1261 | reg |= WM9081_IRQ_POL; | ||
1262 | if (!wm9081->pdata.irq_cmos) | ||
1263 | reg |= WM9081_IRQ_OP_CTRL; | ||
1264 | snd_soc_update_bits(codec, WM9081_INTERRUPT_CONTROL, | ||
1265 | WM9081_IRQ_POL | WM9081_IRQ_OP_CTRL, reg); | ||
1266 | |||
1258 | wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1267 | wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1259 | 1268 | ||
1260 | /* Enable zero cross by default */ | 1269 | /* Enable zero cross by default */ |
@@ -1266,7 +1275,7 @@ static int wm9081_probe(struct snd_soc_codec *codec) | |||
1266 | 1275 | ||
1267 | snd_soc_add_controls(codec, wm9081_snd_controls, | 1276 | snd_soc_add_controls(codec, wm9081_snd_controls, |
1268 | ARRAY_SIZE(wm9081_snd_controls)); | 1277 | ARRAY_SIZE(wm9081_snd_controls)); |
1269 | if (!wm9081->retune) { | 1278 | if (!wm9081->pdata.num_retune_configs) { |
1270 | dev_dbg(codec->dev, | 1279 | dev_dbg(codec->dev, |
1271 | "No ReTune Mobile data, using normal EQ\n"); | 1280 | "No ReTune Mobile data, using normal EQ\n"); |
1272 | snd_soc_add_controls(codec, wm9081_eq_controls, | 1281 | snd_soc_add_controls(codec, wm9081_eq_controls, |
@@ -1343,8 +1352,8 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, | |||
1343 | wm9081->control_data = i2c; | 1352 | wm9081->control_data = i2c; |
1344 | 1353 | ||
1345 | if (dev_get_platdata(&i2c->dev)) | 1354 | if (dev_get_platdata(&i2c->dev)) |
1346 | memcpy(&wm9081->retune, dev_get_platdata(&i2c->dev), | 1355 | memcpy(&wm9081->pdata, dev_get_platdata(&i2c->dev), |
1347 | sizeof(wm9081->retune)); | 1356 | sizeof(wm9081->pdata)); |
1348 | 1357 | ||
1349 | ret = snd_soc_register_codec(&i2c->dev, | 1358 | ret = snd_soc_register_codec(&i2c->dev, |
1350 | &soc_codec_dev_wm9081, &wm9081_dai, 1); | 1359 | &soc_codec_dev_wm9081, &wm9081_dai, 1); |