Re: [PATCHv10 1/7] I2C: OMAP: I2C register restore only if context is lost

2012-06-26 Thread Shubhrajyoti
On Monday 25 June 2012 06:00 PM, Felipe Balbi wrote:
 Cc: Kevin Hilman khil...@ti.com
  Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
 how will this ever work with DT ? 
What you say makes sense however that is what currently
most of the omap drivers do.

Will check on this.
 I say we get rid of the OMAP-specific
 API and build this context lost status directly on dev_pm_info and
 have something like pm_runtime_lost_context() or something with pm QoS
 tell you if a device has lost its context.

 Also, your commit log doesn't really state any problems you might have
 reached before, or any improvements wrt latency coming out of suspend
 and so on.

 IMHO, drivers need a generic way to differentiate if they're resuming
 from OFF or RET, otherwise we will end up with a bunch of OMAP-specific
 hackery on all drivers


--
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 05/11] OMAPDSS: add clk_prepare and clk_unprepare

2012-06-26 Thread Tomi Valkeinen
On Tue, 2012-06-26 at 10:30 +0530, Rajendra Nayak wrote:

  So as far as I see, clocks are never handled in atomic context. Is
  everything related to the base clk stuff already in mainline? Can I take
  the clk_prepare/unprepare patch into my omapdss tree?
 
 Well the Common Clk framework is already in mainline, but we still don;t
 have CONFIG_COMMON_CLK enabled for our builds yet. So until we do so,
 clk_prepare/unprepare will just be stubs which do nothing.

But if I understood correctly, clk_prepare and clk_unprepare are anyway
no-ops with dss clocks, even when CONFIG_COMMON_CLK is enabled?

My point was only to understand if I can safely take the patch into
omapdss tree, instead of it going through l-o, to avoid any possible
conflicts.

 Tomi



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


Re: [PATCH] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Tomi Valkeinen
On Mon, 2012-06-25 at 22:36 +0530, Jassi Brar wrote:
 On 25 June 2012 19:19, Tomi Valkeinen tomi.valkei...@ti.com wrote:
  On Mon, 2012-06-25 at 19:01 +0530, Jassi Brar wrote:
 
   /* this accesses a register, but the HW is disabled? */
   dispc_read_reg(FOO);
  
   the H/W is already always enabled if CONFIG_PM_RUNTIME is not defined.
 
  If CONFIG_PM_RUNTIME is indeed defined,  pm_runtime_enabled() will
  always return true after pm_runtime_enable()  unless someone disables
  it explicitly - omapdss or the RPM stack(during suspend/resume).
  OMAPDSS never does so in the lifetime of a driver.  So the only period
  in which pm_runtime_enabled() returns false, is when the platform is
  suspending, suspended or resuming.
 
  Right. So what happens in my example above?
 
  Normally if the driver does dispc_runtime_get() and dispc_read_reg(),
  the first call will enable the HW so the reg read works.
 
  But if the pm_runtime is disabled, say, during system suspend, with your
  patch dispc_runtime_get() will just return 0 without doing anything, and
  the dispc_read_reg() will crash because the HW is disabled (because
  nobody enabled it).
 
 Hmm, I am not sure if new calls would/should be made to dispc.c after
 the system has suspended and before resumed. That is, anything other
 than from runtime_resume/suspend callbacks of DSS, DISPC, HDMI, VENC
 and RFBI, which rightly don't touch any dss reg but only
 enable/disable a clock.

They do touch the registers. For example, dispc's callbacks save and
restore the registers. The HW should be fully functional during the
callbacks. The point of the callbacks is to suspend/resume the HW in
question, which of course requires accessing the HW.

 As we know, a subsystem should make sure any active work is cleared
 out before suspending and set some flag so that nothing runs until it
 has resumed. I don't say we can't crash the system with this patch,
 but then we would be violating rules of suspend-resume.

Let's go back a bit. I feel like I'm missing some pieces of information,
as I still don't quite grasp the problem.

In the patch you said this fixes an issue with HDMI. Can you tell more
about the problem? What code path is being run? Any error messages?

I tried system suspend with omap4-sdp and panda, with 3.5-rc2, but
neither board seems to wake up from the suspend. Does it work for you?

 Tomi



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


Re: Panda ES board hang when using GPIO as interrupt

2012-06-26 Thread DebBarma, Tarun Kanti
On Tue, Jun 26, 2012 at 2:22 AM, Franky Lin fran...@broadcom.com wrote:
 Hi Kevin, Tarun,

 We are using the expansion connector A on Panda board to mount a SDIO WiFi
 dongle on MMC2 with a level triggered interrupt signal connected to GPIO
 138. It's been working fine until 3.5 rc1. The board hang randomly within 5
 mins during a network traffic test. After bisecting we found the culprit is
 [PATCH 8/8] gpio/omap: fix missing check in *_runtime_suspend() [1].

 I noticed Kevin raised some similar cases on other platforms and also
 provided two patches in the patch mail thread. But unfortunately those two
 patches doesn't help in our case. I tested the driver with 3.5-rc3 mainline
 kernel and the issue is still there. I can only fix the hang by either
 reverting the commit or disabling CONFIG_PM_RUNTIME. Also, the hang only
 happens on Panda ES board. Old Panda with 4430 works good.

 Any thoughts and suggestions?
I just had a quick look at the code. Can you please check if the
attached patch solves
the issue? I just boot tested on Panda and Blaze.
--
Tarun

From 0e1b322451b7a49487d2d17a147db1aa1d1119fa Mon Sep 17 00:00:00 2001
From: Tarun Kanti DebBarma tarun.ka...@ti.com
Date: Tue, 26 Jun 2012 12:13:47 +0530
Subject: [PATCH] gpio/omap: enabled_non_wakeup_gpios check skips
bank-saved_datain

Commit b3c64bc30af67ed328a8d919e41160942b870451
(gpio/omap: (re)fix wakeups on level-triggered GPIOs)
still skips update of bank-saved_datain in *_runtime_suspend()
which must be done irrespective of edge/level trigger types.
Therefore, move the enbaled_non_wakeup_gpios check after the
bank-saved_datain is updated.

Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
---
 drivers/gpio/gpio-omap.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index c4ed172..94ecdcf 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1177,9 +1177,6 @@ static int omap_gpio_runtime_suspend(struct device *dev)
__raw_writel(wake_hi | bank-context.risingdetect,
 bank-base + bank-regs-risingdetect);

