diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/pcm.c | 4 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 13 | ||||
-rw-r--r-- | sound/core/rawmidi.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 2 | ||||
-rw-r--r-- | sound/ppc/awacs.c | 50 | ||||
-rw-r--r-- | sound/soc/at32/at32-pcm.c | 5 | ||||
-rw-r--r-- | sound/soc/codecs/cs4270.c | 103 | ||||
-rw-r--r-- | sound/soc/codecs/wm8753.c | 4 |
8 files changed, 85 insertions, 100 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 9dd9bc73fe1d..ece25c718e95 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -781,7 +781,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, | |||
781 | return -ENODEV; | 781 | return -ENODEV; |
782 | 782 | ||
783 | card = pcm->card; | 783 | card = pcm->card; |
784 | down_read(&card->controls_rwsem); | 784 | read_lock(&card->ctl_files_rwlock); |
785 | list_for_each_entry(kctl, &card->ctl_files, list) { | 785 | list_for_each_entry(kctl, &card->ctl_files, list) { |
786 | if (kctl->pid == current->pid) { | 786 | if (kctl->pid == current->pid) { |
787 | prefer_subdevice = kctl->prefer_pcm_subdevice; | 787 | prefer_subdevice = kctl->prefer_pcm_subdevice; |
@@ -789,7 +789,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, | |||
789 | break; | 789 | break; |
790 | } | 790 | } |
791 | } | 791 | } |
792 | up_read(&card->controls_rwsem); | 792 | read_unlock(&card->ctl_files_rwlock); |
793 | 793 | ||
794 | switch (stream) { | 794 | switch (stream) { |
795 | case SNDRV_PCM_STREAM_PLAYBACK: | 795 | case SNDRV_PCM_STREAM_PLAYBACK: |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index c49b9d9e303c..c487025d3457 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1546,16 +1546,10 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) | |||
1546 | card = substream->pcm->card; | 1546 | card = substream->pcm->card; |
1547 | 1547 | ||
1548 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN || | 1548 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN || |
1549 | runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) | 1549 | runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED || |
1550 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) | ||
1550 | return -EBADFD; | 1551 | return -EBADFD; |
1551 | 1552 | ||
1552 | snd_power_lock(card); | ||
1553 | if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { | ||
1554 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0); | ||
1555 | if (result < 0) | ||
1556 | goto _unlock; | ||
1557 | } | ||
1558 | |||
1559 | snd_pcm_stream_lock_irq(substream); | 1553 | snd_pcm_stream_lock_irq(substream); |
1560 | /* resume pause */ | 1554 | /* resume pause */ |
1561 | if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) | 1555 | if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) |
@@ -1564,8 +1558,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) | |||
1564 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); | 1558 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); |
1565 | /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ | 1559 | /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ |
1566 | snd_pcm_stream_unlock_irq(substream); | 1560 | snd_pcm_stream_unlock_irq(substream); |
1567 | _unlock: | 1561 | |
1568 | snd_power_unlock(card); | ||
1569 | return result; | 1562 | return result; |
1570 | } | 1563 | } |
1571 | 1564 | ||
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index f7ea7287c59c..b917a9f981c7 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -418,7 +418,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
418 | mutex_lock(&rmidi->open_mutex); | 418 | mutex_lock(&rmidi->open_mutex); |
419 | while (1) { | 419 | while (1) { |
420 | subdevice = -1; | 420 | subdevice = -1; |
421 | down_read(&card->controls_rwsem); | 421 | read_lock(&card->ctl_files_rwlock); |
422 | list_for_each_entry(kctl, &card->ctl_files, list) { | 422 | list_for_each_entry(kctl, &card->ctl_files, list) { |
423 | if (kctl->pid == current->pid) { | 423 | if (kctl->pid == current->pid) { |
424 | subdevice = kctl->prefer_rawmidi_subdevice; | 424 | subdevice = kctl->prefer_rawmidi_subdevice; |
@@ -426,7 +426,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
426 | break; | 426 | break; |
427 | } | 427 | } |
428 | } | 428 | } |
429 | up_read(&card->controls_rwsem); | 429 | read_unlock(&card->ctl_files_rwlock); |
430 | err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device, | 430 | err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device, |
431 | subdevice, fflags, rawmidi_file); | 431 | subdevice, fflags, rawmidi_file); |
432 | if (err >= 0) | 432 | if (err >= 0) |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index ad994fcab725..f3da621f25c5 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1683,8 +1683,8 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { | |||
1683 | /* Dell 3 stack systems with verb table in BIOS */ | 1683 | /* Dell 3 stack systems with verb table in BIOS */ |
1684 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), | 1684 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), |
1685 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), | 1685 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), |
1686 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell ", STAC_DELL_BIOS), | ||
1687 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), | 1686 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), |
1687 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST), | ||
1688 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), | 1688 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), |
1689 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), | 1689 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), |
1690 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), | 1690 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 566a6d0daf4a..106c48225bba 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c | |||
@@ -621,6 +621,13 @@ static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] __initdata = { | |||
621 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), | 621 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), |
622 | }; | 622 | }; |
623 | 623 | ||
624 | static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] __initdata = { | ||
625 | AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), | ||
626 | AWACS_VOLUME("Master Playback Volume", 5, 6, 1), | ||
627 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), | ||
628 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), | ||
629 | }; | ||
630 | |||
624 | static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __initdata = { | 631 | static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __initdata = { |
625 | AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), | 632 | AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), |
626 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), | 633 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), |
@@ -688,7 +695,10 @@ static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __initdata = { | |||
688 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata = | 695 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata = |
689 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); | 696 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); |
690 | 697 | ||
691 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac __initdata = | 698 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __initdata = |
699 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); | ||
700 | |||
701 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __initdata = | ||
692 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); | 702 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); |
693 | 703 | ||
694 | 704 | ||
@@ -765,11 +775,12 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip) | |||
765 | 775 | ||
766 | #define IS_PM7500 (machine_is_compatible("AAPL,7500")) | 776 | #define IS_PM7500 (machine_is_compatible("AAPL,7500")) |
767 | #define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) | 777 | #define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) |
768 | #define IS_IMAC (machine_is_compatible("PowerMac2,1") \ | 778 | #define IS_IMAC1 (machine_is_compatible("PowerMac2,1")) |
769 | || machine_is_compatible("PowerMac2,2") \ | 779 | #define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \ |
770 | || machine_is_compatible("PowerMac4,1")) | 780 | || machine_is_compatible("PowerMac4,1")) |
781 | #define IS_G4AGP (machine_is_compatible("PowerMac3,1")) | ||
771 | 782 | ||
772 | static int imac; | 783 | static int imac1, imac2; |
773 | 784 | ||
774 | #ifdef PMAC_SUPPORT_AUTOMUTE | 785 | #ifdef PMAC_SUPPORT_AUTOMUTE |
775 | /* | 786 | /* |
@@ -815,13 +826,18 @@ static void snd_pmac_awacs_update_automute(struct snd_pmac *chip, int do_notify) | |||
815 | { | 826 | { |
816 | int reg = chip->awacs_reg[1] | 827 | int reg = chip->awacs_reg[1] |
817 | | (MASK_HDMUTE | MASK_SPKMUTE); | 828 | | (MASK_HDMUTE | MASK_SPKMUTE); |
818 | if (imac) { | 829 | if (imac1) { |
830 | reg &= ~MASK_SPKMUTE; | ||
831 | reg |= MASK_PAROUT1; | ||
832 | } else if (imac2) { | ||
819 | reg &= ~MASK_SPKMUTE; | 833 | reg &= ~MASK_SPKMUTE; |
820 | reg &= ~MASK_PAROUT1; | 834 | reg &= ~MASK_PAROUT1; |
821 | } | 835 | } |
822 | if (snd_pmac_awacs_detect_headphone(chip)) | 836 | if (snd_pmac_awacs_detect_headphone(chip)) |
823 | reg &= ~MASK_HDMUTE; | 837 | reg &= ~MASK_HDMUTE; |
824 | else if (imac) | 838 | else if (imac1) |
839 | reg &= ~MASK_PAROUT1; | ||
840 | else if (imac2) | ||
825 | reg |= MASK_PAROUT1; | 841 | reg |= MASK_PAROUT1; |
826 | else | 842 | else |
827 | reg &= ~MASK_SPKMUTE; | 843 | reg &= ~MASK_SPKMUTE; |
@@ -850,9 +866,13 @@ snd_pmac_awacs_init(struct snd_pmac *chip) | |||
850 | { | 866 | { |
851 | int pm7500 = IS_PM7500; | 867 | int pm7500 = IS_PM7500; |
852 | int beige = IS_BEIGE; | 868 | int beige = IS_BEIGE; |
869 | int g4agp = IS_G4AGP; | ||
870 | int imac; | ||
853 | int err, vol; | 871 | int err, vol; |
854 | 872 | ||
855 | imac = IS_IMAC; | 873 | imac1 = IS_IMAC1; |
874 | imac2 = IS_IMAC2; | ||
875 | imac = imac1 || imac2; | ||
856 | /* looks like MASK_GAINLINE triggers something, so we set here | 876 | /* looks like MASK_GAINLINE triggers something, so we set here |
857 | * as start-up | 877 | * as start-up |
858 | */ | 878 | */ |
@@ -939,7 +959,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip) | |||
939 | snd_pmac_awacs_mixers); | 959 | snd_pmac_awacs_mixers); |
940 | if (err < 0) | 960 | if (err < 0) |
941 | return err; | 961 | return err; |
942 | if (beige) | 962 | if (beige || g4agp) |
943 | ; | 963 | ; |
944 | else if (chip->model == PMAC_SCREAMER) | 964 | else if (chip->model == PMAC_SCREAMER) |
945 | err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2), | 965 | err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2), |
@@ -961,13 +981,17 @@ snd_pmac_awacs_init(struct snd_pmac *chip) | |||
961 | err = build_mixers(chip, | 981 | err = build_mixers(chip, |
962 | ARRAY_SIZE(snd_pmac_screamer_mixers_imac), | 982 | ARRAY_SIZE(snd_pmac_screamer_mixers_imac), |
963 | snd_pmac_screamer_mixers_imac); | 983 | snd_pmac_screamer_mixers_imac); |
984 | else if (g4agp) | ||
985 | err = build_mixers(chip, | ||
986 | ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp), | ||
987 | snd_pmac_screamer_mixers_g4agp); | ||
964 | else | 988 | else |
965 | err = build_mixers(chip, | 989 | err = build_mixers(chip, |
966 | ARRAY_SIZE(snd_pmac_awacs_mixers_pmac), | 990 | ARRAY_SIZE(snd_pmac_awacs_mixers_pmac), |
967 | snd_pmac_awacs_mixers_pmac); | 991 | snd_pmac_awacs_mixers_pmac); |
968 | if (err < 0) | 992 | if (err < 0) |
969 | return err; | 993 | return err; |
970 | chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac) | 994 | chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp) |
971 | ? &snd_pmac_awacs_master_sw_imac | 995 | ? &snd_pmac_awacs_master_sw_imac |
972 | : &snd_pmac_awacs_master_sw, chip); | 996 | : &snd_pmac_awacs_master_sw, chip); |
973 | err = snd_ctl_add(chip->card, chip->master_sw_ctl); | 997 | err = snd_ctl_add(chip->card, chip->master_sw_ctl); |
@@ -1004,15 +1028,17 @@ snd_pmac_awacs_init(struct snd_pmac *chip) | |||
1004 | snd_pmac_awacs_speaker_vol); | 1028 | snd_pmac_awacs_speaker_vol); |
1005 | if (err < 0) | 1029 | if (err < 0) |
1006 | return err; | 1030 | return err; |
1007 | chip->speaker_sw_ctl = snd_ctl_new1(imac | 1031 | chip->speaker_sw_ctl = snd_ctl_new1(imac1 |
1008 | ? &snd_pmac_awacs_speaker_sw_imac | 1032 | ? &snd_pmac_awacs_speaker_sw_imac1 |
1033 | : imac2 | ||
1034 | ? &snd_pmac_awacs_speaker_sw_imac2 | ||
1009 | : &snd_pmac_awacs_speaker_sw, chip); | 1035 | : &snd_pmac_awacs_speaker_sw, chip); |
1010 | err = snd_ctl_add(chip->card, chip->speaker_sw_ctl); | 1036 | err = snd_ctl_add(chip->card, chip->speaker_sw_ctl); |
1011 | if (err < 0) | 1037 | if (err < 0) |
1012 | return err; | 1038 | return err; |
1013 | } | 1039 | } |
1014 | 1040 | ||
1015 | if (beige) | 1041 | if (beige || g4agp) |
1016 | err = build_mixers(chip, | 1042 | err = build_mixers(chip, |
1017 | ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige), | 1043 | ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige), |
1018 | snd_pmac_screamer_mic_boost_beige); | 1044 | snd_pmac_screamer_mic_boost_beige); |
diff --git a/sound/soc/at32/at32-pcm.c b/sound/soc/at32/at32-pcm.c index 435f1daf177c..c83584f989a9 100644 --- a/sound/soc/at32/at32-pcm.c +++ b/sound/soc/at32/at32-pcm.c | |||
@@ -434,7 +434,8 @@ static int at32_pcm_suspend(struct platform_device *pdev, | |||
434 | params = prtd->params; | 434 | params = prtd->params; |
435 | 435 | ||
436 | /* Disable the PDC and save the PDC registers */ | 436 | /* Disable the PDC and save the PDC registers */ |
437 | ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable); | 437 | ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR, |
438 | params->mask->pdc_disable); | ||
438 | 439 | ||
439 | prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr); | 440 | prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr); |
440 | prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr); | 441 | prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr); |
@@ -464,7 +465,7 @@ static int at32_pcm_resume(struct platform_device *pdev, | |||
464 | ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save); | 465 | ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save); |
465 | ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save); | 466 | ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save); |
466 | 467 | ||
467 | ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable); | 468 | ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR, params->mask->pdc_enable); |
468 | return 0; | 469 | return 0; |
469 | } | 470 | } |
470 | #else /* CONFIG_PM */ | 471 | #else /* CONFIG_PM */ |
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 9deb8c74fdfd..0bbd94501d7e 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
@@ -490,34 +490,7 @@ static int cs4270_mute(struct snd_soc_dai *dai, int mute) | |||
490 | 490 | ||
491 | #endif | 491 | #endif |
492 | 492 | ||
493 | static int cs4270_i2c_probe(struct i2c_adapter *adap, int addr, int kind); | 493 | static int cs4270_i2c_probe(struct i2c_client *, const struct i2c_device_id *); |
494 | |||
495 | /* | ||
496 | * Notify the driver that a new I2C bus has been found. | ||
497 | * | ||
498 | * This function is called for each I2C bus in the system. The function | ||
499 | * then asks the I2C subsystem to probe that bus at the addresses on which | ||
500 | * our device (the CS4270) could exist. If a device is found at one of | ||
501 | * those addresses, then our probe function (cs4270_i2c_probe) is called. | ||
502 | */ | ||
503 | static int cs4270_i2c_attach(struct i2c_adapter *adapter) | ||
504 | { | ||
505 | return i2c_probe(adapter, &addr_data, cs4270_i2c_probe); | ||
506 | } | ||
507 | |||
508 | static int cs4270_i2c_detach(struct i2c_client *client) | ||
509 | { | ||
510 | struct snd_soc_codec *codec = i2c_get_clientdata(client); | ||
511 | |||
512 | i2c_detach_client(client); | ||
513 | codec->control_data = NULL; | ||
514 | |||
515 | kfree(codec->reg_cache); | ||
516 | codec->reg_cache = NULL; | ||
517 | |||
518 | kfree(client); | ||
519 | return 0; | ||
520 | } | ||
521 | 494 | ||
522 | /* A list of non-DAPM controls that the CS4270 supports */ | 495 | /* A list of non-DAPM controls that the CS4270 supports */ |
523 | static const struct snd_kcontrol_new cs4270_snd_controls[] = { | 496 | static const struct snd_kcontrol_new cs4270_snd_controls[] = { |
@@ -525,14 +498,19 @@ static const struct snd_kcontrol_new cs4270_snd_controls[] = { | |||
525 | CS4270_VOLA, CS4270_VOLB, 0, 0xFF, 1) | 498 | CS4270_VOLA, CS4270_VOLB, 0, 0xFF, 1) |
526 | }; | 499 | }; |
527 | 500 | ||
501 | static const struct i2c_device_id cs4270_id[] = { | ||
502 | {"cs4270", 0}, | ||
503 | {} | ||
504 | }; | ||
505 | MODULE_DEVICE_TABLE(i2c, cs4270_id); | ||
506 | |||
528 | static struct i2c_driver cs4270_i2c_driver = { | 507 | static struct i2c_driver cs4270_i2c_driver = { |
529 | .driver = { | 508 | .driver = { |
530 | .name = "CS4270 I2C", | 509 | .name = "CS4270 I2C", |
531 | .owner = THIS_MODULE, | 510 | .owner = THIS_MODULE, |
532 | }, | 511 | }, |
533 | .id = I2C_DRIVERID_CS4270, | 512 | .id_table = cs4270_id, |
534 | .attach_adapter = cs4270_i2c_attach, | 513 | .probe = cs4270_i2c_probe, |
535 | .detach_client = cs4270_i2c_detach, | ||
536 | }; | 514 | }; |
537 | 515 | ||
538 | /* | 516 | /* |
@@ -561,11 +539,11 @@ static struct snd_soc_device *cs4270_socdev; | |||
561 | * Note: snd_soc_new_pcms() must be called before this function can be called, | 539 | * Note: snd_soc_new_pcms() must be called before this function can be called, |
562 | * because of snd_ctl_add(). | 540 | * because of snd_ctl_add(). |
563 | */ | 541 | */ |
564 | static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | 542 | static int cs4270_i2c_probe(struct i2c_client *i2c_client, |
543 | const struct i2c_device_id *id) | ||
565 | { | 544 | { |
566 | struct snd_soc_device *socdev = cs4270_socdev; | 545 | struct snd_soc_device *socdev = cs4270_socdev; |
567 | struct snd_soc_codec *codec = socdev->codec; | 546 | struct snd_soc_codec *codec = socdev->codec; |
568 | struct i2c_client *i2c_client = NULL; | ||
569 | int i; | 547 | int i; |
570 | int ret = 0; | 548 | int ret = 0; |
571 | 549 | ||
@@ -578,12 +556,6 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | |||
578 | 556 | ||
579 | /* Note: codec_dai->codec is NULL here */ | 557 | /* Note: codec_dai->codec is NULL here */ |
580 | 558 | ||
581 | i2c_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
582 | if (!i2c_client) { | ||
583 | printk(KERN_ERR "cs4270: could not allocate I2C client\n"); | ||
584 | return -ENOMEM; | ||
585 | } | ||
586 | |||
587 | codec->reg_cache = kzalloc(CS4270_NUMREGS, GFP_KERNEL); | 559 | codec->reg_cache = kzalloc(CS4270_NUMREGS, GFP_KERNEL); |
588 | if (!codec->reg_cache) { | 560 | if (!codec->reg_cache) { |
589 | printk(KERN_ERR "cs4270: could not allocate register cache\n"); | 561 | printk(KERN_ERR "cs4270: could not allocate register cache\n"); |
@@ -591,13 +563,6 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | |||
591 | goto error; | 563 | goto error; |
592 | } | 564 | } |
593 | 565 | ||
594 | i2c_set_clientdata(i2c_client, codec); | ||
595 | strcpy(i2c_client->name, "CS4270"); | ||
596 | |||
597 | i2c_client->driver = &cs4270_i2c_driver; | ||
598 | i2c_client->adapter = adapter; | ||
599 | i2c_client->addr = addr; | ||
600 | |||
601 | /* Verify that we have a CS4270 */ | 566 | /* Verify that we have a CS4270 */ |
602 | 567 | ||
603 | ret = i2c_smbus_read_byte_data(i2c_client, CS4270_CHIPID); | 568 | ret = i2c_smbus_read_byte_data(i2c_client, CS4270_CHIPID); |
@@ -612,18 +577,10 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | |||
612 | goto error; | 577 | goto error; |
613 | } | 578 | } |
614 | 579 | ||
615 | printk(KERN_INFO "cs4270: found device at I2C address %X\n", addr); | 580 | printk(KERN_INFO "cs4270: found device at I2C address %X\n", |
581 | i2c_client->addr); | ||
616 | printk(KERN_INFO "cs4270: hardware revision %X\n", ret & 0xF); | 582 | printk(KERN_INFO "cs4270: hardware revision %X\n", ret & 0xF); |
617 | 583 | ||
618 | /* Tell the I2C layer a new client has arrived */ | ||
619 | |||
620 | ret = i2c_attach_client(i2c_client); | ||
621 | if (ret) { | ||
622 | printk(KERN_ERR "cs4270: could not attach codec, " | ||
623 | "I2C address %x, error code %i\n", addr, ret); | ||
624 | goto error; | ||
625 | } | ||
626 | |||
627 | codec->control_data = i2c_client; | 584 | codec->control_data = i2c_client; |
628 | codec->read = cs4270_read_reg_cache; | 585 | codec->read = cs4270_read_reg_cache; |
629 | codec->write = cs4270_i2c_write; | 586 | codec->write = cs4270_i2c_write; |
@@ -648,20 +605,17 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | |||
648 | goto error; | 605 | goto error; |
649 | } | 606 | } |
650 | 607 | ||
608 | i2c_set_clientdata(i2c_client, codec); | ||
609 | |||
651 | return 0; | 610 | return 0; |
652 | 611 | ||
653 | error: | 612 | error: |
654 | if (codec->control_data) { | 613 | codec->control_data = NULL; |
655 | i2c_detach_client(i2c_client); | ||
656 | codec->control_data = NULL; | ||
657 | } | ||
658 | 614 | ||
659 | kfree(codec->reg_cache); | 615 | kfree(codec->reg_cache); |
660 | codec->reg_cache = NULL; | 616 | codec->reg_cache = NULL; |
661 | codec->reg_cache_size = 0; | 617 | codec->reg_cache_size = 0; |
662 | 618 | ||
663 | kfree(i2c_client); | ||
664 | |||
665 | return ret; | 619 | return ret; |
666 | } | 620 | } |
667 | 621 | ||
@@ -727,7 +681,7 @@ static int cs4270_probe(struct platform_device *pdev) | |||
727 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | 681 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); |
728 | if (ret < 0) { | 682 | if (ret < 0) { |
729 | printk(KERN_ERR "cs4270: failed to create PCMs\n"); | 683 | printk(KERN_ERR "cs4270: failed to create PCMs\n"); |
730 | return ret; | 684 | goto error_free_codec; |
731 | } | 685 | } |
732 | 686 | ||
733 | #ifdef USE_I2C | 687 | #ifdef USE_I2C |
@@ -736,8 +690,7 @@ static int cs4270_probe(struct platform_device *pdev) | |||
736 | ret = i2c_add_driver(&cs4270_i2c_driver); | 690 | ret = i2c_add_driver(&cs4270_i2c_driver); |
737 | if (ret) { | 691 | if (ret) { |
738 | printk(KERN_ERR "cs4270: failed to attach driver"); | 692 | printk(KERN_ERR "cs4270: failed to attach driver"); |
739 | snd_soc_free_pcms(socdev); | 693 | goto error_free_pcms; |
740 | return ret; | ||
741 | } | 694 | } |
742 | 695 | ||
743 | /* Did we find a CS4270 on the I2C bus? */ | 696 | /* Did we find a CS4270 on the I2C bus? */ |
@@ -759,10 +712,23 @@ static int cs4270_probe(struct platform_device *pdev) | |||
759 | ret = snd_soc_register_card(socdev); | 712 | ret = snd_soc_register_card(socdev); |
760 | if (ret < 0) { | 713 | if (ret < 0) { |
761 | printk(KERN_ERR "cs4270: failed to register card\n"); | 714 | printk(KERN_ERR "cs4270: failed to register card\n"); |
762 | snd_soc_free_pcms(socdev); | 715 | goto error_del_driver; |
763 | return ret; | ||
764 | } | 716 | } |
765 | 717 | ||
718 | return 0; | ||
719 | |||
720 | error_del_driver: | ||
721 | #ifdef USE_I2C | ||
722 | i2c_del_driver(&cs4270_i2c_driver); | ||
723 | |||
724 | error_free_pcms: | ||
725 | #endif | ||
726 | snd_soc_free_pcms(socdev); | ||
727 | |||
728 | error_free_codec: | ||
729 | kfree(socdev->codec); | ||
730 | socdev->codec = NULL; | ||
731 | |||
766 | return ret; | 732 | return ret; |
767 | } | 733 | } |
768 | 734 | ||
@@ -773,8 +739,7 @@ static int cs4270_remove(struct platform_device *pdev) | |||
773 | snd_soc_free_pcms(socdev); | 739 | snd_soc_free_pcms(socdev); |
774 | 740 | ||
775 | #ifdef USE_I2C | 741 | #ifdef USE_I2C |
776 | if (socdev->codec->control_data) | 742 | i2c_del_driver(&cs4270_i2c_driver); |
777 | i2c_del_driver(&cs4270_i2c_driver); | ||
778 | #endif | 743 | #endif |
779 | 744 | ||
780 | kfree(socdev->codec); | 745 | kfree(socdev->codec); |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 5761164fe16d..e873414840c8 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -583,7 +583,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
583 | 583 | ||
584 | /* out 4 */ | 584 | /* out 4 */ |
585 | {"Out4 Mux", "VREF", "VREF"}, | 585 | {"Out4 Mux", "VREF", "VREF"}, |
586 | {"Out4 Mux", "Capture ST", "Capture ST Mixer"}, | 586 | {"Out4 Mux", "Capture ST", "Playback Mixer"}, |
587 | {"Out4 Mux", "LOUT2", "LOUT2"}, | 587 | {"Out4 Mux", "LOUT2", "LOUT2"}, |
588 | {"Out 4", NULL, "Out4 Mux"}, | 588 | {"Out 4", NULL, "Out4 Mux"}, |
589 | {"OUT4", NULL, "Out 4"}, | 589 | {"OUT4", NULL, "Out 4"}, |
@@ -607,7 +607,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
607 | /* Capture Right Mux */ | 607 | /* Capture Right Mux */ |
608 | {"Capture Right Mux", "PGA", "Right Capture Volume"}, | 608 | {"Capture Right Mux", "PGA", "Right Capture Volume"}, |
609 | {"Capture Right Mux", "Line or RXP-RXN", "Line Right Mux"}, | 609 | {"Capture Right Mux", "Line or RXP-RXN", "Line Right Mux"}, |
610 | {"Capture Right Mux", "Sidetone", "Capture ST Mixer"}, | 610 | {"Capture Right Mux", "Sidetone", "Playback Mixer"}, |
611 | 611 | ||
612 | /* Mono Capture mixer-mux */ | 612 | /* Mono Capture mixer-mux */ |
613 | {"Capture Right Mixer", "Stereo", "Capture Right Mux"}, | 613 | {"Capture Right Mixer", "Stereo", "Capture Right Mux"}, |