Lines Matching defs:ak4114
28 #include <sound/ak4114.h>
39 static void ak4114_init_regs(struct ak4114 *chip);
41 static void reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char val)
43 ak4114->write(ak4114->private_data, reg, val);
45 ak4114->regmap[reg] = val;
47 ak4114->txcsb[reg-AK4114_REG_TXCSB0] = val;
50 static inline unsigned char reg_read(struct ak4114 *ak4114, unsigned char reg)
52 return ak4114->read(ak4114->private_data, reg);
56 static void snd_ak4114_free(struct ak4114 *chip)
67 struct ak4114 *chip = device->device_data;
75 void *private_data, struct ak4114 **r_ak4114)
77 struct ak4114 *chip;
116 void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char mask, unsigned char val)
125 static void ak4114_init_regs(struct ak4114 *chip)
143 void snd_ak4114_reinit(struct ak4114 *chip)
182 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
198 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
220 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
236 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
247 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
258 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
292 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
314 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
330 .private_value = offsetof(struct ak4114, parity_errors),
338 .private_value = offsetof(struct ak4114, v_bit_errors),
346 .private_value = offsetof(struct ak4114, ccrc_errors),
354 .private_value = offsetof(struct ak4114, qcrc_errors),
444 struct ak4114 *ak4114 = entry->private_data;
446 /* all ak4114 registers 0x00 - 0x1f */
448 val = reg_read(ak4114, reg);
453 static void snd_ak4114_proc_init(struct ak4114 *ak4114)
456 if (!snd_card_proc_new(ak4114->card, "ak4114", &entry))
457 snd_info_set_text_ops(entry, ak4114, snd_ak4114_proc_regs_read);
460 int snd_ak4114_build(struct ak4114 *ak4114,
470 ak4114->playback_substream = ply_substream;
471 ak4114->capture_substream = cap_substream;
473 kctl = snd_ctl_new1(&snd_ak4114_iec958_controls[idx], ak4114);
479 ak4114->kctls[idx] = NULL;
488 err = snd_ctl_add(ak4114->card, kctl);
491 ak4114->kctls[idx] = kctl;
493 snd_ak4114_proc_init(ak4114);
495 schedule_delayed_work(&ak4114->work, HZ / 10);
500 static void ak4114_notify(struct ak4114 *ak4114,
504 if (!ak4114->kctls[0])
508 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
509 &ak4114->kctls[0]->id);
511 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
512 &ak4114->kctls[1]->id);
514 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
515 &ak4114->kctls[2]->id);
517 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
518 &ak4114->kctls[3]->id);
522 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
523 &ak4114->kctls[4]->id);
526 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
527 &ak4114->kctls[9]->id);
529 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
530 &ak4114->kctls[10]->id);
533 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
534 &ak4114->kctls[11]->id);
536 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
537 &ak4114->kctls[12]->id);
539 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
540 &ak4114->kctls[13]->id);
542 snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
543 &ak4114->kctls[14]->id);
546 int snd_ak4114_external_rate(struct ak4114 *ak4114)
550 rcs1 = reg_read(ak4114, AK4114_REG_RCS1);
554 int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags)
556 struct snd_pcm_runtime *runtime = ak4114->capture_substream ? ak4114->capture_substream->runtime : NULL;
562 rcs1 = reg_read(ak4114, AK4114_REG_RCS1);
565 rcs0 = reg_read(ak4114, AK4114_REG_RCS0);
566 spin_lock_irqsave(&ak4114->lock, _flags);
568 ak4114->parity_errors++;
570 ak4114->v_bit_errors++;
572 ak4114->ccrc_errors++;
574 ak4114->qcrc_errors++;
575 c0 = (ak4114->rcs0 & (AK4114_QINT | AK4114_CINT | AK4114_PEM | AK4114_AUDION | AK4114_AUTO | AK4114_UNLCK)) ^
577 c1 = (ak4114->rcs1 & 0xf0) ^ (rcs1 & 0xf0);
578 ak4114->rcs0 = rcs0 & ~(AK4114_QINT | AK4114_CINT);
579 ak4114->rcs1 = rcs1;
580 spin_unlock_irqrestore(&ak4114->lock, _flags);
582 ak4114_notify(ak4114, rcs0, rcs1, c0, c1);
583 if (ak4114->change_callback && (c0 | c1) != 0)
584 ak4114->change_callback(ak4114, c0, c1);
590 snd_pcm_stream_lock_irqsave(ak4114->capture_substream, _flags);
591 if (snd_pcm_running(ak4114->capture_substream)) {
593 snd_pcm_stop(ak4114->capture_substream, SNDRV_PCM_STATE_DRAINING);
596 snd_pcm_stream_unlock_irqrestore(ak4114->capture_substream, _flags);
603 struct ak4114 *chip = container_of(work, struct ak4114, work.work);