kernel: refresh 2.6.30 patches
[openwrt.git] / target / linux / coldfire / patches / 038-m5445x_audio_rates.patch
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.
5
6 LTIBName: m5445x-audio-rates
7 Signed-off-by: Kurt Mahan <kmahan@freescale.com>
8 ---
9 drivers/spi/ssi_audio.c | 34 ++++++++++++++++++++++++----------
10 1 files changed, 24 insertions(+), 10 deletions(-)
11
12 --- a/drivers/spi/ssi_audio.c
13 +++ b/drivers/spi/ssi_audio.c
14 @@ -34,7 +34,6 @@
15 #define SOUND_DEVICE_NAME "sound"
16 #define DRIVER_NAME "ssi_audio"
17
18 -
19 /* #define AUDIO_DEBUG */
20
21 #ifdef CONFIG_MMU
22 @@ -315,24 +314,36 @@ static inline void disable_ssi(void)
23 }
24
25 /* Audio CODEC initialization */
26 -/* TODO: also the SSI frequency/dividers must be adjusted */
27 static void adjust_codec_speed(void) {
28 #ifdef AUDIO_DEBUG
29 printk(DRIVER_NAME ":adjust_codec_speed: %d\n", audio_device->speed);
30 #endif
31 -
32 - if (audio_device->speed == 8000) {
33 + disable_ssi();
34 + switch (audio_device->speed) {
35 + case 8000:
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) {
39 + break;
40 + case 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) {
44 + break;
45 + case 22000:
46 + case 22050:
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) {
50 + break;
51 + case 44000:
52 + case 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) {
56 + break;
57 + case 48000:
58 + MCF_CCM_CDR = MCF_CCM_CDR_SSIDIV(42);
59 codec_write(CODEC_SAMPLE_RATE_REG,CODEC_SAMPLE_48KHZ);
60 - } else {
61 - /* default 44KHz */
62 + break;
63 + default:
64 + MCF_CCM_CDR = MCF_CCM_CDR_SSIDIV(47);
65 codec_write(CODEC_SAMPLE_RATE_REG,CODEC_SAMPLE_44KHZ);
66 }
67 }
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);
72 +#ifdef AUDIO_DEBUG
73 + printk(DRIVER_NAME ":ssi_audio_ioctl: SNDCTL_DSP_SAMPLESIZE: %d\n", val);
74 +#endif
75 ssi_audio_txdrain();
76 ssi_audio_setsamplesize(val);
77 } else {
This page took 0.044906 seconds and 5 git commands to generate.