Re: omapfb: help from userspace

2008-10-15 Thread Nathan Monson
On Wed, Oct 15, 2008 at 4:57 AM, Paul Walmsley <[EMAIL PROTECTED]> wrote:
> Hi Nathan,
>
> could you try Lauri's patch posted here:
> http://marc.info/?l=linux-omap&m=122407150608770&w=2
> without the strongly-ordered memory patches?

This patch works for my DSP test case.

I receive 10-20 kernel messages per second as follows:
irq -33, desc: c0414580, depth: 0, count: 0, unhandled: 0

However, DSP Bridge continues to function normally without errors.

- Nathan
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch FYI] twl4030 dumps revision info

2008-10-15 Thread David Brownell
This is a diagnostic patch, dumping the IDCODE of the
TWL4030/TWL5030/... family chips.

Not for merging, at least for now.  Later this may be
useful to make sure the reduced-functionality catalog
parts (TPS series) don't go registering components that
don't exist, like the battery charger.

The main curiousity we've uncovered is that TWL5030 ES1.0
mis-identifies itself as TWL4030 ES1.0 ... unclear just now
whether that's also true of ES1.1 and later parts.

- Dave

---
 drivers/mfd/twl4030-core.c |   62 +++
 1 file changed, 62 insertions(+)

--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -748,6 +748,66 @@ static int twl4030_remove(struct i2c_cli
return 0;
 }
 
+struct es_desc {
+   u8  nibble;
+   charname[4];
+};
+
+static const struct es_desc twl4030_es[] = {
+   { 0, "1.0", },
+   { 1, "2.x", },
+   { 4, "3.0", },
+   { 5, "3.1", },
+   { },
+};
+static const struct es_desc twl5030_es[] = {
+   { 0, "1.0", },
+   { 1, "1.1", },
+   { },
+};
+
+static u32 twl_id(struct device *dev)
+{
+   const u32 mask = ((1 << 16) - 1) << 12;
+   union { u8 bytes[4]; u32 word; } idcode;
+   int status;
+   u8 nibble;
+   char *chip;
+   const struct es_desc *desc;
+
+   status = twl4030_i2c_read(TWL4030_MODULE_INTBR,
+   idcode.bytes, 0, 4);
+   if (status < 0)
+   return 0;
+
+   idcode.word = le32_to_cpu(idcode.word),
+   nibble = idcode.word >> 28;
+
+   /* NOTE:  TWL5030 / TPS65930 ES1.0 mis-identifies as TWL4030 */
+
+   if ((idcode.word & mask) == (0x0009002F & mask)) {
+   chip = "TWL4030";
+   desc = twl4030_es;
+   } else if ((idcode.word & mask) == (0x0009802F & mask)) {
+   chip = "TWL5030";
+   desc = twl5030_es;
+   } else {
+   chip = "unrecognized";
+   desc = NULL;
+   }
+
+   while (desc && desc->name[0]) {
+   if (desc->nibble == nibble) {
+   dev_info(dev, "%s ES %s; idcode %08x\n",
+   chip, desc->name, idcode.word);
+   return idcode.word;
+   }
+   desc++;
+   }
+   dev_info(dev, "%s; idcode %08x\n", chip, idcode.word);
+   return idcode.word;
+}
+
 /* NOTE:  this driver only handles a single twl4030/tps659x0 chip */
 static int
 twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
@@ -795,6 +855,8 @@ twl4030_probe(struct i2c_client *client,
 
if(0)dumpit();
 
+   twl_id(&client->dev);
+
/* setup clock framework */
clocks_init();
 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] input: lm8323: get rid of global pdata pointer

2008-10-15 Thread Dmitry Torokhov
Hi Felipe,

On Wed, Oct 15, 2008 at 12:39:51AM +0300, Felipe Balbi wrote:
> From: Felipe Balbi <[EMAIL PROTECTED]>
> 
> pdata is only used during probe to initialize a few fields
> from lm8323 device structure. Moving pdata pointer to probe
> won't harm anybody.
> 

I don't think I have these drivers.  I also think that they should
depend on GPIOLIB (I noticed that OMAP selects GPIOLIB but I think
ecplicit dependency should still be present).

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 28/28] [OMAPZOOM] OMAP3430: Enable Camera on 3430sdp and ldp defconfigs

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP3430: Enable Camera on 3430sdp and ldp defconfigs

This patch adds both camera sensors into omap_3430sdp_defconfig file,
as well as the OMAP3 camera and ISP modules.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 arch/arm/configs/omap_3430sdp_defconfig |   75 +++---
 arch/arm/configs/omap_ldp_defconfig |   91 
 2 files changed, 137 insertions(+), 29 deletions(-)

Index: omapkernel/arch/arm/configs/omap_3430sdp_defconfig
===
--- omapkernel.orig/arch/arm/configs/omap_3430sdp_defconfig 2008-10-15 
20:11:31.0 -0500
+++ omapkernel/arch/arm/configs/omap_3430sdp_defconfig  2008-10-15 
20:12:41.0 -0500
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.27-rc9-omap1
-# Wed Oct  8 19:52:56 2008
+# Linux kernel version: 2.6.27-omap1
+# Wed Oct 15 19:20:48 2008
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -219,8 +219,8 @@
 CONFIG_MACH_OMAP_3430SDP=y
 # CONFIG_MACH_OMAP3EVM is not set
 # CONFIG_MACH_OMAP3_BEAGLE is not set
-# CONFIG_OMAP3_PM is not set
 # CONFIG_MACH_OVERO is not set
+# CONFIG_OMAP3_PM is not set
 CONFIG_OMAP_TICK_GPTIMER=1

 #
@@ -868,6 +868,10 @@
 CONFIG_GPIO_TWL4030=y

 #
+# PCI GPIO expanders:
+#
+
+#
 # SPI GPIO expanders:
 #
 # CONFIG_GPIO_MAX7301 is not set
@@ -966,7 +970,64 @@
 CONFIG_VIDEOBUF_DMA_SG=y
 CONFIG_VIDEO_CAPTURE_DRIVERS=y
 # CONFIG_VIDEO_ADV_DEBUG is not set
-CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
+# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set
+
+#
+# Encoders/decoders and other helper chips
+#
+
+#
+# Audio decoders
+#
+# CONFIG_VIDEO_TVAUDIO is not set
+# CONFIG_VIDEO_TDA7432 is not set
+# CONFIG_VIDEO_TDA9840 is not set
+# CONFIG_VIDEO_TDA9875 is not set
+# CONFIG_VIDEO_TEA6415C is not set
+# CONFIG_VIDEO_TEA6420 is not set
+# CONFIG_VIDEO_MSP3400 is not set
+# CONFIG_VIDEO_CS5345 is not set
+# CONFIG_VIDEO_CS53L32A is not set
+# CONFIG_VIDEO_M52790 is not set
+# CONFIG_VIDEO_TLV320AIC23B is not set
+# CONFIG_VIDEO_WM8775 is not set
+# CONFIG_VIDEO_WM8739 is not set
+# CONFIG_VIDEO_VP27SMPX is not set
+
+#
+# Video decoders
+#
+# CONFIG_VIDEO_OV7670 is not set
+# CONFIG_VIDEO_TCM825X is not set
+# CONFIG_VIDEO_OV9640 is not set
+CONFIG_VIDEO_MT9P012=y
+CONFIG_VIDEO_DW9710=y
+CONFIG_VIDEO_OV3640=y
+CONFIG_VIDEO_OV3640_CSI2=y
+# CONFIG_VIDEO_SAA711X is not set
+# CONFIG_VIDEO_SAA717X is not set
+# CONFIG_VIDEO_TVP5150 is not set
+
+#
+# Video and audio decoders
+#
+# CONFIG_VIDEO_CX25840 is not set
+
+#
+# MPEG video encoders
+#
+# CONFIG_VIDEO_CX2341X is not set
+
+#
+# Video encoders
+#
+# CONFIG_VIDEO_SAA7127 is not set
+
+#
+# Video improvement chips
+#
+# CONFIG_VIDEO_UPD64031A is not set
+# CONFIG_VIDEO_UPD64083 is not set
 # CONFIG_VIDEO_VIVI is not set
 # CONFIG_VIDEO_SAA5246A is not set
 # CONFIG_VIDEO_SAA5249 is not set
@@ -977,9 +1038,9 @@
 CONFIG_VIDEO_OMAP24XX_VIDEOLIB=y
 CONFIG_VIDEO_OMAP24XX_VIDEOOUT=y
 CONFIG_VIDEO_OMAP24XX_TVOUT=y
-# CONFIG_VIDEO_OMAP3 is not set
-# CONFIG_VIDEO_OMAP34XX_ISP_PREVIEWER is not set
-# CONFIG_VIDEO_OMAP34XX_ISP_RESIZER is not set
+CONFIG_VIDEO_OMAP3=y
+CONFIG_VIDEO_OMAP34XX_ISP_PREVIEWER=y
+CONFIG_VIDEO_OMAP34XX_ISP_RESIZER=y
 # CONFIG_VIDEO_OMAP2 is not set
 # CONFIG_V4L_USB_DRIVERS is not set
 # CONFIG_SOC_CAMERA is not set
Index: omapkernel/arch/arm/configs/omap_ldp_defconfig
===
--- omapkernel.orig/arch/arm/configs/omap_ldp_defconfig 2008-10-15 
20:11:31.0 -0500
+++ omapkernel/arch/arm/configs/omap_ldp_defconfig  2008-10-15 
20:12:41.0 -0500
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.27-rc9-omap1
-# Wed Oct  8 20:00:38 2008
+# Linux kernel version: 2.6.27-omap1
+# Wed Oct 15 20:10:58 2008
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -218,8 +218,8 @@
 # CONFIG_MACH_OMAP_3430SDP is not set
 # CONFIG_MACH_OMAP3EVM is not set
 # CONFIG_MACH_OMAP3_BEAGLE is not set
-# CONFIG_OMAP3_PM is not set
 # CONFIG_MACH_OVERO is not set
+# CONFIG_OMAP3_PM is not set
 CONFIG_OMAP_TICK_GPTIMER=1

 #
@@ -823,6 +823,10 @@
 CONFIG_GPIO_TWL4030=y

 #
+# PCI GPIO expanders:
+#
+
+#
 # SPI GPIO expanders:
 #
 # CONFIG_GPIO_MAX7301 is not set
@@ -896,7 +900,7 @@
 #
 CONFIG_VIDEO_DEV=y
 CONFIG_VIDEO_V4L2_COMMON=y
-CONFIG_VIDEO_ALLOW_V4L1=y
+# CONFIG_VIDEO_ALLOW_V4L1 is not set
 CONFIG_VIDEO_V4L1_COMPAT=y
 # CONFIG_DVB_CORE is not set
 CONFIG_VIDEO_MEDIA=y
@@ -916,18 +920,71 @@
 CONFIG_MEDIA_TUNER_XC2028=y
 CONFIG_MEDIA_TUNER_XC5000=y
 CONFIG_VIDEO_V4L2=y
-CONFIG_VIDEO_V4L1=y
 CONFIG_VIDEOBUF_GEN=y
 CONFIG_VIDEOBUF_DMA_SG=y
 CONFIG_VIDEO_CAPTURE_DRIVERS=y
 # CONFIG_VIDEO_ADV_DEBUG is not set
-CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
+# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set
+
+#
+# Encoders/decoders and other helper chips
+#
+
+#
+# Audio decoders
+#
+# CONFIG_VIDEO_TVAUD

[PATCH 27/28] [OMAPZOOM] OMAP34XX: CAM: Add OV3640 Sensor Support

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP34XX: CAM: Add OV3640 Sensor Support

This adds support in OMAP34xx SDP board file for OV3640 Sensor driver.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/board-3430sdp.c |  217 
 arch/arm/mach-omap2/board-ldp.c |  213 +++
 2 files changed, 429 insertions(+), 1 deletion(-)

Index: omapkernel/arch/arm/mach-omap2/board-3430sdp.c
===
--- omapkernel.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-10-14 
19:10:49.0 -0500
+++ omapkernel/arch/arm/mach-omap2/board-3430sdp.c  2008-10-14 
19:12:25.0 -0500
@@ -48,9 +48,29 @@
 #include 
 #include <../drivers/media/video/omap34xxcam.h>
 #include <../drivers/media/video/isp/ispreg.h>
+#define REG_SDP3430_FPGA_GPIO_2 (0x50)
+#define FPGA_SPR_GPIO1_3v3 (0x1 << 14)
+#define FPGA_GPIO6_DIR_CTRL(0x1 << 6)
+static void __iomem *fpga_map_addr;
 #if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
 #include <../drivers/media/video/mt9p012.h>
 #endif
+#if defined(CONFIG_VIDEO_OV3640) || defined(CONFIG_VIDEO_OV3640_MODULE)
+#include <../drivers/media/video/ov3640.h>
+#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
 #endif

 #ifdef CONFIG_VIDEO_DW9710
@@ -76,6 +96,8 @@
 #define ENABLE_VAUX3_DEDICATED 0x03
 #define ENABLE_VAUX3_DEV_GRP   0x20

+#define TWL4030_VAUX4_DEV_GRP  0x23
+#define TWL4030_VAUX4_DEDICATED0x26

 #define TWL4030_MSECURE_GPIO 22

@@ -593,6 +615,7 @@
hwc->dev_index = 0;
hwc->dev_minor = 0;
hwc->dev_type = OMAP34XXCAM_SLAVE_SENSOR;
+   hwc->interface_type = ISP_PARLL;
return 0;
 }

@@ -605,6 +628,9 @@
.strobe = 0x0,
.prestrobe = 0x0,
.shutter = 0x0,
+   .prev_sph = 2,
+   .prev_slv = 0,
+   .wenlog = ISPCCDC_CFG_WENLOG_OR,
.u.par.par_bridge = 0x0,
.u.par.par_clk_pol = 0x0,
 };
@@ -704,6 +730,191 @@

 #endif

+#if defined(CONFIG_VIDEO_OV3640) || defined(CONFIG_VIDEO_OV3640_MODULE)
+
+static struct omap34xxcam_sensor_config ov3640_hwc = {
+   .sensor_isp = 0,
+#if defined(CONFIG_VIDEO_OV3640_CSI2)
+   .xclk = OMAP34XXCAM_XCLK_B,
+#else
+   .xclk = OMAP34XXCAM_XCLK_A,
+#endif
+   .capture_mem = PAGE_ALIGN(2048 * 1536 * 2) * 2,
+};
+
+static struct isp_interface_config ov3640_if_config = {
+   .ccdc_par_ser = ISP_CSIA,
+   .dataline_shift = 0x0,
+   .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE,
+   .vdint0_timing = 0x0,
+   .vdint1_timing = 0x0,
+   .strobe = 0x0,
+   .prestrobe = 0x0,
+   .shutter = 0x0,
+   .prev_sph = 2,
+   .prev_slv = 1,
+   .wenlog = ISPCCDC_CFG_WENLOG_AND,
+   .u.csi.crc = 0x0,
+   .u.csi.mode = 0x0,
+   .u.csi.edge = 0x0,
+   .u.csi.signalling = 0x0,
+   .u.csi.strobe_clock_inv = 0x0,
+   .u.csi.vs_edge = 0x0,
+   .u.csi.channel = 0x1,
+   .u.csi.vpclk = 0x1,
+   .u.csi.data_start = 0x0,
+   .u.csi.data_size = 0x0,
+   .u.csi.format = V4L2_PIX_FMT_SGRBG10,
+};
+
+static int ov3640_sensor_set_prv_data(void *priv)
+{
+
+   hwc = priv;
+   hwc->u.sensor.xclk = ov3640_hwc.xclk;
+   hwc->u.sensor.sensor_isp = ov3640_hwc.sensor_isp;
+   hwc->u.sensor.capture_mem = ov3640_hwc.capture_mem;
+   hwc->dev_index = 1;
+   hwc->dev_minor = 4;
+   hwc->dev_type = OMAP34XXCAM_SLAVE_SENSOR;
+   hwc->interface_type = ISP_CSIA;
+
+#if defined(CONFIG_VIDEO_OV3640_CSI2)
+   hwc->csi2.hw_csi2.lanes.clock.polarity = OV3640_CSI2_CLOCK_POLARITY;
+   hwc->csi2.hw_csi2.lanes.clock.position = OV3640_CSI2_CLOCK_LANE;
+   hwc->csi2.hw_csi2.lanes.data[0].polarity = OV3640_CSI2_DATA0_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[0].position = OV3640_CSI2_DATA0_LANE;
+   hwc->csi2.hw_csi2.lanes.data[1].polarity = OV3640_CSI2_DATA1_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[1].position = OV3640_CSI2_DATA1_LANE;
+   hwc->csi2.hw_csi2.phy.ths_term = OV3640_CSI2_PHY_THS_TERM;
+   hwc->csi2.hw_csi2.phy.ths_settle = OV3640_CSI2_PHY_THS_SETTLE;
+   hwc->csi2.hw_csi2.phy.tclk_term = OV3640_CSI2_PHY_TCLK_TERM;
+   hwc->csi2.hw_csi2.phy.tclk_miss = OV3640_CSI2_PHY_TCLK_MISS;
+  

[PATCH 26/28] [OMAPZOOM] OMAP: CAM: Add CSI2 changes to Camera driver

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: Add CSI2 changes to Camera driver

This adds CSI2 related changes to the main OMAP34xx camera driver.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/omap34xxcam.c |4 +++-
 drivers/media/video/omap34xxcam.h |   27 +++
 2 files changed, 30 insertions(+), 1 deletion(-)

Index: omapkernel/drivers/media/video/omap34xxcam.c
===
--- omapkernel.orig/drivers/media/video/omap34xxcam.c   2008-10-14 
18:51:51.0 -0500
+++ omapkernel/drivers/media/video/omap34xxcam.c2008-10-14 
18:52:19.0 -0500
@@ -37,6 +37,7 @@
 #include "omap34xxcam.h"
 #include "isp/isph3a.h"
 #include "isp/isp_af.h"
+#include "isp/ispcsi2.h"
 
 #define OMAP34XXCAM_VERSION KERNEL_VERSION(0, 0, 0)
 
@@ -478,7 +479,8 @@
 best_pix_in->width, best_pix_in->height,
 best_pix_out.width, best_pix_out.height);
 
-   return isp_try_fmt_cap(best_pix_in, wanted_pix_out); }
+   return isp_try_fmt_cap(best_pix_in, wanted_pix_out);
+}
 
 static int s_pix_parm(struct omap34xxcam_videodev *vdev,
  struct v4l2_pix_format *best_pix,
Index: omapkernel/drivers/media/video/omap34xxcam.h
===
--- omapkernel.orig/drivers/media/video/omap34xxcam.h   2008-10-14 
18:48:38.0 -0500
+++ omapkernel/drivers/media/video/omap34xxcam.h2008-10-14 
18:52:19.0 -0500
@@ -45,6 +45,29 @@
 struct omap34xxcam_device;
 struct omap34xxcam_videodev;
 
+struct omap34xxcam_hw_csi2_lanes_data {
+   unsigned polarity:1;
+   unsigned position:3;
+};
+
+struct omap34xxcam_hw_csi2_lanes {
+   struct omap34xxcam_hw_csi2_lanes_data data[4];
+   struct omap34xxcam_hw_csi2_lanes_data clock;
+};
+
+struct omap34xxcam_hw_csi2_phy {
+   u8 ths_term;
+   u8 ths_settle;
+   u8 tclk_term;
+   unsigned tclk_miss:1;
+   u8 tclk_settle;
+};
+
+struct omap34xxcam_hw_csi2 {
+   struct omap34xxcam_hw_csi2_lanes lanes;
+   struct omap34xxcam_hw_csi2_phy phy;
+};
+
 struct omap34xxcam_sensor_config {
int xclk;
int sensor_isp;
@@ -68,11 +91,15 @@
int dev_index; /* Index in omap34xxcam_sensors */
int dev_minor; /* Video device minor number */
int dev_type; /* OMAP34XXCAM_SLAVE_* */
+   int interface_type; /* Interface type */
union {
struct omap34xxcam_sensor_config sensor;
struct omap34xxcam_lens_config lens;
struct omap34xxcam_flash_config flash;
} u;
+   union {
+   struct omap34xxcam_hw_csi2 hw_csi2;
+   } csi2;
 };
 
 /**
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 24/28] [OMAPZOOM] OMAP: CAM: Add CSI2 changes to ISP driver

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: Add CSI2 changes to ISP driver

This adds CSI2 related changes to the ISP driver.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/isp.c|   96 ---
 drivers/media/video/isp/isp.h|   13 
 drivers/media/video/isp/ispccdc.c|   40 +++---
 drivers/media/video/isp/ispccdc.h|2 
 drivers/media/video/isp/isppreview.c |   27 -
 drivers/media/video/isp/isppreview.h |2 
 6 files changed, 151 insertions(+), 29 deletions(-)

Index: omapkernel/drivers/media/video/isp/isp.c
===
--- omapkernel.orig/drivers/media/video/isp/isp.c   2008-10-15 
20:08:34.0 -0500
+++ omapkernel/drivers/media/video/isp/isp.c2008-10-15 20:08:36.0 
-0500
@@ -48,6 +48,7 @@
 #include "isp_af.h"
 #include "isppreview.h"
 #include "ispresizer.h"
+#include "ispcsi2.h"
 
 #if ISP_WORKAROUND
 void *buff_addr;
@@ -171,6 +172,7 @@
int ref_count;
struct clk *cam_ick;
struct clk *cam_mclk;
+   struct clk *csi2_fck;
 } isp_obj;
 
 struct isp_sgdma ispsg;
@@ -528,6 +530,14 @@
IRQ0ENABLE_CCDC_LSC_PREF_ERR_IRQ),
ISP_IRQ0ENABLE);
break;
+   case CBK_CSIA:
+   isp_csi2_irq_set(0);
+   break;
+   case CBK_CSIB:
+   omap_writel(IRQ0ENABLE_CSIB_IRQ, ISP_IRQ0STATUS);
+   omap_writel(omap_readl(ISP_IRQ0ENABLE)|IRQ0ENABLE_CSIB_IRQ,
+   ISP_IRQ0ENABLE);
+   break;
default:
break;
}
@@ -892,6 +902,29 @@
ispctrl_val |= (config->u.par.par_bridge
<< ISPCTRL_PAR_BRIDGE_SHIFT);
break;
+   case ISP_CSIA:
+   ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_CSIA;
+   ispctrl_val &= ~ISPCTRL_PAR_BRIDGE_BENDIAN;
+   ispctrl_val |= (0x03 << ISPCTRL_PAR_BRIDGE_SHIFT);
+
+   isp_csi2_ctx_config_format(0, config->u.csi.format);
+   isp_csi2_ctx_update(0, false);
+
+   if (config->u.csi.crc)
+   isp_csi2_ctrl_config_ecc_enable(true);
+
+   isp_csi2_ctrl_config_vp_out_ctrl(config->u.csi.vpclk);
+   isp_csi2_ctrl_config_vp_only_enable(true);
+   isp_csi2_ctrl_config_vp_clk_enable(true);
+   isp_csi2_ctrl_update(false);
+
+   isp_csi2_irq_complexio1_set(1);
+   isp_csi2_irq_status_set(1);
+   isp_csi2_irq_set(1);
+
+   isp_csi2_enable(1);
+   mdelay(3);
+   break;
case ISP_CSIB:
ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_CSIB;
r = isp_init_csi(config);
@@ -915,11 +948,32 @@
ISPCCDC_VDINT_1_SHIFT),
ISPCCDC_VDINT);
 
+   /* Set sensor specific fields in CCDC and Previewer module.*/
+   isppreview_set_skip(config->prev_sph, config->prev_slv);
+   ispccdc_set_wenlog(config->wenlog);
+
return 0;
 }
 EXPORT_SYMBOL(isp_configure_interface);
 
 /**
+ * isp_configure_interface_bridge - Configure CCDC i/f bridge.
+ *
+ * Sets the bit field that controls the 8 to 16-bit bridge at
+ * the input to CCDC.
+ **/
+int isp_configure_interface_bridge(u32 par_bridge)
+{
+   u32 ispctrl_val = omap_readl(ISP_CTRL);
+
+   ispctrl_val &= ~ISPCTRL_PAR_BRIDGE_BENDIAN;
+   ispctrl_val |= (par_bridge << ISPCTRL_PAR_BRIDGE_SHIFT);
+   omap_writel(ispctrl_val, ISP_CTRL);
+   return 0;
+}
+EXPORT_SYMBOL(isp_configure_interface_bridge);
+
+/**
  * isp_CCDC_VD01_enable - Enables VD0 and VD1 IRQs.
  *
  * Sets VD0 and VD1 bits in IRQ0STATUS to reset the flag, and sets them in
@@ -1048,6 +1102,11 @@
is_irqhandled = 1;
}
 
+   if ((irqstatus & CSIA) == CSIA) {
+   isp_csi2_isr();
+   is_irqhandled = 1;
+   }
+
if (irqstatus & LSC_PRE_ERR) {
printk(KERN_ERR "isp_sr: LSC_PRE_ERR \n");
omap_writel(irqstatus, ISP_IRQ0STATUS);
@@ -1083,24 +1142,6 @@
 };
 
 /**
- * isp_set_pipeline - Set bit mask for submodules enabled within the ISP.
- * @soc_type: Sensor to use: 1 - Smart sensor, 0 - Raw sensor.
- *
- * Sets Previewer and Resizer in the bit mask only if its a Raw sensor.
- **/
-void isp_set_pipeline(int soc_type)
-{
-   ispmodule_obj.isp_pipeline |= OMAP_ISP_CCDC;
-
-   if (!soc_type)
-   ispmodule_obj.isp_pipeline |= (OMAP_ISP_PREVIEW |
-   OMAP_ISP_RESIZER);
-
-   return;
-}
-EXPORT_SYMBOL(isp_set_pipeline);
-
-/**
  * omapisp_unset_callback - Unsets all the callbacks associated with ISP module
  **/
 

