[PATCHv2 0/3] spi: omap2-mcspi: spi cleanups

2012-08-22 Thread Shubhrajyoti D
This patch does the following

Calls the pm_runtime_* functions directly.
Remove the MOD_REG_BIT macro usage thereby removiing un-needed branch.
At remove dont use the autosuspend runtime calls.

Changes from v1:
Fix the comments on changelogs.
Add acks to the patches.

The following changes since commit 23dcfa61bac244e1200ff9ad19c6e9144dcb6bb5:

  Merge branch 'akpm' (Andrew's patch-bomb) (2012-08-21 17:22:22 -0700)

are available in the git repository at:

  git://gitorious.org/linus-tree/linus-tree.git for_3.6/spi




Shubhrajyoti D (3):
  spi: omap2-mcspi: Call pm_runtime_* functions directly
  spi: omap2-mcspi: Remove the macro MOD_REG_BIT
  spi: omap2-mcspi: At remove dont use the runtime_autosuspend calls

 drivers/spi/spi-omap2-mcspi.c |   55 ++---
 1 files changed, 24 insertions(+), 31 deletions(-)

-- 
1.7.5.4

--
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


[PATCHv2 2/3] spi: omap2-mcspi: Remove the macro MOD_REG_BIT

2012-08-22 Thread Shubhrajyoti D
Remove the macro MOD_REG_BIT instead make the bit field modifications
directly. This deletes a branch operation in cases where the the set
is predecided. While at it optimise two sequential bit clear in one step.

Acked-by: Felipe Balbi ba...@ti.com
Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
---
 drivers/spi/spi-omap2-mcspi.c |   28 ++--
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index f542f3d..8a5e2c0 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -140,13 +140,6 @@ struct omap2_mcspi_cs {
u32 chconf0;
 };
 
-#define MOD_REG_BIT(val, mask, set) do { \
-   if (set) \
-   val |= mask; \
-   else \
-   val = ~mask; \
-} while (0)
-
 static inline void mcspi_write_reg(struct spi_master *master,
int idx, u32 val)
 {
@@ -205,7 +198,11 @@ static void omap2_mcspi_set_dma_req(const struct 
spi_device *spi,
else
rw = OMAP2_MCSPI_CHCONF_DMAW;
 
-   MOD_REG_BIT(l, rw, enable);
+   if (enable)
+   l |= rw;
+   else
+   l = ~rw;
+
mcspi_write_chconf0(spi, l);
 }
 
@@ -224,7 +221,11 @@ static void omap2_mcspi_force_cs(struct spi_device *spi, 
int cs_active)
u32 l;
 
l = mcspi_cached_chconf0(spi);
-   MOD_REG_BIT(l, OMAP2_MCSPI_CHCONF_FORCE, cs_active);
+   if (cs_active)
+   l |= OMAP2_MCSPI_CHCONF_FORCE;
+   else
+   l = ~OMAP2_MCSPI_CHCONF_FORCE;
+
mcspi_write_chconf0(spi, l);
 }
 
@@ -239,9 +240,8 @@ static void omap2_mcspi_set_master_mode(struct spi_master 
*master)
 * to single-channel master mode
 */
l = mcspi_read_reg(master, OMAP2_MCSPI_MODULCTRL);
-   MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_STEST, 0);
-   MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_MS, 0);
-   MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_SINGLE, 1);
+   l = ~(OMAP2_MCSPI_MODULCTRL_STEST | OMAP2_MCSPI_MODULCTRL_MS);
+   l |= OMAP2_MCSPI_MODULCTRL_SINGLE;
mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, l);
 
ctx-modulctrl = l;
@@ -1278,9 +1278,9 @@ static int omap2_mcspi_resume(struct device *dev)
 * We need to toggle CS state for OMAP take this
 * change in account.
 */
-   MOD_REG_BIT(cs-chconf0, OMAP2_MCSPI_CHCONF_FORCE, 1);
+   cs-chconf0 |= OMAP2_MCSPI_CHCONF_FORCE;
__raw_writel(cs-chconf0, cs-base + 
OMAP2_MCSPI_CHCONF0);
-   MOD_REG_BIT(cs-chconf0, OMAP2_MCSPI_CHCONF_FORCE, 0);
+   cs-chconf0 = ~OMAP2_MCSPI_CHCONF_FORCE;
__raw_writel(cs-chconf0, cs-base + 
OMAP2_MCSPI_CHCONF0);
}
}
-- 
1.7.5.4

--
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


[PATCHv2 3/3] spi: omap2-mcspi: At remove dont use the runtime_autosuspend calls

2012-08-22 Thread Shubhrajyoti D
At remove we shouldnt be using the autosuspend timeout as we are
calling pm_runtime_disable immediately after.

Acked-by: Felipe Balbi ba...@ti.com
Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
---
 drivers/spi/spi-omap2-mcspi.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 8a5e2c0..1c1dd34 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1244,8 +1244,7 @@ static int __devexit omap2_mcspi_remove(struct 
platform_device *pdev)
mcspi = spi_master_get_devdata(master);
dma_channels = mcspi-dma_channels;
 
-   pm_runtime_mark_last_busy(mcspi-dev);
-   pm_runtime_put_autosuspend(mcspi-dev);
+   pm_runtime_put_sync(mcspi-dev);
pm_runtime_disable(pdev-dev);
 
spi_unregister_master(master);
-- 
1.7.5.4

--
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


[PATCHv2 1/3] spi: omap2-mcspi: Call pm_runtime_* functions directly

2012-08-22 Thread Shubhrajyoti D
Call the pm_runtime functions directly making room for possible
pm optimisations. Also the runtime functions aren't just about
enabling and disabling of clocks though it does enable clocks also.

Acked-by: Felipe Balbi ba...@ti.com
Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
---
 drivers/spi/spi-omap2-mcspi.c |   28 +++-
 1 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index b2fb141..f542f3d 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -260,16 +260,6 @@ static void omap2_mcspi_restore_ctx(struct omap2_mcspi 
*mcspi)
list_for_each_entry(cs, ctx-cs, node)
__raw_writel(cs-chconf0, cs-base + OMAP2_MCSPI_CHCONF0);
 }
-static void omap2_mcspi_disable_clocks(struct omap2_mcspi *mcspi)
-{
-   pm_runtime_mark_last_busy(mcspi-dev);
-   pm_runtime_put_autosuspend(mcspi-dev);
-}
-
-static int omap2_mcspi_enable_clocks(struct omap2_mcspi *mcspi)
-{
-   return pm_runtime_get_sync(mcspi-dev);
-}
 
 static int omap2_prepare_transfer(struct spi_master *master)
 {
@@ -848,12 +838,13 @@ static int omap2_mcspi_setup(struct spi_device *spi)
return ret;
}
 
-   ret = omap2_mcspi_enable_clocks(mcspi);
+   ret = pm_runtime_get_sync(mcspi-dev);
if (ret  0)
return ret;
 
ret = omap2_mcspi_setup_transfer(spi, NULL);
-   omap2_mcspi_disable_clocks(mcspi);
+   pm_runtime_mark_last_busy(mcspi-dev);
+   pm_runtime_put_autosuspend(mcspi-dev);
 
return ret;
 }
@@ -1067,7 +1058,7 @@ static int __devinit omap2_mcspi_master_setup(struct 
omap2_mcspi *mcspi)
struct omap2_mcspi_regs *ctx = mcspi-ctx;
int ret = 0;
 
-   ret = omap2_mcspi_enable_clocks(mcspi);
+   ret = pm_runtime_get_sync(mcspi-dev);
if (ret  0)
return ret;
 
@@ -1076,7 +1067,8 @@ static int __devinit omap2_mcspi_master_setup(struct 
omap2_mcspi *mcspi)
ctx-wakeupenable = OMAP2_MCSPI_WAKEUPENABLE_WKEN;
 
omap2_mcspi_set_master_mode(master);
-   omap2_mcspi_disable_clocks(mcspi);
+   pm_runtime_mark_last_busy(mcspi-dev);
+   pm_runtime_put_autosuspend(mcspi-dev);
return 0;
 }
 
@@ -1252,7 +1244,8 @@ static int __devexit omap2_mcspi_remove(struct 
platform_device *pdev)
mcspi = spi_master_get_devdata(master);
dma_channels = mcspi-dma_channels;
 
-   omap2_mcspi_disable_clocks(mcspi);
+   pm_runtime_mark_last_busy(mcspi-dev);
+   pm_runtime_put_autosuspend(mcspi-dev);
pm_runtime_disable(pdev-dev);
 
spi_unregister_master(master);
@@ -1278,7 +1271,7 @@ static int omap2_mcspi_resume(struct device *dev)
struct omap2_mcspi_regs *ctx = mcspi-ctx;
struct omap2_mcspi_cs   *cs;
 
