From: Lars-Peter Clausen <lars@metafoo.de>
To: "Andreas Irestål" <andreas.irestal@axis.com>,
alsa-devel@alsa-project.org
Cc: "Andreas Irestål" <andire@axis.com>
Subject: Re: [PATCH 4/4] ASoC: adau17x1: Add option to provide platform data via DT
Date: Thu, 4 Feb 2016 22:01:16 +0100 [thread overview]
Message-ID: <56B3BC1C.8010907@metafoo.de> (raw)
In-Reply-To: <1454423510-1330-5-git-send-email-andire@axis.com>
At least a bit of commit message would be nice.
On 02/02/2016 03:31 PM, Andreas Irestål wrote:
> Signed-off-by: Andreas Irestål <andire@axis.com>
> ---
> .../devicetree/bindings/sound/adi,adau17x1.txt | 33 ++++++
> include/dt-bindings/sound/adau17x1.h | 14 +++
> sound/soc/codecs/adau1761.c | 131 +++++++++++++++++++++
> sound/soc/codecs/adau1781.c | 57 +++++++++
> 4 files changed, 235 insertions(+)
> create mode 100644 include/dt-bindings/sound/adau17x1.h
>
> diff --git a/Documentation/devicetree/bindings/sound/adi,adau17x1.txt b/Documentation/devicetree/bindings/sound/adi,adau17x1.txt
> index 90f3ac3..296b417 100644
> --- a/Documentation/devicetree/bindings/sound/adi,adau17x1.txt
> +++ b/Documentation/devicetree/bindings/sound/adi,adau17x1.txt
> @@ -12,10 +12,43 @@ Required properties:
> - reg: The i2c address. Value depends on the state of ADDR0
> and ADDR1, as wired in hardware.
>
> +Optional properties:
> +
> + - input-differential bool to set if the input is differential
> + - digital-microphone bool to set if there is a digital microphone connected
> + to the digmic/jackdet pin.
> + - micbias-vg Microphone bias voltage
> + MICBIAS_0_90_AVDD - 0.9 * AVDD
> + MICBIAS_0_65_AVDD - 0.65 * AVDD
> +
> +Optional properties (ADAU1361/ADAU1461/ADAU1761/ADAU1961 only)
> +
> + - jack-detection If present, configures codec to use the digmic/jackdet
> + pin for jack detection. must provide one of
> + JACKDETECT_ACTIVE_LO or JACKDETECT_ACTIVE_HI followed
> + by debounce time in ms, which must be 5, 10, 20, or 40.
> +
> + - lineout-mode Set output mode of the lineout pins.
> + - headphone-mode Set output mode of the headphone pins.
These properties all need a vendor prefix ("adi,").
[...]
> +
> +static void adau1761_pdata_from_of(struct snd_soc_codec *codec,
> + struct adau1761_platform_data *pdata)
> +{
> + struct device_node *np = codec->dev->of_node;
> + uint32_t val;
> + uint32_t debounce_pars[2];
> +
> + if (of_get_property(np, "input-differential", NULL))
There is a helper function for this of_property_read_bool().
> + pdata->input_differential = 1;
> + else
> + pdata->input_differential = 0;
> +
[...]
> +
> static int adau1761_codec_probe(struct snd_soc_codec *codec)
> {
> struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
> struct adau1761_platform_data *pdata = codec->dev->platform_data;
> struct adau *adau = snd_soc_codec_get_drvdata(codec);
> + struct device_node *np = codec->dev->of_node;
> + struct adau1761_platform_data *of_pdata;
> int ret;
>
> + if (!pdata && np && of_device_is_available(np)) {
> + of_pdata = devm_kzalloc(codec->dev, sizeof(*of_pdata),
> + GFP_KERNEL);
> + if (!of_pdata)
> + return -ENOMEM;
> + adau1761_pdata_from_of(codec, of_pdata);
> + pdata = of_pdata;
> + codec->dev->platform_data = pdata;
The parsing should be done in the main probe function. This will make sure
that we propagate errors up the stack the right way.
> + }
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2016-02-04 21:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 14:31 [PATCH 0/4] ASoC: adau17x1: Minor fixes and DT support Andreas Irestål
2016-02-02 14:31 ` [PATCH 1/4] ASoC: adau17x1: Fix incorrect BCLK ratio definitions Andreas Irestål
2016-02-24 4:15 ` Applied "ASoC: adau17x1: Fix incorrect BCLK ratio definitions" to the asoc tree Mark Brown
2016-02-02 14:31 ` [PATCH 2/4] ASoc: adau17x1: Correct typos in file headers Andreas Irestål
2016-02-24 4:15 ` Applied "ASoC: adau17x1: Correct typos in file headers" to the asoc tree Mark Brown
2016-02-02 14:31 ` [PATCH 3/4] ASoC: adau17x1: Add basic DT support for adau17x1 Andreas Irestål
2016-02-02 14:31 ` [PATCH 4/4] ASoC: adau17x1: Add option to provide platform data via DT Andreas Irestål
2016-02-04 21:01 ` Lars-Peter Clausen [this message]
2016-02-04 20:54 ` [PATCH 0/4] ASoC: adau17x1: Minor fixes and DT support Lars-Peter Clausen
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=56B3BC1C.8010907@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=andire@axis.com \
--cc=andreas.irestal@axis.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.