diff options
Diffstat (limited to 'sound/i2c/other/ak4114.c')
-rw-r--r-- | sound/i2c/other/ak4114.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index b70e6eccbd03..5a4cf3fab4ae 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c | |||
@@ -100,6 +100,7 @@ int snd_ak4114_create(struct snd_card *card, | |||
100 | chip->private_data = private_data; | 100 | chip->private_data = private_data; |
101 | INIT_DELAYED_WORK(&chip->work, ak4114_stats); | 101 | INIT_DELAYED_WORK(&chip->work, ak4114_stats); |
102 | atomic_set(&chip->wq_processing, 0); | 102 | atomic_set(&chip->wq_processing, 0); |
103 | mutex_init(&chip->reinit_mutex); | ||
103 | 104 | ||
104 | for (reg = 0; reg < 6; reg++) | 105 | for (reg = 0; reg < 6; reg++) |
105 | chip->regmap[reg] = pgm[reg]; | 106 | chip->regmap[reg] = pgm[reg]; |
@@ -122,6 +123,7 @@ int snd_ak4114_create(struct snd_card *card, | |||
122 | snd_ak4114_free(chip); | 123 | snd_ak4114_free(chip); |
123 | return err < 0 ? err : -EIO; | 124 | return err < 0 ? err : -EIO; |
124 | } | 125 | } |
126 | EXPORT_SYMBOL(snd_ak4114_create); | ||
125 | 127 | ||
126 | void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char mask, unsigned char val) | 128 | void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char mask, unsigned char val) |
127 | { | 129 | { |
@@ -131,6 +133,7 @@ void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char | |||
131 | reg_write(chip, reg, | 133 | reg_write(chip, reg, |
132 | (chip->txcsb[reg-AK4114_REG_TXCSB0] & ~mask) | val); | 134 | (chip->txcsb[reg-AK4114_REG_TXCSB0] & ~mask) | val); |
133 | } | 135 | } |
136 | EXPORT_SYMBOL(snd_ak4114_reg_write); | ||
134 | 137 | ||
135 | static void ak4114_init_regs(struct ak4114 *chip) | 138 | static void ak4114_init_regs(struct ak4114 *chip) |
136 | { | 139 | { |
@@ -154,11 +157,14 @@ void snd_ak4114_reinit(struct ak4114 *chip) | |||
154 | { | 157 | { |
155 | if (atomic_inc_return(&chip->wq_processing) == 1) | 158 | if (atomic_inc_return(&chip->wq_processing) == 1) |
156 | cancel_delayed_work_sync(&chip->work); | 159 | cancel_delayed_work_sync(&chip->work); |
160 | mutex_lock(&chip->reinit_mutex); | ||
157 | ak4114_init_regs(chip); | 161 | ak4114_init_regs(chip); |
162 | mutex_unlock(&chip->reinit_mutex); | ||
158 | /* bring up statistics / event queing */ | 163 | /* bring up statistics / event queing */ |
159 | if (atomic_dec_and_test(&chip->wq_processing)) | 164 | if (atomic_dec_and_test(&chip->wq_processing)) |
160 | schedule_delayed_work(&chip->work, HZ / 10); | 165 | schedule_delayed_work(&chip->work, HZ / 10); |
161 | } | 166 | } |
167 | EXPORT_SYMBOL(snd_ak4114_reinit); | ||
162 | 168 | ||
163 | static unsigned int external_rate(unsigned char rcs1) | 169 | static unsigned int external_rate(unsigned char rcs1) |
164 | { | 170 | { |
@@ -503,6 +509,7 @@ int snd_ak4114_build(struct ak4114 *ak4114, | |||
503 | schedule_delayed_work(&ak4114->work, HZ / 10); | 509 | schedule_delayed_work(&ak4114->work, HZ / 10); |
504 | return 0; | 510 | return 0; |
505 | } | 511 | } |
512 | EXPORT_SYMBOL(snd_ak4114_build); | ||
506 | 513 | ||
507 | /* notify kcontrols if any parameters are changed */ | 514 | /* notify kcontrols if any parameters are changed */ |
508 | static void ak4114_notify(struct ak4114 *ak4114, | 515 | static void ak4114_notify(struct ak4114 *ak4114, |
@@ -558,6 +565,7 @@ int snd_ak4114_external_rate(struct ak4114 *ak4114) | |||
558 | rcs1 = reg_read(ak4114, AK4114_REG_RCS1); | 565 | rcs1 = reg_read(ak4114, AK4114_REG_RCS1); |
559 | return external_rate(rcs1); | 566 | return external_rate(rcs1); |
560 | } | 567 | } |
568 | EXPORT_SYMBOL(snd_ak4114_external_rate); | ||
561 | 569 | ||
562 | int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags) | 570 | int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags) |
563 | { | 571 | { |
@@ -605,6 +613,7 @@ int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags) | |||
605 | } | 613 | } |
606 | return res; | 614 | return res; |
607 | } | 615 | } |
616 | EXPORT_SYMBOL(snd_ak4114_check_rate_and_errors); | ||
608 | 617 | ||
609 | static void ak4114_stats(struct work_struct *work) | 618 | static void ak4114_stats(struct work_struct *work) |
610 | { | 619 | { |
@@ -616,9 +625,18 @@ static void ak4114_stats(struct work_struct *work) | |||
616 | schedule_delayed_work(&chip->work, HZ / 10); | 625 | schedule_delayed_work(&chip->work, HZ / 10); |
617 | } | 626 | } |
618 | 627 | ||
619 | EXPORT_SYMBOL(snd_ak4114_create); | 628 | #ifdef CONFIG_PM |
620 | EXPORT_SYMBOL(snd_ak4114_reg_write); | 629 | void snd_ak4114_suspend(struct ak4114 *chip) |
621 | EXPORT_SYMBOL(snd_ak4114_reinit); | 630 | { |
622 | EXPORT_SYMBOL(snd_ak4114_build); | 631 | atomic_inc(&chip->wq_processing); /* don't schedule new work */ |
623 | EXPORT_SYMBOL(snd_ak4114_external_rate); | 632 | cancel_delayed_work_sync(&chip->work); |
624 | EXPORT_SYMBOL(snd_ak4114_check_rate_and_errors); | 633 | } |
634 | EXPORT_SYMBOL(snd_ak4114_suspend); | ||
635 | |||
636 | void snd_ak4114_resume(struct ak4114 *chip) | ||
637 | { | ||
638 | atomic_dec(&chip->wq_processing); | ||
639 | snd_ak4114_reinit(chip); | ||
640 | } | ||
641 | EXPORT_SYMBOL(snd_ak4114_resume); | ||
642 | #endif | ||