diff options
Diffstat (limited to 'sound/oss/sh_dac_audio.c')
-rw-r--r-- | sound/oss/sh_dac_audio.c | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index 7b168d85f4ab..83ff8a71f716 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c | |||
@@ -1,3 +1,14 @@ | |||
1 | /* | ||
2 | * sound/oss/sh_dac_audio.c | ||
3 | * | ||
4 | * SH DAC based sound :( | ||
5 | * | ||
6 | * Copyright (C) 2004,2005 Andriy Skulysh | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
1 | #include <linux/module.h> | 12 | #include <linux/module.h> |
2 | #include <linux/init.h> | 13 | #include <linux/init.h> |
3 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
@@ -6,18 +17,17 @@ | |||
6 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
7 | #include <linux/sound.h> | 18 | #include <linux/sound.h> |
8 | #include <linux/soundcard.h> | 19 | #include <linux/soundcard.h> |
20 | #include <linux/interrupt.h> | ||
9 | #include <asm/io.h> | 21 | #include <asm/io.h> |
10 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
11 | #include <asm/irq.h> | 23 | #include <asm/irq.h> |
12 | #include <asm/delay.h> | 24 | #include <asm/delay.h> |
13 | #include <linux/interrupt.h> | 25 | #include <asm/clock.h> |
14 | |||
15 | #include <asm/cpu/dac.h> | 26 | #include <asm/cpu/dac.h> |
16 | 27 | #include <asm/cpu/timer.h> | |
17 | #ifdef MACH_HP600 | 28 | #include <asm/machvec.h> |
18 | #include <asm/hp6xx/hp6xx.h> | 29 | #include <asm/hp6xx/hp6xx.h> |
19 | #include <asm/hd64461/hd64461.h> | 30 | #include <asm/hd64461.h> |
20 | #endif | ||
21 | 31 | ||
22 | #define MODNAME "sh_dac_audio" | 32 | #define MODNAME "sh_dac_audio" |
23 | 33 | ||
@@ -26,11 +36,6 @@ | |||
26 | #define TMU1_TCR_INIT 0x0020 /* Clock/4, rising edge; interrupt on */ | 36 | #define TMU1_TCR_INIT 0x0020 /* Clock/4, rising edge; interrupt on */ |
27 | #define TMU1_TSTR_INIT 0x02 /* Bit to turn on TMU1 */ | 37 | #define TMU1_TSTR_INIT 0x02 /* Bit to turn on TMU1 */ |
28 | 38 | ||
29 | #define TMU_TSTR 0xfffffe92 | ||
30 | #define TMU1_TCOR 0xfffffea0 | ||
31 | #define TMU1_TCNT 0xfffffea4 | ||
32 | #define TMU1_TCR 0xfffffea8 | ||
33 | |||
34 | #define BUFFER_SIZE 48000 | 39 | #define BUFFER_SIZE 48000 |
35 | 40 | ||
36 | static int rate; | 41 | static int rate; |
@@ -71,34 +76,37 @@ static void dac_audio_sync(void) | |||
71 | 76 | ||
72 | static void dac_audio_start(void) | 77 | static void dac_audio_start(void) |
73 | { | 78 | { |
74 | #ifdef MACH_HP600 | 79 | if (mach_is_hp6xx()) { |
75 | u16 v; | 80 | u16 v = inw(HD64461_GPADR); |
76 | v = inw(HD64461_GPADR); | 81 | v &= ~HD64461_GPADR_SPEAKER; |
77 | v &= ~HD64461_GPADR_SPEAKER; | 82 | outw(v, HD64461_GPADR); |
78 | outw(v, HD64461_GPADR); | 83 | } |
79 | #endif | 84 | |
80 | sh_dac_enable(CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); | 85 | sh_dac_enable(CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); |
81 | ctrl_outw(TMU1_TCR_INIT, TMU1_TCR); | 86 | ctrl_outw(TMU1_TCR_INIT, TMU1_TCR); |
82 | } | 87 | } |
83 | static void dac_audio_stop(void) | 88 | static void dac_audio_stop(void) |
84 | { | 89 | { |
85 | #ifdef MACH_HP600 | ||
86 | u16 v; | ||
87 | #endif | ||
88 | dac_audio_stop_timer(); | 90 | dac_audio_stop_timer(); |
89 | #ifdef MACH_HP600 | 91 | |
90 | v = inw(HD64461_GPADR); | 92 | if (mach_is_hp6xx()) { |
91 | v |= HD64461_GPADR_SPEAKER; | 93 | u16 v = inw(HD64461_GPADR); |
92 | outw(v, HD64461_GPADR); | 94 | v |= HD64461_GPADR_SPEAKER; |
93 | #endif | 95 | outw(v, HD64461_GPADR); |
96 | } | ||
97 | |||
98 | sh_dac_output(0, CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); | ||
94 | sh_dac_disable(CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); | 99 | sh_dac_disable(CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); |
95 | } | 100 | } |
96 | 101 | ||
97 | static void dac_audio_set_rate(void) | 102 | static void dac_audio_set_rate(void) |
98 | { | 103 | { |
99 | unsigned long interval; | 104 | unsigned long interval; |
105 | struct clk *clk; | ||
100 | 106 | ||
101 | interval = (current_cpu_data.module_clock / 4) / rate; | 107 | clk = clk_get("module_clk"); |
108 | interval = (clk_get_rate(clk) / 4) / rate; | ||
109 | clk_put(clk); | ||
102 | ctrl_outl(interval, TMU1_TCOR); | 110 | ctrl_outl(interval, TMU1_TCOR); |
103 | ctrl_outl(interval, TMU1_TCNT); | 111 | ctrl_outl(interval, TMU1_TCNT); |
104 | } | 112 | } |