diff mbox

ASoC: mc13783: Add devicetree support

Message ID 1398495423-2223-1-git-send-email-shc_work@mail.ru (mailing list archive)
State Accepted
Commit 780aaeff96819ca58e0cad830bfbe6eee9aef82c
Headers show

Commit Message

Alexander Shiyan April 26, 2014, 6:57 a.m. UTC
This patch adds devicetree support for mc13783-codec.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 Documentation/devicetree/bindings/mfd/mc13xxx.txt |  3 +++
 drivers/mfd/mc13xxx-core.c                        | 10 +++++++---
 sound/soc/codecs/mc13783.c                        | 14 +++++++++++++-
 3 files changed, 23 insertions(+), 4 deletions(-)

Comments

Lee Jones April 28, 2014, 11:17 a.m. UTC | #1
> This patch adds devicetree support for mc13783-codec.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  Documentation/devicetree/bindings/mfd/mc13xxx.txt |  3 +++
>  drivers/mfd/mc13xxx-core.c                        | 10 +++++++---
>  sound/soc/codecs/mc13783.c                        | 14 +++++++++++++-
>  3 files changed, 23 insertions(+), 4 deletions(-)

MFD changes look sensible:
  Acked-by: Lee Jones <lee.jones@linaro.org>

I'm happy to create a shared branch if required.
Mark Brown April 29, 2014, 10:25 p.m. UTC | #2
On Sat, Apr 26, 2014 at 10:57:03AM +0400, Alexander Shiyan wrote:
> This patch adds devicetree support for mc13783-codec.

Applied, thanks.
Lee Jones April 30, 2014, 2:08 p.m. UTC | #3
> > This patch adds devicetree support for mc13783-codec.
> 
> Applied, thanks.

No Mark, no!

Documentation/devicetree/bindings/mfd/mc13xxx.txt |  3 +++
drivers/mfd/mc13xxx-core.c                        | 10 +++++++---
sound/soc/codecs/mc13783.c                        | 14 +++++++++++++-
3 files changed, 23 insertions(+), 4 deletions(-)
Lee Jones April 30, 2014, 2:17 p.m. UTC | #4
> > > > This patch adds devicetree support for mc13783-codec.
> > > 
> > > Applied, thanks.
> > 
> > No Mark, no!
> 
> What a problem, Lee?

There's no problem with the patch, don't worry.

Neither Mark, nor I can apply this patch independently, we need to
create a shared branch somewhere, or we'll risk conflicts at merge
time.
Lee Jones April 30, 2014, 2:24 p.m. UTC | #5
> > > > > > This patch adds devicetree support for mc13783-codec.
> > > > > 
> > > > > Applied, thanks.
> > > > 
> > > > No Mark, no!
> > > 
> > > What a problem, Lee?
> > 
> > There's no problem with the patch, don't worry.
> > 
> > Neither Mark, nor I can apply this patch independently, we need to
> > create a shared branch somewhere, or we'll risk conflicts at merge
> > time.
> 
> I can separate this patch for ASoC and MFD if need.
> But this will work only if both is applied.

Are there build dependencies, or only functional ones?
Lee Jones April 30, 2014, 2:33 p.m. UTC | #6
On Wed, 30 Apr 2014, Alexander Shiyan wrote:

> Wed, 30 Apr 2014 15:24:56 +0100 ?? Lee Jones <lee.jones@linaro.org>:
> > > > > > > > This patch adds devicetree support for mc13783-codec.
> > > > > > > 
> > > > > > > Applied, thanks.
> > > > > > 
> > > > > > No Mark, no!
> > > > > 
> > > > > What a problem, Lee?
> > > > 
> > > > There's no problem with the patch, don't worry.
> > > > 
> > > > Neither Mark, nor I can apply this patch independently, we need to
> > > > create a shared branch somewhere, or we'll risk conflicts at merge
> > > > time.
> > > 
> > > I can separate this patch for ASoC and MFD if need.
> > > But this will work only if both is applied.
> > 
> > Are there build dependencies, or only functional ones?
> 
> Functional only.
> At this time "fsl,mc13xxx-uses-codec" option for PMIC produce a kernel crash :)

