Re: [PATCH 2/6] ASoC: amd: yc: Add a module parameter to influence pdm_gain

From: Jaroslav Kysela
Date: Fri Jan 27 2023 - 11:42:03 EST


On 27. 01. 23 17:25, Limonciello, Mario wrote:
[AMD Official Use Only - General]



-----Original Message-----
From: Jaroslav Kysela <perex@xxxxxxxx>
Sent: Friday, January 27, 2023 10:23
To: Limonciello, Mario <Mario.Limonciello@xxxxxxx>; Mukunda, Vijendar
<Vijendar.Mukunda@xxxxxxx>; Saba Kareem, Syed
<Syed.SabaKareem@xxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx
Cc: Pananchikkal, Renjith <Renjith.Pananchikkal@xxxxxxx>; Mark Pearson
<mpearson@xxxxxxxxxx>; Liam Girdwood <lgirdwood@xxxxxxxxx>; Mark
Brown <broonie@xxxxxxxxxx>; Takashi Iwai <tiwai@xxxxxxxx>; alsa-
devel@xxxxxxxxxxxxxxxx
Subject: Re: [PATCH 2/6] ASoC: amd: yc: Add a module parameter to
influence pdm_gain

On 27. 01. 23 17:01, Mario Limonciello wrote:
In case of regressions for any users that the new pdm_gain value is
too high and for additional debugging, introduce a module parameter
that would let them configure it.

Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
sound/soc/amd/yc/acp6x-pdm-dma.c | 7 ++++++-
sound/soc/amd/yc/acp6x.h | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)

...

pdm_ctrl = acp6x_readl(acp_base + ACP_WOV_MISC_CTRL);
- pdm_ctrl |= ACP_WOV_MISC_CTRL_MASK;
+ pdm_ctrl |= FIELD_PREP(ACP_WOV_GAIN_CONTROL, pdm_gain);

The bits should be zeroed (AND - &) before OR to make sure that the correct
value is written to the register. More related patches are affected.

I had consider this, but the hardware default at reset is 0x0. Do you think it's
still necessary for posterity?

You're using 0644 permissions for the module parameter, so the value can be changed by root using sysfs anytime (between SNDRV_PCM_TRIGGER calls).

Jaroslav

--
Jaroslav Kysela <perex@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.