RE: [PATCH 4/5] OMAP3430SDP: Add support for Camera Kit v3
Hi, > -Original Message- > From: Alexey Klimov [mailto:klimov.li...@gmail.com] > Sent: Saturday, March 07, 2009 9:42 AM > To: DongSoo(Nathaniel) Kim > Cc: Curran, Dominic; Aguirre Rodriguez, Sergio Alberto; linux- > me...@vger.kernel.org; linux-omap@vger.kernel.org; Sakari Ailus; Tuukka.O > Toivonen; Hiroshi DOYU; MiaoStanley; Nagalla, Hari; Hiremath, Vaibhav; > Lakhani, Amish; Menon, Nishanth > Subject: Re: [PATCH 4/5] OMAP3430SDP: Add support for Camera Kit v3 > > Hello, all > > On Fri, 2009-03-06 at 10:54 +0900, DongSoo(Nathaniel) Kim wrote: > > Hi Alexey, > > > > On Fri, Mar 6, 2009 at 7:05 AM, Alexey Klimov > wrote: > > > Hello, all > > > > > > On Thu, Mar 5, 2009 at 7:42 PM, Curran, Dominic > wrote: > > >> > > >> Hi Kim > > >> > > >>> -Original Message- > > >>> From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- > > >>> ow...@vger.kernel.org] On Behalf Of DongSoo(Nathaniel) Kim > > >>> Sent: Wednesday, March 04, 2009 8:58 PM > > >>> To: Aguirre Rodriguez, Sergio Alberto > > >>> Cc: linux-me...@vger.kernel.org; linux-omap@vger.kernel.org; Sakari > Ailus; > > >>> Tuukka.O Toivonen; Hiroshi DOYU; MiaoStanley; Nagalla, Hari; > Hiremath, > > >>> Vaibhav; Lakhani, Amish; Menon, Nishanth > > >>> Subject: Re: [PATCH 4/5] OMAP3430SDP: Add support for Camera Kit v3 > > >>> > > >>> Hi Sergio, > > >>> > > >>> > > >>> > > >>> On Wed, Mar 4, 2009 at 5:44 AM, Aguirre Rodriguez, Sergio Alberto > > >>> wrote: > > >>> > + /* turn on analog power */ > > >>> > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, > > >>> > + VAUX_2_8_V, > TWL4030_VAUX2_DEDICATED); > > >>> > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, > > >>> > + VAUX_DEV_GRP_P1, > TWL4030_VAUX2_DEV_GRP); > > >>> > + > > >>> > + /* out of standby */ > > >>> > + gpio_set_value(MT9P012_STANDBY_GPIO, 0); > > >>> > + udelay(1000); > > >>> > > >>> It seems better using msleep rather than udelay for 1000us much. > Just > > >>> to be safe :) > > >>> How about you? > > >>> > > >> > > >> Why is msleep safer than udelay ? > > > > > > I have small guess that he is wondering why you are using big delays > > > with help of udelay(). (It's may be obvious but as we know udelay uses > > > cpu loops to make delay and msleep calls to scheduler) So, msleep is > > > more flexible and "softer" but if you need precise time or you can't > > > sleep in code you need udelay. Sometimes using udelay is reasonably > > > required. > > > > I totally agree with you. > > But besides the "udelay and mdelay accuracy" issue, Sergio's power up > > timing for MT9P012 seems to delay too much. (not for lens > > controller.) > > I also have experience using MT9P012 sensor with other ISP, but in > > case of mine it took 600 to 800 ms for whole power up sequence. > > But if that delay depends on SDP board and Sergio had no options > > without making delay for that much, then it explains everything. > > So I'm saying if there was no other option than making long delay to > > bring up MT9P012 sensor properly, if I were Sergio I should rather use > > mdelay than udelay. > > I agree with you. mdelay is really safer that udelay. Sorry for not participating much in this thread, I have been busy fixing other comments. This delay setting was set before I ever touched this drivers by other omap3 Linux camera ex-team member here in TI. I suspect they were set to the minimum working level in SDP already, but I haven't honestly tried to move them. I guess it's a good time to do so. :) I'll fix some other things first, and put this on my plate to check before reposting next version of drivers. I really appreciate your feedback on this. Regards, Sergio > > >From file include/linux/delay.h: > > * Using udelay() for intervals greater than a few milliseconds can > * risk overflow for high loops_per_jiffy (high bogomips) machines. The > * mdelay() provides a wrapper to prevent this. For delays greater > * than MAX_UDELAY_MS milliseconds, the wrapper is used. Architecture > * specific values can be defined in asm-???/delay.h as an override. > > So, let's Sergio check and decide what he needed! :) > > > Cheers, > > > > Nate > > -- > Best regards, Klimov Alexey > -- 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 4/5] OMAP3430SDP: Add support for Camera Kit v3
Hello, all On Fri, 2009-03-06 at 10:54 +0900, DongSoo(Nathaniel) Kim wrote: > Hi Alexey, > > On Fri, Mar 6, 2009 at 7:05 AM, Alexey Klimov wrote: > > Hello, all > > > > On Thu, Mar 5, 2009 at 7:42 PM, Curran, Dominic wrote: > >> > >> Hi Kim > >> > >>> -Original Message- > >>> From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- > >>> ow...@vger.kernel.org] On Behalf Of DongSoo(Nathaniel) Kim > >>> Sent: Wednesday, March 04, 2009 8:58 PM > >>> To: Aguirre Rodriguez, Sergio Alberto > >>> Cc: linux-me...@vger.kernel.org; linux-omap@vger.kernel.org; Sakari Ailus; > >>> Tuukka.O Toivonen; Hiroshi DOYU; MiaoStanley; Nagalla, Hari; Hiremath, > >>> Vaibhav; Lakhani, Amish; Menon, Nishanth > >>> Subject: Re: [PATCH 4/5] OMAP3430SDP: Add support for Camera Kit v3 > >>> > >>> Hi Sergio, > >>> > >>> > >>> > >>> On Wed, Mar 4, 2009 at 5:44 AM, Aguirre Rodriguez, Sergio Alberto > >>> wrote: > >>> > + /* turn on analog power */ > >>> > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, > >>> > + VAUX_2_8_V, TWL4030_VAUX2_DEDICATED); > >>> > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, > >>> > + VAUX_DEV_GRP_P1, TWL4030_VAUX2_DEV_GRP); > >>> > + > >>> > + /* out of standby */ > >>> > + gpio_set_value(MT9P012_STANDBY_GPIO, 0); > >>> > + udelay(1000); > >>> > >>> It seems better using msleep rather than udelay for 1000us much. Just > >>> to be safe :) > >>> How about you? > >>> > >> > >> Why is msleep safer than udelay ? > > > > I have small guess that he is wondering why you are using big delays > > with help of udelay(). (It's may be obvious but as we know udelay uses > > cpu loops to make delay and msleep calls to scheduler) So, msleep is > > more flexible and "softer" but if you need precise time or you can't > > sleep in code you need udelay. Sometimes using udelay is reasonably > > required. > > I totally agree with you. > But besides the "udelay and mdelay accuracy" issue, Sergio's power up > timing for MT9P012 seems to delay too much. (not for lens > controller.) > I also have experience using MT9P012 sensor with other ISP, but in > case of mine it took 600 to 800 ms for whole power up sequence. > But if that delay depends on SDP board and Sergio had no options > without making delay for that much, then it explains everything. > So I'm saying if there was no other option than making long delay to > bring up MT9P012 sensor properly, if I were Sergio I should rather use > mdelay than udelay. I agree with you. mdelay is really safer that udelay. >From file include/linux/delay.h: * Using udelay() for intervals greater than a few milliseconds can * risk overflow for high loops_per_jiffy (high bogomips) machines. The * mdelay() provides a wrapper to prevent this. For delays greater * than MAX_UDELAY_MS milliseconds, the wrapper is used. Architecture * specific values can be defined in asm-???/delay.h as an override. So, let's Sergio check and decide what he needed! :) > Cheers, > > Nate -- Best regards, Klimov Alexey -- 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 4/5] OMAP3430SDP: Add support for Camera Kit v3
Hi Alexey, On Fri, Mar 6, 2009 at 7:05 AM, Alexey Klimov wrote: > Hello, all > > On Thu, Mar 5, 2009 at 7:42 PM, Curran, Dominic wrote: >> >> Hi Kim >> >>> -Original Message- >>> From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- >>> ow...@vger.kernel.org] On Behalf Of DongSoo(Nathaniel) Kim >>> Sent: Wednesday, March 04, 2009 8:58 PM >>> To: Aguirre Rodriguez, Sergio Alberto >>> Cc: linux-me...@vger.kernel.org; linux-omap@vger.kernel.org; Sakari Ailus; >>> Tuukka.O Toivonen; Hiroshi DOYU; MiaoStanley; Nagalla, Hari; Hiremath, >>> Vaibhav; Lakhani, Amish; Menon, Nishanth >>> Subject: Re: [PATCH 4/5] OMAP3430SDP: Add support for Camera Kit v3 >>> >>> Hi Sergio, >>> >>> >>> >>> On Wed, Mar 4, 2009 at 5:44 AM, Aguirre Rodriguez, Sergio Alberto >>> wrote: >>> > + /* turn on analog power */ >>> > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, >>> > + VAUX_2_8_V, TWL4030_VAUX2_DEDICATED); >>> > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, >>> > + VAUX_DEV_GRP_P1, TWL4030_VAUX2_DEV_GRP); >>> > + >>> > + /* out of standby */ >>> > + gpio_set_value(MT9P012_STANDBY_GPIO, 0); >>> > + udelay(1000); >>> >>> It seems better using msleep rather than udelay for 1000us much. Just >>> to be safe :) >>> How about you? >>> >> >> Why is msleep safer than udelay ? > > I have small guess that he is wondering why you are using big delays > with help of udelay(). (It's may be obvious but as we know udelay uses > cpu loops to make delay and msleep calls to scheduler) So, msleep is > more flexible and "softer" but if you need precise time or you can't > sleep in code you need udelay. Sometimes using udelay is reasonably > required. I totally agree with you. But besides the "udelay and mdelay accuracy" issue, Sergio's power up timing for MT9P012 seems to delay too much. (not for lens controller.) I also have experience using MT9P012 sensor with other ISP, but in case of mine it took 600 to 800 ms for whole power up sequence. But if that delay depends on SDP board and Sergio had no options without making delay for that much, then it explains everything. So I'm saying if there was no other option than making long delay to bring up MT9P012 sensor properly, if I were Sergio I should rather use mdelay than udelay. But if that delay is necessary to bring up MT9P012 with SDP board, I have no idea what to say. In that case, Sergio should be right. Cheers, Nate > > -- > Best regards, Klimov Alexey > -- DongSoo(Nathaniel), Kim Engineer Mobile S/W Platform Lab. S/W Team. DMC Samsung Electronics CO., LTD. e-mail : dongsoo@gmail.com dongsoo45@samsung.com -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 4/5] OMAP3430SDP: Add support for Camera Kit v3
> -Original Message- > From: Alexey Klimov [mailto:klimov.li...@gmail.com] > Sent: Thursday, March 05, 2009 4:05 PM > To: Curran, Dominic > Cc: DongSoo(Nathaniel) Kim; Aguirre Rodriguez, Sergio Alberto; linux- > me...@vger.kernel.org; linux-omap@vger.kernel.org; Sakari Ailus; Tuukka.O > Toivonen; Hiroshi DOYU; MiaoStanley; Nagalla, Hari; Hiremath, Vaibhav; > Lakhani, Amish; Menon, Nishanth > Subject: Re: [PATCH 4/5] OMAP3430SDP: Add support for Camera Kit v3 > > >> > + /* out of standby */ > >> > + gpio_set_value(MT9P012_STANDBY_GPIO, 0); > >> > + udelay(1000); > >> > >> It seems better using msleep rather than udelay for 1000us much. Just > >> to be safe :) > >> How about you? > >> > > > > Why is msleep safer than udelay ? > > I have small guess that he is wondering why you are using big delays > with help of udelay(). (It's may be obvious but as we know udelay uses > cpu loops to make delay and msleep calls to scheduler) So, msleep is > more flexible and "softer" but if you need precise time or you can't > sleep in code you need udelay. Sometimes using udelay is reasonably > required. > Ah, I did not know that msleep() called scheduler. Thank you. -- 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 4/5] OMAP3430SDP: Add support for Camera Kit v3
Hello, all On Thu, Mar 5, 2009 at 7:42 PM, Curran, Dominic wrote: > > Hi Kim > >> -Original Message- >> From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- >> ow...@vger.kernel.org] On Behalf Of DongSoo(Nathaniel) Kim >> Sent: Wednesday, March 04, 2009 8:58 PM >> To: Aguirre Rodriguez, Sergio Alberto >> Cc: linux-me...@vger.kernel.org; linux-omap@vger.kernel.org; Sakari Ailus; >> Tuukka.O Toivonen; Hiroshi DOYU; MiaoStanley; Nagalla, Hari; Hiremath, >> Vaibhav; Lakhani, Amish; Menon, Nishanth >> Subject: Re: [PATCH 4/5] OMAP3430SDP: Add support for Camera Kit v3 >> >> Hi Sergio, >> >> >> >> On Wed, Mar 4, 2009 at 5:44 AM, Aguirre Rodriguez, Sergio Alberto >> wrote: >> > + /* turn on analog power */ >> > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, >> > + VAUX_2_8_V, TWL4030_VAUX2_DEDICATED); >> > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, >> > + VAUX_DEV_GRP_P1, TWL4030_VAUX2_DEV_GRP); >> > + >> > + /* out of standby */ >> > + gpio_set_value(MT9P012_STANDBY_GPIO, 0); >> > + udelay(1000); >> >> It seems better using msleep rather than udelay for 1000us much. Just >> to be safe :) >> How about you? >> > > Why is msleep safer than udelay ? I have small guess that he is wondering why you are using big delays with help of udelay(). (It's may be obvious but as we know udelay uses cpu loops to make delay and msleep calls to scheduler) So, msleep is more flexible and "softer" but if you need precise time or you can't sleep in code you need udelay. Sometimes using udelay is reasonably required. -- Best regards, Klimov Alexey -- 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 4/5] OMAP3430SDP: Add support for Camera Kit v3
Hi Kim > -Original Message- > From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- > ow...@vger.kernel.org] On Behalf Of DongSoo(Nathaniel) Kim > Sent: Wednesday, March 04, 2009 8:58 PM > To: Aguirre Rodriguez, Sergio Alberto > Cc: linux-me...@vger.kernel.org; linux-omap@vger.kernel.org; Sakari Ailus; > Tuukka.O Toivonen; Hiroshi DOYU; MiaoStanley; Nagalla, Hari; Hiremath, > Vaibhav; Lakhani, Amish; Menon, Nishanth > Subject: Re: [PATCH 4/5] OMAP3430SDP: Add support for Camera Kit v3 > > Hi Sergio, > > > > On Wed, Mar 4, 2009 at 5:44 AM, Aguirre Rodriguez, Sergio Alberto > wrote: > > + /* turn on analog power */ > > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, > > + VAUX_2_8_V, TWL4030_VAUX2_DEDICATED); > > + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, > > + VAUX_DEV_GRP_P1, TWL4030_VAUX2_DEV_GRP); > > + > > + /* out of standby */ > > + gpio_set_value(MT9P012_STANDBY_GPIO, 0); > > + udelay(1000); > > It seems better using msleep rather than udelay for 1000us much. Just > to be safe :) > How about you? > Why is msleep safer than udelay ? -- 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 4/5] OMAP3430SDP: Add support for Camera Kit v3
Hi Sergio, On Wed, Mar 4, 2009 at 5:44 AM, Aguirre Rodriguez, Sergio Alberto wrote: > This patch adds support for sensors contained in Camkit v3, > which has: > - Primary sensor (/dev/video0): MT9P012 (Parallel) with > DW9710 lens driver. > - Secondary sensor (/dev/video4): OV3640 (CSI2). > > It introduces also a new file for storing all camera sensors board > specific related functions, like other platforms do (N800 for example). > > Signed-off-by: Sergio Aguirre > --- > arch/arm/mach-omap2/Makefile|3 +- > arch/arm/mach-omap2/board-3430sdp-camera.c | 490 > +++ > arch/arm/mach-omap2/board-3430sdp.c | 42 ++- > arch/arm/plat-omap/include/mach/board-3430sdp.h |1 + > 4 files changed, 534 insertions(+), 2 deletions(-) > create mode 100644 arch/arm/mach-omap2/board-3430sdp-camera.c > > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile > index 33b5aa8..ee6 100644 > --- a/arch/arm/mach-omap2/Makefile > +++ b/arch/arm/mach-omap2/Makefile > @@ -53,7 +53,8 @@ obj-$(CONFIG_MACH_OMAP2EVM) += board-omap2evm.o \ > mmc-twl4030.o > obj-$(CONFIG_MACH_OMAP_3430SDP)+= board-3430sdp.o \ > mmc-twl4030.o \ > - board-3430sdp-flash.o > + board-3430sdp-flash.o \ > + board-3430sdp-camera.o > obj-$(CONFIG_MACH_OMAP3EVM)+= board-omap3evm.o \ > mmc-twl4030.o \ > board-omap3evm-flash.o \ > diff --git a/arch/arm/mach-omap2/board-3430sdp-camera.c > b/arch/arm/mach-omap2/board-3430sdp-camera.c > new file mode 100644 > index 000..661d5ed > --- /dev/null > +++ b/arch/arm/mach-omap2/board-3430sdp-camera.c > @@ -0,0 +1,490 @@ > +/* > + * linux/arch/arm/mach-omap2/board-3430sdp.c > + * > + * Copyright (C) 2007 Texas Instruments > + * > + * Modified from mach-omap2/board-generic.c > + * > + * Initial code: Syed Mohammed Khasim > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + */ > + > +#ifdef CONFIG_TWL4030_CORE > + > +#include > +#include > +#include > +#include > + > +#include > + > +#include > + > +#include > + > +static int cam_inited; > +#include > +#include <../drivers/media/video/omap34xxcam.h> > +#include <../drivers/media/video/isp/ispreg.h> > +#define DEBUG_BASE 0x0800 > + > +#define REG_SDP3430_FPGA_GPIO_2 (0x50) > +#define FPGA_SPR_GPIO1_3v3 (0x1 << 14) > +#define FPGA_GPIO6_DIR_CTRL(0x1 << 6) > + > +#define VAUX_2_8_V 0x09 > +#define VAUX_1_8_V 0x05 > +#define VAUX_DEV_GRP_P10x20 > +#define VAUX_DEV_GRP_NONE 0x00 > + > +#define CAMKITV3_USE_XCLKA 0 > +#define CAMKITV3_USE_XCLKB 1 > + > +#define CAMKITV3_RESET_GPIO98 > +/* Sensor specific GPIO signals */ > +#define MT9P012_STANDBY_GPIO 58 > +#define OV3640_STANDBY_GPIO55 > +static void __iomem *fpga_map_addr; > + > +#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE) > +#include > +static enum v4l2_power mt9p012_previous_power = V4L2_POWER_OFF; > +#endif > + > +#if defined(CONFIG_VIDEO_OV3640) || defined(CONFIG_VIDEO_OV3640_MODULE) > +#include > +#include <../drivers/media/video/isp/ispcsi2.h> > +static struct omap34xxcam_hw_config *hwc; > +#define OV3640_CSI2_CLOCK_POLARITY 0 /* +/- pin order */ > +#define OV3640_CSI2_DATA0_POLARITY 0 /* +/- pin order */ > +#define OV3640_CSI2_DATA1_POLARITY 0 /* +/- pin order */ > +#define OV3640_CSI2_CLOCK_LANE 1/* Clock lane position: 1 */ > +#define OV3640_CSI2_DATA0_LANE 2/* Data0 lane position: 2 */ > +#define OV3640_CSI2_DATA1_LANE 3/* Data1 lane position: 3 */ > +#define OV3640_CSI2_PHY_THS_TERM 4 > +#define OV3640_CSI2_PHY_THS_SETTLE 14 > +#define OV3640_CSI2_PHY_TCLK_TERM 0 > +#define OV3640_CSI2_PHY_TCLK_MISS 1 > +#define OV3640_CSI2_PHY_TCLK_SETTLE14 > +#endif > + > +#ifdef CONFIG_VIDEO_DW9710 > +#include > +#endif > + > +static void __iomem *fpga_map_addr; > + > +static void enable_fpga_vio_1v8(u8 enable) > +{ > + u16 reg_val; > + > + fpga_map_addr = ioremap(DEBUG_BASE, 4096); > + reg_val = readw(fpga_map_addr + REG_SDP3430_FPGA_GPIO_2); > + > + /* Ensure that the SPR_GPIO1_3v3 is 0 - powered off.. 1 is on */ > + if (reg_val & FPGA_SPR_GPIO1_3v3) { > + reg_val |= FPGA_SPR_GPIO1_3v3; > + reg_val |= FPGA_GPIO6_DIR_CTRL; /* output mode */ > + writew(reg_val, fpga_map_addr + REG_SDP3430_FPGA_GPIO_2); > + /* give a few milli sec to settle down > +