1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * i2sbus driver -- private definitions
5 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
9 #include <linux/interrupt.h>
10 #include <linux/spinlock.h>
11 #include <linux/mutex.h>
12 #include <linux/completion.h>
14 #include <sound/pcm.h>
17 #include <asm/pmac_feature.h>
18 #include <asm/dbdma.h>
20 #include "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
;
41 u32 created
:1, /* has this direction been created with alsa? */
42 active
:1; /* is this stream active? */
43 /* runtime information */
44 struct snd_pcm_substream
*substream
;
47 struct dbdma_command_mem dbdma_ring
;
48 volatile struct dbdma_regs __iomem
*dbdma
;
49 struct completion
*stop_completion
;
53 aoa_resource_i2smmio
= 0,
59 struct soundbus_dev sound
;
60 struct macio_dev
*macio
;
61 struct i2sbus_control
*control
;
62 volatile struct i2s_interface_regs __iomem
*intfregs
;
64 struct resource resources
[3];
65 struct resource
*allocated_resource
[3];
69 /* info about currently active substreams */
70 struct pcm_info out
, in
;
71 snd_pcm_format_t format
;
74 /* list for a single controller */
75 struct list_head item
;
76 /* number of bus on controller */
78 /* for use by control layer */
79 struct pmf_function
*enable
,
86 /* spinlock for low-level interrupt locking */
88 /* mutex for high-level consistency */
92 #define soundbus_dev_to_i2sbus_dev(sdev) \
93 container_of(sdev, struct i2sbus_dev, sound)
95 /* pcm specific functions */
97 i2sbus_attach_codec(struct soundbus_dev
*dev
, struct snd_card
*card
,
98 struct codec_info
*ci
, void *data
);
100 i2sbus_detach_codec(struct soundbus_dev
*dev
, void *data
);
102 i2sbus_tx_intr(int irq
, void *devid
);
104 i2sbus_rx_intr(int irq
, void *devid
);
106 extern void i2sbus_wait_for_stop_both(struct i2sbus_dev
*i2sdev
);
107 extern void i2sbus_pcm_prepare_both(struct i2sbus_dev
*i2sdev
);
109 /* control specific functions */
110 extern int i2sbus_control_init(struct macio_dev
* dev
,
111 struct i2sbus_control
**c
);
112 extern void i2sbus_control_destroy(struct i2sbus_control
*c
);
113 extern int i2sbus_control_add_dev(struct i2sbus_control
*c
,
114 struct i2sbus_dev
*i2sdev
);
115 extern void i2sbus_control_remove_dev(struct i2sbus_control
*c
,
116 struct i2sbus_dev
*i2sdev
);
117 extern int i2sbus_control_enable(struct i2sbus_control
*c
,
118 struct i2sbus_dev
*i2sdev
);
119 extern int i2sbus_control_cell(struct i2sbus_control
*c
,
120 struct i2sbus_dev
*i2sdev
,
122 extern int i2sbus_control_clock(struct i2sbus_control
*c
,
123 struct i2sbus_dev
*i2sdev
,
125 #endif /* __I2SBUS_H */