[PATCH 22/28] [OMAPZOOM] ARM: OMAP: Add CSI2 register defines.

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

ARM: OMAP: Add CSI2 register defines.

Add CSI2 register defines to ispreg.h.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/ispreg.h |  403 ++-
 1 file changed, 394 insertions(+), 9 deletions(-)

Index: omapkernel/drivers/media/video/isp/ispreg.h
===
--- omapkernel.orig/drivers/media/video/isp/ispreg.h2008-10-14 
18:51:35.0 -0500
+++ omapkernel/drivers/media/video/isp/ispreg.h 2008-10-14 18:51:56.0 
-0500
@@ -238,15 +238,6 @@
 #define ISPCSI2_COMPLEXIO1_IRQENABLE   0x480BD860
 #define ISPCSI2_DBG_P  0x480BD868
 #define ISPCSI2_TIMING 0x480BD86C
-#define ISPCSI2_CTX_CTRL1(n)   (0x480BD870+0x20*(n))
-#define ISPCSI2_CTX_CTRL2(n)   (0x480BD874+0x20*(n))
-#define ISPCSI2_CTX_DAT_OFST(n)(0x480BD878+0x20*(n))
-#define ISPCSI2_CTX_DAT_PING_ADDR(n)   (0x480BD87C+0x20*(n))
-#define ISPCSI2_CTX_DAT_PONG_ADDR(n)   (0x480BD880+0x20*(n))
-#define ISPCSI2_CTX_IRQENABLE(n)   (0x480BD884+0x20*(n))
-#define ISPCSI2_CTX_IRQSTATUS(n)   (0x480BD888+0x20*(n))
-#define ISPCSI2_CTX_CTRL3(n)   (0x480BD88C+0x20*(n))
-
 #define ISP_CSIB_SYSCONFIG ISPCSI1_SYSCONFIG
 #define ISP_CSIA_SYSCONFIG ISPCSI2_SYSCONFIG

@@ -726,6 +717,7 @@
 #define ISPCTRL_SYNC_DETECT_HSRISE (0x1 << ISPCTRL_SYNC_DETECT_SHIFT)
 #define ISPCTRL_SYNC_DETECT_VSFALL (0x2 << ISPCTRL_SYNC_DETECT_SHIFT)
 #define ISPCTRL_SYNC_DETECT_VSRISE (0x3 << ISPCTRL_SYNC_DETECT_SHIFT)
+#define ISPCTRL_SYNC_DETECT_MASK   (0x3 << ISPCTRL_SYNC_DETECT_SHIFT)

 #define ISPCTRL_CCDC_RAM_EN(1 << 16)
 #define ISPCTRL_PREV_RAM_EN(1 << 17)
@@ -890,6 +882,8 @@
 #define ISPCCDC_CFG_BW656  (1 << 5)
 #define ISPCCDC_CFG_FIDMD_SHIFT6
 #define ISPCCDC_CFG_WENLOG (1 << 8)
+#define ISPCCDC_CFG_WENLOG_AND (0 << 8)
+#define ISPCCDC_CFG_WENLOG_OR  (1 << 8)
 #define ISPCCDC_CFG_Y8POS  (1 << 11)
 #define ISPCCDC_CFG_BSWD   (1 << 12)
 #define ISPCCDC_CFG_MSBINVI(1 << 13)
@@ -1280,4 +1274,395 @@
 #define ISPCSI1_MIDLEMODE_NOSTANDBY0x1
 #define ISPCSI1_MIDLEMODE_SMARTSTANDBY 0x2

+/* CSI2 receiver registers (ES2.0) */
+#define ISPCSI2_REVISION   0x480BD800
+#define ISPCSI2_SYSCONFIG  0x480BD810
+#define ISPCSI2_SYSCONFIG_MSTANDBY_MODE_SHIFT  12
+#define ISPCSI2_SYSCONFIG_MSTANDBY_MODE_MASK \
+   (0x3 << ISPCSI2_SYSCONFIG_MSTANDBY_MODE_SHIFT)
+#define ISPCSI2_SYSCONFIG_MSTANDBY_MODE_FORCE \
+   (0x0 << ISPCSI2_SYSCONFIG_MSTANDBY_MODE_SHIFT)
+#define ISPCSI2_SYSCONFIG_MSTANDBY_MODE_NO \
+   (0x1 << ISPCSI2_SYSCONFIG_MSTANDBY_MODE_SHIFT)
+#define ISPCSI2_SYSCONFIG_MSTANDBY_MODE_SMART \
+   (0x2 << ISPCSI2_SYSCONFIG_MSTANDBY_MODE_SHIFT)
+#define ISPCSI2_SYSCONFIG_SOFT_RESET_SHIFT 1
+#define ISPCSI2_SYSCONFIG_SOFT_RESET_MASK \
+   (0x1 << ISPCSI2_SYSCONFIG_SOFT_RESET_SHIFT)
+#define ISPCSI2_SYSCONFIG_SOFT_RESET_NORMAL \
+   (0x0 << ISPCSI2_SYSCONFIG_SOFT_RESET_SHIFT)
+#define ISPCSI2_SYSCONFIG_SOFT_RESET_RESET \
+   (0x1 << ISPCSI2_SYSCONFIG_SOFT_RESET_SHIFT)
+#define ISPCSI2_SYSCONFIG_AUTO_IDLE_SHIFT  0
+#define ISPCSI2_SYSCONFIG_AUTO_IDLE_MASK \
+   (0x1 << ISPCSI2_SYSCONFIG_AUTO_IDLE_SHIFT)
+#define ISPCSI2_SYSCONFIG_AUTO_IDLE_FREE \
+   (0x0 << ISPCSI2_SYSCONFIG_AUTO_IDLE_SHIFT)
+#define ISPCSI2_SYSCONFIG_AUTO_IDLE_AUTO \
+   (0x1 << ISPCSI2_SYSCONFIG_AUTO_IDLE_SHIFT)
+#define ISPCSI2_SYSSTATUS  0x480BD814
+#define ISPCSI2_SYSSTATUS_RESET_DONE_SHIFT 0
+#define ISPCSI2_SYSSTATUS_RESET_DONE_MASK \
+   (0x1 << ISPCSI2_SYSSTATUS_RESET_DONE_SHIFT)
+#define ISPCSI2_SYSSTATUS_RESET_DONE_ONGOING \
+   (0x0 << ISPCSI2_SYSSTATUS_RESET_DONE_SHIFT)
+#define ISPCSI2_SYSSTATUS_RESET_DONE_DONE \
+   (0x1 << ISPCSI2_SYSSTATUS_RESET_DONE_SHIFT)
+#define ISPCSI2_IRQSTATUS  0x480BD818
+#define ISPCSI2_IRQSTATUS_OCP_ERR_IRQ  (1 << 14)
+#define ISPCSI2_IRQSTATUS_SHORT_PACKET_IRQ (1 << 13)
+#define ISPCSI2_IRQSTATUS_ECC_CORRECTION_IRQ   (1 << 12)
+#define ISPCSI2_IRQSTATUS_ECC_NO_CORRECTION_IRQ(1 << 11)
+#define ISPCSI2_IRQSTATUS_COMPLEXIO2_ERR_IRQ   (1 << 10)
+#define ISPCSI2_IRQSTATUS_COMPLEXIO1_ERR_IRQ   (1 << 9)
+#define ISPCSI2_IRQSTATUS_FIFO_OVF_IRQ (1 << 8)
+#define ISPCSI2_IRQSTATUS

[PATCH 21/28] [OMAPZOOM] OMAP34XX: CAM: Remove the need for RESUME state

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP34XX: CAM: Remove the need for RESUME state

In RESUME power state, we were only switching a GPIO for that, and we
weren't executing again the whole POWER_ON commands.

Sakari Ailus removed the RESUME power state from his patchset,
rendering the RESUME uncompilable. So, for compensating that, i'm
storing now the previous power state, to know what is the intended
transition:

- Off -> On, or
- standby -> on (which is the resume case now)

This patch Keeps the same functionality without the need for a resume
state.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/board-3430sdp.c |   92 ++--
 1 file changed, 48 insertions(+), 44 deletions(-)

Index: omapkernel/arch/arm/mach-omap2/board-3430sdp.c
===
--- omapkernel.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-10-14 
18:51:36.0 -0500
+++ omapkernel/arch/arm/mach-omap2/board-3430sdp.c  2008-10-14 
18:51:36.0 -0500
@@ -611,6 +611,7 @@

 static int mt9p012_sensor_power_set(enum v4l2_power power)
 {
+   static enum v4l2_power previous_power = V4L2_POWER_OFF;
switch (power) {
case V4L2_POWER_OFF:
/* Power Down Sequence */
@@ -626,69 +627,72 @@
omap_free_gpio(MT9P012_STANDBY_GPIO);
break;
case V4L2_POWER_ON:
-   /* Power Up Sequence */
-   isp_configure_interface(&mt9p012_if_config);
+   if (previous_power == V4L2_POWER_OFF) {
+   /* Power Up Sequence */
+   isp_configure_interface(&mt9p012_if_config);
+
+   /* Request and configure gpio pins */
+   if (omap_request_gpio(MT9P012_STANDBY_GPIO) != 0) {
+   printk(KERN_WARNING "Could not request GPIO %d"
+   " for MT9P012\n",
+   MT9P012_STANDBY_GPIO);
+   return -EIO;
+   }
+
+   /* Request and configure gpio pins */
+   if (omap_request_gpio(MT9P012_RESET_GPIO) != 0)
+   return -EIO;
+
+   /* set to output mode */
+   omap_set_gpio_direction(MT9P012_STANDBY_GPIO, 0);
+   /* set to output mode */
+   omap_set_gpio_direction(MT9P012_RESET_GPIO, 0);

-   /* Request and configure gpio pins */
-   if (omap_request_gpio(MT9P012_STANDBY_GPIO) != 0) {
-   printk(KERN_WARNING "Could not request GPIO %d for "
-   "AF D88\n", MT9P012_STANDBY_GPIO);
-   return -EIO;
-   }
-
-   /* Request and configure gpio pins */
-   if (omap_request_gpio(MT9P012_RESET_GPIO) != 0)
-   return -EIO;
-
-   /* set to output mode */
-   omap_set_gpio_direction(MT9P012_STANDBY_GPIO, 0);
-   /* set to output mode */
-   omap_set_gpio_direction(MT9P012_RESET_GPIO, 0);
+   /* STANDBY_GPIO is active HIGH for set LOW to release */
+   omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);

-   /* STANDBY_GPIO is active HIGH for set LOW to release */
-   omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);
+   /* nRESET is active LOW. set HIGH to release reset */
+   omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);

-   /* nRESET is active LOW. set HIGH to release reset */
-   omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);
-
-   /* turn on digital power */
-   enable_fpga_vio_1v8(1);
+   /* turn on digital power */
+   enable_fpga_vio_1v8(1);
 #ifdef CONFIG_TWL4030_CORE
-   /* turn on analog power */
-   twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+   /* 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,
+   twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
VAUX_DEV_GRP_P1, TWL4030_VAUX2_DEV_GRP);
 #else
 #error "no power companion board defined!"
 #endif
+   }

+   /* out of standby */
omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 0);
-
udelay(1000);

-   /* have to put sensor to reset to guarantee detection */
-   omap_set_gpio_dataout(MT9P012_RESET_GPIO, 0);
-
-   udelay(1500);
-
-   /* nRESET

[PATCH 20/28] [OMAPZOOM] OMAP: CAM: DW9710: RESUME Removal

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: DW9710: RESUME Removal

This patch removes the use of the V4L2_POWER_RESUME state, as it has
been rejected in video4linux list

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/dw9710.c  |6 +++---
 drivers/media/video/mt9p012.c |   14 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)

Index: omapkernel/drivers/media/video/dw9710.c
===
--- omapkernel.orig/drivers/media/video/dw9710.c2008-10-14 
18:51:36.0 -0500
+++ omapkernel/drivers/media/video/dw9710.c 2008-10-14 18:51:53.0 
-0500
@@ -421,8 +421,6 @@

rval = lens->pdata->power_set(on);

-   lens->power_state = on;
-
if ((on == V4L2_POWER_ON) && (lens->state == LENS_NOT_DETECTED)) {
rval = dw9710_detect(c);
if (rval < 0) {
@@ -437,9 +435,11 @@
pr_info(DRIVER_NAME " lens HW detected\n");
}

-   if ((on == V4L2_POWER_RESUME) && (lens->state == LENS_DETECTED))
+   if ((lens->power_state == V4L2_POWER_STANDBY) && (on == V4L2_POWER_ON)
+   && (lens->state == LENS_DETECTED))
dw9710_af_setfocus(lens->current_lens_posn);

+   lens->power_state = on;
return 0;
 }

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


[PATCH 19/28] [OMAPZOOM] OMAP: CAM: MT9P012: RESUME Removal

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: MT9P012: RESUME Removal

This patch removes the use of the V4L2_POWER_RESUME state, as it has
been rejected in video4linux list

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/mt9p012.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

Index: omapkernel/drivers/media/video/mt9p012.c
===
--- omapkernel.orig/drivers/media/video/mt9p012.c   2008-10-15 
20:03:08.0 -0500
+++ omapkernel/drivers/media/video/mt9p012.c2008-10-15 20:04:05.0 
-0500
@@ -1243,8 +1243,7 @@
struct i2c_client *client = sensor->i2c_client;
u32 coarse_int_time = 0;
 
-   if ((current_power_state == V4L2_POWER_ON) ||
-   (current_power_state == V4L2_POWER_RESUME)) {
+   if (current_power_state == V4L2_POWER_ON) {
if ((exp_time < min_exposure_time) ||
(exp_time > max_exposure_time)) {
dev_err(&client->dev, "Exposure time not within the "
@@ -1312,8 +1311,7 @@
struct mt9p012_sensor *sensor = s->priv;
struct i2c_client *client = sensor->i2c_client;
 
-   if ((current_power_state == V4L2_POWER_ON) ||
-   (current_power_state == V4L2_POWER_RESUME)) {
+   if (current_power_state == V4L2_POWER_ON) {
if ((gain < MIN_GAIN) || (gain > MAX_GAIN)) {
dev_err(&client->dev, "Gain not within the legal"
" range\n");
@@ -2006,7 +2004,7 @@
mt9p012_write_regs(c, stream_off_list,
I2C_STREAM_OFF_LIST_SIZE);
 
-   if ((on != V4L2_POWER_ON) && (on != V4L2_POWER_RESUME))
+   if (on != V4L2_POWER_ON)
isp_set_xclk(0, MT9P012_USE_XCLKA);
else
isp_set_xclk(xclk_current, MT9P012_USE_XCLKA);
@@ -2019,8 +2017,9 @@
isp_set_xclk(0, MT9P012_USE_XCLKA);
return rval;
}
-   current_power_state = on;
-   if ((on == V4L2_POWER_RESUME) && (sensor->state == SENSOR_DETECTED))
+   if ((current_power_state == V4L2_POWER_STANDBY) &&
+   (on == V4L2_POWER_ON) &&
+   (sensor->state == SENSOR_DETECTED))
mt9p012_configure(s);
 
if ((on == V4L2_POWER_ON) && (sensor->state == SENSOR_NOT_DETECTED)) {
@@ -2037,6 +2036,7 @@
sensor->ver);
}
 
+   current_power_state = on;
return 0;
 }

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


[PATCH 17/28] [OMAPZOOM] OMAP: CAM: Add MMS Kernel changes

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: Add MMS Kernel changes

This adds MMS changes to the OMAP34xx camera driver. Including:
- HQ capture

NOTE: Credits to MMS crew for all this.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/omap_previewer.c |  392 +++
 drivers/media/video/isp/omap_previewer.h |   22 +
 2 files changed, 309 insertions(+), 105 deletions(-)

Index: omapkernel/drivers/media/video/isp/omap_previewer.c
===
--- omapkernel.orig/drivers/media/video/isp/omap_previewer.c2008-10-15 
19:25:00.0 -0500
+++ omapkernel/drivers/media/video/isp/omap_previewer.c 2008-10-15 
19:53:07.0 -0500
@@ -38,6 +38,24 @@

 #define OMAP_PREV_NAME "omap-previewer"

+#define BIT_SET(var, shift, mask, val) \
+   do {\
+   var = (var & ~(mask << shift))  \
+   | (val << shift);   \
+   } while (0)
+
+/*
+#define OMAP_ISP_PREVIEWER_DEBUG
+*/
+#undef OMAP_ISP_PREVIEWER_DEBUG
+
+#ifdef OMAP_ISP_PREVIEWER_DEBUG
+#define DPRINTK_PREVIEWER(format, ...) \
+   printk(KERN_DEBUG "PREV: " format, ## __VA_ARGS__)
+#else
+#define DPRINTK_PREVIEWER(format, ...)
+#endif
+
 static int prev_major = -1;
 static struct device *prev_dev;
 static struct class *prev_class;
@@ -45,6 +63,7 @@
 static struct platform_driver omap_previewer_driver;

 static u32 prev_bufsize;
+static u32 lsc_bufsize;

 /**
  * prev_calculate_crop - Calculate crop size according to device parameters
@@ -119,6 +138,10 @@
isppreview_enable_hmed(0);

if (config->features & PREV_DARK_FRAME_SUBTRACT) {
+   DPRINTK_PREVIEWER("[%s] darkaddr %08x, darklineoffset %d\n",
+   __func__,
+   config->drkf_params.addr,
+   config->drkf_params.offset);
isppreview_set_darkaddr(config->drkf_params.addr);
isppreview_config_darklineoffset(config->drkf_params.offset);
isppreview_enable_drkframe(1);
@@ -200,28 +223,11 @@
goto err_einval;
}

-   if (params->features & PREV_DARK_FRAME_SUBTRACT)
-   if (!params->drkf_params.addr
-   || (params->drkf_params.offset % 32)) {
-   dev_err(prev_dev, "validate_params: dark frame "
-   "address\n");
-   goto err_einval;
-   }
-
-   if (params->features & PREV_LENS_SHADING)
-   if ((params->lens_shading_shift > 7)
-   || !params->drkf_params.addr
-   || (params->drkf_params.offset % 32)) {
-   dev_err(prev_dev, "validate_params: lens shading "
-   "shift\n");
-   goto err_einval;
-   }
-
if ((params->size_params.in_pitch <= 0)
|| (params->size_params.in_pitch % 32)) {
params->size_params.in_pitch =
(params->size_params.hsize * 2) & 0xFFE0;
-   dev_err(prev_dev, "\nError in in_pitch; new value = %d",
+   dev_err(prev_dev, "Error in in_pitch; new value = %d",
params->size_params.in_pitch);
}

@@ -248,6 +254,40 @@
complete(&device->wfc);
 }

+#define ISP_CTRL_SBL_SHARED_RPORTB (1 << 28)
+#define ISP_CTRL_SBL_SHARED_RPORTA (1 << 27)
+#define SBL_SHARED_RPORTB  28
+#define CBUFF1_BCF_CTRL24
+#define CBUFF0_BCF_CTRL22
+#define SBL_RD_RAM_EN  18
+#define SHIFT  6
+
+static void previewer_set_isp_ctrl(void)
+{
+   u32 val;
+
+   val = omap_readl(ISP_CTRL);
+
+   /* Read port used by preview module data read */
+   val &= ~ISP_CTRL_SBL_SHARED_RPORTA;
+
+   /* Read port used by preview module dark frame read */
+   val &= ~ISP_CTRL_SBL_SHARED_RPORTB;
+
+   BIT_SET(val, CBUFF1_BCF_CTRL, 0x3, 0x01);
+   BIT_SET(val, CBUFF0_BCF_CTRL, 0x3, 0x01);
+   BIT_SET(val, SBL_RD_RAM_EN, 0x1, 0x1);
+   BIT_SET(val, SHIFT, 0x3, 0x00);
+
+   /* write ISP CTRL register */
+   omap_writel(val, ISP_CTRL);
+
+#define TCTRL_CTRL  0x480BC050
+#define TCTRL_FRAME 0x480BC054
+   omap_writel(0x0004, TCTRL_CTRL);
+   omap_writel(0x000C, TCTRL_FRAME);
+}
+
 /**
  * prev_do_preview - Performs the Preview process
  * @device: Structure containing ISP preview wrapper global information
@@ -268,25 +308,23 @@
return -EINVAL;
}

+   previewer_set_isp_ctrl();
+

[PATCH 16/28] [OMAPZOOM] OMAP: CAM: Add MMS Kernel changes

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: Add MMS Kernel changes

This adds MMS changes to the OMAP34xx camera driver. Including:
- HQ capture

NOTE: Credits to MMS crew for all this.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/isp.c|   40 ---
 drivers/media/video/isp/isp_af.c |   28 +---
 drivers/media/video/isp/ispccdc.c|  117 ---
 drivers/media/video/isp/ispccdc.h|4 -
 drivers/media/video/isp/isph3a.c |   12 +++
 drivers/media/video/isp/ispmmu.h |2
 drivers/media/video/isp/isppreview.c |3
 drivers/media/video/isp/isppreview.h |9 ++
 8 files changed, 180 insertions(+), 35 deletions(-)

Index: omapkernel/drivers/media/video/isp/isp.c
===
--- omapkernel.orig/drivers/media/video/isp/isp.c   2008-10-15 
19:37:26.0 -0500
+++ omapkernel/drivers/media/video/isp/isp.c2008-10-15 19:40:02.0 
-0500
@@ -71,6 +71,10 @@
.description = "Bayer10 (GrR/BGb)",
.pixelformat = V4L2_PIX_FMT_SGRBG10,
},
+   {
+   .description = "Bayer10 (pattern)",
+   .pixelformat = V4L2_PIX_FMT_PATT,
+   }
 };

 /* ISP Crop capabilities */
