From: Hans de Goede <hdegoede@redhat.com>
To: Mark Brown <broonie@kernel.org>
Cc: Oder Chiou <oder_chiou@realtek.com>,
devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
Takashi Iwai <tiwai@suse.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Carlo Caione <carlo@endlessm.com>,
Bard Liao <bardliao@realtek.com>
Subject: Re: [PATCH v2 06/32] ASoC: rt5651: Configure jack-detect source through a device-property
Date: Fri, 2 Mar 2018 10:32:25 +0100 [thread overview]
Message-ID: <2ac828b2-04e1-4b5f-f4db-a543ad5e3535@redhat.com> (raw)
In-Reply-To: <032d0e59-0d64-7df1-4fca-1709430b754c@redhat.com>
Hi,
On 01-03-18 23:35, Hans de Goede wrote:
> Hi,
>
> On 01-03-18 20:30, Mark Brown wrote:
>> On Sun, Feb 25, 2018 at 11:46:47AM +0100, Hans de Goede wrote:
>>> Configure the jack-detect source through a device-property which can be
>>> set by code outside of the codec driver. Rather then putting platform
>>> specific DMI quirks inside the generic codec driver.
>>
>>> And move the jack-detect-source quirk for the KIANO SlimNote 14.2, which
>>> was present inside the codec driver to the machine driver, where we can
>>> bundle it together with the other quirks already present for this laptop.
>>
>> Multiple things in a patch again :/
>
> Yes because the property replaces the quirk, I can split the changes between
> the codec and machine driver into 2 patches but then the intermediate state
> will be that the jack-detection no longer works.
>
>> The property itself is fine but...
>>
>>> @@ -360,6 +377,13 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
>>> dev_err(card->dev, "unable to set MCLK rate\n");
>>> }
>>> + props[cnt++] = PROPERTY_ENTRY_U32("realtek,jack-detect-source",
>>> + BYT_RT5651_JDSRC(byt_rt5651_quirk));
>>> +
>>> + ret = device_add_properties(codec->dev, props);
>>> + if (ret)
>>> + return ret;
>>> +
>>> ret = snd_soc_card_jack_new(runtime->card, "Headset",
>>
>> I'm having a hard time geting comfortable with this; it's all a bit
>> fragile feeling to me - someone deciding to centralise the property
>> parsing (eg, if they are using a platform where platform data makes
>> sense or want to cross-validate with some other property on probe) could
>> easily break things and there's not even a comment in the CODEC driver.
>
> It is not _that_ fragile, but I agree that it would be good to add
> a comment about not moving the property-parsing to the codec driver.
So one other solution which comes to mind here is to move the
snd_soc_card_jack_new() call into the codec driver's
rt5651_apply_properties() function (conditional on a jack src being
set in the properties).
This would make the machine driver code look like this:
props[cnt++] = PROPERTY_ENTRY_...
props[cnt++] = PROPERTY_ENTRY_...
props[cnt++] = PROPERTY_ENTRY_...
props[cnt++] = PROPERTY_ENTRY_...
ret = device_add_properties(codec->dev, props);
if (ret)
return ret;
ret = rt5651_apply_properties(codec);
if (ret)
return ret;
Which makes the ordering really clear without needing any
comments.
This will also make the jack-detect device-properties work with
devicetree platforms without any changes to their platform code,
which currently is not the case since the non Intel platform-code
does not call snd_soc_component_set_jack().
Thinking more about this I believe that doing the
snd_soc_card_jack_new() call inside the codec driver based on
device-properties is a better solution then doing it in the
machine driver.
Please let me know if you agree then I will rework the remaining
patches accordingly.
Regards,
Hans
next prev parent reply other threads:[~2018-03-02 9:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180225104713.4745-1-hdegoede@redhat.com>
2018-02-25 10:46 ` [PATCH v2 06/32] ASoC: rt5651: Configure jack-detect source through a device-property Hans de Goede
2018-03-01 19:30 ` Mark Brown
2018-03-01 22:35 ` Hans de Goede
2018-03-02 9:32 ` Hans de Goede [this message]
2018-03-02 12:18 ` Mark Brown
2018-03-02 12:58 ` Hans de Goede
2018-03-02 17:41 ` Mark Brown
2018-03-03 21:20 ` Hans de Goede
2018-03-02 22:17 ` Rob Herring
2018-02-25 10:46 ` [PATCH v2 17/32] ASoC: rt5651: Allow specifying over-current thresholds through device-properties Hans de Goede
2018-03-02 22:18 ` Rob Herring
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=2ac828b2-04e1-4b5f-f4db-a543ad5e3535@redhat.com \
--to=hdegoede@redhat.com \
--cc=alsa-devel@alsa-project.org \
--cc=bardliao@realtek.com \
--cc=broonie@kernel.org \
--cc=carlo@endlessm.com \
--cc=devicetree@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).