Skip to content

Commit 9273aa8

Browse files
cristiccbroonie
authored andcommitted
ASoC: nau8821: Generalize helper to clear IRQ status
Instead of adding yet another utility function for dealing with the interrupt clearing register, generalize nau8821_int_status_clear_all() by renaming it to nau8821_irq_status_clear(), whilst introducing a second parameter to allow restricting the operation scope to a single interrupt instead of the whole range of active IRQs. While at it, also fix a spelling typo in the comment block. Note this is mainly a prerequisite for subsequent patches aiming to address some deficiencies in the implementation of the interrupt handler. Thus the presence of the Fixes tag below is intentional, to facilitate backporting. Fixes: aab1ad1 ("ASoC: nau8821: new driver") Signed-off-by: Cristian Ciocaltea <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6e54919 commit 9273aa8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

sound/soc/codecs/nau8821.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,12 +1021,17 @@ static bool nau8821_is_jack_inserted(struct regmap *regmap)
10211021
return active_high == is_high;
10221022
}
10231023

1024-
static void nau8821_int_status_clear_all(struct regmap *regmap)
1024+
static void nau8821_irq_status_clear(struct regmap *regmap, int active_irq)
10251025
{
1026-
int active_irq, clear_irq, i;
1026+
int clear_irq, i;
10271027

1028-
/* Reset the intrruption status from rightmost bit if the corres-
1029-
* ponding irq event occurs.
1028+
if (active_irq) {
1029+
regmap_write(regmap, NAU8821_R11_INT_CLR_KEY_STATUS, active_irq);
1030+
return;
1031+
}
1032+
1033+
/* Reset the interruption status from rightmost bit if the
1034+
* corresponding irq event occurs.
10301035
*/
10311036
regmap_read(regmap, NAU8821_R10_IRQ_STATUS, &active_irq);
10321037
for (i = 0; i < NAU8821_REG_DATA_LEN; i++) {
@@ -1053,7 +1058,7 @@ static void nau8821_eject_jack(struct nau8821 *nau8821)
10531058
snd_soc_dapm_sync(dapm);
10541059

10551060
/* Clear all interruption status */
1056-
nau8821_int_status_clear_all(regmap);
1061+
nau8821_irq_status_clear(regmap, 0);
10571062

10581063
/* Enable the insertion interruption, disable the ejection inter-
10591064
* ruption, and then bypass de-bounce circuit.
@@ -1522,7 +1527,7 @@ static int nau8821_resume_setup(struct nau8821 *nau8821)
15221527
nau8821_configure_sysclk(nau8821, NAU8821_CLK_DIS, 0);
15231528
if (nau8821->irq) {
15241529
/* Clear all interruption status */
1525-
nau8821_int_status_clear_all(regmap);
1530+
nau8821_irq_status_clear(regmap, 0);
15261531

15271532
/* Enable both insertion and ejection interruptions, and then
15281533
* bypass de-bounce circuit.

0 commit comments

Comments
 (0)