@@ -980,6 +984,14 @@
goto out;
}

+   if ((irqstatus & HS_VS) == HS_VS) {
+   if (irqdis->isp_callbk[CBK_HS_VS])
+   irqdis->isp_callbk[CBK_HS_VS](HS_VS,
+   irqdis->isp_callbk_arg1[CBK_HS_VS],
+   irqdis->isp_callbk_arg2[CBK_HS_VS]);
+   is_irqhandled = 1;
+   }
+
if ((irqstatus & CCDC_VD1) == CCDC_VD1) {
if (irqdis->isp_callbk[CBK_CCDC_VD1])
irqdis->isp_callbk[CBK_CCDC_VD1](CCDC_VD1,
@@ -1028,14 +1040,6 @@
is_irqhandled = 1;
}

-   if ((irqstatus & HS_VS) == HS_VS) {
-   if (irqdis->isp_callbk[CBK_HS_VS])
-   irqdis->isp_callbk[CBK_HS_VS](HS_VS,
-   irqdis->isp_callbk_arg1[CBK_HS_VS],
-   irqdis->isp_callbk_arg2[CBK_HS_VS]);
-   is_irqhandled = 1;
-   }
-
if ((irqstatus & H3A_AF_DONE) == H3A_AF_DONE) {
if (irqdis->isp_callbk[CBK_H3A_AF_DONE])
irqdis->isp_callbk[CBK_H3A_AF_DONE](H3A_AF_DONE,
@@ -1191,6 +1195,9 @@
is_isppreview_enabled())
isppreview_enable(1);

+   /* clear any pending IRQs */
+   omap_writel(0x, ISP_IRQ0STATUS);
+
return;
 }
 EXPORT_SYMBOL(isp_start);
@@ -1258,7 +1265,8 @@

isp_release_resources();
if ((pix_input->pixelformat == V4L2_PIX_FMT_SGRBG10) &&
-   (pix_output->pixelformat != V4L2_PIX_FMT_SGRBG10)) {
+   ((pix_output->pixelformat == V4L2_PIX_FMT_YUYV) ||
+   (pix_output->pixelformat == V4L2_PIX_FMT_UYVY))) {
ispmodule_obj.isp_pipeline = OMAP_ISP_CCDC |
OMAP_ISP_PREVIEW | OMAP_ISP_RESIZER;
ispccdc_request();
@@ -1277,15 +1285,23 @@
isppreview_config_datapath(PRV_RAW_CCDC, PREVIEW_RSZ);
ispresizer_config_datapath(RSZ_OTFLY_YUV);
 #endif
-   } else {
+   } else if (pix_input->pixelformat == pix_output->pixelformat) {
ispmodule_obj.isp_pipeline = OMAP_ISP_CCDC;
ispccdc_request();
if (pix_input->pixelformat == V4L2_PIX_FMT_SGRBG10)
ispccdc_config_datapath(CCDC_RAW, CCDC_OTHERS_MEM);
-   else
+   else if (pix_input->pixelformat == V4L2_PIX_FMT_PATT) {
+   /* MMS */
+   ispccdc_config_datapath(CCDC_RAW_PATTERN,
+   CCDC_OTHERS_LSC_MEM);
+   } else if ((pix_input->pixelformat == V4L2_PIX_FMT_YUYV) ||
+   (pix_input->pixelformat == V4L2_PIX_FMT_UYVY)) {
ispccdc_config_datapath(CCDC_YUV_SYNC,
CCDC_OTHERS_MEM);
-   }
+   } else
+   return -EINVAL;
+   } else
+   return -EINVAL;
return 0;
 }

Index: omapkernel/drivers/media/video/isp/isp_af.c
===
--- omapkernel.orig/drivers/media/video/isp/isp_af.c2008-10-15 
19:37:24.0 -0500
+++ omapkernel/drivers/media/video/isp/isp_af.c 2008-10-15 19:40:49.0 
-0500
@@ -313,9 +313,10 @@
busyaf = omap_readl(ISPH3A_PCR);

if ((busyaf & AF_BUSYAF) == AF_BUSYAF) {
-   DPRINTK_ISPH3A("AF_register_setup_ERROR : Engine Busy");
-   DPRINTK_ISPH3A("\n Configuration cann

[PATCH 15/28] [OMAPZOOM] V4L: Add RAW10 Pattern format MMS

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

V4L: Add RAW10 Pattern format MMS

This adds MMS changes to the OMAP34xx camera driver. Including:
- HQ capture

NOTE: Credits to MMS crew for all this.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 include/linux/videodev2.h |5 +
 1 file changed, 5 insertions(+)

Index: omapkernel/include/linux/videodev2.h
===
--- omapkernel.orig/include/linux/videodev2.h   2008-10-15 19:25:00.0 
-0500
+++ omapkernel/include/linux/videodev2.h2008-10-15 19:39:00.0 
-0500
@@ -319,6 +319,11 @@
 #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') /* 10bit raw 
bayer DPCM compressed to 8 bits */
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. 
GRGR.. */
 
+/* Added by MMS */
+#define V4L2_PIX_FMT_PATT v4l2_fourcc('P', 'A', 'T', 'T') /* 10-bit raw
+  * pattern
+  */
+
 /* compressed formats */
 #define V4L2_PIX_FMT_MJPEGv4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG   
*/
 #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG 
*/
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/28] [OMAPZOOM] OMAP: CAM: Add LSC workaround to ISP driver

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Pallavi Kulkarni <[EMAIL PROTECTED]>

OMAP: CAM: Add LSC workaround to ISP driver

This adds software workaround for silicon errata of mutual SDRAM
use of LSC and resizer. This errata was about data corruption
when Lens Shading Compensation table was loaded by CCDC as the 
resizer was working.

Signed-off-by: Pallavi Kulkarni <[EMAIL PROTECTED]>
Signed-off-by: Margarita Olaya <[EMAIL PROTECTED]>
Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/isp.c|  114 ++-
 drivers/media/video/isp/isp.h|4 +
 drivers/media/video/isp/ispresizer.c |   22 ++
 3 files changed, 138 insertions(+), 2 deletions(-)

Index: omapkernel/drivers/media/video/isp/isp.c
===
--- omapkernel.orig/drivers/media/video/isp/isp.c   2008-10-14 
12:22:23.0 -0500
+++ omapkernel/drivers/media/video/isp/isp.c2008-10-14 12:34:05.0 
-0500
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "isp.h"
 #include "ispmmu.h"
@@ -48,6 +49,14 @@
 #include "isppreview.h"
 #include "ispresizer.h"
 
+#if ISP_WORKAROUND
+void *buff_addr;
+dma_addr_t buff_addr_mapped;
+struct scatterlist *sglist_alloc;
+static int alloc_done, num_sc;
+unsigned long offset_value;
+#endif
+
 /* List of image formats supported via OMAP ISP */
 const static struct v4l2_fmtdesc isp_formats[] = {
{
@@ -1110,6 +1119,66 @@
omap_writel(omap_readl(ISP_IRQ0STATUS) | ISP_INT_CLR, ISP_IRQ0STATUS);
 }
 
+#if ISP_WORKAROUND
+/**
+ *  isp_buf_allocation - To allocate a 10MB memory
+ *
+ **/
+u32 isp_buf_allocation(void)
+{
+   buff_addr = (void *) vmalloc(buffer_size);
+
+   if (!buff_addr) {
+   printk(KERN_ERR "Cannot allocate memory ");
+   return -ENOMEM;
+   }
+
+   sglist_alloc = videobuf_vmalloc_to_sg(buff_addr, no_of_pages);
+   if (!sglist_alloc) {
+   printk(KERN_ERR "videobuf_vmalloc_to_sg error");
+   return -ENOMEM;
+   }
+   num_sc = dma_map_sg(NULL, sglist_alloc, no_of_pages, 1);
+   buff_addr_mapped = ispmmu_map_sg(sglist_alloc, no_of_pages);
+   if (!buff_addr_mapped) {
+   printk(KERN_ERR "ispmmu_map_sg mapping failed ");
+   return -ENOMEM;
+   }
+   isppreview_set_outaddr(buff_addr_mapped);
+   alloc_done = 1;
+   return 0;
+}
+
+/**
+ *  isp_buf_get - Get the buffer pointer address
+ **/
+dma_addr_t isp_buf_get(void)
+{
+   dma_addr_t retaddr;
+
+   if (alloc_done == 1)
+   retaddr = buff_addr_mapped + offset_value;
+   else
+   retaddr = 0;
+   return retaddr;
+}
+
+/**
+ *  isp_buf_free - To free allocated 10MB memory
+ *
+ **/
+void isp_buf_free(void)
+{
+   if (alloc_done == 1) {
+   ispmmu_unmap(buff_addr_mapped);
+   dma_unmap_sg(NULL, sglist_alloc, no_of_pages, 1);
+   kfree(sglist_alloc);
+   vfree(buff_addr);
+   alloc_done = 0;
+   }
+}
+#endif
+
 /**
  * isp_start - Starts ISP submodule
  *
@@ -1165,9 +1234,11 @@
if ((ispmodule_obj.isp_pipeline & OMAP_ISP_RESIZER) &&
is_ispresizer_enabled())
ispresizer_set_outaddr(sgdma_state->isp_addr);
+#if (ISP_WORKAROUND == 0)
else if ((ispmodule_obj.isp_pipeline & OMAP_ISP_PREVIEW) &&
is_isppreview_enabled())
isppreview_set_outaddr(sgdma_state->isp_addr);
+#endif
else if (ispmodule_obj.isp_pipeline & OMAP_ISP_CCDC)
ispccdc_set_outaddr(sgdma_state->isp_addr);
 
@@ -1178,9 +1249,13 @@
  * @pix_input: Pointer to V4L2 pixel format structure for input image.
  * @pix_output: Pointer to V4L2 pixel format structure for output image.
  **/
-void isp_calc_pipeline(struct v4l2_pix_format *pix_input,
+u32 isp_calc_pipeline(struct v4l2_pix_format *pix_input,
struct v4l2_pix_format *pix_output)
 {
+#if ISP_WORKAROUND
+   int rval;
+#endif
+
isp_release_resources();
if ((pix_input->pixelformat == V4L2_PIX_FMT_SGRBG10) &&
(pix_output->pixelformat != V4L2_PIX_FMT_SGRBG10)) {
@@ -1190,8 +1265,18 @@
isppreview_request();
ispresizer_request();
ispccdc_config_datapath(CCDC_RAW, CCDC_OTHERS_VP);
+#if ISP_WORKAROUND
+   isppreview_config_datapath(PRV_RAW_CCDC, PREVIEW_MEM);
+   ispresizer_config_datapath(RSZ_MEM_YUV);
+   if (alloc_done == 0) {
+   rval = isp_buf_allocation();
+   if (rval)
+   return -EINVAL;
+   }
+#else
isppreview_config_datapath(PRV_RAW_CCDC, PREVIEW_RSZ);
ispresizer_config_datapath(RSZ_OTFLY_YUV);
+#endif
} else {

[PATCH 13/28] [OMAPZOOM] OMAP: CAM: MT9P012: Misc Fixes

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: MT9P012: Misc Fixes

This patch adds the following changes:
 - Removal of v4l2_ifparm use, as it is no longer needed.
 - Fix I2C writing of stream_off commands while XCLK wasn't available.
 - Fix for 30 fps capture on sizes lower than 3MP.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/mt9p012.c |   50 ++
 1 file changed, 8 insertions(+), 42 deletions(-)

Index: omapkernel/drivers/media/video/mt9p012.c
===
--- omapkernel.orig/drivers/media/video/mt9p012.c   2008-10-03 
17:48:05.0 -0500
+++ omapkernel/drivers/media/video/mt9p012.c2008-10-14 12:30:17.0 
-0500
@@ -1391,30 +1391,6 @@
 }
 
 /**
- * ioctl_g_ifparm - V4L2 sensor interface handler for vidioc_int_g_ifparm_num
- * @s: pointer to standard V4L2 device structure
- * @p: pointer to standard V4L2 vidioc_int_g_ifparm_num ioctl structure
- *
- * Gets slave interface parameters.
- * Calculates the required xclk value to support the requested
- * clock parameters in p.  This value is returned in the p
- * parameter.
- */
-static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
-{
-   struct mt9p012_sensor *sensor = s->priv;
-   int rval;
-
-   rval = sensor->pdata->ifparm(p);
-   if (rval)
-   return rval;
-
-   p->u.bt656.clock_curr = xclk_current;
-
-   return 0;
-}
-
-/**
  * ioctl_g_priv - V4L2 sensor interface handler for vidioc_int_g_priv_num
  * @s: pointer to standard V4L2 device structure
  * @p: void pointer to hold sensor's private data address
@@ -1426,7 +1402,6 @@
struct mt9p012_sensor *sensor = s->priv;
 
return sensor->pdata->priv_data_set(p);
-
 }
 
 /**
@@ -1440,24 +1415,15 @@
 {
struct mt9p012_sensor *sensor = s->priv;
struct i2c_client *c = sensor->i2c_client;
-   struct v4l2_ifparm p;
int rval;
 
-   rval = ioctl_g_ifparm(s, &p);
-   if (rval) {
-   dev_err(&c->dev, "Unable to get if params\n");
-   return rval;
-   }
-
-   if (((on == V4L2_POWER_OFF) || (on == V4L2_POWER_STANDBY))
-   && (sensor->state == SENSOR_DETECTED))
+   if ((on == V4L2_POWER_STANDBY) && (sensor->state == SENSOR_DETECTED))
mt9p012_write_regs(c, stream_off_list);
 
-
if ((on != V4L2_POWER_ON) && (on != V4L2_POWER_RESUME))
isp_set_xclk(0, MT9P012_USE_XCLKA);
else
-   isp_set_xclk(p.u.bt656.clock_curr, MT9P012_USE_XCLKA);
+   isp_set_xclk(xclk_current, MT9P012_USE_XCLKA);
 
 
rval = sensor->pdata->power_set(on);
@@ -1588,10 +1554,12 @@
 
/* Do we already reached all discrete framesizes? */
 
-   if ((frmi->width == mt9p012_sizes[4].width) &&
-   (frmi->height == mt9p012_sizes[4].height)) {
-   /* FIXME: The only frameinterval supported by 5MP capture is
-* 1/11 fps
+   if (((frmi->width == mt9p012_sizes[4].width) &&
+   (frmi->height == mt9p012_sizes[4].height)) ||
+   ((frmi->width == mt9p012_sizes[3].width) &&
+   (frmi->height == mt9p012_sizes[3].height))) {
+   /* FIXME: The only frameinterval supported by 5MP and 3MP
+* capture sizes is 1/11 fps
 */
if (frmi->index != 0)
return -EINVAL;
@@ -1622,8 +1590,6 @@
  .func = (v4l2_int_ioctl_func *)ioctl_s_power },
{ .num = vidioc_int_g_priv_num,
  .func = (v4l2_int_ioctl_func *)ioctl_g_priv },
-   { .num = vidioc_int_g_ifparm_num,
- .func = (v4l2_int_ioctl_func *)ioctl_g_ifparm },
{ .num = vidioc_int_init_num,
  .func = (v4l2_int_ioctl_func *)ioctl_init },
{ .num = vidioc_int_enum_fmt_cap_num,
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/28] [OMAPZOOM] OMAP3430: SDP: CAM: Fix Capture mem boundary

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP3430: SDP: CAM: Fix Capture mem boundary

This patch specifies the capture_mem boundary in sensor hw info
struct, cleans up the I2C buffer registration, and removes the
v4l2_ifparm, as we don't longer need it.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/board-3430sdp.c |   60 
 1 file changed, 20 insertions(+), 40 deletions(-)

Index: omapkernel/arch/arm/mach-omap2/board-3430sdp.c
===
--- omapkernel.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-10-13 
16:50:30.0 -0500
+++ omapkernel/arch/arm/mach-omap2/board-3430sdp.c  2008-10-14 
12:07:27.0 -0500
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -552,6 +553,7 @@
 static struct omap34xxcam_sensor_config cam_hwc = {
.sensor_isp = 0,
.xclk = OMAP34XXCAM_XCLK_A,
+   .capture_mem = PAGE_ALIGN(2592 * 1944 * 2) * 4,
 };

 static void enable_fpga_vio_1v8(u8 enable)
@@ -587,6 +589,7 @@

hwc->u.sensor.xclk = cam_hwc.xclk;
hwc->u.sensor.sensor_isp = cam_hwc.sensor_isp;
+   hwc->u.sensor.capture_mem = cam_hwc.capture_mem;
hwc->dev_index = 0;
hwc->dev_minor = 0;
hwc->dev_type = OMAP34XXCAM_SLAVE_SENSOR;
@@ -689,44 +692,10 @@
return 0;
 }

-static struct v4l2_ifparm ifparm = {
-   .if_type = V4L2_IF_TYPE_BT656,
-   .u = {
-   .bt656 = {
-   .frame_start_on_rising_vs = 1,
-   .latch_clk_inv = 0,
-   .mode = V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT,
-   .clock_min = MT9P012_XCLK_MIN,
-   .clock_max = MT9P012_XCLK_MAX,
-   },
-   },
-};
-
-static int mt9p012_ifparm(struct v4l2_ifparm *p)
-{
-   *p = ifparm;
-   return 0;
-}
-
 static struct mt9p012_platform_data sdp3430_mt9p012_platform_data = {
.power_set  = mt9p012_sensor_power_set,
.priv_data_set  = mt9p012_sensor_set_prv_data,
.default_regs   = NULL,
-   .ifparm = mt9p012_ifparm,
-};
-
-
-static struct i2c_board_info __initdata sdp3430_i2c2_boardinfo[] = {
-#ifdef CONFIG_VIDEO_DW9710
-   {
-   I2C_BOARD_INFO(DW9710_NAME,  DW9710_AF_I2C_ADDR),
-   .platform_data = &sdp3430_dw9710_platform_data,
-   },
-#endif
-   {
-   I2C_BOARD_INFO("mt9p012", MT9P012_I2C_ADDR),
-   .platform_data = &sdp3430_mt9p012_platform_data,
-   },
 };

 #endif
@@ -847,16 +816,27 @@
},
 };

+static struct i2c_board_info __initdata sdp3430_i2c_boardinfo_2[] = {
+#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
+   {
+   I2C_BOARD_INFO("mt9p012", MT9P012_I2C_ADDR),
+   .platform_data = &sdp3430_mt9p012_platform_data,
+   },
+#ifdef CONFIG_VIDEO_DW9710
+   {
+   I2C_BOARD_INFO(DW9710_NAME,  DW9710_AF_I2C_ADDR),
+   .platform_data = &sdp3430_dw9710_platform_data,
+   },
+#endif
+#endif
+};
+
 static int __init omap3430_i2c_init(void)
 {
omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo,
ARRAY_SIZE(sdp3430_i2c_boardinfo));
-#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
-   omap_register_i2c_bus(2, 400, sdp3430_i2c2_boardinfo,
- ARRAY_SIZE(sdp3430_i2c2_boardinfo));
-#else
-   omap_register_i2c_bus(2, 400, NULL, 0);
-#endif
+   omap_register_i2c_bus(2, 400, sdp3430_i2c_boardinfo_2,
+   ARRAY_SIZE(sdp3430_i2c_boardinfo_2));
omap_register_i2c_bus(3, 400, NULL, 0);
return 0;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/28] [OMAPZOOM] OMAP: CAM: ISP: Fix Silicon Revision check

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: ISP: Fix Silicon Revision check

