Re: [PATCH 0/3] ARM: OMAP5+: Support Duty Cycle Correction(DCC)

2014-05-26 Thread Tero Kristo

On 05/24/2014 12:07 AM, Mike Turquette wrote:

Quoting Nishanth Menon (2014-05-16 03:45:57)

Hi,

This patch series has been carried over in vendor kernel for quiet
few years now.

Unfortunately, it was very recently re-discovered and upstream kernel
is noticed to be broken for OMAP5 1.5GHz - at least we are operating
DPLL at frequency higher than what it was intended to be when CPUFreq
is enabled. Thankfully, with nominal voltage(we dont use AVS yet in
upstream for the mentioned platforms) and margins in trimming, we
have so far not crashed - but I strongly suspect this might be some
boundary case survival.


DCC also exists in OMAP4. In some cases customers used it, in other
cases we just ran the PLL way out of spec and the mpu_clk would divide
by 2.

Is this broken for OMAP4 as well?


Yes, its broken. This series does not address the OMAP4 needs for it, 
but can be expanded later by just defining a proper clock type with 
OMAP4 specific DCC rate limits etc. for it. We would need properly 
functioning DVFS for OMAP4 panda first though I guess... (support for 
the TPS regulator.)


-Tero



Regards,
Mike



Verified on the following impacted platforms using 3.15-rc4 based
vendor kernel.

Before:
OMAP5432: http://slexy.org/view/s20cs0qQFg
DRA72x: http://slexy.org/view/s2TXtSa6mH (refused to lock)
DRA75x: http://slexy.org/view/s20AW8MU5c
After:
OMAP5432: http://slexy.org/view/s21iAfWxpu
DRA72x: http://slexy.org/view/s2hwsvGLmC (locks properly)
DRA75x: http://slexy.org/view/s21ehw8WQn

Hopefully, we can get these into some kernel revision in some form.

NOTE: Support for 4470(which is the only other platform requiring
DCC) is not present in upstream kernel and there are no plans to
support that SoC, even if it is added at a later point, support can be
extended as needed.

Series based on v3.15-rc5 tag.
Also available on my tree:
 https://github.com/nmenon/linux-2.6-playground/
 branch:  push/clock/dcc

 weblink: 
https://github.com/nmenon/linux-2.6-playground/commits/push/clock/dcc

Verification:
3.15-rc4 based kernel - DRA75x-evm, 72x-evm, OMAP5uevm
3.15-rc5 - OMAP5uEVM(only one supporting 1.5GHz atm)

Andrii Tseglytskyi (1):
   ARM: OMAP5+: dpll: support Duty Cycle Correction(DCC)

Nishanth Menon (2):
   clk: dpll: support OMAP5 MPU DPLL that need special handling for
 higher frequencies
   ARM: dts: OMAP5/DRA7: use omap5-mpu-dpll-clock capable of dealing
 with higher frequencies

  .../devicetree/bindings/clock/ti/dpll.txt  |1 +
  arch/arm/boot/dts/dra7xx-clocks.dtsi   |2 +-
  arch/arm/boot/dts/omap54xx-clocks.dtsi |2 +-
  arch/arm/mach-omap2/dpll3xxx.c |9 +
  drivers/clk/ti/dpll.c  |   21 
  include/linux/clk/ti.h |4 
  6 files changed, 37 insertions(+), 2 deletions(-)

Regards,
Nishanth Menon
--
1.7.9.5



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/2] clk: Support for Palmas clk32kg and clk32kgaudio clocks

2014-05-26 Thread Peter Ujfalusi
Mike,

On 05/06/2014 04:31 PM, Nishanth Menon wrote:
 On 16:24-20140506, Peter Ujfalusi wrote:
 Hi,

 Changes since v1:
 - binding documentation and driver has been separated based on Nishanth 
 Menon's
   comment

Could you take a look at this series please? I really hoped that it would make
it to 3.16...

Thanks,
Péter


 v1 of the driver can be found:
 https://lkml.org/lkml/2014/4/3/104

 Palmas class of devices can provide 32K clock(s) to be used by other devices
 on the board. Depending on the actual device the provided clocks can be:
 CLK32K_KG and CLK32K_KGAUDIO
 or only one:
 CLK32K_KG (TPS659039 for example)

 Use separate compatible flags for the two 32K clock.
 A system which needs or have only one of the 32k clock from
 Palmas will need to add node(s) for each clock as separate section
 in the dts file.
 The two compatible property is:
 ti,palmas-clk32kg for clk32kg clock
 ti,palmas-clk32kgaudio for clk32kgaudio clock

 Apart from the register control of the clocks - which is done via
 the clock API there is a posibility to enable the external sleep
 control. In this way the clock can be enabled/disabled on demand by the
 user of the clock.

 Regards,
 Peter
 ---
 Peter Ujfalusi (2):
   dt/bindings: Binding documentation for Palmas clk32kg and clk32kgaudio
 clocks
   clk: Add driver for Palmas clk32kg and clk32kgaudio clocks

  .../bindings/clock/clk-palmas-clk32kg-clocks.txt   |  35 +++
  drivers/clk/Kconfig|   7 +
  drivers/clk/Makefile   |   1 +
  drivers/clk/clk-palmas.c   | 307 
 +
  include/dt-bindings/mfd/palmas.h   |  18 ++
  5 files changed, 368 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/clock/clk-palmas-clk32kg-clocks.txt
  create mode 100644 drivers/clk/clk-palmas.c
  create mode 100644 include/dt-bindings/mfd/palmas.h

 -- 
 1.9.2

 
 Series:
 Reviewed-by: Nishanth Menon n...@ti.com


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 00/16] OMAP: GPMC: Restructure OMAP GPMC driver (NAND) : DT binding change proposal

2014-05-26 Thread Roger Quadros
Javier,

On 05/23/2014 12:40 PM, Javier Martinez Canillas wrote:
 Hello Roger,
 
 On Fri, May 23, 2014 at 10:16 AM, Roger Quadros rog...@ti.com wrote:
 Ezequiel  Javier,

 On 05/22/2014 05:46 PM, Ezequiel Garcia wrote:
 On 22 May 01:51 PM, Javier Martinez Canillas wrote:
 On Thu, May 22, 2014 at 10:12 AM, Roger Quadros rog...@ti.com wrote:
 On 21 May 02:20 PM, Roger Quadros wrote:

 For DT boot:
 - The GPMC controller node should have a chip select (CS) node for each 
 used
   chip select. The CS node must have a child device node for each device
   attached to that chip select. Properties for that child are GPMC 
 agnostic.

   i.e.
  gpmc {
  cs0 {
  nand0 {
  }
  };

  cs1 {
  nor0 {
  }
  }
  ...
  };


 While I agree that the GPMC driver is a bit messy, I'm not sure it's 
 possible
 to go through such a complete devicetree binding re-design (breaking 
 backwards
 compatibility) now that the binding is already in production.

 Why not? especially if the existing bindings are poorly dones. Is anyone 
 using these
 bindings burning the DT into ROM and can't change it when they update the 
 kernel?


 While I do agree that your DT bindings are much better than the
 current ones, there is a policy that DT bindings are an external API
 and once are released with a kernel are set in stone and can't be
 changed.


 Exactly. The DT binding is considered an ABI. Thus, invariant across kernel
 versions. Users can't be coherced into a DTB update after a kernel update.

 That said, I don't really care if you break compatilibity in this case.
 Rather, I'm suggesting that you make sure this change is going to be 
 accepted
 upstream, before doing any more work. The DT maintainers are reluctant to do
 so.

 Appreciate your concern.

 Would be really nice if you can review patches 1-12. They have nothing to do 
 with DT changes.
 Thanks.

 
 Overall your patches looks good to me. But I think it's better to wait
 until Tony removes the legacy board files for OMAP2+ since AFAIU at
 least the following patches could be dropped or trimmed down when
 board files are gone:
 
 [RFC PATCH 04/16] ARM: OMAP2+: gpmc: use platform data to configure CS
 space and poplulate
 [RFC PATCH 06/16] ARM: OMAP2+: gpmc: add NAND specific setup
 [RFC PATCH 07/16] ARM: OMAP2+: nand: Update gpmc_nand_init() to use
 generic_gpmc_init()
 
 Patches 1-3 and 5 are independent and can be applied in the meantime
 as a preparation for further changes following board files removal.
 
 I really like patches 9-12 since those moves some NAND add-hoc code to
 the NAND driver where it really belongs. I think that similar changes
 can be made for OneNAND and push the special case handling code from
 GPMC driver to drivers/mtd/onenand/omap2.c.
 
 Other devices (nor, ethernet, uart, etc) are already using
 gpmc_probe_generic_child() so I hope we can isolate the NAND and
 OneNAND specific changes and just use a single probe function for all
 child devices and possibly get even need the enum gpmc_omap_type you
 are adding on your struct gpmc_omap_cs_data.

Yes, I was thinking the same.

 
 So what do you think if as a first step we add the platform data as
 you propose with all the commons timings and settings there, move all
 the possible code to NAND and OneNAND drivers and try to use a single
 configuration function for all child devices?

Yes, I agree.
 
 Then once board files are gone we can do further cleanup in the driver
 and then we can discuss about changing the DT bindings. Maybe we can
 even change it while keeping backwards compatibility? Although I'm not
 sure about the last point I think that at least is worth to discuss
 it.

OK.

cheers,
-roger

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 00/16] OMAP: GPMC: Restructure OMAP GPMC driver (NAND) : DT binding change proposal

2014-05-26 Thread Roger Quadros
On 05/23/2014 05:53 PM, Tony Lindgren wrote:
 * Roger Quadros rog...@ti.com [140523 01:17]:
 On 05/22/2014 05:46 PM, Ezequiel Garcia wrote:
 On 22 May 01:51 PM, Javier Martinez Canillas wrote:
 On Thu, May 22, 2014 at 10:12 AM, Roger Quadros rog...@ti.com wrote:
 On 21 May 02:20 PM, Roger Quadros wrote:
 While I agree that the GPMC driver is a bit messy, I'm not sure it's 
 possible
 to go through such a complete devicetree binding re-design (breaking 
 backwards
 compatibility) now that the binding is already in production.

 Why not? especially if the existing bindings are poorly dones. Is anyone 
 using these
 bindings burning the DT into ROM and can't change it when they update the 
 kernel?


 While I do agree that your DT bindings are much better than the
 current ones, there is a policy that DT bindings are an external API
 and once are released with a kernel are set in stone and can't be
 changed.


 Exactly. The DT binding is considered an ABI. Thus, invariant across kernel
 versions. Users can't be coherced into a DTB update after a kernel update.

 That said, I don't really care if you break compatilibity in this case.
 Rather, I'm suggesting that you make sure this change is going to be 
 accepted
 upstream, before doing any more work. The DT maintainers are reluctant to do
 so.

 Appreciate your concern.

 Would be really nice if you can review patches 1-12. They have nothing to do 
 with DT changes.
 Thanks.
 
 I'm mostly concerned about keeping things working. I think the
 only way we can keep things working is to keep support for
 the old binding around in addition to the new one. That way
 we can update devices one at a time.

Good to hear that you are not keen on keeping the old bindings forever. I 
understand
that we need to keep things working during the transition. I'll think of 
something to
maintain backward compatibility while supporting the new binding.

cheers,
-roger
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 1/6] usb: musb: core: Handle Babble condition only in HOST mode

2014-05-26 Thread George Cherian

On 5/23/2014 2:12 AM, Bin Liu wrote:

Hi George,

On Mon, May 19, 2014 at 11:32 PM, George Cherian george.cher...@ti.com wrote:

Hi Bin,

On 5/19/2014 9:24 PM, Bin Liu wrote:

Hi,

On Mon, May 19, 2014 at 8:39 AM, George Cherian george.cher...@ti.com
wrote:

BABBLE and RESET share the same interrupt. The interrupt
is considered to be RESET if MUSB is in peripheral mode and
as a BABBLE if MUSB is in HOST mode.

Handle babble condition iff MUSB is in HOST mode.

Signed-off-by: George Cherian george.cher...@ti.com
---
   drivers/usb/musb/musb_core.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 61da471..eff3c5c 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -849,7 +849,7 @@ b_host:
  }

  /* handle babble condition */
-   if (int_usb  MUSB_INTR_BABBLE)
+   if (int_usb  MUSB_INTR_BABBLE  is_host_active(musb))
  schedule_work(musb-recover_work);

I guess my following comments are for Daniel's patch as while which
initially added the babble work.

