Blame view

sound/ppc/pmac.h 5.15 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  /*
   * Driver for PowerMac onboard soundchips
   * Copyright (c) 2001 by Takashi Iwai <tiwai@suse.de>
   *   based on dmasound.c.
   *
   *   This program is free software; you can redistribute it and/or modify
   *   it under the terms of the GNU General Public License as published by
   *   the Free Software Foundation; either version 2 of the License, or
   *   (at your option) any later version.
   *
   *   This program is distributed in the hope that it will be useful,
   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *   GNU General Public License for more details.
   *
   *   You should have received a copy of the GNU General Public License
   *   along with this program; if not, write to the Free Software
   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
   */
  
  
  #ifndef __PMAC_H
  #define __PMAC_H
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  #include <sound/control.h>
  #include <sound/pcm.h>
  #include "awacs.h"
  
  #include <linux/adb.h>
  #ifdef CONFIG_ADB_CUDA
  #include <linux/cuda.h>
  #endif
  #ifdef CONFIG_ADB_PMU
  #include <linux/pmu.h>
  #endif
  #include <linux/nvram.h>
  #include <linux/tty.h>
  #include <linux/vt_kern.h>
  #include <asm/dbdma.h>
  #include <asm/prom.h>
  #include <asm/machdep.h>
  
  /* maximum number of fragments */
  #define PMAC_MAX_FRAGS		32
  
  
  #define PMAC_SUPPORT_AUTOMUTE
  
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
50
   * DBDMA space
   */
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
51
  struct pmac_dbdma {
7bbd82775   Benjamin Herrenschmidt   [PATCH] ppc64: ve...
52
53
  	dma_addr_t dma_base;
  	dma_addr_t addr;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
55
56
57
58
59
60
61
  	struct dbdma_cmd __iomem *cmds;
  	void *space;
  	int size;
  };
  
  /*
   * playback/capture stream
   */
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
62
  struct pmac_stream {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
63
64
65
66
67
68
69
70
  	int running;	/* boolean */
  
  	int stream;	/* PLAYBACK/CAPTURE */
  
  	int dma_size; /* in bytes */
  	int period_size; /* in bytes */
  	int buffer_size; /* in kbytes */
  	int nperiods, cur_period;
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
71
  	struct pmac_dbdma cmd;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72
  	volatile struct dbdma_regs __iomem *dma;
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
73
  	struct snd_pcm_substream *substream;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
75
76
77
78
79
80
81
82
83
  
  	unsigned int cur_freqs;		/* currently available frequencies */
  	unsigned int cur_formats;	/* currently available formats */
  };
  
  
  /*
   */
  
  enum snd_pmac_model {
1f7b49d04   Benjamin Herrenschmidt   [PATCH] ppc32: ad...
84
  	PMAC_AWACS, PMAC_SCREAMER, PMAC_BURGUNDY, PMAC_DACA, PMAC_TUMBLER,
55c385ad5   Johannes Berg   [ALSA] snd-powerm...
85
  	PMAC_SNAPPER
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
86
87
88
  };
  
  struct snd_pmac {
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
89
  	struct snd_card *card;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
90
91
92
  
  	/* h/w info */
  	struct device_node *node;
7bbd82775   Benjamin Herrenschmidt   [PATCH] ppc64: ve...
93
  	struct pci_dev *pdev;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
94
95
96
97
98
99
100
101
102
  	unsigned int revision;
  	unsigned int manufacturer;
  	unsigned int subframe;
  	unsigned int device_id;
  	enum snd_pmac_model model;
  
  	unsigned int has_iic : 1;
  	unsigned int is_pbook_3400 : 1;
  	unsigned int is_pbook_G3 : 1;
7bbd82775   Benjamin Herrenschmidt   [PATCH] ppc64: ve...
103
  	unsigned int is_k2 : 1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
105
106
107
108
109
110
111
  
  	unsigned int can_byte_swap : 1;
  	unsigned int can_duplex : 1;
  	unsigned int can_capture : 1;
  
  	unsigned int auto_mute : 1;
  	unsigned int initialized : 1;
  	unsigned int feature_is_set : 1;
cc5d0189b   Benjamin Herrenschmidt   [PATCH] powerpc: ...
112
113
  	unsigned int requested;
  	struct resource rsrc[3];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
  
  	int num_freqs;
  	int *freq_table;
  	unsigned int freqs_ok;		/* bit flags */
  	unsigned int formats_ok;	/* pcm hwinfo */
  	int active;
  	int rate_index;
  	int format;			/* current format */
  
  	spinlock_t reg_lock;
  	volatile struct awacs_regs __iomem *awacs;
  	int awacs_reg[8]; /* register cache */
  	unsigned int hp_stat_mask;
  
  	unsigned char __iomem *latch_base;
  	unsigned char __iomem *macio_base;
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
130
131
  	struct pmac_stream playback;
  	struct pmac_stream capture;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
132

65b29f503   Takashi Iwai   [ALSA] Remove xxx...
133
  	struct pmac_dbdma extra_dma;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
134
135
  
  	int irq, tx_irq, rx_irq;
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
136
  	struct snd_pcm *pcm;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
137

65b29f503   Takashi Iwai   [ALSA] Remove xxx...
138
  	struct pmac_beep *beep;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
139
140
141
142
143
  
  	unsigned int control_mask;	/* control mask */
  
  	/* mixer stuffs */
  	void *mixer_data;
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
144
145
146
147
148
149
  	void (*mixer_free)(struct snd_pmac *);
  	struct snd_kcontrol *master_sw_ctl;
  	struct snd_kcontrol *speaker_sw_ctl;
  	struct snd_kcontrol *drc_sw_ctl;	/* only used for tumbler -ReneR */
  	struct snd_kcontrol *hp_detect_ctl;
  	struct snd_kcontrol *lineout_sw_ctl;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
150
151
  
  	/* lowlevel callbacks */
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
152
153
154
  	void (*set_format)(struct snd_pmac *chip);
  	void (*update_automute)(struct snd_pmac *chip, int do_notify);
  	int (*detect_headphone)(struct snd_pmac *chip);
8c8709334   Benjamin Herrenschmidt   [PATCH] ppc32: Re...
155
  #ifdef CONFIG_PM
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
156
157
  	void (*suspend)(struct snd_pmac *chip);
  	void (*resume)(struct snd_pmac *chip);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
158
159
160
161
162
163
  #endif
  
  };
  
  
  /* exported functions */
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
164
165
166
167
168
169
  int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return);
  int snd_pmac_pcm_new(struct snd_pmac *chip);
  int snd_pmac_attach_beep(struct snd_pmac *chip);
  void snd_pmac_detach_beep(struct snd_pmac *chip);
  void snd_pmac_beep_stop(struct snd_pmac *chip);
  unsigned int snd_pmac_rate_index(struct snd_pmac *chip, struct pmac_stream *rec, unsigned int rate);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