This patch fixes the silicon revision checking method for the latest
method

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/isp.c|4 ++--
 drivers/media/video/isp/ispccdc.c|2 +-
 drivers/media/video/isp/ispmmu.c |4 ++--
 drivers/media/video/isp/isppreview.c |4 ++--
 drivers/media/video/isp/ispresizer.c |2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

Index: omapkernel/drivers/media/video/isp/isp.c
===
--- omapkernel.orig/drivers/media/video/isp/isp.c   2008-10-14 
10:22:33.0 -0500
+++ omapkernel/drivers/media/video/isp/isp.c2008-10-14 11:03:27.0 
-0500
@@ -696,7 +696,7 @@
omap_writel(ISPMMU_AUTOIDLE | (ISPMMU_SIDLEMODE_SMARTIDLE <<
ISPMMU_SIDLEMODE_SHIFT),
ISPMMU_SYSCONFIG);
-   if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0)) {
+   if (system_rev == OMAP3430_REV_ES1_0) {
omap_writel(ISPCSI1_AUTOIDLE |
(ISPCSI1_MIDLEMODE_SMARTSTANDBY <<
ISPCSI1_MIDLEMODE_SHIFT),
@@ -717,7 +717,7 @@
omap_writel(ISPMMU_AUTOIDLE |
(ISPMMU_SIDLEMODE_NOIDLE << ISPMMU_SIDLEMODE_SHIFT),
ISPMMU_SYSCONFIG);
-   if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0)) {
+   if (system_rev == OMAP3430_REV_ES1_0) {
omap_writel(ISPCSI1_AUTOIDLE |
(ISPCSI1_MIDLEMODE_FORCESTANDBY <<
ISPCSI1_MIDLEMODE_SHIFT),
Index: omapkernel/drivers/media/video/isp/ispccdc.c
===
--- omapkernel.orig/drivers/media/video/isp/ispccdc.c   2008-10-14 
10:22:33.0 -0500
+++ omapkernel/drivers/media/video/isp/ispccdc.c2008-10-14 
11:03:27.0 -0500
@@ -751,7 +751,7 @@
bclamp_val |= bclamp.obstpixel << ISPCCDC_CLAMP_OBST_SHIFT;
omap_writel(bclamp_val, ISPCCDC_CLAMP);
} else {
-   if (is_sil_rev_less_than(OMAP3430_REV_ES2_0))
+   if (system_rev < OMAP3430_REV_ES2_0)
if ((ispccdc_obj.syncif_ipmod == YUV16) ||
(ispccdc_obj.syncif_ipmod == YUV8) ||
((omap_readl(ISPCCDC_REC656IF) &
Index: omapkernel/drivers/media/video/isp/ispmmu.c
===
--- omapkernel.orig/drivers/media/video/isp/ispmmu.c2008-10-14 
10:22:33.0 -0500
+++ omapkernel/drivers/media/video/isp/ispmmu.c 2008-10-14 11:03:27.0 
-0500
@@ -211,7 +211,7 @@
l2_page_cache_p, l2_page_cache,
L2P_TABLES_SIZE);
 
-   if (is_sil_rev_less_than(OMAP3430_REV_ES2_0))
+   if (system_rev < OMAP3430_REV_ES2_0)
l2_mapattr_obj.endianism = B_ENDIAN;
else
l2_mapattr_obj.endianism = L_ENDIAN;
@@ -616,7 +616,7 @@
DPRINTK_ISPMMU("TTB allocated at p = 0x%x, v = 0x%x, size = 0x%x\n",
ttb_p, (u32)ttb, ttb_aligned_size);
 
-   if (is_sil_rev_less_than(OMAP3430_REV_ES2_0))
+   if (system_rev < OMAP3430_REV_ES2_0)
l1_mapattr_obj.endianism = B_ENDIAN;
else
l1_mapattr_obj.endianism = L_ENDIAN;
Index: omapkernel/drivers/media/video/isp/isppreview.c
===
--- omapkernel.orig/drivers/media/video/isp/isppreview.c2008-10-14 
10:22:33.0 -0500
+++ omapkernel/drivers/media/video/isp/isppreview.c 2008-10-14 
11:03:27.0 -0500
@@ -1441,7 +1441,7 @@
"width < 16 or height < 32 \n");
return -EINVAL;
}
-   if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0))
+   if (system_rev == OMAP3430_REV_ES1_0)
max_out = ISPPRV_MAXOUTPUT_WIDTH;
else
max_out = ISPPRV_MAXOUTPUT_WIDTH_ES2;
@@ -1808,7 +1808,7 @@
ispprev_obj.prev_inuse = 0;
mutex_init(&ispprev_obj.ispprev_mutex);
 
-   if (is_sil_rev_equal_to(OMAP3430_REV_ES2_0)) {
+   if (system_rev > OMAP3430_REV_ES1_0) {
flr_wbal_coef0 = 0x23;
flr_wbal_coef1 = 0x20;
flr_wbal_coef2 = 0x20;
Index: omapkernel/drivers/media/video/isp/ispresizer.c
===
--- omapkernel.orig/drivers/media/video/isp/ispresizer.c2008-10-14 
10:22:33.0 -0500
+++ omapkernel/drivers/media/video/isp/ispresizer

[PATCH 9/28] [OMAPZOOM] OMAP: CAM: ISP: MMU Fixes

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: ISP: MMU Fixes

This patch removes cache flush related registers from context save.

Signed-off-by: Mohit Jalori <[EMAIL PROTECTED]>
Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/ispmmu.c |2 --
 1 file changed, 2 deletions(-)

Index: omapkernel/drivers/media/video/isp/ispmmu.c
===
--- omapkernel.orig/drivers/media/video/isp/ispmmu.c2008-10-14 
10:04:34.0 -0500
+++ omapkernel/drivers/media/video/isp/ispmmu.c 2008-10-14 10:20:13.0 
-0500
@@ -65,8 +65,6 @@
{ISPMMU_LD_TLB, 0x},
{ISPMMU_CAM, 0x},
{ISPMMU_RAM, 0x},
-   {ISPMMU_GFLUSH, 0x},
-   {ISPMMU_FLUSH_ENTRY, 0x},
{ISP_TOK_TERM, 0x}
 };

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


[PATCH 8/28] [OMAPZOOM] OMAP: CAM: ISP: SCM Fixes

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: ISP: SCM Fixes

This patch Adds the following changes:
ISP AF (Auto Focus)
 - Set Statistics Buffers as Userptr type
 - Added timestamp recording at interrupt time.
 - Fixed memory leak on isp_af_configure
 - Fixed un sync buffer size in statistics configuration change
 - Removed Constants in isp_af.h for adding them on isp_user.h file

ISP H3A (Auto Exposure and Auto White Balance)
 - Add Timestamp capture on ISR time
 - Change buffer handling as a User ptr type.
 - Remove unnecessary debug prints.
 - Remove limit defines from h3a header

ISP Histogram
 - Change buffer handling as a User ptr type.

Signed-off-by: Troy Laramy <[EMAIL PROTECTED]>
Signed-off-by: Ivan Ivanov <[EMAIL PROTECTED]>
Signed-off-by: Sakari Ailus <[EMAIL PROTECTED]>
Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/isph3a.c  |  145 --
 drivers/media/video/isp/isph3a.h  |   22 -
 drivers/media/video/isp/isphist.c |   83 ++---
 3 files changed, 73 insertions(+), 177 deletions(-)

Index: omapkernel/drivers/media/video/isp/isp_af.c
===
--- omapkernel.orig/drivers/media/video/isp/isp_af.c2008-10-03 
17:48:05.0 -0500
+++ omapkernel/drivers/media/video/isp/isp_af.c 2008-10-13 19:46:26.0 
-0500
@@ -73,6 +73,7 @@
  * @frame_req: Number of frame requested for statistics.
  * @af_buff: Array of statistics buffers to access.
  * @stats_buf_size: Statistics buffer size.
+ * @curr_cfg_buf_size: Current user configured stats buff size.
  * @min_buf_size: Minimum statisitics buffer size.
  * @frame_count: Frame Count.
  * @stats_wait: Wait primitive for locking/unlocking the stats request.
@@ -88,6 +89,7 @@
struct isp_af_buffer af_buff[H3A_MAX_BUFF];
unsigned int stats_buf_size;
unsigned int min_buf_size;
+   unsigned int curr_cfg_buf_size;

u32 frame_count;
wait_queue_head_t stats_wait;
@@ -293,55 +295,6 @@
}
 }

-/*
- * Helper function to munmap kernel buffers from user space.
- */
-static int isp_af_munmap(struct isp_af_buffer *buffer)
-{
-   /* TO DO: munmap succesfully the kernel buffers, so they can be
-  remmaped again */
-   buffer->mmap_addr = 0;
-   return 0;
-}
-
-/*
- * Helper function to mmap buffers to user space.
- * buffer passed need to already have a valid physical address: 
buffer->phy_addr
- * It returns user pointer as unsigned long in buffer->mmap_addr
- */
-static int isp_af_mmap_buffers(struct isp_af_buffer *buffer)
-{
-   struct vm_area_struct vma;
-   struct mm_struct *mm = current->mm;
-   int size = afstat.stats_buf_size;
-   unsigned long addr = 0;
-   unsigned long pgoff = 0, flags = MAP_SHARED | MAP_ANONYMOUS;
-   unsigned long prot = PROT_READ | PROT_WRITE;
-   void *pos = (void *)buffer->addr_align;
-
-   size = PAGE_ALIGN(size);
-
-   addr = get_unmapped_area(NULL, addr, size, pgoff, flags);
-   vma.vm_mm = mm;
-   vma.vm_start = addr;
-   vma.vm_end = addr + size;
-   vma.vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags);
-   vma.vm_pgoff = pgoff;
-   vma.vm_file = NULL;
-   vma.vm_page_prot = vm_get_page_prot(vma.vm_flags);
-
-   while (size > 0) {
-   if (vm_insert_page(&vma, addr, vmalloc_to_page(pos)))
-   return -EAGAIN;
-   addr += PAGE_SIZE;
-   pos += PAGE_SIZE;
-   size -= PAGE_SIZE;
-   }
-
-   buffer->mmap_addr = vma.vm_start;
-   return 0;
-}
-
 /* Function to perform hardware set up */
 int isp_af_configure(struct af_configuration *afconfig)
 {
@@ -354,7 +307,8 @@
return -EINVAL;
}

-   af_dev_configptr->config = afconfig;
+   memcpy(af_dev_configptr->config, afconfig,
+   sizeof(struct af_configuration));
/* Get the value of PCR register */
busyaf = omap_readl(ISPH3A_PCR);

@@ -385,14 +339,14 @@
(af_dev_configptr->config->paxel_config.hz_cnt + 1) *
(af_dev_configptr->config->paxel_config.vt_cnt + 1) * AF_PAXEL_SIZE;

+   afstat.curr_cfg_buf_size = buff_size;
/*Deallocate the previous buffers */
if (afstat.stats_buf_size && (buff_size > afstat.stats_buf_size)) {
isp_af_enable(0);
for (i = 0; i < H3A_MAX_BUFF; i++) {
-   isp_af_munmap(&afstat.af_buff[i]);
ispmmu_unmap(afstat.af_buff[i].ispmmu_addr);
dma_free_coherent(NULL,
- afstat.min_buf_size + 64,
+ afstat.min_buf_size,
  (void *)afstat.af_buff[i].virt_addr,
  (dma_addr_t)afstat.af_buff[i].phy_addr);
afstat.af_buff[i].virt_addr = 0;

[PATCH 7/28] [OMAPZOOM] OMAP: CAM: ISP: Backend Fixes

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: ISP: Backend Fixes

This patch Adds the following changes:
ISP Preview
 - Remove table address and data from register context save/restore.
 - Added PCR register to context save/restore.
 - Added lower boundary checking for image size in try_size function.

ISP Resizer
 - Fixed default coefficients to be on sync with CDP
 - Added lower boundary check for resizer input size.

Signed-off-by: Vaibhav Hiremat <[EMAIL PROTECTED]>
Signed-off-by: Troy Laramy <[EMAIL PROTECTED]>
Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/isppreview.c |8 -
 drivers/media/video/isp/isppreview.h |4 +-
 drivers/media/video/isp/ispresizer.c |   48 +++
 3 files changed, 35 insertions(+), 25 deletions(-)

Index: omapkernel/drivers/media/video/isp/isppreview.c
===
--- omapkernel.orig/drivers/media/video/isp/isppreview.c2008-10-14 
10:04:34.0 -0500
+++ omapkernel/drivers/media/video/isp/isppreview.c 2008-10-14 
10:12:29.0 -0500
@@ -65,12 +65,11 @@
{ISPPRV_CNT_BRT, 0x},
{ISPPRV_CSUP, 0x},
{ISPPRV_SETUP_YC, 0x},
-   {ISPPRV_SET_TBL_ADDR, 0x},
-   {ISPPRV_SET_TBL_DATA, 0x},
{ISPPRV_CDC_THR0, 0x},
{ISPPRV_CDC_THR1, 0x},
{ISPPRV_CDC_THR2, 0x},
{ISPPRV_CDC_THR3, 0x},
+   {ISPPRV_PCR, 0x},
{ISP_TOK_TERM, 0x}
 };

@@ -1437,6 +1436,11 @@
ispprev_obj.previn_w = input_w;
ispprev_obj.previn_h = input_h;

+   if (input_w < 32 || input_h < 32) {
+   printk(KERN_ERR "ISP_ERR : preview does not support "
+   "width < 16 or height < 32 \n");
+   return -EINVAL;
+   }
if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0))
max_out = ISPPRV_MAXOUTPUT_WIDTH;
else
Index: omapkernel/drivers/media/video/isp/isppreview.h
===
--- omapkernel.orig/drivers/media/video/isp/isppreview.h2008-10-14 
10:04:34.0 -0500
+++ omapkernel/drivers/media/video/isp/isppreview.h 2008-10-14 
10:12:29.0 -0500
@@ -91,8 +91,8 @@

 enum preview_color_effect {
PREV_DEFAULT_COLOR = 0,
-   PREV_BW_COLOR = 1,
-   PREV_SEPIA_COLOR = 2
+   PREV_SEPIA_COLOR = 1,
+   PREV_BW_COLOR = 2
 };


Index: omapkernel/drivers/media/video/isp/ispresizer.c
===
--- omapkernel.orig/drivers/media/video/isp/ispresizer.c2008-10-14 
10:04:34.0 -0500
+++ omapkernel/drivers/media/video/isp/ispresizer.c 2008-10-14 
10:12:29.0 -0500
@@ -33,14 +33,14 @@
 static struct isprsz_yenh ispreszdefaultyenh = {0, 0, 0, 0};
 static struct isprsz_coef ispreszdefcoef = {
{
-   0x, 0x0100, 0x, 0x,
-   0x03FA, 0x00F6, 0x0010, 0x,
-   0x03F9, 0x00DB, 0x002C, 0x,
-   0x03FB, 0x00B3, 0x0053, 0x03FF,
-   0x03FD, 0x0082, 0x0084, 0x03FD,
-   0x03FF, 0x0053, 0x00B3, 0x03FB,
-   0x, 0x002C, 0x00DB, 0x03F9,
-   0x, 0x0010, 0x00F6, 0x03FA
+   0x0027, 0x00B2, 0x00B2, 0x0027,
+   0x0027, 0x00B2, 0x0027, 0x00B2,
+   0x0027, 0x00B2, 0x0027, 0x00B2,
+   0x0027, 0x00B2, 0x0027, 0x00B2,
+   0x0027, 0x00B2, 0x0027, 0x00B2,
+   0x0027, 0x00B2, 0x0027, 0x00B2,
+   0x0027, 0x00B2, 0x0027, 0x00B2,
+   0x0027, 0x00B2, 0x0027, 0x00B2,
},
{
0x, 0x0100, 0x, 0x,
@@ -53,13 +53,13 @@
0x, 0x0010, 0x00F6, 0x03FA
},
{
-   0x0004, 0x0023, 0x005A, 0x0058,
-   0x0023, 0x0004, 0x, 0x0002,
-   0x0018, 0x004d, 0x0060, 0x0031,
-   0x0008, 0x, 0x0001, 0x000f,
-   0x003f, 0x0062, 0x003f, 0x000f,
-   0x0001, 0x, 0x0008, 0x0031,
-   0x0060, 0x004d, 0x0018, 0x0002
+   0x0004, 0x0023, 0x0023, 0x005A,
+   0x005A, 0x0058, 0x0058, 0x0004,
+   0x0023, 0x0023, 0x005A, 0x005A,
+   0x0058, 0x0058, 0x0004, 0x0023,
+   0x0023, 0x005A, 0x005A, 0x0058,
+   0x0058, 0x0004, 0x0023, 0x0023,
+   0x005A, 0x005A, 0x0058, 0x0058
},
{
0x0004, 0x0023, 0x005A, 0x0058,
@@ -335,6 +335,12 @@
input_w = *input_width;
input_h = *input_height;

+   if (input_w < 32 || input_h < 32) {
+   DPRINTK_ISPCCDC("ISP_ERR: RESIZER cannot handle input width"
+   " less than 32 pixels or height less than"
+   " 32\n");
+   return -EINVAL;
+   }
input_w -= 6;

[PATCH 5/28] [OMAPZOOM] OMAP: CAM: ISP: Core Fixes

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: ISP: Core Fixes

This patch Adds the following changes:
 - Removes useless headers
 - Add DMA cache flush for fixing green line problem on streaming
 - Aligns color effects handling with CDP release
 - Removes IRQ registers saving/restore on context save/restore
 - Removes isp_open and isp_close, and adds isp_release_resources
   instead.
 - Fixes V4L2 control handling operation, now responds properly when
   calling vidioc_g_ctrl IOCTL with V4L2_CTRL_FLAG_NEXT_CTRL flag.
 - Simplify isp_stop code.
 - Boundary checking fixes.
 - Removes IOCTL declares from isp header.
 - Add resizer output boundaries.
 - Corrected ISPCCDC_BLKCMP_GR_CY_SHIFT value.

Signed-off-by: Mohit Jalori <[EMAIL PROTECTED]>
Signed-off-by: Dominic Curran <[EMAIL PROTECTED]>
Signed-off-by: Vaibhav Hiremat <[EMAIL PROTECTED]>
Signed-off-by: Sakari Ailus <[EMAIL PROTECTED]>
Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/isp/isp.c|  245 ---
 drivers/media/video/isp/isp.h|   22 ---
 drivers/media/video/isp/ispreg.h |4
 3 files changed, 161 insertions(+), 110 deletions(-)

Index: omapkernel/drivers/media/video/isp/isp.c
===
--- omapkernel.orig/drivers/media/video/isp/isp.c   2008-10-14 
12:12:13.0 -0500
+++ omapkernel/drivers/media/video/isp/isp.c2008-10-14 12:16:12.0 
-0500
@@ -30,12 +30,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 

@@ -108,7 +107,7 @@
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Color Effects",
.minimum = PREV_DEFAULT_COLOR,
-   .maximum = PREV_SEPIA_COLOR,
+   .maximum = PREV_BW_COLOR,
.step = 1,
.default_value = PREV_DEFAULT_COLOR,
},
@@ -219,8 +218,6 @@
 /* Structure for saving/restoring ISP module registers */
 static struct isp_reg isp_reg_list[] = {
{ISP_SYSCONFIG, 0},
-   {ISP_IRQ0ENABLE, 0},
-   {ISP_IRQ1ENABLE, 0},
{ISP_TCTRL_GRESET_LENGTH, 0},
{ISP_TCTRL_PSTRB_REPLAY, 0},
{ISP_CTRL, 0},
@@ -277,26 +274,39 @@
return i;
 }

-/**
- * isp_open - Reserve ISP submodules for operation
- **/
-void isp_open(void)
+static int find_next_vctrl(int id)
 {
-   ispccdc_request();
-   isppreview_request();
-   ispresizer_request();
-   return;
+   int i;
+   u32 best = (u32)-1;
+
+   for (i = 0; i < ARRAY_SIZE(video_control); i++) {
+   if (video_control[i].qc.id > id
+   && (best == (u32)-1
+   || video_control[i].qc.id
+   < video_control[best].qc.id)) {
+   best = i;
+   }
+   }
+
+   if (best == (u32)-1)
+   return -EINVAL;
+
+   return best;
 }
-EXPORT_SYMBOL(isp_set_pipeline);

 /**
- * isp_close - Free ISP submodules
+ * isp_release_resources - Free ISP submodules
  **/
-void isp_close(void)
+void isp_release_resources(void)
 {
-   ispccdc_free();
-   isppreview_free();
-   ispresizer_free();
+   if (ispmodule_obj.isp_pipeline & OMAP_ISP_CCDC)
+   ispccdc_free();
+
+   if (ispmodule_obj.isp_pipeline & OMAP_ISP_PREVIEW)
+   isppreview_free();
+
+   if (ispmodule_obj.isp_pipeline & OMAP_ISP_RESIZER)
+   ispresizer_free();
return;
 }
 EXPORT_SYMBOL(omapisp_unset_callback);
@@ -1075,7 +1085,7 @@

return;
 }
