From: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
To: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
olofj-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org
Subject: Re: [RFC 3/3] ARM:Tegra: Device Tree Support: Initialize from wm8903 the device tree
Date: Thu, 12 May 2011 09:49:19 +0200 [thread overview]
Message-ID: <20110512074917.GA16250@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20110511232711.10362.53256.stgit@riker>
On Wed, May 11, 2011 at 04:27:18PM -0700, John Bonesio wrote:
> This patch makes it so the wm8903 is initialized from it's device tree node.
>
> Signed-off-by: John Bonesio<bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> ---
>
> arch/arm/boot/dts/tegra-harmony.dts | 17 ++++++
> sound/soc/codecs/wm8903.c | 93 +++++++++++++++++++++++++++++++++--
This needs to be sent separately to the relevant mailing lists and
maintainers. You can't go making substantial changes to drivers without
even telling the maintainers about it - this will apply to any device
tree work you're doing. In this case one of the maintainers happens to
be me, but even so.
> + interrupts = < 347 >;
> + irq-active-low = <0>;
> + micdet-cfg = <0>;
> + micdet-delay = <100>;
Some of this looks like chip default, why is it being configured?
> + gpio-controller;
> + #gpio-cells = <2>;
The fact that this device is a GPIO controller is a physical property of
the device, we shouldn't need to be putting it into the device tree.
> + gpio-num-cfg = < 5 >;
Similarly here, the device has a fixed number of GPIOs.
> + /* #define WM8903_GPIO_NO_CONFIG 0x8000 */
> + gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >;
This doesn't seem great for usability. I'd suggest key/value pairs
rather than an array.
> - if (pdata && pdata->gpio_base)
> + wm8903->gpio_chip.base = -1;
> + if (pdata && pdata->gpio_base) {
> wm8903->gpio_chip.base = pdata->gpio_base;
> - else
> - wm8903->gpio_chip.base = -1;
> + } else if (codec->dev->of_node) {
> + prop = of_get_property(codec->dev->of_node, "gpio-base", NULL);
> + if (prop)
> + wm8903->gpio_chip.base = be32_to_cpup(prop);
> + }
We have to do manual endianness conversions to read from the device
tree? Oh, well.
> +
> + prop = of_get_property(codec->dev->of_node, "interrupts", NULL);
> + if (prop)
> + wm8903->irq = be32_to_cpup(prop);
> +
We have a standard way of passing the IRQ number to I2C devices, surely
we should make sure that works at the bus level rather than having to
replicate this code everywhere?
> + prop = of_get_property(codec->dev->of_node, "micdet-cfg", NULL);
> + if (prop)
> + micdet_cfg = be32_to_cpup(prop);
> +
> + snd_soc_write(codec, WM8903_MIC_BIAS_CONTROL_0, micdet_cfg);
> +
> + if (micdet_cfg)
> + snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0,
> + WM8903_WSEQ_ENA, WM8903_WSEQ_ENA);
> +
> + /* If microphone detection is enabled in device tree but
> + * detected via IRQ then interrupts can be lost before
> + * the machine driver has set up microphone detection
> + * IRQs as the IRQs are clear on read. The detection
> + * will be enabled when the machine driver configures.
> + */
> + WARN_ON(!mic_gpio && (micdet_cfg & WM8903_MICDET_ENA));
> +
There's an awful lot of cut'n'paste code for the parsing code from the
platform data code.
> config SND_TEGRA_SOC_HARMONY
> tristate "SoC Audio support for Tegra Harmony reference board"
> - depends on SND_TEGRA_SOC && MACH_HARMONY && I2C
> + depends on SND_TEGRA_SOC && (MACH_HARMONY || MACH_TEGRA_DT) && I2C
You've not added anything to the device tree to register the platform
device for the machine and I rather fear this won't apply to current
code. You should develop against -next.
WARNING: multiple messages have this Message-ID (diff)
From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 3/3] ARM:Tegra: Device Tree Support: Initialize from wm8903 the device tree
Date: Thu, 12 May 2011 09:49:19 +0200 [thread overview]
Message-ID: <20110512074917.GA16250@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20110511232711.10362.53256.stgit@riker>
On Wed, May 11, 2011 at 04:27:18PM -0700, John Bonesio wrote:
> This patch makes it so the wm8903 is initialized from it's device tree node.
>
> Signed-off-by: John Bonesio<bones@secretlab.ca>
> ---
>
> arch/arm/boot/dts/tegra-harmony.dts | 17 ++++++
> sound/soc/codecs/wm8903.c | 93 +++++++++++++++++++++++++++++++++--
This needs to be sent separately to the relevant mailing lists and
maintainers. You can't go making substantial changes to drivers without
even telling the maintainers about it - this will apply to any device
tree work you're doing. In this case one of the maintainers happens to
be me, but even so.
> + interrupts = < 347 >;
> + irq-active-low = <0>;
> + micdet-cfg = <0>;
> + micdet-delay = <100>;
Some of this looks like chip default, why is it being configured?
> + gpio-controller;
> + #gpio-cells = <2>;
The fact that this device is a GPIO controller is a physical property of
the device, we shouldn't need to be putting it into the device tree.
> + gpio-num-cfg = < 5 >;
Similarly here, the device has a fixed number of GPIOs.
> + /* #define WM8903_GPIO_NO_CONFIG 0x8000 */
> + gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >;
This doesn't seem great for usability. I'd suggest key/value pairs
rather than an array.
> - if (pdata && pdata->gpio_base)
> + wm8903->gpio_chip.base = -1;
> + if (pdata && pdata->gpio_base) {
> wm8903->gpio_chip.base = pdata->gpio_base;
> - else
> - wm8903->gpio_chip.base = -1;
> + } else if (codec->dev->of_node) {
> + prop = of_get_property(codec->dev->of_node, "gpio-base", NULL);
> + if (prop)
> + wm8903->gpio_chip.base = be32_to_cpup(prop);
> + }
We have to do manual endianness conversions to read from the device
tree? Oh, well.
> +
> + prop = of_get_property(codec->dev->of_node, "interrupts", NULL);
> + if (prop)
> + wm8903->irq = be32_to_cpup(prop);
> +
We have a standard way of passing the IRQ number to I2C devices, surely
we should make sure that works at the bus level rather than having to
replicate this code everywhere?
> + prop = of_get_property(codec->dev->of_node, "micdet-cfg", NULL);
> + if (prop)
> + micdet_cfg = be32_to_cpup(prop);
> +
> + snd_soc_write(codec, WM8903_MIC_BIAS_CONTROL_0, micdet_cfg);
> +
> + if (micdet_cfg)
> + snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0,
> + WM8903_WSEQ_ENA, WM8903_WSEQ_ENA);
> +
> + /* If microphone detection is enabled in device tree but
> + * detected via IRQ then interrupts can be lost before
> + * the machine driver has set up microphone detection
> + * IRQs as the IRQs are clear on read. The detection
> + * will be enabled when the machine driver configures.
> + */
> + WARN_ON(!mic_gpio && (micdet_cfg & WM8903_MICDET_ENA));
> +
There's an awful lot of cut'n'paste code for the parsing code from the
platform data code.
> config SND_TEGRA_SOC_HARMONY
> tristate "SoC Audio support for Tegra Harmony reference board"
> - depends on SND_TEGRA_SOC && MACH_HARMONY && I2C
> + depends on SND_TEGRA_SOC && (MACH_HARMONY || MACH_TEGRA_DT) && I2C
You've not added anything to the device tree to register the platform
device for the machine and I rather fear this won't apply to current
code. You should develop against -next.
next prev parent reply other threads:[~2011-05-12 7:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-11 23:26 [RFC 0/3] ARM: Tegra: Device Tree: i2c & wm8903 John Bonesio
2011-05-11 23:26 ` John Bonesio
2011-05-11 23:26 ` [RFC 1/3] ARM: Tegra: Device Tree Support: Update how sdhci devices are initialized John Bonesio
2011-05-12 4:13 ` Stephen Warren
2011-05-12 4:13 ` Stephen Warren
2011-05-11 23:27 ` [RFC 2/3] ARM: Tegra: Device Tree Support: Add i2c devices John Bonesio
2011-05-12 4:34 ` Stephen Warren
2011-05-12 4:34 ` Stephen Warren
[not found] ` <74CDBE0F657A3D45AFBB94109FB122FF04986AA2C5-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-05-12 4:47 ` Grant Likely
2011-05-12 4:47 ` Grant Likely
[not found] ` <BANLkTinvDRDfdGawFBb=OE8DqG_DW7L6qQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-12 5:10 ` Stephen Warren
2011-05-12 5:10 ` Stephen Warren
2011-05-11 23:27 ` [RFC 3/3] ARM:Tegra: Device Tree Support: Initialize from wm8903 the device tree John Bonesio
2011-05-12 5:01 ` Stephen Warren
2011-05-12 5:01 ` Stephen Warren
2011-05-12 7:49 ` Mark Brown [this message]
2011-05-12 7:49 ` Mark Brown
[not found] ` <20110512074917.GA16250-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-06-02 16:46 ` Grant Likely
2011-06-02 16:46 ` Grant Likely
[not found] ` <BANLkTimqf+BC=R3qRn3z3eKOjNXohGUsHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-03 9:06 ` Mark Brown
2011-06-03 9:06 ` Mark Brown
2011-06-03 16:20 ` Grant Likely
2011-06-03 16:20 ` Grant Likely
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=20110512074917.GA16250@opensource.wolfsonmicro.com \
--to=broonie-yzvpicuk2aatku/dhu1wvuem+bqzidxxqq4iyu8u01e@public.gmane.org \
--cc=bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=olofj-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
/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.