root / hw / audio / marvell_88w8618.c @ 14eefd0e
History | View | Annotate | Download (8.3 kB)
1 | ef07b491 | Andrzej Zaborowski | /*
|
---|---|---|---|
2 | ef07b491 | Andrzej Zaborowski | * Marvell 88w8618 audio emulation extracted from
|
3 | ef07b491 | Andrzej Zaborowski | * Marvell MV88w8618 / Freecom MusicPal emulation.
|
4 | ef07b491 | Andrzej Zaborowski | *
|
5 | ef07b491 | Andrzej Zaborowski | * Copyright (c) 2008 Jan Kiszka
|
6 | ef07b491 | Andrzej Zaborowski | *
|
7 | 8e31bf38 | Matthew Fernandez | * This code is licensed under the GNU GPL v2.
|
8 | 6b620ca3 | Paolo Bonzini | *
|
9 | 6b620ca3 | Paolo Bonzini | * Contributions after 2012-01-13 are licensed under the terms of the
|
10 | 6b620ca3 | Paolo Bonzini | * GNU GPL, version 2 or (at your option) any later version.
|
11 | ef07b491 | Andrzej Zaborowski | */
|
12 | 83c9f4ca | Paolo Bonzini | #include "hw/sysbus.h" |
13 | 83c9f4ca | Paolo Bonzini | #include "hw/hw.h" |
14 | 0d09e41a | Paolo Bonzini | #include "hw/i2c/i2c.h" |
15 | ef07b491 | Andrzej Zaborowski | #include "audio/audio.h" |
16 | ef07b491 | Andrzej Zaborowski | |
17 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_SIZE 0x00001000 |
18 | ef07b491 | Andrzej Zaborowski | |
19 | ef07b491 | Andrzej Zaborowski | /* Audio register offsets */
|
20 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_PLAYBACK_MODE 0x00 |
21 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_CLOCK_DIV 0x18 |
22 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_IRQ_STATUS 0x20 |
23 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_IRQ_ENABLE 0x24 |
24 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_TX_START_LO 0x28 |
25 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_TX_THRESHOLD 0x2C |
26 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_TX_STATUS 0x38 |
27 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_TX_START_HI 0x40 |
28 | ef07b491 | Andrzej Zaborowski | |
29 | ef07b491 | Andrzej Zaborowski | /* Status register and IRQ enable bits */
|
30 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_TX_HALF (1 << 6) |
31 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_TX_FULL (1 << 7) |
32 | ef07b491 | Andrzej Zaborowski | |
33 | ef07b491 | Andrzej Zaborowski | /* Playback mode bits */
|
34 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_16BIT_SAMPLE (1 << 0) |
35 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_PLAYBACK_EN (1 << 7) |
36 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_CLOCK_24MHZ (1 << 9) |
37 | ef07b491 | Andrzej Zaborowski | #define MP_AUDIO_MONO (1 << 14) |
38 | ef07b491 | Andrzej Zaborowski | |
39 | ef07b491 | Andrzej Zaborowski | typedef struct mv88w8618_audio_state { |
40 | ef07b491 | Andrzej Zaborowski | SysBusDevice busdev; |
41 | e2ba99e9 | Benoît Canet | MemoryRegion iomem; |
42 | ef07b491 | Andrzej Zaborowski | qemu_irq irq; |
43 | ef07b491 | Andrzej Zaborowski | uint32_t playback_mode; |
44 | ef07b491 | Andrzej Zaborowski | uint32_t status; |
45 | ef07b491 | Andrzej Zaborowski | uint32_t irq_enable; |
46 | d5b61ddd | Jan Kiszka | uint32_t phys_buf; |
47 | ef07b491 | Andrzej Zaborowski | uint32_t target_buffer; |
48 | d5b61ddd | Jan Kiszka | uint32_t threshold; |
49 | d5b61ddd | Jan Kiszka | uint32_t play_pos; |
50 | d5b61ddd | Jan Kiszka | uint32_t last_free; |
51 | ef07b491 | Andrzej Zaborowski | uint32_t clock_div; |
52 | e855761c | Anthony Liguori | void *wm;
|
53 | ef07b491 | Andrzej Zaborowski | } mv88w8618_audio_state; |
54 | ef07b491 | Andrzej Zaborowski | |
55 | ef07b491 | Andrzej Zaborowski | static void mv88w8618_audio_callback(void *opaque, int free_out, int free_in) |
56 | ef07b491 | Andrzej Zaborowski | { |
57 | ef07b491 | Andrzej Zaborowski | mv88w8618_audio_state *s = opaque; |
58 | ef07b491 | Andrzej Zaborowski | int16_t *codec_buffer; |
59 | ef07b491 | Andrzej Zaborowski | int8_t buf[4096];
|
60 | ef07b491 | Andrzej Zaborowski | int8_t *mem_buffer; |
61 | ef07b491 | Andrzej Zaborowski | int pos, block_size;
|
62 | ef07b491 | Andrzej Zaborowski | |
63 | 49fedd0d | Jan Kiszka | if (!(s->playback_mode & MP_AUDIO_PLAYBACK_EN)) {
|
64 | ef07b491 | Andrzej Zaborowski | return;
|
65 | 49fedd0d | Jan Kiszka | } |
66 | 49fedd0d | Jan Kiszka | if (s->playback_mode & MP_AUDIO_16BIT_SAMPLE) {
|
67 | ef07b491 | Andrzej Zaborowski | free_out <<= 1;
|
68 | 49fedd0d | Jan Kiszka | } |
69 | 49fedd0d | Jan Kiszka | if (!(s->playback_mode & MP_AUDIO_MONO)) {
|
70 | ef07b491 | Andrzej Zaborowski | free_out <<= 1;
|
71 | 49fedd0d | Jan Kiszka | } |
72 | ef07b491 | Andrzej Zaborowski | block_size = s->threshold / 2;
|
73 | 49fedd0d | Jan Kiszka | if (free_out - s->last_free < block_size) {
|
74 | ef07b491 | Andrzej Zaborowski | return;
|
75 | 49fedd0d | Jan Kiszka | } |
76 | 49fedd0d | Jan Kiszka | if (block_size > 4096) { |
77 | ef07b491 | Andrzej Zaborowski | return;
|
78 | 49fedd0d | Jan Kiszka | } |
79 | e1fe50dc | Stefan Weil | cpu_physical_memory_read(s->target_buffer + s->play_pos, buf, block_size); |
80 | ef07b491 | Andrzej Zaborowski | mem_buffer = buf; |
81 | ef07b491 | Andrzej Zaborowski | if (s->playback_mode & MP_AUDIO_16BIT_SAMPLE) {
|
82 | ef07b491 | Andrzej Zaborowski | if (s->playback_mode & MP_AUDIO_MONO) {
|
83 | ef07b491 | Andrzej Zaborowski | codec_buffer = wm8750_dac_buffer(s->wm, block_size >> 1);
|
84 | ef07b491 | Andrzej Zaborowski | for (pos = 0; pos < block_size; pos += 2) { |
85 | ef07b491 | Andrzej Zaborowski | *codec_buffer++ = *(int16_t *)mem_buffer; |
86 | ef07b491 | Andrzej Zaborowski | *codec_buffer++ = *(int16_t *)mem_buffer; |
87 | ef07b491 | Andrzej Zaborowski | mem_buffer += 2;
|
88 | ef07b491 | Andrzej Zaborowski | } |
89 | 49fedd0d | Jan Kiszka | } else {
|
90 | ef07b491 | Andrzej Zaborowski | memcpy(wm8750_dac_buffer(s->wm, block_size >> 2),
|
91 | ef07b491 | Andrzej Zaborowski | (uint32_t *)mem_buffer, block_size); |
92 | 49fedd0d | Jan Kiszka | } |
93 | ef07b491 | Andrzej Zaborowski | } else {
|
94 | ef07b491 | Andrzej Zaborowski | if (s->playback_mode & MP_AUDIO_MONO) {
|
95 | ef07b491 | Andrzej Zaborowski | codec_buffer = wm8750_dac_buffer(s->wm, block_size); |
96 | ef07b491 | Andrzej Zaborowski | for (pos = 0; pos < block_size; pos++) { |
97 | ef07b491 | Andrzej Zaborowski | *codec_buffer++ = cpu_to_le16(256 * *mem_buffer);
|
98 | ef07b491 | Andrzej Zaborowski | *codec_buffer++ = cpu_to_le16(256 * *mem_buffer++);
|
99 | ef07b491 | Andrzej Zaborowski | } |
100 | ef07b491 | Andrzej Zaborowski | } else {
|
101 | ef07b491 | Andrzej Zaborowski | codec_buffer = wm8750_dac_buffer(s->wm, block_size >> 1);
|
102 | ef07b491 | Andrzej Zaborowski | for (pos = 0; pos < block_size; pos += 2) { |
103 | ef07b491 | Andrzej Zaborowski | *codec_buffer++ = cpu_to_le16(256 * *mem_buffer++);
|
104 | ef07b491 | Andrzej Zaborowski | *codec_buffer++ = cpu_to_le16(256 * *mem_buffer++);
|
105 | ef07b491 | Andrzej Zaborowski | } |
106 | ef07b491 | Andrzej Zaborowski | } |
107 | ef07b491 | Andrzej Zaborowski | } |
108 | ef07b491 | Andrzej Zaborowski | wm8750_dac_commit(s->wm); |
109 | ef07b491 | Andrzej Zaborowski | |
110 | ef07b491 | Andrzej Zaborowski | s->last_free = free_out - block_size; |
111 | ef07b491 | Andrzej Zaborowski | |
112 | ef07b491 | Andrzej Zaborowski | if (s->play_pos == 0) { |
113 | ef07b491 | Andrzej Zaborowski | s->status |= MP_AUDIO_TX_HALF; |
114 | ef07b491 | Andrzej Zaborowski | s->play_pos = block_size; |
115 | ef07b491 | Andrzej Zaborowski | } else {
|
116 | ef07b491 | Andrzej Zaborowski | s->status |= MP_AUDIO_TX_FULL; |
117 | ef07b491 | Andrzej Zaborowski | s->play_pos = 0;
|
118 | ef07b491 | Andrzej Zaborowski | } |
119 | ef07b491 | Andrzej Zaborowski | |
120 | 49fedd0d | Jan Kiszka | if (s->status & s->irq_enable) {
|
121 | ef07b491 | Andrzej Zaborowski | qemu_irq_raise(s->irq); |
122 | 49fedd0d | Jan Kiszka | } |
123 | ef07b491 | Andrzej Zaborowski | } |
124 | ef07b491 | Andrzej Zaborowski | |
125 | ef07b491 | Andrzej Zaborowski | static void mv88w8618_audio_clock_update(mv88w8618_audio_state *s) |
126 | ef07b491 | Andrzej Zaborowski | { |
127 | ef07b491 | Andrzej Zaborowski | int rate;
|
128 | ef07b491 | Andrzej Zaborowski | |
129 | 49fedd0d | Jan Kiszka | if (s->playback_mode & MP_AUDIO_CLOCK_24MHZ) {
|
130 | ef07b491 | Andrzej Zaborowski | rate = 24576000 / 64; /* 24.576MHz */ |
131 | 49fedd0d | Jan Kiszka | } else {
|
132 | ef07b491 | Andrzej Zaborowski | rate = 11289600 / 64; /* 11.2896MHz */ |
133 | 49fedd0d | Jan Kiszka | } |
134 | ef07b491 | Andrzej Zaborowski | rate /= ((s->clock_div >> 8) & 0xff) + 1; |
135 | ef07b491 | Andrzej Zaborowski | |
136 | ef07b491 | Andrzej Zaborowski | wm8750_set_bclk_in(s->wm, rate); |
137 | ef07b491 | Andrzej Zaborowski | } |
138 | ef07b491 | Andrzej Zaborowski | |
139 | a8170e5e | Avi Kivity | static uint64_t mv88w8618_audio_read(void *opaque, hwaddr offset, |
140 | e2ba99e9 | Benoît Canet | unsigned size)
|
141 | ef07b491 | Andrzej Zaborowski | { |
142 | ef07b491 | Andrzej Zaborowski | mv88w8618_audio_state *s = opaque; |
143 | ef07b491 | Andrzej Zaborowski | |
144 | ef07b491 | Andrzej Zaborowski | switch (offset) {
|
145 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_PLAYBACK_MODE:
|
146 | ef07b491 | Andrzej Zaborowski | return s->playback_mode;
|
147 | ef07b491 | Andrzej Zaborowski | |
148 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_CLOCK_DIV:
|
149 | ef07b491 | Andrzej Zaborowski | return s->clock_div;
|
150 | ef07b491 | Andrzej Zaborowski | |
151 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_IRQ_STATUS:
|
152 | ef07b491 | Andrzej Zaborowski | return s->status;
|
153 | ef07b491 | Andrzej Zaborowski | |
154 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_IRQ_ENABLE:
|
155 | ef07b491 | Andrzej Zaborowski | return s->irq_enable;
|
156 | ef07b491 | Andrzej Zaborowski | |
157 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_TX_STATUS:
|
158 | ef07b491 | Andrzej Zaborowski | return s->play_pos >> 2; |
159 | ef07b491 | Andrzej Zaborowski | |
160 | ef07b491 | Andrzej Zaborowski | default:
|
161 | ef07b491 | Andrzej Zaborowski | return 0; |
162 | ef07b491 | Andrzej Zaborowski | } |
163 | ef07b491 | Andrzej Zaborowski | } |
164 | ef07b491 | Andrzej Zaborowski | |
165 | a8170e5e | Avi Kivity | static void mv88w8618_audio_write(void *opaque, hwaddr offset, |
166 | e2ba99e9 | Benoît Canet | uint64_t value, unsigned size)
|
167 | ef07b491 | Andrzej Zaborowski | { |
168 | ef07b491 | Andrzej Zaborowski | mv88w8618_audio_state *s = opaque; |
169 | ef07b491 | Andrzej Zaborowski | |
170 | ef07b491 | Andrzej Zaborowski | switch (offset) {
|
171 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_PLAYBACK_MODE:
|
172 | ef07b491 | Andrzej Zaborowski | if (value & MP_AUDIO_PLAYBACK_EN &&
|
173 | ef07b491 | Andrzej Zaborowski | !(s->playback_mode & MP_AUDIO_PLAYBACK_EN)) { |
174 | ef07b491 | Andrzej Zaborowski | s->status = 0;
|
175 | ef07b491 | Andrzej Zaborowski | s->last_free = 0;
|
176 | ef07b491 | Andrzej Zaborowski | s->play_pos = 0;
|
177 | ef07b491 | Andrzej Zaborowski | } |
178 | ef07b491 | Andrzej Zaborowski | s->playback_mode = value; |
179 | ef07b491 | Andrzej Zaborowski | mv88w8618_audio_clock_update(s); |
180 | ef07b491 | Andrzej Zaborowski | break;
|
181 | ef07b491 | Andrzej Zaborowski | |
182 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_CLOCK_DIV:
|
183 | ef07b491 | Andrzej Zaborowski | s->clock_div = value; |
184 | ef07b491 | Andrzej Zaborowski | s->last_free = 0;
|
185 | ef07b491 | Andrzej Zaborowski | s->play_pos = 0;
|
186 | ef07b491 | Andrzej Zaborowski | mv88w8618_audio_clock_update(s); |
187 | ef07b491 | Andrzej Zaborowski | break;
|
188 | ef07b491 | Andrzej Zaborowski | |
189 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_IRQ_STATUS:
|
190 | ef07b491 | Andrzej Zaborowski | s->status &= ~value; |
191 | ef07b491 | Andrzej Zaborowski | break;
|
192 | ef07b491 | Andrzej Zaborowski | |
193 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_IRQ_ENABLE:
|
194 | ef07b491 | Andrzej Zaborowski | s->irq_enable = value; |
195 | 49fedd0d | Jan Kiszka | if (s->status & s->irq_enable) {
|
196 | ef07b491 | Andrzej Zaborowski | qemu_irq_raise(s->irq); |
197 | 49fedd0d | Jan Kiszka | } |
198 | ef07b491 | Andrzej Zaborowski | break;
|
199 | ef07b491 | Andrzej Zaborowski | |
200 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_TX_START_LO:
|
201 | ef07b491 | Andrzej Zaborowski | s->phys_buf = (s->phys_buf & 0xFFFF0000) | (value & 0xFFFF); |
202 | ef07b491 | Andrzej Zaborowski | s->target_buffer = s->phys_buf; |
203 | ef07b491 | Andrzej Zaborowski | s->play_pos = 0;
|
204 | ef07b491 | Andrzej Zaborowski | s->last_free = 0;
|
205 | ef07b491 | Andrzej Zaborowski | break;
|
206 | ef07b491 | Andrzej Zaborowski | |
207 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_TX_THRESHOLD:
|
208 | ef07b491 | Andrzej Zaborowski | s->threshold = (value + 1) * 4; |
209 | ef07b491 | Andrzej Zaborowski | break;
|
210 | ef07b491 | Andrzej Zaborowski | |
211 | ef07b491 | Andrzej Zaborowski | case MP_AUDIO_TX_START_HI:
|
212 | ef07b491 | Andrzej Zaborowski | s->phys_buf = (s->phys_buf & 0xFFFF) | (value << 16); |
213 | ef07b491 | Andrzej Zaborowski | s->target_buffer = s->phys_buf; |
214 | ef07b491 | Andrzej Zaborowski | s->play_pos = 0;
|
215 | ef07b491 | Andrzej Zaborowski | s->last_free = 0;
|
216 | ef07b491 | Andrzej Zaborowski | break;
|
217 | ef07b491 | Andrzej Zaborowski | } |
218 | ef07b491 | Andrzej Zaborowski | } |
219 | ef07b491 | Andrzej Zaborowski | |
220 | d5b61ddd | Jan Kiszka | static void mv88w8618_audio_reset(DeviceState *d) |
221 | ef07b491 | Andrzej Zaborowski | { |
222 | d5b61ddd | Jan Kiszka | mv88w8618_audio_state *s = FROM_SYSBUS(mv88w8618_audio_state, |
223 | 1356b98d | Andreas Färber | SYS_BUS_DEVICE(d)); |
224 | ef07b491 | Andrzej Zaborowski | |
225 | ef07b491 | Andrzej Zaborowski | s->playback_mode = 0;
|
226 | ef07b491 | Andrzej Zaborowski | s->status = 0;
|
227 | ef07b491 | Andrzej Zaborowski | s->irq_enable = 0;
|
228 | 267c4840 | Jan Kiszka | s->clock_div = 0;
|
229 | 267c4840 | Jan Kiszka | s->threshold = 0;
|
230 | 267c4840 | Jan Kiszka | s->phys_buf = 0;
|
231 | ef07b491 | Andrzej Zaborowski | } |
232 | ef07b491 | Andrzej Zaborowski | |
233 | e2ba99e9 | Benoît Canet | static const MemoryRegionOps mv88w8618_audio_ops = { |
234 | e2ba99e9 | Benoît Canet | .read = mv88w8618_audio_read, |
235 | e2ba99e9 | Benoît Canet | .write = mv88w8618_audio_write, |
236 | e2ba99e9 | Benoît Canet | .endianness = DEVICE_NATIVE_ENDIAN, |
237 | ef07b491 | Andrzej Zaborowski | }; |
238 | ef07b491 | Andrzej Zaborowski | |
239 | 81a322d4 | Gerd Hoffmann | static int mv88w8618_audio_init(SysBusDevice *dev) |
240 | ef07b491 | Andrzej Zaborowski | { |
241 | ef07b491 | Andrzej Zaborowski | mv88w8618_audio_state *s = FROM_SYSBUS(mv88w8618_audio_state, dev); |
242 | ef07b491 | Andrzej Zaborowski | |
243 | ef07b491 | Andrzej Zaborowski | sysbus_init_irq(dev, &s->irq); |
244 | ef07b491 | Andrzej Zaborowski | |
245 | ef07b491 | Andrzej Zaborowski | wm8750_data_req_set(s->wm, mv88w8618_audio_callback, s); |
246 | ef07b491 | Andrzej Zaborowski | |
247 | 64bde0f3 | Paolo Bonzini | memory_region_init_io(&s->iomem, OBJECT(s), &mv88w8618_audio_ops, s, |
248 | e2ba99e9 | Benoît Canet | "audio", MP_AUDIO_SIZE);
|
249 | 750ecd44 | Avi Kivity | sysbus_init_mmio(dev, &s->iomem); |
250 | ef07b491 | Andrzej Zaborowski | |
251 | 81a322d4 | Gerd Hoffmann | return 0; |
252 | ef07b491 | Andrzej Zaborowski | } |
253 | ef07b491 | Andrzej Zaborowski | |
254 | d5b61ddd | Jan Kiszka | static const VMStateDescription mv88w8618_audio_vmsd = { |
255 | d5b61ddd | Jan Kiszka | .name = "mv88w8618_audio",
|
256 | d5b61ddd | Jan Kiszka | .version_id = 1,
|
257 | d5b61ddd | Jan Kiszka | .minimum_version_id = 1,
|
258 | d5b61ddd | Jan Kiszka | .minimum_version_id_old = 1,
|
259 | d5b61ddd | Jan Kiszka | .fields = (VMStateField[]) { |
260 | d5b61ddd | Jan Kiszka | VMSTATE_UINT32(playback_mode, mv88w8618_audio_state), |
261 | d5b61ddd | Jan Kiszka | VMSTATE_UINT32(status, mv88w8618_audio_state), |
262 | d5b61ddd | Jan Kiszka | VMSTATE_UINT32(irq_enable, mv88w8618_audio_state), |
263 | d5b61ddd | Jan Kiszka | VMSTATE_UINT32(phys_buf, mv88w8618_audio_state), |
264 | d5b61ddd | Jan Kiszka | VMSTATE_UINT32(target_buffer, mv88w8618_audio_state), |
265 | d5b61ddd | Jan Kiszka | VMSTATE_UINT32(threshold, mv88w8618_audio_state), |
266 | d5b61ddd | Jan Kiszka | VMSTATE_UINT32(play_pos, mv88w8618_audio_state), |
267 | d5b61ddd | Jan Kiszka | VMSTATE_UINT32(last_free, mv88w8618_audio_state), |
268 | d5b61ddd | Jan Kiszka | VMSTATE_UINT32(clock_div, mv88w8618_audio_state), |
269 | d5b61ddd | Jan Kiszka | VMSTATE_END_OF_LIST() |
270 | d5b61ddd | Jan Kiszka | } |
271 | d5b61ddd | Jan Kiszka | }; |
272 | d5b61ddd | Jan Kiszka | |
273 | 999e12bb | Anthony Liguori | static Property mv88w8618_audio_properties[] = {
|
274 | 999e12bb | Anthony Liguori | DEFINE_PROP_PTR("wm8750", mv88w8618_audio_state, wm),
|
275 | 999e12bb | Anthony Liguori | {/* end of list */},
|
276 | 999e12bb | Anthony Liguori | }; |
277 | 999e12bb | Anthony Liguori | |
278 | 999e12bb | Anthony Liguori | static void mv88w8618_audio_class_init(ObjectClass *klass, void *data) |
279 | 999e12bb | Anthony Liguori | { |
280 | 39bffca2 | Anthony Liguori | DeviceClass *dc = DEVICE_CLASS(klass); |
281 | 999e12bb | Anthony Liguori | SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); |
282 | 999e12bb | Anthony Liguori | |
283 | 999e12bb | Anthony Liguori | k->init = mv88w8618_audio_init; |
284 | 39bffca2 | Anthony Liguori | dc->reset = mv88w8618_audio_reset; |
285 | 39bffca2 | Anthony Liguori | dc->vmsd = &mv88w8618_audio_vmsd; |
286 | 39bffca2 | Anthony Liguori | dc->props = mv88w8618_audio_properties; |
287 | 999e12bb | Anthony Liguori | } |
288 | 999e12bb | Anthony Liguori | |
289 | 8c43a6f0 | Andreas Färber | static const TypeInfo mv88w8618_audio_info = { |
290 | 39bffca2 | Anthony Liguori | .name = "mv88w8618_audio",
|
291 | 39bffca2 | Anthony Liguori | .parent = TYPE_SYS_BUS_DEVICE, |
292 | 39bffca2 | Anthony Liguori | .instance_size = sizeof(mv88w8618_audio_state),
|
293 | 39bffca2 | Anthony Liguori | .class_init = mv88w8618_audio_class_init, |
294 | ef07b491 | Andrzej Zaborowski | }; |
295 | ef07b491 | Andrzej Zaborowski | |
296 | 83f7d43a | Andreas Färber | static void mv88w8618_register_types(void) |
297 | ef07b491 | Andrzej Zaborowski | { |
298 | 39bffca2 | Anthony Liguori | type_register_static(&mv88w8618_audio_info); |
299 | ef07b491 | Andrzej Zaborowski | } |
300 | ef07b491 | Andrzej Zaborowski | |
301 | 83f7d43a | Andreas Färber | type_init(mv88w8618_register_types) |