-EXPORT_SYMBOL(isp_open);
+EXPORT_SYMBOL(isp_set_pipeline);

 /**
  * omapisp_unset_callback - Unsets all the callbacks associated with ISP module
@@ -1099,7 +1109,6 @@
}
omap_writel(omap_readl(ISP_IRQ0STATUS) | ISP_INT_CLR, ISP_IRQ0STATUS);
 }
-EXPORT_SYMBOL(isp_close);

 /**
  * isp_start - Starts ISP submodule
@@ -1122,53 +1131,29 @@
  **/
 void isp_stop()
 {
-   int timeout;
+   int timeout = 0;

spin_lock(&isp_obj.isp_temp_buf_lock);
ispmodule_obj.isp_temp_state = ISP_FREE_RUNNING;
spin_unlock(&isp_obj.isp_temp_buf_lock);
-   omapisp_unset_callback();
-
-   if ((ispmodule_obj.isp_pipeline & OMAP_ISP_RESIZER) &&
-   is_ispresizer_enabled()) {
-   ispresizer_enable(0);
-   timeout = 0;
-   while (ispresizer_busy() && (timeout < 20)) {
-   timeout++;
-   mdelay(10);
-   }
-   }
-
-   if ((ispmodule_obj.isp_pipeline & OMAP_ISP_PREVIEW) &&
-   is_isppreview_enabled()) {
-   isppreview_enable(0);
-   timeout = 0;
-   while (isppreview_busy() && (timeout < 20)) {
-   timeout++;
-

[PATCH 4/28] [OMAPZOOM] OMAP: CAM: ISP: USER: Misc fixes

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: ISP: USER: Misc fixes

This patch includes fixes for the following:
 - Added IOCTL defines from isp.h file
 - Added ISP H3A limit defines
 - Added ISP AF limit and paxel size defines
 - Remove dependency from types.h header by switching to __u* types
   

Signed-off-by: Sakari Ailus <[EMAIL PROTECTED]>
Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 arch/arm/plat-omap/include/mach/isp_user.h |  271 +
 1 file changed, 161 insertions(+), 110 deletions(-)

Index: omapkernel/arch/arm/plat-omap/include/mach/isp_user.h
===
--- omapkernel.orig/arch/arm/plat-omap/include/mach/isp_user.h  2008-10-15 
19:25:00.0 -0500
+++ omapkernel/arch/arm/plat-omap/include/mach/isp_user.h   2008-10-15 
19:36:01.0 -0500
@@ -20,6 +20,24 @@
 #ifndef OMAP_ISP_USER_H
 #define OMAP_ISP_USER_H
 
+/* ISP Private IOCTLs */
+#define VIDIOC_PRIVATE_ISP_CCDC_CFG\
+   _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct ispccdc_update_config)
+#define VIDIOC_PRIVATE_ISP_PRV_CFG \
+   _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct ispprv_update_config)
+#define VIDIOC_PRIVATE_ISP_AEWB_CFG \
+   _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct isph3a_aewb_config)
+#define VIDIOC_PRIVATE_ISP_AEWB_REQ \
+   _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct isph3a_aewb_data)
+#define VIDIOC_PRIVATE_ISP_HIST_CFG \
+   _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct isp_hist_config)
+#define VIDIOC_PRIVATE_ISP_HIST_REQ \
+   _IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct isp_hist_data)
+#define VIDIOC_PRIVATE_ISP_AF_CFG \
+   _IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct af_configuration)
+#define VIDIOC_PRIVATE_ISP_AF_REQ \
+   _IOWR('V', BASE_VIDIOC_PRIVATE + 9, struct isp_af_data)
+
 /* AE/AWB related structures and flags*/
 
 /* Flags for update field */
@@ -32,6 +50,39 @@
 #define MAX_FRAME_COUNT0x0FFF
 #define MAX_FUTURE_FRAMES  10
 
+#define MAX_SATURATION_LIM 1023
+#define MIN_WIN_H  2
+#define MAX_WIN_H  256
+#define MIN_WIN_W  6
+#define MAX_WIN_W  256
+#define MAX_WINVC  128
+#define MAX_WINHC  36
+#define MAX_WINSTART   4095
+#define MIN_SUB_INC2
+#define MAX_SUB_INC32
+
+/* Range Constants */
+#define AF_IIRSH_MIN   0
+#define AF_IIRSH_MAX   4094
+#define AF_PAXEL_HORIZONTAL_COUNT_MIN  0
+#define AF_PAXEL_HORIZONTAL_COUNT_MAX  35
+#define AF_PAXEL_VERTICAL_COUNT_MIN0
+#define AF_PAXEL_VERTICAL_COUNT_MAX127
+#define AF_PAXEL_INCREMENT_MIN 0
+#define AF_PAXEL_INCREMENT_MAX 14
+#define AF_PAXEL_HEIGHT_MIN0
+#define AF_PAXEL_HEIGHT_MAX127
+#define AF_PAXEL_WIDTH_MIN 0
+#define AF_PAXEL_WIDTH_MAX 127
+#define AF_PAXEL_HZSTART_MIN   2
+#define AF_PAXEL_HZSTART_MAX   4094
+
+#define AF_PAXEL_VTSTART_MIN   0
+#define AF_PAXEL_VTSTART_MAX   4095
+#define AF_THRESHOLD_MAX   255
+#define AF_COEF_MAX4095
+#define AF_PAXEL_SIZE  48
+
 /**
  * struct isph3a_aewb_config - AE AWB configuration reset values.
  * saturation_limit: Saturation limit.
@@ -51,19 +102,19 @@
  * @aewb_enable: AE AWB stats generation EN flag.
  */
 struct isph3a_aewb_config {
-   u16 saturation_limit;
-   u16 win_height;
-   u16 win_width;
-   u16 ver_win_count;
-   u16 hor_win_count;
-   u16 ver_win_start;
-   u16 hor_win_start;
-   u16 blk_ver_win_start;
-   u16 blk_win_height;
-   u16 subsample_ver_inc;
-   u16 subsample_hor_inc;
-   u8 alaw_enable;
-   u8 aewb_enable;
+   __u16 saturation_limit;
+   __u16 win_height;
+   __u16 win_width;
+   __u16 ver_win_count;
+   __u16 hor_win_count;
+   __u16 ver_win_start;
+   __u16 hor_win_start;
+   __u16 blk_ver_win_start;
+   __u16 blk_win_height;
+   __u16 subsample_ver_inc;
+   __u16 subsample_hor_inc;
+   __u8 alaw_enable;
+   __u8 aewb_enable;
 };
 
 /**
@@ -86,18 +137,18 @@
  */
 struct isph3a_aewb_data {
void *h3a_aewb_statistics_buf;
-   u32 shutter;
-   u16 gain;
-   u32 shutter_cap;
-   u16 gain_cap;
-   u16 dgain;
-   u16 wb_gain_b;
-   u16 wb_gain_r;
-   u16 wb_gain_gb;
-   u16 wb_gain_gr;
-   u16 frame_number;
-   u16 curr_frame;
-   u8 update;
+   __u32 shutter;
+   __u16 gain;
+   __u32 shutter_cap;
+   __u16 gain_cap;
+   __u16 dgain;
+   __u16 wb_gain_b;
+   __u16 wb_gain_r;
+   __u16 wb_gain_gb;
+   __u16 wb_gain_gr;
+   __u16 frame_number;
+   __u16 curr_frame;
+   __u8 update;
struct timeval ts;
unsigned long field_count;
 };
@@ -111,34 +162,34 @@
 #define BINS_256   0x3
 
 struct isp_hist_config {
-   u8 

[PATCH 3/28] [OMAPZOOM] OMAP: CAM: Misc Camera driver fixes

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP: CAM: Misc Camera driver fixes

This patch includes fixes for the following:
 - Removal of unneeded headers
 - Changed order of steps to execute on vbq release on active
   streaming.
 - Fixed IOCTL Name for AF Request Statistics in vidioc_default
 - Removed isp_open and isp_close calls from driver open/close
 - Removed Timestamp capture for AEWB stats from update_vbq
 - Added field_count reporting to AF driver for stats mapping.
 - Added _notify calls for communication from Camera driver to SCM
 - Removed RESUME powerstate handling, as it wasn't aprooved in v4l
 - Removed g_priv_mem handling, as it wasn't aprooved in v4l

Signed-off-by: Sakari Ailus <[EMAIL PROTECTED]>
Signed-off-by: Mohit Jalori <[EMAIL PROTECTED]>
Signed-off-by: Troy Laramy <[EMAIL PROTECTED]>
Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 drivers/media/video/omap34xxcam.c |   32 +---
 1 file changed, 13 insertions(+), 19 deletions(-)

Index: omapkernel/drivers/media/video/omap34xxcam.c
===
--- omapkernel.orig/drivers/media/video/omap34xxcam.c   2008-10-14 
18:52:48.0 -0500
+++ omapkernel/drivers/media/video/omap34xxcam.c2008-10-14 
18:57:05.0 -0500
@@ -35,10 +35,6 @@
 #include 

 #include "omap34xxcam.h"
-#include "isp/isp.h"
-#include "isp/ispmmu.h"
-#include "isp/ispreg.h"
-#include "isp/ispccdc.h"
 #include "isp/isph3a.h"
 #include "isp/isp_af.h"

@@ -111,20 +107,22 @@
 {
struct omap34xxcam_fh *fh = camfh_saved;
struct omap34xxcam_videodev *vdev = fh->vdev;
-   struct isph3a_aewb_xtrastats xtrastats;
int rval = 0;
+   struct isph3a_aewb_xtrastats xtrastats;
+   struct isp_af_xtrastats af_xtrastats;

do_gettimeofday(&vb->ts);
vb->field_count = atomic_add_return(2, &fh->field_count);
vb->state = VIDEOBUF_DONE;

-   xtrastats.ts = vb->ts;
xtrastats.field_count = vb->field_count;
+   af_xtrastats.field_count = vb->field_count;

if (vdev->streaming)
rval = 1;

wake_up(&vb->done);
+   isp_af_setxtrastats(&af_xtrastats, AF_UPDATEXS_FIELDCOUNT);
isph3a_aewb_setxtrastats(&xtrastats);

return rval;
@@ -170,9 +168,9 @@
struct videobuf_buffer *vb)
 {
if (!vbq->streaming) {
-   isp_vbq_release(vbq, vb);
videobuf_dma_unmap(vbq, videobuf_to_dma(vb));
videobuf_dma_free(videobuf_to_dma(vb));
+   isp_vbq_release(vbq, vb);
vb->state = VIDEOBUF_NEEDS_INIT;
}
return;
@@ -694,6 +692,8 @@
}

cam->dma_notify = 1;
+   isph3a_notify(0);
+   isp_af_notify(0);
isp_sgdma_init();
rval = videobuf_streamon(&ofh->vbq);
if (rval) {
@@ -702,7 +702,7 @@
}


-   rval = omap34xxcam_slave_power_set(vdev, V4L2_POWER_RESUME);
+   rval = omap34xxcam_slave_power_set(vdev, V4L2_POWER_ON);
if (!rval)
vdev->streaming = file;
else
@@ -733,7 +733,8 @@
int rval;

mutex_lock(&vdev->mutex);
-
+   isph3a_notify(1);
+   isp_af_notify(1);
if (vdev->streaming == file)
isp_stop();

@@ -1163,7 +1164,7 @@
}
}
break;
-   case VIDIOC_PRIVATE_ISP_AF_CFG: {
+   case VIDIOC_PRIVATE_ISP_AF_REQ: {
/* Need to update lens first */
struct isp_af_data *data;
struct v4l2_control vc;
@@ -1193,10 +1194,6 @@
}
}
break;
-   case VIDIOC_G_PRIV_MEM:
-   rval = vidioc_int_g_priv_mem(vdev->vdev_sensor,
-   (struct v4l2_priv_mem *)arg);
-   goto out;
}

rval = isp_handle_private(cmd, arg);
@@ -1316,7 +1313,6 @@

if (atomic_inc_return(&vdev->users) == 1) {
isp_get();
-   isp_open();
if (omap34xxcam_slave_power_set(vdev, V4L2_POWER_ON))
goto out_slave_power_set_standby;
if (omap34xxcam_slave_power_set(vdev, V4L2_POWER_STANDBY))
@@ -1348,7 +1344,6 @@

 out_slave_power_set_standby:
omap34xxcam_slave_power_set(vdev, V4L2_POWER_OFF);
-   isp_close();
isp_put();
atomic_dec(&vdev->users);
mutex_unlock(&vdev->mutex);
@@ -1384,6 +1379,8 @@

mutex_lock(&vdev->mutex);
if (vdev->streaming == file) {
+   isph3a_notify(1);
+   isp_af_notify(1);
isp_stop();
videobuf_streamoff(&fh->vbq);
omap34xxcam_slave_power_set(vdev, V4L2_POWER_STANDBY);
@@ -1392,7 +1389,6 @@

if (atomic_dec_return(&vdev->users) == 0) {
  

[PATCH 2/28] [OMAPZOOM] V4L: Remove RESUME powerstate and g_priv_mem ioctl

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

V4L: Remove RESUME powerstate and g_priv_mem ioctl

This removes the RESUME powerstate as it isn't really a state, its
really a transition between powerstates.

Also removes the g_priv_mem as it wasn't aprooved as a V4L change
in video4linux mailing list, and we aren't using it anyway.

Signed-off-by: Sakari Ailus <[EMAIL PROTECTED]>
Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 include/media/v4l2-int-device.h |4 
 1 file changed, 4 deletions(-)

Index: omapkernel/include/media/v4l2-int-device.h
===
--- omapkernel.orig/include/media/v4l2-int-device.h 2008-10-14 
18:48:27.0 -0500
+++ omapkernel/include/media/v4l2-int-device.h  2008-10-14 18:52:36.0 
-0500
@@ -102,7 +102,6 @@
V4L2_POWER_OFF = 0,
V4L2_POWER_ON,
V4L2_POWER_STANDBY,
-   V4L2_POWER_RESUME,
 };
 
 /* Slave interface type. */
@@ -219,8 +218,6 @@
vidioc_int_init_num,
/* VIDIOC_INT_G_CHIP_IDENT */
vidioc_int_g_chip_ident_num,
-   /* VIDIOC_INT_G_PRIV_MEM */
-   vidioc_int_g_priv_mem_num,
 
/*
 *
@@ -300,6 +297,5 @@
 V4L2_INT_WRAPPER_0(reset);
 V4L2_INT_WRAPPER_0(init);
 V4L2_INT_WRAPPER_1(g_chip_ident, int, *);
-V4L2_INT_WRAPPER_1(g_priv_mem, struct v4l2_priv_mem, *);
 
 #endif
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/28] [OMAPZOOM] OMAP3PM: Change CSI2 clock name

2008-10-15 Thread Aguirre Rodriguez, Sergio Alberto
From: Sergio Aguirre <[EMAIL PROTECTED]>

OMAP3PM: Change CSI2 clock name

This patch sets the name of the clock to csi2_96m_fck, to be in sync
with the name of the same clock in Paul Walmsley's clock framework.

Signed-off-by: Sergio Aguirre <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/clock_34xx.h |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: omapkernel/arch/arm/mach-omap2/clock_34xx.h
===
--- omapkernel.orig/arch/arm/mach-omap2/clock_34xx.h2008-10-14 
18:48:29.0 -0500
+++ omapkernel/arch/arm/mach-omap2/clock_34xx.h 2008-10-14 18:52:32.0 
-0500
@@ -937,8 +937,8 @@
.recalc = &omap3_clk_recalc,
 };
 
-static struct clk csi2_fck = {
-   .name = "csi2_fck",
+static struct clk csi2_96m_fck = {
+   .name = "csi2_96m_fck",
.prcmid = PRCM_CSI2,
.parent = &func_96m_ck,
.flags = CLOCK_IN_OMAP343X | F_CLK | POWER_ON_REQUIRED,
@@ -1490,7 +1490,7 @@
&dss_ick,
&cam_mclk,
&cam_ick,
-   &csi2_fck,
+   &csi2_96m_fck,
&gpt1_fck,
&gpt1_ick,
&sync_32k_fck,
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/3] clk: introduce omap_clk_associate

2008-10-15 Thread Woodruff, Richard

> From: Högander Jouni [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 15, 2008 8:04 AM

> L3 and L4 are anyway on when not in wfi, because of sleep/wkdep, so no
> power save. This is the case at least with OMAP3 not sure about OMAP2.

Probably some savings inside of individual domains when they are in idle like 
camera.  Defiantly internal autogating in CortexA8 saves power if MPU domain is 
in idle.  ... Recall if DSP is up and running L3/L4 might be up, but MPU could 
be in WFI with its domain gated off (also in INACTIVE/RET/OFF).

A 1st order power waster is fan out from L3/L4 as you say.

Future OMAPs add more domains to reduce fan out effect even if L3/L4 is on.

> In many modules there is also possibility to gate ick by HW when not
> in wfi (see AUTOIDLE in SYCONFIG). I'm not sure about this but
> extremely also fcks could be taken care by HW (see CLOCKACTIVITY in
> SYSCONFIG).

Module AUTOIDLE can save power by selective gating inside the module.  An easy 
experiment is to measure power while stopped in the debugger and enable/disable 
individual auto idles.  You'll be surprised how much you get back on something 
like security accelerators (all I-clock, so gating inside of modules helps, 
even if l3/l4 is up).

Clock activity in some modules does do extra gating at segment idle time.

Regards,
Richard W.



RE: [PATCH 1/3] [RFC] clk: introduce clk_associate

2008-10-15 Thread Woodruff, Richard
Hi,

> From: [EMAIL PROTECTED] [mailto:linux-omap-
> [EMAIL PROTECTED] On Behalf Of Paul Walmsley

> between omap_clk_associate() and vclk, my preference is for the
> omap_clk_associate() approach.
>
> The core problem is that the vclk patches create clocks with multiple
> parents in a way that is hidden from the clock framework.  This causes
> both semantic and practical problems.
>
> Semantically, the patches cause the meaning of set_rate() and set_parent()
> to be confused, and any driver that wants to call set_parent() or
> set_rate() on those clocks will need to have their own custom functions
> for those operations.  I'd like to keep the amount of that custom code
> minimized.

I agree and these mirror my comments when it was first proposed.

Having a virtual node does however have some benefits which may be worth 
exploiting for future.

For these types of nodes it might be they just return an error if someone tries 
to use them.  Or have some way to get its attributes.

When you do allow a set rate on a virtual clock it will have to be custom.  
There may be a number of valid internal combinations.  Providing a 
"clock-cluster" OPP table is probably enough.

Regards,
Richard W.

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


Re: git pull request for minimal omap3 support one more time

2008-10-15 Thread Tony Lindgren
Hi,

* Jarkko Nikula <[EMAIL PROTECTED]> [081014 23:03]:
> On Tue, 14 Oct 2008 10:19:08 -0700
> "ext Tony Lindgren" <[EMAIL PROTECTED]> wrote:
> 
> > > Please take a look and resolve ASAP.  Thanks.
> > 
> > Sorry for the delay, I was sitting in an airplane again.
> > 
> > Here's the fix, looks like the missing McBSP irqs should have been
> > merged into the recent McBSP patches.
> > 
> > This patch is also in your patch system as 5301/1.
> > 
> Tony,
> 
> If my patch below from linux-omap was forgotten from original pull
> request, please note that it's required to add those rx/tx irqs into
> omap_mcbsp_platform_data structs in arch/arm/mach-omap2/mcbsp.c as
> well. Otherwise arch/arm/plat-omap/mcbsp.c: omap_mcbsp_request will
> fail when requesting zero defined irqs.
> 
> Sorry, not noting this before.
> 
> 
> Jarkko
> 
> commit c29cfcead32c8dcb9738a085d498aebe6ab160af
> Author: Jarkko Nikula <[EMAIL PROTECTED]>
> Date:   Tue Sep 16 15:56:53 2008 +0300
> 
> ARM: OMAP: Add RX/TX interrupts for 2430 and 34xx McBSP ports 3-5
> 
> Without RX and TX interrupt definitions, the omap_mcbsp_request will
> fail on OMAP2430 and OMAP34xx for ports 3-5 since default io_type is
> OMAP_MCBSP_IRQ_IO.

It's there, in Russell's omap-all branch. I just merged your fix
into your other patch:

commit 05228c35c67995c745ae3c768eaf90740c643fa9
Author: Jarkko Nikula <[EMAIL PROTECTED]>
Date:   Wed Oct 8 10:01:40 2008 +0300

ARM: OMAP: Add support for OMAP2430 in McBSP

Regards,

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


[PATCH 0/3] debugfs entries for PM counters

2008-10-15 Thread Peter 'p2' De Schrijver
This patchset adds 2 debugfs entries for power management counters.
pm_debug/count indicates how many times each powerdomain entered each state
(On, Inactive, Retention, Off).
pm_debug/time indicates how much time each powerdomain spent per state.

Peter 'p2' De Schrijver (3):
  Add closures to clkdm_for_each and pwrdm_for_each.
  Add pm-debug counters
  Hook into powerdomain code

 arch/arm/mach-omap2/clockdomain.c |5 +-
 arch/arm/mach-omap2/pm-debug.c|  175 +
 arch/arm/mach-omap2/pm.h  |2 +
 arch/arm/mach-omap2/pm34xx.c  |8 +-
 arch/arm/mach-omap2/powerdomain.c |   17 ++-
 arch/arm/plat-omap/include/mach/clockdomain.h |3 +-
 arch/arm/plat-omap/include/mach/powerdomain.h |8 +-
 7 files changed, 204 insertions(+), 14 deletions(-)

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


[PATCH 3/3] Hook into powerdomain code

2008-10-15 Thread Peter 'p2' De Schrijver
Make the powerdomain code call the new hook for updating the time.
Also implement the updated pwrdm_for_each.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/powerdomain.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 3a9e151..0334609 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -35,6 +35,8 @@
 #include 
 #include 
 
+#include "pm.h"
+
 enum {
PWRDM_STATE_NOW = 0,
PWRDM_STATE_PREV,
@@ -134,19 +136,21 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, 
int flag)
if (state != prev)
pwrdm->state_counter[state]++;
 
+   pm_dbg_update_time(pwrdm, prev);
+
pwrdm->state = state;
 
return 0;
 }
 
-static int _pwrdm_pre_transition_cb(struct powerdomain *pwrdm)
+static int _pwrdm_pre_transition_cb(struct powerdomain *pwrdm, void *unused)
 {
pwrdm_clear_all_prev_pwrst(pwrdm);
_pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW);
return 0;
 }
 
-static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm)
+static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)
 {
_pwrdm_state_switch(pwrdm, PWRDM_STATE_PREV);
return 0;
@@ -282,7 +286,8 @@ struct powerdomain *pwrdm_lookup(const char *name)
  * anything else to indicate failure; or -EINVAL if the function
  * pointer is null.
  */
-int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm))
+int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user),
+   void *user)
 {
struct powerdomain *temp_pwrdm;
unsigned long flags;
@@ -293,7 +298,7 @@ int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm))
 