-   omap2_mcspi_enable_clocks(mcspi);
+   pm_runtime_get_sync(mcspi-dev);
list_for_each_entry(cs, ctx-cs, node) {
if ((cs-chconf0  OMAP2_MCSPI_CHCONF_FORCE) == 0) {
/*
@@ -1291,7 +1284,8 @@ static int omap2_mcspi_resume(struct device *dev)
__raw_writel(cs-chconf0, cs-base + 
OMAP2_MCSPI_CHCONF0);
}
}
-   omap2_mcspi_disable_clocks(mcspi);
+   pm_runtime_mark_last_busy(mcspi-dev);
+   pm_runtime_put_autosuspend(mcspi-dev);
return 0;
 }
 #else
-- 
1.7.5.4

--
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 0/3] ARM: OMAP2/3: DSS HWMOD fixes

2012-08-22 Thread Tomi Valkeinen
On Wed, 2012-07-04 at 06:11 -0600, Paul Walmsley wrote:
 Hi Tomi
 
 On Wed, 27 Jun 2012, Paul Walmsley wrote:
 
  On Thu, 10 May 2012, Tomi Valkeinen wrote:
  
   These patches fix DSS hwmod data related to sysc flags. I haven't seen any
   problem produced by these missing bits, but by looking at the TRM it's 
   clear
   that they should be defined.
   
   However, applying these will cause additional warnings to show during 
   boot:
   
   omap_hwmod: dss_dispc: softreset failed (waited 1 usec)
   omap_hwmod: dss_rfbi: softreset failed (waited 1 usec)
   
   Most likely the softreset fails even now, but as there's no check to 
   verify it,
   no warnings are visible.
   
   I think the reason for the failing softreset is the same problem as we 
   have on
   OMAP4: dss_core hwmod should be enabled before other dss hwmods can be 
   enabled
   (and reset).
  
  Thanks, queued for 3.6.
  
  Not sure what to do about the softreset issues at the moment, due to 
  competing priorities.  But for sure the data should match the hardware.
 
 I've dropped these for 3.6 since they cause a PM regression during a 
 system suspend test:
 
 [   39.721282] Powerdomain (dss_pwrdm) didn't enter target state 1
 
 Probably before we can pull these in, we need to figure out what's going 
 on there.

I was testing with omap3 overo, on v3.6-rc2 +
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
fixes-for-linus

I don't seem to be able to enter full suspend even without dss. This is
with DSS compiled as modules, and not loaded:

# echo mem  /sys/power/state 
[   21.697265] PM: Syncing filesystems ... done.
[   21.711059] Freezing user space processes ... (elapsed 0.02 seconds) done.
[   21.740722] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) 
done.
[   21.911407] PM: suspend of devices complete after 134.399 msecs
[   21.921874] PM: late suspend of devices complete after 4.150 msecs
[   21.934753] PM: noirq suspend of devices complete after 6.256 msecs
[   21.941467] Disabling non-boot CPUs ...
[   24.639495] Powerdomain (iva2_pwrdm) didn't enter target state 1
[   24.645812] Powerdomain (dss_pwrdm) didn't enter target state 1
[   24.652008] Powerdomain (per_pwrdm) didn't enter target state 1
[   24.658233] Powerdomain (core_pwrdm) didn't enter target state 1
[   24.664550] Powerdomain (usbhost_pwrdm) didn't enter target state 1
[   24.671112] Could not enter target state in pm_suspend
[   24.679901] PM: noirq resume of devices complete after 3.173 msecs
[   24.691101] PM: early resume of devices complete after 2.716 msecs
[   25.086517] PM: resume of devices complete after 388.793 msecs
[   25.097564] Restarting tasks ... done.

There's also still the old bug that happens if I have USB ethernet
gadget as built-in:

# echo mem  /sys/power/state 
[   25.011657] PM: Syncing filesystems ... done.
[   25.026184] Freezing user space processes ... (elapsed 0.02 seconds) done.
[   25.055145] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) 
done.
[   25.086303] Suspending console(s) (use no_console_suspend to debug)
[   25.264953] PM: suspend of devices complete after 166.717 msecs
[   25.269348] PM: late suspend of devices complete after 4.394 msecs
[   25.275482] twl: i2c_read failed to transfer all messages
[   25.275543] twl: i2c_write failed to transfer all messages
[   25.275604] twl: i2c_write failed to transfer all messages
[   25.275634] [ cut here ]
[   25.275665] WARNING: at drivers/usb/otg/twl4030-usb.c:360 
__twl4030_phy_power+0x88/0x98()
[   25.275665] Modules linked in:
[   25.275726] [c001b8cc] (unwind_backtrace+0x0/0xf0) from [c004217c] 
(warn_slowpath_common+0x4c
/0x64)
[   25.275756] [c004217c] (warn_slowpath_common+0x4c/0x64) from [c00421b0] 
(warn_slowpath_null+0
x1c/0x24)
[   25.275787] [c00421b0] (warn_slowpath_null+0x1c/0x24) from [c03babe8] 
(__twl4030_phy_power+0x
88/0x98)
[   25.275787] [c03babe8] (__twl4030_phy_power+0x88/0x98) from [c03bac84] 
(twl4030_phy_power+0x8
c/0xf4)
[   25.275817] [c03bac84] (twl4030_phy_power+0x8c/0xf4) from [c03bad90] 
(twl4030_phy_suspend.clo
ne.7+0x18/0x44)
[   25.275848] [c03bad90] (twl4030_phy_suspend.clone.7+0x18/0x44) from 
[c03bae38] (twl4030_set_s
uspend+0x1c/0x24)
[   25.275878] [c03bae38] (twl4030_set_suspend+0x1c/0x24) from [c03d92ec] 
(omap2430_runtime_susp
end+0x4c/0x54)
[   25.275909] [c03d92ec] (omap2430_runtime_suspend+0x4c/0x54) from 
[c0328b10] (pm_generic_runti
me_suspend+0x2c/0x40)
[   25.275939] [c0328b10] (pm_generic_runtime_suspend+0x2c/0x40) from 
[c003dcd0] (_od_suspend_no
irq+0x34/0x68)
[   25.275939] [c003dcd0] (_od_suspend_noirq+0x34/0x68) from [c0329bf0] 
(dpm_run_callback.clone.
10+0x30/0xb4)
[   25.275970] [c0329bf0] (dpm_run_callback.clone.10+0x30/0xb4) from 
[c032a3c4] (dpm_suspend_end
+0x30c/0x514)
[   25.276000] [c032a3c4] (dpm_suspend_end+0x30c/0x514) from [c00830c0] 
(suspend_devices_and_ent
er+0xbc/0x2d0)
[   25.276031] [c00830c0] (suspend_devices_and_enter+0xbc/0x2d0) 

[PATCH V6 0/6] OMAPDSS: Cleanup cpu_is checks

2012-08-22 Thread Chandrabhanu Mahapatra
Hi everyone,
this patch series aims at cleaning up of DSS of cpu_is checks thereby making it
more generic.

The 1st patch cleans up cpu_is checks from DISPC code.
The 2nd patch removes unused functions from DSS code.
The 3rd patch cleans up cpu_is checks from DSS code.
The 4th patch disables VENC support on OMAP4.
The 5th patch removes cpu_is checks from VENC code.
The 6th patch removes cpu_is checks from DPI code and replaces it with a
dss feature.

Changes from V1 to V5 series:
 1st patch :
* moved dispc_ops structure definitions from dss_features.c to dispc.c
  and renamed it to dispc_features
* moved dispc_features definitions close to dispc_init_features() 
thereby
  eliminating various functions declarations from top of dispc.c
* used __initconst before dispc_features definitions and __init before
  dispc_init_features()
* removed definitions of _dispc_lcd_timings_ok_24xx,
  _dispc_lcd_timings_ok_44xx, _dispc_mgr_set_lcd_timings_hv_24xx and
  _dispc_mgr_set_lcd_timings_hv_44xx replacing them with appropiate 
variables
* renamed various dispc_features structures to give consistent naming

 3rd patch :
* moved dss_ops structure definitions from dss_features.c to dss.c and
  renamed it to dss_features
* removed all functions from dss_features structure and replaced them 
with
  appropiate variables
* used __initconst before dss_features definitions and __init before 
  dss_init_features()
* renamed various dss_features structures to give consistent naming
* renamed factor variable of dss_features structure to 
dss_fck_multiplier

Changes from V5 to V6 series:
* The ARM: OMAP: Disable venc for OMAP4 patch has been placed before
  OMAPDSS: VENC: Remove cpu_is_ checks patch
 1st patch:
* The dispc_init_features() implementation has been corrected
* The variables types of variables in dispc_features has been changed
  to u8 and u16 as found appropiate
 2nd patch:
* The dss_init_features() implementation has been corrected
* In dss_features struct char * has been changed to const char * and
  int replaced with u8

All your comments and suggestions are welcome.

Refenence Tree:
g...@gitorious.org:~chandrabhanu/linux-omap-dss2/chandrabhanus-linux.git 
dss_cleanup

Regards,
Chandrabhanu

Chandrabhanu Mahapatra (6):
  OMAPDSS: DISPC: Cleanup cpu_is_ checks
  OMAPDSS: DSS: Remove redundant functions
  OMAPDSS: DSS: Cleanup cpu_is_ checks
  ARM: OMAP: Disable venc for OMAP4
  OMAPDSS: VENC: Remove cpu_is_ checks
  OMAPDSS: DPI: Remove cpu_is_ checks

 arch/arm/mach-omap2/display.c  |1 -
 drivers/video/omap2/dss/dispc.c|  434 
 drivers/video/omap2/dss/dpi.c  |   12 +-
 drivers/video/omap2/dss/dss.c  |  165 ++--
 drivers/video/omap2/dss/dss.h  |2 -
 drivers/video/omap2/dss/dss_features.c |1 +
 drivers/video/omap2/dss/dss_features.h |1 +
 drivers/video/omap2/dss/venc.c |   11 -
 8 files changed, 367 insertions(+), 260 deletions(-)

-- 
1.7.10

--
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/6] OMAPDSS: DISPC: Cleanup cpu_is_xxxx checks

2012-08-22 Thread Chandrabhanu Mahapatra
All the cpu_is checks have been moved to dispc_init_features function providing
a much more generic and cleaner interface. The OMAP version and revision
specific functions and data are initialized by dispc_features structure which is
local to dispc.c.

Signed-off-by: Chandrabhanu Mahapatra cmahapa...@ti.com
---
 drivers/video/omap2/dss/dispc.c |  434 +--
 1 file changed, 279 insertions(+), 155 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index ff52702..0de9a7e 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -81,6 +81,23 @@ struct dispc_irq_stats {
unsigned irqs[32];
 };
 
+struct dispc_features {
+   u8 sw_start;
+   u8 fp_start;
+   u8 bp_start;
+   u16 sw_max;
+   u16 vp_max;
+   u16 hp_max;
+   int (*calc_scaling) (enum omap_channel channel,
+   const struct omap_video_timings *mgr_timings,
+   u16 width, u16 height, u16 out_width, u16 out_height,
+   enum omap_color_mode color_mode, bool *five_taps,
+   int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
+   u16 pos_x, unsigned long *core_clk);
+   unsigned long (*calc_core_clk) (enum omap_channel channel,
+   u16 width, u16 height, u16 out_width, u16 out_height);
+};
+
 static struct {
struct platform_device *pdev;
void __iomem*base;
@@ -101,6 +118,8 @@ static struct {
boolctx_valid;
u32 ctx[DISPC_SZ_REGS / sizeof(u32)];
 
+   const struct dispc_features *feat;
+
 #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
spinlock_t irq_stats_lock;
struct dispc_irq_stats irq_stats;
@@ -1939,7 +1958,18 @@ static unsigned long calc_core_clk_five_taps(enum 
omap_channel channel,
return core_clk;
 }
 
-static unsigned long calc_core_clk(enum omap_channel channel, u16 width,
+static unsigned long calc_core_clk_24xx(enum omap_channel channel, u16 width,
+   u16 height, u16 out_width, u16 out_height)
+{
+   unsigned long pclk = dispc_mgr_pclk_rate(channel);
+
+   if (height  out_height  width  out_width)
+   return pclk * 4;
+   else
+   return pclk * 2;
+}
+
+static unsigned long calc_core_clk_34xx(enum omap_channel channel, u16 width,
u16 height, u16 out_width, u16 out_height)
 {
unsigned int hf, vf;
@@ -1958,25 +1988,163 @@ static unsigned long calc_core_clk(enum omap_channel 
channel, u16 width,
hf = 2;
else
hf = 1;
-
if (height  out_height)
vf = 2;
else
vf = 1;
 
-   if (cpu_is_omap24xx()) {
-   if (vf  1  hf  1)
-   return pclk * 4;
-   else
-   return pclk * 2;
-   } else if (cpu_is_omap34xx()) {
-   return pclk * vf * hf;
-   } else {
-   if (hf  1)
-   return DIV_ROUND_UP(pclk, out_width) * width;
-   else
-   return pclk;
+   return pclk * vf * hf;
+}
+
+static unsigned long calc_core_clk_44xx(enum omap_channel channel, u16 width,
+   u16 height, u16 out_width, u16 out_height)
+{
+   unsigned long pclk = dispc_mgr_pclk_rate(channel);
+
+   if (width  out_width)
+   return DIV_ROUND_UP(pclk, out_width) * width;
+   else
+   return pclk;
+}
+
+static int dispc_ovl_calc_scaling_24xx(enum omap_channel channel,
+   const struct omap_video_timings *mgr_timings,
+   u16 width, u16 height, u16 out_width, u16 out_height,
+   enum omap_color_mode color_mode, bool *five_taps,
+   int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
+   u16 pos_x, unsigned long *core_clk)
+{
+   int error;
+   u16 in_width, in_height;
+   int min_factor = min(*decim_x, *decim_y);
+   const int maxsinglelinewidth =
+   dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
+   *five_taps = false;
+
+   do {
+   in_height = DIV_ROUND_UP(height, *decim_y);
+   in_width = DIV_ROUND_UP(width, *decim_x);
+   *core_clk = dispc.feat-calc_core_clk(channel, in_width,
+   in_height, out_width, out_height);
+   error = (in_width  maxsinglelinewidth || !*core_clk ||
+   *core_clk  dispc_core_clk_rate());
+   if (error) {
+   if (*decim_x == *decim_y) {
+   *decim_x = min_factor;
+   ++*decim_y;
+   } else {
+   swap(*decim_x, *decim_y);
+   if (*decim_x  *decim_y)
+   ++*decim_x;
+   }
+   }
+   

[PATCH V6 2/6] OMAPDSS: DSS: Remove redundant functions

2012-08-22 Thread Chandrabhanu Mahapatra
Functions dss_calc_clock_rates() and dss_get_clock_div() are removed as these
functions have become redundant and no longer used.

Signed-off-by: Chandrabhanu Mahapatra cmahapa...@ti.com
---
 drivers/video/omap2/dss/dss.c |   45 -
 drivers/video/omap2/dss/dss.h |2 --
 2 files changed, 47 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 92353be..e2e0fa4 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -431,31 +431,6 @@ enum omap_dss_clk_source dss_get_lcd_clk_source(enum 
omap_channel channel)
}
 }
 
-/* calculate clock rates using dividers in cinfo */
-int dss_calc_clock_rates(struct dss_clock_info *cinfo)
-{
-   if (dss.dpll4_m4_ck) {
-   unsigned long prate;
-   u16 fck_div_max = 16;
-
-   if (cpu_is_omap3630() || cpu_is_omap44xx())
-   fck_div_max = 32;
-
-   if (cinfo-fck_div  fck_div_max || cinfo-fck_div == 0)
-   return -EINVAL;
-
-   prate = clk_get_rate(clk_get_parent(dss.dpll4_m4_ck));
-
-   cinfo-fck = prate / cinfo-fck_div;
-   } else {
-   if (cinfo-fck_div != 0)
-   return -EINVAL;
-   cinfo-fck = clk_get_rate(dss.dss_clk);
-   }
-
-   return 0;
-}
-
 int dss_set_clock_div(struct dss_clock_info *cinfo)
 {
if (dss.dpll4_m4_ck) {
@@ -478,26 +453,6 @@ int dss_set_clock_div(struct dss_clock_info *cinfo)
return 0;
 }
 
-int dss_get_clock_div(struct dss_clock_info *cinfo)
-{
-   cinfo-fck = clk_get_rate(dss.dss_clk);
-
-   if (dss.dpll4_m4_ck) {
-   unsigned long prate;
-
-   prate = clk_get_rate(clk_get_parent(dss.dpll4_m4_ck));
-
-   if (cpu_is_omap3630() || cpu_is_omap44xx())
-   cinfo-fck_div = prate / (cinfo-fck);
-   else
-   cinfo-fck_div = prate / (cinfo-fck / 2);
-   } else {
-   cinfo-fck_div = 0;
-   }
-
-   return 0;
-}
-
 unsigned long dss_get_dpll4_rate(void)
 {
if (dss.dpll4_m4_ck)
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 41c00dc..d6cca82 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -296,9 +296,7 @@ void dss_set_venc_output(enum omap_dss_venc_type type);
 void dss_set_dac_pwrdn_bgz(bool enable);
 
 unsigned long dss_get_dpll4_rate(void);
-int dss_calc_clock_rates(struct dss_clock_info *cinfo);
 int dss_set_clock_div(struct dss_clock_info *cinfo);
-int dss_get_clock_div(struct dss_clock_info *cinfo);
 int dss_calc_clock_div(unsigned long req_pck, struct dss_clock_info *dss_cinfo,
struct dispc_clock_info *dispc_cinfo);
 
-- 
1.7.10

--
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 3/6] OMAPDSS: DSS: Cleanup cpu_is_xxxx checks

2012-08-22 Thread Chandrabhanu Mahapatra
All the cpu_is checks have been moved to dss_init_features function providing a
much more generic and cleaner interface. The OMAP version and revision specific
initializations in various functions are cleaned and the necessary data are
moved to dss_features structure which is local to dss.c.

Signed-off-by: Chandrabhanu Mahapatra cmahapa...@ti.com
---
 drivers/video/omap2/dss/dss.c |  120 +++--
 1 file changed, 79 insertions(+), 41 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index e2e0fa4..31a553a 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -31,6 +31,7 @@
 #include linux/clk.h
 #include linux/platform_device.h
 #include linux/pm_runtime.h
+#include linux/gfp.h
 
 #include video/omapdss.h
 
@@ -65,6 +66,12 @@ struct dss_reg {
 static int dss_runtime_get(void);
 static void dss_runtime_put(void);
 
+struct dss_features {
+   u8 fck_div_max;
+   u8 dss_fck_multiplier;
+   const char *clk_name;
+};
+
 static struct {
struct platform_device *pdev;
void __iomem*base;
@@ -83,6 +90,8 @@ static struct {
 
boolctx_valid;
u32 ctx[DSS_SZ_REGS / sizeof(u32)];
+
+   const struct dss_features *feat;
 } dss;
 
 static const char * const dss_generic_clk_source_names[] = {
@@ -91,6 +100,30 @@ static const char * const dss_generic_clk_source_names[] = {
[OMAP_DSS_CLK_SRC_FCK]  = DSS_FCK,
 };
 
+static const struct dss_features omap24xx_dss_feats __initconst = {
+   .fck_div_max=   16,
+   .dss_fck_multiplier =   2,
+   .clk_name   =   NULL,
+};
+
+static const struct dss_features omap34xx_dss_feats __initconst = {
+   .fck_div_max=   16,
+   .dss_fck_multiplier =   2,
+   .clk_name   =   dpll4_m4_ck,
+};
+
+static const struct dss_features omap3630_dss_feats __initconst = {
+   .fck_div_max=   32,
+   .dss_fck_multiplier =   1,
+   .clk_name   =   dpll4_m4_ck,
+};
+
+static const struct dss_features omap44xx_dss_feats __initconst = {
+   .fck_div_max=   32,
+   .dss_fck_multiplier =   1,
+   .clk_name   =   dpll_per_m5x2_ck,
+};
+
 static inline void dss_write_reg(const struct dss_reg idx, u32 val)
 {
__raw_writel(val, dss.base + idx.idx);
@@ -236,7 +269,6 @@ const char *dss_get_generic_clk_source_name(enum 
omap_dss_clk_source clk_src)
return dss_generic_clk_source_names[clk_src];
 }
 
-
 void dss_dump_clocks(struct seq_file *s)
 {
unsigned long dpll4_ck_rate;
@@ -259,18 +291,10 @@ void dss_dump_clocks(struct seq_file *s)
 
seq_printf(s, dpll4_ck %lu\n, dpll4_ck_rate);
 
-   if (cpu_is_omap3630() || cpu_is_omap44xx())
-   seq_printf(s, %s (%s) = %lu / %lu  = %lu\n,
-   fclk_name, fclk_real_name,
-   dpll4_ck_rate,
-   dpll4_ck_rate / dpll4_m4_ck_rate,
-   fclk_rate);
-   else
-   seq_printf(s, %s (%s) = %lu / %lu * 2 = %lu\n,
-   fclk_name, fclk_real_name,
-   dpll4_ck_rate,
-   dpll4_ck_rate / dpll4_m4_ck_rate,
-   fclk_rate);
+   seq_printf(s, %s (%s) = %lu / %lu * %d  = %lu\n,
+   fclk_name, fclk_real_name, dpll4_ck_rate,
+   dpll4_ck_rate / dpll4_m4_ck_rate,
+   dss.feat-dss_fck_multiplier, fclk_rate);
} else {
seq_printf(s, %s (%s) = %lu\n,
fclk_name, fclk_real_name,
@@ -470,7 +494,7 @@ int dss_calc_clock_div(unsigned long req_pck, struct 
dss_clock_info *dss_cinfo,
 
unsigned long fck, max_dss_fck;
 
-   u16 fck_div, fck_div_max = 16;
+   u16 fck_div;
 
int match = 0;
int min_fck_per_pck;
@@ -480,9 +504,8 @@ int dss_calc_clock_div(unsigned long req_pck, struct 
dss_clock_info *dss_cinfo,
max_dss_fck = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
 
fck = clk_get_rate(dss.dss_clk);
-   if (req_pck == dss.cache_req_pck 
-   ((cpu_is_omap34xx()  prate == dss.cache_prate) ||
-dss.cache_dss_cinfo.fck == fck)) {
+   if (req_pck == dss.cache_req_pck  prate == dss.cache_prate 
+   dss.cache_dss_cinfo.fck == fck) {
DSSDBG(dispc clock info found from cache.\n);
*dss_cinfo = dss.cache_dss_cinfo;
*dispc_cinfo = dss.cache_dispc_cinfo;
@@ -519,16 +542,10 @@ retry:
 
goto found;
} else {
- 

[PATCH V6 5/6] OMAPDSS: VENC: Remove cpu_is_xxxx checks

2012-08-22 Thread Chandrabhanu Mahapatra
OMAP4 checks are removed from VENC to provide it a cleaner interface. These
checks were introduced by patches HACK: OMAP: DSS2: VENC: disable VENC on OMAP4
to prevent crash (ba02fa37de) by Tomi Valkeinen tomi.valkei...@ti.com and
OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on
OMAP4 (cc1d3e032d)  by Danny Kukawka danny.kuka...@bisect.de to prevent VENC
from crashing OMAP4 kernel.

Signed-off-by: Chandrabhanu Mahapatra cmahapa...@ti.com
---
 drivers/video/omap2/dss/venc.c |   11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 7d3eef8..4a6caf9 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -674,11 +674,6 @@ static void venc_dump_regs(struct seq_file *s)
 {
 #define DUMPREG(r) seq_printf(s, %-35s %08x\n, #r, venc_read_reg(r))
 
-   if (cpu_is_omap44xx()) {
-   seq_printf(s, VENC currently disabled on OMAP44xx\n);
-   return;
-   }
-
if (venc_runtime_get())
return;
 
@@ -893,16 +888,10 @@ static struct platform_driver omap_venchw_driver = {
 
 int __init venc_init_platform_driver(void)
 {
-   if (cpu_is_omap44xx())
-   return 0;
-
return platform_driver_probe(omap_venchw_driver, omap_venchw_probe);
 }
 
 void __exit venc_uninit_platform_driver(void)
 {
-   if (cpu_is_omap44xx())
-   return;
-
platform_driver_unregister(omap_venchw_driver);
 }
-- 
1.7.10

--
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 4/6] ARM: OMAP: Disable venc for OMAP4

2012-08-22 Thread Chandrabhanu Mahapatra
This is a alternative to HACK: OMAP: DSS2: VENC: disable VENC on OMAP4 to
prevent crash (ba02fa37de) by Tomi Valkeinen tomi.valkei...@ti.com to prevent
VENC from crashing OMAP4 kernel. This prevents OMAPDSS from initial registration
of a device for VENC on OMAP4.

Signed-off-by: Chandrabhanu Mahapatra cmahapa...@ti.com
---
 arch/arm/mach-omap2/display.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index af1ed7d..ee40739 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -95,7 +95,6 @@ static const struct omap_dss_hwmod_data 
omap4_dss_hwmod_data[] __initdata = {
{ dss_core, omapdss_dss, -1 },
{ dss_dispc, omapdss_dispc, -1 },
{ dss_rfbi, omapdss_rfbi, -1 },
-   { dss_venc, omapdss_venc, -1 },
{ dss_dsi1, omapdss_dsi, 0 },
{ dss_dsi2, omapdss_dsi, 1 },
{ dss_hdmi, omapdss_hdmi, -1 },
-- 
1.7.10

--
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 6/6] OMAPDSS: DPI: Remove cpu_is_xxxx checks

2012-08-22 Thread Chandrabhanu Mahapatra
The OMAP3 checks have been removed and replaced by a dss feature
FEAT_DPI_USES_VDDS_DSI for cleaner implementation. The patches
OMAP: DSS2: enable VDDS_DSI when using DPI (8a2cfea8cc) by Tomi Valkeinen
tomi.valkei...@nokia.com and ARM: omap: fix oops in
drivers/video/omap2/dss/dpi.c (4041071571) by Russell King
rmk+ker...@arm.linux.org.uk had introduced these checks. As it is evident
from these patches a dependency exists for some DSS pins on VDDS_DSI which is
better shown by dss feature FEAT_DPI_USES_VDDS_DSI.

Signed-off-by: Chandrabhanu Mahapatra cmahapa...@ti.com
---
 drivers/video/omap2/dss/dpi.c  |   12 +++-
 drivers/video/omap2/dss/dss_features.c |1 +
 drivers/video/omap2/dss/dss_features.h |1 +
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index f260343..25fb895 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -34,6 +34,7 @@
 #include plat/cpu.h
 
 #include dss.h
+#include dss_features.h
 
 static struct {
struct regulator *vdds_dsi_reg;
@@ -175,7 +176,7 @@ int omapdss_dpi_display_enable(struct omap_dss_device 
*dssdev)
 
mutex_lock(dpi.lock);
 
-   if (cpu_is_omap34xx()  !dpi.vdds_dsi_reg) {
+   if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)  !dpi.vdds_dsi_reg) {
DSSERR(no VDSS_DSI regulator\n);
r = -ENODEV;
goto err_no_reg;
@@ -193,7 +194,7 @@ int omapdss_dpi_display_enable(struct omap_dss_device 
*dssdev)
goto err_start_dev;
}
 
-   if (cpu_is_omap34xx()) {
+   if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) {
r = regulator_enable(dpi.vdds_dsi_reg);
if (r)
goto err_reg_enable;
@@ -239,7 +240,7 @@ err_dsi_pll_init:
 err_get_dsi:
dispc_runtime_put();
 err_get_dispc:
-   if (cpu_is_omap34xx())
+   if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI))
regulator_disable(dpi.vdds_dsi_reg);
 err_reg_enable:
omap_dss_stop_device(dssdev);
@@ -265,7 +266,7 @@ void omapdss_dpi_display_disable(struct omap_dss_device 
*dssdev)
 
dispc_runtime_put();
 
-   if (cpu_is_omap34xx())
+   if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI))
regulator_disable(dpi.vdds_dsi_reg);
 
omap_dss_stop_device(dssdev);
@@ -362,7 +363,8 @@ static int __init dpi_init_display(struct omap_dss_device 
*dssdev)
 {
DSSDBG(init_display\n);
 
-   if (cpu_is_omap34xx()  dpi.vdds_dsi_reg == NULL) {
+   if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI) 
+   dpi.vdds_dsi_reg == NULL) {
struct regulator *vdds_dsi;
 
vdds_dsi = dss_get_vdds_dsi();
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index 9387097..2fe39d6 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -373,6 +373,7 @@ static const enum dss_feat_id omap3430_dss_feat_list[] = {
FEAT_ALPHA_FIXED_ZORDER,
FEAT_FIFO_MERGE,
FEAT_OMAP3_DSI_FIFO_BUG,
+   FEAT_DPI_USES_VDDS_DSI,
 };
 
 static const enum dss_feat_id omap3630_dss_feat_list[] = {
diff --git a/drivers/video/omap2/dss/dss_features.h 
b/drivers/video/omap2/dss/dss_features.h
index 996ffcb..26d43a4 100644
--- a/drivers/video/omap2/dss/dss_features.h
+++ b/drivers/video/omap2/dss/dss_features.h
@@ -50,6 +50,7 @@ enum dss_feat_id {
FEAT_DSI_VC_OCP_WIDTH,
FEAT_DSI_REVERSE_TXCLKESC,
FEAT_DSI_GNQ,
+   FEAT_DPI_USES_VDDS_DSI,
FEAT_HDMI_CTS_SWMODE,
FEAT_HDMI_AUDIO_USE_MCLK,
FEAT_HANDLE_UV_SEPARATE,
-- 
1.7.10

--
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: [alsa-devel] [RFC] ASoC: snd_soc_jack for HDMI audio: does it make sense?

2012-08-22 Thread Takashi Iwai
At Tue, 21 Aug 2012 19:58:02 -0500,
Ricardo Neri wrote:
 
 
 
 On 08/21/2012 07:39 AM, Clark, Rob wrote:
  On Tue, Aug 21, 2012 at 1:01 AM, Tomi Valkeinen tomi.valkei...@ti.com 
  wrote:
  On Mon, 2012-08-20 at 20:47 -0500, Ricardo Neri wrote:
  Hello!
 
  I have been working on prototypes for the ASoC OMAP HDMI audio driver to
  propagate events from the HDMI output (e.g., display getting
  enabled/disabled/suspended). This for the users of the driver to react
  to such events. For instance, if the display is disabled or disconected,
  audio could be stopped, rerouted or whatever other decision the user
  makes. This is needed because, if, for instance, the  HDMI IP goes off,
  audio will stall and the audio users will only see a playback write
  error (DMA or IRQ trouble?)
 
  In my prototypes I have used snd_soc_jack for this purpose and I have
  some questions:
 
  *I see snd_soc_jack is used mostly for headsets and microphones with
  actual external mechanical connections. Strictly, in my case I propagate
  events originated by the OMAP display driver (changes in the power
  state), and not from external events. Some of these events are generated
  from an actual HDMI cable connection/disconnection, though.
 
  *Maybe the event should be propagated by omapdss/omapdrm/drm and the
  entity in charge of the audio policy should listen those events instead.
 
  *I do see SND_JACK_VIDEOOUT and SND_JACK_AVOUT types so maybe it is
  feasible for an audio driver to report events from an AV output.
 
  I was wondering about how much sense does it make to you guys use a
  snd_soc_jack in this case?
 
  How does DRM handle audio? I made a quick grep, but I see the drm
  drivers only enabling the audio in the HW, nothing else.
 
  I confess to not knowing too much about audio/alsa, but what does
  audio driver need from hdmi?  Just hotplug events?
 
 At least for the case of the ASoC HDMI audio driver (but hopefully for 
 other audio drivers as well), it needs to detect whether an HDMI output 
 is available, if the display's current configuration supports audio 
 (e.g., a 1080p display configured as VGA should be reported as not 
 supporting audio). It also needs interfaces to 
 configure/prepare/start/stop audio. Also, of course, needs to know if 
 the display is off/on/suspended and when transitions occur. For OMAP, 
 omapdss provide an interface for this functionality for ALSA or any 
 other interested user.
 
   From a quick look, it seems most of what the existing drm drivers are
  doing is detecting if the display supports audio, and then turning
  on/off the hw.. (and some infoframe stuff in some cases).
 
 Yes, it seems to me that every driver makes its own audio 
 implementation, mainly focused on configuration. I could not find any 
 audio common interface so that users like ALSA can take advantage of.
 
 Also, I could not see any ALSA driver using functionality provided by a 
 drm driver.
 
 Maybe the lack of audio support in drm is because the audio users should 
 not talk to drm directly but to a lower level component (omapdrm, 
 omapdss?). However, today there exists video technology supports audio 
 as well, such as DisplayPort or HDMI. Could it make more sense now to 
 provide audio support?

The reason is that the audio and video handling are already separated
in the hardware level, at least, for desktop graphics.

The audio infoframe is passed via ELD to the audio controller part
upon plug/unplugging via HD-audio unsolicited event, and the audio
driver sets up the stuff according to the given ELD.  Thus no extra
interface between drm and ALSA was required in the kernel API level,
so far.


Takashi
--
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


[RESEND PATCH v4 2/2] arm/dts: omap4: Add ocp2scp data

2012-08-22 Thread Kishon Vijay Abraham I
Add ocp2scp data node in omap4 device tree file.

Acked-by: Felipe Balbi ba...@ti.com
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/boot/dts/omap4.dtsi |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 04cbbcb..8a780b2 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -295,5 +295,13 @@
interrupt-parent = gic;
ti,hwmods = dmic;
};
+
+   ocp2scp {
+   compatible = ti,omap-ocp2scp;
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+   ti,hwmods = ocp2scp_usb_phy;
+   };
};
 };
-- 
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


[RESEND PATCH v4 0/2] omap: add ocp2scp as a bus driver

2012-08-22 Thread Kishon Vijay Abraham I
This patch series has been lying here for long. If no one has any
comments on this patch series, can someone pick it up?

This patch series is done as a preparatory step for adding phy drivers
for dwc3 and musb.

This series adds a new driver for ocp2scp (only dt) to which phy
drivers are connected.

Since currently there is no generic way to create a child device along
with doing a pm_runtime_enable (the exact requirement for ocp2scp), I'm
creating a separate driver for ocp2scp.

Changes from v3:
No functional changes. Fixed few comments on filling *module* details.

Changes from v2:
Fixed Felipe's comments to avoid using arch_initcall and make dependent
drivers return -EPROBE_DEFER case this isn't ready yet.

Changes from v1:
Fixed Sergei's comments to remove the address in the node name of ocp2scp
since the ocp2scp node doesn't have a reg property.

Changes from [RFC PATCH v2 0/2] omap: add ocp2scp as a misc driver:
Created a new folder drivers/bus and moved ocp2scp driver from misc to
drivers/bus.

This patch was developed and tested on
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git

Kishon Vijay Abraham I (2):
  drivers: bus: add a new driver for omap-ocp2scp
  arm/dts: omap4: Add ocp2scp data

 .../devicetree/bindings/bus/omap-ocp2scp.txt   |   10 +++
 arch/arm/boot/dts/omap4.dtsi   |8 ++
 drivers/Kconfig|2 +
 drivers/Makefile   |2 +
 drivers/bus/Kconfig|   15 
 drivers/bus/Makefile   |5 ++
 drivers/bus/omap-ocp2scp.c |   88 
 7 files changed, 130 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
 create mode 100644 drivers/bus/Kconfig
 create mode 100644 drivers/bus/Makefile
 create mode 100644 drivers/bus/omap-ocp2scp.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


[RESEND PATCH v4 1/2] drivers: bus: add a new driver for omap-ocp2scp

2012-08-22 Thread Kishon Vijay Abraham I
Adds a new driver *omap-ocp2scp*. This driver takes the responsibility of
creating all the devices that is connected to OCP2SCP. In the case of OMAP4,
USB2PHY is connected to ocp2scp.

This also includes device tree support for ocp2scp driver and
the documentation with device tree binding information is updated.

Acked-by: Felipe Balbi ba...@ti.com
Acked-by: Arnd Bergmann a...@arndb.de
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 .../devicetree/bindings/bus/omap-ocp2scp.txt   |   10 +++
 drivers/Kconfig|2 +
 drivers/Makefile   |2 +
 drivers/bus/Kconfig|   15 
 drivers/bus/Makefile   |5 ++
 drivers/bus/omap-ocp2scp.c |   88 
 6 files changed, 122 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
 create mode 100644 drivers/bus/Kconfig
 create mode 100644 drivers/bus/Makefile
 create mode 100644 drivers/bus/omap-ocp2scp.c

diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt 
b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
new file mode 100644
index 000..d2fe064
--- /dev/null
+++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
@@ -0,0 +1,10 @@
+* OMAP OCP2SCP - ocp interface to scp interface
+
+properties:
+- compatible : Should be ti,omap-ocp2scp
+- #address-cells, #size-cells : Must be present if the device has sub-nodes
+- ranges : the child address space are mapped 1:1 onto the parent address space
+- ti,hwmods : must be ocp2scp_usb_phy
+
+Sub-nodes:
+All the devices connected to ocp2scp are described using sub-node to ocp2scp
diff --git a/drivers/Kconfig b/drivers/Kconfig
index ece958d..324e958 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -2,6 +2,8 @@ menu Device Drivers
 
 source drivers/base/Kconfig
 
+source drivers/bus/Kconfig
+
 source drivers/connector/Kconfig
 
 source drivers/mtd/Kconfig
diff --git a/drivers/Makefile b/drivers/Makefile
index 5b42184..f8cdeeb 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -5,6 +5,8 @@
 # Rewritten to use lists instead of if-statements.
 #
 
+obj-y  += bus/
+
 # GPIO must come after pinctrl as gpios may need to mux pins etc
 obj-y  += pinctrl/
 obj-y  += gpio/
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
new file mode 100644
index 000..6270415
--- /dev/null
+++ b/drivers/bus/Kconfig
@@ -0,0 +1,15 @@
+#
+# Bus Devices
+#
+
+menu Bus devices
+
+config OMAP_OCP2SCP
+   tristate OMAP OCP2SCP DRIVER
+   help
+ Driver to enable ocp2scp module which transforms ocp interface
+ protocol to scp protocol. In OMAP4, USB PHY is connected via
+ OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via
+ OCP2SCP.
+
+endmenu
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
new file mode 100644
index 000..0ec50bc
--- /dev/null
+++ b/drivers/bus/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for the bus drivers.
+#
+
+obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o
diff --git a/drivers/bus/omap-ocp2scp.c b/drivers/bus/omap-ocp2scp.c
new file mode 100644
index 000..881d5bb
--- /dev/null
+++ b/drivers/bus/omap-ocp2scp.c
@@ -0,0 +1,88 @@
+/*
+ * omap-ocp2scp.c - transform ocp interface protocol to scp protocol
+ *
+ * Copyright (C) 2012 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 as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Author: Kishon Vijay Abraham I kis...@ti.com
+ *
+ * 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.
+ *
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/err.h
+#include linux/pm_runtime.h
+#include linux/of.h
+#include linux/of_platform.h
+
+static int ocp2scp_remove_devices(struct device *dev, void *c)
+{
+   struct platform_device *pdev = to_platform_device(dev);
+
+   platform_device_unregister(pdev);
+
+   return 0;
+}
+
+static int __devinit omap_ocp2scp_probe(struct platform_device *pdev)
+{
+   int ret;
+   struct device_node  *np = pdev-dev.of_node;
+
+   if (np) {
+   ret = of_platform_populate(np, NULL, NULL, pdev-dev);
+   if (ret) {
+   dev_err(pdev-dev, failed to add resources for 
ocp2scp child\n);
+   goto err0;
+   }
+   }
+   pm_runtime_enable(pdev-dev);
+
+   return 0;
+
+err0:
+   device_for_each_child(pdev-dev, NULL, 

Re: [PATCH V6 0/6] OMAPDSS: Cleanup cpu_is checks

2012-08-22 Thread Tomi Valkeinen
On Wed, 2012-08-22 at 12:06 +0530, Chandrabhanu Mahapatra wrote:
 Hi everyone,
 this patch series aims at cleaning up of DSS of cpu_is checks thereby making 
 it
 more generic.
 
 The 1st patch cleans up cpu_is checks from DISPC code.
 The 2nd patch removes unused functions from DSS code.
 The 3rd patch cleans up cpu_is checks from DSS code.
 The 4th patch disables VENC support on OMAP4.
 The 5th patch removes cpu_is checks from VENC code.
 The 6th patch removes cpu_is checks from DPI code and replaces it with a
 dss feature.

Thanks, looks good. I'll apply this to omapdss tree.

 Tomi



signature.asc
Description: This is a digitally signed message part


Re: [PATCH v2] mfd/regulator: tps65217: Move regulator plat data handling to regulator

2012-08-22 Thread Samuel Ortiz
Hi AnilKumar,

On Mon, Aug 13, 2012 at 08:36:05PM +0530, AnilKumar Ch wrote:
 Regulator platform data handling was mistakenly added to MFD
 driver. So we will see build errors if we compile MFD drivers
 without CONFIG_REGULATOR. This patch moves regulator platform
 data handling from TPS65217 MFD driver to regulator driver.
 
 This makes MFD driver independent of REGULATOR framework so
 build error is fixed if CONFIG_REGULATOR is not set.
 
 drivers/built-in.o: In function `tps65217_probe':
 tps65217.c:(.devinit.text+0x13e37): undefined reference
 to `of_regulator_match'
 
 This patch also fix allocation size of tps65217 platform data.
 Current implementation allocates a struct tps65217_board for each
 regulator specified in the device tree. But the structure itself
 provides array of regulators so one instance of it is sufficient.
 
 Signed-off-by: AnilKumar Ch anilku...@ti.com
 ---
 This patch is tested on BeagleBone with regulator device node
 additions. And this is based on mfd/master.
 
 Changes from v1:
   - Incorporated Matthias Kaehlcke's commets on v1
 * Fixed allocation size of tps65217 platform data
 
  drivers/mfd/tps65217.c |  130 
 +++-
  drivers/regulator/tps65217-regulator.c |  124 ++
  include/linux/mfd/tps65217.h   |   12 ++-
  3 files changed, 161 insertions(+), 105 deletions(-)
 
Applied to my for-next and for-linus branches, thanks.
Btw, this is too big of a patch for stable.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.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: [PATCH 09/10] mmc: omap_hsmmc: convert from IP timer to hrtimer

2012-08-22 Thread S, Venkatraman
On Tue, Aug 21, 2012 at 4:12 PM, Felipe Balbi ba...@ti.com wrote:
 On Sat, Aug 18, 2012 at 12:22:29AM +0530, Venkatraman S wrote:
 omap hsmmc controller IP has an inbuilt timer that can be programmed to
   ^^^
   built-in
 guard against unresponsive operations. But it's range is very narrow,
  
  its


 and it's maximum countable time is a few seconds.
   
   its


Will fix.


 Card maintenance operations like BKOPS and SECURE DISCARD and long
 stream writes like packed command require timers of order of
 several minutes.
 So get rid of using the IP timer entirely and use kernel's hrtimer
 functionality for guarding the device operations.
 As part of this change, a workaround that disabled timeouts for
 MMC_ERASE commands is removed, and the arbitary timing of 100ms
 is used only when the timeout is not explicitly specified by core.

 Signed-off-by: Venkatraman S svenk...@ti.com
 ---
  drivers/mmc/host/omap_hsmmc.c | 96 
 ++-
  1 file changed, 50 insertions(+), 46 deletions(-)

 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index 9afdd20..8f7cebc 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -79,7 +79,7 @@
  #define CLKD_SHIFT   6
  #define DTO_MASK 0x000F
  #define DTO_SHIFT16
 -#define INT_EN_MASK  0x307F0033
 +#define INT_EN_MASK  0x306E0033

 not related to this patch in particular, but it would be nice if this
 was converted to something more meaningfull, like ORing a bunch of bit
 defines.


Sure. Good to do now as part of the change.

  #define BWR_ENABLE   (1  4)
  #define BRR_ENABLE   (1  5)
  #define DTO_ENABLE   (1  20)
 @@ -160,6 +160,7 @@ struct omap_hsmmc_host {
   unsigned intdma_sg_idx;
   unsigned char   bus_mode;
   unsigned char   power_mode;
 + unsigned intns_per_clk_cycle;
   int suspended;
   int irq;
   int use_dma, dma_ch;
 @@ -172,6 +173,7 @@ struct omap_hsmmc_host {
   int reqs_blocked;
   int use_reg;
   int req_in_progress;
 + struct hrtimer  guard_timer;
   struct omap_hsmmc_next  next_data;

   struct  omap_mmc_platform_data  *pdata;
 @@ -455,10 +457,6 @@ static void omap_hsmmc_enable_irq(struct 
 omap_hsmmc_host *host,
   else
   irq_mask = INT_EN_MASK;

 - /* Disable timeout for erases */
 - if (cmd-opcode == MMC_ERASE)
 - irq_mask = ~DTO_ENABLE;
 -
   OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
   OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
   OMAP_HSMMC_WRITE(host-base, IE, irq_mask);
 @@ -508,6 +506,9 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
 *host)
time_before(jiffies, timeout))
   cpu_relax();

 + if (ios-clock)
 + host-ns_per_clk_cycle = DIV_ROUND_UP(NSEC_PER_SEC, 
 ios-clock);
 +
   omap_hsmmc_start_clock(host);
  }

 @@ -824,7 +825,7 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, 
 struct mmc_data *data)
   omap_hsmmc_request_done(host, mrq);
   return;
   }
 -
 + hrtimer_cancel(host-guard_timer);
   host-data = NULL;

   if (!data-error)
 @@ -859,8 +860,11 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, 
 struct mmc_command *cmd)
   cmd-resp[0] = OMAP_HSMMC_READ(host-base, RSP10);
   }
   }
 - if ((host-data == NULL  !host-response_busy) || cmd-error)
 + if ((host-data == NULL  !host-response_busy) || cmd-error) {

 could just go ahead and make this check uniform by:

 if ((!host-data  !host-response_busy)) || cmd-error)


Ok.

 + if (cmd-error != -ETIMEDOUT)
 + hrtimer_cancel(host-guard_timer);
   omap_hsmmc_request_done(host, cmd-mrq);
 + }
  }

  /*
 @@ -992,7 +996,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
 *host, int status)
   hsmmc_command_incomplete(host, -EILSEQ);

   end_cmd = 1;
 - if (host-data || host-response_busy) {
 + if (data || host-response_busy) {

 This doesn't seem like it belongs to $SUBJECT...

I thought is was a small fix which didn't warrant a separate patch though.

   end_trans = 1;
   host-response_busy = 0;
   }
 @@ -1292,41 +1296,35 @@ static int omap_hsmmc_start_dma_transfer(struct 
 omap_hsmmc_host *host,
   return 0;
  }

 -static void set_data_timeout(struct omap_hsmmc_host *host,
 -  unsigned int timeout_ns,
 -  unsigned int timeout_clks)
 

Re: [PATCH 09/10] mmc: omap_hsmmc: convert from IP timer to hrtimer

2012-08-22 Thread Felipe Balbi
Hi,

On Wed, Aug 22, 2012 at 04:08:17PM +0530, S, Venkatraman wrote:
  @@ -992,7 +996,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
  *host, int status)
hsmmc_command_incomplete(host, -EILSEQ);
 
end_cmd = 1;
  - if (host-data || host-response_busy) {
  + if (data || host-response_busy) {
 
  This doesn't seem like it belongs to $SUBJECT...
 
 I thought is was a small fix which didn't warrant a separate patch though.

sure, that's fair. But it does deserve a mention on commit log too.
Something along the lines of while at that, also use a 'data' variable
which was already defined instead of dereferencing host again.

-- 
balbi


signature.asc
Description: Digital signature


Re: [RESEND PATCH v4 0/2] omap: add ocp2scp as a bus driver

2012-08-22 Thread Arnd Bergmann
On Wednesday 22 August 2012, Kishon Vijay Abraham I wrote:
 This patch series has been lying here for long. If no one has any
 comments on this patch series, can someone pick it up?

I've added them now as a drivers/ocp2scp branch arm-soc and pulled
them into the next/drivers topic branch.

Arnd
--
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: [RESEND PATCH v4 0/2] omap: add ocp2scp as a bus driver

2012-08-22 Thread ABRAHAM, KISHON VIJAY
On Wed, Aug 22, 2012 at 6:04 PM, Arnd Bergmann a...@arndb.de wrote:
 On Wednesday 22 August 2012, Kishon Vijay Abraham I wrote:
 This patch series has been lying here for long. If no one has any
 comments on this patch series, can someone pick it up?

 I've added them now as a drivers/ocp2scp branch arm-soc and pulled
 them into the next/drivers topic branch.

Thanks Arnd :-)

-Kishon
--
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: debug needed: twl4030 RTC wakeups: repeated attempts fail on Beagle

2012-08-22 Thread Datta, Shubhrajyoti
On Sat, Aug 11, 2012 at 12:19 AM, Kevin Hilman khil...@ti.com wrote:
 Hello,

 In doing some automated testing of suspend/resume I noticed that
 repeated attempts to suspend and resume via RTC wakeup fail on
 3530/Beagle and 3730/Beagle-xM, but work fine on 3430/n900, 3530/Overo,
 3730/OveroSTORM and 4430/Panda.

 When RTC wakeup fails, a UART wakeup will work, and in the logs, you'll
 see this:

 [  316.036132] twl: i2c_read failed to transfer all messages
 [  316.036163] twl4030: I2C error -13 reading PIH ISR

The  error value is is propagated from the i2c get_sync failure.


 My guess about what might be happening is that very late in the suspend
 process (during the noirq hooks), a PMIC interrupt fires, but by this
 time the I2C driver is runtime suspended (and clock gated.)  Since
 runtime PM is disabled at this point, I2C reads fail, so the twl4030 IRQ
 driver cannot talk over I2C to the PMIC to determine the interrupt
 source.

Agreed.


 The real mystery is why this happens on Beagle and Beagle-xM, but none
 of the other OMAP3 boards (at least the ones I have.)

Looks like some  race/ timing issue.
However I am not sure what is a good way to synchronise the i2c
requests from a client from an isr and
the device disable / runtime resumed.

However on merging the clean up series

http://www.mail-archive.com/linux-omap@vger.kernel.org/msg73870.html

Didn't see the above mentioned issue.

but there were some error's like timeout.

This may be because the controller was not fully enabled.

SYSC in case of I2C not only reflects the reset status from sysc
reset( register is reset)
but also controller enable ( controller reset ).

On checking the reset after controller didnt see the time out issue.

patch below.



diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 9aefd36..b35afa4 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1254,6 +1254,7 @@ static int omap_i2c_runtime_resume(struct device *dev)
 {
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
+   unsigned long timeout = 1;

if (_dev-flags  OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, 0);
@@ -1266,6 +1267,15 @@ static int omap_i2c_runtime_resume(struct device *dev)
omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
}

+   while (!(omap_i2c_read_reg(_dev, OMAP_I2C_SYSS_REG) 
+   SYSS_RESETDONE_MASK)) {
+   if (time_after(jiffies, timeout)) {
+   dev_warn(dev, timeout waiting for controller reset\n);
+   return -ETIMEDOUT;
+   }
+   msleep(1);
+   }
+
/*
 * Don't write to this register if the IE state is 0 as it can
 * cause deadlock.


 Reproducing is easy.  Simply run rtcwake in a loop:

   # while true; do rtcwake -m mem -s 1; done

 In my tests, this happens using omap2plus_defconfig (+ initramfs) on
 v3.6-rc1, v3.5, v3.4, v3.3 but seems to work fine on v3.2.

 I'm going on vacation for a few weeks, so any help debugging this would
 be greatly appreciated.

 Thanks,

 Kevin
 --
 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
--
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: [alsa-devel] [RFC] ASoC: snd_soc_jack for HDMI audio: does it make sense?

2012-08-22 Thread Mark Brown
On Tue, Aug 21, 2012 at 08:24:45PM -0500, Ricardo Neri wrote:

 So, it seems that the way to go is extcon. I guess that ALSA will
 use extcon just like today snd_jack uses the input driver. is this
 correct? Is there any chance that ctrljack will propagate the events
 through extcon? Is there any early implementation that I could look
 at? I am asking to know how feasible is to use ctljack today and be
 compatible with extcon in the future.

The ctljack API doesn't really map onto the other jack APIs at the
minute since the in kernel representation is that it exposes the
booleans directly to the callers rather than grouping them together into
the overall jack.


signature.asc
Description: Digital signature


Re: [PATCHv2 0/3] spi: omap2-mcspi: spi cleanups

2012-08-22 Thread Mark Brown
On Wed, Aug 22, 2012 at 11:35:11AM +0530, Shubhrajyoti D wrote:
 This patch does the following
 
 Calls the pm_runtime_* functions directly.
 Remove the MOD_REG_BIT macro usage thereby removiing un-needed branch.
 At remove dont use the autosuspend runtime calls.

Applied all, thanks.

 The following changes since commit 23dcfa61bac244e1200ff9ad19c6e9144dcb6bb5:
 
   Merge branch 'akpm' (Andrew's patch-bomb) (2012-08-21 17:22:22 -0700)

When sending pull requests please always base them off a tag of some
kind, normally one of Linus' is a good option if you've no special
needs.  This one looks like it's based off -next so can't be pulled into
any other tree, -next is rebased daily.


signature.asc
Description: Digital signature


Re: [PATCHv2 0/3] spi: omap2-mcspi: spi cleanups

2012-08-22 Thread Shubhrajyoti Datta
On Wed, Aug 22, 2012 at 10:29 PM, Mark Brown
broo...@opensource.wolfsonmicro.com wrote:
 On Wed, Aug 22, 2012 at 11:35:11AM +0530, Shubhrajyoti D wrote:
 This patch does the following

 Calls the pm_runtime_* functions directly.
 Remove the MOD_REG_BIT macro usage thereby removiing un-needed branch.
 At remove dont use the autosuspend runtime calls.

 Applied all, thanks.

thanks.


 The following changes since commit 23dcfa61bac244e1200ff9ad19c6e9144dcb6bb5:

   Merge branch 'akpm' (Andrew's patch-bomb) (2012-08-21 17:22:22 -0700)

 When sending pull requests please always base them off a tag of some
 kind, normally one of Linus' is a good option if you've no special
 needs.  This one looks like it's based off -next so can't be pulled into
 any other tree, -next is rebased daily.

Actually there was a patch in your tree that I sent which is not yet
in linus tree so I rebased
it to linux-next to avoid any merge conflicts.

Henceforth I will rebase it to your tree.
--
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: [PATCHv2 0/3] spi: omap2-mcspi: spi cleanups

2012-08-22 Thread Mark Brown
On Wed, Aug 22, 2012 at 10:33:55PM +0530, Shubhrajyoti Datta wrote:

 Actually there was a patch in your tree that I sent which is not yet
 in linus tree so I rebased
 it to linux-next to avoid any merge conflicts.

 Henceforth I will rebase it to your tree.

That's also a good option, though for simple conflcits it's OK if the
person applying the patch has to resolve them especially if you give
some warning.


signature.asc
Description: Digital signature


Re: debug needed: twl4030 RTC wakeups: repeated attempts fail on Beagle

2012-08-22 Thread Felipe Balbi
Hi,

On Wed, Aug 22, 2012 at 08:36:31PM +0530, Datta, Shubhrajyoti wrote:
  The real mystery is why this happens on Beagle and Beagle-xM, but none
  of the other OMAP3 boards (at least the ones I have.)
 
 Looks like some  race/ timing issue.
 However I am not sure what is a good way to synchronise the i2c
 requests from a client from an isr and
 the device disable / runtime resumed.
 
 However on merging the clean up series
 
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg73870.html
 
 Didn't see the above mentioned issue.
 
 but there were some error's like timeout.
 
 This may be because the controller was not fully enabled.
 
 SYSC in case of I2C not only reflects the reset status from sysc
 reset( register is reset)
 but also controller enable ( controller reset ).
 
 On checking the reset after controller didnt see the time out issue.
 
 patch below.
 
 
 
 diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
 index 9aefd36..b35afa4 100644
 --- a/drivers/i2c/busses/i2c-omap.c
 +++ b/drivers/i2c/busses/i2c-omap.c
 @@ -1254,6 +1254,7 @@ static int omap_i2c_runtime_resume(struct device *dev)
  {
   struct platform_device *pdev = to_platform_device(dev);
   struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
 + unsigned long timeout = 1;
 
   if (_dev-flags  OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
   omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, 0);
 @@ -1266,6 +1267,15 @@ static int omap_i2c_runtime_resume(struct device *dev)
   omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
   }
 
 + while (!(omap_i2c_read_reg(_dev, OMAP_I2C_SYSS_REG) 
 + SYSS_RESETDONE_MASK)) {
 + if (time_after(jiffies, timeout)) {
 + dev_warn(dev, timeout waiting for controller reset\n);
 + return -ETIMEDOUT;
 + }
 + msleep(1);
 + }
 +
   /*
* Don't write to this register if the IE state is 0 as it can
* cause deadlock.

That's weird. i2c has SYSS_HAS_RESET_STATUS set, so hwmod framework
should be checking that for us. And, in fact, SYSS_HAS_RESET_STATUS is
set on all *data.c files.

When you wrote that patch, did you check that reset hasn't completed
yet ? I mean, was reset still asserted at that time ? If instead of your
patch, you just wait longer for reset to complete, will it work ?

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 6ca8e51..7a39c72 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -156,7 +156,7 @@
 #include pm.h
 
 /* Maximum microseconds to wait for OMAP module to softreset */
