Skip to content

Commit 129cef0

Browse files
cristiccgregkh
authored andcommitted
ASoC: nau8821: Generalize helper to clear IRQ status
[ Upstream commit 9273aa8 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 8ed3d6c commit 129cef0

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
@@ -1022,12 +1022,17 @@ static bool nau8821_is_jack_inserted(struct regmap *regmap)
10221022
return active_high == is_high;
10231023
}
10241024

1025-
static void nau8821_int_status_clear_all(struct regmap *regmap)
1025+
static void nau8821_irq_status_clear(struct regmap *regmap, int active_irq)
10261026
{
1027-
int active_irq, clear_irq, i;
1027+
int clear_irq, i;
10281028

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

10561061
/* Clear all interruption status */
1057-
nau8821_int_status_clear_all(regmap);
1062+
nau8821_irq_status_clear(regmap, 0);
10581063

10591064
/* Enable the insertion interruption, disable the ejection inter-
10601065
* ruption, and then bypass de-bounce circuit.
@@ -1523,7 +1528,7 @@ static int nau8821_resume_setup(struct nau8821 *nau8821)
15231528
nau8821_configure_sysclk(nau8821, NAU8821_CLK_DIS, 0);
15241529
if (nau8821->irq) {
15251530
/* Clear all interruption status */
1526-
nau8821_int_status_clear_all(regmap);
1531+
nau8821_irq_status_clear(regmap, 0);
15271532

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

0 commit comments

Comments
 (0)