Re: [PATCH 2/4] ASoC: arizona: always parse device properties regardless of platform data
From: Dmitry Torokhov
Date: Mon Nov 23 2026 - 14:52:44 EST
Hi Mark,
On Sun, Nov 08, 2026 at 12:54:20PM +0000, Mark Brown wrote:
> > @@ -1184,7 +1184,7 @@ static int arizona_extcon_device_get_pdata(struct device *dev,
> > struct arizona *arizona)
> > {
> > struct arizona_pdata *pdata = &arizona->pdata;
> > - unsigned int val = ARIZONA_ACCDET_MODE_HPL;
> > + unsigned int val = pdata->hpdet_channel ?: ARIZONA_ACCDET_MODE_HPL;
>
> This changes the default from ARIZONA_ACCDET_MODE_MIC to
> ARIZONA_ACCDET_MODE_HPL, and might be clearer if written using a normal
> logic statement.
ARIZONA_ACCDET_MODE_MIC (0) is not actually a valid headphone detection
channel: hpdet_channel is only programmed before starting ARIZONA_HP_POLL
to measure headphone impedance on HPL or HPR, and the switch right below
(as well as the DT binding) rejects 0 and falls back to HPL.
Before commit 9e86b2ad4c11 ("extcon: arizona: Add support for select
accessory detect mode when headphone detection"), ARIZONA_ACCDET_MODE_HPL
was hardcoded for all boards; that commit only initialized the default in
the OF path, leaving platform-data boards that omit hpdet_channel (such
as crag6410) with 0 by accident.
Fair point on the ternary though. I will rewrite this in v2 using a plain
if check (only validating "wlf,hpdet-channel" when the property is
present, and defaulting unset pdata->hpdet_channel to
ARIZONA_ACCDET_MODE_HPL in arizona_jack_codec_dev_probe(), matching
pdata->micd_timeout) and note the default behavior in the commit message.
Thanks.
--
Dmitry