aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712/ews.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-01-18 07:36:07 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:30:05 -0500
commit7cda8ba9f4e471dfba914ecf67fd14ebffb17c16 (patch)
tree5786b450d9099809b974929ea356b444c9f2bc07 /sound/pci/ice1712/ews.c
parent797760ab14db4e82a50c06a9916dd5c6147b415b (diff)
[ALSA] ice1712, ice1724 - Code clean up
Clean up ice1712/ice1724 codes. The board-specific data is allocated locally in each code instead of having an ungly union in struct ice1712. Also, fix coding issues in prodigy_hifi.c. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/ice1712/ews.c')
-rw-r--r--sound/pci/ice1712/ews.c91
1 files changed, 68 insertions, 23 deletions
diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c
index 6f65da48e00d..064760d2a027 100644
--- a/sound/pci/ice1712/ews.c
+++ b/sound/pci/ice1712/ews.c
@@ -44,6 +44,11 @@ enum {
44}; 44};
45 45
46 46
47/* additional i2c devices for EWS boards */
48struct ews_spec {
49 struct snd_i2c_device *i2cdevs[3];
50};
51
47/* 52/*
48 * access via i2c mode (for EWX 24/96, EWS 88MT&D) 53 * access via i2c mode (for EWX 24/96, EWS 88MT&D)
49 */ 54 */
@@ -141,15 +146,17 @@ static struct snd_i2c_bit_ops snd_ice1712_ewx_cs8427_bit_ops = {
141/* AK4524 chip select; address 0x48 bit 0-3 */ 146/* AK4524 chip select; address 0x48 bit 0-3 */
142static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mask) 147static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mask)
143{ 148{
149 struct ews_spec *spec = ice->spec;
144 unsigned char data, ndata; 150 unsigned char data, ndata;
145 151
146 snd_assert(chip_mask >= 0 && chip_mask <= 0x0f, return -EINVAL); 152 snd_assert(chip_mask >= 0 && chip_mask <= 0x0f, return -EINVAL);
147 snd_i2c_lock(ice->i2c); 153 snd_i2c_lock(ice->i2c);
148 if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) 154 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1)
149 goto __error; 155 goto __error;
150 ndata = (data & 0xf0) | chip_mask; 156 ndata = (data & 0xf0) | chip_mask;
151 if (ndata != data) 157 if (ndata != data)
152 if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &ndata, 1) != 1) 158 if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF2], &ndata, 1)
159 != 1)
153 goto __error; 160 goto __error;
154 snd_i2c_unlock(ice->i2c); 161 snd_i2c_unlock(ice->i2c);
155 return 0; 162 return 0;
@@ -223,6 +230,7 @@ static void dmx6fire_ak4524_lock(struct snd_akm4xxx *ak, int chip)
223 230
224static void snd_ice1712_ews_cs8404_spdif_write(struct snd_ice1712 *ice, unsigned char bits) 231static void snd_ice1712_ews_cs8404_spdif_write(struct snd_ice1712 *ice, unsigned char bits)
225{ 232{
233 struct ews_spec *spec = ice->spec;
226 unsigned char bytes[2]; 234 unsigned char bytes[2];
227 235
228 snd_i2c_lock(ice->i2c); 236 snd_i2c_lock(ice->i2c);
@@ -230,15 +238,18 @@ static void snd_ice1712_ews_cs8404_spdif_write(struct snd_ice1712 *ice, unsigned
230 case ICE1712_SUBDEVICE_EWS88MT: 238 case ICE1712_SUBDEVICE_EWS88MT:
231 case ICE1712_SUBDEVICE_EWS88MT_NEW: 239 case ICE1712_SUBDEVICE_EWS88MT_NEW:
232 case ICE1712_SUBDEVICE_PHASE88: 240 case ICE1712_SUBDEVICE_PHASE88:
233 if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_CS8404], &bits, 1) != 1) 241 if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_CS8404], &bits, 1)
242 != 1)
234 goto _error; 243 goto _error;
235 break; 244 break;
236 case ICE1712_SUBDEVICE_EWS88D: 245 case ICE1712_SUBDEVICE_EWS88D:
237 if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_88D], bytes, 2) != 2) 246 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], bytes, 2)
247 != 2)
238 goto _error; 248 goto _error;
239 if (bits != bytes[1]) { 249 if (bits != bytes[1]) {
240 bytes[1] = bits; 250 bytes[1] = bits;
241 if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_88D], bytes, 2) != 2) 251 if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_88D],
252 bytes, 2) != 2)
242 goto _error; 253 goto _error;
243 } 254 }
244 break; 255 break;
@@ -411,6 +422,7 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice)
411{ 422{
412 int err; 423 int err;
413 struct snd_akm4xxx *ak; 424 struct snd_akm4xxx *ak;
425 struct ews_spec *spec;
414 426
415 /* set the analog DACs */ 427 /* set the analog DACs */
416 switch (ice->eeprom.subvendor) { 428 switch (ice->eeprom.subvendor) {
@@ -435,6 +447,11 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice)
435 break; 447 break;
436 } 448 }
437 449
450 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
451 if (!spec)
452 return -ENOMEM;
453 ice->spec = spec;
454
438 /* create i2c */ 455 /* create i2c */
439 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { 456 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
440 snd_printk(KERN_ERR "unable to create I2C bus\n"); 457 snd_printk(KERN_ERR "unable to create I2C bus\n");
@@ -446,7 +463,10 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice)
446 /* create i2c devices */ 463 /* create i2c devices */
447 switch (ice->eeprom.subvendor) { 464 switch (ice->eeprom.subvendor) {
448 case ICE1712_SUBDEVICE_DMX6FIRE: 465 case ICE1712_SUBDEVICE_DMX6FIRE:
449 if ((err = snd_i2c_device_create(ice->i2c, "PCF9554", ICE1712_6FIRE_PCF9554_ADDR, &ice->spec.i2cdevs[EWS_I2C_6FIRE])) < 0) { 466 err = snd_i2c_device_create(ice->i2c, "PCF9554",
467 ICE1712_6FIRE_PCF9554_ADDR,
468 &spec->i2cdevs[EWS_I2C_6FIRE]);
469 if (err < 0) {
450 snd_printk(KERN_ERR "PCF9554 initialization failed\n"); 470 snd_printk(KERN_ERR "PCF9554 initialization failed\n");
451 return err; 471 return err;
452 } 472 }
@@ -455,18 +475,30 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice)
455 case ICE1712_SUBDEVICE_EWS88MT: 475 case ICE1712_SUBDEVICE_EWS88MT:
456 case ICE1712_SUBDEVICE_EWS88MT_NEW: 476 case ICE1712_SUBDEVICE_EWS88MT_NEW:
457 case ICE1712_SUBDEVICE_PHASE88: 477 case ICE1712_SUBDEVICE_PHASE88:
458 if ((err = snd_i2c_device_create(ice->i2c, "CS8404", ICE1712_EWS88MT_CS8404_ADDR, &ice->spec.i2cdevs[EWS_I2C_CS8404])) < 0) 478 err = snd_i2c_device_create(ice->i2c, "CS8404",
479 ICE1712_EWS88MT_CS8404_ADDR,
480 &spec->i2cdevs[EWS_I2C_CS8404]);
481 if (err < 0)
459 return err; 482 return err;
460 if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)", ICE1712_EWS88MT_INPUT_ADDR, &ice->spec.i2cdevs[EWS_I2C_PCF1])) < 0) 483 err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)",
484 ICE1712_EWS88MT_INPUT_ADDR,
485 &spec->i2cdevs[EWS_I2C_PCF1]);
486 if (err < 0)
461 return err; 487 return err;
462 if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)", ICE1712_EWS88MT_OUTPUT_ADDR, &ice->spec.i2cdevs[EWS_I2C_PCF2])) < 0) 488 err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)",
489 ICE1712_EWS88MT_OUTPUT_ADDR,
490 &spec->i2cdevs[EWS_I2C_PCF2]);
491 if (err < 0)
463 return err; 492 return err;
464 /* Check if the front module is connected */ 493 /* Check if the front module is connected */
465 if ((err = snd_ice1712_ews88mt_chip_select(ice, 0x0f)) < 0) 494 if ((err = snd_ice1712_ews88mt_chip_select(ice, 0x0f)) < 0)
466 return err; 495 return err;
467 break; 496 break;
468 case ICE1712_SUBDEVICE_EWS88D: 497 case ICE1712_SUBDEVICE_EWS88D:
469 if ((err = snd_i2c_device_create(ice->i2c, "PCF8575", ICE1712_EWS88D_PCF_ADDR, &ice->spec.i2cdevs[EWS_I2C_88D])) < 0) 498 err = snd_i2c_device_create(ice->i2c, "PCF8575",
499 ICE1712_EWS88D_PCF_ADDR,
500 &spec->i2cdevs[EWS_I2C_88D]);
501 if (err < 0)
470 return err; 502 return err;
471 break; 503 break;
472 } 504 }
@@ -506,7 +538,7 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice)
506 } 538 }
507 539
508 /* analog section */ 540 /* analog section */
509 ak = ice->akm = kmalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); 541 ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
510 if (! ak) 542 if (! ak)
511 return -ENOMEM; 543 return -ENOMEM;
512 ice->akm_codecs = 1; 544 ice->akm_codecs = 1;
@@ -604,10 +636,11 @@ static struct snd_kcontrol_new snd_ice1712_ewx2496_controls[] __devinitdata = {
604static int snd_ice1712_ews88mt_output_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 636static int snd_ice1712_ews88mt_output_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
605{ 637{
606 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 638 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
639 struct ews_spec *spec = ice->spec;
607 unsigned char data; 640 unsigned char data;
608 641
609 snd_i2c_lock(ice->i2c); 642 snd_i2c_lock(ice->i2c);
610 if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) { 643 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) {
611 snd_i2c_unlock(ice->i2c); 644 snd_i2c_unlock(ice->i2c);
612 return -EIO; 645 return -EIO;
613 } 646 }
@@ -620,15 +653,17 @@ static int snd_ice1712_ews88mt_output_sense_get(struct snd_kcontrol *kcontrol, s
620static int snd_ice1712_ews88mt_output_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 653static int snd_ice1712_ews88mt_output_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
621{ 654{
622 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 655 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
656 struct ews_spec *spec = ice->spec;
623 unsigned char data, ndata; 657 unsigned char data, ndata;
624 658
625 snd_i2c_lock(ice->i2c); 659 snd_i2c_lock(ice->i2c);
626 if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) { 660 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) {
627 snd_i2c_unlock(ice->i2c); 661 snd_i2c_unlock(ice->i2c);
628 return -EIO; 662 return -EIO;
629 } 663 }
630 ndata = (data & ~ICE1712_EWS88MT_OUTPUT_SENSE) | (ucontrol->value.enumerated.item[0] ? ICE1712_EWS88MT_OUTPUT_SENSE : 0); 664 ndata = (data & ~ICE1712_EWS88MT_OUTPUT_SENSE) | (ucontrol->value.enumerated.item[0] ? ICE1712_EWS88MT_OUTPUT_SENSE : 0);
631 if (ndata != data && snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &ndata, 1) != 1) { 665 if (ndata != data && snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF2],
666 &ndata, 1) != 1) {
632 snd_i2c_unlock(ice->i2c); 667 snd_i2c_unlock(ice->i2c);
633 return -EIO; 668 return -EIO;
634 } 669 }
@@ -640,12 +675,13 @@ static int snd_ice1712_ews88mt_output_sense_put(struct snd_kcontrol *kcontrol, s
640static int snd_ice1712_ews88mt_input_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 675static int snd_ice1712_ews88mt_input_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
641{ 676{
642 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 677 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
678 struct ews_spec *spec = ice->spec;
643 int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 679 int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
644 unsigned char data; 680 unsigned char data;
645 681
646 snd_assert(channel >= 0 && channel <= 7, return 0); 682 snd_assert(channel >= 0 && channel <= 7, return 0);
647 snd_i2c_lock(ice->i2c); 683 snd_i2c_lock(ice->i2c);
648 if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { 684 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) {
649 snd_i2c_unlock(ice->i2c); 685 snd_i2c_unlock(ice->i2c);
650 return -EIO; 686 return -EIO;
651 } 687 }
@@ -659,17 +695,19 @@ static int snd_ice1712_ews88mt_input_sense_get(struct snd_kcontrol *kcontrol, st
659static int snd_ice1712_ews88mt_input_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 695static int snd_ice1712_ews88mt_input_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
660{ 696{
661 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 697 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
698 struct ews_spec *spec = ice->spec;
662 int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 699 int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
663 unsigned char data, ndata; 700 unsigned char data, ndata;
664 701
665 snd_assert(channel >= 0 && channel <= 7, return 0); 702 snd_assert(channel >= 0 && channel <= 7, return 0);
666 snd_i2c_lock(ice->i2c); 703 snd_i2c_lock(ice->i2c);
667 if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { 704 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) {
668 snd_i2c_unlock(ice->i2c); 705 snd_i2c_unlock(ice->i2c);
669 return -EIO; 706 return -EIO;
670 } 707 }
671 ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel)); 708 ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel));
672 if (ndata != data && snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_PCF1], &ndata, 1) != 1) { 709 if (ndata != data && snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF1],
710 &ndata, 1) != 1) {
673 snd_i2c_unlock(ice->i2c); 711 snd_i2c_unlock(ice->i2c);
674 return -EIO; 712 return -EIO;
675 } 713 }
@@ -704,12 +742,13 @@ static struct snd_kcontrol_new snd_ice1712_ews88mt_output_sense __devinitdata =
704static int snd_ice1712_ews88d_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 742static int snd_ice1712_ews88d_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
705{ 743{
706 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 744 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
745 struct ews_spec *spec = ice->spec;
707 int shift = kcontrol->private_value & 0xff; 746 int shift = kcontrol->private_value & 0xff;
708 int invert = (kcontrol->private_value >> 8) & 1; 747 int invert = (kcontrol->private_value >> 8) & 1;
709 unsigned char data[2]; 748 unsigned char data[2];
710 749
711 snd_i2c_lock(ice->i2c); 750 snd_i2c_lock(ice->i2c);
712 if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_88D], data, 2) != 2) { 751 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) {
713 snd_i2c_unlock(ice->i2c); 752 snd_i2c_unlock(ice->i2c);
714 return -EIO; 753 return -EIO;
715 } 754 }
@@ -724,13 +763,14 @@ static int snd_ice1712_ews88d_control_get(struct snd_kcontrol *kcontrol, struct
724static int snd_ice1712_ews88d_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 763static int snd_ice1712_ews88d_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
725{ 764{
726 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 765 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
766 struct ews_spec *spec = ice->spec;
727 int shift = kcontrol->private_value & 0xff; 767 int shift = kcontrol->private_value & 0xff;
728 int invert = (kcontrol->private_value >> 8) & 1; 768 int invert = (kcontrol->private_value >> 8) & 1;
729 unsigned char data[2], ndata[2]; 769 unsigned char data[2], ndata[2];
730 int change; 770 int change;
731 771
732 snd_i2c_lock(ice->i2c); 772 snd_i2c_lock(ice->i2c);
733 if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_88D], data, 2) != 2) { 773 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) {
734 snd_i2c_unlock(ice->i2c); 774 snd_i2c_unlock(ice->i2c);
735 return -EIO; 775 return -EIO;
736 } 776 }
@@ -743,7 +783,8 @@ static int snd_ice1712_ews88d_control_put(struct snd_kcontrol *kcontrol, struct
743 ndata[shift >> 3] |= (1 << (shift & 7)); 783 ndata[shift >> 3] |= (1 << (shift & 7));
744 } 784 }
745 change = (data[shift >> 3] != ndata[shift >> 3]); 785 change = (data[shift >> 3] != ndata[shift >> 3]);
746 if (change && snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_88D], data, 2) != 2) { 786 if (change &&
787 snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) {
747 snd_i2c_unlock(ice->i2c); 788 snd_i2c_unlock(ice->i2c);
748 return -EIO; 789 return -EIO;
749 } 790 }
@@ -777,11 +818,13 @@ static struct snd_kcontrol_new snd_ice1712_ews88d_controls[] __devinitdata = {
777static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg) 818static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg)
778{ 819{
779 unsigned char byte; 820 unsigned char byte;
821 struct ews_spec *spec = ice->spec;
822
780 snd_i2c_lock(ice->i2c); 823 snd_i2c_lock(ice->i2c);
781 byte = reg; 824 byte = reg;
782 snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], &byte, 1); 825 snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1);
783 byte = 0; 826 byte = 0;
784 if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { 827 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) {
785 snd_i2c_unlock(ice->i2c); 828 snd_i2c_unlock(ice->i2c);
786 printk(KERN_ERR "cannot read pca\n"); 829 printk(KERN_ERR "cannot read pca\n");
787 return -EIO; 830 return -EIO;
@@ -793,10 +836,12 @@ static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg
793static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data) 836static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data)
794{ 837{
795 unsigned char bytes[2]; 838 unsigned char bytes[2];
839 struct ews_spec *spec = ice->spec;
840
796 snd_i2c_lock(ice->i2c); 841 snd_i2c_lock(ice->i2c);
797 bytes[0] = reg; 842 bytes[0] = reg;
798 bytes[1] = data; 843 bytes[1] = data;
799 if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], bytes, 2) != 2) { 844 if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], bytes, 2) != 2) {
800 snd_i2c_unlock(ice->i2c); 845 snd_i2c_unlock(ice->i2c);
801 return -EIO; 846 return -EIO;
802 } 847 }