Lines Matching defs:ak4117
14 #include <sound/ak4117.h>
25 static void reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char val)
27 ak4117->write(ak4117->private_data, reg, val);
28 if (reg < sizeof(ak4117->regmap))
29 ak4117->regmap[reg] = val;
32 static inline unsigned char reg_read(struct ak4117 *ak4117, unsigned char reg)
34 return ak4117->read(ak4117->private_data, reg);
38 static void reg_dump(struct ak4117 *ak4117)
44 printk(KERN_DEBUG "reg[%02x] = %02x (%02x)\n", i, reg_read(ak4117, i), i < sizeof(ak4117->regmap) ? ak4117->regmap[i] : 0);
48 static void snd_ak4117_free(struct ak4117 *chip)
56 struct ak4117 *chip = device->device_data;
62 const unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117)
64 struct ak4117 *chip;
101 void snd_ak4117_reg_write(struct ak4117 *chip, unsigned char reg, unsigned char mask, unsigned char val)
108 void snd_ak4117_reinit(struct ak4117 *chip)
155 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
170 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
192 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
201 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
227 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
243 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
277 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
299 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
410 int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *cap_substream)
418 ak4117->substream = cap_substream;
420 kctl = snd_ctl_new1(&snd_ak4117_iec958_controls[idx], ak4117);
425 err = snd_ctl_add(ak4117->card, kctl);
428 ak4117->kctls[idx] = kctl;
433 int snd_ak4117_external_rate(struct ak4117 *ak4117)
437 rcs1 = reg_read(ak4117, AK4117_REG_RCS1);
441 int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags)
443 struct snd_pcm_runtime *runtime = ak4117->substream ? ak4117->substream->runtime : NULL;
449 rcs1 = reg_read(ak4117, AK4117_REG_RCS1);
452 rcs0 = reg_read(ak4117, AK4117_REG_RCS0);
453 rcs2 = reg_read(ak4117, AK4117_REG_RCS2);
455 spin_lock_irqsave(&ak4117->lock, _flags);
457 ak4117->errors[AK4117_PARITY_ERRORS]++;
459 ak4117->errors[AK4117_V_BIT_ERRORS]++;
461 ak4117->errors[AK4117_CCRC_ERRORS]++;
463 ak4117->errors[AK4117_QCRC_ERRORS]++;
464 c0 = (ak4117->rcs0 & (AK4117_QINT | AK4117_CINT | AK4117_STC | AK4117_AUDION | AK4117_AUTO | AK4117_UNLCK)) ^
466 c1 = (ak4117->rcs1 & (AK4117_DTSCD | AK4117_NPCM | AK4117_PEM | 0x0f)) ^
468 ak4117->rcs0 = rcs0 & ~(AK4117_QINT | AK4117_CINT | AK4117_STC);
469 ak4117->rcs1 = rcs1;
470 ak4117->rcs2 = rcs2;
471 spin_unlock_irqrestore(&ak4117->lock, _flags);
474 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[0]->id);
476 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[1]->id);
478 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[2]->id);
480 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[3]->id);
484 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[4]->id);
487 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[6]->id);
489 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[8]->id);
492 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[9]->id);
494 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[10]->id);
496 snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[11]->id);
498 if (ak4117->change_callback && (c0 | c1) != 0)
499 ak4117->change_callback(ak4117, c0, c1);
505 snd_pcm_stream_lock_irqsave(ak4117->substream, _flags);
506 if (snd_pcm_running(ak4117->substream)) {
508 snd_pcm_stop(ak4117->substream, SNDRV_PCM_STATE_DRAINING);
512 snd_pcm_stream_unlock_irqrestore(ak4117->substream, _flags);
519 struct ak4117 *chip = from_timer(chip, t, timer);