-#define MAX_MODULE_SOFTRESET_WAIT  1
+#define MAX_MODULE_SOFTRESET_WAIT  5
 
 /* Name of the OMAP hwmod for the MPU */
 #define MPU_INITIATOR_NAME mpu


If it does, then reset takes longer to complete on those particular
boards and it would be nice to know why, but one step at a time :-)

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v3 1/9] ARM/ASoC: omap-mcbsp: Move OMAP2+ clock parenting code to ASoC driver

2012-08-22 Thread Mark Brown
On Thu, Aug 16, 2012 at 04:41:00PM +0300, Peter Ujfalusi wrote:
 Move the McBSP CLKS re-parenting code to ASoC driver from
 arch/arm/mach-omap2.
 The call fort the re-parenting has been already limited to OMAP2+ SoC in
 the ASoC driver. There is no longer need to have callback function for it.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH v3 2/9] ARM: OMAP: mcbsp: Enable FIFO use for OMAP2430

2012-08-22 Thread Mark Brown
On Thu, Aug 16, 2012 at 04:41:01PM +0300, Peter Ujfalusi wrote:
 On OMAP2430 all McBSP ports have 128 word long buffer, enable the use of
 the FIFO for the audio stack.
 
 Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
 Acked-by: Jarkko Nikula jarkko.nik...@bitmer.com

