Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
i2sbus.h
Go to the documentation of this file.
1 /*
2  * i2sbus driver -- private definitions
3  *
4  * Copyright 2006 Johannes Berg <[email protected]>
5  *
6  * GPL v2, can be found in COPYING.
7  */
8 #ifndef __I2SBUS_H
9 #define __I2SBUS_H
10 #include <linux/interrupt.h>
11 #include <linux/spinlock.h>
12 #include <linux/mutex.h>
13 #include <linux/completion.h>
14 
15 #include <sound/pcm.h>
16 
17 #include <asm/prom.h>
18 #include <asm/pmac_feature.h>
19 #include <asm/dbdma.h>
20 
21 #include "interface.h"
22 #include "../soundbus.h"
23 
25  struct list_head list;
26  struct macio_chip *macio;
27 };
28 
29 #define MAX_DBDMA_COMMANDS 32
30 
34  struct dbdma_cmd *cmds;
35  void *space;
36  int size;
39 };
40 
41 struct pcm_info {
42  u32 created:1, /* has this direction been created with alsa? */
43  active:1; /* is this stream active? */
44  /* runtime information */
49  volatile struct dbdma_regs __iomem *dbdma;
51 };
52 
53 enum {
57 };
58 
59 struct i2sbus_dev {
61  struct macio_dev *macio;
64 
65  struct resource resources[3];
67  int interrupts[3];
68  char rnames[3][32];
69 
70  /* info about currently active substreams */
71  struct pcm_info out, in;
73  unsigned int rate;
74 
75  /* list for a single controller */
76  struct list_head item;
77  /* number of bus on controller */
79  /* for use by control layer */
81  *cell_enable,
82  *cell_disable,
83  *clock_enable,
85 
86  /* locks */
87  /* spinlock for low-level interrupt locking */
89  /* mutex for high-level consistency */
90  struct mutex lock;
91 };
92 
93 #define soundbus_dev_to_i2sbus_dev(sdev) \
94  container_of(sdev, struct i2sbus_dev, sound)
95 
96 /* pcm specific functions */
97 extern int
99  struct codec_info *ci, void *data);
100 extern void
101 i2sbus_detach_codec(struct soundbus_dev *dev, void *data);
102 extern irqreturn_t
103 i2sbus_tx_intr(int irq, void *devid);
104 extern irqreturn_t
105 i2sbus_rx_intr(int irq, void *devid);
106 
107 extern void i2sbus_wait_for_stop_both(struct i2sbus_dev *i2sdev);
108 extern void i2sbus_pcm_prepare_both(struct i2sbus_dev *i2sdev);
109 
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,
122  int enable);
123 extern int i2sbus_control_clock(struct i2sbus_control *c,
124  struct i2sbus_dev *i2sdev,
125  int enable);
126 #endif /* __I2SBUS_H */