diff options
author | Tony Lindgren <tony@atomide.com> | 2006-04-02 12:46:27 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-04-02 12:46:27 -0400 |
commit | 120db2cba8e40c562e5a4aea44ede2f360a5de75 (patch) | |
tree | f08247e64219571b634faf5a809e8505fb0292f2 /include | |
parent | 0dc5e77c46c6b02e8286f17544d93d614c0cb892 (diff) |
[ARM] 3455/1: ARM: OMAP: 7/8 Misc updates, take 2
Patch from Tony Lindgren
Update misc OMAP core code from linux-omap tree:
- McBSP updates by Samuel Ortiz, Andrzej Zaborowski
- Whitespace cleanups by Ladislav Michl
- Other fixes by various linux-omap developers
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-arm/arch-omap/aic23.h | 4 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/dsp.h | 6 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/dsp_common.h | 13 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/gpioexpander.h | 24 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/irda.h | 36 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/irqs.h | 5 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/keypad.h | 36 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/mcbsp.h | 65 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/mcspi.h | 16 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/menelaus.h | 2 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/omap-alsa.h | 124 |
11 files changed, 324 insertions, 7 deletions
diff --git a/include/asm-arm/arch-omap/aic23.h b/include/asm-arm/arch-omap/aic23.h index 590bac25b7c4..6513065941d0 100644 --- a/include/asm-arm/arch-omap/aic23.h +++ b/include/asm-arm/arch-omap/aic23.h | |||
@@ -57,6 +57,7 @@ | |||
57 | #define LHV_MIN 0x0000 | 57 | #define LHV_MIN 0x0000 |
58 | 58 | ||
59 | // Analog audio path control register | 59 | // Analog audio path control register |
60 | #define STA_REG(x) ((x)<<6) | ||
60 | #define STE_ENABLED 0x0020 | 61 | #define STE_ENABLED 0x0020 |
61 | #define DAC_SELECTED 0x0010 | 62 | #define DAC_SELECTED 0x0010 |
62 | #define BYPASS_ON 0x0008 | 63 | #define BYPASS_ON 0x0008 |
@@ -109,4 +110,7 @@ | |||
109 | #define TLV320AIC23ID1 (0x1a) // cs low | 110 | #define TLV320AIC23ID1 (0x1a) // cs low |
110 | #define TLV320AIC23ID2 (0x1b) // cs high | 111 | #define TLV320AIC23ID2 (0x1b) // cs high |
111 | 112 | ||
113 | void tlv320aic23_power_up(void); | ||
114 | void tlv320aic23_power_down(void); | ||
115 | |||
112 | #endif /* __ASM_ARCH_AIC23_H */ | 116 | #endif /* __ASM_ARCH_AIC23_H */ |
diff --git a/include/asm-arm/arch-omap/dsp.h b/include/asm-arm/arch-omap/dsp.h index 57bf4f39ca58..06dad83dd41f 100644 --- a/include/asm-arm/arch-omap/dsp.h +++ b/include/asm-arm/arch-omap/dsp.h | |||
@@ -181,10 +181,16 @@ struct omap_dsp_varinfo { | |||
181 | #define OMAP_DSP_MBCMD_PM_ENABLE 0x01 | 181 | #define OMAP_DSP_MBCMD_PM_ENABLE 0x01 |
182 | 182 | ||
183 | #define OMAP_DSP_MBCMD_KFUNC_FBCTL 0x00 | 183 | #define OMAP_DSP_MBCMD_KFUNC_FBCTL 0x00 |
184 | #define OMAP_DSP_MBCMD_KFUNC_AUDIO_PWR 0x01 | ||
184 | 185 | ||
186 | #define OMAP_DSP_MBCMD_FBCTL_UPD 0x0000 | ||
185 | #define OMAP_DSP_MBCMD_FBCTL_ENABLE 0x0002 | 187 | #define OMAP_DSP_MBCMD_FBCTL_ENABLE 0x0002 |
186 | #define OMAP_DSP_MBCMD_FBCTL_DISABLE 0x0003 | 188 | #define OMAP_DSP_MBCMD_FBCTL_DISABLE 0x0003 |
187 | 189 | ||
190 | #define OMAP_DSP_MBCMD_AUDIO_PWR_UP 0x0000 | ||
191 | #define OMAP_DSP_MBCMD_AUDIO_PWR_DOWN1 0x0001 | ||
192 | #define OMAP_DSP_MBCMD_AUDIO_PWR_DOWN2 0x0002 | ||
193 | |||
188 | #define OMAP_DSP_MBCMD_TDEL_SAFE 0x0000 | 194 | #define OMAP_DSP_MBCMD_TDEL_SAFE 0x0000 |
189 | #define OMAP_DSP_MBCMD_TDEL_KILL 0x0001 | 195 | #define OMAP_DSP_MBCMD_TDEL_KILL 0x0001 |
190 | 196 | ||
diff --git a/include/asm-arm/arch-omap/dsp_common.h b/include/asm-arm/arch-omap/dsp_common.h index 4fcce6944056..16a459dfa714 100644 --- a/include/asm-arm/arch-omap/dsp_common.h +++ b/include/asm-arm/arch-omap/dsp_common.h | |||
@@ -27,11 +27,12 @@ | |||
27 | #ifndef ASM_ARCH_DSP_COMMON_H | 27 | #ifndef ASM_ARCH_DSP_COMMON_H |
28 | #define ASM_ARCH_DSP_COMMON_H | 28 | #define ASM_ARCH_DSP_COMMON_H |
29 | 29 | ||
30 | void omap_dsp_pm_suspend(void); | 30 | extern void omap_dsp_request_mpui(void); |
31 | void omap_dsp_pm_resume(void); | 31 | extern void omap_dsp_release_mpui(void); |
32 | void omap_dsp_request_mpui(void); | 32 | extern int omap_dsp_request_mem(void); |
33 | void omap_dsp_release_mpui(void); | 33 | extern int omap_dsp_release_mem(void); |
34 | int omap_dsp_request_mem(void); | 34 | |
35 | int omap_dsp_release_mem(void); | 35 | extern void (*omap_dsp_audio_pwr_up_request)(int stage); |
36 | extern void (*omap_dsp_audio_pwr_down_request)(int stage); | ||
36 | 37 | ||
37 | #endif /* ASM_ARCH_DSP_COMMON_H */ | 38 | #endif /* ASM_ARCH_DSP_COMMON_H */ |
diff --git a/include/asm-arm/arch-omap/gpioexpander.h b/include/asm-arm/arch-omap/gpioexpander.h new file mode 100644 index 000000000000..7a43b0a912e4 --- /dev/null +++ b/include/asm-arm/arch-omap/gpioexpander.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-omap/gpioexpander.h | ||
3 | * | ||
4 | * | ||
5 | * Copyright (C) 2004 Texas Instruments, Inc. | ||
6 | * | ||
7 | * This package is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | ||
12 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
13 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
14 | */ | ||
15 | |||
16 | #ifndef __ASM_ARCH_OMAP_GPIOEXPANDER_H | ||
17 | #define __ASM_ARCH_OMAP_GPIOEXPANDER_H | ||
18 | |||
19 | /* Function Prototypes for GPIO Expander functions */ | ||
20 | |||
21 | int read_gpio_expa(u8 *, int); | ||
22 | int write_gpio_expa(u8 , int); | ||
23 | |||
24 | #endif /* __ASM_ARCH_OMAP_GPIOEXPANDER_H */ | ||
diff --git a/include/asm-arm/arch-omap/irda.h b/include/asm-arm/arch-omap/irda.h new file mode 100644 index 000000000000..805ae3575e44 --- /dev/null +++ b/include/asm-arm/arch-omap/irda.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-omap/irda.h | ||
3 | * | ||
4 | * Copyright (C) 2005-2006 Komal Shah <komal_shah802003@yahoo.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef ASMARM_ARCH_IRDA_H | ||
11 | #define ASMARM_ARCH_IRDA_H | ||
12 | |||
13 | /* board specific transceiver capabilities */ | ||
14 | |||
15 | #define IR_SEL 1 /* Selects IrDA */ | ||
16 | #define IR_SIRMODE 2 | ||
17 | #define IR_FIRMODE 4 | ||
18 | #define IR_MIRMODE 8 | ||
19 | |||
20 | struct omap_irda_config { | ||
21 | int transceiver_cap; | ||
22 | int (*transceiver_mode)(struct device *dev, int mode); | ||
23 | int (*select_irda)(struct device *dev, int state); | ||
24 | /* Very specific to the needs of some platforms (h3,h4) | ||
25 | * having calls which can sleep in irda_set_speed. | ||
26 | */ | ||
27 | struct work_struct gpio_expa; | ||
28 | int rx_channel; | ||
29 | int tx_channel; | ||
30 | unsigned long dest_start; | ||
31 | unsigned long src_start; | ||
32 | int tx_trigger; | ||
33 | int rx_trigger; | ||
34 | }; | ||
35 | |||
36 | #endif | ||
diff --git a/include/asm-arm/arch-omap/irqs.h b/include/asm-arm/arch-omap/irqs.h index 4ffce1d77759..42098d99f302 100644 --- a/include/asm-arm/arch-omap/irqs.h +++ b/include/asm-arm/arch-omap/irqs.h | |||
@@ -242,6 +242,11 @@ | |||
242 | #define INT_24XX_GPIO_BANK2 30 | 242 | #define INT_24XX_GPIO_BANK2 30 |
243 | #define INT_24XX_GPIO_BANK3 31 | 243 | #define INT_24XX_GPIO_BANK3 31 |
244 | #define INT_24XX_GPIO_BANK4 32 | 244 | #define INT_24XX_GPIO_BANK4 32 |
245 | #define INT_24XX_MCBSP1_IRQ_TX 59 | ||
246 | #define INT_24XX_MCBSP1_IRQ_RX 60 | ||
247 | #define INT_24XX_MCBSP2_IRQ_TX 62 | ||
248 | #define INT_24XX_MCBSP2_IRQ_RX 63 | ||
249 | #define INT_24XX_UART3_IRQ 74 | ||
245 | 250 | ||
246 | /* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and | 251 | /* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and |
247 | * 16 MPUIO lines */ | 252 | * 16 MPUIO lines */ |
diff --git a/include/asm-arm/arch-omap/keypad.h b/include/asm-arm/arch-omap/keypad.h new file mode 100644 index 000000000000..8a023a984acb --- /dev/null +++ b/include/asm-arm/arch-omap/keypad.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-omap/keypad.h | ||
3 | * | ||
4 | * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef ASMARM_ARCH_KEYPAD_H | ||
11 | #define ASMARM_ARCH_KEYPAD_H | ||
12 | |||
13 | struct omap_kp_platform_data { | ||
14 | int rows; | ||
15 | int cols; | ||
16 | int *keymap; | ||
17 | unsigned int rep:1; | ||
18 | /* specific to OMAP242x*/ | ||
19 | unsigned int *row_gpios; | ||
20 | unsigned int *col_gpios; | ||
21 | }; | ||
22 | |||
23 | /* Group (0..3) -- when multiple keys are pressed, only the | ||
24 | * keys pressed in the same group are considered as pressed. This is | ||
25 | * in order to workaround certain crappy HW designs that produce ghost | ||
26 | * keypresses. */ | ||
27 | #define GROUP_0 (0 << 16) | ||
28 | #define GROUP_1 (1 << 16) | ||
29 | #define GROUP_2 (2 << 16) | ||
30 | #define GROUP_3 (3 << 16) | ||
31 | #define GROUP_MASK GROUP_3 | ||
32 | |||
33 | #define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val)) | ||
34 | |||
35 | #endif | ||
36 | |||
diff --git a/include/asm-arm/arch-omap/mcbsp.h b/include/asm-arm/arch-omap/mcbsp.h index e79d98ab2ab6..ed0dde4f7219 100644 --- a/include/asm-arm/arch-omap/mcbsp.h +++ b/include/asm-arm/arch-omap/mcbsp.h | |||
@@ -37,6 +37,11 @@ | |||
37 | #define OMAP1610_MCBSP2_BASE 0xfffb1000 | 37 | #define OMAP1610_MCBSP2_BASE 0xfffb1000 |
38 | #define OMAP1610_MCBSP3_BASE 0xe1017000 | 38 | #define OMAP1610_MCBSP3_BASE 0xe1017000 |
39 | 39 | ||
40 | #define OMAP24XX_MCBSP1_BASE 0x48074000 | ||
41 | #define OMAP24XX_MCBSP2_BASE 0x48076000 | ||
42 | |||
43 | #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730) | ||
44 | |||
40 | #define OMAP_MCBSP_REG_DRR2 0x00 | 45 | #define OMAP_MCBSP_REG_DRR2 0x00 |
41 | #define OMAP_MCBSP_REG_DRR1 0x02 | 46 | #define OMAP_MCBSP_REG_DRR1 0x02 |
42 | #define OMAP_MCBSP_REG_DXR2 0x04 | 47 | #define OMAP_MCBSP_REG_DXR2 0x04 |
@@ -71,9 +76,62 @@ | |||
71 | 76 | ||
72 | #define OMAP_MAX_MCBSP_COUNT 3 | 77 | #define OMAP_MAX_MCBSP_COUNT 3 |
73 | 78 | ||
79 | #define AUDIO_MCBSP_DATAWRITE (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DXR1) | ||
80 | #define AUDIO_MCBSP_DATAREAD (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DRR1) | ||
81 | |||
82 | #define AUDIO_MCBSP OMAP_MCBSP1 | ||
83 | #define AUDIO_DMA_TX OMAP_DMA_MCBSP1_TX | ||
84 | #define AUDIO_DMA_RX OMAP_DMA_MCBSP1_RX | ||
85 | |||
86 | #elif defined(CONFIG_ARCH_OMAP24XX) | ||
87 | |||
88 | #define OMAP_MCBSP_REG_DRR2 0x00 | ||
89 | #define OMAP_MCBSP_REG_DRR1 0x04 | ||
90 | #define OMAP_MCBSP_REG_DXR2 0x08 | ||
91 | #define OMAP_MCBSP_REG_DXR1 0x0C | ||
92 | #define OMAP_MCBSP_REG_SPCR2 0x10 | ||
93 | #define OMAP_MCBSP_REG_SPCR1 0x14 | ||
94 | #define OMAP_MCBSP_REG_RCR2 0x18 | ||
95 | #define OMAP_MCBSP_REG_RCR1 0x1C | ||
96 | #define OMAP_MCBSP_REG_XCR2 0x20 | ||
97 | #define OMAP_MCBSP_REG_XCR1 0x24 | ||
98 | #define OMAP_MCBSP_REG_SRGR2 0x28 | ||
99 | #define OMAP_MCBSP_REG_SRGR1 0x2C | ||
100 | #define OMAP_MCBSP_REG_MCR2 0x30 | ||
101 | #define OMAP_MCBSP_REG_MCR1 0x34 | ||
102 | #define OMAP_MCBSP_REG_RCERA 0x38 | ||
103 | #define OMAP_MCBSP_REG_RCERB 0x3C | ||
104 | #define OMAP_MCBSP_REG_XCERA 0x40 | ||
105 | #define OMAP_MCBSP_REG_XCERB 0x44 | ||
106 | #define OMAP_MCBSP_REG_PCR0 0x48 | ||
107 | #define OMAP_MCBSP_REG_RCERC 0x4C | ||
108 | #define OMAP_MCBSP_REG_RCERD 0x50 | ||
109 | #define OMAP_MCBSP_REG_XCERC 0x54 | ||
110 | #define OMAP_MCBSP_REG_XCERD 0x58 | ||
111 | #define OMAP_MCBSP_REG_RCERE 0x5C | ||
112 | #define OMAP_MCBSP_REG_RCERF 0x60 | ||
113 | #define OMAP_MCBSP_REG_XCERE 0x64 | ||
114 | #define OMAP_MCBSP_REG_XCERF 0x68 | ||
115 | #define OMAP_MCBSP_REG_RCERG 0x6C | ||
116 | #define OMAP_MCBSP_REG_RCERH 0x70 | ||
117 | #define OMAP_MCBSP_REG_XCERG 0x74 | ||
118 | #define OMAP_MCBSP_REG_XCERH 0x78 | ||
119 | |||
120 | #define OMAP_MAX_MCBSP_COUNT 2 | ||
121 | |||
122 | #define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1) | ||
123 | #define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1) | ||
124 | |||
125 | #define AUDIO_MCBSP OMAP_MCBSP2 | ||
126 | #define AUDIO_DMA_TX OMAP24XX_DMA_MCBSP2_TX | ||
127 | #define AUDIO_DMA_RX OMAP24XX_DMA_MCBSP2_RX | ||
128 | |||
129 | #endif | ||
130 | |||
74 | #define OMAP_MCBSP_READ(base, reg) __raw_readw((base) + OMAP_MCBSP_REG_##reg) | 131 | #define OMAP_MCBSP_READ(base, reg) __raw_readw((base) + OMAP_MCBSP_REG_##reg) |
75 | #define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) + OMAP_MCBSP_REG_##reg) | 132 | #define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) + OMAP_MCBSP_REG_##reg) |
76 | 133 | ||
134 | |||
77 | /************************** McBSP SPCR1 bit definitions ***********************/ | 135 | /************************** McBSP SPCR1 bit definitions ***********************/ |
78 | #define RRST 0x0001 | 136 | #define RRST 0x0001 |
79 | #define RRDY 0x0002 | 137 | #define RRDY 0x0002 |
@@ -195,6 +253,10 @@ typedef enum { | |||
195 | OMAP_MCBSP3, | 253 | OMAP_MCBSP3, |
196 | } omap_mcbsp_id; | 254 | } omap_mcbsp_id; |
197 | 255 | ||
256 | typedef int __bitwise omap_mcbsp_io_type_t; | ||
257 | #define OMAP_MCBSP_IRQ_IO ((__force omap_mcbsp_io_type_t) 1) | ||
258 | #define OMAP_MCBSP_POLL_IO ((__force omap_mcbsp_io_type_t) 2) | ||
259 | |||
198 | typedef enum { | 260 | typedef enum { |
199 | OMAP_MCBSP_WORD_8 = 0, | 261 | OMAP_MCBSP_WORD_8 = 0, |
200 | OMAP_MCBSP_WORD_12, | 262 | OMAP_MCBSP_WORD_12, |
@@ -246,6 +308,9 @@ u32 omap_mcbsp_recv_word(unsigned int id); | |||
246 | 308 | ||
247 | int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int length); | 309 | int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int length); |
248 | int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int length); | 310 | int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int length); |
311 | int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word); | ||
312 | int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word); | ||
313 | |||
249 | 314 | ||
250 | /* SPI specific API */ | 315 | /* SPI specific API */ |
251 | void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg); | 316 | void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg); |
diff --git a/include/asm-arm/arch-omap/mcspi.h b/include/asm-arm/arch-omap/mcspi.h new file mode 100644 index 000000000000..9e7f40a88e1b --- /dev/null +++ b/include/asm-arm/arch-omap/mcspi.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _OMAP2_MCSPI_H | ||
2 | #define _OMAP2_MCSPI_H | ||
3 | |||
4 | struct omap2_mcspi_platform_config { | ||
5 | unsigned long base; | ||
6 | unsigned short num_cs; | ||
7 | }; | ||
8 | |||
9 | struct omap2_mcspi_device_config { | ||
10 | unsigned turbo_mode:1; | ||
11 | |||
12 | /* Do we want one channel enabled at the same time? */ | ||
13 | unsigned single_channel:1; | ||
14 | }; | ||
15 | |||
16 | #endif | ||
diff --git a/include/asm-arm/arch-omap/menelaus.h b/include/asm-arm/arch-omap/menelaus.h index 46be8b8d6346..88cd4c87f0de 100644 --- a/include/asm-arm/arch-omap/menelaus.h +++ b/include/asm-arm/arch-omap/menelaus.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #ifndef __ASM_ARCH_MENELAUS_H | 7 | #ifndef __ASM_ARCH_MENELAUS_H |
8 | #define __ASM_ARCH_MENELAUS_H | 8 | #define __ASM_ARCH_MENELAUS_H |
9 | 9 | ||
10 | extern void menelaus_mmc_register(void (*callback)(u8 card_mask), | 10 | extern void menelaus_mmc_register(void (*callback)(unsigned long data, u8 card_mask), |
11 | unsigned long data); | 11 | unsigned long data); |
12 | extern void menelaus_mmc_remove(void); | 12 | extern void menelaus_mmc_remove(void); |
13 | extern void menelaus_mmc_opendrain(int enable); | 13 | extern void menelaus_mmc_opendrain(int enable); |
diff --git a/include/asm-arm/arch-omap/omap-alsa.h b/include/asm-arm/arch-omap/omap-alsa.h new file mode 100644 index 000000000000..df4695474e3d --- /dev/null +++ b/include/asm-arm/arch-omap/omap-alsa.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-omap/omap-alsa.h | ||
3 | * | ||
4 | * Alsa Driver for AIC23 and TSC2101 codecs on OMAP platform boards. | ||
5 | * | ||
6 | * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi> | ||
7 | * | ||
8 | * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil | ||
9 | * Written by Daniel Petrini, David Cohen, Anderson Briglia | ||
10 | * {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | * | ||
32 | * History | ||
33 | * ------- | ||
34 | * | ||
35 | * 2005/07/25 INdT-10LE Kernel Team - Alsa driver for omap osk, | ||
36 | * original version based in sa1100 driver | ||
37 | * and omap oss driver. | ||
38 | */ | ||
39 | |||
40 | #ifndef __OMAP_ALSA_H | ||
41 | #define __OMAP_ALSA_H | ||
42 | |||
43 | #include <sound/driver.h> | ||
44 | #include <asm/arch/dma.h> | ||
45 | #include <sound/core.h> | ||
46 | #include <sound/pcm.h> | ||
47 | #include <asm/arch/mcbsp.h> | ||
48 | #include <linux/platform_device.h> | ||
49 | |||
50 | #define DMA_BUF_SIZE (1024 * 8) | ||
51 | |||
52 | /* | ||
53 | * Buffer management for alsa and dma | ||
54 | */ | ||
55 | struct audio_stream { | ||
56 | char *id; /* identification string */ | ||
57 | int stream_id; /* numeric identification */ | ||
58 | int dma_dev; /* dma number of that device */ | ||
59 | int *lch; /* Chain of channels this stream is linked to */ | ||
60 | char started; /* to store if the chain was started or not */ | ||
61 | int dma_q_head; /* DMA Channel Q Head */ | ||
62 | int dma_q_tail; /* DMA Channel Q Tail */ | ||
63 | char dma_q_count; /* DMA Channel Q Count */ | ||
64 | int active:1; /* we are using this stream for transfer now */ | ||
65 | int period; /* current transfer period */ | ||
66 | int periods; /* current count of periods registerd in the DMA engine */ | ||
67 | spinlock_t dma_lock; /* for locking in DMA operations */ | ||
68 | snd_pcm_substream_t *stream; /* the pcm stream */ | ||
69 | unsigned linked:1; /* dma channels linked */ | ||
70 | int offset; /* store start position of the last period in the alsa buffer */ | ||
71 | int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */ | ||
72 | int (*hw_stop)(void); /* interface to stop HW interface, e.g. McBSP */ | ||
73 | }; | ||
74 | |||
75 | /* | ||
76 | * Alsa card structure for aic23 | ||
77 | */ | ||
78 | struct snd_card_omap_codec { | ||
79 | snd_card_t *card; | ||
80 | snd_pcm_t *pcm; | ||
81 | long samplerate; | ||
82 | struct audio_stream s[2]; /* playback & capture */ | ||
83 | }; | ||
84 | |||
85 | /* Codec specific information and function pointers. | ||
86 | * Codec (omap-alsa-aic23.c and omap-alsa-tsc2101.c) | ||
87 | * are responsible for defining the function pointers. | ||
88 | */ | ||
89 | struct omap_alsa_codec_config { | ||
90 | char *name; | ||
91 | struct omap_mcbsp_reg_cfg *mcbsp_regs_alsa; | ||
92 | snd_pcm_hw_constraint_list_t *hw_constraints_rates; | ||
93 | snd_pcm_hardware_t *snd_omap_alsa_playback; | ||
94 | snd_pcm_hardware_t *snd_omap_alsa_capture; | ||
95 | void (*codec_configure_dev)(void); | ||
96 | void (*codec_set_samplerate)(long); | ||
97 | void (*codec_clock_setup)(void); | ||
98 | int (*codec_clock_on)(void); | ||
99 | int (*codec_clock_off)(void); | ||
100 | int (*get_default_samplerate)(void); | ||
101 | }; | ||
102 | |||
103 | /*********** Mixer function prototypes *************************/ | ||
104 | int snd_omap_mixer(struct snd_card_omap_codec *); | ||
105 | void snd_omap_init_mixer(void); | ||
106 | |||
107 | #ifdef CONFIG_PM | ||
108 | void snd_omap_suspend_mixer(void); | ||
109 | void snd_omap_resume_mixer(void); | ||
110 | #endif | ||
111 | |||
112 | int snd_omap_alsa_post_probe(struct platform_device *pdev, struct omap_alsa_codec_config *config); | ||
113 | int snd_omap_alsa_remove(struct platform_device *pdev); | ||
114 | #ifdef CONFIG_PM | ||
115 | int snd_omap_alsa_suspend(struct platform_device *pdev, pm_message_t state); | ||
116 | int snd_omap_alsa_resume(struct platform_device *pdev); | ||
117 | #else | ||
118 | #define snd_omap_alsa_suspend NULL | ||
119 | #define snd_omap_alsa_resume NULL | ||
120 | #endif | ||
121 | |||
122 | void callback_omap_alsa_sound_dma(void *); | ||
123 | |||
124 | #endif | ||