read_lock_irqsave(&pwrdm_rwlock, flags);
list_for_each_entry(temp_pwrdm, &pwrdm_list, node) {
-   ret = (*fn)(temp_pwrdm);
+   ret = (*fn)(temp_pwrdm, user);
if (ret)
break;
}
@@ -1198,13 +1203,13 @@ int pwrdm_clk_state_switch(struct clk *clk)
 
 int pwrdm_pre_transition(void)
 {
-   pwrdm_for_each(_pwrdm_pre_transition_cb);
+   pwrdm_for_each(_pwrdm_pre_transition_cb, NULL);
return 0;
 }
 
 int pwrdm_post_transition(void)
 {
-   pwrdm_for_each(_pwrdm_post_transition_cb);
+   pwrdm_for_each(_pwrdm_post_transition_cb, NULL);
return 0;
 }
 
-- 
1.5.6.3

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


[PATCH 2/3] Add pm-debug counters

2008-10-15 Thread Peter 'p2' De Schrijver
This patch provides the debugfs entries and a function which will be called
by the PM code to register the time spent per domain per state. Also some
new fields are added to the powerdomain struct to keep the time information.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/pm-debug.c|  175 +
 arch/arm/mach-omap2/pm.h  |2 +
 arch/arm/plat-omap/include/mach/powerdomain.h |5 +
 3 files changed, 182 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 0b5c044..4ba6cec 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -29,6 +29,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 #include "prm.h"
 #include "cm.h"
@@ -288,4 +290,177 @@ void omap2_pm_dump(int mode, int resume, unsigned int us)
printk("%-20s: 0x%08x\n", regs[i].name, regs[i].val);
 }
 
+#ifdef CONFIG_DEBUG_FS
+#include 
+#include 
+
+struct dentry *pm_dbg_dir;
+
+static int pm_dbg_init_done;
+
+enum {
+   DEBUG_FILE_COUNTERS = 0,
+   DEBUG_FILE_TIMERS,
+};
+
+static const char pwrdm_state_names[][4] = {
+   "OFF",
+   "RET",
+   "INA",
+   "ON"
+};
+
+void pm_dbg_update_time(struct powerdomain *pwrdm, int prev)
+{
+   s64 t;
+   struct timespec now;
+
+   if (!pm_dbg_init_done)
+   return ;
+
+   /* Update timer for previous state */
+   getnstimeofday(&now);
+   t = timespec_to_ns(&now);
+
+   pwrdm->state_timer[prev] += t - pwrdm->timer;
+
+   pwrdm->timer = t;
+}
+
+static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user)
+{
+   struct seq_file *s = (struct seq_file *)user;
+
+   if (strcmp(clkdm->name, "emu_clkdm") == 0 ||
+   strcmp(clkdm->name, "wkup_clkdm") == 0)
+   return 0;
+
+   seq_printf(s, "%s->%s (%d)", clkdm->name,
+   clkdm->pwrdm.ptr->name,
+   atomic_read(&clkdm->usecount));
+   seq_printf(s, "\n");
+
+   return 0;
+}
+
+static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user)
+{
+   struct seq_file *s = (struct seq_file *)user;
+   int i;
+
+   if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
+   strcmp(pwrdm->name, "wkup_pwrdm") == 0)
+   return 0;
+
+   if (pwrdm->state != pwrdm_read_pwrst(pwrdm))
+   printk(KERN_ERR "pwrdm state mismatch(%s) %d != %d\n",
+   pwrdm->name, pwrdm->state, pwrdm_read_pwrst(pwrdm));
+
+   seq_printf(s, "%s (%s)", pwrdm->name,
+   pwrdm_state_names[pwrdm->state]);
+   for (i = 0; i < 4; i++)
+   seq_printf(s, ",%s:%d", pwrdm_state_names[i],
+   pwrdm->state_counter[i]);
+
+   seq_printf(s, "\n");
+
+   return 0;
+}
+
+static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, void *user)
+{
+   struct seq_file *s = (struct seq_file *)user;
+   int i;
+
+   if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
+   strcmp(pwrdm->name, "wkup_pwrdm") == 0)
+   return 0;
+
+   pwrdm_state_switch(pwrdm);
+
+   seq_printf(s, "%s (%s)", pwrdm->name,
+   pwrdm_state_names[pwrdm->state]);
+
+   for (i = 0; i < 4; i++)
+   seq_printf(s, ",%s:%lld", pwrdm_state_names[i],
+   pwrdm->state_timer[i]);
+
+   seq_printf(s, "\n");
+
+   return 0;
+}
+
+static void pm_dbg_show_counters(struct seq_file *s, void *unused)
+{
+   pwrdm_for_each(pwrdm_dbg_show_counter, s);
+   clkdm_for_each(clkdm_dbg_show_counter, s);
+}
+
+static void pm_dbg_show_timers(struct seq_file *s, void *unused)
+{
+   pwrdm_for_each(pwrdm_dbg_show_timer, s);
+}
+
+static int pm_dbg_open(struct inode *inode, struct file *file)
+{
+   switch ((int)inode->i_private) {
+   case DEBUG_FILE_COUNTERS:
+   return single_open(file, pm_dbg_show_counters,
+   &inode->i_private);
+   case DEBUG_FILE_TIMERS:
+   default:
+   return single_open(file, pm_dbg_show_timers,
+   &inode->i_private);
+   };
+}
+
+static const struct file_operations debug_fops = {
+   .open   = pm_dbg_open,
+   .read   = seq_read,
+   .llseek = seq_lseek,
+   .release= single_release,
+};
+
+static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
+{
+   int i;
+   s64 t;
+   struct timespec now;
+
+   getnstimeofday(&now);
+   t = timespec_to_ns(&now);
+
+   for (i = 0; i < 4; i++)
+   pwrdm->state_timer[i] = 0;
+
+   pwrdm->timer = t;
+
+   return 0;
+}
+
+static int __init pm_dbg_init(void)
+{
+   struct dentry *d;
+
+   printk(KERN_INFO "pm_dbg_init()\n");
+
+   d = debugfs_create_dir("pm_debug", NULL);
+   if (IS_ERR(d))
+   return PT

[PATCH 1/3] Add closures to clkdm_for_each and pwrdm_for_each.

2008-10-15 Thread Peter 'p2' De Schrijver
First add some infrastructure to easily iterate over clock and power domains.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/clockdomain.c |5 +++--
 arch/arm/mach-omap2/pm34xx.c  |8 
 arch/arm/plat-omap/include/mach/clockdomain.h |3 ++-
 arch/arm/plat-omap/include/mach/powerdomain.h |3 ++-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index 5249fe8..b0b5885 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -295,7 +295,8 @@ struct clockdomain *clkdm_lookup(const char *name)
  * anything else to indicate failure; or -EINVAL if the function pointer
  * is null.
  */
-int clkdm_for_each(int (*fn)(struct clockdomain *clkdm))
+int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
+   void *user)
 {
struct clockdomain *clkdm;
int ret = 0;
@@ -305,7 +306,7 @@ int clkdm_for_each(int (*fn)(struct clockdomain *clkdm))
 
mutex_lock(&clkdm_mutex);
list_for_each_entry(clkdm, &clkdm_list, node) {
-   ret = (*fn)(clkdm);
+   ret = (*fn)(clkdm, user);
if (ret)
break;
}
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 1fbb690..be69839 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -518,7 +518,7 @@ static void __init prcm_setup_regs(void)
OCP_MOD, OMAP2_PRM_IRQENABLE_MPU_OFFSET);
 }
 
-static int __init pwrdms_setup(struct powerdomain *pwrdm)
+static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
 {
struct power_state *pwrst;
 
@@ -538,7 +538,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm)
return set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
 }
 
-static int __init clkdms_setup(struct clockdomain *clkdm)
+static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
 {
omap2_clkdm_allow_idle(clkdm);
return 0;
@@ -564,13 +564,13 @@ int __init omap3_pm_init(void)
goto err1;
}
 
-   ret = pwrdm_for_each(pwrdms_setup);
+   ret = pwrdm_for_each(pwrdms_setup, NULL);
if (ret) {
printk(KERN_ERR "Failed to setup powerdomains\n");
goto err2;
}
 
-   (void) clkdm_for_each(clkdms_setup);
+   (void) clkdm_for_each(clkdms_setup, NULL);
 
mpu_pwrdm = pwrdm_lookup("mpu_pwrdm");
if (mpu_pwrdm == NULL) {
diff --git a/arch/arm/plat-omap/include/mach/clockdomain.h 
b/arch/arm/plat-omap/include/mach/clockdomain.h
index b9d0dd2..99ebd88 100644
--- a/arch/arm/plat-omap/include/mach/clockdomain.h
+++ b/arch/arm/plat-omap/include/mach/clockdomain.h
@@ -95,7 +95,8 @@ int clkdm_register(struct clockdomain *clkdm);
 int clkdm_unregister(struct clockdomain *clkdm);
 struct clockdomain *clkdm_lookup(const char *name);
 
-int clkdm_for_each(int (*fn)(struct clockdomain *clkdm));
+int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
+   void *user);
 struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm);
 
 void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
diff --git a/arch/arm/plat-omap/include/mach/powerdomain.h 
b/arch/arm/plat-omap/include/mach/powerdomain.h
index 52663fc..de03f3d 100644
--- a/arch/arm/plat-omap/include/mach/powerdomain.h
+++ b/arch/arm/plat-omap/include/mach/powerdomain.h
@@ -128,7 +128,8 @@ int pwrdm_register(struct powerdomain *pwrdm);
 int pwrdm_unregister(struct powerdomain *pwrdm);
 struct powerdomain *pwrdm_lookup(const char *name);
 
-int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm));
+int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user),
+   void *user);
 
 int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
 int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
-- 
1.5.6.3

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


[PATCH 0/2] PM counters

2008-10-15 Thread Peter 'p2' De Schrijver
This patch introduces counters for the various PM states in OMAP3.

Peter 'p2' De Schrijver (2):
  PM counter infrastructure.
  Hook into PM counters

 arch/arm/mach-omap2/clock.c   |2 +
 arch/arm/mach-omap2/clockdomain.c |4 +
 arch/arm/mach-omap2/pm34xx.c  |6 ++
 arch/arm/mach-omap2/powerdomain.c |  101 -
 arch/arm/plat-omap/include/mach/powerdomain.h |7 ++
 5 files changed, 118 insertions(+), 2 deletions(-)

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


[PATCH 2/2] Hook into PM counters

2008-10-15 Thread Peter 'p2' De Schrijver
This patch modifies the clock, clockdomain and OMAP3 specific powerdomain
code to call the PM counter infrastructure whenever one or more powerdomains
might have changed state.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/clock.c   |2 ++
 arch/arm/mach-omap2/clockdomain.c |4 
 arch/arm/mach-omap2/pm34xx.c  |6 ++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index c3af24e..dbbc7c8 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -1013,5 +1013,7 @@ void omap2_clk_disable_unused(struct clk *clk)
 
printk(KERN_INFO "Disabling unused clock \"%s\"\n", clk->name);
_omap2_clk_disable(clk);
+   if (clk->clkdm.ptr != NULL)
+   pwrdm_clkdm_state_switch(clk->clkdm.ptr);
 }
 #endif
diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index fa62f14..5249fe8 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -567,6 +567,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_wakeup(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
@@ -618,6 +620,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_sleep(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index a828db6..1fbb690 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -170,6 +170,8 @@ static void omap_sram_idle(void)
disable_smartreflex(SR1);
disable_smartreflex(SR2);
 
+   pwrdm_pre_transition();
+
omap2_gpio_prepare_for_retention();
 
_omap_sram_idle(NULL, save_state);
@@ -179,6 +181,9 @@ static void omap_sram_idle(void)
/* Enable smartreflex after WFI */
enable_smartreflex(SR1);
enable_smartreflex(SR2);
+
+   pwrdm_post_transition();
+
 }
 
 /*
@@ -260,6 +265,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 
state)
if (sleep_switch) {
omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
pwrdm_wait_transition(pwrdm);
+   pwrdm_state_switch(pwrdm);
}
 
 err:
-- 
1.5.6.3

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


[PATCH 1/2] PM counter infrastructure.

2008-10-15 Thread Peter 'p2' De Schrijver
This patch provides the infrastructure to count how many times a powerdomain
entered a given power state (on, inactive, retention, off). A number of
functions are provided which will be called by the chip specific powerdomain
and clockdomain code whenever a transition might have happened.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/powerdomain.c |  101 -
 arch/arm/plat-omap/include/mach/powerdomain.h |7 ++
 2 files changed, 106 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 73e2971..3a9e151 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -35,6 +35,11 @@
 #include 
 #include 
 
+enum {
+   PWRDM_STATE_NOW = 0,
+   PWRDM_STATE_PREV,
+};
+
 /* pwrdm_list contains all registered struct powerdomains */
 static LIST_HEAD(pwrdm_list);
 
@@ -102,6 +107,63 @@ static struct powerdomain *_pwrdm_deps_lookup(struct 
powerdomain *pwrdm,
return pd->pwrdm;
 }
 
+static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)
+{
+
+   int prev;
+   int state;
+
+   if (pwrdm == NULL)
+   return -EINVAL;
+
+   state = pwrdm_read_pwrst(pwrdm);
+
+   switch (flag) {
+   case PWRDM_STATE_NOW:
+   prev = pwrdm->state;
+   break;
+   case PWRDM_STATE_PREV:
+   prev = pwrdm_read_prev_pwrst(pwrdm);
+   if (pwrdm->state != prev)
+   pwrdm->state_counter[prev]++;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   if (state != prev)
+   pwrdm->state_counter[state]++;
+
+   pwrdm->state = state;
+
+   return 0;
+}
+
+static int _pwrdm_pre_transition_cb(struct powerdomain *pwrdm)
+{
+   pwrdm_clear_all_prev_pwrst(pwrdm);
+   _pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW);
+   return 0;
+}
+
+static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm)
+{
+   _pwrdm_state_switch(pwrdm, PWRDM_STATE_PREV);
+   return 0;
+}
+
+static __init void _pwrdm_setup(struct powerdomain *pwrdm)
+{
+   int i;
+
+   for (i = 0; i < 4; i++)
+   pwrdm->state_counter[i] = 0;
+
+   pwrdm_wait_transition(pwrdm);
+   pwrdm->state = pwrdm_read_pwrst(pwrdm);
+   pwrdm->state_counter[pwrdm->state] = 1;
+
+}
 
 /* Public functions */
 
@@ -117,9 +179,12 @@ void pwrdm_init(struct powerdomain **pwrdm_list)
 {
struct powerdomain **p = NULL;
 
-   if (pwrdm_list)
-   for (p = pwrdm_list; *p; p++)
+   if (pwrdm_list) {
+   for (p = pwrdm_list; *p; p++) {
pwrdm_register(*p);
+   _pwrdm_setup(*p);
+   }
+   }
 }
 
 /**
@@ -1110,4 +1175,36 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm)
return 0;
 }
 
+int pwrdm_state_switch(struct powerdomain *pwrdm)
+{
+   return _pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW);
+}
+
+int pwrdm_clkdm_state_switch(struct clockdomain *clkdm)
+{
+   if (clkdm != NULL && clkdm->pwrdm.ptr != NULL) {
+   pwrdm_wait_transition(clkdm->pwrdm.ptr);
+   return pwrdm_state_switch(clkdm->pwrdm.ptr);
+   }
+
+   return -EINVAL;
+}
+int pwrdm_clk_state_switch(struct clk *clk)
+{
+   if (clk != NULL && clk->clkdm.ptr != NULL)
+   return pwrdm_clkdm_state_switch(clk->clkdm.ptr);
+   return -EINVAL;
+}
+
+int pwrdm_pre_transition(void)
+{
+   pwrdm_for_each(_pwrdm_pre_transition_cb);
+   return 0;
+}
+
+int pwrdm_post_transition(void)
+{
+   pwrdm_for_each(_pwrdm_post_transition_cb);
+   return 0;
+}
 
diff --git a/arch/arm/plat-omap/include/mach/powerdomain.h 
b/arch/arm/plat-omap/include/mach/powerdomain.h
index 69c9e67..52663fc 100644
--- a/arch/arm/plat-omap/include/mach/powerdomain.h
+++ b/arch/arm/plat-omap/include/mach/powerdomain.h
@@ -117,6 +117,8 @@ struct powerdomain {
 
struct list_head node;
 
+   int state;
+   unsigned state_counter[4];
 };
 
 
@@ -164,4 +166,9 @@ bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm);
 
 int pwrdm_wait_transition(struct powerdomain *pwrdm);
 
+int pwrdm_state_switch(struct powerdomain *pwrdm);
+int pwrdm_clkdm_state_switch(struct clockdomain *clkdm);
+int pwrdm_pre_transition(void);
+int pwrdm_post_transition(void);
+
 #endif
-- 
1.5.6.3

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


Re: [PATCH 3/3] Hook into powerdomain code

2008-10-15 Thread Peter 'p2' De Schrijver
On Tue, Oct 14, 2008 at 01:55:07PM -0600, ext Paul Walmsley wrote:
> On Tue, 14 Oct 2008, Peter 'p2' De Schrijver wrote:
> 
> > @@ -179,9 +183,12 @@ void pwrdm_init(struct powerdomain **pwrdm_list)
> >  {
> > struct powerdomain **p = NULL;
> >  
> > -   if (pwrdm_list)
> > -   for (p = pwrdm_list; *p; p++)
> > +   if (pwrdm_list) {
> > +   for (p = pwrdm_list; *p; p++) {
> > pwrdm_register(*p);
> > +   _pwrdm_setup(*p);
> 
> perhaps I am going blind - could you point me at where _pwrdm_setup() is 
> defined?
> 

Hmm. This seems to be a change which should have been in the normal pm
counters patch. Somehow it didn't get there. I will send an updated
version of that patch.

Cheers,

Peter.

-- 
goa is a state of mind
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] 3430sdp and ldp use custom twl4030 power scripts.

2008-10-15 Thread Peter 'p2' De Schrijver
The TI 3430dsp and ldp boards have a custom power script to handle sleep and 
off modes.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/board-3430sdp.c |   84 +++
 arch/arm/mach-omap2/board-ldp.c |   84 +++
 2 files changed, 168 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 56f28ae..bb591bb 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -47,6 +47,8 @@
 
 #include "sdram-qimonda-hyb18m512160af-6.h"
 
+#define CONFIG_DISABLE_HFCLK 1
+
 #defineSDP3430_SMC91X_CS   3
 
 #define ENABLE_VAUX3_DEDICATED 0x03
@@ -329,6 +331,87 @@ static struct twl4030_madc_platform_data sdp3430_madc_data 
= {
.irq_line   = 1,
 };
 
+
+static struct twl4030_ins __initdata sleep_on_seq[] = {
+/*
+ * Turn off VDD1 and VDD2.
+ */
+   {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
+#ifdef CONFIG_DISABLE_HFCLK
+/*
+ * And also turn off the OMAP3 PLLs and the sysclk output.
+ */
+   {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_OFF), 3},
+#endif
+};
+
+static struct twl4030_script sleep_on_script __initdata = {
+   .script = sleep_on_seq,
+   .size   = ARRAY_SIZE(sleep_on_seq),
+   .flags  = TRITON_SLEEP_SCRIPT,
+};
+
+static struct twl4030_ins wakeup_seq[] __initdata = {
+#ifndef CONFIG_DISABLE_HFCLK
+/*
+ * Wakeup VDD1 and VDD2.
+ */
+   {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 4},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 2},
+#else
+/*
+ * Reenable the OMAP3 PLLs.
+ * Wakeup VDD1 and VDD2.
+ * Reenable sysclk output.
+ */
+   {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 0x30},
+   {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 0x30},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 0x37},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 3},
+#endif /* #ifndef CONFIG_DISABLE_HFCLK */
+};
+
+static struct twl4030_script wakeup_script __initdata = {
+   .script = wakeup_seq,
+   .size   = ARRAY_SIZE(wakeup_seq),
+   .flags  = TRITON_WAKEUP12_SCRIPT | TRITON_WAKEUP3_SCRIPT,
+};
+
+static struct twl4030_ins wrst_seq[] __initdata = {
+/*
+ * Reset twl4030.
+ * Reset VDD1 regulator.
+ * Reset VDD2 regulator.
+ * Reset VPLL1 regulator.
+ * Enable sysclk output.
+ * Reenable twl4030.
+ */
+   {MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_OFF), 2},
+   {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_WRST), 15},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_WRST), 15},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_WRST), 0x60},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 2},
+   {MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_ACTIVE), 2},
+};
+static struct twl4030_script wrst_script __initdata = {
+   .script = wrst_seq,
+   .size   = ARRAY_SIZE(wakeup_seq),
+   .flags  = TRITON_WRST_SCRIPT,
+};
+
+static struct twl4030_script *twl4030_scripts[] __initdata = {
+   &sleep_on_script,
+   &wakeup_script,
+   &wrst_script,
+};
+
+static struct twl4030_power_data sdp3430_t2scripts_data __initdata = {
+   .scripts= twl4030_scripts,
+   .size   = ARRAY_SIZE(twl4030_scripts),
+};
+
 static struct twl4030_platform_data sdp3430_twldata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
@@ -338,6 +421,7 @@ static struct twl4030_platform_data sdp3430_twldata = {
.gpio   = &sdp3430_gpio_data,
.madc   = &sdp3430_madc_data,
.keypad = &sdp3430_kp_data,
+   .power  = &sdp3430_t2scripts_data,
.usb= &sdp3430_usb_data,
 };
 
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 92710c3..d4d4e90 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -41,6 +41,8 @@
 #include 
 #include 
 
+#define CONFIG_DISABLE_HFCLK 1
+
 #define ENABLE_VAUX1_DEDICATED 0x03
 #define ENABLE_VAUX1_DEV_GRP   0x20
 
@@ -195,6 +197,87 @@ static int ldp_batt_table[] = {
 4040,   3910,   3790,   3670,   3550
 };
 
