ak4117
void (*change_callback)(struct ak4117 *ak4117, unsigned char c0, unsigned char c1);
const unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117);
void snd_ak4117_reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char mask, unsigned char val);
void snd_ak4117_reinit(struct ak4117 *ak4117);
int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *capture_substream);
int snd_ak4117_external_rate(struct ak4117 *ak4117);
int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags);
struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
static void reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char val)
struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
ak4117->write(ak4117->private_data, reg, val);
if (reg < sizeof(ak4117->regmap))
struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
ak4117->regmap[reg] = val;
static inline unsigned char reg_read(struct ak4117 *ak4117, unsigned char reg)
return ak4117->read(ak4117->private_data, reg);
static void snd_ak4117_free(struct ak4117 *chip)
int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *cap_substream)
ak4117->substream = cap_substream;
kctl = snd_ctl_new1(&snd_ak4117_iec958_controls[idx], ak4117);
err = snd_ctl_add(ak4117->card, kctl);
ak4117->kctls[idx] = kctl;
int snd_ak4117_external_rate(struct ak4117 *ak4117)
rcs1 = reg_read(ak4117, AK4117_REG_RCS1);
int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags)
struct snd_pcm_runtime *runtime = ak4117->substream ? ak4117->substream->runtime : NULL;
rcs1 = reg_read(ak4117, AK4117_REG_RCS1);
rcs0 = reg_read(ak4117, AK4117_REG_RCS0);
rcs2 = reg_read(ak4117, AK4117_REG_RCS2);
scoped_guard(spinlock_irqsave, &ak4117->lock) {
ak4117->errors[AK4117_PARITY_ERRORS]++;
ak4117->errors[AK4117_V_BIT_ERRORS]++;
ak4117->errors[AK4117_CCRC_ERRORS]++;
struct ak4117 *chip = device->device_data;
ak4117->errors[AK4117_QCRC_ERRORS]++;
c0 = (ak4117->rcs0 & (AK4117_QINT | AK4117_CINT | AK4117_STC | AK4117_AUDION | AK4117_AUTO | AK4117_UNLCK)) ^
c1 = (ak4117->rcs1 & (AK4117_DTSCD | AK4117_NPCM | AK4117_PEM | 0x0f)) ^
ak4117->rcs0 = rcs0 & ~(AK4117_QINT | AK4117_CINT | AK4117_STC);
ak4117->rcs1 = rcs1;
ak4117->rcs2 = rcs2;
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[0]->id);
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[1]->id);
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[2]->id);
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[3]->id);
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[4]->id);
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[6]->id);
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[8]->id);
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[9]->id);
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[10]->id);
snd_ctl_notify(ak4117->card, SNDRV_CTL_EVENT_MASK_VALUE, &ak4117->kctls[11]->id);
if (ak4117->change_callback && (c0 | c1) != 0)
ak4117->change_callback(ak4117, c0, c1);
snd_pcm_stream_lock_irqsave(ak4117->substream, _flags);
if (snd_pcm_running(ak4117->substream)) {
snd_pcm_stop(ak4117->substream, SNDRV_PCM_STATE_DRAINING);
snd_pcm_stream_unlock_irqrestore(ak4117->substream, _flags);
struct ak4117 *chip = timer_container_of(chip, t, timer);
const unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117)
struct ak4117 *chip;
void snd_ak4117_reg_write(struct ak4117 *chip, unsigned char reg, unsigned char mask, unsigned char val)
void snd_ak4117_reinit(struct ak4117 *chip)
struct ak4117 *ak4117;
snd_ak4117_reinit(chip->ak4117);
static void snd_pdacf_ak4117_change(struct ak4117 *ak4117, unsigned char c0, unsigned char c1)
struct snd_pdacf *chip = ak4117->change_callback_private;
if (ak4117->rcs0 & AK4117_UNLCK)
err = snd_ak4117_create(chip->card, pdacf_ak4117_read, pdacf_ak4117_write, pgm, chip, &chip->ak4117);
chip->ak4117->change_callback_private = chip;
chip->ak4117->change_callback = snd_pdacf_ak4117_change;
snd_pdacf_ak4117_change(chip->ak4117, AK4117_UNLCK, 0);
return (chip->ak4117->rcs0 & AK4117_UNLCK) == 0;
(snd_ak4117_external_rate(chip->ak4117) <= 0 || !check_signal(chip)))
snd_ak4117_check_rate_and_errors(chip->ak4117, 0);
snd_ak4117_reg_write(chip->ak4117, AK4117_REG_IO, AK4117_DIF2|AK4117_DIF1|AK4117_DIF0, aval);
err = snd_ak4117_build(chip->ak4117, pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
rate = snd_ak4117_check_rate_and_errors(chip->ak4117, AK4117_CHECK_NO_STAT|AK4117_CHECK_NO_RATE);
if ((chip->ak4117->rcs0 & AK4117_UNLCK) || runtime->rate != rate) {
snd_ak4117_check_rate_and_errors(chip->ak4117, AK4117_CHECK_NO_RATE);