~ubuntu-branches/ubuntu/karmic/linux-mvl-dove/karmic-proposed

« back to all changes in this revision

Viewing changes to arch/arm/plat-orion/mv_hal_drivers/mv_drivers_lsp/mv_audio/mv88fx-pcm.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader
  • Date: 2010-03-10 22:24:12 UTC
  • mto: (15.1.2 karmic-security)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20100310222412-k86m3r53jw0je7x1
Tags: upstream-2.6.31
ImportĀ upstreamĀ versionĀ 2.6.31

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *
3
 
 *      Marvell Orion Alsa Sound driver
4
 
 *
5
 
 *      Author: Maen Suleiman
6
 
 *      Copyright (C) 2008 Marvell Ltd.
7
 
 *
8
 
 *
9
 
 * This program is free software; you can redistribute it and/or modify
10
 
 * it under the terms of the GNU General Public License version 2 as
11
 
 * published by the Free Software Foundation.
12
 
 *
13
 
 */
14
 
#define DRIVER_NAME     "mv88fx_snd"
15
 
 
16
 
//#define MV88FX_SND_DEBUG
17
 
#ifdef MV88FX_SND_DEBUG
18
 
#define mv88fx_snd_debug(fmt, arg...) printk(KERN_DEBUG fmt, ##arg)
19
 
#else
20
 
        #define mv88fx_snd_debug(a...)
21
 
#endif
22
 
 
23
 
 
24
 
typedef struct {
25
 
        unsigned int base;
26
 
        unsigned int size;
27
 
} _audio_mem_info;
28
 
 
29
 
struct mv88fx_snd_stream {
30
 
        struct snd_pcm_substream        *substream;
31
 
        struct device*          dev;
32
 
        int     direction;      /* playback or capture */ 
33
 
        #define PLAYBACK        0
34
 
        #define CAPTURE         1
35
 
        unsigned int    dig_mode;       /* i2s,spdif,both*/ 
36
 
        #define I2S             1
37
 
        #define SPDIF           2
38
 
        int     stereo;         /* mono , stereo*/
39
 
        int     mono_mode;      /* both mono, left mono, right mono*/
40
 
        #define MONO_BOTH       0
41
 
        #define MONO_LEFT       1
42
 
        #define MONO_RIGHT      2
43
 
        int     clock_src;
44
 
        #define DCO_CLOCK       0
45
 
        #define SPCR_CLOCK      1
46
 
        #define EXTERN_CLOCK    2
47
 
        int     rate;           
48
 
        int     stat_mem;       /* Channel status source*/
49
 
        int     format;
50
 
        #define SAMPLE_32IN32   0
51
 
        #define SAMPLE_24IN32   1
52
 
        #define SAMPLE_20IN32   2
53
 
        #define SAMPLE_16IN32   3
54
 
        #define SAMPLE_16IN16   4
55
 
        unsigned int    dma_addr;
56
 
        unsigned int    dma_size;
57
 
        unsigned int    period_size;
58
 
        unsigned int spdif_status[4];   /* SPDIF status */
59
 
        unsigned char   *area;  /* virtual pointer */
60
 
        dma_addr_t      addr;   /* physical address */
61
 
 
62
 
        
63
 
};
64
 
 
65
 
struct mv88fx_snd_chip {
66
 
        struct snd_card *card;
67
 
        struct device   *dev;
68
 
        int     port;
69
 
        struct orion_i2s_platform_data  *pdata; /* platform dara*/
70
 
        struct mv88fx_snd_stream        *stream[2];     /* run time values*/
71
 
        struct mv88fx_snd_stream        *stream_defaults[2]; /* default values*/
72
 
        spinlock_t      reg_lock;       /* Register access spinlock */
73
 
        struct resource *res;           /* resource for IRQ and base*/
74
 
        void __iomem    *base;          /* base address of the host */
75
 
        int     irq;
76
 
        int     loopback;               /* When Loopback is enabled, playback 
77
 
                                          data is looped back to be recorded */
78
 
        int     ch_stat_valid;          /* Playback SPDIF channel validity bit 
79
 
                                        value when REG selected */
80
 
        int     burst;                  /* DMA Burst Size */
81
 
 
82
 
        #define SPDIF_MEM_STAT          0
83
 
        #define SPDIF_REG_STAT          1
84
 
        unsigned int dco_ctrl_offst;
85
 
        int     pcm_mode;       /* pcm, nonpcm*/
86
 
        #define PCM             0
87
 
        #define NON_PCM         1
88
 
        _audio_mem_info *mem_array;
89
 
};
90
 
 
91
 
#define MV88FX_SND_MIN_PERIODS          8
92
 
#define MV88FX_SND_MAX_PERIODS          16
93
 
#define MV88FX_SND_MIN_PERIOD_BYTES     0x4000
94
 
#define MV88FX_SND_MAX_PERIOD_BYTES     0x4000
95
 
 
96
 
 
97
 
/* read/write registers */
98
 
 
99
 
#define mv88fx_snd_writel(chip, offs, val)      \
100
 
                writel((val), (chip->base + offs))
101
 
 
102
 
static inline unsigned int mv88fx_snd_readl(struct mv88fx_snd_chip *chip, 
103
 
                                           unsigned int offs)
104
 
{
105
 
        unsigned int val = readl((chip->base + offs));
106
 
        return (val);
107
 
}
108
 
#define mv88fx_snd_bitset(chip, offs, bitmask)  \
109
 
                writel( (readl(chip->base + offs) | (bitmask)), \
110
 
                        chip->base + offs)
111
 
 
112
 
#define mv88fx_snd_bitreset(chip, offs, bitmask)        \
113
 
                writel( (readl(chip->base + offs) & (~(bitmask))), \
114
 
                        chip->base + offs)
115
 
 
116