I applied this - Tony, from the thread it seemed you were OK even though
you didn't explicitly ack it?


signature.asc
Description: Digital signature


Re: [PATCH v3 3/9] ARM: OMAP: board-am3517evm: Configure McBSP1 CLKR/FSR signal source

2012-08-22 Thread Mark Brown
On Thu, Aug 16, 2012 at 04:41:02PM +0300, Peter Ujfalusi wrote:
 am3517evm board uses McBSP1 for audio with 4pin configuration.
 The CLKR/FSR signals need to be connected to CLKX/FSX pin of the SoC in
 this case.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH v3 4/9] ASoC: am3517evm: Do not configure McBSP1 CLKR/FSR signal muxing

2012-08-22 Thread Mark Brown
On Thu, Aug 16, 2012 at 04:41:03PM +0300, Peter Ujfalusi wrote:
 The muxing is done at board level, no need to do it in the ASoC machine
 driver.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH v3 5/9] ARM/ASoC: omap-mcbsp: Remove CLKR/FSR mux configuration code

2012-08-22 Thread Mark Brown
On Thu, Aug 16, 2012 at 04:41:04PM +0300, Peter Ujfalusi wrote:
 Remove the feature to configure the CLKR/FSR mux on McBSP port with 6pin
 configuration.
 When moving to devicetree these callback can no longer be used in a clean
 way anymore.