+static struct twl4030_ins __initdata sleep_on_seq[] = {
+/*
+ * Turn off VDD1 and VDD2.
+ */
+   {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
+#ifdef CONFIG_DISABLE_HFCLK
+/*
+ * And also turn off the OMAP3 PLLs and the sysclk output.
+ */
+   {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3},
+   {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_OFF), 3},
+#endif
+};
+
+static struct twl4030_script sleep_on_script __initdata = {
+   .script = sleep_on_seq,
+   .size   = ARRAY_SIZE(sleep_on_seq),
+   .flags  = TRITON_SLEEP_SCRIPT,
+};
+
+static struct twl4030_ins wakeup_seq[] __initdata 

[PATCH 3/6] Hook twl4030 power code into twl4030 core.

2008-10-15 Thread Peter 'p2' De Schrijver
This patch makes twl4030 core call the power code in case the scripts are 
present in the platform data.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 drivers/mfd/Kconfig|9 +
 drivers/mfd/Makefile   |1 +
 drivers/mfd/twl4030-core.c |   11 +++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e643f6b..91c0417 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -64,6 +64,15 @@ config TWL4030_CORE
  high speed USB OTG transceiver, an audio codec (on most
  versions) and many other features.
 
+config TWL4030_POWER
+   bool "Support power sequencing scripts on TWL4030/TPS659x0"
+   depends on TWL4030_CORE
+   help
+ Say yes here if you want to use the power sequencing scripts on
+ the TWL4030/TPS659x0. These scripts control which regulators or
+ oscillators are switched off or on or reset when a sleep, wakeup
+ or warm reset event occurs.
+
 config MFD_TMIO
bool
default n
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 5650e7b..08c5dfe 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_MFD_TC6387XB)+= tc6387xb.o
 obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o
 
 obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o
+obj-$(CONFIG_TWL4030_POWER)+= twl4030-power.o
 
 obj-$(CONFIG_MFD_CORE) += mfd-core.o
 
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index fd9a016..7a5c9d0 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -81,6 +81,12 @@
 #define twl_has_madc() false
 #endif
 
+#ifdef CONFIG_TWL4030_POWER
+#define twl_has_power()true
+#else
+#define twl_has_power()false
+#endif
+
 #if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE)
 #define twl_has_rtc()  true
 #else
@@ -106,6 +112,8 @@ static inline void activate_irq(int irq)
 #endif
 }
 
+extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
+
 /* Primary Interrupt Handler on TWL4030 Registers */
 
 /* Register Definitions */
@@ -794,6 +802,9 @@ static int add_children(struct twl4030_platform_data *pdata)
}
}
 
+   if (twl_has_power() && pdata->power)
+   twl4030_power_init(pdata->power);
+
if (twl_has_rtc()) {
twl = &twl4030_modules[3];
 
-- 
1.5.6.3

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


[PATCH 6/6] omap3 evm, beagle and overo use the generic twl4030 script

2008-10-15 Thread Peter 'p2' De Schrijver
Make omap3 evm, beagle and overo use the generic twl4030 script.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/Makefile|9 ++---
 arch/arm/mach-omap2/board-omap3beagle.c |4 ++--
 arch/arm/mach-omap2/board-omap3evm.c|4 ++--
 arch/arm/mach-omap2/board-overo.c   |4 ++--
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 33de217..ed0cd7a 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -58,10 +58,12 @@ obj-$(CONFIG_MACH_OMAP_3430SDP) += 
board-3430sdp.o \
 obj-$(CONFIG_MACH_OMAP3EVM)+= board-omap3evm.o \
   hsmmc.o \
   usb-musb.o usb-ehci.o \
-  board-omap3evm-flash.o
+  board-omap3evm-flash.o \
+  twl4030-generic-scripts.o
 obj-$(CONFIG_MACH_OMAP3_BEAGLE)+= board-omap3beagle.o \
   usb-musb.o usb-ehci.o \
-  hsmmc.o
+  hsmmc.o \
+  twl4030-generic-scripts.o
 obj-$(CONFIG_MACH_OMAP_LDP)+= board-ldp.o \
   hsmmc.o \
   usb-musb.o
@@ -77,7 +79,8 @@ obj-$(CONFIG_MACH_NOKIA_N810) += board-n810.o
 obj-$(CONFIG_MACH_OVERO)   += board-overo.o \
   hsmmc.o \
   usb-musb.o \
-  usb-ehci.o
+  usb-ehci.o \
+  twl4030-generic-scripts.o
 
 # TUSB 6010 chips
 obj-$(CONFIG_MACH_OMAP2_TUSB6010)  += usb-tusb6010.o
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index 19702c7..cc9506b 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -24,8 +24,6 @@
 #include 
 #include 
 
-#include 
-
 #include 
 #include 
 #include 
@@ -45,6 +43,7 @@
 #include 
 #include 
 
+#include "twl4030-generic-scripts.h"
 
 #define GPMC_CS0_BASE  0x60
 #define GPMC_CS_SIZE   0x30
@@ -149,6 +148,7 @@ static struct twl4030_platform_data beagle_twldata = {
/* platform_data for children goes here */
.usb= &beagle_usb_data,
.gpio   = &beagle_gpio_data,
+   .power  = &generic3430_t2scripts_data,
 };
 
 static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 3538067..a72772f 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -20,8 +20,6 @@
 #include 
 #include 
 
-#include 
-
 #include 
 #include 
 #include 
@@ -41,6 +39,7 @@
 #include 
 
 #include "sdram-micron-mt46h32m32lf-6.h"
+#include "twl4030-generic-scripts.h"
 
 static struct resource omap3evm_smc911x_resources[] = {
[0] =   {
@@ -139,6 +138,7 @@ static struct twl4030_platform_data omap3evm_twldata = {
.keypad = &omap3evm_kp_data,
.madc   = &omap3evm_madc_data,
.usb= &omap3evm_usb_data,
+   .power  = &generic3430_t2scripts_data,
.gpio   = &omap3evm_gpio_data,
 };
 
diff --git a/arch/arm/mach-omap2/board-overo.c 
b/arch/arm/mach-omap2/board-overo.c
index 4e2781a..b0e5cec 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -27,8 +27,6 @@
 #include 
 #include 
 
-#include 
-
 #include 
 #include 
 #include 
@@ -50,6 +48,7 @@
 #include 
 
 #include "sdram-micron-mt46h32m32lf-6.h"
+#include "twl4030-generic-scripts.h"
 
 #define NAND_BLOCK_SIZE SZ_128K
 #define GPMC_CS0_BASE  0x60
@@ -160,6 +159,7 @@ static struct twl4030_platform_data overo_twldata = {
.irq_end= TWL4030_IRQ_END,
.gpio   = &overo_gpio_data,
.usb= &overo_usb_data,
+   .power  = &generic3430_t2scripts_data,
 };
 
 static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
-- 
1.5.6.3

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


[PATCH 1/6] Add defines and data types for twl4030.

2008-10-15 Thread Peter 'p2' De Schrijver
This patch adds a bunch of data types and defines to handle the twl4030 power 
sequence scripts.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 include/linux/i2c/twl4030.h |   64 +++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index cdb4531..7dc4ee1 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -264,6 +264,69 @@ struct twl4030_usb_data {
enum twl4030_usb_mode   usb_mode;
 };
 
+struct twl4030_ins {
+   u16 pmb_message;
+   u8 delay;
+};
+
+struct twl4030_script {
+   struct twl4030_ins *script;
+   unsigned size;
+   u8 flags;
+};
+#define TRITON_WRST_SCRIPT (1<<0)
+#define TRITON_WAKEUP12_SCRIPT (1<<1)
+#define TRITON_WAKEUP3_SCRIPT  (1<<2)
+#define TRITON_SLEEP_SCRIPT(1<<3)
+
+struct twl4030_power_data {
+   struct twl4030_script **scripts;
+   unsigned size;
+};
+
+/* Power bus message definitions */
+
+#define DEV_GRP_NULL   0x0
+#define DEV_GRP_P1 0x1
+#define DEV_GRP_P2 0x2
+#define DEV_GRP_P3 0x4
+
+#define RES_GRP_RES0x0
+#define RES_GRP_PP 0x1
+#define RES_GRP_RC 0x2
+#define RES_GRP_PP_RC  0x3
+#define RES_GRP_PR 0x4
+#define RES_GRP_PP_PR  0x5
+#define RES_GRP_RC_PR  0x6
+#define RES_GRP_ALL0x7
+
+#define RES_TYPE2_R0   0x0
+
+#define RES_TYPE_ALL   0x7
+
+#define RES_STATE_WRST 0xF
+#define RES_STATE_ACTIVE   0xE
+#define RES_STATE_SLEEP0x8
+#define RES_STATE_OFF  0x0
+
+/*
+*  Power Bus Message Format
+*
+*  Broadcast Message (16 Bits)
+*  DEV_GRP[15:13] MT[12]  RES_GRP[11:9]  RES_TYPE2[8:7] RES_TYPE[6:4]
+*  RES_STATE[3:0]
+*
+*  Singular Message (16 Bits)
+*  DEV_GRP[15:13] MT[12]  RES_ID[11:4]  RES_STATE[3:0]
+*
+*/
+
+#define MSG_BROADCAST(devgrp, grp, type, type2, state) \
+   (devgrp << 13 | 1 << 12 | grp << 9 | type2 << 7 | type << 4 | state)
+
+#define MSG_SINGULAR(devgrp, id, state) \
+   (devgrp << 13 | 0 << 12 | id << 4 | state)
+
 struct twl4030_platform_data {
unsignedirq_base, irq_end;
struct twl4030_bci_platform_data*bci;
@@ -271,6 +334,7 @@ struct twl4030_platform_data {
struct twl4030_madc_platform_data   *madc;
struct twl4030_keypad_data  *keypad;
struct twl4030_usb_data *usb;
+   struct twl4030_power_data   *power;
 
/* REVISIT more to come ... _nothing_ should be hard-wired */
 };
-- 
1.5.6.3

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


[PATCH 5/6] Generic twl4030 power script for 3430 based boards.

2008-10-15 Thread Peter 'p2' De Schrijver
This is a generic twl4030 power script for 3430 based boards. It handles
sleep and wakeup events. In case of a sleep event it will first put the
Reset and Control (RC) resources to sleep and then put the voltage regulators
to sleep. In case of a wakeup event, the system clock will be started first,
then the voltage regulators will be woken up and finally the RC resources will
be woken up.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/twl4030-generic-scripts.c |   78 +
 arch/arm/mach-omap2/twl4030-generic-scripts.h |8 +++
 2 files changed, 86 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/twl4030-generic-scripts.c
 create mode 100644 arch/arm/mach-omap2/twl4030-generic-scripts.h

diff --git a/arch/arm/mach-omap2/twl4030-generic-scripts.c 
b/arch/arm/mach-omap2/twl4030-generic-scripts.c
new file mode 100644
index 000..f41c9ef
--- /dev/null
+++ b/arch/arm/mach-omap2/twl4030-generic-scripts.c
@@ -0,0 +1,78 @@
+/*
+ * arch/arm/mach-omap2/twl4030-generic-scripts.c
+ *
+ * Generic power control scripts for TWL4030
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ * Copyright (C) 2006 Texas Instruments, Inc
+ *
+ * Written by  Kalle Jokiniemi
+ * Peter De Schrijver <[EMAIL PROTECTED]>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * This script instructs twl4030 to first put the Reset and Control (RC)
+ * resources to sleep and then all the other resources.
+ */
+
+static struct twl4030_ins sleep_on_seq[] __initdata = {
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_RC, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_SLEEP), 4},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_SLEEP), 4},
+};
+
+static struct twl4030_script sleep_on_script __initdata = {
+   .script = sleep_on_seq,
+   .size   = ARRAY_SIZE(sleep_on_seq),
+   .flags  = TRITON_SLEEP_SCRIPT,
+};
+
+/*
+ * This script instructs twl4030 to first enable CLKEN, then wakeup the
+ * regulators and then all other resources.
+ */
+
+static struct twl4030_ins wakeup_seq[] __initdata = {
+   {MSG_SINGULAR(DEV_GRP_NULL, 0x17, RES_STATE_ACTIVE), 0x30},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP_PR, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_ACTIVE), 0x37},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_ACTIVE), 0x2},
+};
+
+static struct twl4030_script wakeup_script __initdata = {
+   .script = wakeup_seq,
+   .size   = ARRAY_SIZE(wakeup_seq),
+   .flags  = TRITON_WAKEUP12_SCRIPT | TRITON_WAKEUP3_SCRIPT,
+};
+
+static struct twl4030_script *twl4030_scripts[] __initdata = {
+   &sleep_on_script,
+   &wakeup_script,
+};
+
+struct twl4030_power_data generic3430_t2scripts_data __initdata = {
+   .scripts= twl4030_scripts,
+   .size   = ARRAY_SIZE(twl4030_scripts),
+};
+
+
diff --git a/arch/arm/mach-omap2/twl4030-generic-scripts.h 
b/arch/arm/mach-omap2/twl4030-generic-scripts.h
new file mode 100644
index 000..64d8d3f
--- /dev/null
+++ b/arch/arm/mach-omap2/twl4030-generic-scripts.h
@@ -0,0 +1,8 @@
+#ifndef __TWL4030_GENERIC_SCRIPTS_H
+#define __TWL4030_GENERIC_SCRIPTS_H
+
+#include 
+
+extern struct twl4030_power_data generic3430_t2scripts_data;
+
+#endif
-- 
1.5.6.3

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


[PATCH 2/6] Move existing TWL4030 code to drivers/mfd

2008-10-15 Thread Peter 'p2' De Schrijver
This patches moves the twl4030 power sequencer code to drivers/mfd and
updates the code for the new twl4030 framework. The code handles downloading
the scripts provided by the board configuration and configuring the chip
to call the relevant script for each event (processor group 1 and 2 sleep,
processor group 3 sleep, wakeup or warm reset).

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 drivers/i2c/chips/Makefile|2 +-
 drivers/i2c/chips/twl4030-power.c |  343 -
 drivers/mfd/twl4030-power.c   |  270 +
 3 files changed, 271 insertions(+), 344 deletions(-)
 delete mode 100644 drivers/i2c/chips/twl4030-power.c
 create mode 100644 drivers/mfd/twl4030-power.c

diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index ba41a57..7e0fdfa 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -24,7 +24,7 @@ obj-$(CONFIG_GPIOEXPANDER_OMAP)   += gpio_expander_omap.o
 obj-$(CONFIG_MENELAUS) += menelaus.o
 obj-$(CONFIG_SENSORS_TSL2550)  += tsl2550.o
 obj-$(CONFIG_SENSORS_TSL2563)  += tsl2563.o
-obj-$(CONFIG_TWL4030_CORE) += twl4030-pwrirq.o twl4030-power.o
+obj-$(CONFIG_TWL4030_CORE) += twl4030-pwrirq.o
 obj-$(CONFIG_TWL4030_USB)  += twl4030-usb.o
 obj-$(CONFIG_TWL4030_POWEROFF) += twl4030-poweroff.o
 obj-$(CONFIG_TWL4030_PWRBUTTON)+= twl4030-pwrbutton.o
diff --git a/drivers/i2c/chips/twl4030-power.c 
b/drivers/i2c/chips/twl4030-power.c
deleted file mode 100644
index cb325b0..000
--- a/drivers/i2c/chips/twl4030-power.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * linux/drivers/i2c/chips/twl4030-power.c
- *
- * Handle TWL4030 Power initialization
- *
- * Copyright (C) 2008 Nokia Corporation
- * Copyright (C) 2006 Texas Instruments, Inc
- *
- * Written by  Kalle Jokiniemi
- * Peter De Schrijver <[EMAIL PROTECTED]>
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file "COPYING" in the main directory of this
- * archive for more details.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include 
-#include 
-#include 
-
-#include 
-
-#define PWR_P1_SW_EVENTS   0x10
-#define PWR_DEVOFF (1<<0)
-
-#define PHY_TO_OFF_PM_MASTER(p)(p - 0x36)
-#define PHY_TO_OFF_PM_RECIEVER(p)  (p - 0x5b)
-
-/* resource - hfclk */
-#define R_HFCLKOUT_DEV_GRP PHY_TO_OFF_PM_RECIEVER(0xe6)
-
-/* PM events */
-#define R_P1_SW_EVENTS PHY_TO_OFF_PM_MASTER(0x46)
-#define R_P2_SW_EVENTS PHY_TO_OFF_PM_MASTER(0x47)
-#define R_P3_SW_EVENTS PHY_TO_OFF_PM_MASTER(0x48)
-#define R_CFG_P1_TRANSITIONPHY_TO_OFF_PM_MASTER(0x36)
-#define R_CFG_P2_TRANSITIONPHY_TO_OFF_PM_MASTER(0x37)
-#define R_CFG_P3_TRANSITIONPHY_TO_OFF_PM_MASTER(0x38)
-
-#define LVL_WAKEUP 0x08
-
-#define ENABLE_WARMRESET (1<<4)
-
-/* sequence script */
-
-#define END_OF_SCRIPT  0x3f
-
-#define R_SEQ_ADD_A2S  PHY_TO_OFF_PM_MASTER(0x55)
-#define R_SEQ_ADD_SA12 PHY_TO_OFF_PM_MASTER(0x56)
-#defineR_SEQ_ADD_S2A3  PHY_TO_OFF_PM_MASTER(0x57)
-#defineR_SEQ_ADD_WARM  PHY_TO_OFF_PM_MASTER(0x58)
-#define R_MEMORY_ADDRESS   PHY_TO_OFF_PM_MASTER(0x59)
-#define R_MEMORY_DATA  PHY_TO_OFF_PM_MASTER(0x5a)
-
-/* Power bus message definitions */
-
-#define DEV_GRP_NULL   0x0
-#define DEV_GRP_P1 0x1
-#define DEV_GRP_P2 0x2
-#define DEV_GRP_P3 0x4
-
-#define RES_GRP_RES0x0
-#define RES_GRP_PP 0x1
-#define RES_GRP_RC 0x2
-#define RES_GRP_PP_RC  0x3
-#define RES_GRP_PR 0x4
-#define RES_GRP_PP_PR  0x5
-#define RES_GRP_RC_PR  0x6
-#define RES_GRP_ALL0x7
-
-#define RES_TYPE2_R0   0x0
-
-#define RES_TYPE_ALL   0x7
-
-#define RES_STATE_WRST 0xF
-#define RES_STATE_ACTIVE   0xE
-#define RES_STATE_SLEEP0x8
-#define RES_STATE_OFF  0x0
-
-/*
-*  Power Bus Message Format
-*
-*  Broadcast Message (16 Bits)
-*  DEV_GRP[15:13] MT[12]  RES_GRP[11:9]  RES_TYPE2[8:7] RES_TYPE[6:4]
-*  RES_STATE[3:0]
-*
-*  Singular Message (16 Bits)
-*  DEV_GRP[15:13] MT[12]  RES_ID[11:4]  RES_STATE[3:0]
-*
-*/
-
-#define MSG_BROADCAST(devgrp, grp, type, type2, state) \
-   (devgrp << 13 | 1 << 12 | grp << 9 | type2 << 7 | type << 4 | state)
-
-#define MSG_SINGULAR(devgrp, id, state) \
-   (devgrp << 13 | 0 << 12 | id << 4 | state)
-
-#define R_PROTECT_KEY   

[PATCH 0/6] Integrate the twl4030 power code into new twl4030 mfd

2008-10-15 Thread Peter 'p2' De Schrijver
This patchset integrates the twl4030 power code into the new twl4030 mfd 
framework. The scripts will be moved to the board specific data.

Peter 'p2' De Schrijver (6):
  Add defines and data types for twl4030.
  Move existing TWL4030 code to drivers/mfd
  Hook twl4030 power code into twl4030 core.
  3430sdp and ldp use custom twl4030 power scripts.
  Generic twl4030 power script for 3430 based boards.
  omap3 evm, beagle and overo use the generic twl4030 script

 arch/arm/mach-omap2/Makefile  |9 +-
 arch/arm/mach-omap2/board-3430sdp.c   |   84 ++
 arch/arm/mach-omap2/board-ldp.c   |   84 ++
 arch/arm/mach-omap2/board-omap3beagle.c   |4 +-
 arch/arm/mach-omap2/board-omap3evm.c  |4 +-
 arch/arm/mach-omap2/board-overo.c |4 +-
 arch/arm/mach-omap2/twl4030-generic-scripts.c |   78 ++
 arch/arm/mach-omap2/twl4030-generic-scripts.h |8 +
 drivers/i2c/chips/Makefile|2 +-
 drivers/i2c/chips/twl4030-power.c |  343 -
 drivers/mfd/Kconfig   |9 +
 drivers/mfd/Makefile  |1 +
 drivers/mfd/twl4030-core.c|   11 +
 drivers/mfd/twl4030-power.c   |  270 +++
 include/linux/i2c/twl4030.h   |   64 +
 15 files changed, 622 insertions(+), 353 deletions(-)
 create mode 100644 arch/arm/mach-omap2/twl4030-generic-scripts.c
 create mode 100644 arch/arm/mach-omap2/twl4030-generic-scripts.h
 delete mode 100644 drivers/i2c/chips/twl4030-power.c
 create mode 100644 drivers/mfd/twl4030-power.c

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


Re: [PATCH 1/3] clk: introduce omap_clk_associate

2008-10-15 Thread Paul Walmsley
On Wed, 15 Oct 2008, Högander Jouni wrote:

> L3 and L4 are anyway on when not in wfi, because of sleep/wkdep, so no
> power save. This is the case at least with OMAP3 not sure about OMAP2.

I thought that disabling the iclken bit still disabled some gates 
in the OCP interface.  Richard, do you know if that is the case?

> > There also was some discussion last year that modules like GPTIMER can 
> > have their functional clocks enabled, but their interface clocks disabled 
> > when register access is not needed.  Wakeups from the module are still 
> > sent asynchronously to the PRCM.  Again the motivation is to save power.  
> > I don't think the current code tries to do this.
> >
> 
> In many modules there is also possibility to gate ick by HW when not
> in wfi (see AUTOIDLE in SYCONFIG). I'm not sure about this but
> extremely also fcks could be taken care by HW (see CLOCKACTIVITY in
> SYSCONFIG).

