aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-05-23 06:31:40 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-05-23 06:31:40 -0400
commit1a55b3f6ed1d917dd26271dae19dda088d820540 (patch)
treed99fc2581db3233a5b06d247b62da82d5b7a8008
parent0a1bf553359013621c8c5cf745354212c6ef51d3 (diff)
ASoC: WM8974 checkpatch cleanups
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/wm8974.c78
-rw-r--r--sound/soc/codecs/wm8974.h28
2 files changed, 52 insertions, 54 deletions
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 2b0c99c3e65..b5f1a707cd7 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -28,9 +28,6 @@
28 28
29#include "wm8974.h" 29#include "wm8974.h"
30 30
31#define AUDIO_NAME "wm8974"
32#define WM8974_VERSION "0.6"
33
34struct snd_soc_codec_device soc_codec_dev_wm8974; 31struct snd_soc_codec_device soc_codec_dev_wm8974;
35 32
36/* 33/*
@@ -39,27 +36,27 @@ struct snd_soc_codec_device soc_codec_dev_wm8974;
39 * using 2 wire for device control, so we cache them instead. 36 * using 2 wire for device control, so we cache them instead.
40 */ 37 */
41static const u16 wm8974_reg[WM8974_CACHEREGNUM] = { 38static const u16 wm8974_reg[WM8974_CACHEREGNUM] = {
42 0x0000, 0x0000, 0x0000, 0x0000, 39 0x0000, 0x0000, 0x0000, 0x0000,
43 0x0050, 0x0000, 0x0140, 0x0000, 40 0x0050, 0x0000, 0x0140, 0x0000,
44 0x0000, 0x0000, 0x0000, 0x00ff, 41 0x0000, 0x0000, 0x0000, 0x00ff,
45 0x0000, 0x0000, 0x0100, 0x00ff, 42 0x0000, 0x0000, 0x0100, 0x00ff,
46 0x0000, 0x0000, 0x012c, 0x002c, 43 0x0000, 0x0000, 0x012c, 0x002c,
47 0x002c, 0x002c, 0x002c, 0x0000, 44 0x002c, 0x002c, 0x002c, 0x0000,
48 0x0032, 0x0000, 0x0000, 0x0000, 45 0x0032, 0x0000, 0x0000, 0x0000,
49 0x0000, 0x0000, 0x0000, 0x0000, 46 0x0000, 0x0000, 0x0000, 0x0000,
50 0x0038, 0x000b, 0x0032, 0x0000, 47 0x0038, 0x000b, 0x0032, 0x0000,
51 0x0008, 0x000c, 0x0093, 0x00e9, 48 0x0008, 0x000c, 0x0093, 0x00e9,
52 0x0000, 0x0000, 0x0000, 0x0000, 49 0x0000, 0x0000, 0x0000, 0x0000,
53 0x0003, 0x0010, 0x0000, 0x0000, 50 0x0003, 0x0010, 0x0000, 0x0000,
54 0x0000, 0x0002, 0x0000, 0x0000, 51 0x0000, 0x0002, 0x0000, 0x0000,
55 0x0000, 0x0000, 0x0039, 0x0000, 52 0x0000, 0x0000, 0x0039, 0x0000,
56 0x0000, 53 0x0000,
57}; 54};
58 55
59/* 56/*
60 * read wm8974 register cache 57 * read wm8974 register cache
61 */ 58 */
62static inline unsigned int wm8974_read_reg_cache(struct snd_soc_codec * codec, 59static inline unsigned int wm8974_read_reg_cache(struct snd_soc_codec *codec,
63 unsigned int reg) 60 unsigned int reg)
64{ 61{
65 u16 *cache = codec->reg_cache; 62 u16 *cache = codec->reg_cache;
@@ -97,7 +94,7 @@ static int wm8974_write(struct snd_soc_codec *codec, unsigned int reg,
97 data[0] = (reg << 1) | ((value >> 8) & 0x0001); 94 data[0] = (reg << 1) | ((value >> 8) & 0x0001);
98 data[1] = value & 0x00ff; 95 data[1] = value & 0x00ff;
99 96
100 wm8974_write_reg_cache (codec, reg, value); 97 wm8974_write_reg_cache(codec, reg, value);
101 if (codec->hw_write(codec->control_data, data, 2) == 2) 98 if (codec->hw_write(codec->control_data, data, 2) == 2)
102 return 0; 99 return 0;
103 else 100 else
@@ -215,7 +212,8 @@ static int wm8974_add_controls(struct snd_soc_codec *codec)
215 212
216 for (i = 0; i < ARRAY_SIZE(wm8974_snd_controls); i++) { 213 for (i = 0; i < ARRAY_SIZE(wm8974_snd_controls); i++) {
217 err = snd_ctl_add(codec->card, 214 err = snd_ctl_add(codec->card,
218 snd_soc_cnew(&wm8974_snd_controls[i],codec, NULL)); 215 snd_soc_cnew(&wm8974_snd_controls[i],
216 codec, NULL));
219 if (err < 0) 217 if (err < 0)
220 return err; 218 return err;
221 } 219 }
@@ -347,13 +345,14 @@ struct pll_ {
347}; 345};
348 346
349static struct pll_ pll[] = { 347static struct pll_ pll[] = {
350 {12000000, 11289600, 0, 7, 0x86c220}, 348 { 12000000, 11289600, 0, 7, 0x86c220 },
351 {12000000, 12288000, 0, 8, 0x3126e8}, 349 { 12000000, 12288000, 0, 8, 0x3126e8 },
352 {13000000, 11289600, 0, 6, 0xf28bd4}, 350 { 13000000, 11289600, 0, 6, 0xf28bd4 },
353 {13000000, 12288000, 0, 7, 0x8fd525}, 351 { 13000000, 12288000, 0, 7, 0x8fd525 },
354 {12288000, 11289600, 0, 7, 0x59999a}, 352 { 12288000, 11289600, 0, 7, 0x59999a },
355 {11289600, 12288000, 0, 8, 0x80dee9}, 353 { 11289600, 12288000, 0, 8, 0x80dee9 },
356 /* liam - add more entries */ 354 { 25000000, 11289600, 1, 7, 0x39B024 },
355 { 25000000, 24576000, 1, 7, 0xdd4413 }
357}; 356};
358 357
359static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai, 358static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai,
@@ -363,23 +362,26 @@ static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai,
363 int i; 362 int i;
364 u16 reg; 363 u16 reg;
365 364
366 if(freq_in == 0 || freq_out == 0) { 365 if (freq_in == 0 || freq_out == 0) {
367 reg = wm8974_read_reg_cache(codec, WM8974_POWER1); 366 reg = wm8974_read_reg_cache(codec, WM8974_POWER1);
368 wm8974_write(codec, WM8974_POWER1, reg & 0x1df); 367 wm8974_write(codec, WM8974_POWER1, reg & 0x1df);
369 return 0; 368 return 0;
370 } 369 }
371 370
372 for(i = 0; i < ARRAY_SIZE(pll); i++) { 371 for (i = 0; i < ARRAY_SIZE(pll); i++) {
373 if (freq_in == pll[i].in_hz && freq_out == pll[i].out_hz) { 372 if (freq_in == pll[i].in_hz && freq_out == pll[i].out_hz) {
374 wm8974_write(codec, WM8974_PLLN, (pll[i].pre << 4) | pll[i].n); 373 wm8974_write(codec, WM8974_PLLN,
374 (pll[i].pre << 4) | pll[i].n);
375 wm8974_write(codec, WM8974_PLLK1, pll[i].k >> 18); 375 wm8974_write(codec, WM8974_PLLK1, pll[i].k >> 18);
376 wm8974_write(codec, WM8974_PLLK2, (pll[i].k >> 9) & 0x1ff); 376 wm8974_write(codec, WM8974_PLLK2,
377 (pll[i].k >> 9) & 0x1ff);
377 wm8974_write(codec, WM8974_PLLK3, pll[i].k & 0x1ff); 378 wm8974_write(codec, WM8974_PLLK3, pll[i].k & 0x1ff);
378 reg = wm8974_read_reg_cache(codec, WM8974_POWER1); 379 reg = wm8974_read_reg_cache(codec, WM8974_POWER1);
379 wm8974_write(codec, WM8974_POWER1, reg | 0x020); 380 wm8974_write(codec, WM8974_POWER1, reg | 0x020);
380 return 0; 381 return 0;
381 } 382 }
382 } 383 }
384
383 return -EINVAL; 385 return -EINVAL;
384} 386}
385 387
@@ -394,7 +396,7 @@ static int wm8974_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
394 396
395 switch (div_id) { 397 switch (div_id) {
396 case WM8974_OPCLKDIV: 398 case WM8974_OPCLKDIV:
397 reg = wm8974_read_reg_cache(codec, WM8974_GPIO) & 0x1cf; 399 reg = wm8974_read_reg_cache(codec, WM8974_GPIO) & 0x1cf;
398 wm8974_write(codec, WM8974_GPIO, reg | div); 400 wm8974_write(codec, WM8974_GPIO, reg | div);
399 break; 401 break;
400 case WM8974_MCLKDIV: 402 case WM8974_MCLKDIV:
@@ -531,7 +533,7 @@ static int wm8974_mute(struct snd_soc_dai *dai, int mute)
531 struct snd_soc_codec *codec = dai->codec; 533 struct snd_soc_codec *codec = dai->codec;
532 u16 mute_reg = wm8974_read_reg_cache(codec, WM8974_DAC) & 0xffbf; 534 u16 mute_reg = wm8974_read_reg_cache(codec, WM8974_DAC) & 0xffbf;
533 535
534 if(mute) 536 if (mute)
535 wm8974_write(codec, WM8974_DAC, mute_reg | 0x40); 537 wm8974_write(codec, WM8974_DAC, mute_reg | 0x40);
536 else 538 else
537 wm8974_write(codec, WM8974_DAC, mute_reg); 539 wm8974_write(codec, WM8974_DAC, mute_reg);
@@ -562,9 +564,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec,
562 return 0; 564 return 0;
563} 565}
564 566
565#define WM8974_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ 567#define WM8974_RATES (SNDRV_PCM_RATE_8000_48000)
566 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
567 SNDRV_PCM_RATE_48000)
568 568
569#define WM8974_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 569#define WM8974_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
570 SNDRV_PCM_FMTBIT_S24_LE) 570 SNDRV_PCM_FMTBIT_S24_LE)
@@ -649,7 +649,7 @@ static int wm8974_init(struct snd_soc_device *socdev)
649 649
650 /* register pcms */ 650 /* register pcms */
651 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 651 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
652 if(ret < 0) { 652 if (ret < 0) {
653 printk(KERN_ERR "wm8974: failed to create pcms\n"); 653 printk(KERN_ERR "wm8974: failed to create pcms\n");
654 goto pcm_err; 654 goto pcm_err;
655 } 655 }
@@ -773,8 +773,6 @@ static int wm8974_probe(struct platform_device *pdev)
773 struct snd_soc_codec *codec; 773 struct snd_soc_codec *codec;
774 int ret = 0; 774 int ret = 0;
775 775
776 pr_info("WM8974 Audio Codec %s", WM8974_VERSION);
777
778 setup = socdev->codec_data; 776 setup = socdev->codec_data;
779 codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 777 codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
780 if (codec == NULL) 778 if (codec == NULL)
diff --git a/sound/soc/codecs/wm8974.h b/sound/soc/codecs/wm8974.h
index 0f5172e0f61..726de9648ba 100644
--- a/sound/soc/codecs/wm8974.h
+++ b/sound/soc/codecs/wm8974.h
@@ -16,30 +16,30 @@
16#define WM8974_POWER2 0x2 16#define WM8974_POWER2 0x2
17#define WM8974_POWER3 0x3 17#define WM8974_POWER3 0x3
18#define WM8974_IFACE 0x4 18#define WM8974_IFACE 0x4
19#define WM8974_COMP 0x5 19#define WM8974_COMP 0x5
20#define WM8974_CLOCK 0x6 20#define WM8974_CLOCK 0x6
21#define WM8974_ADD 0x7 21#define WM8974_ADD 0x7
22#define WM8974_GPIO 0x8 22#define WM8974_GPIO 0x8
23#define WM8974_DAC 0xa 23#define WM8974_DAC 0xa
24#define WM8974_DACVOL 0xb 24#define WM8974_DACVOL 0xb
25#define WM8974_ADC 0xe 25#define WM8974_ADC 0xe
26#define WM8974_ADCVOL 0xf 26#define WM8974_ADCVOL 0xf
27#define WM8974_EQ1 0x12 27#define WM8974_EQ1 0x12
28#define WM8974_EQ2 0x13 28#define WM8974_EQ2 0x13
29#define WM8974_EQ3 0x14 29#define WM8974_EQ3 0x14
30#define WM8974_EQ4 0x15 30#define WM8974_EQ4 0x15
31#define WM8974_EQ5 0x16 31#define WM8974_EQ5 0x16
32#define WM8974_DACLIM1 0x18 32#define WM8974_DACLIM1 0x18
33#define WM8974_DACLIM2 0x19 33#define WM8974_DACLIM2 0x19
34#define WM8974_NOTCH1 0x1b 34#define WM8974_NOTCH1 0x1b
35#define WM8974_NOTCH2 0x1c 35#define WM8974_NOTCH2 0x1c
36#define WM8974_NOTCH3 0x1d 36#define WM8974_NOTCH3 0x1d
37#define WM8974_NOTCH4 0x1e 37#define WM8974_NOTCH4 0x1e
38#define WM8974_ALC1 0x20 38#define WM8974_ALC1 0x20
39#define WM8974_ALC2 0x21 39#define WM8974_ALC2 0x21
40#define WM8974_ALC3 0x22 40#define WM8974_ALC3 0x22
41#define WM8974_NGATE 0x23 41#define WM8974_NGATE 0x23
42#define WM8974_PLLN 0x24 42#define WM8974_PLLN 0x24
43#define WM8974_PLLK1 0x25 43#define WM8974_PLLK1 0x25
44#define WM8974_PLLK2 0x26 44#define WM8974_PLLK2 0x26
45#define WM8974_PLLK3 0x27 45#define WM8974_PLLK3 0x27