diff --git a/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c b/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c
index d1f057e..e9d62ba 100644
a
|
b
|
ice1712_setup(ice1712 *ice)
|
263 | 263 | ice->CommLines.data_in = 0; |
264 | 264 | ice->CommLines.data_out = DELTA66_DOUT; |
265 | 265 | ice->CommLines.cs_mask = DELTA66_CLK | DELTA66_DOUT |
266 | | | DELTA66_CODEC_CS_0 | DELTA66_CODEC_CS_1; |
| 266 | | DELTA66_CS_MASK; |
267 | 267 | break; |
268 | 268 | case ICE1712_SUBDEVICE_DELTA410 : |
269 | 269 | case ICE1712_SUBDEVICE_AUDIOPHILE_2496 : |
… |
… |
ice1712_setup(ice1712 *ice)
|
272 | 272 | ice->CommLines.data_in = AP2496_DIN; |
273 | 273 | ice->CommLines.data_out = AP2496_DOUT; |
274 | 274 | ice->CommLines.cs_mask = AP2496_CLK | AP2496_DIN |
275 | | | AP2496_DOUT | AP2496_SPDIF_CS | AP2496_CODEC_CS; |
| 275 | | AP2496_DOUT | AP2496_CS_MASK; |
276 | 276 | break; |
277 | 277 | case ICE1712_SUBDEVICE_DELTA1010 : |
278 | 278 | case ICE1712_SUBDEVICE_DELTA1010LT : |
… |
… |
ice1712_setup(ice1712 *ice)
|
286 | 286 | ice->CommLines.clock = VX442_CLK; |
287 | 287 | ice->CommLines.data_in = VX442_DIN; |
288 | 288 | ice->CommLines.data_out = VX442_DOUT; |
289 | | ice->CommLines.cs_mask = VX442_SPDIF_CS | VX442_CODEC_CS_0 |
290 | | | VX442_CODEC_CS_1; |
| 289 | ice->CommLines.cs_mask = VX442_CLK | VX442_DIN | VX442_DOUT |
| 290 | | VX442_CS_MASK; |
291 | 291 | break; |
292 | 292 | } |
293 | 293 | |
diff --git a/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h b/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h
index 7212255..b848a18 100644
a
|
b
|
extern ice1712 cards[NUM_CARDS];
|
193 | 193 | #define DELTA66_CLK 0x20 // clock |
194 | 194 | #define DELTA66_CODEC_CS_0 0x40 // AK4524 #0 |
195 | 195 | #define DELTA66_CODEC_CS_1 0x80 // AK4524 #1 |
| 196 | #define DELTA66_CS_MASK 0xD0 // Chip Select mask |
196 | 197 | |
197 | 198 | //For AudioPhile 2496 / Delta 410 |
198 | 199 | #define AP2496_CLK 0x02 // clock |
… |
… |
extern ice1712 cards[NUM_CARDS];
|
200 | 201 | #define AP2496_DOUT 0x08 // data output |
201 | 202 | #define AP2496_SPDIF_CS 0x10 // CS8427 chip select |
202 | 203 | #define AP2496_CODEC_CS 0x20 // AK4528 chip select |
| 204 | #define AP2496_CS_MASK 0x30 // Chip Select Mask |
203 | 205 | |
204 | 206 | //For Delta 1010 LT |
205 | 207 | #define DELTA1010LT_CLK 0x02 // clock |
… |
… |
extern ice1712 cards[NUM_CARDS];
|
210 | 212 | #define DELTA1010LT_CODEC_CS_2 0x20 // AK4524 #2 |
211 | 213 | #define DELTA1010LT_CODEC_CS_3 0x30 // AK4524 #3 |
212 | 214 | #define DELTA1010LT_SPDIF_CS 0x40 // CS8427 |
213 | | #define DELTA1010LT_CS_NONE 0x50 // All CS deselected |
| 215 | #define DELTA1010LT_CS_NONE 0x70 // All CS deselected |
214 | 216 | |
215 | 217 | //For VX442 |
216 | 218 | #define VX442_CLK 0x02 // clock |
… |
… |
extern ice1712 cards[NUM_CARDS];
|
219 | 221 | #define VX442_SPDIF_CS 0x10 // CS8427 |
220 | 222 | #define VX442_CODEC_CS_0 0x20 // ?? #0 |
221 | 223 | #define VX442_CODEC_CS_1 0x40 // ?? #1 |
| 224 | #define VX442_CS_MASK 0x70 // Chip Select Mask |
222 | 225 | |
223 | 226 | #define GPIO_I2C_DELAY 5 //Clock Delay for writing |
224 | 227 | //I2C data throw GPIO |
diff --git a/src/add-ons/kernel/drivers/audio/ice1712/io.c b/src/add-ons/kernel/drivers/audio/ice1712/io.c
index 89fa607..81990a2 100644
a
|
b
|
|
16 | 16 | extern pci_module_info *pci; |
17 | 17 | |
18 | 18 | static void ak45xx_write_gpio(ice1712 *ice, uint8 reg_addr, |
19 | | uint8 data, uint8 chip_select); |
| 19 | uint8 data, uint8 chip_select, uint8 invert_cs); |
20 | 20 | |
21 | 21 | static void cs84xx_write_gpio(ice1712 *ice, uint8 reg_addr, |
22 | | uint8 data, uint8 chip_select); |
| 22 | uint8 data, uint8 chip_select, uint8 invert_cs); |
23 | 23 | |
24 | 24 | static uint8 ak45xx_read_gpio(ice1712 *ice, uint8 reg_addr, |
25 | | uint8 chip_select) {return 0;} //Unimplemented |
| 25 | uint8 chip_select, uint8 invert_cs) |
| 26 | {return 0;} //Unimplemented |
26 | 27 | |
27 | 28 | static uint8 cs84xx_read_gpio(ice1712 *ice, uint8 reg_addr, |
28 | | uint8 chip_select); |
| 29 | uint8 chip_select, uint8 invert_cs); |
29 | 30 | |
30 | 31 | static void write_gpio_byte(ice1712 *ice, uint8 data, uint8 gpio_data); |
31 | 32 | static uint8 read_gpio_byte(ice1712 *ice, uint8 gpio_data); |
… |
… |
codec_write(ice1712 *ice, uint8 reg_addr, uint8 data)
|
304 | 305 | switch (ice->product) { |
305 | 306 | case ICE1712_SUBDEVICE_DELTA66: |
306 | 307 | case ICE1712_SUBDEVICE_DELTA44: |
307 | | ak45xx_write_gpio(ice, reg_addr, data, DELTA66_CODEC_CS_0); |
308 | | ak45xx_write_gpio(ice, reg_addr, data, DELTA66_CODEC_CS_1); |
| 308 | ak45xx_write_gpio(ice, reg_addr, data, DELTA66_CODEC_CS_0, 0); |
| 309 | ak45xx_write_gpio(ice, reg_addr, data, DELTA66_CODEC_CS_1, 0); |
309 | 310 | break; |
310 | 311 | case ICE1712_SUBDEVICE_DELTA410: |
311 | 312 | case ICE1712_SUBDEVICE_AUDIOPHILE_2496: |
312 | 313 | case ICE1712_SUBDEVICE_DELTADIO2496: |
313 | | ak45xx_write_gpio(ice, reg_addr, data, AP2496_CODEC_CS); |
| 314 | ak45xx_write_gpio(ice, reg_addr, data, AP2496_CODEC_CS, 0); |
314 | 315 | break; |
315 | 316 | case ICE1712_SUBDEVICE_DELTA1010: |
316 | 317 | case ICE1712_SUBDEVICE_DELTA1010LT: |
317 | | ak45xx_write_gpio(ice, reg_addr, data, DELTA1010LT_CODEC_CS_0); |
318 | | ak45xx_write_gpio(ice, reg_addr, data, DELTA1010LT_CODEC_CS_1); |
319 | | ak45xx_write_gpio(ice, reg_addr, data, DELTA1010LT_CODEC_CS_2); |
320 | | ak45xx_write_gpio(ice, reg_addr, data, DELTA1010LT_CODEC_CS_3); |
| 318 | ak45xx_write_gpio(ice, reg_addr, data, DELTA1010LT_CODEC_CS_0, |
| 319 | DELTA1010LT_CS_NONE); |
| 320 | ak45xx_write_gpio(ice, reg_addr, data, DELTA1010LT_CODEC_CS_1, |
| 321 | DELTA1010LT_CS_NONE); |
| 322 | ak45xx_write_gpio(ice, reg_addr, data, DELTA1010LT_CODEC_CS_2, |
| 323 | DELTA1010LT_CS_NONE); |
| 324 | ak45xx_write_gpio(ice, reg_addr, data, DELTA1010LT_CODEC_CS_3, |
| 325 | DELTA1010LT_CS_NONE); |
321 | 326 | break; |
322 | 327 | case ICE1712_SUBDEVICE_VX442: |
323 | | ak45xx_write_gpio(ice, reg_addr, data, VX442_CODEC_CS_0); |
324 | | ak45xx_write_gpio(ice, reg_addr, data, VX442_CODEC_CS_1); |
| 328 | ak45xx_write_gpio(ice, reg_addr, data, VX442_CODEC_CS_0, 0); |
| 329 | ak45xx_write_gpio(ice, reg_addr, data, VX442_CODEC_CS_1, 0); |
325 | 330 | break; |
326 | 331 | } |
327 | 332 | } |
… |
… |
spdif_write(ice1712 *ice, uint8 reg_addr, uint8 data)
|
340 | 345 | case ICE1712_SUBDEVICE_DELTA44: |
341 | 346 | break; |
342 | 347 | case ICE1712_SUBDEVICE_AUDIOPHILE_2496: |
343 | | cs84xx_write_gpio(ice, reg_addr, data, AP2496_SPDIF_CS); |
| 348 | cs84xx_write_gpio(ice, reg_addr, data, AP2496_SPDIF_CS, 0); |
344 | 349 | break; |
345 | 350 | case ICE1712_SUBDEVICE_DELTA410: |
346 | 351 | break; |
347 | 352 | case ICE1712_SUBDEVICE_DELTA1010LT: |
348 | | cs84xx_write_gpio(ice, reg_addr, data, DELTA1010LT_SPDIF_CS); |
| 353 | cs84xx_write_gpio(ice, reg_addr, data, DELTA1010LT_SPDIF_CS, |
| 354 | DELTA1010LT_CS_NONE); |
349 | 355 | break; |
350 | 356 | case ICE1712_SUBDEVICE_VX442: |
351 | | cs84xx_write_gpio(ice, reg_addr, data, VX442_SPDIF_CS); |
| 357 | cs84xx_write_gpio(ice, reg_addr, data, VX442_SPDIF_CS, 0); |
352 | 358 | break; |
353 | 359 | } |
354 | 360 | } |
… |
… |
codec_read(ice1712 *ice, uint8 reg_addr)
|
361 | 367 | switch (ice->product) { |
362 | 368 | case ICE1712_SUBDEVICE_DELTA66: |
363 | 369 | case ICE1712_SUBDEVICE_DELTA44: |
364 | | val = ak45xx_read_gpio(ice, reg_addr, DELTA66_CODEC_CS_0); |
| 370 | val = ak45xx_read_gpio(ice, reg_addr, DELTA66_CODEC_CS_0, 0); |
365 | 371 | break; |
366 | 372 | case ICE1712_SUBDEVICE_DELTA410: |
367 | 373 | case ICE1712_SUBDEVICE_AUDIOPHILE_2496: |
368 | 374 | case ICE1712_SUBDEVICE_DELTADIO2496: |
369 | | val = ak45xx_read_gpio(ice, reg_addr, AP2496_CODEC_CS); |
| 375 | val = ak45xx_read_gpio(ice, reg_addr, AP2496_CODEC_CS, 0); |
370 | 376 | break; |
371 | 377 | case ICE1712_SUBDEVICE_DELTA1010: |
372 | 378 | case ICE1712_SUBDEVICE_DELTA1010LT: |
373 | | val = ak45xx_read_gpio(ice, reg_addr, DELTA1010LT_CODEC_CS_0); |
| 379 | val = ak45xx_read_gpio(ice, reg_addr, DELTA1010LT_CODEC_CS_0, |
| 380 | DELTA1010LT_CS_NONE); |
374 | 381 | break; |
375 | 382 | case ICE1712_SUBDEVICE_VX442: |
376 | | val = ak45xx_read_gpio(ice, reg_addr, VX442_CODEC_CS_0); |
| 383 | val = ak45xx_read_gpio(ice, reg_addr, VX442_CODEC_CS_0, 0); |
377 | 384 | break; |
378 | 385 | } |
379 | 386 | |
… |
… |
spdif_read(ice1712 *ice, uint8 reg_addr)
|
395 | 402 | case ICE1712_SUBDEVICE_DELTA44: |
396 | 403 | break; |
397 | 404 | case ICE1712_SUBDEVICE_AUDIOPHILE_2496: |
398 | | val = cs84xx_read_gpio(ice, reg_addr, AP2496_SPDIF_CS); |
| 405 | val = cs84xx_read_gpio(ice, reg_addr, AP2496_SPDIF_CS, 0); |
399 | 406 | break; |
400 | 407 | case ICE1712_SUBDEVICE_DELTA410: |
401 | 408 | break; |
402 | 409 | case ICE1712_SUBDEVICE_DELTA1010LT: |
403 | | val = cs84xx_read_gpio(ice, reg_addr, DELTA1010LT_SPDIF_CS); |
| 410 | val = cs84xx_read_gpio(ice, reg_addr, DELTA1010LT_SPDIF_CS, |
| 411 | DELTA1010LT_CS_NONE); |
404 | 412 | break; |
405 | 413 | case ICE1712_SUBDEVICE_VX442: |
406 | | val = cs84xx_read_gpio(ice, reg_addr, VX442_SPDIF_CS); |
| 414 | val = cs84xx_read_gpio(ice, reg_addr, VX442_SPDIF_CS, 0); |
407 | 415 | break; |
408 | 416 | } |
409 | 417 | |
… |
… |
read_gpio_byte(ice1712 *ice, uint8 gpio_data)
|
458 | 466 | } |
459 | 467 | |
460 | 468 | void |
461 | | ak45xx_write_gpio(ice1712 *ice, uint8 reg_addr, uint8 data, uint8 chip_select) |
| 469 | ak45xx_write_gpio(ice1712 *ice, uint8 reg_addr, uint8 data, |
| 470 | uint8 chip_select, uint8 invert_cs) |
462 | 471 | { |
463 | 472 | uint8 tmp; |
464 | 473 | |
465 | 474 | tmp = read_gpio(ice); |
466 | 475 | tmp |= ice->CommLines.cs_mask; |
467 | | tmp &= ~(chip_select); |
| 476 | |
| 477 | if (invert_cs != 0) { |
| 478 | tmp &= ~invert_cs; |
| 479 | tmp |= chip_select; |
| 480 | } else { |
| 481 | tmp &= ~chip_select; |
| 482 | } |
468 | 483 | |
469 | 484 | write_gpio(ice, tmp); |
470 | 485 | snooze(GPIO_I2C_DELAY); |
… |
… |
ak45xx_write_gpio(ice1712 *ice, uint8 reg_addr, uint8 data, uint8 chip_select)
|
473 | 488 | | (reg_addr & 0x1F), tmp); |
474 | 489 | write_gpio_byte(ice, data, tmp); |
475 | 490 | |
476 | | tmp |= chip_select; |
| 491 | if (invert_cs != 0) { |
| 492 | tmp |= invert_cs; |
| 493 | } else { |
| 494 | tmp |= chip_select; |
| 495 | } |
477 | 496 | write_gpio(ice, tmp); |
478 | 497 | snooze(GPIO_I2C_DELAY); |
479 | 498 | } |
480 | 499 | |
481 | 500 | void |
482 | | cs84xx_write_gpio(ice1712 *ice, uint8 reg_addr, uint8 data, uint8 chip_select) |
| 501 | cs84xx_write_gpio(ice1712 *ice, uint8 reg_addr, uint8 data, |
| 502 | uint8 chip_select, uint8 invert_cs) |
483 | 503 | { |
484 | 504 | uint8 tmp; |
485 | 505 | |
486 | 506 | tmp = read_gpio(ice); |
487 | 507 | tmp |= ice->CommLines.cs_mask; |
488 | | tmp &= ~(chip_select); |
| 508 | |
| 509 | if (invert_cs != 0) { |
| 510 | tmp &= ~invert_cs; |
| 511 | tmp |= chip_select; |
| 512 | } else { |
| 513 | tmp &= ~chip_select; |
| 514 | } |
489 | 515 | |
490 | 516 | write_gpio(ice, tmp); |
491 | 517 | snooze(GPIO_I2C_DELAY); |
… |
… |
cs84xx_write_gpio(ice1712 *ice, uint8 reg_addr, uint8 data, uint8 chip_select)
|
494 | 520 | write_gpio_byte(ice, reg_addr & 0x7F, tmp); //Do not Increment |
495 | 521 | write_gpio_byte(ice, data, tmp); |
496 | 522 | |
497 | | tmp |= chip_select; |
| 523 | if (invert_cs != 0) { |
| 524 | tmp |= invert_cs; |
| 525 | } else { |
| 526 | tmp |= chip_select; |
| 527 | } |
498 | 528 | write_gpio(ice, tmp); |
499 | 529 | snooze(GPIO_I2C_DELAY); |
500 | 530 | } |
501 | 531 | |
502 | 532 | uint8 |
503 | | cs84xx_read_gpio(ice1712 *ice, uint8 reg_addr, uint8 chip_select) |
| 533 | cs84xx_read_gpio(ice1712 *ice, uint8 reg_addr, uint8 chip_select, |
| 534 | uint8 invert_cs) |
504 | 535 | { |
505 | 536 | uint8 tmp, data; |
506 | 537 | |
507 | 538 | tmp = read_gpio(ice); |
508 | 539 | tmp |= ice->CommLines.cs_mask; |
509 | | tmp &= ~(chip_select); |
| 540 | |
| 541 | if (invert_cs != 0) { |
| 542 | tmp &= ~invert_cs; |
| 543 | tmp |= chip_select; |
| 544 | } else { |
| 545 | tmp &= ~chip_select; |
| 546 | } |
510 | 547 | |
511 | 548 | write_gpio(ice, tmp); |
512 | 549 | snooze(GPIO_I2C_DELAY); |
… |
… |
cs84xx_read_gpio(ice1712 *ice, uint8 reg_addr, uint8 chip_select)
|
515 | 552 | tmp); //For writing the MAP |
516 | 553 | write_gpio_byte(ice, reg_addr & 0x7F, tmp); //Do not Increment |
517 | 554 | |
518 | | tmp |= chip_select; //Deselect the chip |
| 555 | //Deselect the chip |
| 556 | if (invert_cs != 0) { |
| 557 | tmp |= invert_cs; |
| 558 | } else { |
| 559 | tmp |= chip_select; |
| 560 | } |
519 | 561 | write_gpio(ice, tmp); |
520 | 562 | snooze(GPIO_I2C_DELAY); |
521 | 563 | |
522 | | tmp &= ~(chip_select); //Reselect the chip |
| 564 | if (invert_cs != 0) { |
| 565 | tmp &= ~invert_cs; |
| 566 | tmp |= chip_select; |
| 567 | } else { |
| 568 | tmp &= ~chip_select; |
| 569 | } |
523 | 570 | write_gpio(ice, tmp); |
524 | 571 | snooze(GPIO_I2C_DELAY); |
525 | 572 | |
… |
… |
cs84xx_read_gpio(ice1712 *ice, uint8 reg_addr, uint8 chip_select)
|
527 | 574 | tmp); //For writing the MAP |
528 | 575 | data = read_gpio_byte(ice, tmp); //For reading |
529 | 576 | |
530 | | tmp |= chip_select; //Deselect the chip |
| 577 | //Deselect the chip |
| 578 | if (invert_cs != 0) { |
| 579 | tmp |= invert_cs; |
| 580 | } else { |
| 581 | tmp |= chip_select; |
| 582 | } |
531 | 583 | write_gpio(ice, tmp); |
532 | 584 | |
533 | 585 | return data; |