All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	alsa-devel@alsa-project.org
Cc: tiwai@suse.de, vinod.koul@intel.com, broonie@kernel.org,
	liam.r.girdwood@linux.intel.com, Bard Liao <bardliao@realtek.com>
Subject: Re: [PATCH] ASoC: rt5645: add fallback case for jack detection support
Date: Wed, 3 Jan 2018 23:20:38 +0100	[thread overview]
Message-ID: <6b845088-9900-789c-1137-811321e23252@redhat.com> (raw)
In-Reply-To: <20180103184241.11690-1-pierre-louis.bossart@linux.intel.com>

Hi,

On 03-01-18 19:42, Pierre-Louis Bossart wrote:
> Commit 78f5605c0329 ("ASoC: rt5645: cleanup DMI matching code") did a
> lot of useful cleanups, but the logic is a bit flawed: if there is no
> DMI match on an ACPI machine, the code reads non-existent properties.

Reading non existent properties is not a problem, notice that the check
only checks if one of the properties is present, the others may still
be unset, which is fine, then the code reading the properties will leave
everything 0 / false.
> Re-add previous code that checked for the existence of those
> properties and a fallback mode to enable jd-mode3 if there is no
> pdata, device property or quirk. This will help avoid having to add
> new DMI quirks when only the jd-mode is needed for headset playback.

Note I do think that defaulting to jd_mode = 3 is a good idea,
I just believe that the commit message wrongly give the impression
that reading non-existent props is a problem.

> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Bard Liao <bardliao@realtek.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>   sound/soc/codecs/rt5645.c | 15 ++++++++++++++-
>   1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
> index ebc4f5970f24..476020445f65 100644
> --- a/sound/soc/codecs/rt5645.c
> +++ b/sound/soc/codecs/rt5645.c
> @@ -3687,6 +3687,17 @@ static const struct dmi_system_id dmi_platform_data[] = {
>   	{ }
>   };
>   
> +static bool rt5645_check_dp(struct device *dev)
> +{
> +	if (device_property_present(dev, "realtek,in2-differential") ||
> +	    device_property_present(dev, "realtek,dmic1-data-pin") ||
> +	    device_property_present(dev, "realtek,dmic2-data-pin") ||
> +	    device_property_present(dev, "realtek,jd-mode"))
> +		return true;
> +
> +	return false;
> +}
> +
>   static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
>   {
>   	rt5645->pdata.in2_diff = device_property_read_bool(dev,
> @@ -3727,8 +3738,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
>   
>   	if (pdata)
>   		rt5645->pdata = *pdata;
> -	else
> +	else if (rt5645_check_dp(&i2c->dev))
>   		rt5645_parse_dt(rt5645, &i2c->dev);
> +	else
> +		rt5645->pdata = jd_mode3_platform_data;

How about:

		rt5645->pdata.jd_mode = 3;

instead and remove jd_mode3_platform_data and the 2 dmi table entries
pointing to it ?

Regards,

Hans



>   
>   	if (quirk != -1) {
>   		rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk);
> 

  reply	other threads:[~2018-01-03 22:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 18:42 [PATCH] ASoC: rt5645: add fallback case for jack detection support Pierre-Louis Bossart
2018-01-03 22:20 ` Hans de Goede [this message]
2018-01-04 11:59   ` Mark Brown
2018-01-04 15:15     ` Pierre-Louis Bossart
2018-01-12 12:28 ` Applied "ASoC: rt5645: add fallback case for jack detection support" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b845088-9900-789c-1137-811321e23252@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bardliao@realtek.com \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.