diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 12:09:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 12:09:56 -0400 |
commit | 88e366217e8f75bd7eab64f4aa4ff9583070b0af (patch) | |
tree | efa9d084f98749a35555afd9898b92d51d3755d2 | |
parent | a1cf64944f6f2ffe5ef30a0ee4d529db771f7db2 (diff) | |
parent | 975f6b0c1b0efb66db455d2e76bacba06cc65541 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: ASoC: OMAP: Fix DSP DAI format in McBSP DAI driver
go7007 - Add missing dependency on sound subsystem
ALSA: ps3: Add support for SPDIF/HDMI passthru
ps3: Add passthru support for non-audio streams
ps3: Add ps3av_audio_mute_analog()
ALSA: misc typo fixes
sound: add missing pcm kernel-doc
-rw-r--r-- | arch/powerpc/include/asm/ps3av.h | 3 | ||||
-rw-r--r-- | drivers/ps3/ps3av.c | 16 | ||||
-rw-r--r-- | drivers/ps3/ps3av_cmd.c | 19 | ||||
-rw-r--r-- | drivers/staging/go7007/Kconfig | 2 | ||||
-rw-r--r-- | sound/core/pcm_misc.c | 1 | ||||
-rw-r--r-- | sound/drivers/dummy.c | 2 | ||||
-rw-r--r-- | sound/pci/ca0106/ca0106_main.c | 1 | ||||
-rw-r--r-- | sound/ppc/snd_ps3.c | 96 | ||||
-rw-r--r-- | sound/ppc/snd_ps3.h | 1 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 24 |
10 files changed, 144 insertions, 21 deletions
diff --git a/arch/powerpc/include/asm/ps3av.h b/arch/powerpc/include/asm/ps3av.h index fda98715cd35..5aa22cffdbd6 100644 --- a/arch/powerpc/include/asm/ps3av.h +++ b/arch/powerpc/include/asm/ps3av.h | |||
@@ -678,6 +678,8 @@ struct ps3av_pkt_avb_param { | |||
678 | u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE]; | 678 | u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE]; |
679 | }; | 679 | }; |
680 | 680 | ||
681 | /* channel status */ | ||
682 | extern u8 ps3av_mode_cs_info[]; | ||
681 | 683 | ||
682 | /** command status **/ | 684 | /** command status **/ |
683 | #define PS3AV_STATUS_SUCCESS 0x0000 /* success */ | 685 | #define PS3AV_STATUS_SUCCESS 0x0000 /* success */ |
@@ -735,6 +737,7 @@ extern int ps3av_get_mode(void); | |||
735 | extern int ps3av_video_mode2res(u32, u32 *, u32 *); | 737 | extern int ps3av_video_mode2res(u32, u32 *, u32 *); |
736 | extern int ps3av_video_mute(int); | 738 | extern int ps3av_video_mute(int); |
737 | extern int ps3av_audio_mute(int); | 739 | extern int ps3av_audio_mute(int); |
740 | extern int ps3av_audio_mute_analog(int); | ||
738 | extern int ps3av_dev_open(void); | 741 | extern int ps3av_dev_open(void); |
739 | extern int ps3av_dev_close(void); | 742 | extern int ps3av_dev_close(void); |
740 | extern void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data), | 743 | extern void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data), |
diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c index 6f2f90ebb020..06848b254d57 100644 --- a/drivers/ps3/ps3av.c +++ b/drivers/ps3/ps3av.c | |||
@@ -915,6 +915,22 @@ int ps3av_video_mute(int mute) | |||
915 | 915 | ||
916 | EXPORT_SYMBOL_GPL(ps3av_video_mute); | 916 | EXPORT_SYMBOL_GPL(ps3av_video_mute); |
917 | 917 | ||
918 | /* mute analog output only */ | ||
919 | int ps3av_audio_mute_analog(int mute) | ||
920 | { | ||
921 | int i, res; | ||
922 | |||
923 | for (i = 0; i < ps3av->av_hw_conf.num_of_avmulti; i++) { | ||
924 | res = ps3av_cmd_av_audio_mute(1, | ||
925 | &ps3av->av_port[i + ps3av->av_hw_conf.num_of_hdmi], | ||
926 | mute); | ||
927 | if (res < 0) | ||
928 | return -1; | ||
929 | } | ||
930 | return 0; | ||
931 | } | ||
932 | EXPORT_SYMBOL_GPL(ps3av_audio_mute_analog); | ||
933 | |||
918 | int ps3av_audio_mute(int mute) | 934 | int ps3av_audio_mute(int mute) |
919 | { | 935 | { |
920 | return ps3av_set_audio_mute(mute ? PS3AV_CMD_MUTE_ON | 936 | return ps3av_set_audio_mute(mute ? PS3AV_CMD_MUTE_ON |
diff --git a/drivers/ps3/ps3av_cmd.c b/drivers/ps3/ps3av_cmd.c index 7f880c26122f..11eb50318fec 100644 --- a/drivers/ps3/ps3av_cmd.c +++ b/drivers/ps3/ps3av_cmd.c | |||
@@ -660,9 +660,10 @@ u32 ps3av_cmd_set_av_audio_param(void *p, u32 port, | |||
660 | } | 660 | } |
661 | 661 | ||
662 | /* default cs val */ | 662 | /* default cs val */ |
663 | static const u8 ps3av_mode_cs_info[] = { | 663 | u8 ps3av_mode_cs_info[] = { |
664 | 0x00, 0x09, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00 | 664 | 0x00, 0x09, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00 |
665 | }; | 665 | }; |
666 | EXPORT_SYMBOL_GPL(ps3av_mode_cs_info); | ||
666 | 667 | ||
667 | #define CS_44 0x00 | 668 | #define CS_44 0x00 |
668 | #define CS_48 0x02 | 669 | #define CS_48 0x02 |
@@ -677,7 +678,7 @@ void ps3av_cmd_set_audio_mode(struct ps3av_pkt_audio_mode *audio, u32 avport, | |||
677 | u32 ch, u32 fs, u32 word_bits, u32 format, | 678 | u32 ch, u32 fs, u32 word_bits, u32 format, |
678 | u32 source) | 679 | u32 source) |
679 | { | 680 | { |
680 | int spdif_through, spdif_bitstream; | 681 | int spdif_through; |
681 | int i; | 682 | int i; |
682 | 683 | ||
683 | if (!(ch | fs | format | word_bits | source)) { | 684 | if (!(ch | fs | format | word_bits | source)) { |
@@ -687,7 +688,6 @@ void ps3av_cmd_set_audio_mode(struct ps3av_pkt_audio_mode *audio, u32 avport, | |||
687 | format = PS3AV_CMD_AUDIO_FORMAT_PCM; | 688 | format = PS3AV_CMD_AUDIO_FORMAT_PCM; |
688 | source = PS3AV_CMD_AUDIO_SOURCE_SERIAL; | 689 | source = PS3AV_CMD_AUDIO_SOURCE_SERIAL; |
689 | } | 690 | } |
690 | spdif_through = spdif_bitstream = 0; /* XXX not supported */ | ||
691 | 691 | ||
692 | /* audio mode */ | 692 | /* audio mode */ |
693 | memset(audio, 0, sizeof(*audio)); | 693 | memset(audio, 0, sizeof(*audio)); |
@@ -777,16 +777,17 @@ void ps3av_cmd_set_audio_mode(struct ps3av_pkt_audio_mode *audio, u32 avport, | |||
777 | break; | 777 | break; |
778 | } | 778 | } |
779 | 779 | ||
780 | /* non-audio bit */ | ||
781 | spdif_through = audio->audio_cs_info[0] & 0x02; | ||
782 | |||
780 | /* pass through setting */ | 783 | /* pass through setting */ |
781 | if (spdif_through && | 784 | if (spdif_through && |
782 | (avport == PS3AV_CMD_AVPORT_SPDIF_0 || | 785 | (avport == PS3AV_CMD_AVPORT_SPDIF_0 || |
783 | avport == PS3AV_CMD_AVPORT_SPDIF_1)) { | 786 | avport == PS3AV_CMD_AVPORT_SPDIF_1 || |
787 | avport == PS3AV_CMD_AVPORT_HDMI_0 || | ||
788 | avport == PS3AV_CMD_AVPORT_HDMI_1)) { | ||
784 | audio->audio_word_bits = PS3AV_CMD_AUDIO_WORD_BITS_16; | 789 | audio->audio_word_bits = PS3AV_CMD_AUDIO_WORD_BITS_16; |
785 | audio->audio_source = PS3AV_CMD_AUDIO_SOURCE_SPDIF; | 790 | audio->audio_format = PS3AV_CMD_AUDIO_FORMAT_BITSTREAM; |
786 | if (spdif_bitstream) { | ||
787 | audio->audio_format = PS3AV_CMD_AUDIO_FORMAT_BITSTREAM; | ||
788 | audio->audio_cs_info[0] |= CS_BIT; | ||
789 | } | ||
790 | } | 791 | } |
791 | } | 792 | } |
792 | 793 | ||
diff --git a/drivers/staging/go7007/Kconfig b/drivers/staging/go7007/Kconfig index 57a121c338c4..593fdb767aad 100644 --- a/drivers/staging/go7007/Kconfig +++ b/drivers/staging/go7007/Kconfig | |||
@@ -1,10 +1,12 @@ | |||
1 | config VIDEO_GO7007 | 1 | config VIDEO_GO7007 |
2 | tristate "Go 7007 support" | 2 | tristate "Go 7007 support" |
3 | depends on VIDEO_DEV && PCI && I2C && INPUT | 3 | depends on VIDEO_DEV && PCI && I2C && INPUT |
4 | depends on SND | ||
4 | select VIDEOBUF_DMA_SG | 5 | select VIDEOBUF_DMA_SG |
5 | select VIDEO_IR | 6 | select VIDEO_IR |
6 | select VIDEO_TUNER | 7 | select VIDEO_TUNER |
7 | select VIDEO_TVEEPROM | 8 | select VIDEO_TVEEPROM |
9 | select SND_PCM | ||
8 | select CRC32 | 10 | select CRC32 |
9 | default N | 11 | default N |
10 | ---help--- | 12 | ---help--- |
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c index 89b7f549bebd..ea2bf82c9373 100644 --- a/sound/core/pcm_misc.c +++ b/sound/core/pcm_misc.c | |||
@@ -319,6 +319,7 @@ EXPORT_SYMBOL(snd_pcm_format_physical_width); | |||
319 | /** | 319 | /** |
320 | * snd_pcm_format_size - return the byte size of samples on the given format | 320 | * snd_pcm_format_size - return the byte size of samples on the given format |
321 | * @format: the format to check | 321 | * @format: the format to check |
322 | * @samples: sampling rate | ||
322 | * | 323 | * |
323 | * Returns the byte size of the given samples for the format, or a | 324 | * Returns the byte size of the given samples for the format, or a |
324 | * negative error code if unknown format. | 325 | * negative error code if unknown format. |
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index e5e749f3e0ef..73be7e14a603 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c | |||
@@ -51,7 +51,7 @@ static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime) | |||
51 | if (err < 0) | 51 | if (err < 0) |
52 | return err; | 52 | return err; |
53 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX); | 53 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX); |
54 | if (err) < 0) | 54 | if (err < 0) |
55 | return err; | 55 | return err; |
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index a7d89662acf6..88fbf285d2b7 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -759,7 +759,6 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream) | |||
759 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | | 759 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | |
760 | SPCS_GENERATIONSTATUS | 0x00001200 | | 760 | SPCS_GENERATIONSTATUS | 0x00001200 | |
761 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT ); | 761 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT ); |
762 | } | ||
763 | #endif | 762 | #endif |
764 | 763 | ||
765 | return 0; | 764 | return 0; |
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index 20d0e328288a..8f9e3859c37c 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c | |||
@@ -666,6 +666,7 @@ static int snd_ps3_init_avsetting(struct snd_ps3_card_info *card) | |||
666 | card->avs.avs_audio_width = PS3AV_CMD_AUDIO_WORD_BITS_16; | 666 | card->avs.avs_audio_width = PS3AV_CMD_AUDIO_WORD_BITS_16; |
667 | card->avs.avs_audio_format = PS3AV_CMD_AUDIO_FORMAT_PCM; | 667 | card->avs.avs_audio_format = PS3AV_CMD_AUDIO_FORMAT_PCM; |
668 | card->avs.avs_audio_source = PS3AV_CMD_AUDIO_SOURCE_SERIAL; | 668 | card->avs.avs_audio_source = PS3AV_CMD_AUDIO_SOURCE_SERIAL; |
669 | memcpy(card->avs.avs_cs_info, ps3av_mode_cs_info, 8); | ||
669 | 670 | ||
670 | ret = snd_ps3_change_avsetting(card); | 671 | ret = snd_ps3_change_avsetting(card); |
671 | 672 | ||
@@ -685,6 +686,7 @@ static int snd_ps3_set_avsetting(struct snd_pcm_substream *substream) | |||
685 | { | 686 | { |
686 | struct snd_ps3_card_info *card = snd_pcm_substream_chip(substream); | 687 | struct snd_ps3_card_info *card = snd_pcm_substream_chip(substream); |
687 | struct snd_ps3_avsetting_info avs; | 688 | struct snd_ps3_avsetting_info avs; |
689 | int ret; | ||
688 | 690 | ||
689 | avs = card->avs; | 691 | avs = card->avs; |
690 | 692 | ||
@@ -729,19 +731,92 @@ static int snd_ps3_set_avsetting(struct snd_pcm_substream *substream) | |||
729 | return 1; | 731 | return 1; |
730 | } | 732 | } |
731 | 733 | ||
732 | if ((card->avs.avs_audio_width != avs.avs_audio_width) || | 734 | memcpy(avs.avs_cs_info, ps3av_mode_cs_info, 8); |
733 | (card->avs.avs_audio_rate != avs.avs_audio_rate)) { | ||
734 | card->avs = avs; | ||
735 | snd_ps3_change_avsetting(card); | ||
736 | 735 | ||
736 | if (memcmp(&card->avs, &avs, sizeof(avs))) { | ||
737 | pr_debug("%s: after freq=%d width=%d\n", __func__, | 737 | pr_debug("%s: after freq=%d width=%d\n", __func__, |
738 | card->avs.avs_audio_rate, card->avs.avs_audio_width); | 738 | card->avs.avs_audio_rate, card->avs.avs_audio_width); |
739 | 739 | ||
740 | return 0; | 740 | card->avs = avs; |
741 | snd_ps3_change_avsetting(card); | ||
742 | ret = 0; | ||
741 | } else | 743 | } else |
744 | ret = 1; | ||
745 | |||
746 | /* check CS non-audio bit and mute accordingly */ | ||
747 | if (avs.avs_cs_info[0] & 0x02) | ||
748 | ps3av_audio_mute_analog(1); /* mute if non-audio */ | ||
749 | else | ||
750 | ps3av_audio_mute_analog(0); | ||
751 | |||
752 | return ret; | ||
753 | } | ||
754 | |||
755 | /* | ||
756 | * SPDIF status bits controls | ||
757 | */ | ||
758 | static int snd_ps3_spdif_mask_info(struct snd_kcontrol *kcontrol, | ||
759 | struct snd_ctl_elem_info *uinfo) | ||
760 | { | ||
761 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | ||
762 | uinfo->count = 1; | ||
763 | return 0; | ||
764 | } | ||
765 | |||
766 | /* FIXME: ps3av_set_audio_mode() assumes only consumer mode */ | ||
767 | static int snd_ps3_spdif_cmask_get(struct snd_kcontrol *kcontrol, | ||
768 | struct snd_ctl_elem_value *ucontrol) | ||
769 | { | ||
770 | memset(ucontrol->value.iec958.status, 0xff, 8); | ||
771 | return 0; | ||
772 | } | ||
773 | |||
774 | static int snd_ps3_spdif_pmask_get(struct snd_kcontrol *kcontrol, | ||
775 | struct snd_ctl_elem_value *ucontrol) | ||
776 | { | ||
777 | return 0; | ||
778 | } | ||
779 | |||
780 | static int snd_ps3_spdif_default_get(struct snd_kcontrol *kcontrol, | ||
781 | struct snd_ctl_elem_value *ucontrol) | ||
782 | { | ||
783 | memcpy(ucontrol->value.iec958.status, ps3av_mode_cs_info, 8); | ||
784 | return 0; | ||
785 | } | ||
786 | |||
787 | static int snd_ps3_spdif_default_put(struct snd_kcontrol *kcontrol, | ||
788 | struct snd_ctl_elem_value *ucontrol) | ||
789 | { | ||
790 | if (memcmp(ps3av_mode_cs_info, ucontrol->value.iec958.status, 8)) { | ||
791 | memcpy(ps3av_mode_cs_info, ucontrol->value.iec958.status, 8); | ||
742 | return 1; | 792 | return 1; |
793 | } | ||
794 | return 0; | ||
743 | } | 795 | } |
744 | 796 | ||
797 | static struct snd_kcontrol_new spdif_ctls[] = { | ||
798 | { | ||
799 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | ||
800 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
801 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | ||
802 | .info = snd_ps3_spdif_mask_info, | ||
803 | .get = snd_ps3_spdif_cmask_get, | ||
804 | }, | ||
805 | { | ||
806 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | ||
807 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
808 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | ||
809 | .info = snd_ps3_spdif_mask_info, | ||
810 | .get = snd_ps3_spdif_pmask_get, | ||
811 | }, | ||
812 | { | ||
813 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
814 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | ||
815 | .info = snd_ps3_spdif_mask_info, | ||
816 | .get = snd_ps3_spdif_default_get, | ||
817 | .put = snd_ps3_spdif_default_put, | ||
818 | }, | ||
819 | }; | ||
745 | 820 | ||
746 | 821 | ||
747 | static int snd_ps3_map_mmio(void) | 822 | static int snd_ps3_map_mmio(void) |
@@ -842,7 +917,7 @@ static void snd_ps3_audio_set_base_addr(uint64_t ioaddr_start) | |||
842 | 917 | ||
843 | static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) | 918 | static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) |
844 | { | 919 | { |
845 | int ret; | 920 | int i, ret; |
846 | u64 lpar_addr, lpar_size; | 921 | u64 lpar_addr, lpar_size; |
847 | 922 | ||
848 | BUG_ON(!firmware_has_feature(FW_FEATURE_PS3_LV1)); | 923 | BUG_ON(!firmware_has_feature(FW_FEATURE_PS3_LV1)); |
@@ -903,6 +978,15 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) | |||
903 | strcpy(the_card.card->driver, "PS3"); | 978 | strcpy(the_card.card->driver, "PS3"); |
904 | strcpy(the_card.card->shortname, "PS3"); | 979 | strcpy(the_card.card->shortname, "PS3"); |
905 | strcpy(the_card.card->longname, "PS3 sound"); | 980 | strcpy(the_card.card->longname, "PS3 sound"); |
981 | |||
982 | /* create control elements */ | ||
983 | for (i = 0; i < ARRAY_SIZE(spdif_ctls); i++) { | ||
984 | ret = snd_ctl_add(the_card.card, | ||
985 | snd_ctl_new1(&spdif_ctls[i], &the_card)); | ||
986 | if (ret < 0) | ||
987 | goto clean_card; | ||
988 | } | ||
989 | |||
906 | /* create PCM devices instance */ | 990 | /* create PCM devices instance */ |
907 | /* NOTE:this driver works assuming pcm:substream = 1:1 */ | 991 | /* NOTE:this driver works assuming pcm:substream = 1:1 */ |
908 | ret = snd_pcm_new(the_card.card, | 992 | ret = snd_pcm_new(the_card.card, |
diff --git a/sound/ppc/snd_ps3.h b/sound/ppc/snd_ps3.h index 4b7e6fbbe500..326fb29e82d8 100644 --- a/sound/ppc/snd_ps3.h +++ b/sound/ppc/snd_ps3.h | |||
@@ -51,6 +51,7 @@ struct snd_ps3_avsetting_info { | |||
51 | uint32_t avs_audio_width; | 51 | uint32_t avs_audio_width; |
52 | uint32_t avs_audio_format; /* fixed */ | 52 | uint32_t avs_audio_format; /* fixed */ |
53 | uint32_t avs_audio_source; /* fixed */ | 53 | uint32_t avs_audio_source; /* fixed */ |
54 | unsigned char avs_cs_info[8]; | ||
54 | }; | 55 | }; |
55 | /* | 56 | /* |
56 | * PS3 audio 'card' instance | 57 | * PS3 audio 'card' instance |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 0a063a98a661..853b33ae3435 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -43,6 +43,7 @@ | |||
43 | struct omap_mcbsp_data { | 43 | struct omap_mcbsp_data { |
44 | unsigned int bus_id; | 44 | unsigned int bus_id; |
45 | struct omap_mcbsp_reg_cfg regs; | 45 | struct omap_mcbsp_reg_cfg regs; |
46 | unsigned int fmt; | ||
46 | /* | 47 | /* |
47 | * Flags indicating is the bus already activated and configured by | 48 | * Flags indicating is the bus already activated and configured by |
48 | * another substream | 49 | * another substream |
@@ -200,6 +201,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
200 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 201 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); |
201 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 202 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
202 | int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; | 203 | int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; |
204 | int wlen; | ||
203 | unsigned long port; | 205 | unsigned long port; |
204 | 206 | ||
205 | if (cpu_class_is_omap1()) { | 207 | if (cpu_class_is_omap1()) { |
@@ -244,19 +246,29 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
244 | switch (params_format(params)) { | 246 | switch (params_format(params)) { |
245 | case SNDRV_PCM_FORMAT_S16_LE: | 247 | case SNDRV_PCM_FORMAT_S16_LE: |
246 | /* Set word lengths */ | 248 | /* Set word lengths */ |
249 | wlen = 16; | ||
247 | regs->rcr2 |= RWDLEN2(OMAP_MCBSP_WORD_16); | 250 | regs->rcr2 |= RWDLEN2(OMAP_MCBSP_WORD_16); |
248 | regs->rcr1 |= RWDLEN1(OMAP_MCBSP_WORD_16); | 251 | regs->rcr1 |= RWDLEN1(OMAP_MCBSP_WORD_16); |
249 | regs->xcr2 |= XWDLEN2(OMAP_MCBSP_WORD_16); | 252 | regs->xcr2 |= XWDLEN2(OMAP_MCBSP_WORD_16); |
250 | regs->xcr1 |= XWDLEN1(OMAP_MCBSP_WORD_16); | 253 | regs->xcr1 |= XWDLEN1(OMAP_MCBSP_WORD_16); |
251 | /* Set FS period and length in terms of bit clock periods */ | ||
252 | regs->srgr2 |= FPER(16 * 2 - 1); | ||
253 | regs->srgr1 |= FWID(16 - 1); | ||
254 | break; | 254 | break; |
255 | default: | 255 | default: |
256 | /* Unsupported PCM format */ | 256 | /* Unsupported PCM format */ |
257 | return -EINVAL; | 257 | return -EINVAL; |
258 | } | 258 | } |
259 | 259 | ||
260 | /* Set FS period and length in terms of bit clock periods */ | ||
261 | switch (mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | ||
262 | case SND_SOC_DAIFMT_I2S: | ||
263 | regs->srgr2 |= FPER(wlen * 2 - 1); | ||
264 | regs->srgr1 |= FWID(wlen - 1); | ||
265 | break; | ||
266 | case SND_SOC_DAIFMT_DSP_A: | ||
267 | regs->srgr2 |= FPER(wlen * 2 - 1); | ||
268 | regs->srgr1 |= FWID(0); | ||
269 | break; | ||
270 | } | ||
271 | |||
260 | omap_mcbsp_config(bus_id, &mcbsp_data->regs); | 272 | omap_mcbsp_config(bus_id, &mcbsp_data->regs); |
261 | mcbsp_data->configured = 1; | 273 | mcbsp_data->configured = 1; |
262 | 274 | ||
@@ -272,10 +284,12 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
272 | { | 284 | { |
273 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 285 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); |
274 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 286 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
287 | unsigned int temp_fmt = fmt; | ||
275 | 288 | ||
276 | if (mcbsp_data->configured) | 289 | if (mcbsp_data->configured) |
277 | return 0; | 290 | return 0; |
278 | 291 | ||
292 | mcbsp_data->fmt = fmt; | ||
279 | memset(regs, 0, sizeof(*regs)); | 293 | memset(regs, 0, sizeof(*regs)); |
280 | /* Generic McBSP register settings */ | 294 | /* Generic McBSP register settings */ |
281 | regs->spcr2 |= XINTM(3) | FREE; | 295 | regs->spcr2 |= XINTM(3) | FREE; |
@@ -293,6 +307,8 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
293 | /* 0-bit data delay */ | 307 | /* 0-bit data delay */ |
294 | regs->rcr2 |= RDATDLY(0); | 308 | regs->rcr2 |= RDATDLY(0); |
295 | regs->xcr2 |= XDATDLY(0); | 309 | regs->xcr2 |= XDATDLY(0); |
310 | /* Invert bit clock and FS polarity configuration for DSP_A */ | ||
311 | temp_fmt ^= SND_SOC_DAIFMT_IB_IF; | ||
296 | break; | 312 | break; |
297 | default: | 313 | default: |
298 | /* Unsupported data format */ | 314 | /* Unsupported data format */ |
@@ -316,7 +332,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
316 | } | 332 | } |
317 | 333 | ||
318 | /* Set bit clock (CLKX/CLKR) and FS polarities */ | 334 | /* Set bit clock (CLKX/CLKR) and FS polarities */ |
319 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 335 | switch (temp_fmt & SND_SOC_DAIFMT_INV_MASK) { |
320 | case SND_SOC_DAIFMT_NB_NF: | 336 | case SND_SOC_DAIFMT_NB_NF: |
321 | /* | 337 | /* |
322 | * Normal BCLK + FS. | 338 | * Normal BCLK + FS. |