diff options
Diffstat (limited to 'sound/soc/codecs/tlv320dac33.c')
| -rw-r--r-- | sound/soc/codecs/tlv320dac33.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index faa5e9fb1471..dc8a2b2bdc1c 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
| @@ -55,13 +55,13 @@ | |||
| 55 | #define BURST_BASEFREQ_HZ 49152000 | 55 | #define BURST_BASEFREQ_HZ 49152000 |
| 56 | 56 | ||
| 57 | #define SAMPLES_TO_US(rate, samples) \ | 57 | #define SAMPLES_TO_US(rate, samples) \ |
| 58 | (1000000000 / ((rate * 1000) / samples)) | 58 | (1000000000 / (((rate) * 1000) / (samples))) |
| 59 | 59 | ||
| 60 | #define US_TO_SAMPLES(rate, us) \ | 60 | #define US_TO_SAMPLES(rate, us) \ |
| 61 | (rate / (1000000 / (us < 1000000 ? us : 1000000))) | 61 | ((rate) / (1000000 / ((us) < 1000000 ? (us) : 1000000))) |
| 62 | 62 | ||
| 63 | #define UTHR_FROM_PERIOD_SIZE(samples, playrate, burstrate) \ | 63 | #define UTHR_FROM_PERIOD_SIZE(samples, playrate, burstrate) \ |
| 64 | ((samples * 5000) / ((burstrate * 5000) / (burstrate - playrate))) | 64 | (((samples)*5000) / (((burstrate)*5000) / ((burstrate) - (playrate)))) |
| 65 | 65 | ||
| 66 | static void dac33_calculate_times(struct snd_pcm_substream *substream); | 66 | static void dac33_calculate_times(struct snd_pcm_substream *substream); |
| 67 | static int dac33_prepare_chip(struct snd_pcm_substream *substream); | 67 | static int dac33_prepare_chip(struct snd_pcm_substream *substream); |
| @@ -627,18 +627,6 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
| 627 | {"RIGHT_LO", NULL, "Codec Power"}, | 627 | {"RIGHT_LO", NULL, "Codec Power"}, |
| 628 | }; | 628 | }; |
| 629 | 629 | ||
| 630 | static int dac33_add_widgets(struct snd_soc_codec *codec) | ||
| 631 | { | ||
| 632 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
| 633 | |||
| 634 | snd_soc_dapm_new_controls(dapm, dac33_dapm_widgets, | ||
| 635 | ARRAY_SIZE(dac33_dapm_widgets)); | ||
| 636 | /* set up audio path interconnects */ | ||
| 637 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | ||
| 638 | |||
| 639 | return 0; | ||
| 640 | } | ||
| 641 | |||
| 642 | static int dac33_set_bias_level(struct snd_soc_codec *codec, | 630 | static int dac33_set_bias_level(struct snd_soc_codec *codec, |
| 643 | enum snd_soc_bias_level level) | 631 | enum snd_soc_bias_level level) |
| 644 | { | 632 | { |
| @@ -1431,7 +1419,7 @@ static int dac33_soc_probe(struct snd_soc_codec *codec) | |||
| 1431 | /* Check if the IRQ number is valid and request it */ | 1419 | /* Check if the IRQ number is valid and request it */ |
| 1432 | if (dac33->irq >= 0) { | 1420 | if (dac33->irq >= 0) { |
| 1433 | ret = request_irq(dac33->irq, dac33_interrupt_handler, | 1421 | ret = request_irq(dac33->irq, dac33_interrupt_handler, |
| 1434 | IRQF_TRIGGER_RISING | IRQF_DISABLED, | 1422 | IRQF_TRIGGER_RISING, |
| 1435 | codec->name, codec); | 1423 | codec->name, codec); |
| 1436 | if (ret < 0) { | 1424 | if (ret < 0) { |
| 1437 | dev_err(codec->dev, "Could not request IRQ%d (%d)\n", | 1425 | dev_err(codec->dev, "Could not request IRQ%d (%d)\n", |
| @@ -1451,15 +1439,11 @@ static int dac33_soc_probe(struct snd_soc_codec *codec) | |||
| 1451 | } | 1439 | } |
| 1452 | } | 1440 | } |
| 1453 | 1441 | ||
| 1454 | snd_soc_add_controls(codec, dac33_snd_controls, | ||
| 1455 | ARRAY_SIZE(dac33_snd_controls)); | ||
| 1456 | /* Only add the FIFO controls, if we have valid IRQ number */ | 1442 | /* Only add the FIFO controls, if we have valid IRQ number */ |
| 1457 | if (dac33->irq >= 0) | 1443 | if (dac33->irq >= 0) |
| 1458 | snd_soc_add_controls(codec, dac33_mode_snd_controls, | 1444 | snd_soc_add_controls(codec, dac33_mode_snd_controls, |
| 1459 | ARRAY_SIZE(dac33_mode_snd_controls)); | 1445 | ARRAY_SIZE(dac33_mode_snd_controls)); |
| 1460 | 1446 | ||
| 1461 | dac33_add_widgets(codec); | ||
| 1462 | |||
| 1463 | err_power: | 1447 | err_power: |
| 1464 | return ret; | 1448 | return ret; |
| 1465 | } | 1449 | } |
| @@ -1502,6 +1486,13 @@ static struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = { | |||
| 1502 | .remove = dac33_soc_remove, | 1486 | .remove = dac33_soc_remove, |
| 1503 | .suspend = dac33_soc_suspend, | 1487 | .suspend = dac33_soc_suspend, |
| 1504 | .resume = dac33_soc_resume, | 1488 | .resume = dac33_soc_resume, |
| 1489 | |||
| 1490 | .controls = dac33_snd_controls, | ||
| 1491 | .num_controls = ARRAY_SIZE(dac33_snd_controls), | ||
| 1492 | .dapm_widgets = dac33_dapm_widgets, | ||
| 1493 | .num_dapm_widgets = ARRAY_SIZE(dac33_dapm_widgets), | ||
| 1494 | .dapm_routes = audio_map, | ||
| 1495 | .num_dapm_routes = ARRAY_SIZE(audio_map), | ||
| 1505 | }; | 1496 | }; |
| 1506 | 1497 | ||
| 1507 | #define DAC33_RATES (SNDRV_PCM_RATE_44100 | \ | 1498 | #define DAC33_RATES (SNDRV_PCM_RATE_44100 | \ |
