diff mbox

ASoC: sgtl5000: add device tree probe support

Message ID 1311265731-23318-1-git-send-email-shawn.guo@linaro.org
State New
Headers show

Commit Message

Shawn Guo July 21, 2011, 4:28 p.m. UTC
It adds device tree probe support for sgtl5000 driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Zeng Zhaoming <zhaoming.zeng@freescale.com>
Cc: Liam Girdwood <lrg@ti.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 .../bindings/sound/soc/codecs/fsl-sgtl5000.txt     |   11 +++++++++++
 sound/soc/codecs/sgtl5000.c                        |    8 ++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt

Comments

Mark Brown July 26, 2011, 7:55 p.m. UTC | #1
On Fri, Jul 22, 2011 at 12:28:51AM +0800, Shawn Guo wrote:

> It adds device tree probe support for sgtl5000 driver.

Kind of waiting for the device tree people to comment on this...

>  .../bindings/sound/soc/codecs/fsl-sgtl5000.txt     |   11 +++++++++++

I'd expect this can just be put directly under the sound directory.

> +++ b/Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt
> @@ -0,0 +1,11 @@
> +* Freescale SGTL5000 Stereo Codec
> +
> +Required properties:
> +- compatible : "fsl,sgtl5000".
> +
> +Example:
> +
> +codec: sgtl5000@0a {
> +	compatible = "fsl,sgtl5000";
> +	reg = <0x0a>;
> +};

This might get a tiny bit verbose...  I wonder if it makes sense to have
some central file for devices with trivial bindings?  But possibly more
trouble than it's worth.
Shawn Guo July 29, 2011, 2:40 a.m. UTC | #2
On Tue, Jul 26, 2011 at 08:55:11PM +0100, Mark Brown wrote:
> On Fri, Jul 22, 2011 at 12:28:51AM +0800, Shawn Guo wrote:
> 
> > It adds device tree probe support for sgtl5000 driver.
> 
> Kind of waiting for the device tree people to comment on this...
> 

Grant, please?

Regards,
Shawn

> >  .../bindings/sound/soc/codecs/fsl-sgtl5000.txt     |   11 +++++++++++
> 
> I'd expect this can just be put directly under the sound directory.
> 
> > +++ b/Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt
> > @@ -0,0 +1,11 @@
> > +* Freescale SGTL5000 Stereo Codec
> > +
> > +Required properties:
> > +- compatible : "fsl,sgtl5000".
> > +
> > +Example:
> > +
> > +codec: sgtl5000@0a {
> > +	compatible = "fsl,sgtl5000";
> > +	reg = <0x0a>;
> > +};
> 
> This might get a tiny bit verbose...  I wonder if it makes sense to have
> some central file for devices with trivial bindings?  But possibly more
> trouble than it's worth.
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
>
Grant Likely July 29, 2011, 4 p.m. UTC | #3
On Tue, Jul 26, 2011 at 08:55:11PM +0100, Mark Brown wrote:
> On Fri, Jul 22, 2011 at 12:28:51AM +0800, Shawn Guo wrote:
> 
> > It adds device tree probe support for sgtl5000 driver.
> 
> Kind of waiting for the device tree people to comment on this...
> 
> >  .../bindings/sound/soc/codecs/fsl-sgtl5000.txt     |   11 +++++++++++
> 
> I'd expect this can just be put directly under the sound directory.
> 
> > +++ b/Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt
> > @@ -0,0 +1,11 @@
> > +* Freescale SGTL5000 Stereo Codec
> > +
> > +Required properties:
> > +- compatible : "fsl,sgtl5000".
> > +
> > +Example:
> > +
> > +codec: sgtl5000@0a {
> > +	compatible = "fsl,sgtl5000";
> > +	reg = <0x0a>;
> > +};
> 
> This might get a tiny bit verbose...  I wonder if it makes sense to have
> some central file for devices with trivial bindings?  But possibly more
> trouble than it's worth.

Yes, I think it would be valuable.  I've been thinking a lot about how
to make binding documentation less verbose and have much better cross
referencing so that binding documentation doesn't need to include all
kinds of common property definitions. I've had no time to work on
it though... I need an intern student.  :-)

g.
Grant Likely July 29, 2011, 4 p.m. UTC | #4
On Fri, Jul 29, 2011 at 10:40:51AM +0800, Shawn Guo wrote:
> On Tue, Jul 26, 2011 at 08:55:11PM +0100, Mark Brown wrote:
> > On Fri, Jul 22, 2011 at 12:28:51AM +0800, Shawn Guo wrote:
> > 
> > > It adds device tree probe support for sgtl5000 driver.
> > 
> > Kind of waiting for the device tree people to comment on this...
> > 
> 
> Grant, please?

Acked-by: Grant Likely <grant.likely@secretlab.ca>
> 
> Regards,
> Shawn
> 
> > >  .../bindings/sound/soc/codecs/fsl-sgtl5000.txt     |   11 +++++++++++
> > 
> > I'd expect this can just be put directly under the sound directory.
> > 
> > > +++ b/Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt
> > > @@ -0,0 +1,11 @@
> > > +* Freescale SGTL5000 Stereo Codec
> > > +
> > > +Required properties:
> > > +- compatible : "fsl,sgtl5000".
> > > +
> > > +Example:
> > > +
> > > +codec: sgtl5000@0a {
> > > +	compatible = "fsl,sgtl5000";
> > > +	reg = <0x0a>;
> > > +};
> > 
> > This might get a tiny bit verbose...  I wonder if it makes sense to have
> > some central file for devices with trivial bindings?  But possibly more
> > trouble than it's worth.
> > _______________________________________________
> > devicetree-discuss mailing list
> > devicetree-discuss@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/devicetree-discuss
> > 
>
Mark Brown July 29, 2011, 4:37 p.m. UTC | #5
On Fri, Jul 22, 2011 at 12:28:51AM +0800, Shawn Guo wrote:
> It adds device tree probe support for sgtl5000 driver.

Applied, thanks.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt b/Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt
new file mode 100644
index 0000000..2c3cd41
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt
@@ -0,0 +1,11 @@ 
+* Freescale SGTL5000 Stereo Codec
+
+Required properties:
+- compatible : "fsl,sgtl5000".
+
+Example:
+
+codec: sgtl5000@0a {
+	compatible = "fsl,sgtl5000";
+	reg = <0x0a>;
+};
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 76258f2..cf6eea8 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -20,6 +20,7 @@ 
 #include <linux/regulator/driver.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/consumer.h>
+#include <linux/of_device.h>
 #include <sound/core.h>
 #include <sound/tlv.h>
 #include <sound/pcm.h>
@@ -1494,10 +1495,17 @@  static const struct i2c_device_id sgtl5000_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, sgtl5000_id);
 
+static const struct of_device_id sgtl5000_dt_ids[] = {
+	{ .compatible = "fsl,sgtl5000", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(i2c, sgtl5000_dt_ids);
+
 static struct i2c_driver sgtl5000_i2c_driver = {
 	.driver = {
 		   .name = "sgtl5000",
 		   .owner = THIS_MODULE,
+		   .of_match_table = sgtl5000_dt_ids,
 		   },
 	.probe = sgtl5000_i2c_probe,
 	.remove = __devexit_p(sgtl5000_i2c_remove),