Should this if statement be merged into the previous 'if(int_usb 
MUSB_INTR_RESET)' one, which handles the same interrupt and already
handles host and device mode respectively.


Initially I too had the babble handling as part of  'if(int_usb 
MUSB_INTR_RESET)'
one. But during my tests I hit a corner case where in we hit a BABBLE
condition
on disconnect. In such case the babble interrupt can be handled only if we
have a seperate
check, else its considered as a BUS RESET.

When all devices are disconnected  MUSB_DEVCTL_HM = 0 and the code always
enter the
else path. In this path it treats the BABBLE as a BUS RESET.

The code flow is a bit confusing, two if() handle the same interrupt.
The second one implied using 'handled = IRQ_HANDLED;' from the first
one.
Also does the switch() in else{} in the first if() cause any side effect?

No it doesn't.

Since this babble handing is AM335x specific, how about handle it in
dsps_interrupt() in musb_dsps.c, which already has an entry for babble
interrupt? TI 3.2 kernel does this way.
That the reason we have platform specific callbacks added  from the main 
interrupt handler.

Regards,
-Bin.




Regards,
-Bin.


   #if 0
--
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
-George




--
-George

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ASoC: omap-pcm: Move omap-pcm under include/sound

2014-05-26 Thread Jyri Sarha
Make including the omap-pcm.h outside sound/soc/omap more convenient.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
It would be nice to get this applied at ASAP for OMAP HDMI audio
rework patches depend on this and it would help a lot if this would
already be there when applying to OMAPDSS side patches.

 include/sound/omap-pcm.h  |   30 ++
 sound/soc/davinci/davinci-mcasp.c |2 +-
 sound/soc/omap/omap-dmic.c|2 +-
 sound/soc/omap/omap-hdmi.c|2 +-
 sound/soc/omap/omap-mcbsp.c   |2 +-
 sound/soc/omap/omap-mcpdm.c   |2 +-
 sound/soc/omap/omap-pcm.h |   30 --
 7 files changed, 35 insertions(+), 35 deletions(-)
 create mode 100644 include/sound/omap-pcm.h
 delete mode 100644 sound/soc/omap/omap-pcm.h

diff --git a/include/sound/omap-pcm.h b/include/sound/omap-pcm.h
new file mode 100644
index 000..c1d2f31
--- /dev/null
+++ b/include/sound/omap-pcm.h
@@ -0,0 +1,30 @@
+/*
+ * omap-pcm.h - OMAP PCM driver
+ *
+ * Copyright (C) 2014 Texas Instruments, Inc.
+ *
+ * Author: Peter Ujfalusi peter.ujfal...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef __OMAP_PCM_H__
+#define __OMAP_PCM_H__
+
+#if IS_ENABLED(CONFIG_SND_OMAP_SOC)
+int omap_pcm_platform_register(struct device *dev);
+#else
+static inline int omap_pcm_platform_register(struct device *dev)
+{
+   return 0;
+}
+#endif /* CONFIG_SND_OMAP_SOC */
+
+#endif /* __OMAP_PCM_H__ */
diff --git a/sound/soc/davinci/davinci-mcasp.c 
b/sound/soc/davinci/davinci-mcasp.c
index 14058dc..9afb146 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -33,10 +33,10 @@
 #include sound/initval.h
 #include sound/soc.h
 #include sound/dmaengine_pcm.h
+#include sound/omap-pcm.h
 
 #include davinci-pcm.h
 #include davinci-mcasp.h
-#include ../omap/omap-pcm.h
 
 #define MCASP_MAX_AFIFO_DEPTH  64
 
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
index 53da041..6925d71 100644
--- a/sound/soc/omap/omap-dmic.c
+++ b/sound/soc/omap/omap-dmic.c
@@ -40,9 +40,9 @@
 #include sound/initval.h
 #include sound/soc.h
 #include sound/dmaengine_pcm.h
+#include sound/omap-pcm.h
 
 #include omap-dmic.h