If patches can be broken up notwithstanding build errors, they should
be.  It makes things sooo much easier.
Lee Jones April 30, 2014, 2:46 p.m. UTC | #7
> > > > > > > > > > This patch adds devicetree support for mc13783-codec.
> > > > > > > > > 
> > > > > > > > > Applied, thanks.
> > > > > > > > 
> > > > > > > > No Mark, no!
> > > > > > > 
> > > > > > > What a problem, Lee?
> > > > > > 
> > > > > > There's no problem with the patch, don't worry.
> > > > > > 
> > > > > > Neither Mark, nor I can apply this patch independently, we need to
> > > > > > create a shared branch somewhere, or we'll risk conflicts at merge
> > > > > > time.
> > > > > 
> > > > > I can separate this patch for ASoC and MFD if need.
> > > > > But this will work only if both is applied.
> > > > 
> > > > Are there build dependencies, or only functional ones?
> > > 
> > > Functional only.
> > > At this time "fsl,mc13xxx-uses-codec" option for PMIC produce a kernel crash :)
> > 
> > If patches can be broken up notwithstanding build errors, they should
> > be.  It makes things sooo much easier.
> 
> In fact that the patch for MFD is not obvious if the codec have no DT support...
> 
> If you do we see this problem (pdata == NULL and we pass this to the
> driver in DT case), for me it not worst to separate this. What we do?
> Should this be a two patches in one series or one for MFD and one for ASoC then?

You can put them into a patch-set and I will take the MFD one, Mark
will take the other.
Mark Brown April 30, 2014, 6:23 p.m. UTC | #8
On Wed, Apr 30, 2014 at 10:12:36PM +0400, Alexander Shiyan wrote:
> Wed, 30 Apr 2014 11:06:53 -0700 ?? Mark Brown <broonie@kernel.org>:

> > ----------------------------------------------------------------
> > ASoC: mc13783 DT support

> Sorry, this means that I should not create v2? 

It's probably not going to achieve an enormous amount, no.  Let's see.
Lee Jones May 1, 2014, 7:42 a.m. UTC | #9
On Wed, 30 Apr 2014, Mark Brown wrote:

> On Wed, Apr 30, 2014 at 03:17:08PM +0100, Lee Jones wrote:
> 
> > Neither Mark, nor I can apply this patch independently, we need to
> > create a shared branch somewhere, or we'll risk conflicts at merge
> > time.
> 
> You acked it without saying you didn't want me to apply it...  usually
> that means someone is OK with things getting applied.

Actually, that's not true:

MFD changes look sensible:
  Acked-by: Lee Jones <lee.jones@linaro.org>

I'm happy to create a shared branch if required.   <-----###

> In any case, as
> ever it's on a branch by itself so you can pull it in easily.  I just
> tagged it.

Very well, thanks.

> The following changes since commit c9eaa447e77efe77b7fa4c953bd62de8297fd6c5:
> 
>   Linux 3.15-rc1 (2014-04-13 14:18:35 -0700)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git tags/mc13783-asoc
> 
> for you to fetch changes up to 780aaeff96819ca58e0cad830bfbe6eee9aef82c:
> 
>   ASoC: mc13783: Add devicetree support (2014-04-29 15:24:54 -0700)
> 
> ----------------------------------------------------------------
> ASoC: mc13783 DT support
> 
> Tagged since it updates the MFD as well.
> 
> ----------------------------------------------------------------
> Alexander Shiyan (1):
>       ASoC: mc13783: Add devicetree support
> 
>  Documentation/devicetree/bindings/mfd/mc13xxx.txt |  3 +++
>  drivers/mfd/mc13xxx-core.c                        | 10 +++++++---
>  sound/soc/codecs/mc13783.c                        | 14 +++++++++++++-
>  3 files changed, 23 insertions(+), 4 deletions(-)
Mark Brown May 1, 2014, 3:06 p.m. UTC | #10
On Thu, May 01, 2014 at 08:42:53AM +0100, Lee Jones wrote:

> > You acked it without saying you didn't want me to apply it...  usually
> > that means someone is OK with things getting applied.

> Actually, that's not true:

> MFD changes look sensible:
>   Acked-by: Lee Jones <lee.jones@linaro.org>

> I'm happy to create a shared branch if required.   <-----###

Sure, but I didn't see an urgent need for that immediately so I just
went ahead - the ack usually means that it's OK to apply.
Lee Jones May 2, 2014, 8:09 a.m. UTC | #11
On Thu, 01 May 2014, Mark Brown wrote:

