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>
13 #include <linux/completion.h>
15 #include <sound/pcm.h>
18 #include <asm/pmac_feature.h>
19 #include <asm/dbdma.h>
21 #include "interface.h"
22 #include "../soundbus.h"
24 struct i2sbus_control
{
25 struct list_head list
;
26 struct macio_chip
*macio
;
29 #define MAX_DBDMA_COMMANDS 32
31 struct dbdma_command_mem
{
33 dma_addr_t bus_cmd_start
;
34 struct dbdma_cmd
*cmds
;
42 u32 created
:1, /* has this direction been created with alsa? */
43 active
:1; /* is this stream active? */
44 /* runtime information */
45 struct snd_pcm_substream
*substream
;
48 struct dbdma_command_mem dbdma_ring
;
49 volatile struct dbdma_regs __iomem
*dbdma
;
50 struct completion
*stop_completion
;
54 aoa_resource_i2smmio
= 0,
60 struct soundbus_dev sound
;
61 struct macio_dev
*macio
;
62 struct i2sbus_control
*control
;
63 volatile struct i2s_interface_regs __iomem
*intfregs
;
65 struct resource resources
[3];
66 struct resource
*allocated_resource
[3];
70 /* info about currently active substreams */
71 struct pcm_info out
, in
;
72 snd_pcm_format_t format
;
75 /* list for a single controller */
76 struct list_head item
;
77 /* number of bus on controller */
79 /* for use by control layer */
80 struct pmf_function
*enable
,
87 /* spinlock for low-level interrupt locking */
89 /* mutex for high-level consistency */
93 #define soundbus_dev_to_i2sbus_dev(sdev) \
94 container_of(sdev, struct i2sbus_dev, sound)
96 /* pcm specific functions */
98 i2sbus_attach_codec(struct soundbus_dev
*dev
, struct snd_card
*card
,
99 struct codec_info
*ci
, void *data
);
101 i2sbus_detach_codec(struct soundbus_dev
*dev
, void *data
);
103 i2sbus_tx_intr(int irq
, void *devid
);
105 i2sbus_rx_intr(int irq
, void *devid
);
107 extern void i2sbus_wait_for_stop_both(struct i2sbus_dev
*i2sdev
);
108 extern void i2sbus_pcm_prepare_both(struct i2sbus_dev
*i2sdev
);
110 /* control specific functions */
111 extern int i2sbus_control_init(struct macio_dev
* dev
,
112 struct i2sbus_control
**c
);
113 extern void i2sbus_control_destroy(struct i2sbus_control
*c
);
114 extern int i2sbus_control_add_dev(struct i2sbus_control
*c
,
115 struct i2sbus_dev
*i2sdev
);
116 extern void i2sbus_control_remove_dev(struct i2sbus_control
*c
,
117 struct i2sbus_dev
*i2sdev
);
118 extern int i2sbus_control_enable(struct i2sbus_control
*c
,
119 struct i2sbus_dev
*i2sdev
);
120 extern int i2sbus_control_cell(struct i2sbus_control
*c
,
121 struct i2sbus_dev
*i2sdev
,
123 extern int i2sbus_control_clock(struct i2sbus_control
*c
,
124 struct i2sbus_dev
*i2sdev
,
126 #endif /* __I2SBUS_H */