How will the PRCM know when the device driver is accessing the module 
registers?


- Paul

Re: [PATCH 1/3] clk: introduce omap_clk_associate

2008-10-15 Thread Högander Jouni
"ext Paul Walmsley" <[EMAIL PROTECTED]> writes:

> Hello Jouni,
>
> On Wed, 15 Oct 2008, Högander Jouni wrote:
>
>> "ext Tony Lindgren" <[EMAIL PROTECTED]> writes:
>> 
>> > * Igor Stoppa <[EMAIL PROTECTED]> [081014 14:12]:
>> >> On Tue, 2008-10-14 at 13:59 -0700, ext Tony Lindgren wrote:
>> >> 
>> >> > And that we can use same naming in the driver no matter which omap :)
>> >> 
>> >> Wasn't that one of the main features of the clock FW, when it was
>> >> designed?
>> >
>> > Yes. But we adding separate ick and fck during omap2420 confused
>> > that.
>> 
>> Why this was originally done? I mean we have possibility to autogate
>> interface clocks. AFAIK those could be just fine be enabled on boot and let
>> the hw to take care of them.
>
> Richard is really the best person to ask about this, so he's been added to 
> the cc.  My current understanding is below.  Perhaps he can respond with 
> more detail and correct any errors.
>
> In terms of original motivation, you might want to look at 34xx TRM 
> 4.12.2.4.3.  I don't think this actually works in practice on OMAP3.
>
> Current practical use is different.  Autogating only takes effect during 
> sleep & wakeup transitions for the entire CORE_Lx clockdomain (34xx TRM 
> 4.12.2.4.4).  So even if a module's functional clocks are disabled, the 
> PRCM won't autogate the module's interface clock until the entire CORE_Lx 
> clockdomain transitions to inactive.  The theory here is that this wastes 
> power and that manually disabling the interface clock when the device is 
> known to be inactive should save some power.

L3 and L4 are anyway on when not in wfi, because of sleep/wkdep, so no
power save. This is the case at least with OMAP3 not sure about OMAP2.

>
> There also was some discussion last year that modules like GPTIMER can 
> have their functional clocks enabled, but their interface clocks disabled 
> when register access is not needed.  Wakeups from the module are still 
> sent asynchronously to the PRCM.  Again the motivation is to save power.  
> I don't think the current code tries to do this.
>

In many modules there is also possibility to gate ick by HW when not
in wfi (see AUTOIDLE in SYCONFIG). I'm not sure about this but
extremely also fcks could be taken care by HW (see CLOCKACTIVITY in
SYSCONFIG).

>
> - Paul

-- 
Jouni Högander

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


RE: [PATCH 1/3] clk: introduce omap_clk_associate

2008-10-15 Thread Woodruff, Richard
> Richard is really the best person to ask about this, so he's been added
> to
> the cc.  My current understanding is below.  Perhaps he can respond with
> more detail and correct any errors.
>
> In terms of original motivation, you might want to look at 34xx TRM
> 4.12.2.4.3.  I don't think this actually works in practice on OMAP3.

See other mail response.

Paul hit some major points.

We do target auto handling on I-Clocks for active use cases.  We depend on it 
to hit our given power targets for things like MP3.  You can't handle in 
software all I clocks and even get close.  All drivers have to be just so to 
make it work.  Having individual control makes it possible especially for ones 
which are bugged in some fashion (hw or software).

Moving to some combined clock for the general case and having specific control 
of others seems like a good future goal.

Back in omap2 time the hardware designers did indicate they added all this 
flexibility as a way to compensate for possible design errors.  This was a 
correct and needed a lot in omap2 and somewhat in omap3 to meet aggressive 
power targets.  Our feed back at the time was that’s all fine, but it would 
have better to have a standard 'simple' interface which could be bypassed for 
direct usage if bugs/flexibility were needed.  All the variables which exist 
can be confusing with out a lot of explaining.

Regards,
Richard W.

N�r��yb�X��ǧv�^�)޺{.n�+{��f��{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj"��!�i

RE: [PATCH 1/3] clk: introduce omap_clk_associate

2008-10-15 Thread Woodruff, Richard
> >> Wasn't that one of the main features of the clock FW, when it was
> >> designed?
> >
> > Yes. But we adding separate ick and fck during omap2420 confused
> > that.
>
> Why this was originally done? I mean we have possibility to autogate
> interface clocks. AFAIK those could be just fine be enabled on boot and
> let
> the hw to take care of them.

Autogating only happens when you get all preconditions met.  For much of OMAP2 
time this was not the case.  For l-o I’m not sure today if it is yet the case.  
For OMAP3 this has been a target.

You do need selective control for some modules.

The ideal should be to just control F and let I be auto handled.  In retrospect 
something like v-clock's which handle the set for a module, but also have 
explicit access when its needed to individual ones.  Perhaps a v clock with 
separate id's for individual clocks...  Some of this may be good for next gen 
omaps.

Regards,
Richard W.
N�r��yb�X��ǧv�^�)޺{.n�+{��f��{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj"��!�i

Re: omapfb: help from userspace

2008-10-15 Thread Lauri Leukkunen
On 15/10/08 05:57 -0600, ext Paul Walmsley wrote:
> Hi Nathan,
> 
> On Thu, 9 Oct 2008, Nathan Monson wrote:
> 
> > On Thu, Oct 9, 2008 at 5:43 AM, Tony Lindgren <[EMAIL PROTECTED]> wrote:
> > > Nathan, good to hear that the SO mode helps. But since you seem to
> > > have it easily reproducable..
> > 
> > Reproducing is as easy as applying the DSP Bridge kernel patches and
> > then running the 'ping.out' sample like this:  while true; do
> > ping.out; done
> > 
> > > Could you try the following patch based on RMK's earlier patch
> > > without the strongly ordered patch and see if that makes any
> > > difference?
> > 
> > Maybe it lasted a few seconds longer, or maybe it was luck, but in any
> > case it eventually went into an IRQ -33 loop even with this patch.
> 
> could you try Lauri's patch posted here:
> 
> http://marc.info/?l=linux-omap&m=122407150608770&w=2
> 
> without the strongly-ordered memory patches?

I would like TI or ARM to confirm if my assumption is correct that the IRQ
will be re-raised if it gets corrupted in this way (resulting in a spurious
irq -33, which seems to be the most common one ;). If not, then this patch
will cause us to drop interrupts which is not good. Of course it is still
better than ending in a permanent loop, but only marginally.

I also tried the SO patch, result wasn't able to boot up at all (sorry, don't
have the log to show where it died).

/lauri
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: omapfb: help from userspace

2008-10-15 Thread Paul Walmsley
Hi Nathan,

On Thu, 9 Oct 2008, Nathan Monson wrote:

> On Thu, Oct 9, 2008 at 5:43 AM, Tony Lindgren <[EMAIL PROTECTED]> wrote:
> > Nathan, good to hear that the SO mode helps. But since you seem to
> > have it easily reproducable..
> 
> Reproducing is as easy as applying the DSP Bridge kernel patches and
> then running the 'ping.out' sample like this:  while true; do
> ping.out; done
> 
> > Could you try the following patch based on RMK's earlier patch
> > without the strongly ordered patch and see if that makes any
> > difference?
> 
> Maybe it lasted a few seconds longer, or maybe it was luck, but in any
> case it eventually went into an IRQ -33 loop even with this patch.

could you try Lauri's patch posted here:

http://marc.info/?l=linux-omap&m=122407150608770&w=2

without the strongly-ordered memory patches?


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


[PATCH] OMAP3: ack spurious IRQs in get_irqnr_and_base

2008-10-15 Thread Lauri Leukkunen
This prevents spurious interrupts from repeating unacked and
thus locking the system, while still allowing the spurious
bad irq error message to be show on console.

Signed-off-by: Lauri Leukkunen <[EMAIL PROTECTED]>
---
 arch/arm/plat-omap/include/mach/entry-macro.S |   21 -
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/include/mach/entry-macro.S 
b/arch/arm/plat-omap/include/mach/entry-macro.S
index a8fca9d..c88a4cb 100644
--- a/arch/arm/plat-omap/include/mach/entry-macro.S
+++ b/arch/arm/plat-omap/include/mach/entry-macro.S
@@ -87,7 +87,26 @@
ldr \irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
cmp \irqnr, #0x0
 :
-   ldrne   \irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
+#if defined(CONFIG_ARCH_OMAP34XX)
+   mov \tmp, \irqnr
+#endif
+   ldrne   \irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
+#if defined(CONFIG_ARCH_OMAP34XX)
+   mov \irqstat, \irqnr
+   bic \irqstat, \irqstat, #0x7f /* check for spurious flag */
+   cmp \irqstat, #0x0
+   beq 2223f
+   mov \irqstat, #0x1 /* Ack the spurious irq, this lets it
+   * generate a bad irq error message,
+   * but prevents infinitely repeating
+   * irq.
+   */
+   str \irqstat, [\base, #0x48] /* INTC_CONTROL register */
+2223:
+   cmp \tmp, #0x0 /* set conditional back to what it was
+   * before spurious test
+   */
+#endif
 
.endm
 
-- 
1.5.6.5

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


Re: [PATCH 2/7] input: tsc2005: move to gpiolib

2008-10-15 Thread Felipe Balbi
On Tue, Oct 14, 2008 at 04:20:04PM -0700, David Brownell wrote:
> That should be ts->irq = gpio_to_irq(dav_gpio) ...

New version below

== cut here =

>From 28368394029be3c8bbfa44c0d433bf06a64c2761 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <[EMAIL PROTECTED]>
Date: Wed, 15 Oct 2008 00:39:52 +0300
Subject: [PATCH 2/7] input: tsc2005: move to gpiolib

Get rid of omap-specific gpio calls and switch over
to gpiolib.

Cc: David Brownell <[EMAIL PROTECTED]>
Cc: Dmitry Torokhov <[EMAIL PROTECTED]>
Signed-off-by: Felipe Balbi <[EMAIL PROTECTED]>
---
 drivers/input/touchscreen/tsc2005.c |   17 +
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2005.c 
b/drivers/input/touchscreen/tsc2005.c
index 7fb107e..0c631d4 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -534,16 +534,14 @@ static int __devinit tsc2005_ts_init(struct tsc2005 *ts,
ts->dav_gpio = dav_gpio;
dev_dbg(&ts->spi->dev, "TSC2005: DAV GPIO = %d\n", dav_gpio);
 
-#ifdef CONFIG_ARCH_OMAP
-   r = omap_request_gpio(dav_gpio);
+   r = gpio_request(dav_gpio, "dav_gpio");
if (r < 0) {
dev_err(&ts->spi->dev, "unable to get DAV GPIO");
goto err1;
}
-   omap_set_gpio_direction(dav_gpio, 1);
-   ts->irq = OMAP_GPIO_IRQ(dav_gpio);
+   gpio_direction_input(dav_gpio);
+   ts->irq = gpio_to_irq(dav_gpio);
dev_dbg(&ts->spi->dev, "TSC2005: DAV IRQ = %d\n", ts->irq);
-#endif
init_timer(&ts->penup_timer);
setup_timer(&ts->penup_timer, tsc2005_ts_penup_timer_handler,
(unsigned long)ts);
@@ -612,9 +610,7 @@ err3:
tsc2005_stop_scan(ts);
input_free_device(idev);
 err2:
-#ifdef CONFIG_ARCH_OMAP
-   omap_free_gpio(dav_gpio);
-#endif
+   gpio_free(dav_gpio);
 err1:
return r;
 }
@@ -671,10 +667,7 @@ static int __devexit tsc2005_remove(struct spi_device *spi)
 
free_irq(ts->irq, ts);
input_unregister_device(ts->idev);
-
-#ifdef CONFIG_ARCH_OMAP
-   omap_free_gpio(ts->dav_gpio);
-#endif
+   gpio_free(ts->dav_gpio);
kfree(ts);
 
return 0;
-- 
1.6.0.2.307.gc427


-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] [RFC] clk: introduce clk_associate

2008-10-15 Thread Hiroshi DOYU
Hi Paul,

From: "ext Paul Walmsley" <[EMAIL PROTECTED]>
Subject: Re: [PATCH 1/3] [RFC] clk: introduce clk_associate
Date: Wed, 15 Oct 2008 03:13:49 -0600 (MDT)

> Hello Hiroshi,
> 
> On Tue, 14 Oct 2008, Hiroshi DOYU wrote:
> 
> > I understood both points you explained below, while I still think that
> > standardizing clock names may be a little bit rigid.
> 
> Perhaps you can help me understand - are you referring to the use of the 
> TRM clocks, rather than creating a custom clock for each device driver?  
> Or are you referring to the clock names used in the omap_clk_associate() 
> calls?

This has been already solved since you suggested just to use more
shorter logical name, "ick" and "fck". It would be much cleaner;)

Hiroshi DOYU

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


RE: [PATCH 2/3] Add pm-debug counters

2008-10-15 Thread Tero.Kristo


>"ext Peter 'p2' De Schrijver" <[EMAIL PROTECTED]> writes:
>
>> This patch provides the debugfs entries and a function which will be 
>> called by the PM code to register the time spent per domain 
>per state.
>>
>> Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
>> ---
>>  arch/arm/mach-omap2/pm-debug.c|  175 
>+
>>  arch/arm/mach-omap2/pm.h  |2 +
>>  2 files changed, 177 insertions(+)
>>
>> diff --git a/arch/arm/mach-omap2/pm-debug.c 
>> b/arch/arm/mach-omap2/pm-debug.c index 0b5c044..4ba6cec 100644
>> --- a/arch/arm/mach-omap2/pm-debug.c
>> +++ b/arch/arm/mach-omap2/pm-debug.c
>> @@ -29,6 +29,8 @@
>>  
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>>  
>>  #include "prm.h"
>>  #include "cm.h"
>> @@ -288,4 +290,177 @@ void omap2_pm_dump(int mode, int 
>resume, unsigned int us)
>>  printk("%-20s: 0x%08x\n", regs[i].name, regs[i].val);  }
>>  
>> +#ifdef CONFIG_DEBUG_FS
>> +#include 
>> +#include 
>> +
>> +struct dentry *pm_dbg_dir;
>> +
>> +static int pm_dbg_init_done;
>> +
>> +enum {
>> +DEBUG_FILE_COUNTERS = 0,
>> +DEBUG_FILE_TIMERS,
>> +};
>> +
>> +static const char pwrdm_state_names[][4] = {
>> +"OFF",
>> +"RET",
>> +"INA",
>> +"ON"
>> +};
>> +
>> +void pm_dbg_update_time(struct powerdomain *pwrdm, int prev) {
>> +s64 t;
>> +struct timespec now;
>> +
>> +if (!pm_dbg_init_done)
>> +return ;
>> +
>> +/* Update timer for previous state */
>> +getnstimeofday(&now);
>> +t = timespec_to_ns(&now);
>> +
>> +pwrdm->state_timer[prev] += t - pwrdm->timer;
>> +
>> +pwrdm->timer = t;
>> +}
>> +
>> +static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void 
>> +*user) {
>> +struct seq_file *s = (struct seq_file *)user;
>> +
>> +if (strcmp(clkdm->name, "emu_clkdm") == 0 ||
>> +strcmp(clkdm->name, "wkup_clkdm") == 0)
>> +return 0;
>
>Why emu and wkup are not taken into account? If wkup is closed 
>out here, I think also prm_clkdm and cm_clkdm should be.
>
>> +
>> +seq_printf(s, "%s->%s (%d)", clkdm->name,
>> +clkdm->pwrdm.ptr->name,
>> +atomic_read(&clkdm->usecount));
>> +seq_printf(s, "\n");
>> +
>> +return 0;
>> +}
>> +
>> +static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void 
>> +*user) {
>> +struct seq_file *s = (struct seq_file *)user;
>> +int i;
>> +
>> +if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
>> +strcmp(pwrdm->name, "wkup_pwrdm") == 0)
>> +return 0;
>
>Why emu is closed out here? It has pwstst register.

I closed out emu and wkup powerdomains here because they
did not show any useful information. They are missing either
prepwstst or pwstst register and this debug stuff relies on
accessibility of both of them. If you do not have one, you
get "interesting" results (missing prepwstst => OFF count hits
the roof as the software assumes you are entering off mode
during each sleep period, missing pwstst => you are in OFF state
always.) You could show the current state for emu powerdomain yes,
but not counters.

>I think 
>also dpll1..5_pwrdm should be closed out here. I'm not sure 
>why those are even modelled in a clocktree.

I tracked the powerdomain code a bit, and it seems dpll1...dpll5
are mapped to some real software accessible powerdomains. E.g. we
have dpll1 -> MPU_MOD. Now, a side effect of this is that when you
access such a powerdomain, you may alter the HW registers of another
powerdomain, which you probably did not want to do. Nasty part of this
is that some code does pwrdm_for_each() calls to modify status of
all powerdomains, like pm34xx.c. Question for Paul: Is the powerdomain
code safe against this kind of stuff? 

>
>> +
>> +if (pwrdm->state != pwrdm_read_pwrst(pwrdm))
>> +printk(KERN_ERR "pwrdm state mismatch(%s) %d != %d\n",
>> +pwrdm->name, pwrdm->state, 
>pwrdm_read_pwrst(pwrdm));
>> +
>> +seq_printf(s, "%s (%s)", pwrdm->name,
>> +pwrdm_state_names[pwrdm->state]);
>> +for (i = 0; i < 4; i++)
>> +seq_printf(s, ",%s:%d", pwrdm_state_names[i],
>> +pwrdm->state_counter[i]);
>> +
>> +seq_printf(s, "\n");
>> +
>> +return 0;
>> +}
>> +
>> +static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, void 
>> +*user) {
>> +struct seq_file *s = (struct seq_file *)user;
>> +int i;
>> +
>> +if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
>> +strcmp(pwrdm->name, "wkup_pwrdm") == 0)
>> +return 0;
>
>Same comment as above.
>
>> +
>> +pwrdm_state_switch(pwrdm);
>> +
>> +seq_printf(s, "%s (%s)", pwrdm->name,
>> +pwrdm_state_names[pwrdm->state]);
>> +
>> +for (i = 0; i < 4; i++)
>> +seq_printf(s, ",%s:%lld", pwrdm_state_names[i],
>> +pwrdm->state_timer[i]);
>> +
>> +seq_printf(s, "\n");
>> +
>> +return 0;
>> +

Re: [PATCH 1/3] [RFC] clk: introduce clk_associate

2008-10-15 Thread Paul Walmsley
Hello Hiroshi,

On Tue, 14 Oct 2008, Hiroshi DOYU wrote:

> I understood both points you explained below, while I still think that
> standardizing clock names may be a little bit rigid.

Perhaps you can help me understand - are you referring to the use of the 
TRM clocks, rather than creating a custom clock for each device driver?  
Or are you referring to the clock names used in the omap_clk_associate() 
calls?

> Thank you for your review and comments.

You're welcome,

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


Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon

2008-10-15 Thread Jean Delvare
Hi Felipe, David,

On Tue, 14 Oct 2008 14:44:51 -0700, David Brownell wrote:
> On Tuesday 14 October 2008, Felipe Balbi wrote:
> > I'd say that if it goes to the "wrong" place and doesn't bother anyone,
> > will get forgotten. Just like the whole bunch of other drivers sitting
> > in linux-omap...

You're not merging drivers upstream just to bother people, are you?

There's nothing wrong with drivers being forgotten. Each driver gets
the level of attention it deserves depending on how broken and useful
it is.

> I thought the point was to have them sit in mainline.  ;)
> 
> > Funny that most of such drivers are for nokia tablets :-p
> 
> Some of these drivers are first-of-a-kind, so these questions wouldn't
> necessarily have come up before.  That's one of the obstacles to
> mainline merge that isn't always acknowledged.

Well, as you said before, it seems we have drivers/misc exactly for
that case.

-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] clk: introduce omap_clk_associate

2008-10-15 Thread Paul Walmsley
Hello Jouni,

On Wed, 15 Oct 2008, Högander Jouni wrote:

> "ext Tony Lindgren" <[EMAIL PROTECTED]> writes:
> 
> > * Igor Stoppa <[EMAIL PROTECTED]> [081014 14:12]:
> >> On Tue, 2008-10-14 at 13:59 -0700, ext Tony Lindgren wrote:
> >> 
> >> > And that we can use same naming in the driver no matter which omap :)
> >> 
> >> Wasn't that one of the main features of the clock FW, when it was
> >> designed?
> >
> > Yes. But we adding separate ick and fck during omap2420 confused
> > that.
> 
> Why this was originally done? I mean we have possibility to autogate
> interface clocks. AFAIK those could be just fine be enabled on boot and let
> the hw to take care of them.

Richard is really the best person to ask about this, so he's been added to 
the cc.  My current understanding is below.  Perhaps he can respond with 
more detail and correct any errors.

In terms of original motivation, you might want to look at 34xx TRM 
4.12.2.4.3.  I don't think this actually works in practice on OMAP3.

Current practical use is different.  Autogating only takes effect during 
sleep & wakeup transitions for the entire CORE_Lx clockdomain (34xx TRM 
4.12.2.4.4).  So even if a module's functional clocks are disabled, the 
PRCM won't autogate the module's interface clock until the entire CORE_Lx 
clockdomain transitions to inactive.  The theory here is that this wastes 
power and that manually disabling the interface clock when the device is 
known to be inactive should save some power.

There also was some discussion last year that modules like GPTIMER can 
have their functional clocks enabled, but their interface clocks disabled 
when register access is not needed.  Wakeups from the module are still 
sent asynchronously to the PRCM.  Again the motivation is to save power.  
I don't think the current code tries to do this.


- Paul

Re: [PATCH 2/7] input: tsc2005: move to gpiolib

2008-10-15 Thread Felipe Balbi
On Tue, Oct 14, 2008 at 04:20:04PM -0700, David Brownell wrote:
> On Tuesday 14 October 2008, Felipe Balbi wrote:
> > -   omap_set_gpio_direction(dav_gpio, 1);
> > +   gpio_direction_input(dav_gpio);
> > ts->irq = OMAP_GPIO_IRQ(dav_gpio);
> 
> That should be ts->irq = gpio_to_irq(dav_gpio) ...

good catch :-)
will resend soon.

-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html