Applied but this didn't quite apply cleanly, please check that it did so.


signature.asc
Description: Digital signature


Re: [PATCH v3 6/9] ASoC: omap-mcbsp: Remove unused defines

2012-08-22 Thread Mark Brown
On Thu, Aug 16, 2012 at 04:41:05PM +0300, Peter Ujfalusi wrote:
 NUM_LINKS is no longer in use by the code.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH v3 7/9] ASoC: omap-mcbsp: Remove cpu_is_omap* checks from the code

2012-08-22 Thread Mark Brown
On Thu, Aug 16, 2012 at 04:41:06PM +0300, Peter Ujfalusi wrote:
 We can use the has_ccr flag to replace the cpu_is_omap* checks.
 This provides future proof implementation and we do not need to update the
 code if new OMAP revision starts to use the McBSP driver.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH v3 8/9] ARM: OMAP2+: McBSP: Do not create legacy devices when booting with DT data

2012-08-22 Thread Mark Brown
On Thu, Aug 16, 2012 at 04:41:07PM +0300, Peter Ujfalusi wrote:
 Only create the devices in a legacy way if we do not have the DT data.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH v3 9/9] ASoC: omap-mcbsp: Add device tree bindings

2012-08-22 Thread Mark Brown
On Thu, Aug 16, 2012 at 04:41:08PM +0300, Peter Ujfalusi wrote:
 Device tree support for McBSP modules on OMAP2+ SoC.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH] ASoC: omap-mcbsp: Device tree binding documentation update

