1 From de5f4660856350ac43f642bb7c5adf063fc68287 Mon Sep 17 00:00:00 2001
2 From: Kurt Mahan <kmahan@freescale.com>
3 Date: Mon, 10 Dec 2007 13:15:33 -0700
4 Subject: [PATCH] Fix to allow playback at other than 44.1.
6 LTIBName: m5445x-audio-rates
7 Signed-off-by: Kurt Mahan <kmahan@freescale.com>
9 drivers/spi/ssi_audio.c | 34 ++++++++++++++++++++++++----------
10 1 files changed, 24 insertions(+), 10 deletions(-)
12 --- a/drivers/spi/ssi_audio.c
13 +++ b/drivers/spi/ssi_audio.c
15 #define SOUND_DEVICE_NAME "sound"
16 #define DRIVER_NAME "ssi_audio"
19 /* #define AUDIO_DEBUG */
22 @@ -315,24 +314,36 @@ static inline void disable_ssi(void)
25 /* Audio CODEC initialization */
26 -/* TODO: also the SSI frequency/dividers must be adjusted */
27 static void adjust_codec_speed(void) {
29 printk(DRIVER_NAME ":adjust_codec_speed: %d\n", audio_device->speed);
32 - if (audio_device->speed == 8000) {
34 + switch (audio_device->speed) {
36 + MCF_CCM_CDR = MCF_CCM_CDR_SSIDIV(255);
37 codec_write(CODEC_SAMPLE_RATE_REG,CODEC_SAMPLE_8KHZ);
38 - } else if (audio_device->speed == 16000) {
41 + MCF_CCM_CDR = MCF_CCM_CDR_SSIDIV(129);
42 codec_write(CODEC_SAMPLE_RATE_REG,CODEC_SAMPLE_16KHZ);
43 - } else if (audio_device->speed == 22000) {
47 + MCF_CCM_CDR = MCF_CCM_CDR_SSIDIV(94);
48 codec_write(CODEC_SAMPLE_RATE_REG,CODEC_SAMPLE_22KHZ);
49 - } else if (audio_device->speed == 44000 || audio_device->speed == 44100) {
53 + MCF_CCM_CDR = MCF_CCM_CDR_SSIDIV(47);
54 codec_write(CODEC_SAMPLE_RATE_REG,CODEC_SAMPLE_44KHZ);
55 - } else if (audio_device->speed == 48000) {
58 + MCF_CCM_CDR = MCF_CCM_CDR_SSIDIV(42);
59 codec_write(CODEC_SAMPLE_RATE_REG,CODEC_SAMPLE_48KHZ);
64 + MCF_CCM_CDR = MCF_CCM_CDR_SSIDIV(47);
65 codec_write(CODEC_SAMPLE_RATE_REG,CODEC_SAMPLE_44KHZ);
68 @@ -712,6 +723,9 @@ static int ssi_audio_ioctl(struct inode
69 case SNDCTL_DSP_SAMPLESIZE:
70 if (access_ok(VERIFY_READ, (void *) arg, sizeof(val))) {
71 get_user(val, (unsigned long *) arg);
73 + printk(DRIVER_NAME ":ssi_audio_ioctl: SNDCTL_DSP_SAMPLESIZE: %d\n", val);
76 ssi_audio_setsamplesize(val);