Cliff Cai | f202862 | 2008-09-05 18:21:37 +0800 | [diff] [blame] | 1 | /* |
Barry Song | 7d156a2 | 2009-09-16 20:25:10 -0400 | [diff] [blame] | 2 | * sound/soc/blackfin/bf5xx-ac97.h |
Cliff Cai | f202862 | 2008-09-05 18:21:37 +0800 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _BF5XX_AC97_H |
| 10 | #define _BF5XX_AC97_H |
| 11 | |
| 12 | extern struct snd_ac97_bus_ops bf5xx_ac97_ops; |
| 13 | extern struct snd_ac97 *ac97; |
| 14 | /* Frame format in memory, only support stereo currently */ |
| 15 | struct ac97_frame { |
| 16 | u16 ac97_tag; /* slot 0 */ |
| 17 | u16 ac97_addr; /* slot 1 */ |
| 18 | u16 ac97_data; /* slot 2 */ |
Cliff Cai | 67f854b | 2008-11-18 16:18:17 +0800 | [diff] [blame] | 19 | u16 ac97_pcm_l; /*slot 3:front left*/ |
| 20 | u16 ac97_pcm_r; /*slot 4:front left*/ |
| 21 | #if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) |
| 22 | u16 ac97_mdm_l1; |
| 23 | u16 ac97_center; /*slot 6:center*/ |
| 24 | u16 ac97_sl; /*slot 7:surround left*/ |
| 25 | u16 ac97_sr; /*slot 8:surround right*/ |
| 26 | u16 ac97_lfe; /*slot 9:lfe*/ |
| 27 | #endif |
Cliff Cai | f202862 | 2008-09-05 18:21:37 +0800 | [diff] [blame] | 28 | } __attribute__ ((packed)); |
| 29 | |
Cliff Cai | 67f854b | 2008-11-18 16:18:17 +0800 | [diff] [blame] | 30 | /* Speaker location */ |
| 31 | #define SP_FL 0x0001 |
| 32 | #define SP_FR 0x0010 |
| 33 | #define SP_FC 0x0002 |
| 34 | #define SP_LFE 0x0020 |
| 35 | #define SP_SL 0x0004 |
| 36 | #define SP_SR 0x0040 |
| 37 | |
| 38 | #define SP_STEREO (SP_FL | SP_FR) |
| 39 | #define SP_2DOT1 (SP_FL | SP_FR | SP_LFE) |
| 40 | #define SP_QUAD (SP_FL | SP_FR | SP_SL | SP_SR) |
| 41 | #define SP_5DOT1 (SP_FL | SP_FR | SP_FC | SP_LFE | SP_SL | SP_SR) |
| 42 | |
Cliff Cai | f202862 | 2008-09-05 18:21:37 +0800 | [diff] [blame] | 43 | #define TAG_VALID 0x8000 |
| 44 | #define TAG_CMD 0x6000 |
| 45 | #define TAG_PCM_LEFT 0x1000 |
| 46 | #define TAG_PCM_RIGHT 0x0800 |
Cliff Cai | 67f854b | 2008-11-18 16:18:17 +0800 | [diff] [blame] | 47 | #define TAG_PCM_MDM_L1 0x0400 |
| 48 | #define TAG_PCM_CENTER 0x0200 |
| 49 | #define TAG_PCM_SL 0x0100 |
| 50 | #define TAG_PCM_SR 0x0080 |
| 51 | #define TAG_PCM_LFE 0x0040 |
Cliff Cai | f202862 | 2008-09-05 18:21:37 +0800 | [diff] [blame] | 52 | |
Cliff Cai | 67f854b | 2008-11-18 16:18:17 +0800 | [diff] [blame] | 53 | void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, \ |
| 54 | size_t count, unsigned int chan_mask); |
Cliff Cai | f202862 | 2008-09-05 18:21:37 +0800 | [diff] [blame] | 55 | |
Cliff Cai | 67f854b | 2008-11-18 16:18:17 +0800 | [diff] [blame] | 56 | void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u16 *dst, \ |
Cliff Cai | f202862 | 2008-09-05 18:21:37 +0800 | [diff] [blame] | 57 | size_t count); |
| 58 | |
| 59 | #endif |