170

65b29f503   Takashi Iwai   [ALSA] Remove xxx...
171
172
  void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long addr, int speed);
  void snd_pmac_beep_dma_stop(struct snd_pmac *chip);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
173

5e12bea08   Takashi Iwai   [ALSA] powermac -...
174
175
176
177
  #ifdef CONFIG_PM
  void snd_pmac_suspend(struct snd_pmac *chip);
  void snd_pmac_resume(struct snd_pmac *chip);
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
178
  /* initialize mixer */
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
179
180
181
182
  int snd_pmac_awacs_init(struct snd_pmac *chip);
  int snd_pmac_burgundy_init(struct snd_pmac *chip);
  int snd_pmac_daca_init(struct snd_pmac *chip);
  int snd_pmac_tumbler_init(struct snd_pmac *chip);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
183
184
185
  int snd_pmac_tumbler_post_init(void);
  
  /* i2c functions */
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
186
  struct pmac_keywest {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
187
188
189
  	int addr;
  	struct i2c_client *client;
  	int id;
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
190
  	int (*init_client)(struct pmac_keywest *i2c);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
191
  	char *name;
65b29f503   Takashi Iwai   [ALSA] Remove xxx...
192
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
193

65b29f503   Takashi Iwai   [ALSA] Remove xxx...
194
195
  int snd_pmac_keywest_init(struct pmac_keywest *i2c);
  void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
196
197
  
  /* misc */
a5ce88909   Takashi Iwai   [ALSA] Clean up w...
198
199
  #define snd_pmac_boolean_stereo_info	snd_ctl_boolean_stereo_info
  #define snd_pmac_boolean_mono_info	snd_ctl_boolean_mono_info
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
200

65b29f503   Takashi Iwai   [ALSA] Remove xxx...
201
  int snd_pmac_add_automute(struct snd_pmac *chip);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
202

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
203
  #endif /* __PMAC_H */