2 * i2sbus driver -- private definitions
4 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
6 * GPL v2, can be found in COPYING.
10 #include <asm/dbdma.h>
11 #include <linux/interrupt.h>
12 #include <sound/pcm.h>
13 #include <linux/spinlock.h>
14 #include <linux/mutex.h>
16 #include "i2sbus-interface.h"
17 #include "i2sbus-control.h"
18 #include "../soundbus.h"
20 struct i2sbus_control {
21 volatile struct i2s_control_regs __iomem *controlregs;
23 struct list_head list;
26 #define MAX_DBDMA_COMMANDS 32
28 struct dbdma_command_mem {
30 dma_addr_t bus_cmd_start;
31 struct dbdma_cmd *cmds;
38 u32 created:1, /* has this direction been created with alsa? */
39 active:1; /* is this stream active? */
40 /* runtime information */
41 struct snd_pcm_substream *substream;
44 struct dbdma_command_mem dbdma_ring;
45 volatile struct dbdma_regs __iomem *dbdma;
49 struct soundbus_dev sound;
50 struct macio_dev *macio;
51 struct i2sbus_control *control;
52 volatile struct i2s_interface_regs __iomem *intfregs;
54 struct resource resources[3];
55 struct resource *allocated_resource[3];
59 /* info about currently active substreams */
60 struct pcm_info out, in;
61 snd_pcm_format_t format;
64 /* list for a single controller */
65 struct list_head item;
66 /* number of bus on controller */
68 /* for use by control layer */
69 struct pmf_function *enable,
76 /* spinlock for low-level interrupt locking */
78 /* mutex for high-level consistency */
82 #define soundbus_dev_to_i2sbus_dev(sdev) \
83 container_of(sdev, struct i2sbus_dev, sound)
85 /* pcm specific functions */
87 i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
88 struct codec_info *ci, void *data);
90 i2sbus_detach_codec(struct soundbus_dev *dev, void *data);
92 i2sbus_tx_intr(int irq, void *devid, struct pt_regs *regs);
94 i2sbus_rx_intr(int irq, void *devid, struct pt_regs *regs);
96 /* control specific functions */
97 extern int i2sbus_control_init(struct macio_dev* dev,
98 struct i2sbus_control **c);
99 extern void i2sbus_control_destroy(struct i2sbus_control *c);
100 extern int i2sbus_control_add_dev(struct i2sbus_control *c,
101 struct i2sbus_dev *i2sdev);
102 extern void i2sbus_control_remove_dev(struct i2sbus_control *c,
103 struct i2sbus_dev *i2sdev);
104 extern int i2sbus_control_enable(struct i2sbus_control *c,
105 struct i2sbus_dev *i2sdev);
106 extern int i2sbus_control_cell(struct i2sbus_control *c,
107 struct i2sbus_dev *i2sdev,
109 extern int i2sbus_control_clock(struct i2sbus_control *c,
110 struct i2sbus_dev *i2sdev,
112 #endif /* __I2SBUS_H */