aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712/juli.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ice1712/juli.c')
-rw-r--r--sound/pci/ice1712/juli.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c
index b4e0c16852a6..c51659b9caf6 100644
--- a/sound/pci/ice1712/juli.c
+++ b/sound/pci/ice1712/juli.c
@@ -21,7 +21,7 @@
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * 23 *
24 */ 24 */
25 25
26#include <asm/io.h> 26#include <asm/io.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
@@ -34,9 +34,10 @@
34#include "ice1712.h" 34#include "ice1712.h"
35#include "envy24ht.h" 35#include "envy24ht.h"
36#include "juli.h" 36#include "juli.h"
37
37struct juli_spec { 38struct juli_spec {
38 struct ak4114 *ak4114; 39 struct ak4114 *ak4114;
39 unsigned int analog: 1; 40 unsigned int analog:1;
40}; 41};
41 42
42/* 43/*
@@ -160,14 +161,17 @@ static int get_gpio_val(int rate)
160 return 0; 161 return 0;
161} 162}
162 163
163static void juli_ak4114_write(void *private_data, unsigned char reg, unsigned char val) 164static void juli_ak4114_write(void *private_data, unsigned char reg,
165 unsigned char val)
164{ 166{
165 snd_vt1724_write_i2c((struct snd_ice1712 *)private_data, AK4114_ADDR, reg, val); 167 snd_vt1724_write_i2c((struct snd_ice1712 *)private_data, AK4114_ADDR,
168 reg, val);
166} 169}
167 170
168static unsigned char juli_ak4114_read(void *private_data, unsigned char reg) 171static unsigned char juli_ak4114_read(void *private_data, unsigned char reg)
169{ 172{
170 return snd_vt1724_read_i2c((struct snd_ice1712 *)private_data, AK4114_ADDR, reg); 173 return snd_vt1724_read_i2c((struct snd_ice1712 *)private_data,
174 AK4114_ADDR, reg);
171} 175}
172 176
173/* 177/*
@@ -175,7 +179,7 @@ static unsigned char juli_ak4114_read(void *private_data, unsigned char reg)
175 * to the external rate 179 * to the external rate
176 */ 180 */
177static void juli_spdif_in_open(struct snd_ice1712 *ice, 181static void juli_spdif_in_open(struct snd_ice1712 *ice,
178 struct snd_pcm_substream *substream) 182 struct snd_pcm_substream *substream)
179{ 183{
180 struct juli_spec *spec = ice->spec; 184 struct juli_spec *spec = ice->spec;
181 struct snd_pcm_runtime *runtime = substream->runtime; 185 struct snd_pcm_runtime *runtime = substream->runtime;
@@ -208,7 +212,8 @@ static void juli_akm_write(struct snd_akm4xxx *ak, int chip,
208{ 212{
209 struct snd_ice1712 *ice = ak->private_data[0]; 213 struct snd_ice1712 *ice = ak->private_data[0];
210 214
211 snd_assert(chip == 0, return); 215 if (snd_BUG_ON(chip))
216 return;
212 snd_vt1724_write_i2c(ice, AK4358_ADDR, addr, data); 217 snd_vt1724_write_i2c(ice, AK4358_ADDR, addr, data);
213} 218}
214 219
@@ -571,10 +576,12 @@ static void juli_ak4114_change(struct ak4114 *ak4114, unsigned char c0,
571static int __devinit juli_init(struct snd_ice1712 *ice) 576static int __devinit juli_init(struct snd_ice1712 *ice)
572{ 577{
573 static const unsigned char ak4114_init_vals[] = { 578 static const unsigned char ak4114_init_vals[] = {
574 /* AK4117_REG_PWRDN */ AK4114_RST | AK4114_PWN | AK4114_OCKS0 | AK4114_OCKS1, 579 /* AK4117_REG_PWRDN */ AK4114_RST | AK4114_PWN |
580 AK4114_OCKS0 | AK4114_OCKS1,
575 /* AK4114_REQ_FORMAT */ AK4114_DIF_I24I2S, 581 /* AK4114_REQ_FORMAT */ AK4114_DIF_I24I2S,
576 /* AK4114_REG_IO0 */ AK4114_TX1E, 582 /* AK4114_REG_IO0 */ AK4114_TX1E,
577 /* AK4114_REG_IO1 */ AK4114_EFH_1024 | AK4114_DIT | AK4114_IPS(1), 583 /* AK4114_REG_IO1 */ AK4114_EFH_1024 | AK4114_DIT |
584 AK4114_IPS(1),
578 /* AK4114_REG_INT0_MASK */ 0, 585 /* AK4114_REG_INT0_MASK */ 0,
579 /* AK4114_REG_INT1_MASK */ 0 586 /* AK4114_REG_INT1_MASK */ 0
580 }; 587 };
@@ -604,12 +611,14 @@ static int __devinit juli_init(struct snd_ice1712 *ice)
604 spec->ak4114->check_flags = 0; 611 spec->ak4114->check_flags = 0;
605 612
606#if 0 613#if 0
607 /* it seems that the analog doughter board detection does not work 614/*
608 reliably, so force the analog flag; it should be very rare 615 * it seems that the analog doughter board detection does not work reliably, so
609 to use Juli@ without the analog doughter board */ 616 * force the analog flag; it should be very rare (if ever) to come at Juli@
617 * used without the analog daughter board
618 */
610 spec->analog = (ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT) ? 0 : 1; 619 spec->analog = (ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT) ? 0 : 1;
611#else 620#else
612 spec->analog = 1; 621 spec->analog = 1;
613#endif 622#endif
614 623
615 if (spec->analog) { 624 if (spec->analog) {
@@ -617,14 +626,16 @@ static int __devinit juli_init(struct snd_ice1712 *ice)
617 ice->num_total_dacs = 2; 626 ice->num_total_dacs = 2;
618 ice->num_total_adcs = 2; 627 ice->num_total_adcs = 2;
619 628
620 ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); 629 ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
621 if (! ak) 630 ak = ice->akm;
631 if (!ak)
622 return -ENOMEM; 632 return -ENOMEM;
623 ice->akm_codecs = 1; 633 ice->akm_codecs = 1;
624 if ((err = snd_ice1712_akm4xxx_init(ak, &akm_juli_dac, NULL, ice)) < 0) 634 err = snd_ice1712_akm4xxx_init(ak, &akm_juli_dac, NULL, ice);
635 if (err < 0)
625 return err; 636 return err;
626 } 637 }
627 638
628 /* juli is clocked by Xilinx array */ 639 /* juli is clocked by Xilinx array */
629 ice->hw_rates = &juli_rates_info; 640 ice->hw_rates = &juli_rates_info;
630 ice->is_spdif_master = juli_is_spdif_master; 641 ice->is_spdif_master = juli_is_spdif_master;