2 * i2sbus driver -- private definitions
4 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
6 * GPL v2, can be found in COPYING.
10 #include <linux/interrupt.h>
11 #include <linux/spinlock.h>
12 #include <linux/mutex.h>
14 #include <sound/pcm.h>
17 #include <asm/pmac_feature.h>
18 #include <asm/dbdma.h>
20 #include "i2sbus-interface.h"
21 #include "../soundbus.h"
23 struct i2sbus_control {
24 struct list_head list;
25 struct macio_chip *macio;
28 #define MAX_DBDMA_COMMANDS 32
30 struct dbdma_command_mem {
32 dma_addr_t bus_cmd_start;
33 struct dbdma_cmd *cmds;
40 u32 created:1, /* has this direction been created with alsa? */
41 active:1; /* is this stream active? */
42 /* runtime information */
43 struct snd_pcm_substream *substream;
46 struct dbdma_command_mem dbdma_ring;
47 volatile struct dbdma_regs __iomem *dbdma;
51 aoa_resource_i2smmio = 0,
57 struct soundbus_dev sound;
58 struct macio_dev *macio;
59 struct i2sbus_control *control;
60 volatile struct i2s_interface_regs __iomem *intfregs;
62 struct resource resources[3];
63 struct resource *allocated_resource[3];
67 /* info about currently active substreams */
68 struct pcm_info out, in;
69 snd_pcm_format_t format;
72 /* list for a single controller */
73 struct list_head item;
74 /* number of bus on controller */
76 /* for use by control layer */
77 struct pmf_function *enable,
84 /* spinlock for low-level interrupt locking */
86 /* mutex for high-level consistency */
90 #define soundbus_dev_to_i2sbus_dev(sdev) \
91 container_of(sdev, struct i2sbus_dev, sound)
93 /* pcm specific functions */
95 i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
96 struct codec_info *ci, void *data);
98 i2sbus_detach_codec(struct soundbus_dev *dev, void *data);
100 i2sbus_tx_intr(int irq, void *devid);
102 i2sbus_rx_intr(int irq, void *devid);
104 /* control specific functions */
105 extern int i2sbus_control_init(struct macio_dev* dev,
106 struct i2sbus_control **c);
107 extern void i2sbus_control_destroy(struct i2sbus_control *c);
108 extern int i2sbus_control_add_dev(struct i2sbus_control *c,
109 struct i2sbus_dev *i2sdev);
110 extern void i2sbus_control_remove_dev(struct i2sbus_control *c,
111 struct i2sbus_dev *i2sdev);
112 extern int i2sbus_control_enable(struct i2sbus_control *c,
113 struct i2sbus_dev *i2sdev);
114 extern int i2sbus_control_cell(struct i2sbus_control *c,
115 struct i2sbus_dev *i2sdev,
117 extern int i2sbus_control_clock(struct i2sbus_control *c,
118 struct i2sbus_dev *i2sdev,
120 #endif /* __I2SBUS_H */