diff mbox

ASoC: nau8824: user configuration of key detection

Message ID 1521617423-2213-1-git-send-email-KCHSU0@nuvoton.com (mailing list archive)
State Accepted
Commit 7b0037fa2d6048284e90de4131fc53c0ac1d4430
Headers show

Commit Message

AS50 KCHsu0 March 21, 2018, 7:30 a.m. UTC
The SAR ADC of key press detection varies depending on headset.
We can't make a set of common threshold values for every case.
Therefore, the driver provides configuration for user and
they can set up values by UCM configuration.

Signed-off-by: John Hsu <KCHSU0@nuvoton.com>
---
 sound/soc/codecs/nau8824.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Mark Brown March 22, 2018, 2:07 a.m. UTC | #1
On Wed, Mar 21, 2018 at 03:30:23PM +0800, John Hsu wrote:
> The SAR ADC of key press detection varies depending on headset.
> We can't make a set of common threshold values for every case.
> Therefore, the driver provides configuration for user and
> they can set up values by UCM configuration.

It's more normal for this configuration to be done as part of the
platform bindings for the device, with the values being tuned based on
the in box headset and the tastes of the system integrator, seeing this
exposed as a userspace control is a bit surprising - what motivated
that?

If we are going to have this tunable from userspace we probably want a
standard interface for it so that the userspace software can work more
generally.  However that's a bit tricky as the tunable parameters are
going to vary...
AS50 KCHsu0 March 22, 2018, 2:41 a.m. UTC | #2
On 3/22/2018 10:07 AM, Mark Brown wrote:
> On Wed, Mar 21, 2018 at 03:30:23PM +0800, John Hsu wrote:
>> The SAR ADC of key press detection varies depending on headset.
>> We can't make a set of common threshold values for every case.
>> Therefore, the driver provides configuration for user and
>> they can set up values by UCM configuration.
>
> It's more normal for this configuration to be done as part of the
> platform bindings for the device, with the values being tuned based on
> the in box headset and the tastes of the system integrator, seeing this
> exposed as a userspace control is a bit surprising - what motivated
> that?
>
> If we are going to have this tunable from userspace we probably want a
> standard interface for it so that the userspace software can work more
> generally.  However that's a bit tricky as the tunable parameters are
> going to vary...

There is binding values in devicetree or ACPI when product shipping.
Sometimes users find the wrong response of key press when they use their
specific headset. That means they have to tune their SAR threshold of chip,
and they need our support for the values. But the value is kept in ACPI,
and it's not easy for the user to adapt the new one which we provide.
I think the easy way is that they can put the values in UCM and happy to
use their favorite headset.



===========================================================================================
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.
diff mbox

Patch

diff --git a/sound/soc/codecs/nau8824.c b/sound/soc/codecs/nau8824.c
index 637e952..76502c0 100644
--- a/sound/soc/codecs/nau8824.c
+++ b/sound/soc/codecs/nau8824.c
@@ -409,6 +409,15 @@  static const struct snd_kcontrol_new nau8824_snd_controls[] = {
 
 	SOC_SINGLE("DACL LR Mix", NAU8824_REG_DAC_MUTE_CTRL, 0, 1, 0),
 	SOC_SINGLE("DACR LR Mix", NAU8824_REG_DAC_MUTE_CTRL, 1, 1, 0),
+
+	SOC_SINGLE("THD for key media",
+		NAU8824_REG_VDET_THRESHOLD_1, 8, 0xff, 0),
+	SOC_SINGLE("THD for key voice command",
+		NAU8824_REG_VDET_THRESHOLD_1, 0, 0xff, 0),
+	SOC_SINGLE("THD for key volume up",
+		NAU8824_REG_VDET_THRESHOLD_2, 8, 0xff, 0),
+	SOC_SINGLE("THD for key volume down",
+		NAU8824_REG_VDET_THRESHOLD_2, 0, 0xff, 0),
 };
 
 static int nau8824_output_dac_event(struct snd_soc_dapm_widget *w,