> On Thu, May 01, 2014 at 08:42:53AM +0100, Lee Jones wrote:
> 
> > > You acked it without saying you didn't want me to apply it...  usually
> > > that means someone is OK with things getting applied.
> 
> > Actually, that's not true:
> 
> > MFD changes look sensible:
> >   Acked-by: Lee Jones <lee.jones@linaro.org>
> 
> > I'm happy to create a shared branch if required.   <-----###
> 
> Sure, but I didn't see an urgent need for that immediately so I just
> went ahead - the ack usually means that it's OK to apply.

Hmm... I'm inclined to disagree.  The Ack is a marker that I'm okay
with the changes, but the note after makes it pretty clear that the
preference would be for the patch to be handled via an IB.
Mark Brown May 3, 2014, 1:49 a.m. UTC | #12
On Fri, May 02, 2014 at 09:09:44AM +0100, Lee Jones wrote:
> On Thu, 01 May 2014, Mark Brown wrote:

> > Sure, but I didn't see an urgent need for that immediately so I just
> > went ahead - the ack usually means that it's OK to apply.

> Hmm... I'm inclined to disagree.  The Ack is a marker that I'm okay
> with the changes, but the note after makes it pretty clear that the
> preference would be for the patch to be handled via an IB.

Right, and it's sitting on a separate branch which is (as we've seen)
very easy to add a tag to if it turns out to be needed.  This is what
all the small topic branches are there for, it makes it really easy to
cross merge, and obviously applying the patch on a branch is always
going to be the first step in creating an immutable branch.  It
certainly doesn't seem worth getting worried about.

Really, if you're not happy for something to be applied you probably
don't want to be acking it or you at least want to be really explicit
about things.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/mfd/mc13xxx.txt b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
index 1413f39..8aba488 100644
--- a/Documentation/devicetree/bindings/mfd/mc13xxx.txt
+++ b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
@@ -10,6 +10,9 @@  Optional properties:
 - fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
 
 Sub-nodes:
+- codec: Contain the Audio Codec node.
+  - adc-port: Contain PMIC SSI port number used for ADC.
+  - dac-port: Contain PMIC SSI port number used for DAC.
 - leds : Contain the led nodes and initial register values in property
   "led-control". Number of register depends of used IC, for MC13783 is 6,
   for MC13892 is 4, for MC34708 is 1. See datasheet for bits definitions of
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 06e64b6..0c6c21c 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -673,9 +673,13 @@  int mc13xxx_common_init(struct device *dev)
 	if (mc13xxx->flags & MC13XXX_USE_ADC)
 		mc13xxx_add_subdevice(mc13xxx, "%s-adc");
 
-	if (mc13xxx->flags & MC13XXX_USE_CODEC)
-		mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
-					pdata->codec, sizeof(*pdata->codec));
+	if (mc13xxx->flags & MC13XXX_USE_CODEC) {
+		if (pdata)
+			mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
+				pdata->codec, sizeof(*pdata->codec));
+		else
+			mc13xxx_add_subdevice(mc13xxx, "%s-codec");
+	}
 
 	if (mc13xxx->flags & MC13XXX_USE_RTC)
 		mc13xxx_add_subdevice(mc13xxx, "%s-rtc");
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index 0b0a4ca..9965277 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -22,6 +22,7 @@ 
  */
 #include <linux/module.h>
 #include <linux/device.h>
+#include <linux/of.h>
 #include <linux/mfd/mc13xxx.h>
 #include <linux/slab.h>
 #include <sound/core.h>
@@ -748,6 +749,7 @@  static int __init mc13783_codec_probe(struct platform_device *pdev)
 {
 	struct mc13783_priv *priv;
 	struct mc13xxx_codec_platform_data *pdata = pdev->dev.platform_data;
+	struct device_node *np;
 	int ret;
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -758,7 +760,17 @@  static int __init mc13783_codec_probe(struct platform_device *pdev)
 		priv->adc_ssi_port = pdata->adc_ssi_port;
 		priv->dac_ssi_port = pdata->dac_ssi_port;
 	} else {
-		return -ENOSYS;
+		np = of_get_child_by_name(pdev->dev.parent->of_node, "codec");
+		if (!np)
+			return -ENOSYS;
+
+		ret = of_property_read_u32(np, "adc-port", &priv->adc_ssi_port);
+		if (ret)
+			return ret;
+
+		ret = of_property_read_u32(np, "dac-port", &priv->dac_ssi_port);
+		if (ret)
+			return ret;
 	}
 
 	dev_set_drvdata(&pdev->dev, priv);