Lines Matching refs:chip

41 static void ak4113_init_regs(struct ak4113 *chip);
57 static void snd_ak4113_free(struct ak4113 *chip) in snd_ak4113_free() argument
59 atomic_inc(&chip->wq_processing); /* don't schedule new work */ in snd_ak4113_free()
60 cancel_delayed_work_sync(&chip->work); in snd_ak4113_free()
61 kfree(chip); in snd_ak4113_free()
66 struct ak4113 *chip = device->device_data; in snd_ak4113_dev_free() local
67 snd_ak4113_free(chip); in snd_ak4113_dev_free()
75 struct ak4113 *chip; in snd_ak4113_create() local
82 chip = kzalloc(sizeof(*chip), GFP_KERNEL); in snd_ak4113_create()
83 if (chip == NULL) in snd_ak4113_create()
85 spin_lock_init(&chip->lock); in snd_ak4113_create()
86 chip->card = card; in snd_ak4113_create()
87 chip->read = read; in snd_ak4113_create()
88 chip->write = write; in snd_ak4113_create()
89 chip->private_data = private_data; in snd_ak4113_create()
90 INIT_DELAYED_WORK(&chip->work, ak4113_stats); in snd_ak4113_create()
91 atomic_set(&chip->wq_processing, 0); in snd_ak4113_create()
92 mutex_init(&chip->reinit_mutex); in snd_ak4113_create()
95 chip->regmap[reg] = pgm[reg]; in snd_ak4113_create()
96 ak4113_init_regs(chip); in snd_ak4113_create()
98 chip->rcs0 = reg_read(chip, AK4113_REG_RCS0) & ~(AK4113_QINT | in snd_ak4113_create()
100 chip->rcs1 = reg_read(chip, AK4113_REG_RCS1); in snd_ak4113_create()
101 chip->rcs2 = reg_read(chip, AK4113_REG_RCS2); in snd_ak4113_create()
102 err = snd_device_new(card, SNDRV_DEV_CODEC, chip, &ops); in snd_ak4113_create()
107 *r_ak4113 = chip; in snd_ak4113_create()
111 snd_ak4113_free(chip); in snd_ak4113_create()
116 void snd_ak4113_reg_write(struct ak4113 *chip, unsigned char reg, in snd_ak4113_reg_write() argument
121 reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val); in snd_ak4113_reg_write()
125 static void ak4113_init_regs(struct ak4113 *chip) in ak4113_init_regs() argument
127 unsigned char old = chip->regmap[AK4113_REG_PWRDN], reg; in ak4113_init_regs()
130 reg_write(chip, AK4113_REG_PWRDN, old & ~(AK4113_RST|AK4113_PWN)); in ak4113_init_regs()
133 reg_write(chip, AK4113_REG_PWRDN, (old | AK4113_RST) & ~AK4113_PWN); in ak4113_init_regs()
136 reg_write(chip, reg, chip->regmap[reg]); in ak4113_init_regs()
138 reg_write(chip, AK4113_REG_PWRDN, old | AK4113_RST | AK4113_PWN); in ak4113_init_regs()
141 void snd_ak4113_reinit(struct ak4113 *chip) in snd_ak4113_reinit() argument
143 if (atomic_inc_return(&chip->wq_processing) == 1) in snd_ak4113_reinit()
144 cancel_delayed_work_sync(&chip->work); in snd_ak4113_reinit()
145 mutex_lock(&chip->reinit_mutex); in snd_ak4113_reinit()
146 ak4113_init_regs(chip); in snd_ak4113_reinit()
147 mutex_unlock(&chip->reinit_mutex); in snd_ak4113_reinit()
149 if (atomic_dec_and_test(&chip->wq_processing)) in snd_ak4113_reinit()
150 schedule_delayed_work(&chip->work, HZ / 10); in snd_ak4113_reinit()
201 struct ak4113 *chip = snd_kcontrol_chip(kcontrol); in snd_ak4113_in_error_get() local
204 spin_lock_irq(&chip->lock); in snd_ak4113_in_error_get()
205 ptr = (long *)(((char *)chip) + kcontrol->private_value); in snd_ak4113_in_error_get()
208 spin_unlock_irq(&chip->lock); in snd_ak4113_in_error_get()
217 struct ak4113 *chip = snd_kcontrol_chip(kcontrol); in snd_ak4113_in_bit_get() local
223 ((reg_read(chip, reg) & (1 << bit)) ? 1 : 0) ^ inv; in snd_ak4113_in_bit_get()
240 struct ak4113 *chip = snd_kcontrol_chip(kcontrol); in snd_ak4113_rx_get() local
243 (AK4113_IPS(chip->regmap[AK4113_REG_IO1])); in snd_ak4113_rx_get()
250 struct ak4113 *chip = snd_kcontrol_chip(kcontrol); in snd_ak4113_rx_put() local
254 spin_lock_irq(&chip->lock); in snd_ak4113_rx_put()
255 old_val = chip->regmap[AK4113_REG_IO1]; in snd_ak4113_rx_put()
258 reg_write(chip, AK4113_REG_IO1, in snd_ak4113_rx_put()
261 spin_unlock_irq(&chip->lock); in snd_ak4113_rx_put()
278 struct ak4113 *chip = snd_kcontrol_chip(kcontrol); in snd_ak4113_rate_get() local
280 ucontrol->value.integer.value[0] = external_rate(reg_read(chip, in snd_ak4113_rate_get()
296 struct ak4113 *chip = snd_kcontrol_chip(kcontrol); in snd_ak4113_spdif_get() local
300 ucontrol->value.iec958.status[i] = reg_read(chip, in snd_ak4113_spdif_get()
333 struct ak4113 *chip = snd_kcontrol_chip(kcontrol); in snd_ak4113_spdif_pget() local
338 tmp = reg_read(chip, AK4113_REG_Pc0) | in snd_ak4113_spdif_pget()
339 (reg_read(chip, AK4113_REG_Pc1) << 8); in snd_ak4113_spdif_pget()
341 tmp = reg_read(chip, AK4113_REG_Pd0) | in snd_ak4113_spdif_pget()
342 (reg_read(chip, AK4113_REG_Pd1) << 8); in snd_ak4113_spdif_pget()
358 struct ak4113 *chip = snd_kcontrol_chip(kcontrol); in snd_ak4113_spdif_qget() local
362 ucontrol->value.bytes.data[i] = reg_read(chip, in snd_ak4113_spdif_qget()
634 struct ak4113 *chip = container_of(work, struct ak4113, work.work); in ak4113_stats() local
636 if (atomic_inc_return(&chip->wq_processing) == 1) in ak4113_stats()
637 snd_ak4113_check_rate_and_errors(chip, chip->check_flags); in ak4113_stats()
639 if (atomic_dec_and_test(&chip->wq_processing)) in ak4113_stats()
640 schedule_delayed_work(&chip->work, HZ / 10); in ak4113_stats()
644 void snd_ak4113_suspend(struct ak4113 *chip) in snd_ak4113_suspend() argument
646 atomic_inc(&chip->wq_processing); /* don't schedule new work */ in snd_ak4113_suspend()
647 cancel_delayed_work_sync(&chip->work); in snd_ak4113_suspend()
651 void snd_ak4113_resume(struct ak4113 *chip) in snd_ak4113_resume() argument
653 atomic_dec(&chip->wq_processing); in snd_ak4113_resume()
654 snd_ak4113_reinit(chip); in snd_ak4113_resume()