diff options
author | Pavel Hofman <dustin@seznam.cz> | 2008-03-17 03:45:33 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 06:00:25 -0400 |
commit | 841b23d4d7b554c8d74fc9c34a701f85abc04875 (patch) | |
tree | 64b7322112731405bcdd0c025b76514599e7d0b8 /sound | |
parent | 5949d2443d96f054d9a32d31edddb0be836968c6 (diff) |
[ALSA] some fixes and cleanup for ICE1724 cards
* removing the hack with NON_AKM ak4xxx type
* support for card-specific flags in ak4114_stats
* definition of the flags for corresponding cards
Signed-off-by: Pavel Hofman <dustin@seznam.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/i2c/other/ak4114.c | 2 | ||||
-rw-r--r-- | sound/i2c/other/ak4xxx-adda.c | 16 | ||||
-rw-r--r-- | sound/pci/ice1712/prodigy192.c | 33 | ||||
-rw-r--r-- | sound/pci/ice1712/revo.c | 4 |
4 files changed, 23 insertions, 32 deletions
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index 9a90e830c423..d20d893b3b60 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c | |||
@@ -612,7 +612,7 @@ static void ak4114_stats(struct work_struct *work) | |||
612 | struct ak4114 *chip = container_of(work, struct ak4114, work.work); | 612 | struct ak4114 *chip = container_of(work, struct ak4114, work.work); |
613 | 613 | ||
614 | if (!chip->init) | 614 | if (!chip->init) |
615 | snd_ak4114_check_rate_and_errors(chip, 0); | 615 | snd_ak4114_check_rate_and_errors(chip, chip->check_flags); |
616 | 616 | ||
617 | schedule_delayed_work(&chip->work, HZ / 10); | 617 | schedule_delayed_work(&chip->work, HZ / 10); |
618 | } | 618 | } |
diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c index 35fbbf2cb9fa..288926d2e205 100644 --- a/sound/i2c/other/ak4xxx-adda.c +++ b/sound/i2c/other/ak4xxx-adda.c | |||
@@ -70,7 +70,8 @@ static void ak4524_reset(struct snd_akm4xxx *ak, int state) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /* reset procedure for AK4355 and AK4358 */ | 72 | /* reset procedure for AK4355 and AK4358 */ |
73 | static void ak4355_reset(struct snd_akm4xxx *ak, int state) | 73 | static void ak435X_reset(struct snd_akm4xxx *ak, int state, |
74 | unsigned char total_regs) | ||
74 | { | 75 | { |
75 | unsigned char reg; | 76 | unsigned char reg; |
76 | 77 | ||
@@ -78,7 +79,7 @@ static void ak4355_reset(struct snd_akm4xxx *ak, int state) | |||
78 | snd_akm4xxx_write(ak, 0, 0x01, 0x02); /* reset and soft-mute */ | 79 | snd_akm4xxx_write(ak, 0, 0x01, 0x02); /* reset and soft-mute */ |
79 | return; | 80 | return; |
80 | } | 81 | } |
81 | for (reg = 0x00; reg < 0x0b; reg++) | 82 | for (reg = 0x00; reg < total_regs; reg++) |
82 | if (reg != 0x01) | 83 | if (reg != 0x01) |
83 | snd_akm4xxx_write(ak, 0, reg, | 84 | snd_akm4xxx_write(ak, 0, reg, |
84 | snd_akm4xxx_get(ak, 0, reg)); | 85 | snd_akm4xxx_get(ak, 0, reg)); |
@@ -118,8 +119,10 @@ void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state) | |||
118 | /* FIXME: needed for ak4529? */ | 119 | /* FIXME: needed for ak4529? */ |
119 | break; | 120 | break; |
120 | case SND_AK4355: | 121 | case SND_AK4355: |
122 | ak435X_reset(ak, state, 0x0b); | ||
123 | break; | ||
121 | case SND_AK4358: | 124 | case SND_AK4358: |
122 | ak4355_reset(ak, state); | 125 | ak435X_reset(ak, state, 0x10); |
123 | break; | 126 | break; |
124 | case SND_AK4381: | 127 | case SND_AK4381: |
125 | ak4381_reset(ak, state); | 128 | ak4381_reset(ak, state); |
@@ -292,11 +295,6 @@ void snd_akm4xxx_init(struct snd_akm4xxx *ak) | |||
292 | case SND_AK5365: | 295 | case SND_AK5365: |
293 | /* FIXME: any init sequence? */ | 296 | /* FIXME: any init sequence? */ |
294 | return; | 297 | return; |
295 | case NON_AKM: | ||
296 | /* fake value for non-akm codecs using akm infrastructure | ||
297 | * (e.g. of ice1724) - certainly FIXME | ||
298 | */ | ||
299 | return; | ||
300 | default: | 298 | default: |
301 | snd_BUG(); | 299 | snd_BUG(); |
302 | return; | 300 | return; |
@@ -374,6 +372,8 @@ static int put_ak_reg(struct snd_kcontrol *kcontrol, int addr, | |||
374 | nval = mask - nval; | 372 | nval = mask - nval; |
375 | if (AK_GET_NEEDSMSB(kcontrol->private_value)) | 373 | if (AK_GET_NEEDSMSB(kcontrol->private_value)) |
376 | nval |= 0x80; | 374 | nval |= 0x80; |
375 | /* printk(KERN_DEBUG "DEBUG - AK writing reg: chip %x addr %x, | ||
376 | nval %x\n", chip, addr, nval); */ | ||
377 | snd_akm4xxx_write(ak, chip, addr, nval); | 377 | snd_akm4xxx_write(ak, chip, addr, nval); |
378 | return 1; | 378 | return 1; |
379 | } | 379 | } |
diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 48cf40a8f32a..25ceb67a9c16 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c | |||
@@ -319,12 +319,11 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol, | |||
319 | /* | 319 | /* |
320 | * Handler for setting correct codec rate - called when rate change is detected | 320 | * Handler for setting correct codec rate - called when rate change is detected |
321 | */ | 321 | */ |
322 | static void stac9460_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) | 322 | static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate) |
323 | { | 323 | { |
324 | unsigned char old, new; | 324 | unsigned char old, new; |
325 | int idx; | 325 | int idx; |
326 | unsigned char changed[7]; | 326 | unsigned char changed[7]; |
327 | struct snd_ice1712 *ice = ak->private_data[0]; | ||
328 | struct prodigy192_spec *spec = ice->spec; | 327 | struct prodigy192_spec *spec = ice->spec; |
329 | 328 | ||
330 | if (rate == 0) /* no hint - S/PDIF input is master, simply return */ | 329 | if (rate == 0) /* no hint - S/PDIF input is master, simply return */ |
@@ -357,16 +356,6 @@ static void stac9460_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) | |||
357 | mutex_unlock(&spec->mute_mutex); | 356 | mutex_unlock(&spec->mute_mutex); |
358 | } | 357 | } |
359 | 358 | ||
360 | /* using akm infrastructure for setting rate of the codec */ | ||
361 | static struct snd_akm4xxx akmlike_stac9460 __devinitdata = { | ||
362 | .type = NON_AKM, /* special value */ | ||
363 | .num_adcs = 6, /* not used in any way, just for completeness */ | ||
364 | .num_dacs = 2, | ||
365 | .ops = { | ||
366 | .set_rate_val = stac9460_set_rate_val | ||
367 | } | ||
368 | }; | ||
369 | |||
370 | 359 | ||
371 | static const DECLARE_TLV_DB_SCALE(db_scale_dac, -19125, 75, 0); | 360 | static const DECLARE_TLV_DB_SCALE(db_scale_dac, -19125, 75, 0); |
372 | static const DECLARE_TLV_DB_SCALE(db_scale_adc, 0, 150, 0); | 361 | static const DECLARE_TLV_DB_SCALE(db_scale_adc, 0, 150, 0); |
@@ -642,12 +631,19 @@ static int prodigy192_ak4114_init(struct snd_ice1712 *ice) | |||
642 | 0x41, 0x02, 0x2c, 0x00, 0x00 | 631 | 0x41, 0x02, 0x2c, 0x00, 0x00 |
643 | }; | 632 | }; |
644 | struct prodigy192_spec *spec = ice->spec; | 633 | struct prodigy192_spec *spec = ice->spec; |
634 | int err; | ||
645 | 635 | ||
646 | return snd_ak4114_create(ice->card, | 636 | err = snd_ak4114_create(ice->card, |
647 | prodigy192_ak4114_read, | 637 | prodigy192_ak4114_read, |
648 | prodigy192_ak4114_write, | 638 | prodigy192_ak4114_write, |
649 | ak4114_init_vals, ak4114_init_txcsb, | 639 | ak4114_init_vals, ak4114_init_txcsb, |
650 | ice, &spec->ak4114); | 640 | ice, &spec->ak4114); |
641 | if (err < 0) | ||
642 | return err; | ||
643 | /* AK4114 in Prodigy192 cannot detect external rate correctly. | ||
644 | * No reason to stop capture stream due to incorrect checks */ | ||
645 | spec->ak4114->check_flags = AK4114_CHECK_NO_RATE; | ||
646 | return 0; | ||
651 | } | 647 | } |
652 | 648 | ||
653 | static void stac9460_proc_regs_read(struct snd_info_entry *entry, | 649 | static void stac9460_proc_regs_read(struct snd_info_entry *entry, |
@@ -743,7 +739,6 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice) | |||
743 | }; | 739 | }; |
744 | const unsigned short *p; | 740 | const unsigned short *p; |
745 | int err = 0; | 741 | int err = 0; |
746 | struct snd_akm4xxx *ak; | ||
747 | struct prodigy192_spec *spec; | 742 | struct prodigy192_spec *spec; |
748 | 743 | ||
749 | /* prodigy 192 */ | 744 | /* prodigy 192 */ |
@@ -761,15 +756,7 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice) | |||
761 | p = stac_inits_prodigy; | 756 | p = stac_inits_prodigy; |
762 | for (; *p != (unsigned short)-1; p += 2) | 757 | for (; *p != (unsigned short)-1; p += 2) |
763 | stac9460_put(ice, p[0], p[1]); | 758 | stac9460_put(ice, p[0], p[1]); |
764 | /* reusing the akm codecs infrastructure, | 759 | ice->gpio.set_pro_rate = stac9460_set_rate_val; |
765 | * for setting rate on stac9460 */ | ||
766 | ak = ice->akm = kmalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); | ||
767 | if (!ak) | ||
768 | return -ENOMEM; | ||
769 | ice->akm_codecs = 1; | ||
770 | err = snd_ice1712_akm4xxx_init(ak, &akmlike_stac9460, NULL, ice); | ||
771 | if (err < 0) | ||
772 | return err; | ||
773 | 760 | ||
774 | /* MI/ODI/O add on card with AK4114 */ | 761 | /* MI/ODI/O add on card with AK4114 */ |
775 | if (prodigy192_miodio_exists(ice)) { | 762 | if (prodigy192_miodio_exists(ice)) { |
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index 7c930cc05f1d..dba93d8efbe0 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c | |||
@@ -488,6 +488,10 @@ static int __devinit ap192_ak4114_init(struct snd_ice1712 *ice) | |||
488 | ap192_ak4114_write, | 488 | ap192_ak4114_write, |
489 | ak4114_init_vals, ak4114_init_txcsb, | 489 | ak4114_init_vals, ak4114_init_txcsb, |
490 | ice, &ak); | 490 | ice, &ak); |
491 | /* AK4114 in Revo cannot detect external rate correctly. | ||
492 | * No reason to stop capture stream due to incorrect checks */ | ||
493 | ak->check_flags = AK4114_CHECK_NO_RATE; | ||
494 | |||
491 | return 0; /* error ignored; it's no fatal error */ | 495 | return 0; /* error ignored; it's no fatal error */ |
492 | } | 496 | } |
493 | 497 | ||