-   if (!bank-enabled_non_wakeup_gpios)
-   goto update_gpio_context_count;
-
if (bank-power_mode != OFF_MODE) {
bank-power_mode = 0;
goto update_gpio_context_count;
@@ -1191,6 +1188,10 @@ static int omap_gpio_runtime_suspend(struct device *dev)
 */
bank-saved_datain = __raw_readl(bank-base +
bank-regs-datain);
+
+   if (!bank-enabled_non_wakeup_gpios)
+   goto update_gpio_context_count;
+
l1 = bank-context.fallingdetect;
l2 = bank-context.risingdetect;

-- 
1.7.0.4




 Thanks,
 Franky

 [1] http://article.gmane.org/gmane.linux.ports.arm.omap/75708/

From 0e1b322451b7a49487d2d17a147db1aa1d1119fa Mon Sep 17 00:00:00 2001
From: Tarun Kanti DebBarma tarun.ka...@ti.com
Date: Tue, 26 Jun 2012 12:13:47 +0530
Subject: [PATCH] gpio/omap: enabled_non_wakeup_gpios check skips bank-saved_datain

Commit b3c64bc30af67ed328a8d919e41160942b870451
(gpio/omap: (re)fix wakeups on level-triggered GPIOs)
still skips update of bank-saved_datain in *_runtime_suspend()
which must be done irrespective of edge/level trigger types.
Therefore, move the enbaled_non_wakeup_gpios check after the
bank-saved_datain is updated.

Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
---
 drivers/gpio/gpio-omap.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index c4ed172..94ecdcf 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1177,9 +1177,6 @@ static int omap_gpio_runtime_suspend(struct device *dev)
 		__raw_writel(wake_hi | bank-context.risingdetect,
 			 bank-base + bank-regs-risingdetect);
 
-	if (!bank-enabled_non_wakeup_gpios)
-		goto update_gpio_context_count;
-
 	if (bank-power_mode != OFF_MODE) {
 		bank-power_mode = 0;
 		goto update_gpio_context_count;
@@ -1191,6 +1188,10 @@ static int omap_gpio_runtime_suspend(struct device *dev)
 	 */
 	bank-saved_datain = __raw_readl(bank-base +
 		bank-regs-datain);
+
+	if (!bank-enabled_non_wakeup_gpios)
+		goto update_gpio_context_count;
+
 	l1 = bank-context.fallingdetect;
 	l2 = bank-context.risingdetect;
 
-- 
1.7.0.4



Re: [PATCH 05/11] OMAPDSS: add clk_prepare and clk_unprepare

2012-06-26 Thread Rajendra Nayak

On Tuesday 26 June 2012 12:25 PM, Tomi Valkeinen wrote:

On Tue, 2012-06-26 at 10:30 +0530, Rajendra Nayak wrote:


So as far as I see, clocks are never handled in atomic context. Is
everything related to the base clk stuff already in mainline? Can I take
the clk_prepare/unprepare patch into my omapdss tree?


Well the Common Clk framework is already in mainline, but we still don;t
have CONFIG_COMMON_CLK enabled for our builds yet. So until we do so,
clk_prepare/unprepare will just be stubs which do nothing.


But if I understood correctly, clk_prepare and clk_unprepare are anyway
no-ops with dss clocks, even when CONFIG_COMMON_CLK is enabled?


With CONFIG_COMMON_CLK enabled, they will do prepare use-counting with
a mutex lock/unlock around it.



My point was only to understand if I can safely take the patch into
omapdss tree, instead of it going through l-o, to avoid any possible
conflicts.


yes, I don't see any issues with it going through dss tree.



  Tomi



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


Re: [PATCH v3 4/4] memory: emif: add device tree support to emif driver

2012-06-26 Thread Shilimkar, Santosh
On Tue, Jun 26, 2012 at 10:56 AM, Rajendra Nayak rna...@ti.com wrote:
 On Tuesday 26 June 2012 10:53 AM, Shilimkar, Santosh wrote:

 On Tue, Jun 26, 2012 at 10:49 AM, Rajendra Nayakrna...@ti.com  wrote:

 On Tuesday 26 June 2012 10:39 AM, Shilimkar, Santosh wrote:


 +#if defined(CONFIG_OF)

      +static const struct of_device_id emif_of_match[] = {
      +             { .compatible = ti,emif-4d },
      +             { .compatible = ti,emif-4d5 },
      +             {},
      +};
      +MODULE_DEVICE_TABLE(of, emif_of_match);
      +#endif
      +
        static struct platform_driver emif_driver = {
             .remove         = __exit_p(emif_remove),
             .shutdown       = emif_shutdown,
             .driver = {
                     .name = emif,
      +#if defined(CONFIG_OF)
      +             .of_match_table = of_match_ptr(emif_of_match),
      +#endif



  Are these two still #if defined needed?

  Also, what about the IS_DEFINED macro?


 Yes. To avoid the build break in !DT build.


 No, infact of_match_ptr is there just so you can avoid a
 #ifdef around and not break !CONFIG_OF.


 Need to recheck but the build was throwing error becasue of
 emif_of_match
 mostly.


 You still need the first one. I meant the second one around
 'of_match_ptr' should be removed.

 With !CONFIG_OF, of_match_ptr(_ptr) is just defined as NULL.

Yep. That make sense too.
Will drop the second check.

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


RE: [PATCH v4 3/3] ARM: OMAP2+: onenand: prepare for gpmc driver migration

2012-06-26 Thread Mohammed, Afzal
Hi Jon,

On Mon, Jun 25, 2012 at 21:42:14, Hunter, Jon wrote:
 On 06/22/2012 04:01 AM, Afzal Mohammed wrote:

  +static int hf, vhf, sync_read, sync_write, latency;
 
 I am wondering if we can remove hf, vhf, sync_read/write variables
 completely. We already have flags from sync_read/write and so we could
 just use the cfg-flags variable and remove sync_read/write variables.

For default frequency, sync_write can get turned off, so flag may or
may not be same as sync_write

 
 At the same time, we could create flags for ONENAND_FREQ_HF and
 ONENAND_FREQ_VHF or something like that. It could be nice to store the
 latency in onenand_data too. In other words, keep all the configuration
 in one place.

I have a feeling as though platform data fields should not be altered once
platform device is registered (as platform data being specific to the
board, thinking further, should they be const?, except for a case
where it is created by a common helper function for multiple boards with
varying capabilities of peripheral).

Other than sync_read, all others like hf, vhf, latency, sync_write are
updated during driver callback, so if we are going to put these in
platform private data fields, platform private data fields has to be
updated after platform device is registered.

Regards
Afzal
--
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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Jassi Brar
On 26 June 2012 12:49, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 On Mon, 2012-06-25 at 22:36 +0530, Jassi Brar wrote:

 
  Normally if the driver does dispc_runtime_get() and dispc_read_reg(),
  the first call will enable the HW so the reg read works.
 
  But if the pm_runtime is disabled, say, during system suspend, with your
  patch dispc_runtime_get() will just return 0 without doing anything, and
  the dispc_read_reg() will crash because the HW is disabled (because
  nobody enabled it).
 
 Hmm, I am not sure if new calls would/should be made to dispc.c after
 the system has suspended and before resumed. That is, anything other
 than from runtime_resume/suspend callbacks of DSS, DISPC, HDMI, VENC
 and RFBI, which rightly don't touch any dss reg but only
 enable/disable a clock.

 They do touch the registers. For example, dispc's callbacks save and
 restore the registers. The HW should be fully functional during the
 callbacks. The point of the callbacks is to suspend/resume the HW in
 question, which of course requires accessing the HW.

DISPC being held by HDMI, VENC and RFBI would be the last to suspend
and first to resume. And it won't have its registers touched between
dispc_runtime_suspend() and dispc_runtime_resume(), which seems ok to
me (?)
HDMI, VENC and RFBI directly fooling around with DISPC regs would have
been a problem, which isn't the case.

 As we know, a subsystem should make sure any active work is cleared
 out before suspending and set some flag so that nothing runs until it
 has resumed. I don't say we can't crash the system with this patch,
 but then we would be violating rules of suspend-resume.

 Let's go back a bit. I feel like I'm missing some pieces of information,
 as I still don't quite grasp the problem.

 In the patch you said this fixes an issue with HDMI. Can you tell more
 about the problem? What code path is being run? Any error messages?

 I tried system suspend with omap4-sdp and panda, with 3.5-rc2, but
 neither board seems to wake up from the suspend. Does it work for you?

Something non-omapdss in vanilla breaks suspend/resume.
Without this patch I see the upstream's display broken after the
suspend attempt.
$ echo mem  /sys/power/state

I work on TILT tree, which has suspend/resume working after some more
local patches.

http://git.linaro.org/gitweb?p=people/andygreen/kernel-tilt.git;a=shortlog;h=refs/heads/tilt-3.4

I don't have SDP so not sure, but it should simply be testable with
Panda4460 and the omap4plus_defconfig there.  Please feel free to ask
if you have any issue checking that out.

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


RE: [PATCH v4 1/3] ARM: OMAP2+: nand: unify init functions

2012-06-26 Thread Mohammed, Afzal
Hi Jon,

On Mon, Jun 25, 2012 at 20:59:57, Hunter, Jon wrote:
 On 06/22/2012 04:00 AM, Afzal Mohammed wrote:
  Helper function for updating nand platform data has been
  added the capability to take timing structure arguement.
  Usage of omap_nand_flash_init() has been replaced by modifed
  one, omap_nand_flash_init was doing things similar to
  board_nand_init except that NAND CS# were being acquired
  based on bootloader setting. As CS# is hardwired for a given
  board, acquiring gpmc CS# has been removed, and updated with
  the value on board.
  
  NAND CS# used in beagle board was found to be CS0.
  Thomas Weber thomas.weber.li...@googlemail.com reported
  that value of devkit8000 to be CS0. Overo board was found
  to be using CS0 based on u-boot, while google grep says
  omap3touchbook too has CS0.

 Reviewed-by: Jon Hunter jon-hun...@ti.com

Thanks,
Afzal
--
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 00/13] GPMC driver conversion

2012-06-26 Thread Mohammed, Afzal
Hi Tony,

On Fri, Jun 22, 2012 at 18:25:38, Mohammed, Afzal wrote:

 This series is based on 3.5-rc1, and is dependent on [1,2,3], and has
 been tested on omap3evm (smsc911x) rev G  C and beagle board(nand).
 Also using private patches, nand  onenand was tested on omap3evm,
 rev G  C respectively (as support for these were not in mainline)
 
 All boards will work using the old existing interface. Further patch
 series would convert all boards to use new interface.
 
 Many of GPMC peripherals depend on bootloader for configuration.
 This is going to be deprecated. feature-removal-schedule.txt will be
 updated in one of the upcoming patch series.
 
 Thanks to Tony  Jon for their various suggestions.
 
 [PATCH 03/13] ARM: OMAP2+: gpmc: driver migration helper, is to be
 reverted once all GPMC peripherals are migrated to use driver
 interface.

Please let me know your comments on this series.

Regards
Afzal
--
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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Tomi Valkeinen
On Tue, 2012-06-26 at 14:02 +0530, Jassi Brar wrote:

 Something non-omapdss in vanilla breaks suspend/resume.

I was able to reproduce (probably) the same issue with omap3 overo. Does
this looks familiar:

[ 2267.140197] [ cut here ]
[ 2267.145172] WARNING: at drivers/video/omap2/dss/dispc.c:377 
dispc_runtime_get+0x60/0x7c [omapdss]
()
[ 2267.154846] Modules linked in: omapfb panel_generic_dpi omapdss cfbimgblt 
cfbfillrect cfbcopyarea
 [last unloaded: omapdss]
[ 2267.166595] [c001b61c] (unwind_backtrace+0x0/0xf0) from [c0040238] 
(warn_slowpath_common+0x4c
/0x64)
[ 2267.176605] [c0040238] (warn_slowpath_common+0x4c/0x64) from [c004026c] 
(warn_slowpath_null+0
x1c/0x24)
[ 2267.186859] [c004026c] (warn_slowpath_null+0x1c/0x24) from [bf0d7918] 
(dispc_runtime_get+0x60
/0x7c [omapdss])
[ 2267.197814] [bf0d7918] (dispc_runtime_get+0x60/0x7c [omapdss]) from 
[bf0e3148] (omapdss_dpi_d
isplay_enable+0x48/0x230 [omapdss])
[ 2267.210479] [bf0e3148] (omapdss_dpi_display_enable+0x48/0x230 [omapdss]) 
from [bf110034] (gen
eric_dpi_panel_check_timings+0x30/0x7c [panel_generic_dpi])
[ 2267.225311] [bf110034] (generic_dpi_panel_check_timings+0x30/0x7c 
[panel_generic_dpi]) from [b
f11008c] (generic_dpi_panel_resume+0xc/0x1c [panel_generic_dpi])
[ 2267.240722] [bf11008c] (generic_dpi_panel_resume+0xc/0x1c 
[panel_generic_dpi]) from [bf0de654
] (dss_resume_device+0x28/0x40 [omapdss])
[ 2267.253936] [bf0de654] (dss_resume_device+0x28/0x40 [omapdss]) from 
[c02bfb94] (bus_for_each_
dev+0x50/0x7c)
[ 2267.264678] [c02bfb94] (bus_for_each_dev+0x50/0x7c) from [c02c287c] 
(platform_pm_resume+0x2c/
0x50)
[ 2267.274566] [c02c287c] (platform_pm_resume+0x2c/0x50) from [c02c6da8] 
(dpm_run_callback.clone
.7+0x30/0xb0)
[ 2267.285186] [c02c6da8] (dpm_run_callback.clone.7+0x30/0xb0) from 
[c02c7b2c] (device_resume+0x
c8/0x188)
[ 2267.295471] [c02c7b2c] (device_resume+0xc8/0x188) from [c02c7f54] 
(dpm_resume+0xfc/0x21c)
[ 2267.304534] [c02c7f54] (dpm_resume+0xfc/0x21c) from [c02c8208] 
(dpm_resume_end+0xc/0x18)
[ 2267.313507] [c02c8208] (dpm_resume_end+0xc/0x18) from [c007fbcc] 
(suspend_devices_and_enter+0
x15c/0x2d0)
[ 2267.323913] [c007fbcc] (suspend_devices_and_enter+0x15c/0x2d0) from 
[c007fecc] (pm_suspend+0x
18c/0x208)
[ 2267.334259] [c007fecc] (pm_suspend+0x18c/0x208) from [c007f170] 
(state_store+0x120/0x134)
[ 2267.343292] [c007f170] (state_store+0x120/0x134) from [c0262850] 
(kobj_attr_store+0x14/0x20)
[ 2267.352661] [c0262850] (kobj_attr_store+0x14/0x20) from [c0169b6c] 
(sysfs_write_file+0x100/0x
184)
[ 2267.362457] [c0169b6c] (sysfs_write_file+0x100/0x184) from [c0109008] 
(vfs_write+0xb4/0x148)
[ 2267.371795] [c0109008] (vfs_write+0xb4/0x148) from [c0109290] 
(sys_write+0x40/0x70)
[ 2267.380310] [c0109290] (sys_write+0x40/0x70) from [c0013d60] 
(ret_fast_syscall+0x0/0x3c)
[ 2267.389282] ---[ end trace 54fe7eea726ac84d ]---
[ 2267.394592] dpm_run_callback(): platform_pm_resume+0x0/0x50 returns -13
[ 2267.401641] PM: Device omapdss failed to resume: error -13

I don't remember seeing that with earlier kernel versions, but I'm not
100% sure.

Looking at the log, I can see that both DSS and DISPC runtime_resume
callbacks are called early, and successfully. Later the system resume
callback tries to enable the displays that were enabled when the system
went to suspend, which fails because dispc_runtime_get() returns -EACCES
(and pm_runtime_enabled() returns false).

Interestingly, during suspend dispc_runtime_put() is called, and at that
point pm_runtime_enabled() also returns false, but pm_runtime_put_sync()
still returns 0 instead of -EACCES.

I'll need to study this more, but I don't think this is a problem
related to omapdss's handling of runtime PM, but rather handling system
suspend. omapdss's handling of system suspend is in a rather bad state.

 Tomi



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


Re: [PATCH] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Andy Green

On 06/26/12 16:32, the mail apparently from Jassi Brar included:

On 26 June 2012 12:49, Tomi Valkeinen tomi.valkei...@ti.com wrote:

On Mon, 2012-06-25 at 22:36 +0530, Jassi Brar wrote:




Normally if the driver does dispc_runtime_get() and dispc_read_reg(),
the first call will enable the HW so the reg read works.

But if the pm_runtime is disabled, say, during system suspend, with your
patch dispc_runtime_get() will just return 0 without doing anything, and
the dispc_read_reg() will crash because the HW is disabled (because
nobody enabled it).


Hmm, I am not sure if new calls would/should be made to dispc.c after
the system has suspended and before resumed. That is, anything other
than from runtime_resume/suspend callbacks of DSS, DISPC, HDMI, VENC
and RFBI, which rightly don't touch any dss reg but only
enable/disable a clock.


They do touch the registers. For example, dispc's callbacks save and
restore the registers. The HW should be fully functional during the
callbacks. The point of the callbacks is to suspend/resume the HW in
question, which of course requires accessing the HW.


DISPC being held by HDMI, VENC and RFBI would be the last to suspend
and first to resume. And it won't have its registers touched between
dispc_runtime_suspend() and dispc_runtime_resume(), which seems ok to
me (?)
HDMI, VENC and RFBI directly fooling around with DISPC regs would have
been a problem, which isn't the case.


As we know, a subsystem should make sure any active work is cleared
out before suspending and set some flag so that nothing runs until it
has resumed. I don't say we can't crash the system with this patch,
but then we would be violating rules of suspend-resume.


Let's go back a bit. I feel like I'm missing some pieces of information,
as I still don't quite grasp the problem.

In the patch you said this fixes an issue with HDMI. Can you tell more
about the problem? What code path is being run? Any error messages?

I tried system suspend with omap4-sdp and panda, with 3.5-rc2, but
neither board seems to wake up from the suspend. Does it work for you?


Something non-omapdss in vanilla breaks suspend/resume.
Without this patch I see the upstream's display broken after the
suspend attempt.
 $ echo mem  /sys/power/state

I work on TILT tree, which has suspend/resume working after some more
local patches.
 
http://git.linaro.org/gitweb?p=people/andygreen/kernel-tilt.git;a=shortlog;h=refs/heads/tilt-3.4

I don't have SDP so not sure, but it should simply be testable with
Panda4460 and the omap4plus_defconfig there.  Please feel free to ask
if you have any issue checking that out.


We don't have access to Blaze and don't test that tree against it, but 
it's worth trying on PandaBoard ES which we do have and test against 
(omap4plus_defconfig).


Here, mem suspend is working with HDMI raster coming back on resume, but 
we don't always get a desktop redraw (suspending again can correct 
that).  Jassi's patches are present in this tree.


A slightly side-issue, I have a TV here that only issues hpd 700ms after 
the Panda provides 5V at the HDMI link.  It has always been touch-and-go 
if dss will recognize it or not, compared to a monitor which issues hpd 
high within some us of the link being powered.


The patches from Jassi about permanently enabling the external HDMI PHY 
chip section that performs level-conversion for hpd, and the existing 
work to use irq management of hpd, seems to have really solved detecting 
that TV for the first time.


-Andy

--
Andy Green | TI Landing Team Leader
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106  - 
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog



--
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 00/17] OMAPDSS: Misc DSS clean ups

2012-06-26 Thread Archit Taneja
This series does the following things:

- Remove passive matrix LCD support: There are no panel drivers with passive
  matrix LCD drivers in DSS2. There are no passive matrix panels even available
  to test with DSS. Since no one is using passive matrix panels, stop trying to
  support it. It cleans up the DSS driver.

- Add some new fields to omap_video_timings: There were some standard panel
  timing fields missing from omap_video_timings. Namely Hsync/Vsync/DE levels
  and interlace. Add these to omap_video_timings to align it more with xorg
  modeline. Add some other OMAP DSS specific fields to omap_video_timings.

- Remove some hacks done because omap_video_timings didn't have the above
  fields.

A branch with the patch set:

git://gitorious.org/~boddob/linux-omap-dss2/archit-dss2-clone.git dss_cleanup

This tree is based on:

git://gitorious.org/linux-omap-dss2/linux.git work/dss-rework-base

Tested on 3430sdp, 4430spd, Pandaboard ES.

Archit Taneja (17):
  OMAPDSS: Remove passive matrix LCD support (part 1)
  OMAPDSS: Remove passive matrix LCD support (part 2)
  OMAPDSS: Remove passive matrix LCD support (part 3)
  OMAPDSS: Remove passive matrix LCD support (part 4)
  OMAPDSS: Add some new fields to omap_video_timings
  OMAPDSS: DISPLAY: Ignore newly added omap_video_timings fields for
display timings sysfs file
  OMAPDSS: DISPC: Configure newly added omap_video_timing fields
  OMAPDSS: DISPC: Remove dispc_mgr_set_pol_freq()
  OMAPFB: Map the newly added omap_video_timings fields with fb sync
flags
  OMAPDRM: Map the newly added omap_video_timings fields with drm mode
flags
  OMAPDSS: Remove omap_panel_config enum from omap_dss_device
  OMAPDSS: Add interlace parameter to omap_video_timings
  OMAPDSS: DISPC/APPLY: Use interlace info in manager timings for
dispc_ovl_setup()
  OMAPFB: Map interlace field in omap_video_timings with fb vmode flags
  OMAPDRM: Map interlace field in omap_video_timings with drm mode
flags
  OMAPDSS: HDMI: Remove custom hdmi_video_timings struct
  OMAPDSS: DSI: Remove redundant fields in omap_dss_dsi_videomode_data

 drivers/staging/omapdrm/omap_connector.c   |   27 ++-
 drivers/video/omap2/displays/panel-acx565akm.c |6 +-
 drivers/video/omap2/displays/panel-generic-dpi.c   |  118 +-
 .../omap2/displays/panel-lgphilips-lb035q02.c  |5 +-
 drivers/video/omap2/displays/panel-n8x0.c  |1 -
 .../omap2/displays/panel-nec-nl8048hl11-01b.c  |7 +-
 drivers/video/omap2/displays/panel-picodlp.c   |7 +-
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |6 +-
 drivers/video/omap2/displays/panel-taal.c  |1 -
 drivers/video/omap2/displays/panel-tfp410.c|1 -
 .../video/omap2/displays/panel-tpo-td043mtea1.c|6 +-
 drivers/video/omap2/dss/apply.c|6 +-
 drivers/video/omap2/dss/dispc.c|  114 -
 drivers/video/omap2/dss/display.c  |6 +-
 drivers/video/omap2/dss/dpi.c  |   39 ++--
 drivers/video/omap2/dss/dsi.c  |   28 ++-
 drivers/video/omap2/dss/dss.c  |7 +-
 drivers/video/omap2/dss/dss.h  |   17 +-
 drivers/video/omap2/dss/hdmi.c |  241 +---
 drivers/video/omap2/dss/hdmi_panel.c   |8 +-
 drivers/video/omap2/dss/rfbi.c |3 +-
 drivers/video/omap2/dss/sdi.c  |   11 +-
 drivers/video/omap2/dss/ti_hdmi.h  |   19 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c  |8 +-
 drivers/video/omap2/dss/venc.c |4 +
 drivers/video/omap2/omapfb/omapfb-main.c   |   32 ++-
 include/video/omapdss.h|   55 +++--
 27 files changed, 474 insertions(+), 309 deletions(-)

-- 
1.7.9.5

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


[PATCH 01/17] OMAPDSS: Remove passive matrix LCD support (part 1)

2012-06-26 Thread Archit Taneja
Remove clock constraints related to passive matrix displays.

There is a constraint (pcd_min should be 3) for passive matrix displays. Remove
this constraint in clock divider calculations as we won't support passive
matrix displays any more.

This cleans up the functions which calculate the clock dividers with DSI's PLL
or DSS_FCLK as the clock source.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/dispc.c |5 +
 drivers/video/omap2/dss/dpi.c   |   28 +++-
 drivers/video/omap2/dss/dsi.c   |8 
 drivers/video/omap2/dss/dss.c   |7 +++
 drivers/video/omap2/dss/dss.h   |9 -
 drivers/video/omap2/dss/sdi.c   |3 +--
 6 files changed, 24 insertions(+), 36 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 0858024..3aa8c9c 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3127,7 +3127,7 @@ void dispc_mgr_set_pol_freq(enum omap_channel channel,
 }
 
 /* with fck as input clock rate, find dispc dividers that produce req_pck */
-void dispc_find_clk_divs(bool is_tft, unsigned long req_pck, unsigned long fck,
+void dispc_find_clk_divs(unsigned long req_pck, unsigned long fck,
struct dispc_clock_info *cinfo)
 {
u16 pcd_min, pcd_max;
@@ -3138,9 +3138,6 @@ void dispc_find_clk_divs(bool is_tft, unsigned long 
req_pck, unsigned long fck,
pcd_min = dss_feat_get_param_min(FEAT_PARAM_DSS_PCD);
pcd_max = dss_feat_get_param_max(FEAT_PARAM_DSS_PCD);
 
-   if (!is_tft)
-   pcd_min = 3;
-
best_pck = 0;
best_ld = 0;
best_pd = 0;
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 43bffc7..ca0e45a 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -78,7 +78,7 @@ static bool dpi_use_dsi_pll(struct omap_dss_device *dssdev)
lcd_src == OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC;
 }
 
-static int dpi_set_dsi_clk(struct omap_dss_device *dssdev, bool is_tft,
+static int dpi_set_dsi_clk(struct omap_dss_device *dssdev,
unsigned long pck_req, unsigned long *fck, int *lck_div,
int *pck_div)
 {
@@ -87,8 +87,8 @@ static int dpi_set_dsi_clk(struct omap_dss_device *dssdev, 
bool is_tft,
struct dispc_clock_info dispc_cinfo;
int r;
 
-   r = dsi_pll_calc_clock_div_pck(dpi.dsidev, is_tft, pck_req,
-   dsi_cinfo, dispc_cinfo);
+   r = dsi_pll_calc_clock_div_pck(dpi.dsidev, pck_req, dsi_cinfo,
+   dispc_cinfo);
if (r)
return r;
 
@@ -113,7 +113,7 @@ static int dpi_set_dsi_clk(struct omap_dss_device *dssdev, 
bool is_tft,
return 0;
 }
 
-static int dpi_set_dispc_clk(struct omap_dss_device *dssdev, bool is_tft,
+static int dpi_set_dispc_clk(struct omap_dss_device *dssdev,
unsigned long pck_req, unsigned long *fck, int *lck_div,
int *pck_div)
 {
@@ -121,7 +121,7 @@ static int dpi_set_dispc_clk(struct omap_dss_device 
*dssdev, bool is_tft,
struct dispc_clock_info dispc_cinfo;
int r;
 
-   r = dss_calc_clock_div(is_tft, pck_req, dss_cinfo, dispc_cinfo);
+   r = dss_calc_clock_div(pck_req, dss_cinfo, dispc_cinfo);
if (r)
return r;
 
@@ -146,20 +146,17 @@ static int dpi_set_mode(struct omap_dss_device *dssdev)
int lck_div = 0, pck_div = 0;
unsigned long fck = 0;
unsigned long pck;
-   bool is_tft;
int r = 0;
 
dispc_mgr_set_pol_freq(dssdev-manager-id, dssdev-panel.config,
dssdev-panel.acbi, dssdev-panel.acb);
 
-   is_tft = (dssdev-panel.config  OMAP_DSS_LCD_TFT) != 0;
-
if (dpi_use_dsi_pll(dssdev))
-   r = dpi_set_dsi_clk(dssdev, is_tft, t-pixel_clock * 1000,
-   fck, lck_div, pck_div);
+   r = dpi_set_dsi_clk(dssdev, t-pixel_clock * 1000, fck,
+   lck_div, pck_div);
else
-   r = dpi_set_dispc_clk(dssdev, is_tft, t-pixel_clock * 1000,
-   fck, lck_div, pck_div);
+   r = dpi_set_dispc_clk(dssdev, t-pixel_clock * 1000, fck,
+   lck_div, pck_div);
if (r)
return r;
 
@@ -315,7 +312,6 @@ EXPORT_SYMBOL(dpi_set_timings);
 int dpi_check_timings(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
 {
-   bool is_tft;
int r;
int lck_div, pck_div;
unsigned long fck;
@@ -328,11 +324,9 @@ int dpi_check_timings(struct omap_dss_device *dssdev,
if (timings-pixel_clock == 0)
return -EINVAL;
 
-   is_tft = (dssdev-panel.config  OMAP_DSS_LCD_TFT) != 0;
-
if (dpi_use_dsi_pll(dssdev)) {
struct dsi_clock_info dsi_cinfo;
-   r = 

[PATCH 02/17] OMAPDSS: Remove passive matrix lcd support (part 2)

2012-06-26 Thread Archit Taneja
Remove OMAP_DSS_LCD_TFT as a omap_panel_config flag.

We don't support passive matrix displays any more. Remove this flag from all the
panel drivers.

Force the display_type to OMAP_DSS_LCD_DISPLAY_TFT in the interface drivers.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/displays/panel-acx565akm.c |4 +-
 drivers/video/omap2/displays/panel-generic-dpi.c   |   61 
 .../omap2/displays/panel-lgphilips-lb035q02.c  |3 +-
 drivers/video/omap2/displays/panel-n8x0.c  |1 -
 .../omap2/displays/panel-nec-nl8048hl11-01b.c  |5 +-
 drivers/video/omap2/displays/panel-picodlp.c   |4 +-
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |3 +-
 drivers/video/omap2/displays/panel-taal.c  |1 -
 drivers/video/omap2/displays/panel-tfp410.c|1 -
 .../video/omap2/displays/panel-tpo-td043mtea1.c|4 +-
 drivers/video/omap2/dss/display.c  |4 --
 drivers/video/omap2/dss/dpi.c  |8 +--
 drivers/video/omap2/dss/hdmi_panel.c   |3 +-
 include/video/omapdss.h|2 -
 14 files changed, 37 insertions(+), 67 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-acx565akm.c 
b/drivers/video/omap2/displays/panel-acx565akm.c
index f7821f7..8264043 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -498,8 +498,8 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
struct backlight_properties props;
 
dev_dbg(dssdev-dev, %s\n, __func__);
-   dssdev-panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS;
+   dssdev-panel.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
+
/* FIXME AC bias ? */
dssdev-panel.timings = acx_panel_timings;
 
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c 
b/drivers/video/omap2/displays/panel-generic-dpi.c
index bd2700c..3e47490 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -76,8 +76,8 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x0,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IEO,
+   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
+   OMAP_DSS_LCD_IEO,
.power_on_delay = 50,
.power_off_delay= 100,
.name   = sharp_lq,
@@ -101,8 +101,7 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x28,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS,
+   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 50,
.power_off_delay= 100,
.name   = sharp_ls,
@@ -126,9 +125,9 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x0,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC |
-   OMAP_DSS_LCD_ONOFF,
+   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
+   OMAP_DSS_LCD_IPC |
+   OMAP_DSS_LCD_ONOFF,
.power_on_delay = 0,
.power_off_delay= 0,
.name   = toppoly_tdo35s,
@@ -152,8 +151,7 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x0,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS,
+   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 0,
.power_off_delay= 0,
.name   = samsung_lte430wq_f0c,
@@ -177,8 +175,7 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x0,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   

[PATCH 02/17] OMAPDSS: Remove passive matrix LCD support (part 2)

2012-06-26 Thread Archit Taneja
Remove OMAP_DSS_LCD_TFT as a omap_panel_config flag.

We don't support passive matrix displays any more. Remove this flag from all the
panel drivers.

Force the display_type to OMAP_DSS_LCD_DISPLAY_TFT in the interface drivers.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/displays/panel-acx565akm.c |4 +-
 drivers/video/omap2/displays/panel-generic-dpi.c   |   61 
 .../omap2/displays/panel-lgphilips-lb035q02.c  |3 +-
 drivers/video/omap2/displays/panel-n8x0.c  |1 -
 .../omap2/displays/panel-nec-nl8048hl11-01b.c  |5 +-
 drivers/video/omap2/displays/panel-picodlp.c   |4 +-
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |3 +-
 drivers/video/omap2/displays/panel-taal.c  |1 -
 drivers/video/omap2/displays/panel-tfp410.c|1 -
 .../video/omap2/displays/panel-tpo-td043mtea1.c|4 +-
 drivers/video/omap2/dss/display.c  |4 --
 drivers/video/omap2/dss/dpi.c  |8 +--
 drivers/video/omap2/dss/hdmi_panel.c   |3 +-
 include/video/omapdss.h|2 -
 14 files changed, 37 insertions(+), 67 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-acx565akm.c 
b/drivers/video/omap2/displays/panel-acx565akm.c
index f7821f7..8264043 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -498,8 +498,8 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
struct backlight_properties props;
 
dev_dbg(dssdev-dev, %s\n, __func__);
-   dssdev-panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS;
+   dssdev-panel.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
+
/* FIXME AC bias ? */
dssdev-panel.timings = acx_panel_timings;
 
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c 
b/drivers/video/omap2/displays/panel-generic-dpi.c
index bd2700c..3e47490 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -76,8 +76,8 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x0,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IEO,
+   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
+   OMAP_DSS_LCD_IEO,
.power_on_delay = 50,
.power_off_delay= 100,
.name   = sharp_lq,
@@ -101,8 +101,7 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x28,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS,
+   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 50,
.power_off_delay= 100,
.name   = sharp_ls,
@@ -126,9 +125,9 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x0,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC |
-   OMAP_DSS_LCD_ONOFF,
+   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
+   OMAP_DSS_LCD_IPC |
+   OMAP_DSS_LCD_ONOFF,
.power_on_delay = 0,
.power_off_delay= 0,
.name   = toppoly_tdo35s,
@@ -152,8 +151,7 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x0,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   OMAP_DSS_LCD_IHS,
+   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 0,
.power_off_delay= 0,
.name   = samsung_lte430wq_f0c,
@@ -177,8 +175,7 @@ static struct panel_config generic_dpi_panels[] = {
},
.acbi   = 0x0,
.acb= 0x0,
-   .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
-   

[PATCH 03/17] OMAPDSS: Remove passive matrix LCD support (part 3)

2012-06-26 Thread Archit Taneja
Remove omap_lcd_display_type enum

The enum omap_lcd_display_type is used to configure the lcd display type in
DISPC. Remove this enum and always set display type to TFT by creating function
dss_mgr_set_lcd_type_tft().

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/dispc.c |   23 +++
 drivers/video/omap2/dss/dpi.c   |4 ++--
 drivers/video/omap2/dss/dsi.c   |9 +
 drivers/video/omap2/dss/dss.h   |3 +--
 drivers/video/omap2/dss/rfbi.c  |3 +--
 drivers/video/omap2/dss/sdi.c   |3 +--
 include/video/omapdss.h |5 -
 7 files changed, 13 insertions(+), 37 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 3aa8c9c..01c81a7 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2439,29 +2439,12 @@ void dispc_mgr_enable_fifohandcheck(enum omap_channel 
channel, bool enable)
 }
 
 
-void dispc_mgr_set_lcd_display_type(enum omap_channel channel,
-   enum omap_lcd_display_type type)
+void dispc_mgr_set_lcd_type_tft(enum omap_channel channel)
 {
-   int mode;
-
-   switch (type) {
-   case OMAP_DSS_LCD_DISPLAY_STN:
-   mode = 0;
-   break;
-
-   case OMAP_DSS_LCD_DISPLAY_TFT:
-   mode = 1;
-   break;
-
-   default:
-   BUG();
-   return;
-   }
-
if (channel == OMAP_DSS_CHANNEL_LCD2)
-   REG_FLD_MOD(DISPC_CONTROL2, mode, 3, 3);
+   REG_FLD_MOD(DISPC_CONTROL2, 1, 3, 3);
else
-   REG_FLD_MOD(DISPC_CONTROL, mode, 3, 3);
+   REG_FLD_MOD(DISPC_CONTROL, 1, 3, 3);
 }
 
 void dispc_set_loadmode(enum omap_dss_load_mode mode)
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index e21955c..018be20 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -180,8 +180,8 @@ static void dpi_basic_init(struct omap_dss_device *dssdev)
dispc_mgr_set_io_pad_mode(DSS_IO_PAD_MODE_BYPASS);
dispc_mgr_enable_stallmode(dssdev-manager-id, false);
 
-   dispc_mgr_set_lcd_display_type(dssdev-manager-id,
-   OMAP_DSS_LCD_DISPLAY_TFT);
+   dispc_mgr_set_lcd_type_tft(dssdev-manager-id);
+
dispc_mgr_set_tft_data_lines(dssdev-manager-id,
dssdev-phy.dpi.data_lines);
 }
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 0eb5452..061bf53 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4383,10 +4383,11 @@ static int dsi_display_init_dispc(struct 
omap_dss_device *dssdev)
dss_mgr_set_timings(dssdev-manager, dssdev-panel.timings);
}
 
-   dispc_mgr_set_lcd_display_type(dssdev-manager-id,
-   OMAP_DSS_LCD_DISPLAY_TFT);
-   dispc_mgr_set_tft_data_lines(dssdev-manager-id,
-   dsi_get_pixel_size(dssdev-panel.dsi_pix_fmt));
+   dispc_mgr_set_lcd_type_tft(dssdev-manager-id);
+
+   dispc_mgr_set_tft_data_lines(dssdev-manager-id,
+   dsi_get_pixel_size(dssdev-panel.dsi_pix_fmt));
+
return 0;
 }
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index d33df16..ffbff49 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -411,8 +411,7 @@ bool dispc_mgr_is_channel_enabled(enum omap_channel 
channel);
 void dispc_mgr_set_io_pad_mode(enum dss_io_pad_mode mode);
 void dispc_mgr_enable_stallmode(enum omap_channel channel, bool enable);
 void dispc_mgr_set_tft_data_lines(enum omap_channel channel, u8 data_lines);
-void dispc_mgr_set_lcd_display_type(enum omap_channel channel,
-   enum omap_lcd_display_type type);
+void dispc_mgr_set_lcd_type_tft(enum omap_channel channel);
 void dispc_mgr_set_timings(enum omap_channel channel,
struct omap_video_timings *timings);
 void dispc_mgr_set_pol_freq(enum omap_channel channel,
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 3d8c206..45084d8 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -885,8 +885,7 @@ int omapdss_rfbi_display_enable(struct omap_dss_device 
*dssdev)
goto err1;
}
 
-   dispc_mgr_set_lcd_display_type(dssdev-manager-id,
-   OMAP_DSS_LCD_DISPLAY_TFT);
+   dispc_mgr_set_lcd_type_tft(dssdev-manager-id);
 
dispc_mgr_set_io_pad_mode(DSS_IO_PAD_MODE_RFBI);
dispc_mgr_enable_stallmode(dssdev-manager-id, true);
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index d07ecc4..1a369de 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -40,8 +40,7 @@ static void sdi_basic_init(struct omap_dss_device *dssdev)
dispc_mgr_set_io_pad_mode(DSS_IO_PAD_MODE_BYPASS);
dispc_mgr_enable_stallmode(dssdev-manager-id, 

[PATCH 04/17] OMAPDSS: Remove passive matrix LCD support (part 4)

2012-06-26 Thread Archit Taneja
Remove configuration of Ac-bias pins

Ac-bias pins need to be configured only for passive matrix displays. Remove
acbi and acb fields in omap_dss_device and their configuration in panel
drivers. Don't program these fields in DISP_POL_FREQo register any more.

The panel driver for sharp-ls037v7dw01, and the panel config for
Innolux AT070TN8 in generic dpi panel driver set acb to a non zero value. This
is most likely carried over from the old omapfb driver which supported passive
matrix displays.

Cc: Thomas Weber we...@corscience.de 
Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/displays/panel-generic-dpi.c   |   23 
 drivers/video/omap2/displays/panel-picodlp.c   |1 -
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |1 -
 drivers/video/omap2/dss/dispc.c|   14 +---
 drivers/video/omap2/dss/dpi.c  |3 +--
 drivers/video/omap2/dss/dss.h  |2 +-
 drivers/video/omap2/dss/sdi.c  |3 +--
 7 files changed, 8 insertions(+), 39 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c 
b/drivers/video/omap2/displays/panel-generic-dpi.c
index 3e47490..fe7e48c 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -40,10 +40,6 @@
 struct panel_config {
struct omap_video_timings timings;
 
-   int acbi;   /* ac-bias pin transitions per interrupt */
-   /* Unit: line clocks */
-   int acb;/* ac-bias pin frequency */
-
enum omap_panel_config config;
 
int power_on_delay;
@@ -74,8 +70,6 @@ static struct panel_config generic_dpi_panels[] = {
.vfp= 3,
.vbp= 2,
},
-   .acbi   = 0x0,
-   .acb= 0x0,
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
OMAP_DSS_LCD_IEO,
.power_on_delay = 50,
@@ -99,8 +93,6 @@ static struct panel_config generic_dpi_panels[] = {
.vfp= 1,
.vbp= 1,
},
-   .acbi   = 0x0,
-   .acb= 0x28,
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 50,
.power_off_delay= 100,
@@ -123,8 +115,6 @@ static struct panel_config generic_dpi_panels[] = {
.vsw= 2,
.vbp= 2,
},
-   .acbi   = 0x0,
-   .acb= 0x0,
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
OMAP_DSS_LCD_IPC |
OMAP_DSS_LCD_ONOFF,
@@ -149,8 +139,6 @@ static struct panel_config generic_dpi_panels[] = {
.vsw= 10,
.vbp= 12 - 10,
},
-   .acbi   = 0x0,
-   .acb= 0x0,
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 0,
.power_off_delay= 0,
@@ -173,8 +161,6 @@ static struct panel_config generic_dpi_panels[] = {
.vfp= 4,
.vbp= 11,
},
-   .acbi   = 0x0,
-   .acb= 0x0,
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 0,
.power_off_delay= 0,
@@ -197,8 +183,6 @@ static struct panel_config generic_dpi_panels[] = {
.vfp= 2,
.vbp= 2,
},
-   .acbi   = 0x0,
-   .acb= 0x0,
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
OMAP_DSS_LCD_IEO,
.power_on_delay = 0,
@@ -222,8 +206,6 @@ static struct panel_config generic_dpi_panels[] = {
.vfp= 12,
.vbp= 25,
},
-   .acbi   = 0x0,
-   .acb= 0x28,
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 0,
.power_off_delay= 0,
@@ -325,8 +307,6 @@ static struct panel_config generic_dpi_panels[] = {
.vfp= 1,

[PATCH 05/17] OMAPDSS: Add some new fields to omap_video_timings

2012-06-26 Thread Archit Taneja
Some panel timing related fields are contained in omap_panel_config in the form
of flags. The fields are:

- Hsync logic level
- Vsync logic level
- Data driven on rising/falling edge of pixel clock
- Output enable/Data enable logic level
- HSYNC/VSYNC driven on rising/falling edge of pixel clock

Out of these parameters, Hsync and Vsync logic levels are a part of the timings
in the Xorg modeline configuration. So it makes sense to move the to
omap_video_timings. The rest aren't a part of modeline, but it still makes
sense to move these since they are related to panel timings.

These fields stored in omap_panel_config in dssdev are configured for LCD
panels, and the corresponding LCD managers in the DISPC_POL_FREQo registers.

Add the above fields in omap_video_timings. Represent their state via new enums.
The parameter pclk_edge is configured via omap_dss_signal_level, however it
actually configures whether data is driven on the rising or falling edge. This
is a bit unclean, but it prevents us from creating another enum.

Add these parameters to the omap_video_timings instances in the panel drivers.
Keep the corresponding IVS, IHS, IPC, IEO, RF and ONOFF flags in
omap_panel_config for now. The struct will be removed later.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/displays/panel-acx565akm.c |3 ++
 drivers/video/omap2/displays/panel-generic-dpi.c   |   53 
 .../omap2/displays/panel-lgphilips-lb035q02.c  |3 ++
 .../omap2/displays/panel-nec-nl8048hl11-01b.c  |4 ++
 drivers/video/omap2/displays/panel-picodlp.c   |4 ++
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |3 ++
 .../video/omap2/displays/panel-tpo-td043mtea1.c|4 ++
 drivers/video/omap2/dss/hdmi_panel.c   |5 +-
 drivers/video/omap2/dss/sdi.c  |2 +
 include/video/omapdss.h|   37 ++
 10 files changed, 117 insertions(+), 1 deletion(-)

diff --git a/drivers/video/omap2/displays/panel-acx565akm.c 
b/drivers/video/omap2/displays/panel-acx565akm.c
index 8264043..067c8a8 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -487,6 +487,9 @@ static struct omap_video_timings acx_panel_timings = {
.vfp= 3,
.vsw= 3,
.vbp= 4,
+
+   .vsync_level= OMAPDSS_SIG_ACTIVE_LOW,
+   .hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
 };
 
 static int acx_panel_probe(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c 
b/drivers/video/omap2/displays/panel-generic-dpi.c
index fe7e48c..e5bba0b 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -69,6 +69,9 @@ static struct panel_config generic_dpi_panels[] = {
.vsw= 11,
.vfp= 3,
.vbp= 2,
+
+   .vsync_level= OMAPDSS_SIG_ACTIVE_LOW,
+   .hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
},
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
OMAP_DSS_LCD_IEO,
@@ -92,6 +95,9 @@ static struct panel_config generic_dpi_panels[] = {
.vsw= 1,
.vfp= 1,
.vbp= 1,
+
+   .vsync_level= OMAPDSS_SIG_ACTIVE_LOW,
+   .hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
},
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 50,
@@ -114,6 +120,11 @@ static struct panel_config generic_dpi_panels[] = {
.vfp= 4,
.vsw= 2,
.vbp= 2,
+
+   .vsync_level= OMAPDSS_SIG_ACTIVE_LOW,
+   .hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
+   .pclk_edge  = OMAPDSS_SIG_ACTIVE_LOW,
+   .hsync_vsync_edge   = 
OMAPDSS_DRIVE_SIG_FALLING_EDGE,
},
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
OMAP_DSS_LCD_IPC |
@@ -138,6 +149,9 @@ static struct panel_config generic_dpi_panels[] = {
.vfp= 4,
.vsw= 10,
.vbp= 12 - 10,
+
+   .vsync_level= OMAPDSS_SIG_ACTIVE_LOW,
+   .hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
},
.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 0,
@@ -160,6 

[PATCH 06/17] OMAPDSS: DISPLAY: Ignore newly added omap_video_timings fields for display timings sysfs file

2012-06-26 Thread Archit Taneja
The display sysfs file for viewing/storing display timings is something which
will be deprecated. The new omap_video_timings fields (hsync_level, vsync_level
and others) are not configurable or viewable via this sysfs file.

This prevents the need to make the input more configurable to take the new
fields and at the same time work without these fields for backward
compatibility.

In display_timings_store, the omap_video_timings struct used to set the timings
is initialized to the existing panel timings so that the new fields are taken in
correctly. The other fields are taken from the user as before.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/display.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/omap2/dss/display.c 
b/drivers/video/omap2/dss/display.c
index 37d6504..1d8198e 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -116,7 +116,7 @@ static ssize_t display_timings_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
 {
struct omap_dss_device *dssdev = to_dss_device(dev);
-   struct omap_video_timings t;
+   struct omap_video_timings t = dssdev-panel.timings;
int r, found;
 
if (!dssdev-driver-set_timings || !dssdev-driver-check_timings)
-- 
1.7.9.5

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


[PATCH 07/17] OMAPDSS: DISPC: Configure newly added omap_video_timing fields

2012-06-26 Thread Archit Taneja
Hsync, Vsync, Data enable enable logic levels and latching info of Data lanes,
Hsync and Vsync signals(with respect to pixel clock) are newly added parameters
in omap_video_timings.

Program these in dispc_mgr_set_lcd_timings. These will be configured when the
manager's timings are set via dss_mgr_set_timings().

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

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index d974be9..184d37b 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2620,9 +2620,16 @@ bool dispc_mgr_timings_ok(enum omap_channel channel,
 }
 
 static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw,
-   int hfp, int hbp, int vsw, int vfp, int vbp)
+   int hfp, int hbp, int vsw, int vfp, int vbp,
+   enum omap_dss_signal_level vsync_level,
+   enum omap_dss_signal_level hsync_level,
+   enum omap_dss_signal_level pclk_edge,
+   enum omap_dss_signal_level de_level,
+   enum omap_dss_signal_edge hsync_vsync_edge)
+
 {
-   u32 timing_h, timing_v;
+   u32 timing_h, timing_v, l;
+   bool onoff, rf;
 
if (cpu_is_omap24xx() || omap_rev()  OMAP3430_REV_ES3_0) {
timing_h = FLD_VAL(hsw-1, 5, 0) | FLD_VAL(hfp-1, 15, 8) |
@@ -2640,6 +2647,32 @@ static void _dispc_mgr_set_lcd_timings(enum omap_channel 
channel, int hsw,
 
dispc_write_reg(DISPC_TIMING_H(channel), timing_h);
dispc_write_reg(DISPC_TIMING_V(channel), timing_v);
+
+   switch (hsync_vsync_edge) {
+   case OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES:
+   onoff = false;
+   rf = false;
+   break;
+   case OMAPDSS_DRIVE_SIG_FALLING_EDGE:
+   onoff = true;
+   rf = false;
+   break;
+   case OMAPDSS_DRIVE_SIG_RISING_EDGE:
+   onoff = true;
+   rf = true;
+   break;
+   default:
+   BUG();
+   };
+
+   l = dispc_read_reg(DISPC_POL_FREQ(channel));
+   l |= FLD_VAL(onoff, 17, 17);
+   l |= FLD_VAL(rf, 16, 16);
+   l |= FLD_VAL(de_level, 15, 15);
+   l |= FLD_VAL(pclk_edge, 14, 14);
+   l |= FLD_VAL(hsync_level, 13, 13);
+   l |= FLD_VAL(vsync_level, 12, 12);
+   dispc_write_reg(DISPC_POL_FREQ(channel), l);
 }
 
 /* change name to mode? */
@@ -2659,7 +2692,8 @@ void dispc_mgr_set_timings(enum omap_channel channel,
 
if (dispc_mgr_is_lcd(channel)) {
_dispc_mgr_set_lcd_timings(channel, t.hsw, t.hfp, t.hbp, t.vsw,
-   t.vfp, t.vbp);
+   t.vfp, t.vbp, t.vsync_level, t.hsync_level,
+   t.pclk_edge, t.de_level, t.hsync_vsync_edge);
 
xtot = t.x_res + t.hfp + t.hsw + t.hbp;
ytot = t.y_res + t.vfp + t.vsw + t.vbp;
@@ -2670,6 +2704,9 @@ void dispc_mgr_set_timings(enum omap_channel channel,
DSSDBG(pck %u\n, timings-pixel_clock);
DSSDBG(hsw %d hfp %d hbp %d vsw %d vfp %d vbp %d\n,
t.hsw, t.hfp, t.hbp, t.vsw, t.vfp, t.vbp);
+   DSSDBG(vsync_level %d hsync_level %d pclk_edge %d de_level %d 
hsync_vsync_edge %d\n,
+   t.vsync_level, t.hsync_level, t.pclk_edge, t.de_level,
+   t.hsync_vsync_edge);
 
DSSDBG(hsync %luHz, vsync %luHz\n, ht, vt);
} else {
-- 
1.7.9.5

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


[PATCH 08/17] OMAPDSS: DISPC: Remove dispc_mgr_set_pol_freq()

2012-06-26 Thread Archit Taneja
dispc_mgr_set_pol_freq() configures the fields in the register DISPC_POL_FREQo.
All these fields have been moved to omap_video_timings struct, and are now
programmed in dispc_mgr_set_lcd_timings(). These will be configured when timings
are applied via dss_mgr_set_timings().

Remove dispc_mgr_set_pol_freq() and it's calls from the interface drivers.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/dispc.c |   29 -
 drivers/video/omap2/dss/dpi.c   |2 --
 drivers/video/omap2/dss/dss.h   |2 --
 drivers/video/omap2/dss/sdi.c   |2 --
 4 files changed, 35 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 184d37b..9b22563 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3113,35 +3113,6 @@ static void dispc_dump_regs(struct seq_file *s)
 #undef DUMPREG
 }
 
-static void _dispc_mgr_set_pol_freq(enum omap_channel channel, bool onoff,
-   bool rf, bool ieo, bool ipc, bool ihs, bool ivs)
-{
-   u32 l = 0;
-
-   DSSDBG(onoff %d rf %d ieo %d ipc %d ihs %d ivs %d\n,
-   onoff, rf, ieo, ipc, ihs, ivs);
-
-   l |= FLD_VAL(onoff, 17, 17);
-   l |= FLD_VAL(rf, 16, 16);
-   l |= FLD_VAL(ieo, 15, 15);
-   l |= FLD_VAL(ipc, 14, 14);
-   l |= FLD_VAL(ihs, 13, 13);
-   l |= FLD_VAL(ivs, 12, 12);
-
-   dispc_write_reg(DISPC_POL_FREQ(channel), l);
-}
-
-void dispc_mgr_set_pol_freq(enum omap_channel channel,
-   enum omap_panel_config config)
-{
-   _dispc_mgr_set_pol_freq(channel, (config  OMAP_DSS_LCD_ONOFF) != 0,
-   (config  OMAP_DSS_LCD_RF) != 0,
-   (config  OMAP_DSS_LCD_IEO) != 0,
-   (config  OMAP_DSS_LCD_IPC) != 0,
-   (config  OMAP_DSS_LCD_IHS) != 0,
-   (config  OMAP_DSS_LCD_IVS) != 0);
-}
-
 /* with fck as input clock rate, find dispc dividers that produce req_pck */
 void dispc_find_clk_divs(unsigned long req_pck, unsigned long fck,
struct dispc_clock_info *cinfo)
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index d8cc440..046a6fb 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -148,8 +148,6 @@ static int dpi_set_mode(struct omap_dss_device *dssdev)
unsigned long pck;
int r = 0;
 
-   dispc_mgr_set_pol_freq(dssdev-manager-id, dssdev-panel.config);
-
if (dpi_use_dsi_pll(dssdev))
r = dpi_set_dsi_clk(dssdev, t-pixel_clock * 1000, fck,
lck_div, pck_div);
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index d64f894..3d23a23 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -414,8 +414,6 @@ void dispc_mgr_set_tft_data_lines(enum omap_channel 
channel, u8 data_lines);
 void dispc_mgr_set_lcd_type_tft(enum omap_channel channel);
 void dispc_mgr_set_timings(enum omap_channel channel,
struct omap_video_timings *timings);
-void dispc_mgr_set_pol_freq(enum omap_channel channel,
-   enum omap_panel_config config);
 unsigned long dispc_mgr_lclk_rate(enum omap_channel channel);
 unsigned long dispc_mgr_pclk_rate(enum omap_channel channel);
 unsigned long dispc_core_clk_rate(void);
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 9330410..264efd5 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -82,8 +82,6 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)
 
dssdev-panel.timings.hsync_vsync_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE;
 
-   dispc_mgr_set_pol_freq(dssdev-manager-id, dssdev-panel.config);
-
r = dss_calc_clock_div(t-pixel_clock * 1000, dss_cinfo, dispc_cinfo);
if (r)
goto err_calc_clock_div;
-- 
1.7.9.5

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


[PATCH 09/17] OMAPFB: Map the newly added omap_video_timings fields with fb sync flags

2012-06-26 Thread Archit Taneja
Use the newly added fields in omap_video_timings(hsync, vsync and data_enable
logic levels and data, hsync and vsync latching related info) to
configure/retrieve corresponding sync flags in fb_var_screeninfo and
fb_videomode.

Out of the new fields, hsync_level and vsync_level can be mapped to the fb sync
flags FB_SYNC_HOR_HIGH_ACT and FB_SYNC_VERT_HIGH_ACT.

When converting fb mode to omap_video_timings, the fields which don't have an
equivalent parameter in fb are set to  the default values.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/omapfb/omapfb-main.c |   24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-main.c 
b/drivers/video/omap2/omapfb/omapfb-main.c
index 1dd8f2c..7c99725 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -733,6 +733,10 @@ int check_fb_var(struct fb_info *fbi, struct 
fb_var_screeninfo *var)
var-lower_margin = timings.vfp;
var-hsync_len = timings.hsw;
var-vsync_len = timings.vsw;
+   var-sync |= timings.hsync_level == OMAPDSS_SIG_ACTIVE_HIGH ?
+   FB_SYNC_HOR_HIGH_ACT : 0;
+   var-sync |= timings.vsync_level == OMAPDSS_SIG_ACTIVE_HIGH ?
+   FB_SYNC_VERT_HIGH_ACT : 0;
} else {
var-pixclock = 0;
var-left_margin = 0;
@@ -741,11 +745,11 @@ int check_fb_var(struct fb_info *fbi, struct 
fb_var_screeninfo *var)
var-lower_margin = 0;
var-hsync_len = 0;
var-vsync_len = 0;
+   var-sync = 0;
}
 
/* TODO: get these from panel-config */
var-vmode  = FB_VMODE_NONINTERLACED;
-   var-sync   = 0;
 
return 0;
 }
@@ -2053,6 +2057,15 @@ static int omapfb_mode_to_timings(const char *mode_str,
timings-vsw = var-vsync_len;
timings-x_res = var-xres;
timings-y_res = var-yres;
+   timings-hsync_level = var-sync  FB_SYNC_HOR_HIGH_ACT ?
+   OMAPDSS_SIG_ACTIVE_HIGH :
+   OMAPDSS_SIG_ACTIVE_LOW;
+   timings-vsync_level = var-sync  FB_SYNC_VERT_HIGH_ACT ?
+   OMAPDSS_SIG_ACTIVE_HIGH :
+   OMAPDSS_SIG_ACTIVE_LOW;
+   timings-pclk_edge = OMAPDSS_SIG_ACTIVE_HIGH;
+   timings-de_level = OMAPDSS_SIG_ACTIVE_HIGH;
+   timings-hsync_vsync_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
 
switch (var-bits_per_pixel) {
case 16:
@@ -2187,6 +2200,15 @@ static void fb_videomode_to_omap_timings(struct 
fb_videomode *m,
t-vsw = m-vsync_len;
t-vfp = m-lower_margin;
t-vbp = m-upper_margin;
+   t-hsync_level = m-sync  FB_SYNC_HOR_HIGH_ACT ?
+   OMAPDSS_SIG_ACTIVE_HIGH :
+   OMAPDSS_SIG_ACTIVE_LOW;
+   t-vsync_level = m-sync  FB_SYNC_VERT_HIGH_ACT ?
+   OMAPDSS_SIG_ACTIVE_HIGH :
+   OMAPDSS_SIG_ACTIVE_LOW;
+   t-pclk_edge = OMAPDSS_SIG_ACTIVE_HIGH;
+   t-de_level = OMAPDSS_SIG_ACTIVE_HIGH;
+   t-hsync_vsync_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
 }
 
 static int omapfb_find_best_mode(struct omap_dss_device *display,
-- 
1.7.9.5

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


[PATCH 10/17] OMAPDRM: Map the newly added omap_video_timings fields with drm mode flags

2012-06-26 Thread Archit Taneja
Use the newly added fields in omap_video_timings(hsync, vsync and data_enable
logic levels and data, hsync and vsync latching related info) to
configure/retrieve corresponding drm mode flags in drm_display_mode.

Out of the new fields, hsync_level and vsync_level can be mapped to the drm mode
flags DRM_MODE_FLAG_PHSYNC, DRM_MODE_FLAG_NHSYNC, DRM_MODE_FLAG_PVSYNC and
DRM_MODE_FLAG_NVSYNC

When converting drm mode to omap_video_timings, the fields which don't have an
equivalent parameter in drm mode are set to the default values.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/staging/omapdrm/omap_connector.c |   22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/omapdrm/omap_connector.c 
b/drivers/staging/omapdrm/omap_connector.c
index 5e2856c..157f6ec 100644
--- a/drivers/staging/omapdrm/omap_connector.c
+++ b/drivers/staging/omapdrm/omap_connector.c
@@ -48,13 +48,11 @@ static inline void copy_timings_omap_to_drm(struct 
drm_display_mode *mode,
mode-vsync_end = mode-vsync_start + timings-vsw;
mode-vtotal = mode-vsync_end + timings-vbp;
 
-   /* note: whether or not it is interlaced, +/- h/vsync, etc,
-* which should be set in the mode flags, is not exposed in
-* the omap_video_timings struct.. but hdmi driver tracks
-* those separately so all we have to have to set the mode
-* is the way to recover these timings values, and the
-* omap_dss_driver would do the rest.
-*/
+   mode-flags |= timings-hsync_level == OMAPDSS_SIG_ACTIVE_HIGH ?
+   DRM_MODE_FLAG_PHSYNC : DRM_MODE_FLAG_NHSYNC;
+
+   mode-flags |= timings-vsync_level == OMAPDSS_SIG_ACTIVE_HIGH ?
+   DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC;
 }
 
 static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings,
@@ -71,6 +69,16 @@ static inline void copy_timings_drm_to_omap(struct 
omap_video_timings *timings,
timings-vfp = mode-vsync_start - mode-vdisplay;
timings-vsw = mode-vsync_end - mode-vsync_start;
timings-vbp = mode-vtotal - mode-vsync_end;
+
+   timings-hsync_level = mode-flags  DRM_MODE_FLAG_PHSYNC ?
+   OMAPDSS_SIG_ACTIVE_HIGH : OMAPDSS_SIG_ACTIVE_LOW;
+
+   timings-vsync_level = mode-flags  DRM_MODE_FLAG_PVSYNC ?
+   OMAPDSS_SIG_ACTIVE_HIGH : OMAPDSS_SIG_ACTIVE_LOW;
+
+   timings-pclk_edge = OMAPDSS_SIG_ACTIVE_HIGH;
+   timings-de_level = OMAPDSS_SIG_ACTIVE_HIGH;
+   timings-hsync_vsync_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
 }
 
 static void omap_connector_dpms(struct drm_connector *connector, int mode)
-- 
1.7.9.5

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


[PATCH 11/17] OMAPDSS: Remove omap_panel_config enum from omap_dss_device

2012-06-26 Thread Archit Taneja
omap_panel_config contains fields which are finally written to DISPC_POL_FREQo
registers. These are now held by omap_video_timings and are set when the manager
timings are applied.

Remove the omap_panel_config enum, and remove all it's references from panel or
interface drivers.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/displays/panel-acx565akm.c |1 -
 drivers/video/omap2/displays/panel-generic-dpi.c   |   29 
 .../omap2/displays/panel-lgphilips-lb035q02.c  |1 -
 .../omap2/displays/panel-nec-nl8048hl11-01b.c  |2 --
 drivers/video/omap2/displays/panel-picodlp.c   |2 --
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |1 -
 .../video/omap2/displays/panel-tpo-td043mtea1.c|2 --
 drivers/video/omap2/dss/hdmi_panel.c   |2 --
 drivers/video/omap2/dss/sdi.c  |2 --
 include/video/omapdss.h|   11 
 10 files changed, 53 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-acx565akm.c 
b/drivers/video/omap2/displays/panel-acx565akm.c
index 067c8a8..c6a2d51 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -501,7 +501,6 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
struct backlight_properties props;
 
dev_dbg(dssdev-dev, %s\n, __func__);
-   dssdev-panel.config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
 
/* FIXME AC bias ? */
dssdev-panel.timings = acx_panel_timings;
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c 
b/drivers/video/omap2/displays/panel-generic-dpi.c
index e5bba0b..96e3d2b 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -40,8 +40,6 @@
 struct panel_config {
struct omap_video_timings timings;
 
-   enum omap_panel_config config;
-
int power_on_delay;
int power_off_delay;
 
@@ -73,8 +71,6 @@ static struct panel_config generic_dpi_panels[] = {
.vsync_level= OMAPDSS_SIG_ACTIVE_LOW,
.hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
},
-   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
-   OMAP_DSS_LCD_IEO,
.power_on_delay = 50,
.power_off_delay= 100,
.name   = sharp_lq,
@@ -99,7 +95,6 @@ static struct panel_config generic_dpi_panels[] = {
.vsync_level= OMAPDSS_SIG_ACTIVE_LOW,
.hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
},
-   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 50,
.power_off_delay= 100,
.name   = sharp_ls,
@@ -126,9 +121,6 @@ static struct panel_config generic_dpi_panels[] = {
.pclk_edge  = OMAPDSS_SIG_ACTIVE_LOW,
.hsync_vsync_edge   = 
OMAPDSS_DRIVE_SIG_FALLING_EDGE,
},
-   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
-   OMAP_DSS_LCD_IPC |
-   OMAP_DSS_LCD_ONOFF,
.power_on_delay = 0,
.power_off_delay= 0,
.name   = toppoly_tdo35s,
@@ -153,7 +145,6 @@ static struct panel_config generic_dpi_panels[] = {
.vsync_level= OMAPDSS_SIG_ACTIVE_LOW,
.hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
},
-   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 0,
.power_off_delay= 0,
.name   = samsung_lte430wq_f0c,
@@ -178,7 +169,6 @@ static struct panel_config generic_dpi_panels[] = {
.vsync_level= OMAPDSS_SIG_ACTIVE_LOW,
.hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
},
-   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
.power_on_delay = 0,
.power_off_delay= 0,
.name   = seiko_70wvw1tz3,
@@ -204,8 +194,6 @@ static struct panel_config generic_dpi_panels[] = {
.hsync_level= OMAPDSS_SIG_ACTIVE_LOW,
.de_level   = OMAPDSS_SIG_ACTIVE_LOW,
},
-   .config = OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS |
-   OMAP_DSS_LCD_IEO,
.power_on_delay = 0,
.power_off_delay= 0,
.name   = 

[PATCH 12/17] OMAPDSS: Add interlace parameter to omap_video_timings

2012-06-26 Thread Archit Taneja
Add a parameter called interlace which tells whether the timings are in
interlaced or progressive mode. This aligns the omap_video_timings struct with
the Xorg modeline configuration.

It also removes the hack needed to write to divide the manager height by 2 if
the connected interface is VENC.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/dispc.c |6 +-
 drivers/video/omap2/dss/venc.c  |4 
 include/video/omapdss.h |3 +++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 9b22563..92b6428 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2710,11 +2710,7 @@ void dispc_mgr_set_timings(enum omap_channel channel,
 
DSSDBG(hsync %luHz, vsync %luHz\n, ht, vt);
} else {
-   enum dss_hdmi_venc_clk_source_select source;
-
-   source = dss_get_hdmi_venc_clk_source();
-
-   if (source == DSS_VENC_TV_CLK)
+   if (t.interlace == true)
t.y_res /= 2;
}
 
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 3552305..494f763 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -272,6 +272,8 @@ const struct omap_video_timings omap_dss_pal_timings = {
.vsw= 5,
.vfp= 5,
.vbp= 41,
+
+   .interlace  = true,
 };
 EXPORT_SYMBOL(omap_dss_pal_timings);
 
@@ -285,6 +287,8 @@ const struct omap_video_timings omap_dss_ntsc_timings = {
.vsw= 6,
.vfp= 6,
.vbp= 31,
+
+   .interlace  = true,
 };
 EXPORT_SYMBOL(omap_dss_ntsc_timings);
 
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 5de5c9c..1498bb3 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -390,6 +390,9 @@ struct omap_video_timings {
 * default value: OMAPDSS_SIG_ACTIVE_HIGH
 */
enum omap_dss_signal_level hsync_level;
+
+   /* Interlaced or Progressive timings */
+   bool interlace;
/*
 * Pixel clock edge to drive LCD data
 * default value: OMAPDSS_SIG_ACTIVE_HIGH
-- 
1.7.9.5

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


[PATCH 13/17] OMAPDSS: DISPC/APPLY: Use interlace info in manager timings for dispc_ovl_setup()

2012-06-26 Thread Archit Taneja
Currently the interlace parameter passed to dispc_ovl_setup() is configured by
checking the display type, and set to true if the display type is VENC.

This isn't correct as other panels can take interlaced content too. The
omap_video_timings struct in manager's private data contains the info whether
the panel is in interlaced mode or not.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/apply.c |6 ++
 drivers/video/omap2/dss/dispc.c |4 ++--
 drivers/video/omap2/dss/dss.h   |3 +--
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index ab22cc2..3ce7a3e 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -537,7 +537,7 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
 {
struct ovl_priv_data *op = get_ovl_priv(ovl);
struct omap_overlay_info *oi;
-   bool ilace, replication;
+   bool replication;
struct mgr_priv_data *mp;
int r;
 
@@ -552,9 +552,7 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
 
replication = dss_use_replication(ovl-manager-device, oi-color_mode);
 
-   ilace = ovl-manager-device-type == OMAP_DISPLAY_TYPE_VENC;
-
-   r = dispc_ovl_setup(ovl-id, oi, ilace, replication, mp-timings);
+   r = dispc_ovl_setup(ovl-id, oi, replication, mp-timings);
if (r) {
/*
 * We can't do much here, as this function can be called from
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 92b6428..c0b82c6 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2086,8 +2086,7 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane,
 }
 
 int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
-   bool ilace, bool replication,
-   const struct omap_video_timings *mgr_timings)
+   bool replication, const struct omap_video_timings *mgr_timings)
 {
struct omap_overlay *ovl = omap_dss_get_overlay(plane);
bool five_taps = true;
@@ -2103,6 +2102,7 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
u16 out_width, out_height;
enum omap_channel channel;
int x_predecim = 1, y_predecim = 1;
+   bool ilace = mgr_timings-interlace;
 
channel = dispc_ovl_get_channel_out(plane);
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 3d23a23..20151d5 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -394,8 +394,7 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane 
plane,
u32 *fifo_low, u32 *fifo_high, bool use_fifomerge,
bool manual_update);
 int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
-   bool ilace, bool replication,
-   const struct omap_video_timings *mgr_timings);
+   bool replication, const struct omap_video_timings *mgr_timings);
 int dispc_ovl_enable(enum omap_plane plane, bool enable);
 void dispc_ovl_set_channel_out(enum omap_plane plane,
enum omap_channel channel);
-- 
1.7.9.5

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


[PATCH 14/17] OMAPFB: Map interlace field in omap_video_timings with fb vmode flags

2012-06-26 Thread Archit Taneja
Use the interlace field in omap_video_timings to configure/retrieve
corresponding fb mode flags in fb_var_screeninfo and fb_videomode.

The interlace field maps with the fb mode flags FB_VMODE_INTERLACED and
FB_VMODE_NONINTERLACED.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/omapfb/omapfb-main.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-main.c 
b/drivers/video/omap2/omapfb/omapfb-main.c
index 7c99725..434aa9a 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -737,6 +737,8 @@ int check_fb_var(struct fb_info *fbi, struct 
fb_var_screeninfo *var)
FB_SYNC_HOR_HIGH_ACT : 0;
var-sync |= timings.vsync_level == OMAPDSS_SIG_ACTIVE_HIGH ?
FB_SYNC_VERT_HIGH_ACT : 0;
+   var-vmode = timings.interlace ?
+   FB_VMODE_INTERLACED : FB_VMODE_NONINTERLACED;
} else {
var-pixclock = 0;
var-left_margin = 0;
@@ -746,11 +748,9 @@ int check_fb_var(struct fb_info *fbi, struct 
fb_var_screeninfo *var)
var-hsync_len = 0;
var-vsync_len = 0;
var-sync = 0;
+   var-vmode = FB_VMODE_NONINTERLACED;
}
 
-   /* TODO: get these from panel-config */
-   var-vmode  = FB_VMODE_NONINTERLACED;
-
return 0;
 }
 
@@ -2063,6 +2063,7 @@ static int omapfb_mode_to_timings(const char *mode_str,
timings-vsync_level = var-sync  FB_SYNC_VERT_HIGH_ACT ?
OMAPDSS_SIG_ACTIVE_HIGH :
OMAPDSS_SIG_ACTIVE_LOW;
+   timings-interlace = var-vmode  FB_VMODE_INTERLACED;
timings-pclk_edge = OMAPDSS_SIG_ACTIVE_HIGH;
timings-de_level = OMAPDSS_SIG_ACTIVE_HIGH;
timings-hsync_vsync_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
@@ -2206,6 +2207,7 @@ static void fb_videomode_to_omap_timings(struct 
fb_videomode *m,
t-vsync_level = m-sync  FB_SYNC_VERT_HIGH_ACT ?
OMAPDSS_SIG_ACTIVE_HIGH :
OMAPDSS_SIG_ACTIVE_LOW;
+   t-interlace = m-vmode  FB_VMODE_INTERLACED;
t-pclk_edge = OMAPDSS_SIG_ACTIVE_HIGH;
t-de_level = OMAPDSS_SIG_ACTIVE_HIGH;
t-hsync_vsync_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
-- 
1.7.9.5

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


[PATCH 15/17] OMAPDRM: Map interlace field in omap_video_timings with drm mode flags

2012-06-26 Thread Archit Taneja
Use the interlace field in omap_video_timings to configure/retrieve
corresponding flags in drm_display_mode.

The interlace field maps with the drm mode flag DRM_MODE_FLAG_INTERLACE.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/staging/omapdrm/omap_connector.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/omapdrm/omap_connector.c 
b/drivers/staging/omapdrm/omap_connector.c
index 157f6ec..05dda41 100644
--- a/drivers/staging/omapdrm/omap_connector.c
+++ b/drivers/staging/omapdrm/omap_connector.c
@@ -53,6 +53,8 @@ static inline void copy_timings_omap_to_drm(struct 
drm_display_mode *mode,
 
mode-flags |= timings-vsync_level == OMAPDSS_SIG_ACTIVE_HIGH ?
DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC;
+
+   mode-flags |= timings-interlace ? DRM_MODE_FLAG_INTERLACE : 0;
 }
 
 static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings,
@@ -76,6 +78,9 @@ static inline void copy_timings_drm_to_omap(struct 
omap_video_timings *timings,
timings-vsync_level = mode-flags  DRM_MODE_FLAG_PVSYNC ?
OMAPDSS_SIG_ACTIVE_HIGH : OMAPDSS_SIG_ACTIVE_LOW;
 
+   timings-interlace = mode-flags  DRM_MODE_FLAG_INTERLACE ?
+   true : false;
+
timings-pclk_edge = OMAPDSS_SIG_ACTIVE_HIGH;
timings-de_level = OMAPDSS_SIG_ACTIVE_HIGH;
timings-hsync_vsync_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
-- 
1.7.9.5

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


[PATCH 16/17] OMAPDSS: HDMI: Remove custom hdmi_video_timings struct

2012-06-26 Thread Archit Taneja
The hdmi CEA and VESA timings were represented by the struct hdmi_video_timings,
omap_video_timings couldn't be used as it didn't contain the fields hsync/vsync
polarities and interlaced/progressive information.

Remove hdmi_video_timings, and use omap_video_timings instead.

Cc: Mythri P K mythr...@ti.com
Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/hdmi.c|  241 -
 drivers/video/omap2/dss/ti_hdmi.h |   19 +--
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |8 +-
 3 files changed, 213 insertions(+), 55 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 34910bc..46fb1be 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -78,43 +78,214 @@ static struct {
  */
 
 static const struct hdmi_config cea_timings[] = {
-{ {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
-{ {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
-{ {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
-{ {1920, 540, 74250, 44, 88, 148, 5, 2, 15, 1, 1, 1}, {5, HDMI_HDMI} },
-{ {1440, 240, 27027, 124, 38, 114, 3, 4, 15, 0, 0, 1}, {6, HDMI_HDMI} },
-{ {1920, 1080, 148500, 44, 88, 148, 5, 4, 36, 1, 1, 0}, {16, HDMI_HDMI} },
-{ {720, 576, 27000, 64, 12, 68, 5, 5, 39, 0, 0, 0}, {17, HDMI_HDMI} },
-{ {1280, 720, 74250, 40, 440, 220, 5, 5, 20, 1, 1, 0}, {19, HDMI_HDMI} },
-{ {1920, 540, 74250, 44, 528, 148, 5, 2, 15, 1, 1, 1}, {20, HDMI_HDMI} },
-{ {1440, 288, 27000, 126, 24, 138, 3, 2, 19, 0, 0, 1}, {21, HDMI_HDMI} },
-{ {1440, 576, 54000, 128, 24, 136, 5, 5, 39, 0, 0, 0}, {29, HDMI_HDMI} },
-{ {1920, 1080, 148500, 44, 528, 148, 5, 4, 36, 1, 1, 0}, {31, HDMI_HDMI} },
-{ {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
-{ {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
-{ {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+   {
+   { 640, 480, 25200, 96, 16, 48, 2, 10, 33,
+   OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
+   false, },
+   { 1, HDMI_HDMI },
+   },
+   {
+   { 720, 480, 27027, 62, 16, 60, 6, 9, 30,
+   OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
+   false, },
+   { 2, HDMI_HDMI },
+   },
+   {
+   { 1280, 720, 74250, 40, 110, 220, 5, 5, 20,
+   OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
+   false, },
+   { 4, HDMI_HDMI },
+   },
+   {
+   { 1920, 540, 74250, 44, 88, 148, 5, 2, 15,
+   OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
+   true, },
+   { 5, HDMI_HDMI },
+   },
+   {
+   { 1440, 240, 27027, 124, 38, 114, 3, 4, 15,
+   OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
+   true, },
+   { 6, HDMI_HDMI },
+   },
+   {
+   { 1920, 1080, 148500, 44, 88, 148, 5, 4, 36,
+   OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
+   false, },
+   { 16, HDMI_HDMI },
+   },
+   {
+   { 720, 576, 27000, 64, 12, 68, 5, 5, 39,
+   OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
+   false, },
+   { 17, HDMI_HDMI },
+   },
+   {
+   { 1280, 720, 74250, 40, 440, 220, 5, 5, 20,
+   OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
+   false, },
+   { 19, HDMI_HDMI },
+   },
+   {
+   { 1920, 540, 74250, 44, 528, 148, 5, 2, 15,
+   OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
+   true, },
+   { 20, HDMI_HDMI },
+   },
+   {
+   { 1440, 288, 27000, 126, 24, 138, 3, 2, 19,
+   OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
+   true, },
+   { 21, HDMI_HDMI },
+   },
+   {
+   { 1440, 576, 54000, 128, 24, 136, 5, 5, 39,
+   OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
+   false, },
+   { 29, HDMI_HDMI },
+   },
+   {
+   { 1920, 1080, 148500, 44, 528, 148, 5, 4, 36,
+   OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
+   false, },
+   { 31, HDMI_HDMI },
+   },
+   {
+   { 1920, 1080, 74250, 44, 638, 148, 5, 4, 36,
+   OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
+   false, },
+   { 32, HDMI_HDMI },
+   },
+   {
+   { 2880, 480, 108108, 248, 64, 240, 6, 9, 30,
+   OMAPDSS_SIG_ACTIVE_LOW, 

[PATCH 17/17] OMAPDSS: DSI: Remove redundant fields in omap_dss_dsi_videomode_data

2012-06-26 Thread Archit Taneja
The struct omap_dss_dsi_videomode_data holds polaritiy/logic level information
of the DISPC video port signals DE, HSYNC and VSYNC. This information already
exists in the omap_video_timings struct.

Use the fields in omap_video_timings to program VP_DE_POL, VP_HSYNC_POL and
VP_VSYNC_POL in DSI_CTRL. Remove the redundant fields in
omap_dss_dsi_videomode_data.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/dsi.c |   11 ---
 include/video/omapdss.h   |3 ---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 061bf53..3844430 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -3628,13 +3628,18 @@ static void dsi_config_vp_num_line_buffers(struct 
omap_dss_device *dssdev)
 static void dsi_config_vp_sync_events(struct omap_dss_device *dssdev)
 {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
-   int de_pol = dssdev-panel.dsi_vm_data.vp_de_pol;
-   int hsync_pol = dssdev-panel.dsi_vm_data.vp_hsync_pol;
-   int vsync_pol = dssdev-panel.dsi_vm_data.vp_vsync_pol;
+   int de_pol, hsync_pol, vsync_pol;
+   int de_level = dssdev-panel.timings.de_level;
+   int hsync_level = dssdev-panel.timings.hsync_level;
+   int vsync_level = dssdev-panel.timings.vsync_level;
bool vsync_end = dssdev-panel.dsi_vm_data.vp_vsync_end;
bool hsync_end = dssdev-panel.dsi_vm_data.vp_hsync_end;
u32 r;
 
+   de_pol = de_level == OMAPDSS_SIG_ACTIVE_HIGH ? 1 : 0;
+   hsync_pol = hsync_level == OMAPDSS_SIG_ACTIVE_HIGH ? 1 : 0;
+   vsync_pol = vsync_level == OMAPDSS_SIG_ACTIVE_HIGH ? 1 : 0;
+
r = dsi_read_reg(dsidev, DSI_CTRL);
r = FLD_MOD(r, de_pol, 9, 9);   /* VP_DE_POL */
r = FLD_MOD(r, hsync_pol, 10, 10);  /* VP_HSYNC_POL */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 1498bb3..f627ad9 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -255,9 +255,6 @@ struct omap_dss_dsi_videomode_data {
int hfp_blanking_mode;
 
/* Video port sync events */
-   int vp_de_pol;
-   int vp_hsync_pol;
-   int vp_vsync_pol;
bool vp_vsync_end;
bool vp_hsync_end;
 
-- 
1.7.9.5

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


Re: [PATCH V3 1/2] of: Add generic device tree DMA helpers

2012-06-26 Thread Vinod Koul
On Mon, 2012-06-25 at 20:30 +, Arnd Bergmann wrote:
 dma_request_channel is called with some information about the channel
 provided in its arguments, and the driver might get that from a number
 of places.
Today, we just ask for a channel with specific mask. Further filtering
is done in filter function as we request a channel, not a specific one.
In most slave cases, we need a specific channel from a specific
controller, and that is where DT can play a role. In addition to DMA
resources for dma and client driver, I would expect DT to provide the
channel mapping information, which is anyway known only by platform.
That should be a dmaengine binding and not client or controller
specific. For different platforms this information can come from DT or
something else.
Then, once a channel is requested dmaengine knows what to provide.
And as you see the filter becomes redundant.

 In the case of having a fully populated device tree with this binding,
 the driver calling (of_)dma_request_channel does not need to know about
 any of that information because we should be able to encapsulate that
 completely in device tree data. It does not replace the regular interface
 but wraps around it to provide a higher abstraction level where possible.
 
 Of course if you think we should not be doing that but instead
 have of_dma_request_channel() live besides dma_request_channel()
 rather than calling it, that should be absolutely fine too.
 
  In the case of DMA controllers that are using DMA Engine, requesting a
  channel is performed by calling the following function.
   
 struct dma_chan *dma_request_channel(dma_cap_mask_t mask,
 dma_filter_fn filter_fn,
 void *filter_param);
   
  The mask variable is used to identify the device controller in a list 
   of
  controllers. The filter_fn and filter_param are used to identify the
  required dma channel and return a handle to the dma channel of type
  dma_chan. From the examples I have seen, the mask and filter_fn are 
   constant
  for a given DMA controller. Therefore, when registering a DMA 
   controller with
  device tree we can pass these parameters and store them so that a 
   device can
  request them when requesting a channel. Hence, based upon this our 
   register
  function for the DMA controller now looks like this.
   
 int of_dma_controller_register(struct device_node *np,
 dma_cap_mask_t *mask, dma_filter_fn fn);
  IMO we should do away with filter functions.
  If we solve the mapping problem, then we don't need a filer.
 
 The channel data in the device tree is still in a format
 that is specific to that dmaengine driver and interpreted
 by it. Using the regular dma_filter_fn prototype is not
 necessary, but it would be convenient because the dmaengine
 code already knows how to deal with it. If we don't use this
 method, how about adding another callback to struct dma_device
 like
 
 bool (*device_match)(struct dma_chan *chan, struct property *req);
 
   2. Supporting legacy devices not using DMA Engine
   
  These devices present a problem, as there may not be a uniform way to 
   easily
  support them with regard to device tree. However, _IF_ legacy devices 
   that
  are not using DMA Engine, only have a single DMA controller, then this
  problem is a lot simpler. For example, if we look at the previously 
   proposed
  API for registering a DMA controller (where we pass the mask and 
   function
  pointer to the DMA Engine filter function) we can simply pass NULL and 
   hence,
  a driver requesting the DMA channel information would receive NULL for 
   the
  DMA Engine specific parameters. Then for legacy devices we simply need 
   a
  means to return the channel information (more on this later). If there 
   are
  legacy devices that do have multiple DMA controllers, then maybe they 
   need to
  be converted to support DMA Engine. I am not sure if this is 
   unreasonable???
 
  Why should these be supported? They should be converted to use dmaengine
  over a reasonable amount of time.
 
 I agree, at least for the long run. However, that is a separate issue to work 
 on.
 Right now we need a generic way to represent dma requests independent of how
 they are used in the kernel. The device tree binding is supposed to be
 operating system independent so there should be nothing in it that requires
 the use of the linux dmaengine code.
 
 For drivers that do not use dmaengine, we have to make a decision whether
 it's worth adding support for the DT binding first and converting the driver
 and its users to dmaengine later, or whether it's better to use the dmaengine
 API right away to avoid having to do changes twice.
Latter please :)
 
   3. Representing and requesting channel information
   
  From a hardware perspective, a DMA channel could be represented as ...
   
  i. channel index/number
  

Re: [PATCH] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Jassi Brar
On 26 June 2012 14:37, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 On Tue, 2012-06-26 at 14:02 +0530, Jassi Brar wrote:

 Something non-omapdss in vanilla breaks suspend/resume.

 I was able to reproduce (probably) the same issue with omap3 overo. Does
 this looks familiar:

 [ 2267.140197] [ cut here ]
 [ 2267.145172] WARNING: at drivers/video/omap2/dss/dispc.c:377 
 dispc_runtime_get+0x60/0x7c [omapdss]
 ()
 [ 2267.154846] Modules linked in: omapfb panel_generic_dpi omapdss cfbimgblt 
 cfbfillrect cfbcopyarea
  [last unloaded: omapdss]
 [ 2267.166595] [c001b61c] (unwind_backtrace+0x0/0xf0) from [c0040238] 
 (warn_slowpath_common+0x4c
 /0x64)
 [ 2267.176605] [c0040238] (warn_slowpath_common+0x4c/0x64) from 
 [c004026c] (warn_slowpath_null+0
 x1c/0x24)
 [ 2267.186859] [c004026c] (warn_slowpath_null+0x1c/0x24) from [bf0d7918] 
 (dispc_runtime_get+0x60
 /0x7c [omapdss])
 [ 2267.197814] [bf0d7918] (dispc_runtime_get+0x60/0x7c [omapdss]) from 
 [bf0e3148] (omapdss_dpi_d
 isplay_enable+0x48/0x230 [omapdss])
 [ 2267.210479] [bf0e3148] (omapdss_dpi_display_enable+0x48/0x230 [omapdss]) 
 from [bf110034] (gen
 eric_dpi_panel_check_timings+0x30/0x7c [panel_generic_dpi])
 [ 2267.225311] [bf110034] (generic_dpi_panel_check_timings+0x30/0x7c 
 [panel_generic_dpi]) from [b
 f11008c] (generic_dpi_panel_resume+0xc/0x1c [panel_generic_dpi])
 [ 2267.240722] [bf11008c] (generic_dpi_panel_resume+0xc/0x1c 
 [panel_generic_dpi]) from [bf0de654
 ] (dss_resume_device+0x28/0x40 [omapdss])
 [ 2267.253936] [bf0de654] (dss_resume_device+0x28/0x40 [omapdss]) from 
 [c02bfb94] (bus_for_each_
 dev+0x50/0x7c)
 [ 2267.264678] [c02bfb94] (bus_for_each_dev+0x50/0x7c) from [c02c287c] 
 (platform_pm_resume+0x2c/
 0x50)
 [ 2267.274566] [c02c287c] (platform_pm_resume+0x2c/0x50) from [c02c6da8] 
 (dpm_run_callback.clone
 .7+0x30/0xb0)
 [ 2267.285186] [c02c6da8] (dpm_run_callback.clone.7+0x30/0xb0) from 
 [c02c7b2c] (device_resume+0x
 c8/0x188)
 [ 2267.295471] [c02c7b2c] (device_resume+0xc8/0x188) from [c02c7f54] 
 (dpm_resume+0xfc/0x21c)
 [ 2267.304534] [c02c7f54] (dpm_resume+0xfc/0x21c) from [c02c8208] 
 (dpm_resume_end+0xc/0x18)
 [ 2267.313507] [c02c8208] (dpm_resume_end+0xc/0x18) from [c007fbcc] 
 (suspend_devices_and_enter+0
 x15c/0x2d0)
 [ 2267.323913] [c007fbcc] (suspend_devices_and_enter+0x15c/0x2d0) from 
 [c007fecc] (pm_suspend+0x
 18c/0x208)
 [ 2267.334259] [c007fecc] (pm_suspend+0x18c/0x208) from [c007f170] 
 (state_store+0x120/0x134)
 [ 2267.343292] [c007f170] (state_store+0x120/0x134) from [c0262850] 
 (kobj_attr_store+0x14/0x20)
 [ 2267.352661] [c0262850] (kobj_attr_store+0x14/0x20) from [c0169b6c] 
 (sysfs_write_file+0x100/0x
 184)
 [ 2267.362457] [c0169b6c] (sysfs_write_file+0x100/0x184) from [c0109008] 
 (vfs_write+0xb4/0x148)
 [ 2267.371795] [c0109008] (vfs_write+0xb4/0x148) from [c0109290] 
 (sys_write+0x40/0x70)
 [ 2267.380310] [c0109290] (sys_write+0x40/0x70) from [c0013d60] 
 (ret_fast_syscall+0x0/0x3c)
 [ 2267.389282] ---[ end trace 54fe7eea726ac84d ]---
 [ 2267.394592] dpm_run_callback(): platform_pm_resume+0x0/0x50 returns -13
 [ 2267.401641] PM: Device omapdss failed to resume: error -13

Seems similar, but I only tested OMAP4 HDMI.
thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/7] ARM: OMAP2: Use hwmod to initialize mmc for 2420

2012-06-26 Thread Tony Lindgren
* Paul Walmsley p...@pwsan.com [120509 13:31]:
 Hi Tony,
 
 On Tue, 8 May 2012, Paul Walmsley wrote:
 
  On Mon, 23 Apr 2012, Tony Lindgren wrote:
  
   This allows us to pass dma request lines in platform data to
   MMC driver the same way as we already do for omap2430 and later.
   
   Signed-off-by: Tony Lindgren t...@atomide.com
  
  This might save you some time, I updated this patch to move the device 
  creation code to arch/arm/mach-omap2/msdi.c and to change the hwmod name 
  to 'msdi1' to conform with the new data.  Updated patch below.
 
 One other thing, the version that was sent yesterday was the 
 second-to-last revision.  Also needed are the following includes in 
 arch/arm/mach-omap2/msdi.c:
 
 #include linux/err.h
 
 #include control.h

Looks like I had this forgotten in testing-misc.. It needed an update
to add #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
for the omap242x_init_mmc() to avoid introducing a new build warning
when MMC_OMAP is not selected at all.

Also looking at the msdi.c file, that too should have the reset function
in drivers/mmc/msdi.h as discussed earlier for other driver resets.

After that's fixed, then we only need to build in msdi.o when we have

obj-msdi-$(CONFIG_MMC_OMAP) := msdi.o
obj-y   += $(omap-msdi-m) $(omap-msdi-y)

But that's a separate patch, so I've applied the following version
of $Subject patch into devel-driver branch.

Tony


From: Tony Lindgren t...@atomide.com
Date: Tue, 26 Jun 2012 03:14:20 -0700
Subject: [PATCH] ARM: OMAP2: Use hwmod to initialize mmc for 2420

This allows us to pass dma request lines in platform data to
MMC driver the same way as we already do for omap2430 and later.

Also note that we need to only build this code if MMC_OMAP
is selected, so change Makefile accordingly and place it near
the MMC_OMAP_HS in the Makefile.

Signed-off-by: Tony Lindgren t...@atomide.com

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 8cab358..91ef6699 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -27,7 +27,6 @@
 
 #include iomap.h
 #include plat/board.h
-#include plat/mmc.h
 #include plat/dma.h
 #include plat/omap_hwmod.h
 #include plat/omap_device.h
@@ -603,75 +602,6 @@ static inline void omap_init_aes(void) { }
 
 /*-*/
 
-#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
-
-static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
-   *mmc_controller)
-{
-   if ((mmc_controller-slots[0].switch_pin  0)  \
-   (mmc_controller-slots[0].switch_pin  OMAP_MAX_GPIO_LINES))
-   omap_mux_init_gpio(mmc_controller-slots[0].switch_pin,
-   OMAP_PIN_INPUT_PULLUP);
-   if ((mmc_controller-slots[0].gpio_wp  0)  \
-   (mmc_controller-slots[0].gpio_wp  OMAP_MAX_GPIO_LINES))
-   omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp,
-   OMAP_PIN_INPUT_PULLUP);
-
-   omap_mux_init_signal(sdmmc_cmd, 0);
-   omap_mux_init_signal(sdmmc_clki, 0);
-   omap_mux_init_signal(sdmmc_clko, 0);
-   omap_mux_init_signal(sdmmc_dat0, 0);
-   omap_mux_init_signal(sdmmc_dat_dir0, 0);
-   omap_mux_init_signal(sdmmc_cmd_dir, 0);
-   if (mmc_controller-slots[0].caps  MMC_CAP_4_BIT_DATA) {
-   omap_mux_init_signal(sdmmc_dat1, 0);
-   omap_mux_init_signal(sdmmc_dat2, 0);
-   omap_mux_init_signal(sdmmc_dat3, 0);
-   omap_mux_init_signal(sdmmc_dat_dir1, 0);
-   omap_mux_init_signal(sdmmc_dat_dir2, 0);
-   omap_mux_init_signal(sdmmc_dat_dir3, 0);
-   }
-
-   /*
-* Use internal loop-back in MMC/SDIO Module Input Clock
-* selection
-*/
-   if (mmc_controller-slots[0].internal_clock) {
-   u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
-   v |= (1  24);
-   omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
-   }
-}
-
-void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
-{
-   struct platform_device *pdev;
-   struct omap_hwmod *oh;
-   int id = 0;
-   char *oh_name = msdi1;
-   char *dev_name = mmci-omap;
-
-   if (!mmc_data[0]) {
-   pr_err(%s fails: Incomplete platform data\n, __func__);
-   return;
-   }
-
-   omap242x_mmc_mux(mmc_data[0]);
-
-   oh = omap_hwmod_lookup(oh_name);
-   if (!oh) {
-   pr_err(Could not look up %s\n, oh_name);
-   return;
-   }
-   pdev = omap_device_build(dev_name, id, oh, mmc_data[0],
-sizeof(struct omap_mmc_platform_data), NULL, 
0, 0);
-   if (IS_ERR(pdev))
-   WARN(1, Can'd build omap_device for %s:%s.\n,
-

Re: [PATCH] ARM: omap4: Fix standalone OMAP4 build break

2012-06-26 Thread Tony Lindgren
* Tony Lindgren t...@atomide.com [120625 03:58]:
 * Rajendra Nayak rna...@ti.com [120622 04:48]:
  Fix the below build error while building OMAP4 standalone
  
CC  arch/arm/mach-omap2/board-flash.o
  arch/arm/mach-omap2/board-flash.c:102: error: redefinition of 
  'board_onenand_init'
  arch/arm/mach-omap2/board-flash.h:56: note: previous definition of 
  'board_onenand_init' was here
  make[1]: *** [arch/arm/mach-omap2/board-flash.o] Error 1
  make: *** [arch/arm/mach-omap2] Error 2
  
  Signed-off-by: Rajendra Nayak rna...@ti.com
 
 Thanks, applying into fixes with the updated description to describe
 the regression causing commit.

Oops, looks like I have an earlier fix already in fixes-board branch
from Kevin that I'll use instead.

Regards,

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


Re: [PATCH 08/11] crypto: omap: add clk_prepare and clk_unprepare

2012-06-26 Thread Paul Walmsley
On Mon, 25 Jun 2012, Rajendra Nayak wrote:

 So if CCF conversion patches get in before these get converted to
 runtime PM, do we break them? or should CCF conversion for OMAP
 wait till all remaining drivers get converted to runtime PM?

I'd suggest getting patches 1, 10, and 11 from your series in shape and 
PM-tested.  Those shouldn't have any driver dependencies, so once those 
are in good condition, they can be merged through the OMAP tree.

Then at the same time, maybe get the rest of the drivers runtime-PM 
converted and acked through their respective maintainers.  Looks like you 
have a couple of driver patches that don't involve runtime-PM conversions;
those can presumably get merged through their respective maintainers?

...

I did notice that some other driver conversions weren't present in this 
series, e.g., omap3isp.  If someone doesn't convert those drivers, then 
those seem likely to break.


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


Re: [PATCH v2 05/17] i2c: omap: split out [XR]DR and [XR]RDY

2012-06-26 Thread Shubhrajyoti
Hi Felipe,
On Thursday 14 June 2012 09:54 PM, Felipe Balbi wrote:
   return IRQ_HANDLED;
   }
  
 - if (stat  (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
 + if (stat  OMAP_I2C_STAT_RDR) {
   u8 num_bytes = 1;
  
 + if (dev-fifo_size)
 + num_bytes = dev-fifo_size;
In case of a draining interrupt. The byte count may not be the fifo size.
Do you agree?
 +
 + while (num_bytes--) {
 + if (!dev-buf_len) {

--
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 1/2] ARM: OMAP2+: fix naming collision of variable nr_irqs

2012-06-26 Thread Tony Lindgren
* Venkatraman S svenk...@ti.com [120625 03:31]:
 Using nr_irqs as local variable name triggers the sparse warning..
 ./arch/arm/mach-omap2/irq.c:265:6: warning: symbol 'nr_irqs' shadows an 
 earlier one
 ./linux/include/linux/irqnr.h:26:12: originally declared here

Thanks applying both into fixes-non-critical.

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


Re: [PATCH v2 00/17] Big OMAP I2C Cleanup

2012-06-26 Thread Shubhrajyoti
On Thursday 14 June 2012 11:29 PM, Wolfram Sang wrote:
  - removed dev_err() which was introduced on patch 09/17
 To prevent the list being flooded, I would appreciate if you could wait
 a few days to collect reviews before resending. It will take some time
 until I pick this series anyhow, because I want people to have time to
 donate Tested-by tags.
Felipe thats a good cleanup.
The series look good to me.

Also draining interrupt I had some queries.
Looks good to me.

I have tested it after rebasing.
Tested-by : Shubhrajyoti shubhrajy...@ti.com


Thanks,


--
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 08/11] crypto: omap: add clk_prepare and clk_unprepare

2012-06-26 Thread Rajendra Nayak

On Tuesday 26 June 2012 04:09 PM, Paul Walmsley wrote:

Then at the same time, maybe get the rest of the drivers runtime-PM
converted and acked through their respective maintainers.


So if I read your response correctly, you are saying all OMAP drivers
being converted to use runtime PM is a pre-requisite for OMAP moving 
over to use Common Clk framework?

--
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: [PATCHv8 03/13] I2C: OMAP: Remove reset at init

2012-06-26 Thread Tony Lindgren
* Shubhrajyoti shubhrajy...@ti.com [120621 02:35]:
 On Thursday 21 June 2012 12:50 PM, Tony Lindgren wrote:
  * Shubhrajyoti shubhrajy...@ti.com [120621 00:08]:
  On Wednesday 20 June 2012 03:59 PM, Tony Lindgren wrote:
  See the comments regarding driver specific resets in hwmod code.
  you mean omap_hwmod.c
  The way to set this up is to have a shared inline function in
  i2c-omap.h that both the driver and hwmod code can use.
  hwmod reset function uses oh (omap_hwmod).
 
  How could the driver also pass oh ?
  Could we keep a local copy in driver data?
  Eventually hwmod code will do the reset only in late initcall
  if no driver is loaded for the device in question.
  There's no need for the driver to know anything about oh.
  The driver just needs to know the iobase.
 I will rework to make the hwmod and driver use the same function.
 In the meanwhile I will send a minimal/ remaining cleanups/ fixes so that
 it might get some time to bake in the next branch.

OK thanks!

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


Re: [RFC PATCH v2 03/11] mfd: omap: control: core system control driver

2012-06-26 Thread Tony Lindgren
* Konstantin Baydarov kbaida...@dev.rtsoft.ru [120620 07:18]:
 
 So,the same API set (omap_control_readl/omap_control_writel) was added to 
 omap-control-core.c.
 
 If omap-control-core.c should only service users from driver/ directory, than 
 I agree - we can remove
 omap_control_readl/omap_control_writel from omap-control-core.c.
   But IIUC you are agree to switch arch/arm/mach-omap2/id.c from control.c 
 to omap-control-core.c. If arch/arm/mach-omap2/id.c is switched to control.c, 
 then I guess all arch/arm/mach-omap2/*.c should be switched to 
 omap-control-core.c as well. But this means that omap-control-core.c should 
 provide omap_control_readl/omap_control_writel API.

Can't you just add something like int omap_ctrl_read_status(void)
that id.c can use?

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


Re: [PATCHv10 1/7] I2C: OMAP: I2C register restore only if context is lost

2012-06-26 Thread Shubhrajyoti
On Tuesday 26 June 2012 11:38 AM, Shubhrajyoti wrote:
 On Monday 25 June 2012 06:00 PM, Felipe Balbi wrote:
 Cc: Kevin Hilman khil...@ti.com
 Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
 how will this ever work with DT ? 
 What you say makes sense however that is what currently
 most of the omap drivers do.

 Will check on this.
 I say we get rid of the OMAP-specific
 API and build this context lost status directly on dev_pm_info and
 have something like pm_runtime_lost_context() or something with pm QoS
 tell you if a device has lost its context.

 Also, your commit log doesn't really state any problems you might have
 reached before,
Didnt see any issues while reviewing found that the restore was done always.
  or any improvements wrt latency coming out of suspend
 and so on.
I am only restoring only 4-5 registers.


 IMHO, drivers need a generic way to differentiate if they're resuming
 from OFF or RET, otherwise we will end up with a bunch of OMAP-specific
 hackery on all drivers


--
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] OMAP7XX: Remove omap730.h and omap850.h

2012-06-26 Thread Tony Lindgren
* Paul Bolle pebo...@tiscali.nl [120618 03:02]:
 No file includes omap730.h or omap850.h. That's not surprising, as
 commit e6684f7132c6e6333e96407b06910bebaa4c1935 (OMAP7XX: Create
 omap7xx.h) created a header that was intended to replace omap730.h and
 omap850.h, while all values defined [in omap7xx.h] are identical to
 those in both the old files. So it seems it was just an oversight to
 keep both the old files after commit
 7a8f48f8c611ac8c07023260258e2fec312b9242 (OMAP7XX: omap_uwire.c:
 Convert to omap7xx.h) converted the last file still including one of
 those two old files.
 
 Convert the last reference to omap730.h to a reference to omap7xx.h too.
 
 Signed-off-by: Paul Bolle pebo...@tiscali.nl
 ---
 0) Tested only by using various git commands on the (history of the)
 tree.

Thanks, nice catch :) I'll apply this into fixes-non-critical.
 
 1) A related cleanup could be to remove cpu_is_omap730 and
 cpu_is_omap850, as both macros seem unused.

Yes seems like we could do that. Care to do a patch for that?

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


[PATCH 0/5 V2 RESEND] ARM: OMAP: TLL driver implementation for USB host driver

2012-06-26 Thread Keshava Munegowda
The TLL configuration is removed from the UHH driver and implemented as
a seperate platform driver. Now, the UHH driver configures the TLL
through API's exported by the TLL platform driver. The TLL is an
has independent hardware mod structure for in OMAP3 and later chips,
hence an dedicated platform driver is created.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com

In V2:
- covered review comments from linux omap and usb community
- rebased on top Russ dil's patch
   'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue'
   fixes an issue where the ULPI PHYs were not held in reset
   while initializing the EHCI controller

Keshava Munegowda (5):
  ARM: OMAP: USB: HOST TLL platform driver
  ARM: OMAP: USB: Build the USB HOST TLL omap device
  ARM: OMAP: USB: Remove TLL specific code
  ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver
  ARM: OMAP: change the USB TLL clocks device name

 arch/arm/mach-omap2/clock3xxx_data.c  |8 +-
 arch/arm/mach-omap2/clock44xx_data.c  |4 +-
 arch/arm/mach-omap2/usb-host.c|   31 ++-
 arch/arm/plat-omap/include/plat/usb.h |7 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-host.c   |  238 ++---
 drivers/mfd/omap-usb-tll.c|  471 +
 8 files changed, 523 insertions(+), 240 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

-- 
1.7.9.5

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


[PATCH 1/5 V2 RESEND] ARM: OMAP: USB: HOST TLL platform driver

2012-06-26 Thread Keshava Munegowda
The platform driver for the TLL component of the OMAP USB host controller
is implemented. Depending on the TLL hardware revision , the TLL channels
are configured. The USB HS core driver uses this driver through exported
APIs from the TLL platform driver.
usb_tll_enable and usb_tll_disble are the exported APIs of the USB TLL
platform driver.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
Reviewed-by: Partha Basak part...@india.ti.com
---
 arch/arm/plat-omap/include/plat/usb.h |6 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-tll.c|  471 +
 4 files changed, 479 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index 762eeb0..b8a9d5e 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -62,6 +62,10 @@ struct usbhs_omap_platform_data {
struct ehci_hcd_omap_platform_data  *ehci_data;
struct ohci_hcd_omap_platform_data  *ohci_data;
 };
+
+struct usbtll_omap_platform_data {
+   enum usbhs_omap_port_mode   port_mode[OMAP3_HS_USB_PORTS];
+};
 /*-*/
 
 #define OMAP1_OTG_BASE 0xfffb0400
@@ -100,6 +104,8 @@ enum musb_interface{MUSB_INTERFACE_ULPI, 
MUSB_INTERFACE_UTMI};
 extern void usb_musb_init(struct omap_musb_board_data *board_data);
 
 extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
+extern int omap_tll_enable(void);
+extern int omap_tll_disable(void);
 
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e129c82..74abd60 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -823,7 +823,7 @@ config MFD_WL1273_CORE
  audio codec.
 
 config MFD_OMAP_USB_HOST
-   bool Support OMAP USBHS core driver
+   bool Support OMAP USBHS core and TLL driver
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
default y
help
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 75f6ed6..6de605d 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -107,7 +107,7 @@ obj-$(CONFIG_MFD_TPS6586X)  += tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
-obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o omap-usb-tll.o
 obj-$(CONFIG_MFD_PM8921_CORE)  += pm8921-core.o
 obj-$(CONFIG_MFD_PM8XXX_IRQ)   += pm8xxx-irq.o
 obj-$(CONFIG_TPS65911_COMPARATOR)  += tps65911-comparator.o
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
new file mode 100644
index 000..516059b
--- /dev/null
+++ b/drivers/mfd/omap-usb-tll.c
@@ -0,0 +1,471 @@
+/**
+ * omap-usb-tll.c - The USB TLL driver for OMAP EHCI  OHCI
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda keshava_mgo...@ti.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.
+ */
+#include linux/kernel.h
+#include linux/module.h
+#include linux/types.h
+#include linux/slab.h
+#include linux/spinlock.h
+#include linux/platform_device.h
+#include linux/clk.h
+#include linux/io.h
+#include linux/err.h
+#include plat/usb.h
+#include linux/pm_runtime.h
+
+#define USBTLL_DRIVER_NAME usbhs_tll
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1  8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1  3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1  2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1  1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1  0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1  0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   

[PATCH 2/5 V2 RESEND] ARM: OMAP: USB: Build the USB HOST TLL omap device

2012-06-26 Thread Keshava Munegowda
The hwmod of the usb tll is retrieved and omap device build is
performed to created the platform device for the usb tll component.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
Reviewed-by: Partha Basak part...@india.ti.com
---
 arch/arm/mach-omap2/usb-host.c |   31 ++-
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index dde8a11..b2a2dd7 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -35,10 +35,12 @@
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
 #define OMAP_USBHS_DEVICE  usbhs_omap
+#define OMAP_USBTLL_DEVICE usbhs_tll
 #defineUSBHS_UHH_HWMODNAME usb_host_hs
 #define USBHS_TLL_HWMODNAMEusb_tll_hs
 
 static struct usbhs_omap_platform_data usbhs_data;
+static struct usbtll_omap_platform_datausbtll_data;
 static struct ehci_hcd_omap_platform_data  ehci_data;
 static struct ohci_hcd_omap_platform_data  ohci_data;
 
@@ -487,13 +489,14 @@ void __init setup_4430ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
 
 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 {
-   struct omap_hwmod   *oh[2];
+   struct omap_hwmod   *uhh_hwm, *tll_hwm;
struct platform_device  *pdev;
int bus_id = -1;
int i;
 
for (i = 0; i  OMAP3_HS_USB_PORTS; i++) {
usbhs_data.port_mode[i] = pdata-port_mode[i];
+   usbtll_data.port_mode[i] = pdata-port_mode[i];
ohci_data.port_mode[i] = pdata-port_mode[i];
ehci_data.port_mode[i] = pdata-port_mode[i];
ehci_data.reset_gpio_port[i] = pdata-reset_gpio_port[i];
@@ -512,25 +515,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data 
*pdata)
setup_4430ohci_io_mux(pdata-port_mode);
}
 
-   oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
-   if (!oh[0]) {
+   uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
+   if (!uhh_hwm) {
pr_err(Could not look up %s\n, USBHS_UHH_HWMODNAME);
return;
}
 
-   oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
-   if (!oh[1]) {
+   tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
+   if (!tll_hwm) {
pr_err(Could not look up %s\n, USBHS_TLL_HWMODNAME);
return;
}
 
-   pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
-   (void *)usbhs_data, sizeof(usbhs_data),
+   pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm,
+   usbtll_data, sizeof(usbtll_data),
omap_uhhtll_latency,
ARRAY_SIZE(omap_uhhtll_latency), false);
if (IS_ERR(pdev)) {
-   pr_err(Could not build hwmod devices %s,%s\n,
-   USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
+   pr_err(Could not build hwmod device %s\n,
+  USBHS_TLL_HWMODNAME);
+   return;
+   }
+
+   pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm,
+   usbhs_data, sizeof(usbhs_data),
+   omap_uhhtll_latency,
+   ARRAY_SIZE(omap_uhhtll_latency), false);
+   if (IS_ERR(pdev)) {
+   pr_err(Could not build hwmod devices %s\n,
+  USBHS_UHH_HWMODNAME);
return;
}
 }
-- 
1.7.9.5

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


[PATCH 3/5 V2 RESEND] ARM: OMAP: USB: Remove TLL specific code

2012-06-26 Thread Keshava Munegowda
The TLL specific code such as channels clocks enable/disable,
initialization functions are removed from the USBHS core
driver.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
Reviewed-by: Partha Basak part...@india.ti.com
---
 drivers/mfd/omap-usb-host.c |  231 ++-
 1 file changed, 10 insertions(+), 221 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 41088ec..c1baf20 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -36,63 +36,6 @@
 
 /* OMAP USBHOST Register addresses  */
 
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1  8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1  3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1  2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1  1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1  0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1  0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1  6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1  5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1  2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1  1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1  0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#define OMAP_TLL_CHANNEL_CONF_FSLSMODE_SHIFT   24
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1  11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1  10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1  9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1  8)
-#define OMAP_TLL_CHANNEL_CONF_CHANMODE_FSLS(1  1)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1  0)
-
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DAT_SE0 0x0
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DP_DM   0x1
-#define OMAP_TLL_FSLSMODE_3PIN_PHY 0x2
-#define OMAP_TLL_FSLSMODE_4PIN_PHY 0x3
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DAT_SE0 0x4
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DP_DM   0x5
-#define OMAP_TLL_FSLSMODE_3PIN_TLL 0x6
-#define OMAP_TLL_FSLSMODE_4PIN_TLL 0x7
-#define OMAP_TLL_FSLSMODE_2PIN_TLL_DAT_SE0 0xA
-#define OMAP_TLL_FSLSMODE_2PIN_DAT_DP_DM   0xB
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1  0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1  1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1  2)
-
 /* UHH Register Set */
 #defineOMAP_UHH_REVISION   (0x00)
 #defineOMAP_UHH_SYSCONFIG  (0x10)
@@ -132,8 +75,6 @@
 #define OMAP4_P2_MODE_TLL  (1  18)
 #define OMAP4_P2_MODE_HSIC (3  18)
 
-#define OMAP_REV2_TLL_CHANNEL_COUNT2
-
 #defineOMAP_UHH_DEBUG_CSR  (0x44)
 
 /* Values of UHH_REVISION - Note: these are not given in the TRM */
@@ -153,15 +94,12 @@ struct usbhs_hcd_omap {
struct clk  *xclk60mhsp2_ck;
struct clk  *utmi_p1_fck;
struct clk  *usbhost_p1_fck;
-   struct clk  *usbtll_p1_fck;
struct clk  *utmi_p2_fck;
struct clk  *usbhost_p2_fck;
-   struct clk  *usbtll_p2_fck;

[PATCH 4/5 V2 RESEND] ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver

2012-06-26 Thread Keshava Munegowda
The usbhs driver invokes the enable/disable APIs of the
usb tll driver in the runtime resume/suspend callbacks
of the runtime get sync and put sync of the usbhs driver.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
Reviewed-by: Partha Basak part...@india.ti.com
---
 arch/arm/plat-omap/include/plat/usb.h |1 +
 drivers/mfd/omap-usb-host.c   |7 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index b8a9d5e..8eac78c 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -4,6 +4,7 @@
 #define__ASM_ARCH_OMAP_USB_H
 
 #include linux/io.h
+#include linux/platform_device.h
 #include linux/usb/musb.h
 #include plat/board.h
 
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index c1baf20..23cec57 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -21,7 +21,6 @@
 #include linux/types.h
 #include linux/slab.h
 #include linux/delay.h
-#include linux/platform_device.h
 #include linux/clk.h
 #include linux/dma-mapping.h
 #include linux/spinlock.h
@@ -287,6 +286,7 @@ static int usbhs_runtime_resume(struct device *dev)
return  -ENODEV;
}
 
+   omap_tll_enable();
spin_lock_irqsave(omap-lock, flags);
 
if (omap-ehci_logic_fck  !IS_ERR(omap-ehci_logic_fck))
@@ -332,6 +332,7 @@ static int usbhs_runtime_suspend(struct device *dev)
clk_disable(omap-ehci_logic_fck);
 
spin_unlock_irqrestore(omap-lock, flags);
+   omap_tll_disable();
 
return 0;
 }
@@ -699,8 +700,10 @@ static int __init omap_usbhs_drvinit(void)
  * init before ehci and ohci drivers;
  * The usbhs core driver should be initialized much before
  * the omap ehci and ohci probe functions are called.
+ * This usbhs core driver should be initialized after
+ * usb tll driver
  */
-fs_initcall(omap_usbhs_drvinit);
+fs_initcall_sync(omap_usbhs_drvinit);
 
 static void __exit omap_usbhs_drvexit(void)
 {
-- 
1.7.9.5

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


[PATCH 5/5 V2 RESEND] ARM: OMAP: change the USB TLL clocks device name

2012-06-26 Thread Keshava Munegowda
The platform device name for the functional, interface and
channel clocks of the TLL module is changed from usbhs device
to usb tll platform device name.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
Reviewed-by: Partha Basak part...@india.ti.com
---
 arch/arm/mach-omap2/clock3xxx_data.c |8 
 arch/arm/mach-omap2/clock44xx_data.c |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 4e1a3b0..300ca51 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3306,7 +3306,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   cpefuse_fck,  cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   ts_fck,   ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   usbtll_fck,   usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK(usbhs_omap,   usbtll_fck,   usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK(usbhs_tll,usbtll_fck,   usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK(omap-mcbsp.1, prcm_fck, core_96m_fck,  CK_3XXX),
CLK(omap-mcbsp.5, prcm_fck, core_96m_fck,  CK_3XXX),
CLK(NULL,   core_96m_fck, core_96m_fck,  CK_3XXX),
@@ -3342,7 +3342,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   pka_ick,  pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   core_l4_ick,  core_l4_ick,   CK_3XXX),
CLK(NULL,   usbtll_ick,   usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK(usbhs_omap,   usbtll_ick,   usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK(usbhs_tll,usbtll_ick,   usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK(omap_hsmmc.2, ick,  mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   icr_ick,  icr_ick,   CK_34XX | CK_36XX),
CLK(omap-aes, ick,  aes2_ick,  CK_34XX | CK_36XX),
@@ -3397,9 +3397,9 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(usbhs_omap,   xclk60mhsp2_ck,   dummy_ck,  
CK_3XXX),
CLK(usbhs_omap,   usb_host_hs_utmi_p1_clk,  dummy_ck,  
CK_3XXX),
CLK(usbhs_omap,   usb_host_hs_utmi_p2_clk,  dummy_ck,  
CK_3XXX),
-   CLK(usbhs_omap,   usb_tll_hs_usb_ch0_clk,   dummy_ck,  
CK_3XXX),
-   CLK(usbhs_omap,   usb_tll_hs_usb_ch1_clk,   dummy_ck,  
CK_3XXX),
CLK(usbhs_omap,   init_60m_fclk,dummy_ck,  
CK_3XXX),
+   CLK(usbhs_tll,usb_tll_hs_usb_ch0_clk,   dummy_ck,  
CK_3XXX),
+   CLK(usbhs_tll,usb_tll_hs_usb_ch1_clk,   dummy_ck,  
CK_3XXX),
CLK(NULL,   usim_fck, usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   gpt1_fck, gpt1_fck,  CK_3XXX),
CLK(NULL,   wkup_32k_fck, wkup_32k_fck,  CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c 
b/arch/arm/mach-omap2/clock44xx_data.c
index 2172f66..d60e8d6 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3328,7 +3328,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   usb_tll_hs_usb_ch2_clk,   
usb_tll_hs_usb_ch2_clk,CK_443X),
CLK(NULL,   usb_tll_hs_usb_ch0_clk,   
usb_tll_hs_usb_ch0_clk,CK_443X),
CLK(NULL,   usb_tll_hs_usb_ch1_clk,   
usb_tll_hs_usb_ch1_clk,CK_443X),
-   CLK(usbhs_omap,   usbtll_ick,   usb_tll_hs_ick,
CK_443X),
+   CLK(usbhs_tll,usbtll_ick,   usb_tll_hs_ick,
CK_443X),
CLK(NULL,   usim_ck,  usim_ck,   
CK_443X),
CLK(NULL,   usim_fclk,usim_fclk, 
CK_443X),
CLK(NULL,   usim_fck, usim_fck,  
CK_443X),
@@ -3378,7 +3378,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   uart3_ick,dummy_ck,  
CK_443X),
CLK(NULL,   uart4_ick,dummy_ck,  
CK_443X),
CLK(usbhs_omap,   usbhost_ick,  dummy_ck,  
CK_443X),
-   CLK(usbhs_omap,   usbtll_fck,   dummy_ck,  
CK_443X),
+   CLK(usbhs_tll,usbtll_fck,   dummy_ck,  
CK_443X),
CLK(omap_wdt, ick,  dummy_ck,  
CK_443X),
CLK(omap_timer.1, 32k_ck,   sys_32k_ck,CK_443X),
CLK(omap_timer.2, 32k_ck,   sys_32k_ck,CK_443X),
-- 
1.7.9.5

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


Re: Current state of AM33xx patches

2012-06-26 Thread Sekhar Nori
Hi Daniel,

On 6/25/2012 11:47 PM, Daniel Mack wrote:
 On 21.06.2012 15:50, Daniel Mack wrote:
 On 18.06.2012 10:15, Hiremath, Vaibhav wrote:
 On Mon, Jun 11, 2012 at 19:21:21, Jason Kridner wrote:
 From: Daniel Mack zon...@gmail.com
 Hey,

 can anybody give me a quick wrap-up about the current state of AM33xx
 based SoCs in mainline? What are the next steps to get things merged?

 There is a wiki page [1] that is intended to provide a summary, but I'm
 confident it is not up-to-date.  

 Page updated now...

 http://processors.wiki.ti.com/index.php/Sitara_Linux_Upstream_Status#AM335x_Linux_Status

 Great, thanks. So if things get upstreamed, which is the repo/branch
 they appear in? In other words: where is the code people should write
 patches against? I couldn't find an answer to that yet.
 
 ping?

Bug fixes are always accepted against Linus's tree[1].

For features, typically there is a -next branch that each subsystem
maintainer has against which feature development happens. In case of
OMAP, feature development happens against master branch of linux-omap
tree[2]. One way to get to know the -next branches of all subsystem is
to look at Next/Trees file of linux-next tree[3].

Note that in case of ARM, sub-arch maintainers send the code to arm-soc
maintainers who in turn have a branch which gets merged to linux-next.

Hope that helps.

Thanks,
Sekhar

[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git
[2] http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap.git
[3] http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git


--
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] OMAP7XX: Remove omap730.h and omap850.h

2012-06-26 Thread Paul Bolle
On Tue, 2012-06-26 at 04:25 -0700, Tony Lindgren wrote:
 * Paul Bolle pebo...@tiscali.nl [120618 03:02]: 
  1) A related cleanup could be to remove cpu_is_omap730 and
  cpu_is_omap850, as both macros seem unused.
 
 Yes seems like we could do that. Care to do a patch for that?

Sure, no problem. I hope to submit it shortly.


Paul Bolle

--
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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Tomi Valkeinen
On Tue, 2012-06-26 at 15:27 +0530, Jassi Brar wrote:

 Seems similar, but I only tested OMAP4 HDMI.

Would something like this one below work for you? It fixes the issues on
my overo board.

Instead of using omapdss device's suspend/resume callbacks, this one
uses PM notifier calls which happen before suspend and after resume.

I still think the suspend handling is wrong, omapdss shouldn't be
enabling and disabling panel devices like that, but this one should
remove the biggest issues with the current suspend method.

 Tomi

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 5066eee..c35a248 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -32,6 +32,7 @@
 #include linux/io.h
 #include linux/device.h
 #include linux/regulator/consumer.h
+#include linux/suspend.h
 
 #include video/omapdss.h
 
@@ -201,6 +202,30 @@ int dss_debugfs_create_file(const char *name, void 
(*write)(struct seq_file *))
 #endif /* CONFIG_DEBUG_FS  CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
 
 /* PLATFORM DEVICE */
+static int omap_dss_pm_notif(struct notifier_block *b, unsigned long v, void 
*d)
+{
+   DSSDBG(pm notif %lu\n, v);
+
+   switch (v)
+   {
+   case PM_SUSPEND_PREPARE:
+   DSSDBG(suspending displays\n);
+   return dss_suspend_all_devices();
+
+   case PM_POST_SUSPEND:
+   DSSDBG(resuming displays\n);
+   return dss_resume_all_devices();
+
+   default:
+   return 0;
+   }
+}
+
+static struct notifier_block omap_dss_pm_notif_block =
+{
+   .notifier_call = omap_dss_pm_notif,
+};
+
 static int __init omap_dss_probe(struct platform_device *pdev)
 {
struct omap_dss_board_info *pdata = pdev-dev.platform_data;
@@ -224,6 +249,8 @@ static int __init omap_dss_probe(struct platform_device 
*pdev)
else if (pdata-default_device)
core.default_display_name = pdata-default_device-name;
 
+   register_pm_notifier(omap_dss_pm_notif_block);
+
return 0;
 
 err_debugfs:
@@ -233,6 +260,8 @@ err_debugfs:
 
 static int omap_dss_remove(struct platform_device *pdev)
 {
+   unregister_pm_notifier(omap_dss_pm_notif_block);
+
dss_uninitialize_debugfs();
 
dss_uninit_overlays(pdev);
@@ -247,25 +276,9 @@ static void omap_dss_shutdown(struct platform_device *pdev)
dss_disable_all_devices();
 }
 
-static int omap_dss_suspend(struct platform_device *pdev, pm_message_t state)
-{
-   DSSDBG(suspend %d\n, state.event);
-
-   return dss_suspend_all_devices();
-}
-
-static int omap_dss_resume(struct platform_device *pdev)
-{
-   DSSDBG(resume\n);
-
-   return dss_resume_all_devices();
-}
-
 static struct platform_driver omap_dss_driver = {
.remove = omap_dss_remove,
.shutdown   = omap_dss_shutdown,
-   .suspend= omap_dss_suspend,
-   .resume = omap_dss_resume,
.driver = {
.name   = omapdss,
.owner  = THIS_MODULE,



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


[PATCH] drivers: usb/power: fix return value check of usb_get_phy

2012-06-26 Thread Kishon Vijay Abraham I
usb_get_phy will return -ENODEV if it's not able to find the phy. Hence
fixed all the callers of usb_get_phy to check for this error condition
instead of relying on a non-zero value as success condition.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
Developed on
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv
Compile tested only for omap2plus_defconfig.
 drivers/power/ab8500_charger.c|2 +-
 drivers/power/isp1704_charger.c   |2 +-
 drivers/power/pda_power.c |   16 
 drivers/power/twl4030_charger.c   |7 ---
 drivers/usb/chipidea/udc.c|9 +
 drivers/usb/gadget/fsl_udc_core.c |   15 ---
 drivers/usb/gadget/mv_udc_core.c  |   13 +++--
 drivers/usb/gadget/omap_udc.c |   25 +
 drivers/usb/gadget/pxa25x_udc.c   |   11 ++-
 drivers/usb/gadget/pxa27x_udc.c   |   11 ++-
 drivers/usb/gadget/s3c-hsudc.c|9 +
 drivers/usb/host/ehci-fsl.c   |5 +++--
 drivers/usb/host/ehci-msm.c   |2 +-
 drivers/usb/host/ehci-mv.c|7 ---
 drivers/usb/host/ehci-tegra.c |7 ---
 drivers/usb/host/ohci-omap.c  |5 +++--
 drivers/usb/musb/am35x.c  |3 ++-
 drivers/usb/musb/blackfin.c   |3 ++-
 drivers/usb/musb/da8xx.c  |3 ++-
 drivers/usb/musb/davinci.c|3 ++-
 drivers/usb/musb/musb_dsps.c  |3 ++-
 drivers/usb/musb/omap2430.c   |2 +-
 drivers/usb/musb/tusb6010.c   |3 ++-
 drivers/usb/musb/ux500.c  |3 ++-
 drivers/usb/otg/otg.c |4 ++--
 25 files changed, 96 insertions(+), 77 deletions(-)

diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index 6bd6f1c..d4f0c98 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -2689,7 +2689,7 @@ static int __devinit ab8500_charger_probe(struct 
platform_device *pdev)
}
 
di-usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
-   if (!di-usb_phy) {
+   if (IS_ERR_OR_NULL(di-usb_phy)) {
dev_err(di-dev, failed to get usb transceiver\n);
ret = -EINVAL;
goto free_usb;
diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c
index 090e5f9..1229119 100644
--- a/drivers/power/isp1704_charger.c
+++ b/drivers/power/isp1704_charger.c
@@ -416,7 +416,7 @@ static int __devinit isp1704_charger_probe(struct 
platform_device *pdev)
return -ENOMEM;
 
isp-phy = usb_get_phy(USB_PHY_TYPE_USB2);
-   if (!isp-phy)
+   if (IS_ERR_OR_NULL(isp-phy))
goto fail0;
 
isp-dev = pdev-dev;
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index 7602d49..8dbcd53 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -322,11 +322,11 @@ static int pda_power_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_USB_OTG_UTILS
transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
-   if (transceiver  !pdata-is_usb_online) {
-   pdata-is_usb_online = otg_is_usb_online;
-   }
-   if (transceiver  !pdata-is_ac_online) {
-   pdata-is_ac_online = otg_is_ac_online;
+   if (!IS_ERR_OR_NULL(transceiver)) {
+   if (!pdata-is_usb_online)
+   pdata-is_usb_online = otg_is_usb_online;
+   if (!pdata-is_ac_online)
+   pdata-is_ac_online = otg_is_ac_online;
}
 #endif
 
@@ -373,7 +373,7 @@ static int pda_power_probe(struct platform_device *pdev)
}
 
 #ifdef CONFIG_USB_OTG_UTILS
-   if (transceiver  pdata-use_otg_notifier) {
+   if (!IS_ERR_OR_NULL(transceiver)  pdata-use_otg_notifier) {
otg_nb.notifier_call = otg_handle_notification;
ret = usb_register_notifier(transceiver, otg_nb);
if (ret) {
@@ -408,7 +408,7 @@ usb_supply_failed:
if (pdata-is_ac_online  ac_irq)
free_irq(ac_irq-start, pda_psy_ac);
 #ifdef CONFIG_USB_OTG_UTILS
-   if (transceiver)
+   if (!IS_ERR_OR_NULL(transceiver))
usb_put_phy(transceiver);
 #endif
 ac_irq_failed:
@@ -443,7 +443,7 @@ static int pda_power_remove(struct platform_device *pdev)
if (pdata-is_ac_online)
power_supply_unregister(pda_psy_ac);
 #ifdef CONFIG_USB_OTG_UTILS
-   if (transceiver)
+   if (!IS_ERR_OR_NULL(transceiver))
usb_put_phy(transceiver);
 #endif
if (ac_draw) {
diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index 13f9db2..7cacbaa 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -15,6 +15,7 @@
 #include linux/init.h
 #include linux/module.h
 #include linux/slab.h
+#include linux/err.h
 #include linux/platform_device.h
 #include linux/interrupt.h
 #include linux/i2c/twl.h
@@ -480,7 +481,7 @@ static int __init twl4030_bci_probe(struct 

[GIT PULL] OMAP PM: move SmartReflex driver to drivers/avs

2012-06-26 Thread Kevin Hilman
Tony,

Please pull this series that move the SmartReflex driver out to
drivers/avs.  The series includes some minimal cleanups necessary to
cleanly do the move.

The drivers/* change has been Acked by Rafael and we agreed to merge it
through the OMAP tree because of all the arch/arm/mach-omap2 changes
in this series.

Kevin


The following changes since commit cdd3a354a05b0c33fe33ab11a0fb0838396cad19:

  Merge tag 'pm' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc 
(2012-05-22 09:41:01 -0700)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git 
for_3.6/pm/sr-move

for you to fetch changes up to 21ff63ad131218048525fbd37d065ce61f03bcbd:

  ARM: OMAP: SmartReflex: Move smartreflex driver to drivers/ (2012-05-31 
16:36:30 -0700)


J Keerthy (1):
  ARM: OMAP2+: Voltage: Move the omap_volt_data structure to plat

Jean Pihet (9):
  ARM: OMAP2+: SmartReflex: move the smartreflex header to 
include/linux/power
  ARM: OMAP3+: SmartReflex: class drivers should use struct omap_sr *
  ARM: OMAP2+: smartreflex: Use the names from hwmod data instead of 
voltage domains.
  ARM: OMAP3: hwmod: rename the smartreflex entries
  ARM: OMAP2+: SmartReflex: introduce a busy loop condition test macro
  ARM: OMAP2+: SmartReflex: Use per-OPP data structure
  ARM: OMAP2+: SmartReflex: Create per-opp debugfs node for errminlimit
  ARM: OMAP2+: SmartReflex: add POWER_AVS Kconfig options
  ARM: OMAP: SmartReflex: Move smartreflex driver to drivers/

 arch/arm/mach-omap2/Makefile   |5 +-
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   12 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |3 +-
 arch/arm/mach-omap2/pm.h   |2 +-
 arch/arm/mach-omap2/smartreflex-class3.c   |   29 ++--
 arch/arm/mach-omap2/sr_device.c|   39 -
 arch/arm/mach-omap2/voltage.h  |   21 +--
 arch/arm/plat-omap/Kconfig |   31 ++--
 arch/arm/plat-omap/include/plat/voltage.h  |   21 ++-
 drivers/power/Kconfig  |2 +
 drivers/power/Makefile |1 +
 drivers/power/avs/Kconfig  |   12 ++
 drivers/power/avs/Makefile |1 +
 .../mach-omap2 = drivers/power/avs}/smartreflex.c |  161 
 .../linux/power}/smartreflex.h |   74 +++--
 15 files changed, 235 insertions(+), 179 deletions(-)
 create mode 100644 drivers/power/avs/Kconfig
 create mode 100644 drivers/power/avs/Makefile
 rename {arch/arm/mach-omap2 = drivers/power/avs}/smartreflex.c (90%)
 rename {arch/arm/mach-omap2 = include/linux/power}/smartreflex.h (79%)
--
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


[GIT PULL] OMAP3 PM: preformance enhancements

2012-06-26 Thread Kevin Hilman
Tony,

Please pull the following PM/performance enhancements for v3.6.  I
recently rebased it on your devel-pm branch to avoid some conflicts
with the IO chain stuff recently merged from Paul.

This series had the goal of improving the responsiveness of the
shallowest idle states.  Several reports came in that even when only
hitting the shallowest idle states, there was a significant performance
hit.  This series addresses the major sources of latency in the
shallowest idle states.

Kevin

The following changes since commit 9a17d88e0586bb7189655f8f99484a872a474626:

  Merge tag 'omap-devel-c-for-3.6' of 
git://git.kernel.org/pub/scm/linux/kernel/git/pjw/omap-pending into devel-pm 
(2012-06-25 07:41:17 -0700)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git 
for_3.6/pm/performance

for you to fetch changes up to 05011f711fc751456972d126bbb8081723629408:

  ARM: OMAP3: PM: cpuidle: optimize the clkdm idle latency in C1 state 
(2012-06-25 11:24:24 -0700)


Jean Pihet (3):
  ARM: OMAP3: PM: cpuidle: default to C1 in next_valid_state
  ARM: OMAP3: PM: cpuidle: optimize the PER latency in C1 state
  ARM: OMAP3: PM: cpuidle: optimize the clkdm idle latency in C1 state

Kevin Hilman (3):
  ARM: OMAP2+: powerdomain: allow pre/post transtion to be per pwrdm
  ARM: OMAP3: PM: call pre/post transition per powerdomain
  ARM: OMAP3: PM: cleanup cam_pwrdm leftovers

 arch/arm/mach-omap2/cpuidle34xx.c |   71 +++--
 arch/arm/mach-omap2/omap-mpuss-lowpower.c |4 +-
 arch/arm/mach-omap2/pm34xx.c  |   21 ++---
 arch/arm/mach-omap2/powerdomain.c |   16 +--
 arch/arm/mach-omap2/powerdomain.h |4 +-
 5 files changed, 57 insertions(+), 59 deletions(-)
--
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


[GIT PULL] OMAP PM: misc. cleanup for v3.6

2012-06-26 Thread Kevin Hilman
Tony,

Please pull the following misc. PM cleanups for v3.6.

Kevin

The following changes since commit f8f5701bdaf9134b1f90e5044a82c66324d2073f:

  Linux 3.5-rc1 (2012-06-02 18:29:26 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git 
for_3.6/cleanup/pm

for you to fetch changes up to b110547e586eb5825bc1d04aa9147bff83b57672:

  ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one 
(2012-06-19 15:23:29 -0700)


Daniel Lezcano (1):
  ARM: OMAP3/4: consolidate cpuidle Makefile

Mark A. Greer (1):
  ARM: OMAP3: PM: Only access IVA if one exists

Nishanth Menon (1):
  ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one

 arch/arm/mach-omap2/Kconfig   |2 ++
 arch/arm/mach-omap2/Makefile  |7 +--
 arch/arm/mach-omap2/cpuidle34xx.c |8 
 arch/arm/mach-omap2/cpuidle44xx.c |8 
 arch/arm/mach-omap2/opp.c |3 +--
 arch/arm/mach-omap2/pm.h  |   17 +++--
 arch/arm/mach-omap2/pm34xx.c  |   15 ++-
 7 files changed, 33 insertions(+), 27 deletions(-)
--
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


[GIT PULL] OMAP: TWL IRQ dead code removal

2012-06-26 Thread Kevin Hilman
Tony,

Please pull the following cleanup which removes the now unused TWL irq
base/end.  The drivers part has been acked by Samuel.

Kevin


The following changes since commit f8f5701bdaf9134b1f90e5044a82c66324d2073f:

  Linux 3.5-rc1 (2012-06-02 18:29:26 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git 
for_3.6/cleanup/twl-irq

for you to fetch changes up to 3e7b706ca5151849e4ca91f7f3d8d6d8d8f7b667:

  mfd: twl: remove pdata-irq_base/_end, no more users (2012-06-19 15:24:34 
-0700)


Kevin Hilman (2):
  ARM: OMAP2+: TWL: remove usage of pdata-irq_base/_end
  mfd: twl: remove pdata-irq_base/_end, no more users

 arch/arm/mach-omap2/board-2430sdp.c|3 ---
 arch/arm/mach-omap2/board-omap3logic.c |3 ---
 arch/arm/mach-omap2/twl-common.c   |9 -
 include/linux/i2c/twl.h|1 -
 4 files changed, 16 deletions(-)
--
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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Grazvydas Ignotas
CCing some PM people, maybe they can comment?

On Tue, Jun 26, 2012 at 7:51 AM, Rajendra Nayak rna...@ti.com wrote:
 On Monday 25 June 2012 06:20 PM, Tomi Valkeinen wrote:

 Do you know how the drivers should handle CONFIG_PM_RUNTIME=n?
 Are they supposed to handle the error values returned by runtime PM
 functions somehow, or should they use #ifdef CONFIG_PM_RUNTIME?

 hmm, I always though with CONFIG_RUNTIME_PM=n, the functions would
 be stubbed to return success and not failure. And the _pm_runtime_resume
 function indeed seems to return 1, which is not failure but just saying
 that your device is already active/enabled.
 The _pm_runtime_suspend and _pm_runtime_idle do return a -ENOSYS, which
 is something only returned when CONFIG_RUNTIME_PM=n, so if you really
 want to handle failing pm_runtime_put_sync cases, maybe you still can.
 But then, I don't know if there is anything you can do to recover from
 a failing pm_runtime_put_sync, except for warning the user maybe.

 Both options sound a bit difficult to me... With the first one it's
 difficult to see if there was an actual error and we should somehow
 react to it, or is everything fine and we just shouldn't care about
 runtime PM. The second one requires ifdefs in many places.

-- 
Gražvydas
--
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] ARM: omap2: Fix redefinition of board_onenand_init

2012-06-26 Thread Waldemar Rymarkiewicz
Initialy defined in arch/arm/mach-omap2/board-flash.h and redefined in
arch/arm/mach-omap2/board-flash.c when CONFIG_MTD_ONENAND_OMAP2 were not set.

Signed-off-by: Waldemar Rymarkiewicz waldemar.rymarkiew...@gmail.com
---
 arch/arm/mach-omap2/board-flash.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/mach-omap2/board-flash.c 
b/arch/arm/mach-omap2/board-flash.c
index 70a81f9..53c39d2 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -97,11 +97,6 @@ __init board_onenand_init(struct mtd_partition 
*onenand_parts,
 
gpmc_onenand_init(board_onenand_data);
 }
-#else
-void
-__init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
-{
-}
 #endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */
 
 #if defined(CONFIG_MTD_NAND_OMAP2) || \
-- 
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: [PATCH] pinctrl: Add one-register-per-pin type device tree based pinctrl driver

2012-06-26 Thread Tony Lindgren
* Stephen Warren swar...@wwwdotorg.org [120622 10:37]:
 On 06/22/2012 02:39 AM, Tony Lindgren wrote:
  Hi,
  
  * Stephen Warren swar...@wwwdotorg.org [120621 15:17]:
  On 06/19/2012 07:56 AM, Tony Lindgren wrote:
  +
  +- pinctrl-single,pinconf-mask : mask of allowed pinconf bits in the
  +  pinmux register; this gets combined with pinconf mask but is a separate
  +  mask to allow the option of setting pinconf separatately from the
  +  function
 
  Given that this binding doesn't allow describing pin configuration at
  present, I would simply remove all mention of that property in the
  binding documentation. It can be added back if/when that feature is
  added. Any future driver using this binding can refuse to allow pin
  configuration if that property is missing.
  
  It might be better to just add support for pin_config_get/set to avoid
  changing the binding later:
  
   static int pcs_pinconf_get(struct pinctrl_dev *pctldev,
  unsigned pin, unsigned long *config)
   {
  -   return -ENOTSUPP;
  +   struct pcs_device *pcs;
  +   void __iomem *reg;
  +   int res;
  +
  +   pcs = pinctrl_dev_get_drvdata(pctldev);
  +   res = pcs_pin_to_reg(pcs, pin, reg);
  +   if (res)
  +   return res;
  +
  +   return pcs-read(reg)  pcs-cmask;
   }
  
  A have not done that yet as currently the pcs_pin_to_reg() would need to be
  sorted out in somewhat clean manner.
 
 Yes, implementing pinconf in the driver and binding would be a fine
 alternative; I just assumed you'd want to defer that. How would pinconf
 be represented in DT; just extra bits set in the value portion of the
 pins property? Thinking quickly, I guess that would work fine, since the
 binding's assumption is presumably that there's a 1:1 mapping between
 the set of pins that functions can be mux'd onto and the set of pins
 that can have pinconf applied, and the register to do both muxing and
 pinconf is the same.

Yes that's what I was thinking too.. But after some experiments, I'm
now thinking that we are better off dropping pinconf-mask for now and
only using one mask like you suggested earlier.

The reasoning for doing this is following:

1. Currently pin_config_get() requires the use of driver name and pin
   name, and we don't have a clean way of finding a pin register
   information without using names. That means that implementing
   pcs_pin_to_reg() in pinctrl-single is going to be ugly.

2. Eventually I'd like to make pin names optional in the pinctrl
   framework to save some parsing and memory in the DT case for SoCs
   that have a large number of pins. So adding more dependency to
   the pin names will just make that more complex.

3. We can already do the dynamic remuxing with named states and
   pinctrl_select_state().

4. If needed, we can add support for the pinconf-mask later on like
   you mentioned earlier.

Updated patch below.

Regards,

Tony


From: Tony Lindgren t...@atomide.com
Date: Tue, 26 Jun 2012 04:27:15 -0700
Subject: [PATCH] pinctrl: Add one-register-per-pin type device tree based 
pinctrl driver

Add one-register-per-pin type device tree based pinctrl driver.

This driver has been tested on omap2+ series of processors,
where there is either an 8 or 16-bit padconf register for each pin.
Support for other similar pinmux controllers can be added.

Signed-off-by: Tony Lindgren t...@atomide.com

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt 
b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
new file mode 100644
index 000..4623c50
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
@@ -0,0 +1,93 @@
+One-register-per-pin type device tree based pinctrl driver
+
+Required properties:
+- compatible : pinctrl-single
+
+- reg : offset and length of the register set for the mux registers
+
+- pinctrl-single,register-width : pinmux register access width in bits
+
+- pinctrl-single,function-mask : mask of allowed pinmux function bits
+  in the pinmux register
+
+Optional properties:
+- pinctrl-single,function-off : function off mode for disabled state if
+  available and same for all registers; if not specified, disabling of
+  pin functions is ignored
+
+This driver assumes that there is only one register for each pin,
+and uses the common pinctrl bindings as specified in the pinctrl-bindings.txt
+document in this directory.
+
+The pin configuration nodes for pinctrl-single are specified as pinctrl
+register offset and value pairs using pinctrl-single,pins. Only the bits
+specified in pinctrl-single,function-mask are updated. For example, setting
+a pin for a device could be done with:
+
+   pinctrl-single,pins = 0xdc 0x118;
+
+Where 0xdc is the offset from the pinctrl register base address for the
+device pinctrl register, and 0x118 contains the desired value of the
+pinctrl register. See the device example and static board pins example
+below for more information.
+
+Example:
+
+/* SoC common file */
+
+/* first 

Re: [PATCH] ARM: omap2: Fix redefinition of board_onenand_init

2012-06-26 Thread Tony Lindgren
Hi,

* Waldemar Rymarkiewicz waldemar.rymarkiew...@tieto.com [120626 06:21]:
 Initialy defined in arch/arm/mach-omap2/board-flash.h and redefined in
 arch/arm/mach-omap2/board-flash.c when CONFIG_MTD_ONENAND_OMAP2 were not set.

Thanks, but I already have an earlier version from Kevin queued up that
I forgot to send upstream last week.

Regards,

Tony
 
 Signed-off-by: Waldemar Rymarkiewicz waldemar.rymarkiew...@gmail.com
 ---
  arch/arm/mach-omap2/board-flash.c |5 -
  1 file changed, 5 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/board-flash.c 
 b/arch/arm/mach-omap2/board-flash.c
 index 70a81f9..53c39d2 100644
 --- a/arch/arm/mach-omap2/board-flash.c
 +++ b/arch/arm/mach-omap2/board-flash.c
 @@ -97,11 +97,6 @@ __init board_onenand_init(struct mtd_partition 
 *onenand_parts,
  
   gpmc_onenand_init(board_onenand_data);
  }
 -#else
 -void
 -__init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 
 cs)
 -{
 -}
  #endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */
  
  #if defined(CONFIG_MTD_NAND_OMAP2) || \
 -- 
 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
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH 0/3] OMAP3 I2C/SCCB support

2012-06-26 Thread Laurent Pinchart
Hi everybody,

While trying to use an OV7725 camera sensor with an OMAP3 system I ran into a
couple of issues related to the sensor communication protocol. Instead of
using the obiquitous I2C protocol, Omnivision invited the SCCB communication
bus, very similar to I2C but different enough not to be compatible.

SCCB documentation is available at
http://www.ovt.com/download_document.php?type=documentDID=63. SCCB exists in
two flavors, 3-wire and 2-wire. The 3-wire version is too different from I2C
to be of interest here.

SCCB is very close to SMBus. It supports two transactions, an 8-bit register
read and an 8-bit register write. The write transaction transmits a 3-byte
message (addr/w, reg, data). The read transaction transmits 2 2-byte messages
(addr/w, reg, followed by addr/r, data).

The two majors differences between I2C and SCCB are in the acknowledgment bit
and in the stop bit.

SCCB devices generate no ack bit and don't take the ack bit generated by the
master into account. The ack bit is thus an unspecified bit, present in the
transfer but whose value must be ignored. However, in practice, the SCCB
components I've seen implement the ack bit in write transactions.

The stop bit is handled as in I2C, except that a stop bit needs to be
generated between the two messages that make the read transaction (as opposed
to SMBus, where no stop bit must be present between the two messages).

I need SCCB support in the I2C core and in the OMAP3 I2C driver and have two
options. The OMAP3 I2C controller support SCCB natively. The interface exposed
by the hardware is at the transaction level (smbus_xfer), while the i2c-omap
driver exposes a message level interface (master_xfer). To use the native SCCB
support, we would thus have to either allow i2c_smbus_xfer() to choose between
smbus_xfer and i2c_smbus_xfer_emulated based on the client type (I2C or SCCB),
or export i2c_smbus_xfer_emulated() to use it as a fallback in the i2c-omap
driver for I2C clients.

Another option is not to use the hardware SCCB support, but to emulate it
through I2C. In that case the i2c-omap driver must generate a stop bit after
the first message of a read transaction, and ignore the ack bit. Two flags
would then be necessary, one in the message to force the stop bit, and one in
the i2c_client to mark the device as using SCCB.

Implementing support for the second option is required for I2C masters that
have no hardware SCCB support. As the first option won't bring much benefits,
I've decided to skip it for now. The following three patches thus implement
emulated SCCB support in the I2C core, with a small change in the i2c-omap
driver to support the new I2C_M_STOP flag.

Laurent Pinchart (3):
  i2c: Add SCCB support
  i2c: Fall back to emulated SMBus if the operation isn't supported
natively
  i2c: omap: Add support for I2C_M_STOP message flag

 drivers/i2c/busses/i2c-omap.c |2 ++
 drivers/i2c/i2c-core.c|   22 +++---
 include/linux/i2c.h   |2 ++
 3 files changed, 23 insertions(+), 3 deletions(-)

-- 
Regards,

Laurent Pinchart

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


[RFC/PATCH 3/3] i2c: omap: Add support for I2C_M_STOP message flag

2012-06-26 Thread Laurent Pinchart
Generate a stop condition after each message marked with I2C_M_STOP.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/i2c/busses/i2c-omap.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 801df60..cf1bda0 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -545,6 +545,8 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
if (dev-speed  400)
w |= OMAP_I2C_CON_OPMODE_HS;
 
+   if (msg-flags  I2C_M_STOP)
+   stop = 1;
if (msg-flags  I2C_M_TEN)
w |= OMAP_I2C_CON_XA;
if (!(msg-flags  I2C_M_RD))
-- 
1.7.3.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


[RFC/PATCH 1/3] i2c: Add SCCB support

2012-06-26 Thread Laurent Pinchart
SCCB is a serial communication bus developed by Omnivision. Its 2-wire
mode is very similar to SMBus byte data transactions, but requires the
controller to ignore the ACK bit and to insert a stop condition after
each message.

Add a device SCCB flag and a message stop flag to be passed to
controller drivers.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/i2c/i2c-core.c |   13 -
 include/linux/i2c.h|2 ++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index feb7dc3..8cfa660 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1939,6 +1939,12 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter 
*adapter, u16 addr,
u8 partial_pec = 0;
int status;
 
+   if (unlikely(flags  I2C_CLIENT_SCCB)  size != I2C_SMBUS_BYTE_DATA) {
+   dev_err(adapter-dev,
+   SCCB devices only support I2C_SMBUS_BYTE_DATA\n);
+   return -EINVAL;
+   }
+
msgbuf0[0] = command;
switch (size) {
case I2C_SMBUS_QUICK:
@@ -1956,6 +1962,11 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter 
*adapter, u16 addr,
}
break;
case I2C_SMBUS_BYTE_DATA:
+   if (unlikely(flags  I2C_CLIENT_SCCB)) {
+   msg[0].flags |= I2C_M_IGNORE_NAK | I2C_M_STOP;
+   msg[1].flags |= I2C_M_IGNORE_NAK | I2C_M_STOP;
+   }
+
if (read_write == I2C_SMBUS_READ)
msg[1].len = 1;
else {
@@ -2105,7 +2116,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, 
unsigned short flags,
int try;
s32 res;
 
-   flags = I2C_M_TEN | I2C_CLIENT_PEC;
+   flags = I2C_M_TEN | I2C_CLIENT_PEC | I2C_CLIENT_SCCB;
 
if (adapter-algo-smbus_xfer) {
i2c_lock_adapter(adapter);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 195d8b3..bd42914 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -420,6 +420,7 @@ void i2c_lock_adapter(struct i2c_adapter *);
 void i2c_unlock_adapter(struct i2c_adapter *);
 
 /*flags for the client struct: */
+#define I2C_CLIENT_SCCB0x02/* Use Omnivision SCCB protocol 
*/
 #define I2C_CLIENT_PEC 0x04/* Use Packet Error Checking */
 #define I2C_CLIENT_TEN 0x10/* we have a ten bit chip address */
/* Must equal I2C_M_TEN below */
@@ -540,6 +541,7 @@ struct i2c_msg {
__u16 flags;
 #define I2C_M_TEN  0x0010  /* this is a ten bit chip address */
 #define I2C_M_RD   0x0001  /* read data, from slave to master */
+#define I2C_M_STOP 0x8000  /* if I2C_FUNC_PROTOCOL_MANGLING */
 #define I2C_M_NOSTART  0x4000  /* if I2C_FUNC_PROTOCOL_MANGLING */
 #define I2C_M_REV_DIR_ADDR 0x2000  /* if I2C_FUNC_PROTOCOL_MANGLING */
 #define I2C_M_IGNORE_NAK   0x1000  /* if I2C_FUNC_PROTOCOL_MANGLING */
-- 
1.7.3.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


[RFC/PATCH 2/3] i2c: Fall back to emulated SMBus if the operation isn't supported natively

2012-06-26 Thread Laurent Pinchart
Adapter drivers might support only a subset of the SMBus operations
natively. Those drivers currently have to manually emulate unsupported
operations using I2C.

Make the i2c_smbus_xfer() function fall back to
i2c_smbus_xfer_emulated() when the adapter's .smbus_xfer() operation
returns -EOPNOTSUPP, like it already does when the .smbus_xfer()
operation isn't available at all.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/i2c/i2c-core.c |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 8cfa660..16e750e 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -2113,8 +2113,8 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, 
unsigned short flags,
   union i2c_smbus_data *data)
 {
unsigned long orig_jiffies;
+   s32 res = -EOPNOTSUPP;
int try;
-   s32 res;
 
flags = I2C_M_TEN | I2C_CLIENT_PEC | I2C_CLIENT_SCCB;
 
@@ -2134,7 +2134,12 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 
addr, unsigned short flags,
break;
}
i2c_unlock_adapter(adapter);
-   } else
+   }
+
+   /* Fall back to i2c_smbus_xfer_emulated of the adapter doesn't implement
+* native support for the SMBus operation.
+*/
+   if (res == -EOPNOTSUPP  adapter-algo-master_xfer)
res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write,
  command, protocol, data);
 
-- 
1.7.3.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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Alan Stern
On Tue, 26 Jun 2012, Grazvydas Ignotas wrote:

 CCing some PM people, maybe they can comment?
 
 On Tue, Jun 26, 2012 at 7:51 AM, Rajendra Nayak rna...@ti.com wrote:
  On Monday 25 June 2012 06:20 PM, Tomi Valkeinen wrote:
 
  Do you know how the drivers should handle CONFIG_PM_RUNTIME=n?
  Are they supposed to handle the error values returned by runtime PM
  functions somehow, or should they use #ifdef CONFIG_PM_RUNTIME?
 
  hmm, I always though with CONFIG_RUNTIME_PM=n, the functions would
  be stubbed to return success and not failure.

Not exactly.  They are stubbed to indicate that the device cannot be 
suspended, that it is always active.

Failure to suspend a device should not be regarded as particularly bad, 
because it doesn't affect the device's functionality.  That's true even 
when CONFIG_RUNTIME_PM is enabled.

 And the _pm_runtime_resume
  function indeed seems to return 1, which is not failure but just saying
  that your device is already active/enabled.
  The _pm_runtime_suspend and _pm_runtime_idle do return a -ENOSYS, which
  is something only returned when CONFIG_RUNTIME_PM=n, so if you really
  want to handle failing pm_runtime_put_sync cases, maybe you still can.
  But then, I don't know if there is anything you can do to recover from
  a failing pm_runtime_put_sync, except for warning the user maybe.

I don't see much point in warning the user that a device was unable to 
go to low power.

Alan Stern

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


Re: [PATCH v4 3/3] ARM: OMAP2+: onenand: prepare for gpmc driver migration

2012-06-26 Thread Jon Hunter
Hi Afzal,

On 06/26/2012 03:29 AM, Mohammed, Afzal wrote:
 Hi Jon,
 
 On Mon, Jun 25, 2012 at 21:42:14, Hunter, Jon wrote:
 On 06/22/2012 04:01 AM, Afzal Mohammed wrote:
 
 +static int hf, vhf, sync_read, sync_write, latency;

 I am wondering if we can remove hf, vhf, sync_read/write variables
 completely. We already have flags from sync_read/write and so we could
 just use the cfg-flags variable and remove sync_read/write variables.
 
 For default frequency, sync_write can get turned off, so flag may or
 may not be same as sync_write

Good point. I missed that.


 At the same time, we could create flags for ONENAND_FREQ_HF and
 ONENAND_FREQ_VHF or something like that. It could be nice to store the
 latency in onenand_data too. In other words, keep all the configuration
 in one place.
 
 I have a feeling as though platform data fields should not be altered once
 platform device is registered (as platform data being specific to the
 board, thinking further, should they be const?, except for a case
 where it is created by a common helper function for multiple boards with
 varying capabilities of peripheral).
 
 Other than sync_read, all others like hf, vhf, latency, sync_write are
 updated during driver callback, so if we are going to put these in
 platform private data fields, platform private data fields has to be
 updated after platform device is registered.

May be this is splitting hairs then but I wonder if we should just have
a single global variable called onenand_flags for storing the current
state of sync_read, sync_write, vhf and hf. At least this would be only
one global instead of 4. Not a big deal.

Cheers
Jon
--
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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Jassi Brar
On 26 June 2012 17:33, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 On Tue, 2012-06-26 at 15:27 +0530, Jassi Brar wrote:

 Seems similar, but I only tested OMAP4 HDMI.

 Would something like this one below work for you? It fixes the issues on
 my overo board.

I think this should work too (I will get to test it only tomorrow).

Though I don't think it'll fix stack spew when run without
CONFIG_PM_RUNTIME. Maybe we could simply remove the WARN_ON in the
xxx_runtime_put() as Alan noted?

-j

 Instead of using omapdss device's suspend/resume callbacks, this one
 uses PM notifier calls which happen before suspend and after resume.

 I still think the suspend handling is wrong, omapdss shouldn't be
 enabling and disabling panel devices like that, but this one should
 remove the biggest issues with the current suspend method.

  Tomi

 diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
 index 5066eee..c35a248 100644
 --- a/drivers/video/omap2/dss/core.c
 +++ b/drivers/video/omap2/dss/core.c
 @@ -32,6 +32,7 @@
  #include linux/io.h
  #include linux/device.h
  #include linux/regulator/consumer.h
 +#include linux/suspend.h

  #include video/omapdss.h

 @@ -201,6 +202,30 @@ int dss_debugfs_create_file(const char *name, void 
 (*write)(struct seq_file *))
  #endif /* CONFIG_DEBUG_FS  CONFIG_OMAP2_DSS_DEBUG_SUPPORT */

  /* PLATFORM DEVICE */
 +static int omap_dss_pm_notif(struct notifier_block *b, unsigned long v, void 
 *d)
 +{
 +       DSSDBG(pm notif %lu\n, v);
 +
 +       switch (v)
 +       {
 +       case PM_SUSPEND_PREPARE:
 +               DSSDBG(suspending displays\n);
 +               return dss_suspend_all_devices();
 +
 +       case PM_POST_SUSPEND:
 +               DSSDBG(resuming displays\n);
 +               return dss_resume_all_devices();
 +
 +       default:
 +               return 0;
 +       }
 +}
 +
 +static struct notifier_block omap_dss_pm_notif_block =
 +{
 +       .notifier_call = omap_dss_pm_notif,
 +};
 +
  static int __init omap_dss_probe(struct platform_device *pdev)
  {
        struct omap_dss_board_info *pdata = pdev-dev.platform_data;
 @@ -224,6 +249,8 @@ static int __init omap_dss_probe(struct platform_device 
 *pdev)
        else if (pdata-default_device)
                core.default_display_name = pdata-default_device-name;

 +       register_pm_notifier(omap_dss_pm_notif_block);
 +
        return 0;

  err_debugfs:
 @@ -233,6 +260,8 @@ err_debugfs:

  static int omap_dss_remove(struct platform_device *pdev)
  {
 +       unregister_pm_notifier(omap_dss_pm_notif_block);
 +
        dss_uninitialize_debugfs();

        dss_uninit_overlays(pdev);
 @@ -247,25 +276,9 @@ static void omap_dss_shutdown(struct platform_device 
 *pdev)
        dss_disable_all_devices();
  }

 -static int omap_dss_suspend(struct platform_device *pdev, pm_message_t state)
 -{
 -       DSSDBG(suspend %d\n, state.event);
 -
 -       return dss_suspend_all_devices();
 -}
 -
 -static int omap_dss_resume(struct platform_device *pdev)
 -{
 -       DSSDBG(resume\n);
 -
 -       return dss_resume_all_devices();
 -}
 -
  static struct platform_driver omap_dss_driver = {
        .remove         = omap_dss_remove,
        .shutdown       = omap_dss_shutdown,
 -       .suspend        = omap_dss_suspend,
 -       .resume         = omap_dss_resume,
        .driver         = {
                .name   = omapdss,
                .owner  = THIS_MODULE,




-- 
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106  -
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH 0/3] OMAP3 I2C/SCCB support

2012-06-26 Thread jean-philippe francois
2012/6/26 Laurent Pinchart laurent.pinch...@ideasonboard.com:
 Hi everybody,

 While trying to use an OV7725 camera sensor with an OMAP3 system I ran into a
 couple of issues related to the sensor communication protocol. Instead of
 using the obiquitous I2C protocol, Omnivision invited the SCCB communication
 bus, very similar to I2C but different enough not to be compatible.


I have been using omnivision sensor without being aware of this issue,
and without any i2c reliability issue either.

Here is typical code I use :

/* This function is used to read value from register for i2c client */
static int ov2710_read(struct i2c_client *client, unsigned short reg,
unsigned char *val)
{
int err = 0;
unsigned char outbuf[] = {(reg8)0xff, reg0xff};
unsigned char inbuf[1];
struct i2c_msg msg[] = {
{ .addr = client-addr, .flags = 0, .buf = outbuf, .len = 2 },
{ .addr = client-addr, .flags = I2C_M_RD, .buf = inbuf, .len = 1 },
};
err = i2c_transfer(client-adapter, msg, 2);
/* error handling and pass by ref handling */

}

Is the point of this patch to avoid writing such functions again and
again in every ov driver ?
What is solved in practice by this patch that is not solved by a
regular i2c transfer ?

Regards,
Jean-Philippe François

 SCCB documentation is available at
 http://www.ovt.com/download_document.php?type=documentDID=63. SCCB exists in
 two flavors, 3-wire and 2-wire. The 3-wire version is too different from I2C
 to be of interest here.

 SCCB is very close to SMBus. It supports two transactions, an 8-bit register
 read and an 8-bit register write. The write transaction transmits a 3-byte
 message (addr/w, reg, data). The read transaction transmits 2 2-byte messages
 (addr/w, reg, followed by addr/r, data).

 The two majors differences between I2C and SCCB are in the acknowledgment bit
 and in the stop bit.

 SCCB devices generate no ack bit and don't take the ack bit generated by the
 master into account. The ack bit is thus an unspecified bit, present in the
 transfer but whose value must be ignored. However, in practice, the SCCB
 components I've seen implement the ack bit in write transactions.

 The stop bit is handled as in I2C, except that a stop bit needs to be
 generated between the two messages that make the read transaction (as opposed
 to SMBus, where no stop bit must be present between the two messages).

 I need SCCB support in the I2C core and in the OMAP3 I2C driver and have two
 options. The OMAP3 I2C controller support SCCB natively. The interface exposed
 by the hardware is at the transaction level (smbus_xfer), while the i2c-omap
 driver exposes a message level interface (master_xfer). To use the native SCCB
 support, we would thus have to either allow i2c_smbus_xfer() to choose between
 smbus_xfer and i2c_smbus_xfer_emulated based on the client type (I2C or SCCB),
 or export i2c_smbus_xfer_emulated() to use it as a fallback in the i2c-omap
 driver for I2C clients.

 Another option is not to use the hardware SCCB support, but to emulate it
 through I2C. In that case the i2c-omap driver must generate a stop bit after
 the first message of a read transaction, and ignore the ack bit. Two flags
 would then be necessary, one in the message to force the stop bit, and one in
 the i2c_client to mark the device as using SCCB.

 Implementing support for the second option is required for I2C masters that
 have no hardware SCCB support. As the first option won't bring much benefits,
 I've decided to skip it for now. The following three patches thus implement
 emulated SCCB support in the I2C core, with a small change in the i2c-omap
 driver to support the new I2C_M_STOP flag.

 Laurent Pinchart (3):
  i2c: Add SCCB support
  i2c: Fall back to emulated SMBus if the operation isn't supported
    natively
  i2c: omap: Add support for I2C_M_STOP message flag

  drivers/i2c/busses/i2c-omap.c |    2 ++
  drivers/i2c/i2c-core.c        |   22 +++---
  include/linux/i2c.h           |    2 ++
  3 files changed, 23 insertions(+), 3 deletions(-)

 --
 Regards,

 Laurent Pinchart

 --
 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: [PATCH v4 3/3] ARM: OMAP2+: onenand: prepare for gpmc driver migration

2012-06-26 Thread Jon Hunter
Hi Afzal,

On 06/26/2012 09:39 AM, Jon Hunter wrote:
 Hi Afzal,
 
 On 06/26/2012 03:29 AM, Mohammed, Afzal wrote:
 Hi Jon,

 On Mon, Jun 25, 2012 at 21:42:14, Hunter, Jon wrote:
 On 06/22/2012 04:01 AM, Afzal Mohammed wrote:

 +static int hf, vhf, sync_read, sync_write, latency;

 I am wondering if we can remove hf, vhf, sync_read/write variables
 completely. We already have flags from sync_read/write and so we could
 just use the cfg-flags variable and remove sync_read/write variables.

 For default frequency, sync_write can get turned off, so flag may or
 may not be same as sync_write
 
 Good point. I missed that.
 

 At the same time, we could create flags for ONENAND_FREQ_HF and
 ONENAND_FREQ_VHF or something like that. It could be nice to store the
 latency in onenand_data too. In other words, keep all the configuration
 in one place.

 I have a feeling as though platform data fields should not be altered once
 platform device is registered (as platform data being specific to the
 board, thinking further, should they be const?, except for a case
 where it is created by a common helper function for multiple boards with
 varying capabilities of peripheral).

 Other than sync_read, all others like hf, vhf, latency, sync_write are
 updated during driver callback, so if we are going to put these in
 platform private data fields, platform private data fields has to be
 updated after platform device is registered.
 
 May be this is splitting hairs then but I wonder if we should just have
 a single global variable called onenand_flags for storing the current
 state of sync_read, sync_write, vhf and hf. At least this would be only
 one global instead of 4. Not a big deal.

Apart from the above minor nit-pick, please add ...

Reviewed-by: Jon Hunter jon-hun...@ti.com

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


Re: [PATCH V3 1/2] of: Add generic device tree DMA helpers

2012-06-26 Thread Arnd Bergmann
On Tuesday 26 June 2012, Vinod Koul wrote:
 Today, we just ask for a channel with specific mask. Further filtering
 is done in filter function as we request a channel, not a specific one.
 In most slave cases, we need a specific channel from a specific
 controller, and that is where DT can play a role. In addition to DMA
 resources for dma and client driver, I would expect DT to provide the
 channel mapping information, which is anyway known only by platform.

Can you describe what you mean by channel mapping information?
Is that not what we pass into the filter function?

 That should be a dmaengine binding and not client or controller
 specific. For different platforms this information can come from DT or
 something else.
 Then, once a channel is requested dmaengine knows what to provide.
 And as you see the filter becomes redundant.

But what code interprets the channel mapping then?

 On Mon, 2012-06-25 at 20:30 +, Arnd Bergmann wrote:
  I agree, at least for the long run. However, that is a separate issue to 
  work on.
  Right now we need a generic way to represent dma requests independent of how
  they are used in the kernel. The device tree binding is supposed to be
  operating system independent so there should be nothing in it that requires
  the use of the linux dmaengine code.
  
  For drivers that do not use dmaengine, we have to make a decision whether
  it's worth adding support for the DT binding first and converting the driver
  and its users to dmaengine later, or whether it's better to use the 
  dmaengine
  API right away to avoid having to do changes twice.
 Latter please :)

I'd always leave that decision up to the author of each driver that gets
converted. Fortunately there are very few left that are not already using
the dmaengine interfaces.

 On Fri, Jun 22, 2012 at 05:52:08PM -0500, Jon Hunter wrote:

 1. chan = of_dma_request_channel(dev-of_node, 0);
 2. chan = of_dma_request_channel(dev-of_node, 0);
 3. rxchan = of_dma_request_channel(dev-of_node, DMA_MEM_TO_DEV);
txchan = of_dma_request_channel(dev-of_node, DMA_DEV_TO_MEM);
 4. rxchan = of_dma_request_channel(dev-of_node, DMA_MEM_TO_DEV);
txchan = of_dma_request_channel(dev-of_node, DMA_DEV_TO_MEM);
 5. chan = of_dma_request_named_channel(dev-of_node, rwdata, 0);
auxchan = of_dma_request_named_channel(dev-of_node, status, 
 DMA_DEV_TO_MEM);
 6. chan = of_dma_request_named_channel(dev-of_node, rwdata, 0);
auxchan = of_dma_request_named_channel(dev-of_node, status, 
 DMA_DEV_TO_MEM);

 In the above examples, did you imply that the 
 of_dma_request_channel()
 function would return a type of struct dma_chan and so be calling
 dma_request_channel() underneath?

 I am been prototyping something, but wanted to make sure I am 
 completely
 aligned on this :-)
  
  This is what I think we need to be heading to.
 I am not sure about this, maybe haven't understood all details yet.
 
 But, I was hoping the DT binding will be hidden. DMAengine driver will
 get resource information from DT. Clients will get DMA resource
 information from DT. And if possible dmaengine gets mapping information
 from DT.
 So then why should we have xx_dma_xxx apis?

I think encoding a description for a dma request in a single number is
the last thing we want to do here. We've tried that with IRQ and GPIO
numbers and it got us into a huge mess that will need a long time to
get out of.

Some platforms actually use IORESOURCE_DMA, which was useful to describe
ISA DMA channels, for encoding some form of channel or request number,
but this causes all sorts of problems. These are almost exclusively
used by those platforms that don't have a dmaengine driver yet, so I'd
hope that we can remove this as we convert those platforms over to
dmaengine and device tree.

The representation in device tree as we have it now is a combination of
a pointer to the dmaengine and a description of the request line in it,
typically a single small integer number local to the dmaengine. We should
not try to make that a global integer number again that just serves the
purpose of looking up the dmaengine and local number again.

IMHO no device driver should be bothered with any artificial resource
information, but instead I want all the DT parsing to happen in the
dmaengine code (or some wrapper around it) where it gets used. The only
thing that a device driver needs to know is that it wants to use a
channel based on what is described in the device tree.

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: [PATCH] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Tomi Valkeinen
On Tue, 2012-06-26 at 10:34 -0400, Alan Stern wrote:
 On Tue, 26 Jun 2012, Grazvydas Ignotas wrote:
 
  CCing some PM people, maybe they can comment?
  
  On Tue, Jun 26, 2012 at 7:51 AM, Rajendra Nayak rna...@ti.com wrote:
   On Monday 25 June 2012 06:20 PM, Tomi Valkeinen wrote:
  
   Do you know how the drivers should handle CONFIG_PM_RUNTIME=n?
   Are they supposed to handle the error values returned by runtime PM
   functions somehow, or should they use #ifdef CONFIG_PM_RUNTIME?
  
   hmm, I always though with CONFIG_RUNTIME_PM=n, the functions would
   be stubbed to return success and not failure.
 
 Not exactly.  They are stubbed to indicate that the device cannot be 
 suspended, that it is always active.
 
 Failure to suspend a device should not be regarded as particularly bad, 
 because it doesn't affect the device's functionality.  That's true even 
 when CONFIG_RUNTIME_PM is enabled.

This makes sense. So if CONFIG_RUNTIME_PM=n, using pm_runtime_get_sync()
will return 1, meaning the HW is already enabled, and using
pm_runtime_put_sync() will return -ENOSYS, meaning the hardware cannot
be suspended.

With CONFIG_RUNTIME_PM=y, it's a bit more complex. If I read the code
correctly, when I call pm_runtime_get_sync(), the usage counter is
always increased, even if the pm_runtime_resume() fails. So a get()
needs to be always matched with a put(), even if get() has returned an
error.

But if pm_runtime_get_sync() returns an error, it means the HW has not
been resumed successfully, and is not operational, so the code should
bail out somehow. So basically I'd use this kind of pattern everywhere I
use pm_runtime_get_sync():

---

r = pm_runtime_get_sync(dev);
if (r  0) {
pm_runtime_put_sync(dev);
/* handle error */
return -ESOMETHING;
}

/* do the work */

pm_runtime_put_sync(dev);

---

Is this correct?

 Tomi



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


Re: [PATCH] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Tomi Valkeinen
On Tue, 2012-06-26 at 20:19 +0530, Jassi Brar wrote:
 On 26 June 2012 17:33, Tomi Valkeinen tomi.valkei...@ti.com wrote:
  On Tue, 2012-06-26 at 15:27 +0530, Jassi Brar wrote:
 
  Seems similar, but I only tested OMAP4 HDMI.
 
  Would something like this one below work for you? It fixes the issues on
  my overo board.
 
 I think this should work too (I will get to test it only tomorrow).
 
 Though I don't think it'll fix stack spew when run without
 CONFIG_PM_RUNTIME. Maybe we could simply remove the WARN_ON in the
 xxx_runtime_put() as Alan noted?

Yes, that's a different issue. I'll look at that also.

 Tomi



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


Re: [PATCH] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Jassi Brar
On 26 June 2012 20:38, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 On Tue, 2012-06-26 at 20:19 +0530, Jassi Brar wrote:
 On 26 June 2012 17:33, Tomi Valkeinen tomi.valkei...@ti.com wrote:
  On Tue, 2012-06-26 at 15:27 +0530, Jassi Brar wrote:
 
  Seems similar, but I only tested OMAP4 HDMI.
 
  Would something like this one below work for you? It fixes the issues on
  my overo board.
 
 I think this should work too (I will get to test it only tomorrow).

 Though I don't think it'll fix stack spew when run without
 CONFIG_PM_RUNTIME. Maybe we could simply remove the WARN_ON in the
 xxx_runtime_put() as Alan noted?

 Yes, that's a different issue. I'll look at that also.

Well, my patch took care of that also. But I agree, that could be
added separately as well.
--
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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Alan Stern
On Tue, 26 Jun 2012, Tomi Valkeinen wrote:

  Failure to suspend a device should not be regarded as particularly bad, 
  because it doesn't affect the device's functionality.  That's true even 
  when CONFIG_RUNTIME_PM is enabled.
 
 This makes sense. So if CONFIG_RUNTIME_PM=n, using pm_runtime_get_sync()
 will return 1, meaning the HW is already enabled, and using
 pm_runtime_put_sync() will return -ENOSYS, meaning the hardware cannot
 be suspended.
 
 With CONFIG_RUNTIME_PM=y, it's a bit more complex. If I read the code
 correctly, when I call pm_runtime_get_sync(), the usage counter is
 always increased, even if the pm_runtime_resume() fails. So a get()
 needs to be always matched with a put(), even if get() has returned an
 error.

Right.  Of course, it doesn't hurt to match a get() with a put() even 
when CONFIG_RUNTIME_PM=n.

 But if pm_runtime_get_sync() returns an error, it means the HW has not
 been resumed successfully, and is not operational, so the code should
 bail out somehow. So basically I'd use this kind of pattern everywhere I
 use pm_runtime_get_sync():
 
 ---
 
 r = pm_runtime_get_sync(dev);
 if (r  0) {
   pm_runtime_put_sync(dev);

Here you could just as well call pm_runtime_put_noidle().  Since the 
device wasn't resumed, the put operation doesn't need to try to suspend 
it.

   /* handle error */
   return -ESOMETHING;
 }
 
 /* do the work */
 
 pm_runtime_put_sync(dev);
 
 ---
 
 Is this correct?

Yep, you've got it.

Alan Stern

--
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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Tomi Valkeinen
On Tue, 2012-06-26 at 20:39 +0530, Jassi Brar wrote:
 On 26 June 2012 20:38, Tomi Valkeinen tomi.valkei...@ti.com wrote:
  On Tue, 2012-06-26 at 20:19 +0530, Jassi Brar wrote:
  On 26 June 2012 17:33, Tomi Valkeinen tomi.valkei...@ti.com wrote:
   On Tue, 2012-06-26 at 15:27 +0530, Jassi Brar wrote:
  
   Seems similar, but I only tested OMAP4 HDMI.
  
   Would something like this one below work for you? It fixes the issues on
   my overo board.
  
  I think this should work too (I will get to test it only tomorrow).
 
  Though I don't think it'll fix stack spew when run without
  CONFIG_PM_RUNTIME. Maybe we could simply remove the WARN_ON in the
  xxx_runtime_put() as Alan noted?
 
  Yes, that's a different issue. I'll look at that also.
 
 Well, my patch took care of that also. But I agree, that could be
 added separately as well.

Well, I don't agree that your patch is correct =). I don't think it's
right to skip runtime get and put when pm_runtime_enabled() returns
false.

 Tomi



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


Re: [RFC/PATCH 0/3] OMAP3 I2C/SCCB support

2012-06-26 Thread Laurent Pinchart
Hi Jean-Philippe,

On Tuesday 26 June 2012 16:49:35 jean-philippe francois wrote:
 2012/6/26 Laurent Pinchart laurent.pinch...@ideasonboard.com:
  Hi everybody,
  
  While trying to use an OV7725 camera sensor with an OMAP3 system I ran
  into a couple of issues related to the sensor communication protocol.
  Instead of using the obiquitous I2C protocol, Omnivision invited the SCCB
  communication bus, very similar to I2C but different enough not to be
  compatible.
 I have been using omnivision sensor without being aware of this issue,
 and without any i2c reliability issue either.
 
 Here is typical code I use :
 
 /* This function is used to read value from register for i2c client */
 static int ov2710_read(struct i2c_client *client, unsigned short reg,
 unsigned char *val)
 {
 int err = 0;
 unsigned char outbuf[] = {(reg8)0xff, reg0xff};

According to the SCCB specification (or at least the version I've found) 
register addresses are 8-bit. The OV2710 might just be I2C-compatible.

 unsigned char inbuf[1];
 struct i2c_msg msg[] = {
 { .addr = client-addr, .flags = 0, .buf = outbuf, .len = 2 },
 { .addr = client-addr, .flags = I2C_M_RD, .buf = inbuf, .len = 1 },
 };
 err = i2c_transfer(client-adapter, msg, 2);
 /* error handling and pass by ref handling */
 
 }

The ov772x driver uses i2c_smbus_write_byte_data() and 
i2c_smbus_read_byte_data(). The later calls

i2c_smbus_xfer(client-adapter, client-addr, client-flags,
   I2C_SMBUS_READ, I2C_SMBUS_BYTE_DATA, data);

which calls i2c_smbus_xfer_emulated() for hosts that don't support SMBus 
transfers natively, and that's pretty much equivalent to your above code 
(except for the 8/16 bit register address).

It might be a good idea to implement i2c_smbus_*-like functions for 16-bit 
register addresses in the I2C core, they could be reused across drivers.

 Is the point of this patch to avoid writing such functions again and again
 in every ov driver ?

No, but that's a good idea as well :-)

 What is solved in practice by this patch that is not solved by a regular i2c
 transfer ?

The above code will not ignore acks/nacks and will not generate a stop 
condition between the two messages. The SCCB specification states that 
acks/nacks must be ignored and that a stop condition must be generated. The 
OV7725 handles acks/nacks correctly, but chokes if no stop condition is 
generated. The point of this patch set is to fix both problems (although the 
acks/nacks issue might be theoretical only).

-- 
Regards,

Laurent Pinchart

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


Re: [RFC/PATCH 0/3] OMAP3 I2C/SCCB support

2012-06-26 Thread Gary Thomas

On 2012-06-26 10:20, Laurent Pinchart wrote:

Hi Jean-Philippe,

On Tuesday 26 June 2012 16:49:35 jean-philippe francois wrote:

2012/6/26 Laurent Pinchartlaurent.pinch...@ideasonboard.com:

Hi everybody,

While trying to use an OV7725 camera sensor with an OMAP3 system I ran
into a couple of issues related to the sensor communication protocol.
Instead of using the obiquitous I2C protocol, Omnivision invited the SCCB
communication bus, very similar to I2C but different enough not to be
compatible.

I have been using omnivision sensor without being aware of this issue,
and without any i2c reliability issue either.

Here is typical code I use :

/* This function is used to read value from register for i2c client */
static int ov2710_read(struct i2c_client *client, unsigned short reg,
unsigned char *val)
{
 int err = 0;
 unsigned char outbuf[] = {(reg8)0xff, reg0xff};


According to the SCCB specification (or at least the version I've found)
register addresses are 8-bit. The OV2710 might just be I2C-compatible.


 unsigned char inbuf[1];
 struct i2c_msg msg[] = {
 { .addr = client-addr, .flags = 0, .buf = outbuf, .len = 2 },
 { .addr = client-addr, .flags = I2C_M_RD, .buf = inbuf, .len = 1 },
};
 err = i2c_transfer(client-adapter, msg, 2);
 /* error handling and pass by ref handling */
 
}


The ov772x driver uses i2c_smbus_write_byte_data() and
i2c_smbus_read_byte_data(). The later calls

i2c_smbus_xfer(client-adapter, client-addr, client-flags,
I2C_SMBUS_READ, I2C_SMBUS_BYTE_DATA,data);

which calls i2c_smbus_xfer_emulated() for hosts that don't support SMBus
transfers natively, and that's pretty much equivalent to your above code
(except for the 8/16 bit register address).

It might be a good idea to implement i2c_smbus_*-like functions for 16-bit
register addresses in the I2C core, they could be reused across drivers.


Is the point of this patch to avoid writing such functions again and again
in every ov driver ?


No, but that's a good idea as well :-)


What is solved in practice by this patch that is not solved by a regular i2c
transfer ?


The above code will not ignore acks/nacks and will not generate a stop
condition between the two messages. The SCCB specification states that
acks/nacks must be ignored and that a stop condition must be generated. The
OV7725 handles acks/nacks correctly, but chokes if no stop condition is
generated. The point of this patch set is to fix both problems (although the
acks/nacks issue might be theoretical only).


How does it choke?  I've had success talking to the OV8820 using the
normal I2C driver as well.

--

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world

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


Re: [RFC/PATCH 0/3] OMAP3 I2C/SCCB support

2012-06-26 Thread Laurent Pinchart
Hi Gary,

On Tuesday 26 June 2012 10:25:58 Gary Thomas wrote:
 On 2012-06-26 10:20, Laurent Pinchart wrote:
  On Tuesday 26 June 2012 16:49:35 jean-philippe francois wrote:
  2012/6/26 Laurent Pinchartlaurent.pinch...@ideasonboard.com:
  Hi everybody,
  
  While trying to use an OV7725 camera sensor with an OMAP3 system I ran
  into a couple of issues related to the sensor communication protocol.
  Instead of using the obiquitous I2C protocol, Omnivision invited the
  SCCB communication bus, very similar to I2C but different enough not to
  be compatible.
  
  I have been using omnivision sensor without being aware of this issue,
  and without any i2c reliability issue either.
  
  Here is typical code I use :
  
  /* This function is used to read value from register for i2c client */
  static int ov2710_read(struct i2c_client *client, unsigned short reg,
  unsigned char *val)
  {
  
   int err = 0;
   unsigned char outbuf[] = {(reg8)0xff, reg0xff};
  
  According to the SCCB specification (or at least the version I've found)
  register addresses are 8-bit. The OV2710 might just be I2C-compatible.
  
   unsigned char inbuf[1];
   struct i2c_msg msg[] = {
   
   { .addr = client-addr, .flags = 0, .buf = outbuf, .len = 2 },
   { .addr = client-addr, .flags = I2C_M_RD, .buf = inbuf, .len =
   1 },
  
  };
  
   err = i2c_transfer(client-adapter, msg, 2);
   /* error handling and pass by ref handling */
   
  
  }
  
  The ov772x driver uses i2c_smbus_write_byte_data() and
  i2c_smbus_read_byte_data(). The later calls
  
  i2c_smbus_xfer(client-adapter, client-addr, client-flags,
  
  I2C_SMBUS_READ, I2C_SMBUS_BYTE_DATA,data);
  
  which calls i2c_smbus_xfer_emulated() for hosts that don't support SMBus
  transfers natively, and that's pretty much equivalent to your above code
  (except for the 8/16 bit register address).
  
  It might be a good idea to implement i2c_smbus_*-like functions for 16-bit
  register addresses in the I2C core, they could be reused across drivers.
  
  Is the point of this patch to avoid writing such functions again and
  again in every ov driver ?
  
  No, but that's a good idea as well :-)
  
  What is solved in practice by this patch that is not solved by a regular
  i2c transfer ?
  
  The above code will not ignore acks/nacks and will not generate a stop
  condition between the two messages. The SCCB specification states that
  acks/nacks must be ignored and that a stop condition must be generated.
  The OV7725 handles acks/nacks correctly, but chokes if no stop condition
  is generated. The point of this patch set is to fix both problems
  (although the acks/nacks issue might be theoretical only).
 
 How does it choke?  I've had success talking to the OV8820 using the
 normal I2C driver as well.

With the patches applied:

[   23.277893] omap3isp omap3isp: Revision 15.0 found
[   23.283721] omap-iommu omap-iommu.0: isp: version 1.1
[   25.244079] ov772x 2-0021: ov7725 Product ID 77:21 Manufacturer ID 7f:a2

Without the patches applied:

[   23.505493] omap3isp omap3isp: Revision 15.0 found
[   23.511138] omap-iommu omap-iommu.0: isp: version 1.1
[   25.552246] omap_i2c omap_i2c.2: Arbitration lost
[   26.583160] omap_i2c omap_i2c.2: timeout waiting for bus ready
[   27.598785] omap_i2c omap_i2c.2: timeout waiting for bus ready
[   28.614196] omap_i2c omap_i2c.2: timeout waiting for bus ready
[   28.623260] isp_register_subdev_group: Unable to register subdev ov772x

-- 
Regards,

Laurent Pinchart

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


Re: [RFC/PATCH 0/3] OMAP3 I2C/SCCB support

2012-06-26 Thread Jean Delvare
Salut Laurent,

On Tue, 26 Jun 2012 18:20:33 +0200, Laurent Pinchart wrote:
 It might be a good idea to implement i2c_smbus_*-like functions for 16-bit 
 register addresses in the I2C core, they could be reused across drivers.

Except that they would preferably not be called i2c_smbus_*, not being
part of the SMBus subset nor being commonly implemented by SMBus-only
controllers. Finding a proper name for these helpers function might be
tough, as may be figuring out which ones you really want to implement
and which ones aren't worth it.

Also note that this is more or less what regmap is trying to do, so you
may want to check in that direction (see drivers/base/regmap) first.

-- 
Jean Delvare
--
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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Jassi Brar
On 26 June 2012 20:41, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 On Tue, 2012-06-26 at 20:39 +0530, Jassi Brar wrote:
 On 26 June 2012 20:38, Tomi Valkeinen tomi.valkei...@ti.com wrote:
  On Tue, 2012-06-26 at 20:19 +0530, Jassi Brar wrote:
  On 26 June 2012 17:33, Tomi Valkeinen tomi.valkei...@ti.com wrote:
   On Tue, 2012-06-26 at 15:27 +0530, Jassi Brar wrote:
  
   Seems similar, but I only tested OMAP4 HDMI.
  
   Would something like this one below work for you? It fixes the issues on
   my overo board.
  
  I think this should work too (I will get to test it only tomorrow).
 
  Though I don't think it'll fix stack spew when run without
  CONFIG_PM_RUNTIME. Maybe we could simply remove the WARN_ON in the
  xxx_runtime_put() as Alan noted?
 
  Yes, that's a different issue. I'll look at that also.
 
 Well, my patch took care of that also. But I agree, that could be
 added separately as well.

 Well, I don't agree that your patch is correct =). I don't think it's
 right to skip runtime get and put when pm_runtime_enabled() returns
 false.

While I think your patch is simpler and achieve the same, I also think
your fears about this patch are unfounded.

A quick snack for thought...

 But if pm_runtime_get_sync() returns an error, it means the HW has not
 been resumed successfully, and is not operational,

Not always. The HW could be in RPM_ACTIVE state while PM on it could
be disabled, if the returned error is -EACCESS.   And
pm_runtime_enabled() only catches a potential -EACCESS.


BTW, I just tested your patch and it worked for me as well. But as
suspected, it doesn't help the stack spew of CONFIG_PM_RUNTIME:=n

So I understand, I only need to resend the other three patches ?

Thanks.
--
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] pinctrl: Add one-register-per-pin type device tree based pinctrl driver

2012-06-26 Thread Stephen Warren
On 06/26/2012 07:43 AM, Tony Lindgren wrote:
...
 Subject: [PATCH] pinctrl: Add one-register-per-pin type device tree based 
 pinctrl driver
 
 Add one-register-per-pin type device tree based pinctrl driver.
 
 This driver has been tested on omap2+ series of processors,
 where there is either an 8 or 16-bit padconf register for each pin.
 Support for other similar pinmux controllers can be added.

 diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt 
 b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt

 +/* board specific .dts file */
 +
 +pmx_core {

 + board_pins: pinmux_board_pins {
 + pinctrl-single,pins = 
 + 0x6c 0xf/* csi21_dx3 OUTPUT | MODE7 */
 + 0x6e 0xf/* csi21_dy3 OUTPUT | MODE7 */
 + 0x70 0xf/* csi21_dx4 OUTPUT | MODE7 */
 + 0x72 0xf/* csi21_dy4 OUTPUT | MODE7 */

If you're removing the pinconf mask, I think the comments in the example
should reflect just setting a particular mux function, and remove any
references to pinconf settings in that field. While the binding can be
abused to do that, I think the docs shouldn't encourage it:-)

Other than that, the binding looks reasonable to me, given what it's
intended to do.

However, I'd still like Grant and Rob (and any other DT experts) to
explicitly sign off on this binding, because it's doing exactly
something that was rejected at Linaro Connect in February (albeit the
binding is slightly more oriented at specifically being for pinmux
rather than a fully general blast in these register values, but that
distinction seems minor to me).
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V3 1/2] of: Add generic device tree DMA helpers

2012-06-26 Thread Vinod Koul
On Tue, 2012-06-26 at 14:59 +, Arnd Bergmann wrote:
 On Tuesday 26 June 2012, Vinod Koul wrote:
  Today, we just ask for a channel with specific mask. Further filtering
  is done in filter function as we request a channel, not a specific one.
  In most slave cases, we need a specific channel from a specific
  controller, and that is where DT can play a role. In addition to DMA
  resources for dma and client driver, I would expect DT to provide the
  channel mapping information, which is anyway known only by platform.
 
 Can you describe what you mean by channel mapping information?
 Is that not what we pass into the filter function?
Today many dmaengine drivers have a filter function which is exported
and then used by clients to filter out the channel. That is not a right
way to do, so any future plan which is based on filter is not correct.
IMHO dmaengine driver should *not* know anything about mapping. By
mapping I refer to platform information which tells me which client can
use which channel from which dmac.
If the dmaengine hardware has mux then we have flexible mapping, other
cases would be where request lines are hard wired, so mapping is pretty
much static.
This information if provided to dmaengine can result in dmaengine doing
proper allocation of dma channels.
One of the proposals we discussed sometime back:
https://lkml.org/lkml/2012/3/8/26

  That should be a dmaengine binding and not client or controller
  specific. For different platforms this information can come from DT or
  something else.
  Then, once a channel is requested dmaengine knows what to provide.
  And as you see the filter becomes redundant.
 
 But what code interprets the channel mapping then?
only dmaengine. In this case the mapping comes from DT.

 I think encoding a description for a dma request in a single number is
 the last thing we want to do here. We've tried that with IRQ and GPIO
 numbers and it got us into a huge mess that will need a long time to
 get out of.
No i wasn't thinking of a number. The mapping shouldn't be a global
number at all, though that is a very easy but not very scalable
solution.
We need to take care of 1:1 mapping of client and channels as well as
many:1  cases as well. A single global number cannot represent that
properly.

My idea is platform gives this information to dmaengine. Clients and
dmaengine driver do not worry about it. That also paves way for arch
independent clients and drivers.
 
 Some platforms actually use IORESOURCE_DMA, which was useful to describe
 ISA DMA channels, for encoding some form of channel or request number,
 but this causes all sorts of problems. These are almost exclusively
 used by those platforms that don't have a dmaengine driver yet, so I'd
 hope that we can remove this as we convert those platforms over to
 dmaengine and device tree.
 
 The representation in device tree as we have it now is a combination of
 a pointer to the dmaengine and a description of the request line in it,
 typically a single small integer number local to the dmaengine. We should
 not try to make that a global integer number again that just serves the
 purpose of looking up the dmaengine and local number again.
 
 IMHO no device driver should be bothered with any artificial resource
 information, but instead I want all the DT parsing to happen in the
 dmaengine code (or some wrapper around it) where it gets used. The only
 thing that a device driver needs to know is that it wants to use a
 channel based on what is described in the device tree.
Sure, but I would expect the clients and dmacs to find information about
their devices from DT?
dmaengine should get only mapping information used for allocating
channel to client.

-- 
~Vinod

--
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: Panda ES board hang when using GPIO as interrupt

2012-06-26 Thread Franky Lin

On 06/26/2012 12:21 AM, DebBarma, Tarun Kanti wrote:

On Tue, Jun 26, 2012 at 2:22 AM, Franky Lin fran...@broadcom.com wrote:

Hi Kevin, Tarun,

We are using the expansion connector A on Panda board to mount a SDIO WiFi
dongle on MMC2 with a level triggered interrupt signal connected to GPIO
138. It's been working fine until 3.5 rc1. The board hang randomly within 5
mins during a network traffic test. After bisecting we found the culprit is
[PATCH 8/8] gpio/omap: fix missing check in *_runtime_suspend() [1].

I noticed Kevin raised some similar cases on other platforms and also
provided two patches in the patch mail thread. But unfortunately those two
patches doesn't help in our case. I tested the driver with 3.5-rc3 mainline
kernel and the issue is still there. I can only fix the hang by either
reverting the commit or disabling CONFIG_PM_RUNTIME. Also, the hang only
happens on Panda ES board. Old Panda with 4430 works good.

Any thoughts and suggestions?

I just had a quick look at the code. Can you please check if the
attached patch solves
the issue? I just boot tested on Panda and Blaze.
--
Tarun



Thanks for the prompt reply.

Booting is fine even without the patch and revert. The wifi dongle 
generates interrupt whenever there is data packet available for host to 
read. So during a traffic test a significant numbers of interrupt will 
be triggered through the GPIO. So I assume it has something to do with 
the interrupt GPIO.


With the patch, the kernel still crashes. But the symptom is slightly 
different. Now it has a panic log every time. See attachment.


Regards,
Franky
[  636.143585] Internal error: Oops - undefined instruction: 0 [#1] SMP ARM 


[  636.150634] Modules linked in: brcmfmac brcmutil cfg80211


[  636.156311] CPU: 0Not tainted  (3.5.0-rc4+ #3)   


[  636.161346] PC is at __lock_acquire+0x65c/0x1d88 


[  636.166198] LR is at 0x6093  


[  636.169494] pc : [c008e670]lr : [6093]psr: 2093  


[  636.169494] sp : c06b1e18  ip : 9e370001  fp : c0724f70  


[  636.181549] r10: c06b  r9 : 001e  r8 : c0b92998  


[  636.187042] r7 : c06d2cc8  r6 :   r5 : c0746d64  r4 : c06d2868   


[  636.193908] r3 : 3b0e  r2 : ec3b001d  r1 : 0001d870  r0 : 001d   


[  636.200744] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment 
kernel  
   
[  636.208526] Control: 10c53c7d  Table: ae39c04a  DAC: 0017


[  636.214569] Process swapper/0 (pid: 0, stack limit = 0xc06b02f8) 


[  636.220855] Stack: (0xc06b1e18 to 0xc06b2000)


[  636.225433] 1e00:   
c06d00f8 0002   
 
[  636.234039] 1e20: c0807968 0001  0002 001d  
0001 0001d870   
 
[  636.242614] 1e40: c08070e8 0001  0002 0002  
 c00903e4   
 
[  636.251220] 1e60: 0002 0080  c0066838   
6093    
 
[  636.259796] 1e80: 6093  c06b4324 c06b   
0002    

Re: [RFC 0/3] Add cyclic DMA support to OMAP DMA engine driver

2012-06-26 Thread Russell King - ARM Linux
On Mon, Jun 25, 2012 at 10:08:13PM +0530, Vinod Koul wrote:
 Hi Russell,
 
 What is the status of the virtual dma and the series you have posted
 previously. Is it ready for merge?
 
 I would be away for 10days starting coming Thursday. So please let me
 know

I have no idea.

I've just rebased all the DMA stuff onto -rc4, because -rc3 is just a
whole load of problems for OMAP, and I'm still struggling with the
stupid OMAP audio crap.  And what with people who know how the SDP4430
works and/or OMAP audio works going on holiday too, I don't see much
progress being made until August time.

I've found that the only way I can get any audio out of the SDP4430
platform is if I have something connected to the 3.5mm jack before
powering up the board, and keep it connected.  So provided I do that
I can test the OMAP audio stuff.

Of course, finding out crap like that takes time away from my _one_
day a _week_ that I'm working on OMAP stuff...
--
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] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Tomi Valkeinen
On Tue, 2012-06-26 at 22:31 +0530, Jassi Brar wrote:

 While I think your patch is simpler and achieve the same, I also think
 your fears about this patch are unfounded.

Perhaps. But I do get a bad feeling from your patch, and I don't like
when that happens =). What I fear with changes like you made is that
they'll hide problems that should be fixed in other ways.

And I think that was the case here also. I think we should not call
dispc_runtime_get() during suspend. If pm_runtime_get returns -EACCES,
we do have a possible problem, and we should not silently ignore it.

 A quick snack for thought...
 
  But if pm_runtime_get_sync() returns an error, it means the HW has not
  been resumed successfully, and is not operational,
 
 Not always. The HW could be in RPM_ACTIVE state while PM on it could
 be disabled, if the returned error is -EACCESS.   And
 pm_runtime_enabled() only catches a potential -EACCESS.

True. But the HW could also be in disabled state. And that would lead to
a crash when accessing the registers.

It is not a fatal error if pm_runtime_get returns -EACCES, but we sure
shouldn't ignore it (or avoid it with pm_runtime_enabled()), but handle
it. In some rare cases it could be ok to get -EACCES, but that's a
special case, not standard.

 BTW, I just tested your patch and it worked for me as well. But as
 suspected, it doesn't help the stack spew of CONFIG_PM_RUNTIME:=n
 
 So I understand, I only need to resend the other three patches ?

Yes, please.

 Tomi



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


Re: [PATCH V3 1/2] of: Add generic device tree DMA helpers

2012-06-26 Thread Arnd Bergmann
On Tuesday 26 June 2012, Vinod Koul wrote:
 On Tue, 2012-06-26 at 14:59 +, Arnd Bergmann wrote:
  On Tuesday 26 June 2012, Vinod Koul wrote:
   Today, we just ask for a channel with specific mask. Further filtering
   is done in filter function as we request a channel, not a specific one.
   In most slave cases, we need a specific channel from a specific
   controller, and that is where DT can play a role. In addition to DMA
   resources for dma and client driver, I would expect DT to provide the
   channel mapping information, which is anyway known only by platform.
  
  Can you describe what you mean by channel mapping information?
  Is that not what we pass into the filter function?

 Today many dmaengine drivers have a filter function which is exported
 and then used by clients to filter out the channel. That is not a right
 way to do, so any future plan which is based on filter is not correct.

I agree that exporting a filter function from the dmaengine driver is
very wrong and should not be done because it requires that the device
driver knows which engine is used and that is contrary to the idea
of having an abstraction layer.

We were talking about using a filter function because that would be
easy to do without changing the core dmaengine code. However, in the
proposal, there would actually just be a single filter function that
gets used by all drivers that have DT bindings, and it can be
completely encapsulated in the of_dma_request_channel() function
so it does not have to be a global symbol.

If we instead modify the dmaengine code itself to know about DT
rather than wrapping around it, we would not need this filter
function, but we should still have a probe() function that is
called by dmaengine code to interpret the data that is specific
to one dmaengine driver.

 IMHO dmaengine driver should *not* know anything about mapping. By
 mapping I refer to platform information which tells me which client can
 use which channel from which dmac.

Agreed too. That information shoudd be part of the slave device-node
in DT, as I have argued in this thread already. The slave device driver
does not need to care about the format or the contents of it,
but we need some code to interpret the contents. From all I can tell,
the structure of this data cannot be completely generic because of
all the special cases, so the code to interpret it would live in the
probe() function I mentioned about that the dmaengine driver provides.

  I think encoding a description for a dma request in a single number is
  the last thing we want to do here. We've tried that with IRQ and GPIO
  numbers and it got us into a huge mess that will need a long time to
  get out of.
 No i wasn't thinking of a number. The mapping shouldn't be a global
 number at all, though that is a very easy but not very scalable
 solution.
 We need to take care of 1:1 mapping of client and channels as well as
 many:1  cases as well. A single global number cannot represent that
 properly.
 
 My idea is platform gives this information to dmaengine. Clients and
 dmaengine driver do not worry about it. That also paves way for arch
 independent clients and drivers.

IMO the platform should have no part in this. I absolutely want to
get rid of any platform-specific hardcoded tables in the kernel for
stuff that can easily be run-time detected from the device tree.
There are cases where hard-coding in the kernel is easier, but I don't
think this is one of them.

  Some platforms actually use IORESOURCE_DMA, which was useful to describe
  ISA DMA channels, for encoding some form of channel or request number,
  but this causes all sorts of problems. These are almost exclusively
  used by those platforms that don't have a dmaengine driver yet, so I'd
  hope that we can remove this as we convert those platforms over to
  dmaengine and device tree.
  
  The representation in device tree as we have it now is a combination of
  a pointer to the dmaengine and a description of the request line in it,
  typically a single small integer number local to the dmaengine. We should
  not try to make that a global integer number again that just serves the
  purpose of looking up the dmaengine and local number again.
  
  IMHO no device driver should be bothered with any artificial resource
  information, but instead I want all the DT parsing to happen in the
  dmaengine code (or some wrapper around it) where it gets used. The only
  thing that a device driver needs to know is that it wants to use a
  channel based on what is described in the device tree.
 Sure, but I would expect the clients and dmacs to find information about
 their devices from DT?
 dmaengine should get only mapping information used for allocating
 channel to client.

Let's take a look at a concrete example. The
arch/arm/mach-ux500/board-mop500-sdi.c file defines dma channel
configuration for the mmc devices on the ux500 platform that looks
like

static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
  

[PATCH 1/2] ARM: omap: fix typos related to OMAP330

2012-06-26 Thread Paul Bolle
Signed-off-by: Paul Bolle pebo...@tiscali.nl
---
I tracked this set of typos back to commit
9ad5897c2659b3c610e0c717e8b3dbfb496d2c74 ([ARM] 3143/1: OMAP 4/5:
Update omap include files). It is just something I noticed while
working on the next patch.

 arch/arm/plat-omap/include/plat/cpu.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 297245d..f2bdf15 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -238,7 +238,7 @@ IS_AM_SUBCLASS(335x, 0x335)
 /*
  * Macros to detect individual cpu types.
  * These are only rarely needed.
- * cpu_is_omap330():   True for OMAP330
+ * cpu_is_omap310():   True for OMAP310
  * cpu_is_omap730():   True for OMAP730
  * cpu_is_omap850():   True for OMAP850
  * cpu_is_omap1510():  True for OMAP1510
@@ -304,7 +304,7 @@ IS_OMAP_TYPE(3517, 0x3517)
 
 /*
  * Whether we have MULTI_OMAP1 or not, we still need to distinguish
- * between 730 vs 850, 330 vs. 1510 and 1611B/5912 vs. 1710.
+ * between 730 vs 850, 310 vs. 1510 and 1611B/5912 vs. 1710.
  */
 
 #if defined(CONFIG_ARCH_OMAP730)
-- 
1.7.7.6

--
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/2] ARM: omap: remove unused cpu detection macros

2012-06-26 Thread Paul Bolle
Now that OMAP730 and OMAP850 support is mostly unified, there's no
need for separate cpu detection macros for these architectures. At
least, currently there isn't, because both macros are unused.
cpu_is_7xx() seems to cover all possible uses.

Signed-off-by: Paul Bolle pebo...@tiscali.nl
---
0) Entirely untested!

1) And now the IS_OMAP_TYPE() macro calls for 730 and 850 are unused.
Not sure whether they should be removed too.

2) Note that cpu_is_omap343x(), cpu_is_omap447x(), and cpu_is_omap2423()
are all unused too. Reserved for future use, I guess.

 arch/arm/plat-omap/include/plat/cpu.h |   16 +---
 1 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index f2bdf15..e5304f2 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -239,8 +239,6 @@ IS_AM_SUBCLASS(335x, 0x335)
  * Macros to detect individual cpu types.
  * These are only rarely needed.
  * cpu_is_omap310():   True for OMAP310
- * cpu_is_omap730():   True for OMAP730
- * cpu_is_omap850():   True for OMAP850
  * cpu_is_omap1510():  True for OMAP1510
  * cpu_is_omap1610():  True for OMAP1610
  * cpu_is_omap1611():  True for OMAP1611
@@ -281,8 +279,6 @@ IS_OMAP_TYPE(3505, 0x3517)
 IS_OMAP_TYPE(3517, 0x3517)
 
 #define cpu_is_omap310()   0
-#define cpu_is_omap730()   0
-#define cpu_is_omap850()   0
 #define cpu_is_omap1510()  0
 #define cpu_is_omap1610()  0
 #define cpu_is_omap5912()  0
@@ -304,19 +300,9 @@ IS_OMAP_TYPE(3517, 0x3517)
 
 /*
  * Whether we have MULTI_OMAP1 or not, we still need to distinguish
- * between 730 vs 850, 310 vs. 1510 and 1611B/5912 vs. 1710.
+ * between 310 vs. 1510 and 1611B/5912 vs. 1710.
  */
 
-#if defined(CONFIG_ARCH_OMAP730)
-# undef  cpu_is_omap730
-# define cpu_is_omap730()  is_omap730()
-#endif
-
-#if defined(CONFIG_ARCH_OMAP850)
-# undef  cpu_is_omap850
-# define cpu_is_omap850()  is_omap850()
-#endif
-
 #if defined(CONFIG_ARCH_OMAP15XX)
 # undef  cpu_is_omap310
 # undef  cpu_is_omap1510
-- 
1.7.7.6

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


Re: [RFC/PATCH 0/3] OMAP3 I2C/SCCB support

2012-06-26 Thread Laurent Pinchart
Hi Jean,

On Tuesday 26 June 2012 18:56:16 Jean Delvare wrote:
 On Tue, 26 Jun 2012 18:20:33 +0200, Laurent Pinchart wrote:
  It might be a good idea to implement i2c_smbus_*-like functions for 16-bit
  register addresses in the I2C core, they could be reused across drivers.
 
 Except that they would preferably not be called i2c_smbus_*, not being
 part of the SMBus subset nor being commonly implemented by SMBus-only
 controllers.

Sure. We need another name.

 Finding a proper name for these helpers function might be tough, as may be
 figuring out which ones you really want to implement and which ones aren't
 worth it.
 
 Also note that this is more or less what regmap is trying to do, so you
 may want to check in that direction (see drivers/base/regmap) first.

Thanks, I didn't know about that.

-- 
Regards,

Laurent Pinchart

--
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 05/11] OMAPDSS: add clk_prepare and clk_unprepare

2012-06-26 Thread Mike Turquette
On 20120625-16:14, Tomi Valkeinen wrote:
 A question about clk_prepare/unprepare, not directly related: let's say
 I have a driver for some HW block. The driver doesn't use clk functions,
 but uses runtime PM. The driver also sets pm_runtime_irq_safe().
 
 Now, the driver can call pm_runtime_get_sync() in an atomic context, and
 this would lead to the underlying framework (hwmod, omap_device, I don't
 know who =) enabling the func clock for that HW. But this would happen
 in atomic context, so the underlying framework can't use clk_prepare.
 
 How does the underlying framework handle that case? (sorry if that's a
 stupid question =).
 

I think it's a good question!

If we're going to call clk_prepare_enable from within a runtime pm
callback then I think we'll need to check if _irq_safe() is set and
conditionally call only clk_enable in such a case.

I'm not a runtime pm expert, but if the driver owns the responsibility
of calling pm_runtime_irq_safe then the driver has the proper context
to know that it should call clk_prepare BEFORE calling
pm_runtime_get_sync.

However if some other framework (outside of the driver) calls
pm_runtime_irq_safe then it will be difficult for the driver to know
what to do...

Regards,
Mike

  Tomi
 


--
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 07/11] I2C: OMAP: Handle error check for pm runtime

2012-06-26 Thread Kevin Hilman
Shubhrajyoti D shubhrajy...@ti.com writes:

 If PM runtime get_sync fails return with the error
 so that no further reads/writes goes through the interface.
 This will avoid possible abort. Add a error message in case
 of failure with the cause of the failure.

 Reviewed-by: Kevin Hilman khil...@ti.com
 Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com

This patch introduced a regression where the runtime PM usecount will
never reach zero and so CORE retention is prevented after any xfer
failures...

 ---
 -v10 Use IS_ERR_VALUE
 -v9 Fix the error handling

  drivers/i2c/busses/i2c-omap.c |   14 +++---
  1 files changed, 11 insertions(+), 3 deletions(-)

 diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
 index 44e8cfa..c39b72f 100644
 --- a/drivers/i2c/busses/i2c-omap.c
 +++ b/drivers/i2c/busses/i2c-omap.c
 @@ -585,7 +585,9 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg 
 msgs[], int num)
   int i;
   int r;
  
 - pm_runtime_get_sync(dev-dev);
 + r = pm_runtime_get_sync(dev-dev);
 + if (IS_ERR_VALUE(r))
 + return r;

This return should be 'goto out' so the runtime PM usecount is
decremented by the 'put'.  Otherwise, after failure, the usecount
remains non-zero, so the device is considered 'active' and keeps the
containing power domain active.

I found this on a 3730/OveroSTORM where the suspend/resume of MMC fails
because I2C is already suspended.  After the suspend though, the CORE
powerdomain never again hits retention, and I tracked it down to this.

I'll send a separate patch to fix this shortly.

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


[PATCH] I2C: OMAP: xfer: fix runtime PM get/put balance on error

2012-06-26 Thread Kevin Hilman
In omap_i2c_xfer(), ensure pm_runtime_put() is called, even on
failure.

Without this, after a failed xfer, the runtime PM usecount will have
been incremented, but not decremented causing the usecount to never
reach zero after a failure.  This keeps the device always runtime PM
enabled which keeps the enclosing power domain active, and prevents
full-chip retention/off from happening during idle.

Cc: Shubhrajyoti D shubhrajy...@ti.com
Signed-off-by: Kevin Hilman khil...@ti.com
---
This patch applies to current i2c-embedded/for-next branch

 drivers/i2c/busses/i2c-omap.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 9895fa7..b105733 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -582,7 +582,7 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg 
msgs[], int num)
 
r = pm_runtime_get_sync(dev-dev);
if (IS_ERR_VALUE(r))
-   return r;
+   goto out;
 
r = omap_i2c_wait_for_bb(dev);
if (r  0)
-- 
1.7.9.2

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


Re: [PATCH] gpio/omap: fix irq loss while in idle with debounce on

2012-06-26 Thread Kevin Hilman
Grazvydas Ignotas nota...@gmail.com writes:

 It seems that currently GPIO module is not working correctly during idle
 when debounce is enabled - the system almost never responds to button
 presses (observed on OMAP3530 ES2.1 and OMAP3630 ES1.2 pandora boards).
 Even though wakeups are probably working, it seems that the GPIO module
 itself is unable to detect input events and generate interrupts.
 OMAP35x TRM also states that:
   If the debounce clock is inactive, the debounce cell gates all
input signals and thus cannot be used.

 So whenever we are disabling debounce clocks (for PM or other reasons),
 be sure the module's debounce feature is disabled too.

 Cc: Kevin Hilman khil...@ti.com
 Signed-off-by: Grazvydas Ignotas nota...@gmail.com

This looks right, thanks for the patch.

I will queue it up for v3.6 and get it some broader testing before
sending to Grant.

Kevin

 ---
  drivers/gpio/gpio-omap.c |   10 ++
  1 files changed, 10 insertions(+), 0 deletions(-)

 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
 index c4ed172..ff213e7 100644
 --- a/drivers/gpio/gpio-omap.c
 +++ b/drivers/gpio/gpio-omap.c
 @@ -174,12 +174,22 @@ static inline void _gpio_dbck_enable(struct gpio_bank 
 *bank)
   if (bank-dbck_enable_mask  !bank-dbck_enabled) {
   clk_enable(bank-dbck);
   bank-dbck_enabled = true;
 +
 + __raw_writel(bank-dbck_enable_mask,
 +  bank-base + bank-regs-debounce_en);
   }
  }
  
  static inline void _gpio_dbck_disable(struct gpio_bank *bank)
  {
   if (bank-dbck_enable_mask  bank-dbck_enabled) {
 + /*
 +  * Disable debounce before cutting it's clock. If debounce is
 +  * enabled but the clock is not, GPIO module seems to be unable
 +  * to detect events and generate interrupts at least on OMAP3.
 +  */
 + __raw_writel(0, bank-base + bank-regs-debounce_en);
 +
   clk_disable(bank-dbck);
   bank-dbck_enabled = false;
   }
--
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: DM3730 without PMIC oops on idle

2012-06-26 Thread Kevin Hilman
jean-philippe francois jp.franc...@cynove.com writes:

 Hi,

 My board does not have any Power Management IC.
 Without the following patch, the bood ends with an oops.
 How can I further debug this, ie trace through the assembly
 in arch/arm/mach-omap2/sleep34xx.S ?

The assembly code that is faulting has nothing to do with interaction
with the PMIC.  

Some more comments below ...

 --
 Patch needed to boot to userspace :

 Index: linux-3.4.3/arch/arm/mach-omap2/pm34xx.c
 ===
 --- linux-3.4.3.orig/arch/arm/mach-omap2/pm34xx.c 2012-06-17
 20:21:44.0 +0200
 +++ linux-3.4.3/arch/arm/mach-omap2/pm34xx.c  2012-06-22 16:26:38.0 
 +0200
 @@ -403,7 +403,7 @@
   trace_power_start(POWER_CSTATE, 1, smp_processor_id());
   trace_cpu_idle(1, smp_processor_id());

 - omap_sram_idle();
 + //  omap_sram_idle();

FYI... you can get the same effect without patching the kernel by adding
'nohlt' to the kernel command line.  That avoids entering the idle loop
alltogether.

   trace_power_end(smp_processor_id());
   trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());

 --
 Bootlog without patch :
 Booting Linux on physical CPU 0
 Linux version 3.4.3 (cynove@jp) (gcc version 4.3.2 (Sourcery G++ Lite
 2008q3-41) ) #2 PREEMPT Fri Jun 22 16:33:06 CEST 2012
 CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7d
 CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
 Machine: Cynove CYDM3730
 Reserving 4194304 bytes SDRAM for VRAM
 Memory policy: ECC disabled, Data cache writeback
 OMAP3630 ES1.2 (l2cache iva sgx neon isp 192mhz_clk )
 Clocking rate (Crystal/Core/MPU): 19.2/400/832 MHz
 Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 45056
 Kernel command line: console=ttyO2,115200n8 rdinit=/sbin/init
 initrd=0x8300,1536k
 mtdparts=omap2-nand.0:1024k(bootloaders),3072k(linux),1536k(ramfs),-(usr)
 ubi.mtd=3,2048 mem=55M@0x8000 mem=128M@0x8800
 PID hash table entries: 1024 (order: 0, 4096 bytes)
 Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
 Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
 Memory: 55MB 123MB = 178MB total
 Memory: 174688k/174688k available, 12704k reserved, 0K highmem
 Virtual kernel memory layout:
 vector  : 0x - 0x1000   (   4 kB)
 fixmap  : 0xfff0 - 0xfffe   ( 896 kB)
 vmalloc : 0xd080 - 0xff00   ( 744 MB)
 lowmem  : 0xc000 - 0xd000   ( 256 MB)
 modules : 0xbf00 - 0xc000   (  16 MB)
   .text : 0xc0008000 - 0xc03c5080   (3829 kB)
   .init : 0xc03c6000 - 0xc03ef000   ( 164 kB)
   .data : 0xc03f - 0xc042b6c8   ( 238 kB)
.bss : 0xc042b6ec - 0xc043bdc8   (  66 kB)
 NR_IRQS:440
 IRQ: Found an INTC at 0xfa20 (revision 4.0) with 96 interrupts
 Total of 96 interrupts on 1 active controller
 OMAP clockevent source: GPTIMER1 at 32768 Hz
 sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 131071999ms
 Console: colour dummy device 80x30
 Calibrating delay loop... 831.32 BogoMIPS (lpj=3246080)
 pid_max: default: 32768 minimum: 301
 Mount-cache hash table entries: 512
 CPU: Testing write buffer coherency: ok
 Setting up static identity map for 0x802ad4b0 - 0x802ad508
 devtmpfs: initialized
 dummy:
 NET: Registered protocol family 16
 GPMC revision 5.0
 gpiochip_add: registered GPIOs 0 to 31 on device: gpio
 OMAP GPIO hardware version 2.5
 gpiochip_add: registered GPIOs 32 to 63 on device: gpio
 gpiochip_add: registered GPIOs 64 to 95 on device: gpio
 gpiochip_add: registered GPIOs 96 to 127 on device: gpio
 gpiochip_add: registered GPIOs 128 to 159 on device: gpio
 gpiochip_add: registered GPIOs 160 to 191 on device: gpio
 omap_mux_init: Add partition: #1: core, flags: 0
 GPMC CS4: cs_on :   2 ticks,  10 ns (was   1 ticks)  10 ns
 GPMC CS4: cs_rd_off :  12 ticks,  60 ns (was  16 ticks)  60 ns
 GPMC CS4: cs_wr_off :  12 ticks,  60 ns (was  16 ticks)  60 ns
 GPMC CS4: adv_on:   0 ticks,   0 ns (was   1 ticks)   0 ns
 GPMC CS4: adv_rd_off:   0 ticks,   0 ns (was   2 ticks)   0 ns
 GPMC CS4: adv_wr_off:   0 ticks,   0 ns (was   2 ticks)   0 ns
 GPMC CS4: oe_on :   2 ticks,  10 ns (was   3 ticks)  10 ns
 GPMC CS4: oe_off:  12 ticks,  60 ns (was  16 ticks)  60 ns
 GPMC CS4: we_on :   2 ticks,  10 ns (was   3 ticks)  10 ns
 GPMC CS4: we_off:  12 ticks,  60 ns (was  16 ticks)  60 ns
 GPMC CS4: rd_cycle  :  14 ticks,  70 ns (was  17 ticks)  70 ns
 GPMC CS4: wr_cycle  :  14 ticks,  70 ns (was  17 ticks)  70 ns
 GPMC CS4: access:  12 ticks,  60 ns (was  15 ticks)  60 ns
 GPMC CS4: page_burst_access:   0 ticks,   0 ns (was   1 ticks)   0 ns
 GPMC CS4: wr_data_mux_bus:   0 ticks,   0 ns (was   3 ticks)   0 ns
 GPMC CS4: wr_access :   2 ticks,  10 ns (was  15 ticks)  10 ns
 OMAP DMA hardware revision 5.0
 bio: create slab bio-0 at 0
 SCSI subsystem initialized
 omap2_mcspi omap2_mcspi.1: master is unqueued, 

Re: Panda ES board hang when using GPIO as interrupt

2012-06-26 Thread Kevin Hilman
Hello,

Franky Lin fran...@broadcom.com writes:

 Hi Kevin, Tarun,

 We are using the expansion connector A on Panda board to mount a SDIO
 WiFi dongle on MMC2 with a level triggered interrupt signal connected
 to GPIO 138. It's been working fine until 3.5 rc1. The board hang
 randomly within 5 mins during a network traffic test. After bisecting
 we found the culprit is [PATCH 8/8] gpio/omap: fix missing check in
 *_runtime_suspend() [1].

grumble

As you might guess.  That patch has caused me enough headaches that
reverting it sounds like a good idea now.  But, I'd still like to better
understand exactly what's going on.

 I noticed Kevin raised some similar cases on other platforms and also
 provided two patches in the patch mail thread. But unfortunately those
 two patches doesn't help in our case. I tested the driver with 3.5-rc3
 mainline kernel and the issue is still there. I can only fix the
 hang by either reverting the commit or disabling
 CONFIG_PM_RUNTIME. Also, the hang only happens on Panda ES board. Old
 Panda with 4430 works good.

 Any thoughts and suggestions?

If reverting the patch fixes your problem, can you isolate down to which
part of that patch causes the problem?  IOW, can you fix your problem if
you undo just the hunk added in runtime_suspend or undo just the moved
hunk runtime_resume?  Or is reverting both required?

I suspect the added runtime_suspend hunk is causing the problems, so can
you see if just undoing that part works[1].  If that works, I will give
a bit more of a thinking on it tomorrow.

Thanks for reporting the problem!   Bug reports like this that have
clearly been thoroughly researched and bisected are greatly appreciated!

Kevin

[1] patch against v3.5-rc4

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index c4ed172..2a6067f 100644   
--- a/drivers/gpio/gpio-omap.c  
+++ b/drivers/gpio/gpio-omap.c  
@@ -1177,9 +1177,6 @@ static int omap_gpio_runtime_suspend(struct device *dev)
__raw_writel(wake_hi | bank-context.risingdetect,  
 bank-base + bank-regs-risingdetect);

-   if (!bank-enabled_non_wakeup_gpios)
-   goto update_gpio_context_count; 
-   
if (bank-power_mode != OFF_MODE) { 
bank-power_mode = 0;   
goto update_gpio_context_count; 



--
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 05/11] OMAPDSS: add clk_prepare and clk_unprepare

2012-06-26 Thread Tomi Valkeinen
On Tue, 2012-06-26 at 17:47 -0700, Mike Turquette wrote:
 On 20120625-16:14, Tomi Valkeinen wrote:
  A question about clk_prepare/unprepare, not directly related: let's say
  I have a driver for some HW block. The driver doesn't use clk functions,
  but uses runtime PM. The driver also sets pm_runtime_irq_safe().
  
  Now, the driver can call pm_runtime_get_sync() in an atomic context, and
  this would lead to the underlying framework (hwmod, omap_device, I don't
  know who =) enabling the func clock for that HW. But this would happen
  in atomic context, so the underlying framework can't use clk_prepare.
  
  How does the underlying framework handle that case? (sorry if that's a
  stupid question =).
  
 
 I think it's a good question!
 
 If we're going to call clk_prepare_enable from within a runtime pm
 callback then I think we'll need to check if _irq_safe() is set and
 conditionally call only clk_enable in such a case.
 
 I'm not a runtime pm expert, but if the driver owns the responsibility
 of calling pm_runtime_irq_safe then the driver has the proper context
 to know that it should call clk_prepare BEFORE calling
 pm_runtime_get_sync.

That's not quite what I meant. If it's the driver that does clk_enable,
be it in runtime PM callback or not, it's driver's responsibility.

But some clocks are not handled by the driver, but the hwmod/omap_device
framework. Mainly I think this is for the functional and interface
clocks. The driver has no visibility to those, they are implicitly
enabled via pm_runtime_get.

 Tomi



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


Re: [PATCH] OMAPDSS: Check if RPM enabled before trying to change state

2012-06-26 Thread Jassi Brar
On 27 June 2012 00:14, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 On Tue, 2012-06-26 at 22:31 +0530, Jassi Brar wrote:

  But if pm_runtime_get_sync() returns an error, it means the HW has not
  been resumed successfully, and is not operational,
 
 Not always. The HW could be in RPM_ACTIVE state while PM on it could
 be disabled, if the returned error is -EACCESS.   And
 pm_runtime_enabled() only catches a potential -EACCESS.

 True. But the HW could also be in disabled state. And that would lead to
 a crash when accessing the registers.

 It is not a fatal error if pm_runtime_get returns -EACCES, but we sure
 shouldn't ignore it (or avoid it with pm_runtime_enabled()), but handle
 it. In some rare cases it could be ok to get -EACCES, but that's a
 special case, not standard.

You are mixing up generic concepts with what we have in omapdss.
Believe me, I do understand it's bad to proceed without caring for
returned _errors_.
The way omapdss is organized -EACCESS is _not_ an  error, it just
denotes PM is disabled on the device and that DISPC is in RPM_ACTIVE
is backed by the fact that HDMI always hold a reference between
resume-suspend and DISPC goes to suspend last and resume first.


 BTW, I just tested your patch and it worked for me as well. But as
 suspected, it doesn't help the stack spew of CONFIG_PM_RUNTIME:=n

 So I understand, I only need to resend the other three patches ?

 Yes, please.

OK, will do today later.

Regards.
--
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 05/11] OMAPDSS: add clk_prepare and clk_unprepare

2012-06-26 Thread Rajendra Nayak

On Wednesday 27 June 2012 09:49 AM, Tomi Valkeinen wrote:

On Tue, 2012-06-26 at 17:47 -0700, Mike Turquette wrote:

On 20120625-16:14, Tomi Valkeinen wrote:

A question about clk_prepare/unprepare, not directly related: let's say
I have a driver for some HW block. The driver doesn't use clk functions,
but uses runtime PM. The driver also sets pm_runtime_irq_safe().

Now, the driver can call pm_runtime_get_sync() in an atomic context, and
this would lead to the underlying framework (hwmod, omap_device, I don't
know who =) enabling the func clock for that HW. But this would happen
in atomic context, so the underlying framework can't use clk_prepare.

How does the underlying framework handle that case? (sorry if that's a
stupid question =).



I think it's a good question!

If we're going to call clk_prepare_enable from within a runtime pm
callback then I think we'll need to check if _irq_safe() is set and
conditionally call only clk_enable in such a case.

I'm not a runtime pm expert, but if the driver owns the responsibility
of calling pm_runtime_irq_safe then the driver has the proper context
to know that it should call clk_prepare BEFORE calling
pm_runtime_get_sync.


That's not quite what I meant. If it's the driver that does clk_enable,
be it in runtime PM callback or not, it's driver's responsibility.

But some clocks are not handled by the driver, but the hwmod/omap_device
framework. Mainly I think this is for the functional and interface
clocks. The driver has no visibility to those, they are implicitly
enabled via pm_runtime_get.


yes, thats the tricky part on how would hwmod/omap_device know if the
driver would use runtime pm within atomic context or non-atomic context.
The driver does inform the runtime pm framework about this by calling a
pm_runtime_irq_safe(), which is then used to set the .irq_safe flag 
telling it to leave the interrupts disabled during callbacks.

This information however does not flow down to hwmod/omap_device in any
way. So the way its currently handled is to do an early prepare of all
hwmod controlled clocks.

I have copied Kevin in case he has any better ideas on how this should
be handled.



  Tomi



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


  1   2   >