2012-08-22 Thread Mark Brown
On Tue, Aug 21, 2012 at 05:33:56PM +0300, Peter Ujfalusi wrote:
 To reflect the final devicetree node structure of McBSPs.
 
 Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com

Applied, thanks.

 the initial OMAP McBSP DT structure was not able to describe the IP (and it's
 versions) correctly.
 The main issue was the sidetone block of McBSP2/3 on OMAP3.
 With this change in the DT description the OS can get the needed information
 about the IP.
 
 The sidetone is still not supported when the Linux kernel is booted with DT
 since we still depend on hwmod to fill the resources.

I pasted this into the changelog to explain what's going on.


signature.asc
Description: Digital signature


[PATCH 1/8] ir-rx51: Adjust dependencies

2012-08-22 Thread Timo Kokkonen
Although this kind of IR diode circuitry is known to exist only in
N900 hardware, nothing prevents making similar circuitry on any OMAP
based board. The MACH_NOKIA_RX51 dependency is thus not something we
want to be there.

Also, this should depend on LIRC as it is a LIRC driver.

Signed-off-by: Timo Kokkonen timo.t.kokko...@iki.fi
---
 drivers/media/rc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index ffef8b4..093982b 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -273,7 +273,7 @@ config IR_IGUANA
 
 config IR_RX51
tristate Nokia N900 IR transmitter diode
-   depends on MACH_NOKIA_RX51  OMAP_DM_TIMER
+   depends on OMAP_DM_TIMER  LIRC
---help---
   Say Y or M here if you want to enable support for the IR
   transmitter diode built in the Nokia N900 (RX51) device.
-- 
1.7.12

--
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/8] ir-rx51: Fixes in response to review comments

2012-08-22 Thread Timo Kokkonen
These patches fix most of the issues pointed out in the patch review
by Sean Young and Sakari Ailus. The most noticeable change after these
patch set is that the IR transmission no longer times out even if the
timers are not waking up the MPU as it should be. However, the
transmission itself is still as badly mangled as before, unless there
is some background load preventing the MPU from going into
sleep. Otherwise the patches are mostly clean ups and rather trivial
stuff.

All comments are welcome. Thanks!

Timo Kokkonen (8):
  ir-rx51: Adjust dependencies
  ir-rx51: Handle signals properly
  ir-rx51: Trivial fixes
  ir-rx51: Clean up timer initialization code
  ir-rx51: Move platform data checking into probe function
  ir-rx51: Replace module_{init,exit} macros with
module_platform_driver
  ir-rx51: Remove MPU wakeup latency adjustments
  ir-rx51: Remove useless variable from struct lirc_rx51

 arch/arm/mach-omap2/board-rx51-peripherals.c |  2 -
 drivers/media/rc/Kconfig |  4 +-
 drivers/media/rc/ir-rx51.c   | 92 +---
 include/media/ir-rx51.h  |  2 -
 4 files changed, 43 insertions(+), 57 deletions(-)

-- 
1.7.12

--
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 8/8] ir-rx51: Remove useless variable from struct lirc_rx51

2012-08-22 Thread Timo Kokkonen
As clearly visible from the patch, this variable has no useful purpose
what so ever. Thus, it can be removed altogether without any side
effects.

Signed-off-by: Timo Kokkonen timo.t.kokko...@iki.fi
---
 drivers/media/rc/ir-rx51.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index ac7d3f0..23bc8c0 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -55,7 +55,6 @@ struct lirc_rx51 {
unsigned intfreq;   /* carrier frequency */
unsigned intduty_cycle; /* carrier duty cycle */
unsigned intirq_num;
-   unsigned intmatch;
int wbuf[WBUF_LEN];
int wbuf_index;
unsigned long   device_is_open;
@@ -100,8 +99,6 @@ static int init_timing_params(struct lirc_rx51 *lirc_rx51)
omap_dm_timer_set_int_enable(lirc_rx51-pulse_timer, 0);
omap_dm_timer_start(lirc_rx51-pulse_timer);
 
-   lirc_rx51-match = 0;
-
return 0;
 }
 
@@ -111,11 +108,7 @@ static int pulse_timer_set_timeout(struct lirc_rx51 
*lirc_rx51, int usec)
 
BUG_ON(usec  0);
 
-   if (lirc_rx51-match == 0)
-   counter = omap_dm_timer_read_counter(lirc_rx51-pulse_timer);
-   else
-   counter = lirc_rx51-match;
-
+   counter = omap_dm_timer_read_counter(lirc_rx51-pulse_timer);
counter += (u32)(lirc_rx51-fclk_khz * usec / (1000));
omap_dm_timer_set_match(lirc_rx51-pulse_timer, 1, counter);
omap_dm_timer_set_int_enable(lirc_rx51-pulse_timer,
-- 
1.7.12

--
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 6/8] ir-rx51: Replace module_{init,exit} macros with module_platform_driver

2012-08-22 Thread Timo Kokkonen
No reason to avoid using the existing helpers.

Signed-off-by: Timo Kokkonen timo.t.kokko...@iki.fi
---
 drivers/media/rc/ir-rx51.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 46628c0..7eed541 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -495,17 +495,7 @@ struct platform_driver lirc_rx51_platform_driver = {
},
 };
 
-static int __init lirc_rx51_init(void)
-{
-   return platform_driver_register(lirc_rx51_platform_driver);
-}
-module_init(lirc_rx51_init);
-
-static void __exit lirc_rx51_exit(void)
-{
-   platform_driver_unregister(lirc_rx51_platform_driver);
-}
-module_exit(lirc_rx51_exit);
+module_platform_driver(lirc_rx51_platform_driver);
 
 MODULE_DESCRIPTION(LIRC TX driver for Nokia RX51);
 MODULE_AUTHOR(Nokia Corporation);
-- 
1.7.12

--
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 5/8] ir-rx51: Move platform data checking into probe function

2012-08-22 Thread Timo Kokkonen
This driver is useless without proper platform data. If data is not
available, we should not register the driver at all. Once this check
is done, the BUG_ON check during device open is no longer needed.

