[PATCH] set data enable logic level to low

2013-10-13 Thread Roel Kluin
Signed-off-by: Roel Kluin roel.kl...@gmail.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 fafe7c9..669a81f 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -266,7 +266,7 @@ void videomode_to_omap_video_timings(const struct videomode 
*vm,
OMAPDSS_SIG_ACTIVE_LOW;
ovt-de_level = vm-flags  DISPLAY_FLAGS_DE_HIGH ?
OMAPDSS_SIG_ACTIVE_HIGH :
-   OMAPDSS_SIG_ACTIVE_HIGH;
+   OMAPDSS_SIG_ACTIVE_LOW;
ovt-data_pclk_edge = vm-flags  DISPLAY_FLAGS_PIXDATA_POSEDGE ?
OMAPDSS_DRIVE_SIG_RISING_EDGE :
OMAPDSS_DRIVE_SIG_FALLING_EDGE;
-- 
1.8.1.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] OMAP: Dereference of NULL autodep in _autodep_lookup()

2010-02-24 Thread roel kluin
 Thanks for the patch, but I don't understand what problem you're
 pointing out.  If autodeps is NULL entering clkdm_init(), then the
 for-loop won't even be entered.

My first patch was wrong, but there's something I think could
be wrong. In clkdm_init() we have:

for (autodep = autodeps; autodep-pwrdm.ptr; autodep++)
_autodep_lookup(autodep);

In _autodep_lookup() we ensure that we don't dereference
autodep by:

if (!autodep)
return;

but if autodep can be NULL we already dereferenced it in
the aforementioned for loop, so shouldn't that be:

for (autodep = autodeps; autodep  autodep-pwrdm.ptr; autodep++)
_autodep_lookup(autodep);

Then since this is the only call to _autodep_lookup() we can remove
that test there. Do you agree?

 It looks like there may be a problem, however, in _clkdm_add_autodeps()
 and _clkdm_del_autodeps() if no autodeps were passed in.  What do you
 think about something like the following instead?


 - Paul

Your suggested patch looks right to me 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


[PATCH] OMAP: dma_chan[lch_head].flag OMAP_DMA_ACTIVE tested twice in omap_dma_unlink_lch()

2010-01-09 Thread Roel Kluin
The same flag and bits were tested twice.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
 arch/arm/plat-omap/dma.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Is this what was intended? please review.

diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 09d82b3..728c642 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1183,7 +1183,7 @@ void omap_dma_unlink_lch(int lch_head, int lch_queue)
}
 
if ((dma_chan[lch_head].flags  OMAP_DMA_ACTIVE) ||
-   (dma_chan[lch_head].flags  OMAP_DMA_ACTIVE)) {
+   (dma_chan[lch_queue].flags  OMAP_DMA_ACTIVE)) {
printk(KERN_ERR omap_dma: You need to stop the DMA channels 
   before unlinking\n);
dump_stack();
--
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] OMAP3: add missing parentheses

2010-01-06 Thread Roel Kluin
`!' has a higher precedence than `' so parentheses are required.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
 arch/arm/mach-omap2/pm34xx.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 81ed252..c6cc809 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -124,8 +124,8 @@ static void omap3_core_save_context(void)
control_padconf_off |= START_PADCONF_SAVE;
omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF);
/* wait for the save to complete */
-   while (!omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
-PADCONF_SAVE_DONE)
+   while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
+PADCONF_SAVE_DONE))
;
/* Save the Interrupt controller context */
omap_intc_save_context();
--
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] OMAP3: add missing parentheses

2009-12-22 Thread Roel Kluin
not(!) has a higher precedence than bit and().

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
 arch/arm/plat-omap/include/plat/control.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/control.h 
b/arch/arm/plat-omap/include/plat/control.h
index 2ae8843..a745d62 100644
--- a/arch/arm/plat-omap/include/plat/control.h
+++ b/arch/arm/plat-omap/include/plat/control.h
@@ -147,7 +147,7 @@
 #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
 #define OMAP343X_CONTROL_IVA2_BOOTMOD  (OMAP2_CONTROL_GENERAL + 0x0194)
 #define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \
-   + ((i)  1) * 4 + (!(i)  1) * 2)
+   + ((i)  1) * 4 + (!((i)  1)) * 2)
 #define OMAP343X_CONTROL_PROG_IO0  (OMAP2_CONTROL_GENERAL + 0x01D4)
 #define OMAP343X_CONTROL_PROG_IO1  (OMAP2_CONTROL_GENERAL + 0x01D8)
 #define OMAP343X_CONTROL_DSS_DPLL_SPREADING(OMAP2_CONTROL_GENERAL + 0x01E0)
--
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] OMAP: Should cs be positive in gpmc_cs_free()?