-#include omap-pcm.h
 
 struct omap_dmic {
struct device *dev;
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
index 537a1ec..eb9c392 100644
--- a/sound/soc/omap/omap-hdmi.c
+++ b/sound/soc/omap/omap-hdmi.c
@@ -34,9 +34,9 @@
 #include sound/asoundef.h
 #include sound/dmaengine_pcm.h
 #include video/omapdss.h
+#include sound/omap-pcm.h
 
 #include omap-hdmi.h
-#include omap-pcm.h
 
 #define DRV_NAME omap-hdmi-audio-dai
 
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 71d2266..efe2cd6 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -34,11 +34,11 @@
 #include sound/initval.h
 #include sound/soc.h
 #include sound/dmaengine_pcm.h
+#include sound/omap-pcm.h
 
 #include linux/platform_data/asoc-ti-mcbsp.h
 #include mcbsp.h
 #include omap-mcbsp.h
-#include omap-pcm.h
 
 #define OMAP_MCBSP_RATES   (SNDRV_PCM_RATE_8000_96000)
 
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index d8ebb52..f0e2ebe 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -40,9 +40,9 @@
 #include sound/pcm_params.h
 #include sound/soc.h
 #include sound/dmaengine_pcm.h
+#include sound/omap-pcm.h
 
 #include omap-mcpdm.h
-#include omap-pcm.h
 
 struct mcpdm_link_config {
u32 link_mask; /* channel mask for the direction */
diff --git a/sound/soc/omap/omap-pcm.h b/sound/soc/omap/omap-pcm.h
deleted file mode 100644
index c1d2f31..000
--- a/sound/soc/omap/omap-pcm.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * omap-pcm.h - OMAP PCM driver
- *
- * Copyright (C) 2014 Texas Instruments, Inc.
- *
- * Author: Peter Ujfalusi peter.ujfal...@ti.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- */
-
-#ifndef __OMAP_PCM_H__
-#define __OMAP_PCM_H__
-
-#if IS_ENABLED(CONFIG_SND_OMAP_SOC)
-int omap_pcm_platform_register(struct device *dev);
-#else
-static inline int omap_pcm_platform_register(struct device *dev)
-{
-   

Re: [PATCH] ASoC: omap-pcm: Move omap-pcm under include/sound

2014-05-26 Thread Peter Ujfalusi
On 05/26/2014 11:51 AM, Jyri Sarha wrote:
 Make including the omap-pcm.h outside sound/soc/omap more convenient.

Acked-by: Peter Ujfalusi peter.ujfal...@ti.com

 
 Signed-off-by: Jyri Sarha jsa...@ti.com
 ---
 It would be nice to get this applied at ASAP for OMAP HDMI audio
 rework patches depend on this and it would help a lot if this would
 already be there when applying to OMAPDSS side patches.
 
  include/sound/omap-pcm.h  |   30 ++
  sound/soc/davinci/davinci-mcasp.c |2 +-
  sound/soc/omap/omap-dmic.c|2 +-
  sound/soc/omap/omap-hdmi.c|2 +-
  sound/soc/omap/omap-mcbsp.c   |2 +-
  sound/soc/omap/omap-mcpdm.c   |2 +-
  sound/soc/omap/omap-pcm.h |   30 --
  7 files changed, 35 insertions(+), 35 deletions(-)
  create mode 100644 include/sound/omap-pcm.h
  delete mode 100644 sound/soc/omap/omap-pcm.h
 
 diff --git a/include/sound/omap-pcm.h b/include/sound/omap-pcm.h
 new file mode 100644
 index 000..c1d2f31
 --- /dev/null
 +++ b/include/sound/omap-pcm.h
 @@ -0,0 +1,30 @@
 +/*
 + * omap-pcm.h - OMAP PCM driver
 + *
 + * Copyright (C) 2014 Texas Instruments, Inc.
 + *
 + * Author: Peter Ujfalusi peter.ujfal...@ti.com
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * version 2 as published by the Free Software Foundation.
 + *
 + * This program is distributed in the hope that it will be useful, but
 + * WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * General Public License for more details.
 + */
 +
 +#ifndef __OMAP_PCM_H__
 +#define __OMAP_PCM_H__
 +
 +#if IS_ENABLED(CONFIG_SND_OMAP_SOC)
 +int omap_pcm_platform_register(struct device *dev);
 +#else
 +static inline int omap_pcm_platform_register(struct device *dev)
 +{
 + return 0;
 +}
 +#endif /* CONFIG_SND_OMAP_SOC */
 +
 +#endif /* __OMAP_PCM_H__ */
 diff --git a/sound/soc/davinci/davinci-mcasp.c 
 b/sound/soc/davinci/davinci-mcasp.c
 index 14058dc..9afb146 100644
 --- a/sound/soc/davinci/davinci-mcasp.c
 +++ b/sound/soc/davinci/davinci-mcasp.c
 @@ -33,10 +33,10 @@
  #include sound/initval.h
  #include sound/soc.h
  #include sound/dmaengine_pcm.h
 +#include sound/omap-pcm.h
  
  #include davinci-pcm.h
  #include davinci-mcasp.h
 -#include ../omap/omap-pcm.h
  
  #define MCASP_MAX_AFIFO_DEPTH64
  
 diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
 index 53da041..6925d71 100644
 --- a/sound/soc/omap/omap-dmic.c
 +++ b/sound/soc/omap/omap-dmic.c
 @@ -40,9 +40,9 @@
  #include sound/initval.h
  #include sound/soc.h
  #include sound/dmaengine_pcm.h
 +#include sound/omap-pcm.h
  
  #include omap-dmic.h
 -#include omap-pcm.h
  
  struct omap_dmic {
   struct device *dev;
 diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
 index 537a1ec..eb9c392 100644
 --- a/sound/soc/omap/omap-hdmi.c
 +++ b/sound/soc/omap/omap-hdmi.c
 @@ -34,9 +34,9 @@
  #include sound/asoundef.h
  #include sound/dmaengine_pcm.h
  #include video/omapdss.h
 +#include sound/omap-pcm.h
  
  #include omap-hdmi.h
 -#include omap-pcm.h
  
  #define DRV_NAME omap-hdmi-audio-dai
  
 diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
 index 71d2266..efe2cd6 100644
 --- a/sound/soc/omap/omap-mcbsp.c
 +++ b/sound/soc/omap/omap-mcbsp.c
 @@ -34,11 +34,11 @@
  #include sound/initval.h
  #include sound/soc.h
  #include sound/dmaengine_pcm.h
 +#include sound/omap-pcm.h
  
  #include linux/platform_data/asoc-ti-mcbsp.h
  #include mcbsp.h
  #include omap-mcbsp.h
 -#include omap-pcm.h
  
  #define OMAP_MCBSP_RATES (SNDRV_PCM_RATE_8000_96000)
  
 diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
 index d8ebb52..f0e2ebe 100644
 --- a/sound/soc/omap/omap-mcpdm.c
 +++ b/sound/soc/omap/omap-mcpdm.c
 @@ -40,9 +40,9 @@
  #include sound/pcm_params.h
  #include sound/soc.h
  #include sound/dmaengine_pcm.h
 +#include sound/omap-pcm.h
  
  #include omap-mcpdm.h
 -#include omap-pcm.h
  
  struct mcpdm_link_config {
   u32 link_mask; /* channel mask for the direction */
 diff --git a/sound/soc/omap/omap-pcm.h b/sound/soc/omap/omap-pcm.h
 deleted file mode 100644
 index c1d2f31..000
 --- a/sound/soc/omap/omap-pcm.h
 +++ /dev/null
 @@ -1,30 +0,0 @@
 -/*
 - * omap-pcm.h - OMAP PCM driver
 - *
 - * Copyright (C) 2014 Texas Instruments, Inc.
 - *
 - * Author: Peter Ujfalusi peter.ujfal...@ti.com
 - *
 - * This program is free software; you can redistribute it and/or
 - * modify it under the terms of the GNU General Public License
 - * version 2 as published by the Free Software Foundation.
 - *
 - * This program is distributed in the hope that it will be useful, but
 - * WITHOUT ANY WARRANTY; without even the implied warranty of
 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 - * General Public License for 

[PATCH v6 4/5] usb: musb: core: Convert the musb_platform_reset to have a return value.

2014-05-26 Thread George Cherian
Currently musb_platform_reset() is only used by dsps.
In case of BABBLE interrupt for other platforms the  musb_platform_reset()
is a NOP. In such situations no need to re-initialize the endpoints.
Also in the latest silicon revision of AM335x, we do have a babble recovery
mechanism without resetting the IP block. In preperation to add that support
its better to have a rest_done return for  musb_platform_reset().

Signed-off-by: George Cherian george.cher...@ti.com
---
 drivers/usb/musb/musb_core.c | 10 ++
 drivers/usb/musb/musb_core.h | 10 ++
 drivers/usb/musb/musb_dsps.c |  3 ++-
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index c0ce09f..b841ee0 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1753,9 +1753,11 @@ static void musb_irq_work(struct work_struct *data)
 static void musb_recover_work(struct work_struct *data)
 {
struct musb *musb = container_of(data, struct musb, recover_work.work);
-   int status;
+   int status, ret;
 
-   musb_platform_reset(musb);
+   ret  = musb_platform_reset(musb);
+   if (ret)
+   return;
 
usb_phy_vbus_off(musb-xceiv);
usleep_range(100, 200);
@@ -1764,8 +1766,8 @@ static void musb_recover_work(struct work_struct *data)
usleep_range(100, 200);
 
/*
-* When a babble condition occurs, the musb controller removes the
-* session bit and the endpoint config is lost.
+* When a babble condition occurs, the musb controller
+* removes the session bit and the endpoint config is lost.
 */
if (musb-dyn_fifo)
status = ep_config_from_table(musb);
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 9241025..414e57a 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -192,7 +192,7 @@ struct musb_platform_ops {
 
int (*set_mode)(struct musb *musb, u8 mode);
void(*try_idle)(struct musb *musb, unsigned long timeout);
-   void(*reset)(struct musb *musb);
+   int (*reset)(struct musb *musb);
 
int (*vbus_status)(struct musb *musb);
void(*set_vbus)(struct musb *musb, int on);
@@ -555,10 +555,12 @@ static inline void musb_platform_try_idle(struct musb 
*musb,
musb-ops-try_idle(musb, timeout);
 }
 
-static inline void musb_platform_reset(struct musb *musb)
+static inline int  musb_platform_reset(struct musb *musb)
 {
-   if (musb-ops-reset)
-   musb-ops-reset(musb);
+   if (!musb-ops-reset)
+   return -EINVAL;
+
+   return musb-ops-reset(musb);
 }
 
 static inline int musb_platform_get_vbus_status(struct musb *musb)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 74c4193..f6f3087 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -536,7 +536,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
return 0;
 }
 
-static void dsps_musb_reset(struct musb *musb)
+static int dsps_musb_reset(struct musb *musb)
 {
struct device *dev = musb-controller;
struct dsps_glue *glue = dev_get_drvdata(dev-parent);
@@ -548,6 +548,7 @@ static void dsps_musb_reset(struct musb *musb)
usleep_range(100, 200);
usb_phy_init(musb-xceiv);
 
+   return 0;
 }
 
 static struct musb_platform_ops dsps_ops = {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 5/5] usb: musb: dsps: Add the sw_babble_control() and Enable for newer silicon

2014-05-26 Thread George Cherian
Add sw_babble_control() logic to differentiate between transient
babble and real babble condition. Also add the SW babble control
register definitions.

Babble control register logic is implemented in the latest
revision of AM335x.

Find whether we are running on newer silicon. The babble control
register reads 0x4 by default in newer silicon as opposed to 0
in old versions of AM335x. Based on this enable the sw babble
control logic.

Signed-off-by: George Cherian george.cher...@ti.com
---
 drivers/usb/musb/musb_dsps.c | 89 +---
 drivers/usb/musb/musb_regs.h |  7 
 2 files changed, 90 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index f6f3087..01543a9 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -136,6 +136,7 @@ struct dsps_glue {
const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
struct timer_list timer;/* otg_workaround timer */
unsigned long last_timer;/* last timer data for each instance */
+   bool sw_babble_enabled;
 
struct dsps_context context;
struct debugfs_regset32 regset;
@@ -469,6 +470,19 @@ static int dsps_musb_init(struct musb *musb)
val = ~(1  wrp-otg_disable);
dsps_writel(musb-ctrl_base, wrp-phy_utmi, val);
 
+   /*
+*  Check whether the dsps version has babble control enabled.
+* In latest silicon revision the babble control logic is enabled.
+* If MUSB_BABBLE_CTL returns 0x4 then we have the babble control
+* logic enabled.
+*/
+   val = dsps_readb(musb-mregs, MUSB_BABBLE_CTL);
+   if (val == MUSB_BABBLE_RCV_DISABLE) {
+   glue-sw_babble_enabled = true;
+   val |= MUSB_BABBLE_SW_SESSION_CTRL;
+   dsps_writeb(musb-mregs, MUSB_BABBLE_CTL, val);
+   }
+
ret = dsps_musb_dbg_init(musb, glue);
if (ret)
return ret;
@@ -536,19 +550,82 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
return 0;
 }
 
+static bool  sw_babble_control(struct musb *musb)
+{
+   u8 babble_ctl;
+   bool session_restart =  false;
+
+   babble_ctl = dsps_readb(musb-mregs, MUSB_BABBLE_CTL);
+   dev_dbg(musb-controller, babble: MUSB_BABBLE_CTL value %x\n,
+   babble_ctl);
+   /*
+* check line monitor flag to check whether babble is
+* due to noise
+*/
+   dev_dbg(musb-controller, STUCK_J is %s\n,
+   babble_ctl  MUSB_BABBLE_STUCK_J ? set : reset);
+
+   if (babble_ctl  MUSB_BABBLE_STUCK_J) {
+   int timeout = 10;
+
+   /*
+* babble is due to noise, then set transmit idle (d7 bit)
+* to resume normal operation
+*/
+   babble_ctl = dsps_readb(musb-mregs, MUSB_BABBLE_CTL);
+   babble_ctl |= MUSB_BABBLE_FORCE_TXIDLE;
+   dsps_writeb(musb-mregs, MUSB_BABBLE_CTL, babble_ctl);
+
+   /* wait till line monitor flag cleared */
+   dev_dbg(musb-controller, Set TXIDLE, wait J to clear\n);
+   do {
+   babble_ctl = dsps_readb(musb-mregs, MUSB_BABBLE_CTL);
+   udelay(1);
+   } while ((babble_ctl  MUSB_BABBLE_STUCK_J)  timeout--);
+
+   /* check whether stuck_at_j bit cleared */
+   if (babble_ctl  MUSB_BABBLE_STUCK_J) {
+   /*
+* real babble condition has occurred
+* restart the controller to start the
+* session again
+*/
+   dev_dbg(musb-controller, J not cleared, misc (%x)\n,
+   babble_ctl);
+   session_restart = true;
+   }
+   } else {
+   session_restart = true;
+   }
+
+   return session_restart;
+}
+
 static int dsps_musb_reset(struct musb *musb)
 {
struct device *dev = musb-controller;
struct dsps_glue *glue = dev_get_drvdata(dev-parent);
const struct dsps_musb_wrapper *wrp = glue-wrp;
+   int session_restart = 0;
 
-   dsps_writel(musb-ctrl_base, wrp-control, (1  wrp-reset));
-   usleep_range(100, 200);
-   usb_phy_shutdown(musb-xceiv);
-   usleep_range(100, 200);
-   usb_phy_init(musb-xceiv);
+   if (glue-sw_babble_enabled)
+   session_restart = sw_babble_control(musb);
+   /*
+* In case of new silicon version babble condition can be recovered
+* without resetting the MUSB. But for older silicon versions, MUSB
+* reset is needed
+*/
+   if (session_restart || !glue-sw_babble_enabled) {
+   dev_info(musb-controller, Restarting MUSB to recover from 
Babble\n);
+   dsps_writel(musb-ctrl_base, wrp-control, (1  wrp-reset));
+   

[PATCH v6 3/5] usb: musb: dsps: Call usb_phy(_shutdown/_init) during musb_platform_reset()

2014-05-26 Thread George Cherian
For DSPS platform usb_phy_vbus(_off/_on) are NOPs.
So during musb_platform_reset() call usb_phy(_shutdown/_init)

Signed-off-by: George Cherian george.cher...@ti.com
---
 drivers/usb/musb/musb_dsps.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 51beb13..74c4193 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -543,7 +543,11 @@ static void dsps_musb_reset(struct musb *musb)
const struct dsps_musb_wrapper *wrp = glue-wrp;
 
dsps_writel(musb-ctrl_base, wrp-control, (1  wrp-reset));
-   udelay(100);
+   usleep_range(100, 200);
+   usb_phy_shutdown(musb-xceiv);
+   usleep_range(100, 200);
+   usb_phy_init(musb-xceiv);
+
 }
 
 static struct musb_platform_ops dsps_ops = {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 0/5] Add support for SW babble Control

2014-05-26 Thread George Cherian
Series add support for SW babble control logic found in 
new silicon versions of AM335x. Runtime differentiation of
silicon version is done by checking the BABBLE_CTL register.
For newer silicon the register default value read is 0x4 and
for older versions its 0x0.

Patch 1 - Handle Babble only if MUSB is in HOST mode
Patch 2 - Convert recover work to delayed work.
Patch 3 - usb_phy_vbus_(off/_on) are NOPs for am335x PHY
   so use usb_phy(_shutdown/_init) in musb_platform_reset()
Patch 4 - Add return value for musb_platform_reset() in prepration
   to support SW babble_ctrl
Patch 5 - Add and Enable sw babble control for newer silicon

v5 - v6 : Squash patch 5 and 6 form v5 to avoid build warnings.

v4 - v5 : Added a debug print before resetting MUSB.
   changed a musb_readb to dsps_readb introduced in Patch#5 of v4.

v3 - v4 : Fixes an issue in gagdet mode - BUS RESET should not
   be handled as a BABBLE. Added a check for the same.(Patch #1)
   Enable sw babble control properly (Patch #6)

v2 - v3 : Modify musb_platform_reset() to return zero on success.



George Cherian (5):
  usb: musb: core: Handle Babble condition only in HOST mode
  usb: musb: core: Convert babble recover work to delayed work
  usb: musb: dsps: Call usb_phy(_shutdown/_init) during
musb_platform_reset()
  usb: musb: core: Convert the musb_platform_reset to have a return
value.
  usb: musb: dsps: Add the sw_babble_control() and Enable for newer
silicon

 drivers/usb/musb/musb_core.c | 27 --
 drivers/usb/musb/musb_core.h | 12 +++---
 drivers/usb/musb/musb_dsps.c | 88 ++--
 drivers/usb/musb/musb_regs.h |  7 
 4 files changed, 114 insertions(+), 20 deletions(-)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 1/5] usb: musb: core: Handle Babble condition only in HOST mode

2014-05-26 Thread George Cherian
BABBLE and RESET share the same interrupt. The interrupt
is considered to be RESET if MUSB is in peripheral mode and
as a BABBLE if MUSB is in HOST mode.

Handle babble condition iff MUSB is in HOST mode.

Signed-off-by: George Cherian george.cher...@ti.com
---
 drivers/usb/musb/musb_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 3c6043c..0ad9551 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -849,7 +849,7 @@ b_host:
}
 
/* handle babble condition */
-   if (int_usb  MUSB_INTR_BABBLE)
+   if (int_usb  MUSB_INTR_BABBLE  is_host_active(musb))
schedule_work(musb-recover_work);
 
 #if 0
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 2/5] usb: musb: core: Convert babble recover work to delayed work

2014-05-26 Thread George Cherian
During babble condition both first disconnect of devices are
initiated. Make sure MUSB controller is reset and re-initialized
after all disconnects.

To acheive this schedule a delayed work for babble recovery.

While at that convert udelay to usleep_range.
Refer Documentation/timers/timers-howto.txt

Signed-off-by: George Cherian george.cher...@ti.com
---
 drivers/usb/musb/musb_core.c | 15 ---
 drivers/usb/musb/musb_core.h |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0ad9551..c0ce09f 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -850,7 +850,8 @@ b_host:
 
/* handle babble condition */
if (int_usb  MUSB_INTR_BABBLE  is_host_active(musb))
-   schedule_work(musb-recover_work);
+   schedule_delayed_work(musb-recover_work,
+ msecs_to_jiffies(100));
 
 #if 0
 /* REVISIT ... this would be for multiplexing periodic endpoints, or
@@ -1751,16 +1752,16 @@ static void musb_irq_work(struct work_struct *data)
 /* Recover from babble interrupt conditions */
 static void musb_recover_work(struct work_struct *data)
 {
-   struct musb *musb = container_of(data, struct musb, recover_work);
+   struct musb *musb = container_of(data, struct musb, recover_work.work);
int status;
 
musb_platform_reset(musb);
 
usb_phy_vbus_off(musb-xceiv);
-   udelay(100);
+   usleep_range(100, 200);
 
usb_phy_vbus_on(musb-xceiv);
-   udelay(100);
+   usleep_range(100, 200);
 
/*
 * When a babble condition occurs, the musb controller removes the
@@ -1943,7 +1944,7 @@ musb_init_controller(struct device *dev, int nIrq, void 
__iomem *ctrl)
 
/* Init IRQ workqueue before request_irq */
INIT_WORK(musb-irq_work, musb_irq_work);
-   INIT_WORK(musb-recover_work, musb_recover_work);
+   INIT_DELAYED_WORK(musb-recover_work, musb_recover_work);
INIT_DELAYED_WORK(musb-deassert_reset_work, musb_deassert_reset);
INIT_DELAYED_WORK(musb-finish_resume_work, musb_host_finish_resume);
 
@@ -2039,7 +2040,7 @@ fail4:
 
 fail3:
cancel_work_sync(musb-irq_work);
-   cancel_work_sync(musb-recover_work);
+   cancel_delayed_work_sync(musb-recover_work);
cancel_delayed_work_sync(musb-finish_resume_work);
cancel_delayed_work_sync(musb-deassert_reset_work);
if (musb-dma_controller)
@@ -2105,7 +2106,7 @@ static int musb_remove(struct platform_device *pdev)
dma_controller_destroy(musb-dma_controller);
 
cancel_work_sync(musb-irq_work);
-   cancel_work_sync(musb-recover_work);
+   cancel_delayed_work_sync(musb-recover_work);
cancel_delayed_work_sync(musb-finish_resume_work);
cancel_delayed_work_sync(musb-deassert_reset_work);
musb_free(musb);
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index d155a15..9241025 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -297,7 +297,7 @@ struct musb {
 
irqreturn_t (*isr)(int, void *);
struct work_struct  irq_work;
-   struct work_struct  recover_work;
+   struct delayed_work recover_work;
struct delayed_work deassert_reset_work;
struct delayed_work finish_resume_work;
u16 hwvers;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC v2 5/5] OMAPDSS: DSS: add reg-id param to dpi_select_source

2014-05-26 Thread Archit Taneja
Add an argument which describes which DPI instance we are referring to when
selecting it's overlay manager.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/fbdev/omap2/dss/dpi.c |  2 +-
 drivers/video/fbdev/omap2/dss/dss.c | 12 ++--
 drivers/video/fbdev/omap2/dss/dss.h |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index 962c722..bcf8ee2 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -405,7 +405,7 @@ static int dpi_display_enable(struct omap_dss_device 
*dssdev)
if (r)
goto err_get_dispc;
 
-   r = dss_dpi_select_source(out-manager-id);
+   r = dss_dpi_select_source(out-port_num, out-manager-id);
if (r)
goto err_src_sel;
 
diff --git a/drivers/video/fbdev/omap2/dss/dss.c 
b/drivers/video/fbdev/omap2/dss/dss.c
index 54a84f4..862e771 100644
--- a/drivers/video/fbdev/omap2/dss/dss.c
+++ b/drivers/video/fbdev/omap2/dss/dss.c
@@ -72,7 +72,7 @@ struct dss_features {
const char *parent_clk_name;
enum omap_display_type *ports;
int num_ports;
-   int (*dpi_select_source)(enum omap_channel channel);
+   int (*dpi_select_source)(int id, enum omap_channel channel);
 };
 
 static struct {
@@ -566,7 +566,7 @@ enum dss_hdmi_venc_clk_source_select 
dss_get_hdmi_venc_clk_source(void)
return REG_GET(DSS_CONTROL, 15, 15);
 }
 
-static int dss_dpi_select_source_omap2_omap3(enum omap_channel channel)
+static int dss_dpi_select_source_omap2_omap3(int id, enum omap_channel channel)
 {
if (channel != OMAP_DSS_CHANNEL_LCD)
return -EINVAL;
@@ -574,7 +574,7 @@ static int dss_dpi_select_source_omap2_omap3(enum 
omap_channel channel)
return 0;
 }
 
-static int dss_dpi_select_source_omap4(enum omap_channel channel)
+static int dss_dpi_select_source_omap4(int id, enum omap_channel channel)
 {
int val;
 
@@ -594,7 +594,7 @@ static int dss_dpi_select_source_omap4(enum omap_channel 
channel)
return 0;
 }
 
-static int dss_dpi_select_source_omap5(enum omap_channel channel)
+static int dss_dpi_select_source_omap5(int id, enum omap_channel channel)
 {
int val;
 
@@ -620,9 +620,9 @@ static int dss_dpi_select_source_omap5(enum omap_channel 
channel)
return 0;
 }
 
-int dss_dpi_select_source(enum omap_channel channel)
+int dss_dpi_select_source(int id, enum omap_channel channel)
 {
-   return dss.feat-dpi_select_source(channel);
+   return dss.feat-dpi_select_source(id, channel);
 }
 
 static int dss_get_clocks(void)
diff --git a/drivers/video/fbdev/omap2/dss/dss.h 
b/drivers/video/fbdev/omap2/dss/dss.h
index c91f5bd..cf0a151 100644
--- a/drivers/video/fbdev/omap2/dss/dss.h
+++ b/drivers/video/fbdev/omap2/dss/dss.h
@@ -209,7 +209,7 @@ int dss_init_platform_driver(void) __init;
 void dss_uninit_platform_driver(void);
 
 unsigned long dss_get_dispc_clk_rate(void);
-int dss_dpi_select_source(enum omap_channel channel);
+int dss_dpi_select_source(int id, enum omap_channel channel);
 void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select);
 enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
 const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src);
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC v2 3/5] OMAPDSS: DPI: support multiple DPI instances

2014-05-26 Thread Archit Taneja
SoCs containing DSS until now had only one DPI instance. DRA7x has 3 DPI
instances.

In order to support multiple instances, we allocate a driver data
struct(dpi_data) for each instance. This is somewhat similar to how DSI driver
was changed to support multiple instances.

One difference is that there aren't platform devices for each DPI instance
when DT is used. In the DT case, we store the dpi_data pointer in the DPI port's
(of the type struct device_node) data pointer. In the non DT case, we still
have dummy platform devices, and the device's private data pointer is used to
store the DPI instance's dpi_data.

dpi_init_output/dpi_uninit_output are untouched and only used for non DT case,
dpi_init_output_port/dpi_uninit_output_port are used in the DT case, where DSS
configures the ports using dpi_init_port/dpi_uninit_port.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/fbdev/omap2/dss/dpi.c | 263 +---
 1 file changed, 181 insertions(+), 82 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index 8593567..43966a7 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -37,7 +37,7 @@
 #include dss.h
 #include dss_features.h
 
-static struct {
+struct dpi_data {
struct platform_device *pdev;
 
struct regulator *vdds_dsi_reg;
@@ -52,7 +52,27 @@ static struct {
struct omap_dss_device output;
 
bool port_initialized;
-} dpi;
+};
+
+static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device 
*dssdev)
+{
+   struct device_node *parent = dssdev-dev-of_node;
+
+   /* non DT */
+   if (!parent) {
+   struct omap_dss_device *out = dssdev-src;
+
+   return dev_get_drvdata(out-dev);
+   }
+
+   return container_of(dssdev, struct dpi_data, output);
+}
+
+/* use only for non DT mode */
+static struct dpi_data *dpi_get_data_from_pdev(struct platform_device *pdev)
+{
+   return dev_get_drvdata(pdev-dev);
+}
 
 static struct platform_device *dpi_get_dsidev(enum omap_channel channel)
 {
@@ -200,15 +220,16 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data)
dpi_calc_dispc_cb, ctx);
 }
 
-static bool dpi_dsi_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx)
+static bool dpi_dsi_clk_calc(struct dpi_data *dpi, unsigned long pck,
+   struct dpi_clk_calc_ctx *ctx)
 {
unsigned long clkin;
unsigned long pll_min, pll_max;
 
-   clkin = dsi_get_pll_clkin(dpi.dsidev);
+   clkin = dsi_get_pll_clkin(dpi-dsidev);
 
memset(ctx, 0, sizeof(*ctx));
-   ctx-dsidev = dpi.dsidev;
+   ctx-dsidev = dpi-dsidev;
ctx-pck_min = pck - 1000;
ctx-pck_max = pck + 1000;
ctx-dsi_cinfo.clkin = clkin;
@@ -216,7 +237,7 @@ static bool dpi_dsi_clk_calc(unsigned long pck, struct 
dpi_clk_calc_ctx *ctx)
pll_min = 0;
pll_max = 0;
 
-   return dsi_pll_calc(dpi.dsidev, clkin,
+   return dsi_pll_calc(dpi-dsidev, clkin,
pll_min, pll_max,
dpi_calc_pll_cb, ctx);
 }
@@ -252,7 +273,7 @@ static bool dpi_dss_clk_calc(unsigned long pck, struct 
dpi_clk_calc_ctx *ctx)
 
 
 
-static int dpi_set_dsi_clk(enum omap_channel channel,
+static int dpi_set_dsi_clk(struct dpi_data *dpi, enum omap_channel channel,
unsigned long pck_req, unsigned long *fck, int *lck_div,
int *pck_div)
 {
@@ -260,18 +281,18 @@ static int dpi_set_dsi_clk(enum omap_channel channel,
int r;
bool ok;
 
-   ok = dpi_dsi_clk_calc(pck_req, ctx);
+   ok = dpi_dsi_clk_calc(dpi, pck_req, ctx);
if (!ok)
return -EINVAL;
 
-   r = dsi_pll_set_clock_div(dpi.dsidev, ctx.dsi_cinfo);
+   r = dsi_pll_set_clock_div(dpi-dsidev, ctx.dsi_cinfo);
if (r)
return r;
 
dss_select_lcd_clk_source(channel,
dpi_get_alt_clk_src(channel));
 
-   dpi.mgr_config.clock_info = ctx.dispc_cinfo;
+   dpi-mgr_config.clock_info = ctx.dispc_cinfo;
 
*fck = ctx.dsi_cinfo.dsi_pll_hsdiv_dispc_clk;
*lck_div = ctx.dispc_cinfo.lck_div;
@@ -280,8 +301,8 @@ static int dpi_set_dsi_clk(enum omap_channel channel,
return 0;
 }
 
-static int dpi_set_dispc_clk(unsigned long pck_req, unsigned long *fck,
-   int *lck_div, int *pck_div)
+static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req,
+   unsigned long *fck, int *lck_div, int *pck_div)
 {
struct dpi_clk_calc_ctx ctx;
int r;
@@ -295,7 +316,7 @@ static int dpi_set_dispc_clk(unsigned long pck_req, 
unsigned long *fck,
if (r)
return r;
 
-   dpi.mgr_config.clock_info = ctx.dispc_cinfo;
+   dpi-mgr_config.clock_info = ctx.dispc_cinfo;
 
*fck = ctx.fck;
*lck_div = ctx.dispc_cinfo.lck_div;
@@ -304,19 +325,21 @@ static int 

[RFC v2 1/5] OMAPDSS: DSS: init dss ports cleanly

2014-05-26 Thread Archit Taneja
The init/uninit port functions are used to set up the DPI and SDI outputs under
the dss platform device. A 'reg' property is used to determine whether the node
is DPI or SDI for OMAP34xx DSS revision. For other DSS revisions, only DPI
output exists.

For multiple DPI output instances(introduced in DRA7xx DSS), we would use the
'reg' property in dts to specify the DPI output instance.

The current functions work fine if there is only one DPI output instance in
DSS. For multiple DPI instances, it would get complicated to figure out whether
'reg' is used to specify whether the output is SDI, or another DPI instance.

We create a list of port types supported for each DSS rev, with the index of the
port in the list matching the reg id. This allows us to have a more generic way
to init/uninit ports within DSS, and support multiple DPI ports.

Also, make the uninit_port functions iterative since we will have multiple DPI
ports to uninit in the future.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/fbdev/omap2/dss/dpi.c |  2 +-
 drivers/video/fbdev/omap2/dss/dss.c | 84 ++---
 drivers/video/fbdev/omap2/dss/dss.h | 27 +++-
 drivers/video/fbdev/omap2/dss/sdi.c |  2 +-
 4 files changed, 97 insertions(+), 18 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index 9368972..8593567 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -769,7 +769,7 @@ err_datalines:
return r;
 }
 
-void __exit dpi_uninit_port(void)
+void __exit dpi_uninit_port(struct device_node *port)
 {
if (!dpi.port_initialized)
return;
diff --git a/drivers/video/fbdev/omap2/dss/dss.c 
b/drivers/video/fbdev/omap2/dss/dss.c
index 6daeb7e..54a84f4 100644
--- a/drivers/video/fbdev/omap2/dss/dss.c
+++ b/drivers/video/fbdev/omap2/dss/dss.c
@@ -70,6 +70,8 @@ struct dss_features {
u8 fck_div_max;
u8 dss_fck_multiplier;
const char *parent_clk_name;
+   enum omap_display_type *ports;
+   int num_ports;
int (*dpi_select_source)(enum omap_channel channel);
 };
 
@@ -689,6 +691,22 @@ void dss_debug_dump_clocks(struct seq_file *s)
 }
 #endif
 
+
+static enum omap_display_type omap2plus_ports[] = {
+#ifdef CONFIG_OMAP2_DSS_DPI
+   OMAP_DISPLAY_TYPE_DPI,
+#endif
+};
+
+static enum omap_display_type omap34xx_ports[] = {
+#ifdef CONFIG_OMAP2_DSS_DPI
+   OMAP_DISPLAY_TYPE_DPI,
+#endif
+#ifdef CONFIG_OMAP2_DSS_DSI
+   OMAP_DISPLAY_TYPE_SDI,
+#endif
+};
+
 static const struct dss_features omap24xx_dss_feats __initconst = {
/*
 * fck div max is really 16, but the divider range has gaps. The range
@@ -698,6 +716,8 @@ static const struct dss_features omap24xx_dss_feats 
__initconst = {
.dss_fck_multiplier =   2,
.parent_clk_name=   core_ck,
.dpi_select_source  =   dss_dpi_select_source_omap2_omap3,
+   .ports  =   omap2plus_ports,
+   .num_ports  =   ARRAY_SIZE(omap2plus_ports),
 };
 
 static const struct dss_features omap34xx_dss_feats __initconst = {
@@ -705,6 +725,8 @@ static const struct dss_features omap34xx_dss_feats 
__initconst = {
.dss_fck_multiplier =   2,
.parent_clk_name=   dpll4_ck,
.dpi_select_source  =   dss_dpi_select_source_omap2_omap3,
+   .ports  =   omap34xx_ports,
+   .num_ports  =   ARRAY_SIZE(omap34xx_ports),
 };
 
 static const struct dss_features omap3630_dss_feats __initconst = {
@@ -712,6 +734,8 @@ static const struct dss_features omap3630_dss_feats 
__initconst = {
.dss_fck_multiplier =   1,
.parent_clk_name=   dpll4_ck,
.dpi_select_source  =   dss_dpi_select_source_omap2_omap3,
+   .ports  =   omap2plus_ports,
+   .num_ports  =   ARRAY_SIZE(omap2plus_ports),
 };
 
 static const struct dss_features omap44xx_dss_feats __initconst = {
@@ -719,6 +743,8 @@ static const struct dss_features omap44xx_dss_feats 
__initconst = {
.dss_fck_multiplier =   1,
.parent_clk_name=   dpll_per_x2_ck,
.dpi_select_source  =   dss_dpi_select_source_omap4,
+   .ports  =   omap2plus_ports,
+   .num_ports  =   ARRAY_SIZE(omap2plus_ports),
 };
 
 static const struct dss_features omap54xx_dss_feats __initconst = {
@@ -726,6 +752,8 @@ static const struct dss_features omap54xx_dss_feats 
__initconst = {
.dss_fck_multiplier =   1,
.parent_clk_name=   dpll_per_x2_ck,
.dpi_select_source  =   dss_dpi_select_source_omap5,
+   .ports  =   omap2plus_ports,
+   .num_ports  =   ARRAY_SIZE(omap2plus_ports),
 };
 
 static const struct dss_features am43xx_dss_feats 

[RFC v2 2/5] OMAPDSS: DT: Get source endpoint by matching reg-id

2014-05-26 Thread Archit Taneja
In omapdss_of_find_source_for_first_ep, we retrieve a source endpoint's DT node,
and then see what omapdss output has the matching device_node pointer in
omap_dss_find_output_by_node.

For all DPI and SDI outputs, the device_node pointer is set as the parent's DSS
device_node pointer. If the source is one of these outputs, the above method
won't work.

To get the correct output for ports within DSS(and in other cases in the future,
where multiple ports might be under one device), we require additional
information which is exclusive to the output port.

We create a new field in omap_dss_device called 'port_num', this provides port
number of the output port corresponding to this device. When searching for the
source endpoint in DT, we extract the 'reg' property from the port corresponding
to the endpoint source. From the list of registered outputs, we pick out that
output which has both dev-of_node and port_num matching with the device_node
pointer and 'reg' of the source endpoint node from DT.

For encoder blocks(the ones which have both an input and output port), we need
to set the port_num as the 'reg' property for the output port as defined in the
DT bindings. We set port_num to 1 in the tfp410 and tpd12s015 encoder drivers.

Signed-off-by: Archit Taneja arc...@ti.com
---
 .../fbdev/omap2/displays-new/encoder-tfp410.c  |  1 +
 .../fbdev/omap2/displays-new/encoder-tpd12s015.c   |  1 +
 drivers/video/fbdev/omap2/dss/dss-of.c | 51 +-
 drivers/video/fbdev/omap2/dss/output.c |  8 ++--
 include/video/omapdss.h|  7 ++-
 5 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c 
b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c
index b4e9a42..d927455 100644
--- a/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c
+++ b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c
@@ -249,6 +249,7 @@ static int tfp410_probe(struct platform_device *pdev)
dssdev-output_type = OMAP_DISPLAY_TYPE_DVI;
dssdev-owner = THIS_MODULE;
dssdev-phy.dpi.data_lines = ddata-data_lines;
+   dssdev-port_num = 1;
 
r = omapdss_register_output(dssdev);
if (r) {
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c 
b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
index 7e33686..9e25fe7 100644
--- a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
+++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
@@ -389,6 +389,7 @@ static int tpd_probe(struct platform_device *pdev)
dssdev-type = OMAP_DISPLAY_TYPE_HDMI;
dssdev-output_type = OMAP_DISPLAY_TYPE_HDMI;
dssdev-owner = THIS_MODULE;
+   dssdev-port_num = 1;
 
in = ddata-in;
 
diff --git a/drivers/video/fbdev/omap2/dss/dss-of.c 
b/drivers/video/fbdev/omap2/dss/dss-of.c
index a4b20aa..8ba43faa 100644
--- a/drivers/video/fbdev/omap2/dss/dss-of.c
+++ b/drivers/video/fbdev/omap2/dss/dss-of.c
@@ -132,28 +132,55 @@ EXPORT_SYMBOL_GPL(omapdss_of_get_first_endpoint);
 struct omap_dss_device *
 omapdss_of_find_source_for_first_ep(struct device_node *node)
 {
-   struct device_node *ep;
-   struct device_node *src_node;
+   struct device_node *ep, *port_ep;
+   struct device_node *src_node, *src_port;
struct omap_dss_device *src;
+   int r;
+   u32 reg;
 
ep = omapdss_of_get_first_endpoint(node);
-   if (!ep)
-   return ERR_PTR(-EINVAL);
+   if (!ep) {
+   r = -EINVAL;
+   goto err_first_ep;
+   }
 
src_node = omapdss_of_get_remote_device_node(ep);
+   if (!src_node) {
+   r = -EINVAL;
+   goto err_src_node;
+   }
 
-   of_node_put(ep);
-
-   if (!src_node)
-   return ERR_PTR(-EINVAL);
+   port_ep = of_parse_phandle(ep, remote-endpoint, 0);
+   if (!port_ep) {
+   r = -EINVAL;
+   goto err_port_ep;
+   }
 
-   src = omap_dss_find_output_by_node(src_node);
+   src_port = of_get_next_parent(port_ep);
+   if (!src_port) {
+   r = -EINVAL;
+   goto err_src_port;
+   }
 
-   of_node_put(src_node);
+   r = of_property_read_u32(src_port, reg, reg);
+   if (r) {
+   r = 0;
+   reg = 0;
+   }
 
+   src = omap_dss_find_output_by_node_and_reg(src_node, reg);
if (!src)
-   return ERR_PTR(-EPROBE_DEFER);
+   r = -EPROBE_DEFER;
+
+   of_node_put(src_port);
 
-   return src;
+err_src_port:
+   of_node_put(port_ep);
+err_port_ep:
+   of_node_put(src_node);
+err_src_node:
+   of_node_put(ep);
+err_first_ep:
+   return r ? ERR_PTR(r) : src;
 }
 EXPORT_SYMBOL_GPL(omapdss_of_find_source_for_first_ep);
diff --git a/drivers/video/fbdev/omap2/dss/output.c 
b/drivers/video/fbdev/omap2/dss/output.c
index 2ab3afa..1a8d6c7 100644
--- 

[RFC v2 4/5] OMAPDSS: DPI: make dpi_get_channel take DPI reg-id

2014-05-26 Thread Archit Taneja
To support multiple DPI instances, dpi_get_channel needs to take the DPI
instance's reg-id to get the corresponding channel. Make it take this
argument.

We just pass 0 in the non-DT path, since we don't support multiple instances
in the non-DT case.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/fbdev/omap2/dss/dpi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index 43966a7..962c722 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -625,7 +625,7 @@ static void dpi_init_pll(struct dpi_data *dpi)
  * the channel in some more dynamic manner, or get the channel as a user
  * parameter.
  */
-static enum omap_channel dpi_get_channel(void)
+static enum omap_channel dpi_get_channel(int reg)
 {
switch (omapdss_get_version()) {
case OMAPDSS_VER_OMAP24xx:
@@ -719,7 +719,7 @@ static void dpi_init_output(struct platform_device *pdev)
out-id = OMAP_DSS_OUTPUT_DPI;
out-output_type = OMAP_DISPLAY_TYPE_DPI;
out-name = dpi.0;
-   out-dispc_channel = dpi_get_channel();
+   out-dispc_channel = dpi_get_channel(0);
out-ops.dpi = dpi_ops;
out-owner = THIS_MODULE;
 
@@ -754,7 +754,7 @@ static void dpi_init_output_port(struct platform_device 
*pdev,
out-dev = pdev-dev;
out-id = OMAP_DSS_OUTPUT_DPI;
out-output_type = OMAP_DISPLAY_TYPE_DPI;
-   out-dispc_channel = dpi_get_channel();
+   out-dispc_channel = dpi_get_channel(reg);
out-ops.dpi = dpi_ops;
out-port_num = reg;
out-owner = THIS_MODULE;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] tps65917: Add support for for TPS65917 PMIC

2014-05-26 Thread Keerthy
The TPS65917 chip is a power management IC for Portable Navigation Systems
and Tablet Computing devices. It contains the following components:

 - Regulators.
 - GPADC.
 - Over Temperature warning and Shut down.

This patch series adds support for TPS65917 mfd device. At this time only
the regulator functionality is made available.

The closest drivers are PALMAS series drivers. Hence adapted palmas mfd
driver to support the tps65917 PMIC.

The register set for SMPSs and LDOs are changed and the ramp delay support
is also changed. Bit-field defenitions are changed.
Hence based on the PALMAS drivers and created a new driver
for regulator with code changes as required.

The patches are boot tested on DRA72-EVM.

Keerthy (5):
  mfd: Add DT bindings for tps65917 PMIC
  Regulators: Add TPS65917 Bindings
  mfd: palmas: Add tps65917 specific definitions and enums 
  mfd: palmas: Add tps65917 support
  regulator: tps65917: Add Regulator driver for tps65917 PMIC

 Documentation/devicetree/bindings/mfd/palmas.txt   |2 +
 .../bindings/regulator/tps65917-pmic.txt   |   67 ++
 drivers/mfd/palmas.c   |  177 -
 drivers/regulator/Kconfig  |   12 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/tps65917-regulator.c |  825 
 include/linux/mfd/palmas.h |  793 +++
 7 files changed, 1872 insertions(+), 5 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/tps65917-pmic.txt
 create mode 100644 drivers/regulator/tps65917-regulator.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] mfd: palmas: Add tps65917 support

2014-05-26 Thread Keerthy
Add tps65917 PMIC support. tps65917 is a subset of palmas PMIC.
Some of the register definitions and the interrupt mappings
are different.

Signed-off-by: Keerthy j-keer...@ti.com
---
 drivers/mfd/palmas.c |  177 --
 1 file changed, 172 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index d280d78..e4684cc 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -92,6 +92,133 @@ static const struct regmap_config 
palmas_regmap_config[PALMAS_NUM_CLIENTS] = {
},
 };
 
+static const struct regmap_irq tps65917_irqs[] = {
+   /* INT1 IRQs */
+   [TPS65917_RESERVED1] = {
+   .mask = TPS65917_RESERVED,
+   },
+   [TPS65917_PWRON_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_PWRON,
+   },
+   [TPS65917_LONG_PRESS_KEY_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_LONG_PRESS_KEY,
+   },
+   [TPS65917_RESERVED2] = {
+   .mask = TPS65917_RESERVED,
+   },
+   [TPS65917_PWRDOWN_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_PWRDOWN,
+   },
+   [TPS65917_HOTDIE_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_HOTDIE,
+   },
+   [TPS65917_VSYS_MON_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_VSYS_MON,
+   },
+   [TPS65917_RESERVED3] = {
+   .mask = TPS65917_RESERVED,
+   },
+   /* INT2 IRQs*/
+   [TPS65917_RESERVED4] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 1,
+   },
+   [TPS65917_OTP_ERROR_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_OTP_ERROR,
+   .reg_offset = 1,
+   },
+   [TPS65917_WDT_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_WDT,
+   .reg_offset = 1,
+   },
+   [TPS65917_RESERVED5] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 1,
+   },
+   [TPS65917_RESET_IN_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_RESET_IN,
+   .reg_offset = 1,
+   },
+   [TPS65917_FSD_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_FSD,
+   .reg_offset = 1,
+   },
+   [TPS65917_SHORT_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_SHORT,
+   .reg_offset = 1,
+   },
+   [TPS65917_RESERVED6] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 1,
+   },
+   /* INT3 IRQs */
+   [TPS65917_GPADC_AUTO_0_IRQ] = {
+   .mask = TPS65917_INT3_STATUS_GPADC_AUTO_0,
+   .reg_offset = 2,
+   },
+   [TPS65917_GPADC_AUTO_1_IRQ] = {
+   .mask = TPS65917_INT3_STATUS_GPADC_AUTO_1,
+   .reg_offset = 2,
+   },
+   [TPS65917_GPADC_EOC_SW_IRQ] = {
+   .mask = TPS65917_INT3_STATUS_GPADC_EOC_SW,
+   .reg_offset = 2,
+   },
+   [TPS65917_RESREVED6] = {
+   .mask = TPS65917_RESERVED6,
+   .reg_offset = 2,
+   },
+   [TPS65917_RESERVED7] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 2,
+   },
+   [TPS65917_RESERVED8] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 2,
+   },
+   [TPS65917_RESERVED9] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 2,
+   },
+   [TPS65917_VBUS_IRQ] = {
+   .mask = TPS65917_INT3_STATUS_VBUS,
+   .reg_offset = 2,
+   },
+   /* INT4 IRQs */
+   [TPS65917_GPIO_0_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_0,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_1_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_1,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_2_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_2,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_3_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_3,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_4_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_4,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_5_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_5,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_6_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_6,
+   .reg_offset = 3,
+   },
+   [TPS65917_RESERVED10] = {
+   .mask = TPS65917_RESERVED10,
+   .reg_offset = 3,
+   },
+};
+
 static const struct regmap_irq palmas_irqs[] = {
/* INT1 IRQs */
[PALMAS_CHARG_DET_N_VBUS_OVV_IRQ] = {
@@ -232,6 +359,19 @@ static struct regmap_irq_chip palmas_irq_chip = {
PALMAS_INT1_MASK),
 };
 
+static struct regmap_irq_chip tps65917_irq_chip = {
+   .name = tps65917,
+   .irqs = tps65917_irqs,
+   .num_irqs = ARRAY_SIZE(tps65917_irqs),
+
+   

[PATCH 3/5] mfd: palmas: Add tps65917 specific definitions and enums

2014-05-26 Thread Keerthy
Add tps65917 specific definitions and enums.

Signed-off-by: Keerthy j-keer...@ti.com
---
 include/linux/mfd/palmas.h |  793 
 1 file changed, 793 insertions(+)

diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index ccbb21f..52a24a9 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -30,6 +30,8 @@
 #define PALMAS_CHIP_ID 0xC035
 #define PALMAS_CHIP_CHARGER_ID 0xC036
 
+#define TPS65917_RESERVED  -1
+
 #define is_palmas(a)   (((a) == PALMAS_CHIP_OLD_ID) || \
((a) == PALMAS_CHIP_ID))
 #define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID)
@@ -184,6 +186,27 @@ enum palmas_regulators {
PALMAS_NUM_REGS,
 };
 
+enum tps65917_regulators {
+   /* SMPS regulators */
+   TPS65917_REG_SMPS1,
+   TPS65917_REG_SMPS2,
+   TPS65917_REG_SMPS3,
+   TPS65917_REG_SMPS4,
+   TPS65917_REG_SMPS5,
+   /* LDO regulators */
+   TPS65917_REG_LDO1,
+   TPS65917_REG_LDO2,
+   TPS65917_REG_LDO3,
+   TPS65917_REG_LDO4,
+   TPS65917_REG_LDO5,
+   TPS65917_REG_REGEN1,
+   TPS65917_REG_REGEN2,
+   TPS65917_REG_REGEN3,
+
+   /* Total number of regulators */
+   TPS65917_NUM_REGS,
+};
+
 /* External controll signal name */
 enum {
PALMAS_EXT_CONTROL_ENABLE1  = 0x1,
@@ -228,6 +251,24 @@ enum palmas_external_requestor_id {
PALMAS_EXTERNAL_REQSTR_ID_MAX,
 };
 
+enum tps65917_external_requestor_id {
+   TPS65917_EXTERNAL_REQSTR_ID_REGEN1,
+   TPS65917_EXTERNAL_REQSTR_ID_REGEN2,
+   TPS65917_EXTERNAL_REQSTR_ID_REGEN3,
+   TPS65917_EXTERNAL_REQSTR_ID_SMPS1,
+   TPS65917_EXTERNAL_REQSTR_ID_SMPS2,
+   TPS65917_EXTERNAL_REQSTR_ID_SMPS3,
+   TPS65917_EXTERNAL_REQSTR_ID_SMPS4,
+   TPS65917_EXTERNAL_REQSTR_ID_SMPS5,
+   TPS65917_EXTERNAL_REQSTR_ID_LDO1,
+   TPS65917_EXTERNAL_REQSTR_ID_LDO2,
+   TPS65917_EXTERNAL_REQSTR_ID_LDO3,
+   TPS65917_EXTERNAL_REQSTR_ID_LDO4,
+   TPS65917_EXTERNAL_REQSTR_ID_LDO5,
+   /* Last entry */
+   TPS65917_EXTERNAL_REQSTR_ID_MAX,
+};
+
 struct palmas_pmic_platform_data {
/* An array of pointers to regulator init data indexed by regulator
 * ID
@@ -349,6 +390,48 @@ struct palmas_gpadc_result {
 
 #define PALMAS_MAX_CHANNELS 16
 
+/* Define the tps65917 IRQ numbers */
+enum tps65917_irqs {
+   /* INT1 registers */
+   TPS65917_RESERVED1,
+   TPS65917_PWRON_IRQ,
+   TPS65917_LONG_PRESS_KEY_IRQ,
+   TPS65917_RESERVED2,
+   TPS65917_PWRDOWN_IRQ,
+   TPS65917_HOTDIE_IRQ,
+   TPS65917_VSYS_MON_IRQ,
+   TPS65917_RESERVED3,
+   /* INT2 registers */
+   TPS65917_RESERVED4,
+   TPS65917_OTP_ERROR_IRQ,
+   TPS65917_WDT_IRQ,
+   TPS65917_RESERVED5,
+   TPS65917_RESET_IN_IRQ,
+   TPS65917_FSD_IRQ,
+   TPS65917_SHORT_IRQ,
+   TPS65917_RESERVED6,
+   /* INT3 registers */
+   TPS65917_GPADC_AUTO_0_IRQ,
+   TPS65917_GPADC_AUTO_1_IRQ,
+   TPS65917_GPADC_EOC_SW_IRQ,
+   TPS65917_RESREVED6,
+   TPS65917_RESERVED7,
+   TPS65917_RESERVED8,
+   TPS65917_RESERVED9,
+   TPS65917_VBUS_IRQ,
+   /* INT4 registers */
+   TPS65917_GPIO_0_IRQ,
+   TPS65917_GPIO_1_IRQ,
+   TPS65917_GPIO_2_IRQ,
+   TPS65917_GPIO_3_IRQ,
+   TPS65917_GPIO_4_IRQ,
+   TPS65917_GPIO_5_IRQ,
+   TPS65917_GPIO_6_IRQ,
+   TPS65917_RESERVED10,
+   /* Total Number IRQs */
+   TPS65917_NUM_IRQ,
+};
+
 /* Define the palmas IRQ numbers */
 enum palmas_irqs {
/* INT1 registers */
@@ -400,6 +483,7 @@ struct palmas_pmic {
 
int smps123;
int smps457;
+   int smps12;
 
int range[PALMAS_REG_SMPS10_OUT1];
unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1];
@@ -2871,6 +2955,715 @@ enum usb_irq_events {
 #define PALMAS_GPADC_TRIM150x0E
 #define PALMAS_GPADC_TRIM160x0F
 
+/* TPS65917 Interrupt registers */
+
+/* Registers for function INTERRUPT */
+#define TPS65917_INT1_STATUS   0x00
+#define TPS65917_INT1_MASK 0x01
+#define TPS65917_INT1_LINE_STATE   0x02
+#define TPS65917_INT2_STATUS   0x05
+#define TPS65917_INT2_MASK 0x06
+#define TPS65917_INT2_LINE_STATE   0x07
+#define TPS65917_INT3_STATUS   0x0A
+#define TPS65917_INT3_MASK 0x0B
+#define TPS65917_INT3_LINE_STATE   0x0C
+#define TPS65917_INT4_STATUS   0x0F
+#define TPS65917_INT4_MASK 0x10
+#define TPS65917_INT4_LINE_STATE   0x11
+#define TPS65917_INT4_EDGE_DETECT1 

[PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-26 Thread Keerthy
This patch adds support for TPS65917 PMIC regulators.

The regulators set consists of 5 SMPSs and 5 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components.

Signed-off-by: Keerthy j-keer...@ti.com
---
 drivers/regulator/Kconfig  |   12 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/tps65917-regulator.c |  815 
 3 files changed, 828 insertions(+)
 create mode 100644 drivers/regulator/tps65917-regulator.c

Index: linux/drivers/regulator/Kconfig
===
--- linux.orig/drivers/regulator/Kconfig2014-05-26 15:21:12.269247638 
+0530
+++ linux/drivers/regulator/Kconfig 2014-05-26 15:21:46.956121138 +0530
@@ -581,6 +581,18 @@
help
This driver supports TPS65912 voltage regulator chip.
 
+config REGULATOR_TPS65917
+   tristate TI TPS65917 PMIC Regulators
+   depends on MFD_PALMAS
+   help
+ If you wish to control the regulators on the TPS65917 series of
+ chips say Y here. This will enable support for all the software
+ controllable SMPS/LDO regulators.
+
+ The regulators available on TPS65917 series chips vary depending
+ on the muxing. This is handled automatically in the driver by
+ reading the mux info from OTP.
+
 config REGULATOR_TPS80031
tristate TI TPS80031/TPS80032 power regualtor driver
depends on MFD_TPS80031
Index: linux/drivers/regulator/Makefile
===
--- linux.orig/drivers/regulator/Makefile   2014-05-26 15:21:12.269247638 
+0530
+++ linux/drivers/regulator/Makefile2014-05-26 15:21:46.956121138 +0530
@@ -76,6 +76,7 @@
 obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
+obj-$(CONFIG_REGULATOR_TPS65917) += tps65917-regulator.o
 obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o
 obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
 obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o
Index: linux/drivers/regulator/tps65917-regulator.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux/drivers/regulator/tps65917-regulator.c2014-05-26 
15:22:25.994853307 +0530
@@ -0,0 +1,814 @@
+/*
+ * Driver for Regulator part of TPS65917 PMIC
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/init.h
+#include linux/err.h
+#include linux/platform_device.h
+#include linux/regulator/driver.h
+#include linux/regulator/machine.h
+#include linux/slab.h
+#include linux/regmap.h
+#include linux/mfd/palmas.h
+#include linux/of.h
+#include linux/of_platform.h
+#include linux/regulator/of_regulator.h
+
+static const struct regulator_linear_range smps_low_ranges[] = {
+   REGULATOR_LINEAR_RANGE(50, 0x1, 0x6, 0),
+   REGULATOR_LINEAR_RANGE(51, 0x7, 0x79, 1),
+   REGULATOR_LINEAR_RANGE(165, 0x7A, 0x7f, 0),
+};
+
+static const struct regulator_linear_range smps_high_ranges[] = {
+   REGULATOR_LINEAR_RANGE(100, 0x1, 0x6, 0),
+   REGULATOR_LINEAR_RANGE(102, 0x7, 0x79, 2),
+   REGULATOR_LINEAR_RANGE(330, 0x7A, 0x7f, 0),
+};
+
+struct regs_info {
+   char*name;
+   char*sname;
+   u8  vsel_addr;
+   u8  ctrl_addr;
+   int sleep_id;
+};
+
+static const struct regs_info tps65917_regs_info[] = {
+   {
+   .name   = SMPS1,
+   .sname  = smps1-in,
+   .vsel_addr  = TPS65917_SMPS1_VOLTAGE,
+   .ctrl_addr  = TPS65917_SMPS1_CTRL,
+   .sleep_id   = TPS65917_EXTERNAL_REQSTR_ID_SMPS1,
+   },
+   {
+   .name   = SMPS2,
+   .sname  = smps2-in,
+   .vsel_addr  = TPS65917_SMPS2_VOLTAGE,
+   .ctrl_addr  = TPS65917_SMPS2_CTRL,
+   .sleep_id   = TPS65917_EXTERNAL_REQSTR_ID_SMPS2,
+   },
+   {
+   .name   = SMPS3,
+   .sname  = smps3-in,
+   .vsel_addr  = TPS65917_SMPS3_VOLTAGE,
+   .ctrl_addr  = TPS65917_SMPS3_CTRL,
+   .sleep_id   = 

[PATCH 1/5] mfd: Add DT bindings for tps65917 PMIC

2014-05-26 Thread Keerthy
Add DT bindings for tps65917 PMIC.

Signed-off-by: Keerthy j-keer...@ti.com
---
 Documentation/devicetree/bindings/mfd/palmas.txt |2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/palmas.txt 
b/Documentation/devicetree/bindings/mfd/palmas.txt
index e5f0f83..eda8989 100644
--- a/Documentation/devicetree/bindings/mfd/palmas.txt
+++ b/Documentation/devicetree/bindings/mfd/palmas.txt
@@ -6,6 +6,7 @@ twl6037 (palmas)
 tps65913 (palmas)
 tps65914 (palmas)
 tps659038
+tps65917
 
 Required properties:
 - compatible : Should be from the list
@@ -16,6 +17,7 @@ Required properties:
   ti,tps65914
   ti,tps80036
   ti,tps659038
+  ti,tps65917
 and also the generic series names
   ti,palmas
 - interrupt-controller : palmas has its own internal IRQs
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] Regulators: Add TPS65917 Bindings

2014-05-26 Thread Keerthy
Add TPS65917 Bindings.

Signed-off-by: Keerthy j-keer...@ti.com
---
 .../bindings/regulator/tps65917-pmic.txt   |   67 
 1 file changed, 67 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/regulator/tps65917-pmic.txt

diff --git a/Documentation/devicetree/bindings/regulator/tps65917-pmic.txt 
b/Documentation/devicetree/bindings/regulator/tps65917-pmic.txt
new file mode 100644
index 000..96d1fb7
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/tps65917-pmic.txt
@@ -0,0 +1,67 @@
+* tps65917 regulator IP block devicetree bindings
+
+Required properties:
+- compatible : Should be
+  ti,tps65917-pmic
+
+- interrupt-parent : The parent interrupt controller which is tps65917.
+- interrupts : The interrupt number and the type which can be looked up here:
+  arch/arm/boot/dts/include/dt-bindings/interrupt-controller/irq.h
+- interrupts-name: The names of the individual interrupts.
+
+Optional nodes:
+- regulators : Must contain a sub-node per regulator from the list below.
+  Each sub-node should contain the constraints and initialization
+  information for that regulator. See regulator.txt for a
+  description of standard properties for these sub-nodes.
+  Additional custom properties  are listed below.
+
+  Optional sub-node properties:
+  ti,warm-reset - maintain voltage during warm reset(boolean)
+  ti,roof-floor - This takes as optional argument on platform 
supporting
+  the rail from desired external control. If there is no argument 
then
+  it will be assume that it is controlled by NSLEEP pin.
+  The valid value for external pins are:
+   ENABLE1 then 1,
+   ENABLE2 then 2 or
+   NSLEEP then 3.
+  ti,mode-sleep - mode to adopt in pmic sleep 0 - off, 1 - auto,
+  2 - eco, 3 - forced pwm
+  ti,smps-range - OTP has the wrong range set for the hardware so 
override
+  0 - low range, 1 - high range.
+
+- ti,system-power-controller: Telling whether or not this pmic is controlling
+ the system power.
+
+Example:
+
+#include dt-bindings/interrupt-controller/irq.h
+
+pmic {
+   compatible = ti,tps65917-pmic;
+   interrupt-parent = tps65917;
+   interrupts = 14 IRQ_TYPE_NONE;
+   interrupts-name = short-irq;
+
+   ti,system-power-controller;
+
+   regulators {
+   smps1_reg : smps1 {
+   regulator-name = smps1;
+   regulator-min-microvolt =  60;
+   regulator-max-microvolt = 150;
+   regulator-always-on;
+   regulator-boot-on;
+   ti,warm-reset;
+   ti,roof-floor = 1; /* ENABLE1 control */
+   ti,mode-sleep = 0;
+   ti,smps-range = 1;
+   };
+
+   ldo1_reg: ldo1 {
+   regulator-name = ldo1;
+   regulator-min-microvolt = 280;
+   regulator-max-microvolt = 280;
+   };
+   };
+};
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 2/2] ARM: OMAP5: hwmod data: Make DSS hwmods share MODULEMODE fields

2014-05-26 Thread Archit Taneja
This is an example which shows how to use new 'shared modulemode' flag.

DSS hwmods share the MODULEMODE field. Add the new HWMOD_OMAP4_MODULEMODE_SHARED
flag, and create a modulemode_shared struct which the DSS hwmods refer to.

This will allow the hwmods to reset properly during boot, and not break things
when the DSS driver runs.

(Note: hdmi and rfbi hwmods still don't reset properly as they don't have their
mainclks as dss_dss_clk, this will be fixed later).

Signed-off-by: Archit Taneja arc...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 46 +-
 1 file changed, 33 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index e8bdd7a..762d61f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -337,6 +337,9 @@ static struct omap_hwmod omap54xx_dmic_hwmod = {
  * 'dss' class
  * display sub-system
  */
+
+static struct modulemode_shared dss_modulemode_ref;
+
 static struct omap_hwmod_class_sysconfig omap54xx_dss_sysc = {
.rev_offs   = 0x,
.syss_offs  = 0x0014,
@@ -364,9 +367,11 @@ static struct omap_hwmod omap54xx_dss_hwmod = {
.main_clk   = dss_dss_clk,
.prcm = {
.omap4 = {
-   .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
-   .context_offs = OMAP54XX_RM_DSS_DSS_CONTEXT_OFFSET,
-   .modulemode   = MODULEMODE_SWCTRL,
+   .clkctrl_offs   = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
+   .context_offs   = OMAP54XX_RM_DSS_DSS_CONTEXT_OFFSET,
+   .modulemode = MODULEMODE_SWCTRL,
+   .flags  = HWMOD_OMAP4_MODULEMODE_SHARED,
+   .modulemode_ref = dss_modulemode_ref,
},
},
.opt_clks   = dss_opt_clks,
@@ -414,8 +419,11 @@ static struct omap_hwmod omap54xx_dss_dispc_hwmod = {
.main_clk   = dss_dss_clk,
.prcm = {
.omap4 = {
-   .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
-   .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
+   .clkctrl_offs   = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
+   .flags  = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT |
+ HWMOD_OMAP4_MODULEMODE_SHARED,
+   .modulemode = MODULEMODE_SWCTRL,
+   .modulemode_ref = dss_modulemode_ref,
},
},
.opt_clks   = dss_dispc_opt_clks,
@@ -456,8 +464,11 @@ static struct omap_hwmod omap54xx_dss_dsi1_a_hwmod = {
.main_clk   = dss_dss_clk,
.prcm = {
.omap4 = {
-   .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
-   .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
+   .clkctrl_offs   = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
+   .flags  = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT |
+ HWMOD_OMAP4_MODULEMODE_SHARED,
+   .modulemode = MODULEMODE_SWCTRL,
+   .modulemode_ref = dss_modulemode_ref,
},
},
.opt_clks   = dss_dsi1_a_opt_clks,
@@ -476,8 +487,11 @@ static struct omap_hwmod omap54xx_dss_dsi1_c_hwmod = {
.main_clk   = dss_dss_clk,
.prcm = {
.omap4 = {
-   .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
-   .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
+   .clkctrl_offs   = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
+   .flags  = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT |
+ HWMOD_OMAP4_MODULEMODE_SHARED,
+   .modulemode = MODULEMODE_SWCTRL,
+   .modulemode_ref = dss_modulemode_ref,
},
},
.opt_clks   = dss_dsi1_c_opt_clks,
@@ -515,8 +529,11 @@ static struct omap_hwmod omap54xx_dss_hdmi_hwmod = {
.main_clk   = dss_48mhz_clk,
.prcm = {
.omap4 = {
-   .clkctrl_offs = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
-   .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
+   .clkctrl_offs   = OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET,
+   .flags  = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT |
+ HWMOD_OMAP4_MODULEMODE_SHARED,
+   .modulemode = MODULEMODE_SWCTRL,
+   .modulemode_ref = dss_modulemode_ref,
},
},
.opt_clks   = dss_hdmi_opt_clks,
@@ -554,8 +571,11 @@ static struct omap_hwmod omap54xx_dss_rfbi_hwmod = {
.clkdm_name = dss_clkdm,

[RFC 1/2] ARM: OMAP2+: hwmod: Add refcounting for modulemode shared by multiple hwmods

2014-05-26 Thread Archit Taneja
Generally, IP blocks/modules within a clock domain each have their own
CM_x_CLKCTRL register, each having it's own MODULEMODE field to manage the
module.

DSS clockdoain, however, has multiple modules in it, but only one register
named CM_DSS_DSS_CLKCTRL, which contains one MODULEMODE register field.

Until now, we defined '.prcm.omap4.modulemode' only for the top level DSS
hwmod(dss_core) and didn't define it for other DSS hwmods(like dss_dispc,
dss_dsi1 and so on). This made the omapdss driver work as the top level DSS
platform device and the rest had a parent-child relationship. This ensured that
the parent hwmod(dss_core) is enabled if any of the children hwmods are
enabled while using omapdss.

This method, however, doesn't work when each hwmod is enabled individually.
This happens early in boot in omap_hwmod_setup_all, where each hwmod is enabled,
and then reset and idled. All the 'children' DSS hwmods fail to enable and
reset, since they don't enable modulemode.

The way to make such modules work both during initialization and when used by
pm runtime API in the driver would be to add refcounting for enabling/disabling
the modulemode field.

We add a new flag bit for the flag in omap_hwmod_omap4_prcm, which tells
omap_hwmod that this hwmod uses a modulemode field shared by other hwmods.

We create a struct called 'modulemode_shared'. The hwmod data file should define
a static instance of this struct. Each hwmod that uses this modulemode field
should hold a pointer to this instance.

omap_hwmod's soc enable_module and disable_module ops set the MODULEMODE
reigster bits only when the first module using it is enabled, or the last module
using it is disabled. We serialize accesses to the struct with a spinlock.

Signed-off-by: Archit Taneja arc...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.c | 123 +--
 arch/arm/mach-omap2/omap_hwmod.h |  38 +---
 2 files changed, 133 insertions(+), 28 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 66c60fe..b42718d 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -973,17 +973,33 @@ static void _disable_optional_clocks(struct omap_hwmod 
*oh)
  */
 static void _omap4_enable_module(struct omap_hwmod *oh)
 {
+   unsigned long flags;
+   struct modulemode_shared *mmode = NULL;
+   bool enable = true;
+
if (!oh-clkdm || !oh-prcm.omap4.modulemode)
return;
 
pr_debug(omap_hwmod: %s: %s: %d\n,
 oh-name, __func__, oh-prcm.omap4.modulemode);
 
-   omap4_cminst_module_enable(oh-prcm.omap4.modulemode,
-  oh-clkdm-prcm_partition,
-  oh-clkdm-cm_inst,
-  oh-clkdm-clkdm_offs,
-  oh-prcm.omap4.clkctrl_offs);
+   if (oh-prcm.omap4.flags  HWMOD_OMAP4_MODULEMODE_SHARED) {
+   mmode = oh-prcm.omap4.modulemode_ref;
+
+   spin_lock_irqsave(mmode-lock, flags);
+
+   enable = mmode-refcnt++ == 0;
+   }
+
+   if (enable)
+   omap4_cminst_module_enable(oh-prcm.omap4.modulemode,
+  oh-clkdm-prcm_partition,
+  oh-clkdm-cm_inst,
+  oh-clkdm-clkdm_offs,
+  oh-prcm.omap4.clkctrl_offs);
+
+   if (mmode)
+   spin_unlock_irqrestore(mmode-lock, flags);
 }
 
 /**
@@ -995,15 +1011,32 @@ static void _omap4_enable_module(struct omap_hwmod *oh)
  */
 static void _am33xx_enable_module(struct omap_hwmod *oh)
 {
+   unsigned long flags;
+   struct modulemode_shared *mmode = NULL;
+   bool enable = true;
+
if (!oh-clkdm || !oh-prcm.omap4.modulemode)
return;
 
pr_debug(omap_hwmod: %s: %s: %d\n,
 oh-name, __func__, oh-prcm.omap4.modulemode);
 
-   am33xx_cm_module_enable(oh-prcm.omap4.modulemode, oh-clkdm-cm_inst,
-   oh-clkdm-clkdm_offs,
-   oh-prcm.omap4.clkctrl_offs);
+   if (oh-prcm.omap4.flags  HWMOD_OMAP4_MODULEMODE_SHARED) {
+   mmode = oh-prcm.omap4.modulemode_ref;
+
+   spin_lock_irqsave(mmode-lock, flags);
+
+   enable = mmode-refcnt++ == 0;
+   }
+
+   if (enable)
+   am33xx_cm_module_enable(oh-prcm.omap4.modulemode,
+   oh-clkdm-cm_inst,
+   oh-clkdm-clkdm_offs,
+   oh-prcm.omap4.clkctrl_offs);
+
+   if (mmode)
+   spin_unlock_irqrestore(mmode-lock, flags);
 }
 
 /**
@@ -1846,6 +1879,9 @@ static bool _are_any_hardreset_lines_asserted(struct 
omap_hwmod *oh)
 static int _omap4_disable_module(struct omap_hwmod *oh)
 {
int v;
+   unsigned long 

Re: [PATCH] ASoC: omap-pcm: Move omap-pcm under include/sound

2014-05-26 Thread Mark Brown
On Mon, May 26, 2014 at 11:51:14AM +0300, Jyri Sarha wrote:
 Make including the omap-pcm.h outside sound/soc/omap more convenient.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-26 Thread Mark Brown
On Mon, May 26, 2014 at 03:26:37PM +0530, Keerthy wrote:
 This patch adds support for TPS65917 PMIC regulators.
 
 The regulators set consists of 5 SMPSs and 5 LDOs. The output
 voltages are configurable and are meant to supply power to the
 main processor and other components.

This appears to look *very* like the Palmas driver, should it not be
sharing code with that?  If it were just data tables it'd be less of a
concern but there's quite a bit of actual code here.


signature.asc
Description: Digital signature


Re: [GIT PULL 1/4] omap soc changes for v3.16 merge window

2014-05-26 Thread Olof Johansson
On Mon, May 19, 2014 at 06:30:31PM -0700, Tony Lindgren wrote:
 Looks like I'm still having trouble sending out some pull requests,
 so apologies you're seeing these as duplicates.
 
 The following changes since commit d1db0eea852497762cab43b905b879dfcd3b8987:
 
   Linux 3.15-rc3 (2014-04-27 19:29:27 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
 tags/omap-for-v3.16/soc-signed

Merged into next/soc. Thanks!

-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL 2/4] omap prcm changes for v3.16 merge window

2014-05-26 Thread Olof Johansson
On Mon, May 19, 2014 at 06:30:50PM -0700, Tony Lindgren wrote:
 The following changes since commit be2d62844819b3536233b7fc726b8f17d9fa7f05:
 
   ARM: OMAP: debug-leds: raw read and write endian fix (2014-05-08 07:09:55 
 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
 tags/omap-for-v3.16/prcm-signed

Merged into next/cleanup. Thanks!


-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL 3/4] omap board changes for v3.16 merge window

2014-05-26 Thread Olof Johansson
On Mon, May 19, 2014 at 06:31:08PM -0700, Tony Lindgren wrote:
 The following changes since commit 89ca3b881987f5a4be4c5dbaa7f0df12bbdde2fd:
 
   Linux 3.15-rc4 (2014-05-04 18:14:42 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
 tags/omap-for-v3.16/board-signed
 
 for you to fetch changes up to 77c2f02edbeda9409a7cf3fd66233015820c213a:
 
   ARM: OMAP: replace checks for CONFIG_USB_GADGET_OMAP (2014-05-16 14:14:25 
 -0700)

Merged into next/boards. Thanks!


-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL 4/4] omap dt changes for v3.16 merge window, part 2

2014-05-26 Thread Olof Johansson
On Mon, May 19, 2014 at 06:31:25PM -0700, Tony Lindgren wrote:
 The following changes since commit 3fdb77174a2c173e0e69f2499b836a0e412f6c4d:
 
   ARM: dts: omap3-n900: use MATRIX_KEY for keymap (2014-05-06 10:22:51 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
 tags/omap-for-v3.16/dt-part2-v2
 
 for you to fetch changes up to d712ff63b18309c939396f593510fbcccbafb9e4:
 
   ARM: dts: Enable mcpdm and mcbsp1 on DuoVero (2014-05-19 17:20:31 -0700)
 
 
 Device tree related changes for omaps.

Merged into next/dt.

I'd appreciate a bit more verbose tag messages though -- a very brief
overview of what's new in here, etc. I think you used to do them in the past?


-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL 1/3] omap non urgent fixes for v3.16 merge window, resend

2014-05-26 Thread Olof Johansson
On Mon, May 19, 2014 at 07:10:30PM -0700, Tony Lindgren wrote:
 Hi,
 
 Here are three pull requests that never made the lists
 on the 8th of May as I have something still wrong with
 my scripts it seems. Anyways, these should be fine pulled
 out of order, if in doubt see my temporary merge branch
 at omap-for-v3.16/tmp-merge-2014-05-19.
 
 The following changes since commit fb677ef70b65e22cd4401d31b700a8b4041efae1:
 
   ARM: OMAP2+: Fix GPMC remap for devices using an offset (2014-04-23 
 11:09:22 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
 tags/omap-for-v3.16/fixes-not-urgent-signed

Pulled, thanks.


-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL 2/3] omap pm changes for v3.16 merge window, resend

2014-05-26 Thread Olof Johansson
On Mon, May 19, 2014 at 07:11:52PM -0700, Tony Lindgren wrote:
 The following changes since commit 89ca3b881987f5a4be4c5dbaa7f0df12bbdde2fd:
 
   Linux 3.15-rc4 (2014-05-04 18:14:42 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
 tags/omap-for-v3.16/pm-signed
 
 for you to fetch changes up to 57b05572267581c2320462e9b606709fa6da4c5a:
 
   ARM: OMAP2+: Enable CPUidle in omap2plus_defconfig (2014-05-06 15:45:15 
 -0700)
 
 
 PM related fixes for omap3 that were discovered during omap3
 conversion to device tree. This series sets up the PMIC signaling
 in a way where we can test for PM regressions easily by
 looking at state of the the sys_clkreq and sys_off_mode pins.
 
 Note that this series alone does not make omap3 PM to cut
 off core voltage during off-idle, changes to twl4030-power.c
 configurations are still needed. Those will be posted
 separately.

Merged into next/soc.


Thanks,

-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL 3/3] omap l3-noc bus driver changes for v3.16 merge window, resend

2014-05-26 Thread Olof Johansson
On Mon, May 19, 2014 at 07:13:00PM -0700, Tony Lindgren wrote:
 The following changes since commit 455c6fdbd219161bd09b1165f11699d6d73de11c:
 
   Linux 3.14 (2014-03-30 20:40:15 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
 tags/omap-for-v3.16/l3-noc-signed
 
 for you to fetch changes up to 27b7d5f3cc49f2e5cd6c005d73696058b7140c5c:
 
   bus: omap_l3_noc: Add AM4372 interconnect error data (2014-05-05 14:34:37 
 -0500)

Pulled into next/drivers. Thanks.


-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 01/10] platform_data: edma: Be precise with the paRAM struct

2014-05-26 Thread Olof Johansson
Hi,

On Mon, Apr 14, 2014 at 4:41 AM, Peter Ujfalusi peter.ujfal...@ti.com wrote:
 The edmacc_param struct should follow the layout of the paRAM area in the
 HW. Be explicit on the size of the fields (u32) and also mark the struct
 as packed to avoid any padding on non 32bit architectures.

 Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
 Acked-by: Joel Fernandes jo...@ti.com
 ---
  include/linux/platform_data/edma.h | 18 +-
  1 file changed, 9 insertions(+), 9 deletions(-)

 diff --git a/include/linux/platform_data/edma.h 
 b/include/linux/platform_data/edma.h
 index f50821cb64be..923f8a3e4ce0 100644
 --- a/include/linux/platform_data/edma.h
 +++ b/include/linux/platform_data/edma.h
 @@ -43,15 +43,15 @@

  /* PaRAM slots are laid out like this */
  struct edmacc_param {
 -   unsigned int opt;
 -   unsigned int src;
 -   unsigned int a_b_cnt;
 -   unsigned int dst;
 -   unsigned int src_dst_bidx;
 -   unsigned int link_bcntrld;
 -   unsigned int src_dst_cidx;
 -   unsigned int ccnt;
 -};
 +   u32 opt;
 +   u32 src;
 +   u32 a_b_cnt;
 +   u32 dst;
 +   u32 src_dst_bidx;
 +   u32 link_bcntrld;
 +   u32 src_dst_cidx;
 +   u32 ccnt;
 +} __packed;

  /* fields in edmacc_param.opt */
  #define SAMBIT(0)

I came across this patch when I was looking at a pull request from
Sekhar for EDMA cleanups, and it made me look closer at the contents
of this file.

The include/linux/platform_data/ directory is meant to hold
platform_data definitions for drivers, and nothing more.
platform_data/edma.h also contains a whole bunch of interface
definitions for the driver. They do not belong there, and should be
moved to a different include file.

That also includes the above struct, because as far as I can tell it's
a runtime state structure, not something that is passed in with
platform data.

Can someone please clean this up? Thanks.


-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL 4/4] omap dt changes for v3.16 merge window, part 2

2014-05-26 Thread Tony Lindgren
* Olof Johansson o...@lixom.net [140526 13:03]:
 On Mon, May 19, 2014 at 06:31:25PM -0700, Tony Lindgren wrote:
  The following changes since commit 3fdb77174a2c173e0e69f2499b836a0e412f6c4d:
  
ARM: dts: omap3-n900: use MATRIX_KEY for keymap (2014-05-06 10:22:51 
  -0700)
  
  are available in the git repository at:
  
git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
  tags/omap-for-v3.16/dt-part2-v2
  
  for you to fetch changes up to d712ff63b18309c939396f593510fbcccbafb9e4:
  
ARM: dts: Enable mcpdm and mcbsp1 on DuoVero (2014-05-19 17:20:31 -0700)
  
  
  Device tree related changes for omaps.
 
 Merged into next/dt.
 
 I'd appreciate a bit more verbose tag messages though -- a very brief
 overview of what's new in here, etc. I think you used to do them in the past?

Just laziness.. I'll have more verbose overview next time.

Thanks,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-26 Thread Keerthy

Hi Mark,

On Monday 26 May 2014 08:30 PM, Mark Brown wrote:

On Mon, May 26, 2014 at 03:26:37PM +0530, Keerthy wrote:

This patch adds support for TPS65917 PMIC regulators.

The regulators set consists of 5 SMPSs and 5 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components.

This appears to look *very* like the Palmas driver, should it not be
sharing code with that?  If it were just data tables it'd be less of a
concern but there's quite a bit of actual code here.

Yes it is. The difference is in the entire register space of the regulators
between the two. There are other differences in how the ramp delay
is configured and SMPS ordering. The difference is also a bit in the 
programming
sequence. I agree that largely it is Palmas based. I did not want to add 
more

checks in the probe of the palmas driver. Hence came up with a new one.

Coming to sharing the code, can we have 2 drivers which share the common
functions with separate data and specific functions?

I just simply do not want to add anything more to the palmas driver 
probe function.


Kind Regards,
Keerthy
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html