Signed-off-by: Timo Kokkonen timo.t.kokko...@iki.fi
---
 drivers/media/rc/ir-rx51.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 3d2911b..46628c0 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -378,7 +378,6 @@ static long lirc_rx51_ioctl(struct file *filep,
 static int lirc_rx51_open(struct inode *inode, struct file *file)
 {
struct lirc_rx51 *lirc_rx51 = lirc_get_pdata(file);
-   BUG_ON(!lirc_rx51);
 
file-private_data = lirc_rx51;
 
@@ -458,6 +457,9 @@ static int lirc_rx51_resume(struct platform_device *dev)
 
 static int __devinit lirc_rx51_probe(struct platform_device *dev)
 {
+   if (!dev-dev.platform_data)
+   return -ENODEV;
+
lirc_rx51_driver.features = LIRC_RX51_DRIVER_FEATURES;
lirc_rx51.pdata = dev-dev.platform_data;
lirc_rx51.pwm_timer_num = lirc_rx51.pdata-pwm_timer;
-- 
1.7.12

--
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 7/8] ir-rx51: Remove MPU wakeup latency adjustments

2012-08-22 Thread Timo Kokkonen
The ir-rx51 driver calls omap_pm_set_max_mpu_wakeup_lat() in order to
avoid problems that occur when MPU goes to sleep in the middle of
sending an IR code. Without such calls it takes ridiculously long for
the MPU to wake up from a sleep, which distorts the IR signal
completely.

However, the actual problem is that probably the GP timers are not
able to wake up the MPU at all. That is, adjusting the latency
requirements is not the correct way to solve the issue either. The
reason why this used to work with the original 2.6.28 based N900
kernel that is shipped with the product is that placing strict latency
requirements prevents the MPU from going to sleep at all. Furthermore,
the only PM layer imlementation available at the moment for OMAP3
doesn't do anything with the latency requirement placed with
omap_pm_set_max_mpu_wakeup_lat() calls.

A more appropriate fix for the problem would be to modify the idle
layer so that it does not allow MPU going to too deep sleep modes when
it is expected that the timers need to wake up MPU.

Therefore, it makes sense to actually remove this call entirely from
the ir-rx51 driver as it is both wrong and does nothing useful at the
moment.

Signed-off-by: Timo Kokkonen timo.t.kokko...@iki.fi
---
 arch/arm/mach-omap2/board-rx51-peripherals.c | 2 --
 drivers/media/rc/ir-rx51.c   | 9 -
 include/media/ir-rx51.h  | 2 --
 3 files changed, 13 deletions(-)

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c 
b/arch/arm/mach-omap2/board-rx51-peripherals.c
index ca07264..e0750cb 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -34,7 +34,6 @@
 #include plat/gpmc.h
 #include plat/onenand.h
 #include plat/gpmc-smc91x.h
-#include plat/omap-pm.h
 
 #include mach/board-rx51.h
 
@@ -1227,7 +1226,6 @@ static void __init rx51_init_tsc2005(void)
 
 #if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
 static struct lirc_rx51_platform_data rx51_lirc_data = {
-   .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
.pwm_timer = 9, /* Use GPT 9 for CIR */
 };
 
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 7eed541..ac7d3f0 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -267,12 +267,6 @@ static ssize_t lirc_rx51_write(struct file *file, const 
char *buf,
if (count  WBUF_LEN)
lirc_rx51-wbuf[count] = -1; /* Insert termination mark */
 
-   /*
-* Adjust latency requirements so the device doesn't go in too
-* deep sleep states
-*/
-   lirc_rx51-pdata-set_max_mpu_wakeup_lat(lirc_rx51-dev, 50);
-
lirc_rx51_on(lirc_rx51);
lirc_rx51-wbuf_index = 1;
pulse_timer_set_timeout(lirc_rx51, lirc_rx51-wbuf[0]);
@@ -292,9 +286,6 @@ static ssize_t lirc_rx51_write(struct file *file, const 
char *buf,
 */
lirc_rx51_stop_tx(lirc_rx51);
 
-   /* We can sleep again */
-   lirc_rx51-pdata-set_max_mpu_wakeup_lat(lirc_rx51-dev, -1);
-
return n;
 }
 
diff --git a/include/media/ir-rx51.h b/include/media/ir-rx51.h
index 104aa89..57523f2 100644
--- a/include/media/ir-rx51.h
+++ b/include/media/ir-rx51.h
@@ -3,8 +3,6 @@
 
 struct lirc_rx51_platform_data {
int pwm_timer;
-
-   int(*set_max_mpu_wakeup_lat)(struct device *dev, long t);
 };
 
 #endif
-- 
1.7.12

--
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 3/8] ir-rx51: Trivial fixes

2012-08-22 Thread Timo Kokkonen
-Fix typo

-Change pwm_timer_num type to match type in platform data

-Remove extra parenthesis

-Replace magic constant with proper bit defintions

-Remove duplicate exit pointer

Signed-off-by: Timo Kokkonen timo.t.kokko...@iki.fi

trivial

Signed-off-by: Timo Kokkonen timo.t.kokko...@iki.fi
---
 drivers/media/rc/Kconfig   |  2 +-
 drivers/media/rc/ir-rx51.c | 10 ++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 093982b..4a68014 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -278,7 +278,7 @@ config IR_RX51
   Say Y or M here if you want to enable support for the IR
   transmitter diode built in the Nokia N900 (RX51) device.
 
-  The driver uses omap DM timers for gereating the carrier
+  The driver uses omap DM timers for generating the carrier
   wave and pulses.
 
 config RC_LOOPBACK
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index a7b787a..468c8a1 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -59,7 +59,7 @@ struct lirc_rx51 {
int wbuf[WBUF_LEN];
int wbuf_index;
unsigned long   device_is_open;
-   unsigned intpwm_timer_num;
+   int pwm_timer_num;
 };
 
 static void lirc_rx51_on(struct lirc_rx51 *lirc_rx51)
@@ -138,11 +138,14 @@ static irqreturn_t lirc_rx51_interrupt_handler(int irq, 
void *ptr)
if (!retval)
return IRQ_NONE;
 
-   if ((retval  ~OMAP_TIMER_INT_MATCH))
+   if (retval  ~OMAP_TIMER_INT_MATCH)
dev_err_ratelimited(lirc_rx51-dev,
: Unexpected interrupt source: %x\n, retval);
 
-   omap_dm_timer_write_status(lirc_rx51-pulse_timer, 7);
+   omap_dm_timer_write_status(lirc_rx51-pulse_timer,
+   OMAP_TIMER_INT_MATCH|
+   OMAP_TIMER_INT_OVERFLOW |
+   OMAP_TIMER_INT_CAPTURE);
if (lirc_rx51-wbuf_index  0) {
dev_err_ratelimited(lirc_rx51-dev,
: BUG wbuf_index has value of %i\n,
@@ -489,7 +492,6 @@ struct platform_driver lirc_rx51_platform_driver = {
.remove = __exit_p(lirc_rx51_remove),
.suspend= lirc_rx51_suspend,
.resume = lirc_rx51_resume,
-   .remove = __exit_p(lirc_rx51_remove),
.driver = {
.name   = DRIVER_NAME,
.owner  = THIS_MODULE,
-- 
1.7.12

--
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/8] ir-rx51: Handle signals properly

2012-08-22 Thread Timo Kokkonen
The lirc-dev expects the ir-code to be transmitted when the write call
returns back to the user space. We should not leave TX ongoing no
matter what is the reason we return to the user space. Easiest
solution for that is to simply remove interruptible sleeps.

The first wait_event_interruptible is thus replaced with return -EBUSY
in case there is still ongoing transfer. This should suffice as the
concept of sending multiple codes in parallel does not make sense.

The second wait_event_interruptible call is replaced with
wait_even_timeout with a fixed and safe timeout that should prevent
the process from getting stuck in kernel for too long.

Also, from now on we will force the TX to stop before we return from
write call. If the TX happened to time out for some reason, we should
not leave the HW transmitting anything.

Signed-off-by: Timo Kokkonen timo.t.kokko...@iki.fi
---
 drivers/media/rc/ir-rx51.c | 39 ---
 1 file changed, 28 insertions(+), 11 deletions(-)

diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 9487dd3..a7b787a 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -74,6 +74,19 @@ static void lirc_rx51_off(struct lirc_rx51 *lirc_rx51)
  OMAP_TIMER_TRIGGER_NONE);
 }
 
+static void lirc_rx51_stop_tx(struct lirc_rx51 *lirc_rx51)
+{
+   if (lirc_rx51-wbuf_index  0)
+   return;
+
+   lirc_rx51_off(lirc_rx51);
+   lirc_rx51-wbuf_index = -1;
+   omap_dm_timer_stop(lirc_rx51-pwm_timer);
+   omap_dm_timer_stop(lirc_rx51-pulse_timer);
+   omap_dm_timer_set_int_enable(lirc_rx51-pulse_timer, 0);
+   wake_up_interruptible(lirc_rx51-wqueue);
+}
+
 static int init_timing_params(struct lirc_rx51 *lirc_rx51)
 {
u32 load, match;
@@ -160,13 +173,7 @@ static irqreturn_t lirc_rx51_interrupt_handler(int irq, 
void *ptr)
 
return IRQ_HANDLED;
 end:
-   /* Stop TX here */
-   lirc_rx51_off(lirc_rx51);
-   lirc_rx51-wbuf_index = -1;
-   omap_dm_timer_stop(lirc_rx51-pwm_timer);
-   omap_dm_timer_stop(lirc_rx51-pulse_timer);
-   omap_dm_timer_set_int_enable(lirc_rx51-pulse_timer, 0);
-   wake_up_interruptible(lirc_rx51-wqueue);
+   lirc_rx51_stop_tx(lirc_rx51);
 
return IRQ_HANDLED;
 }
@@ -246,8 +253,9 @@ static ssize_t lirc_rx51_write(struct file *file, const 
char *buf,
if ((count  WBUF_LEN) || (count % 2 == 0))
return -EINVAL;
 
-   /* Wait any pending transfers to finish */
-   wait_event_interruptible(lirc_rx51-wqueue, lirc_rx51-wbuf_index  0);
+   /* We can have only one transmit at a time */
+   if (lirc_rx51-wbuf_index = 0)
+   return -EBUSY;
 
if (copy_from_user(lirc_rx51-wbuf, buf, n))
return -EFAULT;
@@ -273,9 +281,18 @@ static ssize_t lirc_rx51_write(struct file *file, const 
char *buf,
 
/*
 * Don't return back to the userspace until the transfer has
-* finished
+* finished. However, we wish to not spend any more than 500ms
+* in kernel. No IR code TX should ever take that long.
+*/
+   i = wait_event_timeout(lirc_rx51-wqueue, lirc_rx51-wbuf_index  0,
+   HZ / 2);
+
+   /*
+* Ensure transmitting has really stopped, even if the timers
+* went mad or something else happened that caused it still
+* sending out something.
 */
-   wait_event_interruptible(lirc_rx51-wqueue, lirc_rx51-wbuf_index  0);
+   lirc_rx51_stop_tx(lirc_rx51);
 
/* We can sleep again */
lirc_rx51-pdata-set_max_mpu_wakeup_lat(lirc_rx51-dev, -1);
-- 
1.7.12

--
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/8] ir-rx51: Clean up timer initialization code

2012-08-22 Thread Timo Kokkonen
Remove a redundant macro definition. This is unneeded and becomes more
readable once the actual timer code is refactored a little.

Signed-off-by: Timo Kokkonen timo.t.kokko...@iki.fi
---
 drivers/media/rc/ir-rx51.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 468c8a1..3d2911b 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -105,11 +105,9 @@ static int init_timing_params(struct lirc_rx51 *lirc_rx51)
return 0;
 }
 
-#define tics_after(a, b) ((long)(b) - (long)(a)  0)
-
 static int pulse_timer_set_timeout(struct lirc_rx51 *lirc_rx51, int usec)
 {
-   int counter;
+   int counter, counter_now;
 
BUG_ON(usec  0);
 
@@ -122,11 +120,8 @@ static int pulse_timer_set_timeout(struct lirc_rx51 
*lirc_rx51, int usec)
omap_dm_timer_set_match(lirc_rx51-pulse_timer, 1, counter);
omap_dm_timer_set_int_enable(lirc_rx51-pulse_timer,
 OMAP_TIMER_INT_MATCH);
-   if (tics_after(omap_dm_timer_read_counter(lirc_rx51-pulse_timer),
-  counter)) {
-   return 1;
-   }
-   return 0;
+   counter_now = omap_dm_timer_read_counter(lirc_rx51-pulse_timer);
+   return (counter - counter_now)  0;
 }
 
 static irqreturn_t lirc_rx51_interrupt_handler(int irq, void *ptr)
-- 
1.7.12

--
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: receiving data from mcbsp1 in master mode

2012-08-22 Thread Andreas Kemnade
Hi,

On Tue, 21 Aug 2012 16:42:19 +0300
Peter Ujfalusi peter.ujfal...@ti.com wrote:

 On 08/21/2012 08:42 AM, Andreas Kemnade wrote:
  Hi,
  
  I tried a couple of times with different kernels to use mcbsp1 of dm3730
  in master mode (so that it sends out clocks).
  The result always is that I can send data out. but arecord gets no input. It
  waits for input but does not get anything, although clocks are generated,
  checked that with a scope. 
  
  I even took a driver which works in master mode on another mcbsp and just 
  changed
  the mcbsp number.
  What needs to be done to receive data from mcbsp1?
 
 You should check the PIN mux configuration of McBSP1 FSR/CLKR pins. McBSP1 on
 dm3730 have 6 pin configuration. I think the capture should work fine if you
 select the FSX as FSR source, and CLKX as CLKR source.

if I understand the TRM correctly, according to Figure 21-26 in chapter 
21.4.2.3.
if GSYNC is set, the receiver uses the signal from the sample rate generator,
so CLKX does not need to be the CLKR source.
But I tried also with the DEVCONF0 MCBSP1_CLKR bit as you proposed.
I tried
 snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_CLKR_SRC_CLKX, 0,
 SND_SOC_CLOCK_OUT);
 snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_FSR_SRC_FSX, 0,
 SND_SOC_CLOCK_OUT);

 That is why I send you my patch about that mux settings. But I had no success.
The CLKX as CLKR source and FSX as FSR source setting I have only seen when
mcbsp1 is used in slave mode. If you know any working code which uses mcbsp1 in
master mode then let me know.

Greetings
Andreas Kemnade


signature.asc
Description: PGP signature


Re: [PATCH v3 2/9] ARM: OMAP: mcbsp: Enable FIFO use for OMAP2430

2012-08-22 Thread Tony Lindgren
* Mark Brown broo...@opensource.wolfsonmicro.com [120822 12:12]:
 On Thu, Aug 16, 2012 at 04:41:01PM +0300, Peter Ujfalusi wrote:
  On OMAP2430 all McBSP ports have 128 word long buffer, enable the use of
  the FIFO for the audio stack.
  
  Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
  Acked-by: Jarkko Nikula jarkko.nik...@bitmer.com
 
 I applied this - Tony, from the thread it seemed you were OK even though
 you didn't explicitly ack it?

Ah yes sorry, I'm fine with it. Sounds like you already applied it,
so too late to ack. But just in case:

Acked-by: Tony Lindgren t...@atomide.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


[PATCH v3] backlight: Add TPS65217 WLED driver

2012-08-22 Thread Matthias Kaehlcke
The TPS65217 chip contains a boost converter and current sinks which can be
used to drive LEDs for use as backlights. Expose this functionality via the
backlight API.

Tested on an AM335x based custom board with a single WLED string, using
different values for ISEL and FDIM (though it would be hard to tell the
difference except for the value in WLEDCTRL1). Both instantiation through the
device tree and by passing platform data have been tested. Testing has been
done with an Androidized 3.2 kernel from the rowboat project

This patch is based on the mfd/for-next branch (20120822)

Changes since v2:

 * adapted to the latest version of the tps65217 mfd driver
 * register backlight as mfd subdevice
 * allocate struct tps65217_bl after validation of the device tree/platform data

Signed-off-by: Matthias Kaehlcke matth...@kaehlcke.net
---
 drivers/mfd/tps65217.c|3 +
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps65217_bl.c |  352 +
 include/linux/mfd/tps65217.h  |   18 ++
 5 files changed, 381 insertions(+)
 create mode 100644 drivers/video/backlight/tps65217_bl.c

diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
index 3bc2744..592059e 100644
--- a/drivers/mfd/tps65217.c
+++ b/drivers/mfd/tps65217.c
@@ -34,6 +34,9 @@ static struct mfd_cell tps65217s[] = {
{
.name = tps65217-pmic,
},
+   {
+   .name = tps65217-bl,
+   },
 };
 
 /**
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index cf28276..63cee2e 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -373,6 +373,13 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS65217
+   tristate TPS65217 Backlight
+   depends on BACKLIGHT_CLASS_DEVICE  MFD_TPS65217
+   help
+ If you have a Texas Instruments TPS65217 say Y to enable the
+ backlight driver.
+
 endif # BACKLIGHT_CLASS_DEVICE
 
 endif # BACKLIGHT_LCD_SUPPORT
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index a2ac9cf..00223a6 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -43,3 +43,4 @@ obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_AAT2870) += aat2870_bl.o
 obj-$(CONFIG_BACKLIGHT_OT200) += ot200_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
diff --git a/drivers/video/backlight/tps65217_bl.c 
b/drivers/video/backlight/tps65217_bl.c
new file mode 100644
index 000..5842d5f
--- /dev/null
+++ b/drivers/video/backlight/tps65217_bl.c
@@ -0,0 +1,352 @@
+/*
+ * tps65217_bl.c
+ *
+ * TPS65217 backlight driver
+ *
+ * Copyright (C) 2012 Matthias Kaehlcke
+ * Author: Matthias Kaehlcke matth...@kaehlcke.net
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/kernel.h
+#include linux/backlight.h
+#include linux/err.h
+#include linux/fb.h
+#include linux/mfd/tps65217.h
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+struct tps65217_bl {
+   struct tps65217 *tps;
+   struct device *dev;
+   struct backlight_device *bl;
+   int on;
+};
+
+static int tps65217_bl_enable(struct tps65217_bl *tps65217_bl)
+{
+   int rc;
+
+   rc = tps65217_set_bits(tps65217_bl-tps, TPS65217_REG_WLEDCTRL1,
+   TPS65217_WLEDCTRL1_ISINK_ENABLE,
+   TPS65217_WLEDCTRL1_ISINK_ENABLE, TPS65217_PROTECT_NONE);
+   if (rc) {
+   dev_err(tps65217_bl-dev,
+   failed to enable backlight: %d\n, rc);
+   return rc;
+   }
+
+   tps65217_bl-on = 1;
+
+   dev_dbg(tps65217_bl-dev, backlight enabled\n);
+
+   return 0;
+}
+
+static int tps65217_bl_disable(struct tps65217_bl *tps65217_bl)
+{
+   int rc;
+
+   rc = tps65217_clear_bits(tps65217_bl-tps,
+   TPS65217_REG_WLEDCTRL1,
+   TPS65217_WLEDCTRL1_ISINK_ENABLE,
+   TPS65217_PROTECT_NONE);
+   if (rc) {
+   dev_err(tps65217_bl-dev,
+   failed to disable backlight: %d\n, rc);
+   return rc;
+   }
+
+   tps65217_bl-on = 0;
+
+   dev_dbg(tps65217_bl-dev, backlight disabled\n);
+
+   return 0;
+}
+
+static int

[PATCH] omapdrm: use alloc_ordered_workqueue() instead of UNBOUND w/ max_active = 1

2012-08-22 Thread Tejun Heo
This is an equivalent conversion and will ease scheduled removal of
WQ_NON_REENTRANT.

Only compile tested.

Signed-off-by: Tejun Heo t...@kernel.org
---
 drivers/staging/omapdrm/omap_drv.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/omapdrm/omap_drv.c 
b/drivers/staging/omapdrm/omap_drv.c
index 4beab94..672cb3a 100644
--- a/drivers/staging/omapdrm/omap_drv.c
+++ b/drivers/staging/omapdrm/omap_drv.c
@@ -571,8 +571,7 @@ static int dev_load(struct drm_device *dev, unsigned long 
flags)
 
dev-dev_private = priv;
 
-   priv-wq = alloc_workqueue(omapdrm,
-   WQ_UNBOUND | WQ_NON_REENTRANT, 1);
+   priv-wq = alloc_ordered_workqueue(omapdrm, 0);
 
INIT_LIST_HEAD(priv-obj_list);
 
--
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 v6 07/10] ARM: OMAP2+: gpmc: generic timing calculation

2012-08-22 Thread Jon Hunter
Hi Afzal,

On 08/21/2012 05:45 AM, Afzal Mohammed wrote:
 Presently there are three peripherals that gets it timing
 by runtime calculation. Those peripherals can work with
 frequency scaling that affects gpmc clock. But timing
 calculation for them are in different ways.
 
 Here a generic runtime calculation method is proposed. Input
 to this function were selected so that they represent timing
 variables that are present in peripheral datasheets. Motive
 behind this was to achieve DT bindings for the inputs as is.
 Even though a few of the tusb6010 timings could not be made
 directly related to timings normally found on peripherals,
 expressions used were translated to those that could be
 justified.
 
 There are possibilities of improving the calculations, like
 calculating timing for read  write operations in a more
 similar way. Expressions derived here were tested for async
 onenand on omap3evm (as vanilla Kernel does not have omap3evm
 onenand support, local patch was used). Other peripherals,
 tusb6010, smc91x calculations were validated by simulating
 on omap3evm.
 
 Regarding we_on for onenand async, it was found that even
 for muxed address/data, it need not be greater than
 adv_wr_off, but rather could be derived from write setup
 time for peripheral from start of access time, hence would
 more be in line with peripheral timings. With this method
 it was working fine. If it is required in some cases to
 have we_on same as wr_data_mux_bus (i.e. greater than
 adv_wr_off), another variable could be added to indicate
 it. But such a requirement is not expected though.
 
 Whole of this exercise is being done to achieve driver and
 DT conversion. If timings could not be calculated in a
 peripheral agnostic way, either gpmc driver would have to
 be peripheral gnostic or a wrapper arrangement over gpmc
 driver would be required.
 
 Signed-off-by: Afzal Mohammed af...@ti.com
 ---
  arch/arm/mach-omap2/gpmc.c |  302 
 
  arch/arm/plat-omap/include/plat/gpmc.h |   61 +++
  2 files changed, 363 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
 index d005b3a..d8e5b08 100644
 --- a/arch/arm/mach-omap2/gpmc.c
 +++ b/arch/arm/mach-omap2/gpmc.c
 @@ -233,6 +233,18 @@ unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns)
   return ticks * gpmc_get_fclk_period() / 1000;
  }
  
 +unsigned int gpmc_ticks_to_ps(unsigned int ticks)
 +{
 + return ticks * gpmc_get_fclk_period();
 +}
 +
 +unsigned int gpmc_round_ps_to_ticks(unsigned int time_ps)
 +{
 + unsigned long ticks = gpmc_ps_to_ticks(time_ps);
 +
 + return ticks * gpmc_get_fclk_period();
 +}
 +
  static inline void gpmc_cs_modify_reg(int cs, int reg, u32 mask, bool value)
  {
   u32 l;
 @@ -884,6 +896,296 @@ static void __init gpmc_mem_init(void)
   }
  }
  
 +static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk)
 +{
 + u32 temp;
 + int div;
 +
 + div = gpmc_calc_divider(sync_clk);
 + temp = gpmc_ps_to_ticks(time_ps);
 + temp = (temp + div - 1) / div;
 + return gpmc_ticks_to_ps(temp * div);
 +}
 +
 +/* can the cycles be avoided ? */

What is the above comment referring too?

 +static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t,
 + struct gpmc_device_timings *dev_t)
 +{
 + bool mux = dev_t-mux;
 + u32 temp;
 +
 + /* adv_rd_off */
 + temp = dev_t-t_avdp_r;
 + /* mux check required ? */
 + if (mux) {
 + /* t_avdp not to be required for sync, only added for tusb this
 +  * indirectly necessitates requirement of t_avdp_r  t_avdp_w
 +  * instead of having a single t_avdp
 +  */
 + temp = max_t(u32, temp, gpmc_t-clk_activation * 1000 +
 + dev_t-t_avdh);
 + temp = max_t(u32,
 + (gpmc_t-adv_on + gpmc_ticks_to_ns(1)) * 1000, temp);
 + }
 + gpmc_t-adv_rd_off = gpmc_round_ps_to_ticks(temp) / 1000;
 +
 + /* oe_on */
 + temp = dev_t-t_oeasu; /* remove this ? */
 + if (mux) {
 + temp = max_t(u32, temp,
 + gpmc_t-clk_activation * 1000 + dev_t-t_ach);
 + temp = max_t(u32, temp, (gpmc_t-adv_rd_off +
 + gpmc_ticks_to_ns(dev_t-cyc_aavdh_oe)) * 1000);
 + }
 + gpmc_t-oe_on = gpmc_round_ps_to_ticks(temp) / 1000;
 +
 + /* access */
 + /* any scope for improvement ?, by combining oe_on  clk_activation,
 +  * need to check whether access = clk_activation + round to sync clk ?
 +  */
 + temp = max_t(u32, dev_t-t_iaa, dev_t-cyc_iaa * gpmc_t-sync_clk);
 + temp += gpmc_t-clk_activation * 1000;
 + if (dev_t-cyc_oe)
 + temp = max_t(u32, temp, (gpmc_t-oe_on +
 + gpmc_ticks_to_ns(dev_t-cyc_oe)) * 1000);
 + gpmc_t-access = gpmc_round_ps_to_ticks(temp) / 1000;