2009-11-01 Thread Roel Kluin
The index `cs' is signed, test whether it is negative before
we release gpmc_cs_mem[cs].

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
Found by code analysis, is it required?

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 1587682..c892a54 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -378,7 +378,7 @@ EXPORT_SYMBOL(gpmc_cs_request);
 void gpmc_cs_free(int cs)
 {
spin_lock(gpmc_mem_lock);
-   if (cs = GPMC_CS_NUM || !gpmc_cs_reserved(cs)) {
+   if (cs = GPMC_CS_NUM || cs  0 || !gpmc_cs_reserved(cs)) {
printk(KERN_ERR Trying to free non-reserved GPMC CS%d\n, cs);
BUG();
spin_unlock(gpmc_mem_lock);
--
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] omapfb: Wrong test on unsigned?

2009-10-21 Thread Roel Kluin
regno is unsigned so the test didn't work. If regno
can't be used return an error.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
 Is this correct? please review.

 diff --git a/drivers/video/omap/omapfb_main.c 
 b/drivers/video/omap/omapfb_main.c
 index 0d0c8c8..cc7dd93 100644
 --- a/drivers/video/omap/omapfb_main.c
 +++ b/drivers/video/omap/omapfb_main.c
 @@ -286,7 +286,7 @@ static int _setcolreg(struct fb_info 
 *info, u_int regno, u_int red, u_int green,
  if (r != 0)
  break;
  
 -if (regno  0) {
 +if ((int)regno  0) {
 
 Hmm...
 
 Isn't regno unsigned integer from the start?

yes

 2 things here:
 
 - regno will never be negative.
 - Casting won't make a difference in the meaning., it'll make a negative only 
 when:
 
   regno  ((2^32) / 2)
 
 Which doesn't make any sense IMHO.

I think it is strange that _setcolreg() accepts a regno that is invalid,
ignores it and just returns as if all was OK. If you agree then you may
like the patch below.

 Regards,
 Sergio

Thanks,

Roel

diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
index 0d0c8c8..4da94d0 100644
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -285,12 +285,6 @@ static int _setcolreg(struct fb_info *info, u_int regno, 
u_int red, u_int green,
case OMAPFB_COLOR_RGB444:
if (r != 0)
break;
-
-   if (regno  0) {
-   r = -EINVAL;
-   break;
-   }
-
if (regno  16) {
u16 pal;
pal = ((red  (16 - var-red.length)) 
@@ -299,6 +293,8 @@ static int _setcolreg(struct fb_info *info, u_int regno, 
u_int red, u_int green,
var-green.offset) |
  (blue  (16 - var-blue.length));
((u32 *)(info-pseudo_palette))[regno] = pal;
+   } else {
+   r = -EINVAL;
}
break;
default:
--
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] omapfb: Wrong test on unsigned?

2009-10-16 Thread Roel Kluin
Only if the test is signed negative values can be spotted.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
Is this correct? please review.

diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
index 0d0c8c8..cc7dd93 100644
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -286,7 +286,7 @@ static int _setcolreg(struct fb_info *info, u_int regno, 
u_int red, u_int green,
if (r != 0)
break;
 
-   if (regno  0) {
+   if ((int)regno  0) {
r = -EINVAL;
break;
}
--
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] OMAP: Fix Unlikely(x) y

2009-10-06 Thread Roel Kluin
The closing parenthesis was not on the right location.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 71ebd7f..7c345b7 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -373,7 +373,7 @@ static inline int gpio_valid(int gpio)
 
 static int check_gpio(int gpio)
 {
-   if (unlikely(gpio_valid(gpio))  0) {
+   if (unlikely(gpio_valid(gpio)  0)) {
printk(KERN_ERR omap-gpio: invalid GPIO %d\n, gpio);
dump_stack();
return -1;
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] omapfb: invalid test on unsigned

2009-06-22 Thread Roel Kluin
Unsigned regno cannot be less than 0.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
Is this correct? please review.

diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
index 060d72f..787271f 100644
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -276,7 +276,7 @@ static int _setcolreg(struct fb_info *info, u_int regno, 
u_int red, u_int green,
if (r != 0)
break;
 
-   if (regno  0) {
+   if (regno = info-cmap.len) {
r = -EINVAL;
break;
}
--
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: possible division by 0

2009-03-17 Thread Roel Kluin
In linus' git tree the functions can be found at:
vi arch/arm/mach-omap2/usb-tusb6010.c +200  - tusb6010_platform_retime()
vi arch/arm/mach-omap2/gpmc.c +94   - gpmc_get_fclk_period()
vi arch/arm/mach-omap2/usb-tusb6010.c +53   - tusb_set_async_mode()
vi arch/arm/mach-omap2/usb-tusb6010.c +111  - tusb_set_sync_mode()

is -ENODEV appropriate when sysclk_ps == 0?

This was found by code analysis, please review.
--8-8-
gpmc_get_fclk_period() may return 0 when gpmc_l3_clk is not enabled. This is
not checked in tusb6010_platform_retime() nor in tusb_set_async_mode() it
seems. In tusb_set_sync_mode() this may result in a division by zero.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c 
b/arch/arm/mach-omap2/usb-tusb6010.c
index 15e5090..8df55f4 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -187,7 +187,7 @@ int tusb6010_platform_retime(unsigned is_refclk)
unsignedsysclk_ps;
int status;
 
-   if (!refclk_psec)
+   if (!refclk_psec || sysclk_ps == 0)
return -ENODEV;
 
sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60;
--
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] omap2: off by 1

2009-02-25 Thread Roel Kluin
with while (i++  MAX_CLOCK_ENABLE_WAIT); i can reach MAX_CLOCK_ENABLE_WAIT + 1
after the loop, so if (i == MAX_CLOCK_ENABLE_WAIT) that's still success.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
---
 arch/arm/mach-omap2/clock.c   |2 +-
 arch/arm/mach-omap2/powerdomain.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index ce4d46a..da185ff 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -202,7 +202,7 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, 
const char *name)
udelay(1);
}
 
-   if (i  MAX_CLOCK_ENABLE_WAIT)
+   if (i = MAX_CLOCK_ENABLE_WAIT)
pr_debug(Clock %s stable after %d loops\n, name, i);
else
printk(KERN_ERR Clock %s didn't enable in %d tries\n,
diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 73e2971..983f1cb 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -1099,7 +1099,7 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm)
   (c++  PWRDM_TRANSITION_BAILOUT))
udelay(1);
 
-   if (c = PWRDM_TRANSITION_BAILOUT) {
+   if (c  PWRDM_TRANSITION_BAILOUT) {
printk(KERN_ERR powerdomain: waited too long for 
   powerdomain %s to complete transition\n, pwrdm-name);
return -EAGAIN;
--
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 01/10] omap mailbox: cleanup omap2 register definition with macro

2009-01-16 Thread roel kluin
2009/1/16 Hiroshi DOYU hiroshi.d...@nokia.com:
 Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
 ---

  arch/arm/mach-omap2/mailbox.c |   77 
 +++--
  1 files changed, 29 insertions(+), 48 deletions(-)

 diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
 index 32b7af3..0609e2d 100644
 --- a/arch/arm/mach-omap2/mailbox.c
 +++ b/arch/arm/mach-omap2/mailbox.c

 @@ -18,40 +18,19 @@
  #include mach/mailbox.h
  #include mach/irqs.h

 -#define MAILBOX_REVISION   0x00
 -#define MAILBOX_SYSCONFIG  0x10
 -#define MAILBOX_SYSSTATUS  0x14
 -#define MAILBOX_MESSAGE_0  0x40
 -#define MAILBOX_MESSAGE_1  0x44
 -#define MAILBOX_MESSAGE_2  0x48
 -#define MAILBOX_MESSAGE_3  0x4c
 -#define MAILBOX_MESSAGE_4  0x50
 -#define MAILBOX_MESSAGE_5  0x54
 -#define MAILBOX_FIFOSTATUS_0   0x80
 -#define MAILBOX_FIFOSTATUS_1   0x84
 -#define MAILBOX_FIFOSTATUS_2   0x88
 -#define MAILBOX_FIFOSTATUS_3   0x8c
 -#define MAILBOX_FIFOSTATUS_4   0x90
 -#define MAILBOX_FIFOSTATUS_5   0x94
 -#define MAILBOX_MSGSTATUS_00xc0
 -#define MAILBOX_MSGSTATUS_10xc4
 -#define MAILBOX_MSGSTATUS_20xc8
 -#define MAILBOX_MSGSTATUS_30xcc
 -#define MAILBOX_MSGSTATUS_40xd0
 -#define MAILBOX_MSGSTATUS_50xd4
 -#define MAILBOX_IRQSTATUS_00x100
 -#define MAILBOX_IRQENABLE_00x104
 -#define MAILBOX_IRQSTATUS_10x108
 -#define MAILBOX_IRQENABLE_10x10c
 -#define MAILBOX_IRQSTATUS_20x110
 -#define MAILBOX_IRQENABLE_20x114
 -#define MAILBOX_IRQSTATUS_30x118
 -#define MAILBOX_IRQENABLE_30x11c
 +#define MAILBOX_REVISION   0x000
 +#define MAILBOX_SYSCONFIG  0x010
 +#define MAILBOX_SYSSTATUS  0x014
 +#define MAILBOX_MESSAGE(m) (0x040 + 4 * (m))
 +#define MAILBOX_FIFOSTATUS(m)  (0x080 + 4 * (m))
 +#define MAILBOX_MSGSTATUS(m)   (0x0c0 + 4 * (m))
 +#define MAILBOX_IRQSTATUS(u)   (0x100 + 8 * (u))
 +#define MAILBOX_IRQENABLE(u)   (0x108 + 8 * (u))
  ^^^
shouldn't this be
#define MAILBOX_IRQENABLE(u)   (0x104 + 8 * (u))


 -static unsigned long mbox_base;
 +#define MAILBOX_IRQ_NEWMSG(u)  (1  (2 * (u)))
 +#define MAILBOX_IRQ_NOTFULL(u) (1  (2 * (u) + 1))

 -#define MAILBOX_IRQ_NOTFULL(n) (1  (2 * (n) + 1))
 -#define MAILBOX_IRQ_NEWMSG(n)  (1  (2 * (n)))
 +static unsigned long mbox_base;

  struct omap_mbox2_fifo {
unsigned long msg;
--
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