Loading include/sound/ak4113.h +10 −1 Original line number Diff line number Diff line Loading @@ -286,7 +286,8 @@ struct ak4113 { ak4113_write_t *write; ak4113_read_t *read; void *private_data; unsigned int init:1; atomic_t wq_processing; struct mutex reinit_mutex; spinlock_t lock; unsigned char regmap[AK4113_WRITABLE_REGS]; struct snd_kcontrol *kctls[AK4113_CONTROLS]; Loading Loading @@ -317,5 +318,13 @@ int snd_ak4113_build(struct ak4113 *ak4113, int snd_ak4113_external_rate(struct ak4113 *ak4113); int snd_ak4113_check_rate_and_errors(struct ak4113 *ak4113, unsigned int flags); #ifdef CONFIG_PM void snd_ak4113_suspend(struct ak4113 *chip); void snd_ak4113_resume(struct ak4113 *chip); #else static inline void snd_ak4113_suspend(struct ak4113 *chip) {} static inline void snd_ak4113_resume(struct ak4113 *chip) {} #endif #endif /* __SOUND_AK4113_H */ include/sound/ak4114.h +10 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,8 @@ struct ak4114 { ak4114_write_t * write; ak4114_read_t * read; void * private_data; unsigned int init: 1; atomic_t wq_processing; struct mutex reinit_mutex; spinlock_t lock; unsigned char regmap[6]; unsigned char txcsb[5]; Loading Loading @@ -199,5 +200,13 @@ int snd_ak4114_build(struct ak4114 *ak4114, int snd_ak4114_external_rate(struct ak4114 *ak4114); int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags); #ifdef CONFIG_PM void snd_ak4114_suspend(struct ak4114 *chip); void snd_ak4114_resume(struct ak4114 *chip); #else static inline void snd_ak4114_suspend(struct ak4114 *chip) {} static inline void snd_ak4114_resume(struct ak4114 *chip) {} #endif #endif /* __SOUND_AK4114_H */ sound/i2c/other/ak4113.c +27 −9 Original line number Diff line number Diff line Loading @@ -56,8 +56,7 @@ static inline unsigned char reg_read(struct ak4113 *ak4113, unsigned char reg) static void snd_ak4113_free(struct ak4113 *chip) { chip->init = 1; /* don't schedule new work */ mb(); atomic_inc(&chip->wq_processing); /* don't schedule new work */ cancel_delayed_work_sync(&chip->work); kfree(chip); } Loading Loading @@ -89,6 +88,8 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read, chip->write = write; chip->private_data = private_data; INIT_DELAYED_WORK(&chip->work, ak4113_stats); atomic_set(&chip->wq_processing, 0); mutex_init(&chip->reinit_mutex); for (reg = 0; reg < AK4113_WRITABLE_REGS ; reg++) chip->regmap[reg] = pgm[reg]; Loading Loading @@ -139,13 +140,13 @@ static void ak4113_init_regs(struct ak4113 *chip) void snd_ak4113_reinit(struct ak4113 *chip) { chip->init = 1; mb(); flush_delayed_work(&chip->work); if (atomic_inc_return(&chip->wq_processing) == 1) cancel_delayed_work_sync(&chip->work); mutex_lock(&chip->reinit_mutex); ak4113_init_regs(chip); mutex_unlock(&chip->reinit_mutex); /* bring up statistics / event queing */ chip->init = 0; if (chip->kctls[0]) if (atomic_dec_and_test(&chip->wq_processing)) schedule_delayed_work(&chip->work, HZ / 10); } EXPORT_SYMBOL_GPL(snd_ak4113_reinit); Loading Loading @@ -632,8 +633,25 @@ static void ak4113_stats(struct work_struct *work) { struct ak4113 *chip = container_of(work, struct ak4113, work.work); if (!chip->init) if (atomic_inc_return(&chip->wq_processing) == 1) snd_ak4113_check_rate_and_errors(chip, chip->check_flags); if (atomic_dec_and_test(&chip->wq_processing)) schedule_delayed_work(&chip->work, HZ / 10); } #ifdef CONFIG_PM void snd_ak4113_suspend(struct ak4113 *chip) { atomic_inc(&chip->wq_processing); /* don't schedule new work */ cancel_delayed_work_sync(&chip->work); } EXPORT_SYMBOL(snd_ak4113_suspend); void snd_ak4113_resume(struct ak4113 *chip) { atomic_dec(&chip->wq_processing); snd_ak4113_reinit(chip); } EXPORT_SYMBOL(snd_ak4113_resume); #endif sound/i2c/other/ak4114.c +31 −15 Original line number Diff line number Diff line Loading @@ -66,8 +66,7 @@ static void reg_dump(struct ak4114 *ak4114) static void snd_ak4114_free(struct ak4114 *chip) { chip->init = 1; /* don't schedule new work */ mb(); atomic_inc(&chip->wq_processing); /* don't schedule new work */ cancel_delayed_work_sync(&chip->work); kfree(chip); } Loading Loading @@ -100,6 +99,8 @@ int snd_ak4114_create(struct snd_card *card, chip->write = write; chip->private_data = private_data; INIT_DELAYED_WORK(&chip->work, ak4114_stats); atomic_set(&chip->wq_processing, 0); mutex_init(&chip->reinit_mutex); for (reg = 0; reg < 6; reg++) chip->regmap[reg] = pgm[reg]; Loading @@ -122,6 +123,7 @@ int snd_ak4114_create(struct snd_card *card, snd_ak4114_free(chip); return err < 0 ? err : -EIO; } EXPORT_SYMBOL(snd_ak4114_create); void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char mask, unsigned char val) { Loading @@ -131,6 +133,7 @@ void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char reg_write(chip, reg, (chip->txcsb[reg-AK4114_REG_TXCSB0] & ~mask) | val); } EXPORT_SYMBOL(snd_ak4114_reg_write); static void ak4114_init_regs(struct ak4114 *chip) { Loading @@ -152,15 +155,16 @@ static void ak4114_init_regs(struct ak4114 *chip) void snd_ak4114_reinit(struct ak4114 *chip) { chip->init = 1; mb(); flush_delayed_work(&chip->work); if (atomic_inc_return(&chip->wq_processing) == 1) cancel_delayed_work_sync(&chip->work); mutex_lock(&chip->reinit_mutex); ak4114_init_regs(chip); mutex_unlock(&chip->reinit_mutex); /* bring up statistics / event queing */ chip->init = 0; if (chip->kctls[0]) if (atomic_dec_and_test(&chip->wq_processing)) schedule_delayed_work(&chip->work, HZ / 10); } EXPORT_SYMBOL(snd_ak4114_reinit); static unsigned int external_rate(unsigned char rcs1) { Loading Loading @@ -505,6 +509,7 @@ int snd_ak4114_build(struct ak4114 *ak4114, schedule_delayed_work(&ak4114->work, HZ / 10); return 0; } EXPORT_SYMBOL(snd_ak4114_build); /* notify kcontrols if any parameters are changed */ static void ak4114_notify(struct ak4114 *ak4114, Loading Loading @@ -560,6 +565,7 @@ int snd_ak4114_external_rate(struct ak4114 *ak4114) rcs1 = reg_read(ak4114, AK4114_REG_RCS1); return external_rate(rcs1); } EXPORT_SYMBOL(snd_ak4114_external_rate); int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags) { Loading Loading @@ -607,20 +613,30 @@ int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags) } return res; } EXPORT_SYMBOL(snd_ak4114_check_rate_and_errors); static void ak4114_stats(struct work_struct *work) { struct ak4114 *chip = container_of(work, struct ak4114, work.work); if (!chip->init) if (atomic_inc_return(&chip->wq_processing) == 1) snd_ak4114_check_rate_and_errors(chip, chip->check_flags); if (atomic_dec_and_test(&chip->wq_processing)) schedule_delayed_work(&chip->work, HZ / 10); } EXPORT_SYMBOL(snd_ak4114_create); EXPORT_SYMBOL(snd_ak4114_reg_write); EXPORT_SYMBOL(snd_ak4114_reinit); EXPORT_SYMBOL(snd_ak4114_build); EXPORT_SYMBOL(snd_ak4114_external_rate); EXPORT_SYMBOL(snd_ak4114_check_rate_and_errors); #ifdef CONFIG_PM void snd_ak4114_suspend(struct ak4114 *chip) { atomic_inc(&chip->wq_processing); /* don't schedule new work */ cancel_delayed_work_sync(&chip->work); } EXPORT_SYMBOL(snd_ak4114_suspend); void snd_ak4114_resume(struct ak4114 *chip) { atomic_dec(&chip->wq_processing); snd_ak4114_reinit(chip); } EXPORT_SYMBOL(snd_ak4114_resume); #endif sound/pci/ice1712/juli.c +3 −1 Original line number Diff line number Diff line Loading @@ -491,15 +491,17 @@ static int juli_resume(struct snd_ice1712 *ice) /* akm4358 un-reset, un-mute */ snd_akm4xxx_reset(ak, 0); /* reinit ak4114 */ snd_ak4114_reinit(spec->ak4114); snd_ak4114_resume(spec->ak4114); return 0; } static int juli_suspend(struct snd_ice1712 *ice) { struct snd_akm4xxx *ak = ice->akm; struct juli_spec *spec = ice->spec; /* akm4358 reset and soft-mute */ snd_akm4xxx_reset(ak, 1); snd_ak4114_suspend(spec->ak4114); return 0; } #endif Loading Loading
include/sound/ak4113.h +10 −1 Original line number Diff line number Diff line Loading @@ -286,7 +286,8 @@ struct ak4113 { ak4113_write_t *write; ak4113_read_t *read; void *private_data; unsigned int init:1; atomic_t wq_processing; struct mutex reinit_mutex; spinlock_t lock; unsigned char regmap[AK4113_WRITABLE_REGS]; struct snd_kcontrol *kctls[AK4113_CONTROLS]; Loading Loading @@ -317,5 +318,13 @@ int snd_ak4113_build(struct ak4113 *ak4113, int snd_ak4113_external_rate(struct ak4113 *ak4113); int snd_ak4113_check_rate_and_errors(struct ak4113 *ak4113, unsigned int flags); #ifdef CONFIG_PM void snd_ak4113_suspend(struct ak4113 *chip); void snd_ak4113_resume(struct ak4113 *chip); #else static inline void snd_ak4113_suspend(struct ak4113 *chip) {} static inline void snd_ak4113_resume(struct ak4113 *chip) {} #endif #endif /* __SOUND_AK4113_H */
include/sound/ak4114.h +10 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,8 @@ struct ak4114 { ak4114_write_t * write; ak4114_read_t * read; void * private_data; unsigned int init: 1; atomic_t wq_processing; struct mutex reinit_mutex; spinlock_t lock; unsigned char regmap[6]; unsigned char txcsb[5]; Loading Loading @@ -199,5 +200,13 @@ int snd_ak4114_build(struct ak4114 *ak4114, int snd_ak4114_external_rate(struct ak4114 *ak4114); int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags); #ifdef CONFIG_PM void snd_ak4114_suspend(struct ak4114 *chip); void snd_ak4114_resume(struct ak4114 *chip); #else static inline void snd_ak4114_suspend(struct ak4114 *chip) {} static inline void snd_ak4114_resume(struct ak4114 *chip) {} #endif #endif /* __SOUND_AK4114_H */
sound/i2c/other/ak4113.c +27 −9 Original line number Diff line number Diff line Loading @@ -56,8 +56,7 @@ static inline unsigned char reg_read(struct ak4113 *ak4113, unsigned char reg) static void snd_ak4113_free(struct ak4113 *chip) { chip->init = 1; /* don't schedule new work */ mb(); atomic_inc(&chip->wq_processing); /* don't schedule new work */ cancel_delayed_work_sync(&chip->work); kfree(chip); } Loading Loading @@ -89,6 +88,8 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read, chip->write = write; chip->private_data = private_data; INIT_DELAYED_WORK(&chip->work, ak4113_stats); atomic_set(&chip->wq_processing, 0); mutex_init(&chip->reinit_mutex); for (reg = 0; reg < AK4113_WRITABLE_REGS ; reg++) chip->regmap[reg] = pgm[reg]; Loading Loading @@ -139,13 +140,13 @@ static void ak4113_init_regs(struct ak4113 *chip) void snd_ak4113_reinit(struct ak4113 *chip) { chip->init = 1; mb(); flush_delayed_work(&chip->work); if (atomic_inc_return(&chip->wq_processing) == 1) cancel_delayed_work_sync(&chip->work); mutex_lock(&chip->reinit_mutex); ak4113_init_regs(chip); mutex_unlock(&chip->reinit_mutex); /* bring up statistics / event queing */ chip->init = 0; if (chip->kctls[0]) if (atomic_dec_and_test(&chip->wq_processing)) schedule_delayed_work(&chip->work, HZ / 10); } EXPORT_SYMBOL_GPL(snd_ak4113_reinit); Loading Loading @@ -632,8 +633,25 @@ static void ak4113_stats(struct work_struct *work) { struct ak4113 *chip = container_of(work, struct ak4113, work.work); if (!chip->init) if (atomic_inc_return(&chip->wq_processing) == 1) snd_ak4113_check_rate_and_errors(chip, chip->check_flags); if (atomic_dec_and_test(&chip->wq_processing)) schedule_delayed_work(&chip->work, HZ / 10); } #ifdef CONFIG_PM void snd_ak4113_suspend(struct ak4113 *chip) { atomic_inc(&chip->wq_processing); /* don't schedule new work */ cancel_delayed_work_sync(&chip->work); } EXPORT_SYMBOL(snd_ak4113_suspend); void snd_ak4113_resume(struct ak4113 *chip) { atomic_dec(&chip->wq_processing); snd_ak4113_reinit(chip); } EXPORT_SYMBOL(snd_ak4113_resume); #endif
sound/i2c/other/ak4114.c +31 −15 Original line number Diff line number Diff line Loading @@ -66,8 +66,7 @@ static void reg_dump(struct ak4114 *ak4114) static void snd_ak4114_free(struct ak4114 *chip) { chip->init = 1; /* don't schedule new work */ mb(); atomic_inc(&chip->wq_processing); /* don't schedule new work */ cancel_delayed_work_sync(&chip->work); kfree(chip); } Loading Loading @@ -100,6 +99,8 @@ int snd_ak4114_create(struct snd_card *card, chip->write = write; chip->private_data = private_data; INIT_DELAYED_WORK(&chip->work, ak4114_stats); atomic_set(&chip->wq_processing, 0); mutex_init(&chip->reinit_mutex); for (reg = 0; reg < 6; reg++) chip->regmap[reg] = pgm[reg]; Loading @@ -122,6 +123,7 @@ int snd_ak4114_create(struct snd_card *card, snd_ak4114_free(chip); return err < 0 ? err : -EIO; } EXPORT_SYMBOL(snd_ak4114_create); void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char mask, unsigned char val) { Loading @@ -131,6 +133,7 @@ void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char reg_write(chip, reg, (chip->txcsb[reg-AK4114_REG_TXCSB0] & ~mask) | val); } EXPORT_SYMBOL(snd_ak4114_reg_write); static void ak4114_init_regs(struct ak4114 *chip) { Loading @@ -152,15 +155,16 @@ static void ak4114_init_regs(struct ak4114 *chip) void snd_ak4114_reinit(struct ak4114 *chip) { chip->init = 1; mb(); flush_delayed_work(&chip->work); if (atomic_inc_return(&chip->wq_processing) == 1) cancel_delayed_work_sync(&chip->work); mutex_lock(&chip->reinit_mutex); ak4114_init_regs(chip); mutex_unlock(&chip->reinit_mutex); /* bring up statistics / event queing */ chip->init = 0; if (chip->kctls[0]) if (atomic_dec_and_test(&chip->wq_processing)) schedule_delayed_work(&chip->work, HZ / 10); } EXPORT_SYMBOL(snd_ak4114_reinit); static unsigned int external_rate(unsigned char rcs1) { Loading Loading @@ -505,6 +509,7 @@ int snd_ak4114_build(struct ak4114 *ak4114, schedule_delayed_work(&ak4114->work, HZ / 10); return 0; } EXPORT_SYMBOL(snd_ak4114_build); /* notify kcontrols if any parameters are changed */ static void ak4114_notify(struct ak4114 *ak4114, Loading Loading @@ -560,6 +565,7 @@ int snd_ak4114_external_rate(struct ak4114 *ak4114) rcs1 = reg_read(ak4114, AK4114_REG_RCS1); return external_rate(rcs1); } EXPORT_SYMBOL(snd_ak4114_external_rate); int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags) { Loading Loading @@ -607,20 +613,30 @@ int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags) } return res; } EXPORT_SYMBOL(snd_ak4114_check_rate_and_errors); static void ak4114_stats(struct work_struct *work) { struct ak4114 *chip = container_of(work, struct ak4114, work.work); if (!chip->init) if (atomic_inc_return(&chip->wq_processing) == 1) snd_ak4114_check_rate_and_errors(chip, chip->check_flags); if (atomic_dec_and_test(&chip->wq_processing)) schedule_delayed_work(&chip->work, HZ / 10); } EXPORT_SYMBOL(snd_ak4114_create); EXPORT_SYMBOL(snd_ak4114_reg_write); EXPORT_SYMBOL(snd_ak4114_reinit); EXPORT_SYMBOL(snd_ak4114_build); EXPORT_SYMBOL(snd_ak4114_external_rate); EXPORT_SYMBOL(snd_ak4114_check_rate_and_errors); #ifdef CONFIG_PM void snd_ak4114_suspend(struct ak4114 *chip) { atomic_inc(&chip->wq_processing); /* don't schedule new work */ cancel_delayed_work_sync(&chip->work); } EXPORT_SYMBOL(snd_ak4114_suspend); void snd_ak4114_resume(struct ak4114 *chip) { atomic_dec(&chip->wq_processing); snd_ak4114_reinit(chip); } EXPORT_SYMBOL(snd_ak4114_resume); #endif
sound/pci/ice1712/juli.c +3 −1 Original line number Diff line number Diff line Loading @@ -491,15 +491,17 @@ static int juli_resume(struct snd_ice1712 *ice) /* akm4358 un-reset, un-mute */ snd_akm4xxx_reset(ak, 0); /* reinit ak4114 */ snd_ak4114_reinit(spec->ak4114); snd_ak4114_resume(spec->ak4114); return 0; } static int juli_suspend(struct snd_ice1712 *ice) { struct snd_akm4xxx *ak = ice->akm; struct juli_spec *spec = ice->spec; /* akm4358 reset and soft-mute */ snd_akm4xxx_reset(ak, 1); snd_ak4114_suspend(spec->ak4114); return 0; } #endif Loading