public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration
@ 2008-05-13 16:04 Sakari Ailus
  2008-05-13 16:04 ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
  2008-05-13 19:53 ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Felipe Balbi
  0 siblings, 2 replies; 17+ messages in thread
From: Sakari Ailus @ 2008-05-13 16:04 UTC (permalink / raw)
  To: linux-omap

Add invertation of image mirroring register bits to default
configuration.

This is useful when the camera module is e.g. mounted upside down.

Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
---
 drivers/media/video/tcm825x.c |    6 ++++++
 drivers/media/video/tcm825x.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/tcm825x.c b/drivers/media/video/tcm825x.c
index e57a646..216638e 100644
--- a/drivers/media/video/tcm825x.c
+++ b/drivers/media/video/tcm825x.c
@@ -523,6 +523,9 @@ static int ioctl_g_ctrl(struct v4l2_int_device *s,
 	if (val < 0)
 		return val;
 
+	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
+		val ^= sensor->platform_data->is_upside_down();
+
 	vc->value = val;
 	return 0;
 }
@@ -556,6 +559,9 @@ static int ioctl_s_ctrl(struct v4l2_int_device *s,
 	if (lvc == NULL)
 		return -EINVAL;
 
+	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
+		val ^= sensor->platform_data->is_upside_down();
+
 	val = val << lvc->start_bit;
 	if (tcm825x_write_reg_mask(client, lvc->reg, val))
 		return -EIO;
diff --git a/drivers/media/video/tcm825x.h b/drivers/media/video/tcm825x.h
index 966765b..770ebac 100644
--- a/drivers/media/video/tcm825x.h
+++ b/drivers/media/video/tcm825x.h
@@ -182,6 +182,7 @@ struct tcm825x_platform_data {
 	int (*needs_reset)(struct v4l2_int_device *s, void *buf,
 			   struct v4l2_pix_format *fmt);
 	int (*ifparm)(struct v4l2_ifparm *p);
+	int (*is_upside_down)(void);
 };
 
 /* Array of image sizes supported by TCM825X.  These must be ordered from
-- 
1.5.0.6


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/3] N810: Don't export camera orientation
  2008-05-13 16:04 [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus
@ 2008-05-13 16:04 ` Sakari Ailus
  2008-05-13 16:04   ` [PATCH 3/3] N800: Select tcm825x only if wanted Sakari Ailus
  2008-05-13 20:01   ` [PATCH 2/3] N810: Don't export camera orientation Felipe Balbi
  2008-05-13 19:53 ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Felipe Balbi
  1 sibling, 2 replies; 17+ messages in thread
From: Sakari Ailus @ 2008-05-13 16:04 UTC (permalink / raw)
  To: linux-omap

On Nokia N810 the camera module is mounted upside down. This affects
the mirroring controls. This patch inverts the controls for N810.

Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
---
 arch/arm/mach-omap2/board-n800-camera.c |   65 +++++++++++++++++++++++++++---
 1 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n800-camera.c b/arch/arm/mach-omap2/board-n800-camera.c
index 19be30d..9c2bead 100644
--- a/arch/arm/mach-omap2/board-n800-camera.c
+++ b/arch/arm/mach-omap2/board-n800-camera.c
@@ -28,6 +28,8 @@
 
 #include <media/v4l2-int-device.h>
 
+#include <asm/mach-types.h>
+
 #include <asm/arch/menelaus.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/board.h>
@@ -71,7 +73,8 @@ static int frames_after_reset;
 static int saturated_count;
 #endif
 
-const static struct tcm825x_reg tcm825x_default_regs_[] = {
+#ifdef CONFIG_MACH_NOKIA_N800
+const static struct tcm825x_reg tcm825x_regs_n800[] = {
 	/* initial settings for 2.5 V */
 	{0x00, 0x03}, {0x03, 0x29}, {0xaa, 0x2a}, {0xc0, 0x2b},
 	{0x10, 0x2c}, {0x4c, 0x2d}, {0x9c, 0x3f},
@@ -103,6 +106,42 @@ const static struct tcm825x_reg tcm825x_default_regs_[] = {
 	{0x08, 0x5c}, {0x08, 0x5d}, {0x08, 0x5e}, {0x08, 0x5f},
 	{TCM825X_VAL_TERM, TCM825X_REG_TERM}
 };
+#endif
+
+#ifdef CONFIG_MACH_NOKIA_N810
+const static struct tcm825x_reg tcm825x_regs_n810[] = {
+	/* initial settings for 2.5 V */
+	{0x00, 0x03}, {0x03, 0x29}, {0xaa, 0x2a}, {0xc0, 0x2b},
+	{0x10, 0x2c}, {0x4c, 0x2d}, {0x9c, 0x3f},
+
+	/* main settings */
+	{0x00, 0x00}, {0x30, 0x01}, {0x0e, 0x02}, /* initial */
+	{0xcf, 0x04}, {0x02, 0x05}, {0x0d, 0x06}, {0xc0, 0x07},
+	{0x38, 0x08}, {0x50, 0x09}, {0x80, 0x0a}, {0x40, 0x0b},
+	{0x40, 0x0c}, {0x00, 0x0d}, {0x04, 0x0e}, {0x04, 0x0f},
+	{0x22, 0x10}, {0x96, 0x11}, {0xf0, 0x12}, {0x08, 0x13},
+	{0x08, 0x14}, {0x30, 0x15}, {0x30, 0x16}, {0x01, 0x17},
+	{0x40, 0x18}, {0x87, 0x19}, {0x2b, 0x1a}, {0x84, 0x1b},
+	{0x52, 0x1c}, {0x44, 0x1d}, {0x68, 0x1e}, {0x00, 0x1f},
+	{0x00, 0x20}, {0x01, 0x21}, {0x27, 0x22}, {0x40, 0x23},
+	{0x27, 0x24}, {0x5f, 0x25}, {0x00, 0x26}, {0x16, 0x27},
+	{0x23, 0x28}, /* initial */ /* initial */ /* initial */
+	/* initial */ /* initial */ {0x00, 0x2e}, {0x00, 0x2f},
+	{0x00, 0x30}, {0x00, 0x31}, {0x00, 0x32}, {0x00, 0x33},
+	{0x00, 0x34}, {0x00, 0x35}, {0x00, 0x36}, {0x00, 0x37},
+	{0x00, 0x38}, {0x8c, 0x39}, {0xc8, 0x3A}, {0x80, 0x3b},
+	{0x00, 0x3c}, {0x17, 0x3d}, {0x85, 0x3e}, /* initial */
+	{0xa0, 0x40}, {0x00, 0x41}, {0x00, 0x42}, {0x00, 0x43},
+	{0x08, 0x44}, {0x12, 0x45}, {0x00, 0x46}, {0x20, 0x47},
+	{0x30, 0x48}, {0x18, 0x49}, {0x20, 0x4a}, {0x4d, 0x4b},
+	{0x0c, 0x4c}, {0xe0, 0x4d}, {0x20, 0x4e}, {0x89, 0x4f},
+	{0x21, 0x50}, {0x80, 0x51}, {0x02, 0x52}, {0x00, 0x53},
+	{0x30, 0x54}, {0x90, 0x55}, {0x40, 0x56}, {0x06, 0x57},
+	{0x0f, 0x58}, {0x23, 0x59}, {0x08, 0x5A}, {0x04, 0x5b},
+	{0x08, 0x5c}, {0x08, 0x5d}, {0x08, 0x5e}, {0x08, 0x5f},
+	{TCM825X_VAL_TERM, TCM825X_REG_TERM}
+};
+#endif
 
 static int tcm825x_is_okay(void)
 {
@@ -182,7 +221,10 @@ static int tcm825x_power_set(int power)
 
 static const struct tcm825x_reg *tcm825x_default_regs(void)
 {
-	return tcm825x_default_regs_;
+	if (machine_is_nokia_n810())
+		return tcm825x_regs_n810;
+
+	return tcm825x_regs_n800;
 }
 
 #ifdef OMAP24XX_CAMERA_JAM_HACK
@@ -298,12 +340,21 @@ static int tcm825x_ifparm(struct v4l2_ifparm *p)
 	return 0;
 }
 
+static int tcm825x_is_upside_down(void)
+{
+	if (machine_is_nokia_n810())
+		return 1;
+
+	return 0;
+}
+
 const struct tcm825x_platform_data n800_tcm825x_platform_data = {
-	.is_okay      = tcm825x_is_okay,
-	.power_set    = tcm825x_power_set,
-	.default_regs = tcm825x_default_regs,
-	.needs_reset  = tcm825x_needs_reset,
-	.ifparm	      = tcm825x_ifparm,
+	.is_okay	= tcm825x_is_okay,
+	.power_set	= tcm825x_power_set,
+	.default_regs	= tcm825x_default_regs,
+	.needs_reset	= tcm825x_needs_reset,
+	.ifparm		= tcm825x_ifparm,
+	.is_upside_down	= tcm825x_is_upside_down,
 };
 
 void __init n800_cam_init(void)
-- 
1.5.0.6


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/3] N800: Select tcm825x only if wanted
  2008-05-13 16:04 ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
@ 2008-05-13 16:04   ` Sakari Ailus
  2008-05-13 20:01   ` [PATCH 2/3] N810: Don't export camera orientation Felipe Balbi
  1 sibling, 0 replies; 17+ messages in thread
From: Sakari Ailus @ 2008-05-13 16:04 UTC (permalink / raw)
  To: linux-omap

Don't enable automatically TCM825x on N800 unless
VIDEO_HELPER_CHIPS_AUTO is selected.

Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
---
 arch/arm/mach-omap2/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 5c229cc..94beff0 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -35,7 +35,7 @@ config MACH_OMAP_GENERIC
 config MACH_NOKIA_N800
 	bool "Nokia N800"
 	depends on ARCH_OMAP2420
-	select VIDEO_TCM825X if VIDEO_OMAP2
+	select VIDEO_TCM825X if VIDEO_OMAP2 && VIDEO_HELPER_CHIPS_AUTO
 	select CBUS if VIDEO_TCM825X
 	select CBUS_RETU if VIDEO_TCM825X
 	select MENELAUS if VIDEO_TCM825X
-- 
1.5.0.6


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration
  2008-05-13 16:04 [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus
  2008-05-13 16:04 ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
@ 2008-05-13 19:53 ` Felipe Balbi
  1 sibling, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2008-05-13 19:53 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-omap



On Tue, 13 May 2008 19:04:21 +0300, Sakari Ailus <sakari.ailus@nokia.com>
wrote:
> Add invertation of image mirroring register bits to default
> configuration.
> 
> This is useful when the camera module is e.g. mounted upside down.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
> ---
>  drivers/media/video/tcm825x.c |    6 ++++++
>  drivers/media/video/tcm825x.h |    1 +
>  2 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/video/tcm825x.c
b/drivers/media/video/tcm825x.c
> index e57a646..216638e 100644
> --- a/drivers/media/video/tcm825x.c
> +++ b/drivers/media/video/tcm825x.c
> @@ -523,6 +523,9 @@ static int ioctl_g_ctrl(struct v4l2_int_device *s,
>  	if (val < 0)
>  		return val;
> 
> +	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
> +		val ^= sensor->platform_data->is_upside_down();

you didnt put any implementation of this function, but i was wondering if
bit field would be enough?

> +
>  	vc->value = val;
>  	return 0;
>  }
> @@ -556,6 +559,9 @@ static int ioctl_s_ctrl(struct v4l2_int_device *s,
>  	if (lvc == NULL)
>  		return -EINVAL;
> 
> +	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
> +		val ^= sensor->platform_data->is_upside_down();
> +
>  	val = val << lvc->start_bit;
>  	if (tcm825x_write_reg_mask(client, lvc->reg, val))
>  		return -EIO;
> diff --git a/drivers/media/video/tcm825x.h
b/drivers/media/video/tcm825x.h
> index 966765b..770ebac 100644
> --- a/drivers/media/video/tcm825x.h
> +++ b/drivers/media/video/tcm825x.h
> @@ -182,6 +182,7 @@ struct tcm825x_platform_data {
>  	int (*needs_reset)(struct v4l2_int_device *s, void *buf,
>  			   struct v4l2_pix_format *fmt);
>  	int (*ifparm)(struct v4l2_ifparm *p);
> +	int (*is_upside_down)(void);
>  };
> 
>  /* Array of image sizes supported by TCM825X.  These must be ordered
from
> --
> 1.5.0.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Best Regards,

Felipe Balbi
http://felipebalbi.com
me@felipebalbi.com


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/3] N810: Don't export camera orientation
  2008-05-13 16:04 ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
  2008-05-13 16:04   ` [PATCH 3/3] N800: Select tcm825x only if wanted Sakari Ailus
@ 2008-05-13 20:01   ` Felipe Balbi
  2008-05-14 12:04     ` Sakari Ailus
  1 sibling, 1 reply; 17+ messages in thread
From: Felipe Balbi @ 2008-05-13 20:01 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-omap



On Tue, 13 May 2008 19:04:22 +0300, Sakari Ailus <sakari.ailus@nokia.com>
wrote:
> On Nokia N810 the camera module is mounted upside down. This affects
> the mirroring controls. This patch inverts the controls for N810.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
> ---
>  arch/arm/mach-omap2/board-n800-camera.c |   65
> +++++++++++++++++++++++++++---
>  1 files changed, 58 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-n800-camera.c
> b/arch/arm/mach-omap2/board-n800-camera.c
> index 19be30d..9c2bead 100644
> --- a/arch/arm/mach-omap2/board-n800-camera.c
> +++ b/arch/arm/mach-omap2/board-n800-camera.c
> @@ -28,6 +28,8 @@
> 
>  #include <media/v4l2-int-device.h>
> 
> +#include <asm/mach-types.h>
> +
>  #include <asm/arch/menelaus.h>
>  #include <asm/arch/gpio.h>
>  #include <asm/arch/board.h>
> @@ -71,7 +73,8 @@ static int frames_after_reset;
>  static int saturated_count;
>  #endif
> 
> -const static struct tcm825x_reg tcm825x_default_regs_[] = {
> +#ifdef CONFIG_MACH_NOKIA_N800
> +const static struct tcm825x_reg tcm825x_regs_n800[] = {
>  	/* initial settings for 2.5 V */
>  	{0x00, 0x03}, {0x03, 0x29}, {0xaa, 0x2a}, {0xc0, 0x2b},
>  	{0x10, 0x2c}, {0x4c, 0x2d}, {0x9c, 0x3f},
> @@ -103,6 +106,42 @@ const static struct tcm825x_reg
> tcm825x_default_regs_[] = {
>  	{0x08, 0x5c}, {0x08, 0x5d}, {0x08, 0x5e}, {0x08, 0x5f},
>  	{TCM825X_VAL_TERM, TCM825X_REG_TERM}
>  };
> +#endif
> +
> +#ifdef CONFIG_MACH_NOKIA_N810
> +const static struct tcm825x_reg tcm825x_regs_n810[] = {
> +	/* initial settings for 2.5 V */
> +	{0x00, 0x03}, {0x03, 0x29}, {0xaa, 0x2a}, {0xc0, 0x2b},
> +	{0x10, 0x2c}, {0x4c, 0x2d}, {0x9c, 0x3f},
> +
> +	/* main settings */
> +	{0x00, 0x00}, {0x30, 0x01}, {0x0e, 0x02}, /* initial */
> +	{0xcf, 0x04}, {0x02, 0x05}, {0x0d, 0x06}, {0xc0, 0x07},
> +	{0x38, 0x08}, {0x50, 0x09}, {0x80, 0x0a}, {0x40, 0x0b},
> +	{0x40, 0x0c}, {0x00, 0x0d}, {0x04, 0x0e}, {0x04, 0x0f},
> +	{0x22, 0x10}, {0x96, 0x11}, {0xf0, 0x12}, {0x08, 0x13},
> +	{0x08, 0x14}, {0x30, 0x15}, {0x30, 0x16}, {0x01, 0x17},
> +	{0x40, 0x18}, {0x87, 0x19}, {0x2b, 0x1a}, {0x84, 0x1b},
> +	{0x52, 0x1c}, {0x44, 0x1d}, {0x68, 0x1e}, {0x00, 0x1f},
> +	{0x00, 0x20}, {0x01, 0x21}, {0x27, 0x22}, {0x40, 0x23},
> +	{0x27, 0x24}, {0x5f, 0x25}, {0x00, 0x26}, {0x16, 0x27},
> +	{0x23, 0x28}, /* initial */ /* initial */ /* initial */
> +	/* initial */ /* initial */ {0x00, 0x2e}, {0x00, 0x2f},
> +	{0x00, 0x30}, {0x00, 0x31}, {0x00, 0x32}, {0x00, 0x33},
> +	{0x00, 0x34}, {0x00, 0x35}, {0x00, 0x36}, {0x00, 0x37},
> +	{0x00, 0x38}, {0x8c, 0x39}, {0xc8, 0x3A}, {0x80, 0x3b},
> +	{0x00, 0x3c}, {0x17, 0x3d}, {0x85, 0x3e}, /* initial */
> +	{0xa0, 0x40}, {0x00, 0x41}, {0x00, 0x42}, {0x00, 0x43},
> +	{0x08, 0x44}, {0x12, 0x45}, {0x00, 0x46}, {0x20, 0x47},
> +	{0x30, 0x48}, {0x18, 0x49}, {0x20, 0x4a}, {0x4d, 0x4b},
> +	{0x0c, 0x4c}, {0xe0, 0x4d}, {0x20, 0x4e}, {0x89, 0x4f},
> +	{0x21, 0x50}, {0x80, 0x51}, {0x02, 0x52}, {0x00, 0x53},
> +	{0x30, 0x54}, {0x90, 0x55}, {0x40, 0x56}, {0x06, 0x57},
> +	{0x0f, 0x58}, {0x23, 0x59}, {0x08, 0x5A}, {0x04, 0x5b},
> +	{0x08, 0x5c}, {0x08, 0x5d}, {0x08, 0x5e}, {0x08, 0x5f},
> +	{TCM825X_VAL_TERM, TCM825X_REG_TERM}
> +};
> +#endif
> 
>  static int tcm825x_is_okay(void)
>  {
> @@ -182,7 +221,10 @@ static int tcm825x_power_set(int power)
> 
>  static const struct tcm825x_reg *tcm825x_default_regs(void)
>  {
> -	return tcm825x_default_regs_;
> +	if (machine_is_nokia_n810())
> +		return tcm825x_regs_n810;
> +
> +	return tcm825x_regs_n800;
>  }
> 
>  #ifdef OMAP24XX_CAMERA_JAM_HACK
> @@ -298,12 +340,21 @@ static int tcm825x_ifparm(struct v4l2_ifparm *p)
>  	return 0;
>  }
> 
> +static int tcm825x_is_upside_down(void)
> +{
> +	if (machine_is_nokia_n810())
> +		return 1;
> +
> +	return 0;
> +}
> +
>  const struct tcm825x_platform_data n800_tcm825x_platform_data = {
> -	.is_okay      = tcm825x_is_okay,
> -	.power_set    = tcm825x_power_set,
> -	.default_regs = tcm825x_default_regs,
> -	.needs_reset  = tcm825x_needs_reset,
> -	.ifparm	      = tcm825x_ifparm,
> +	.is_okay	= tcm825x_is_okay,
> +	.power_set	= tcm825x_power_set,
> +	.default_regs	= tcm825x_default_regs,
> +	.needs_reset	= tcm825x_needs_reset,
> +	.ifparm		= tcm825x_ifparm,
> +	.is_upside_down	= tcm825x_is_upside_down,

ok, now i got your point but this could be:
.is_upside_down = machine_is_nokia_n810() ? 1 : 0,

>  };
> 
>  void __init n800_cam_init(void)
> --
> 1.5.0.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Best Regards,

Felipe Balbi
http://felipebalbi.com
me@felipebalbi.com


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/3] N810: Don't export camera orientation
  2008-05-13 20:01   ` [PATCH 2/3] N810: Don't export camera orientation Felipe Balbi
@ 2008-05-14 12:04     ` Sakari Ailus
  2008-05-14 12:05       ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus
  2008-05-14 22:58       ` [PATCH 2/3] N810: Don't export camera orientation Felipe Balbi
  0 siblings, 2 replies; 17+ messages in thread
From: Sakari Ailus @ 2008-05-14 12:04 UTC (permalink / raw)
  To: ext Felipe Balbi; +Cc: linux-omap

ext Felipe Balbi wrote:

Hello Felipe, and thanks for reviewing the patch! :)

> On Tue, 13 May 2008 19:04:22 +0300, Sakari Ailus <sakari.ailus@nokia.com>
> wrote:
>> @@ -298,12 +340,21 @@ static int tcm825x_ifparm(struct v4l2_ifparm *p)
>>  	return 0;
>>  }
>>
>> +static int tcm825x_is_upside_down(void)
>> +{
>> +	if (machine_is_nokia_n810())
>> +		return 1;
>> +
>> +	return 0;
>> +}
>> +
>>  const struct tcm825x_platform_data n800_tcm825x_platform_data = {
>> -	.is_okay      = tcm825x_is_okay,
>> -	.power_set    = tcm825x_power_set,
>> -	.default_regs = tcm825x_default_regs,
>> -	.needs_reset  = tcm825x_needs_reset,
>> -	.ifparm	      = tcm825x_ifparm,
>> +	.is_okay	= tcm825x_is_okay,
>> +	.power_set	= tcm825x_power_set,
>> +	.default_regs	= tcm825x_default_regs,
>> +	.needs_reset	= tcm825x_needs_reset,
>> +	.ifparm		= tcm825x_ifparm,
>> +	.is_upside_down	= tcm825x_is_upside_down,
> 
> ok, now i got your point but this could be:
> .is_upside_down = machine_is_nokia_n810() ? 1 : 0,

This doesn't work because machine_is_nokia_n810() is not constant.

Anyway, tcm825x_is_upside_down can be made more simple as it could just 
return machine_is_nokia_n810().

I'll send new patches.

-- 
Sakari Ailus
sakari.ailus@nokia.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration
  2008-05-14 12:04     ` Sakari Ailus
@ 2008-05-14 12:05       ` Sakari Ailus
  2008-05-14 12:05         ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
  2008-05-16 17:42         ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Tony Lindgren
  2008-05-14 22:58       ` [PATCH 2/3] N810: Don't export camera orientation Felipe Balbi
  1 sibling, 2 replies; 17+ messages in thread
From: Sakari Ailus @ 2008-05-14 12:05 UTC (permalink / raw)
  To: linux-omap

Add invertation of image mirroring register bits to default
configuration.

This is useful when the camera module is e.g. mounted upside down.

Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
---
 drivers/media/video/tcm825x.c |    6 ++++++
 drivers/media/video/tcm825x.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/tcm825x.c b/drivers/media/video/tcm825x.c
index e57a646..216638e 100644
--- a/drivers/media/video/tcm825x.c
+++ b/drivers/media/video/tcm825x.c
@@ -523,6 +523,9 @@ static int ioctl_g_ctrl(struct v4l2_int_device *s,
 	if (val < 0)
 		return val;
 
+	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
+		val ^= sensor->platform_data->is_upside_down();
+
 	vc->value = val;
 	return 0;
 }
@@ -556,6 +559,9 @@ static int ioctl_s_ctrl(struct v4l2_int_device *s,
 	if (lvc == NULL)
 		return -EINVAL;
 
+	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
+		val ^= sensor->platform_data->is_upside_down();
+
 	val = val << lvc->start_bit;
 	if (tcm825x_write_reg_mask(client, lvc->reg, val))
 		return -EIO;
diff --git a/drivers/media/video/tcm825x.h b/drivers/media/video/tcm825x.h
index 966765b..770ebac 100644
--- a/drivers/media/video/tcm825x.h
+++ b/drivers/media/video/tcm825x.h
@@ -182,6 +182,7 @@ struct tcm825x_platform_data {
 	int (*needs_reset)(struct v4l2_int_device *s, void *buf,
 			   struct v4l2_pix_format *fmt);
 	int (*ifparm)(struct v4l2_ifparm *p);
+	int (*is_upside_down)(void);
 };
 
 /* Array of image sizes supported by TCM825X.  These must be ordered from
-- 
1.5.0.6


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/3] N810: Don't export camera orientation
  2008-05-14 12:05       ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus
@ 2008-05-14 12:05         ` Sakari Ailus
  2008-05-14 12:05           ` [PATCH 3/3] N800: Select tcm825x only if wanted Sakari Ailus
  2008-05-16 17:44           ` [PATCH 2/3] N810: Don't export camera orientation Tony Lindgren
  2008-05-16 17:42         ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Tony Lindgren
  1 sibling, 2 replies; 17+ messages in thread
From: Sakari Ailus @ 2008-05-14 12:05 UTC (permalink / raw)
  To: linux-omap

On Nokia N810 the camera module is mounted upside down. This affects
the mirroring controls. This patch inverts the controls for N810.

Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
---
 arch/arm/mach-omap2/board-n800-camera.c |   62 +++++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n800-camera.c b/arch/arm/mach-omap2/board-n800-camera.c
index 19be30d..b525125 100644
--- a/arch/arm/mach-omap2/board-n800-camera.c
+++ b/arch/arm/mach-omap2/board-n800-camera.c
@@ -28,6 +28,8 @@
 
 #include <media/v4l2-int-device.h>
 
+#include <asm/mach-types.h>
+
 #include <asm/arch/menelaus.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/board.h>
@@ -71,7 +73,8 @@ static int frames_after_reset;
 static int saturated_count;
 #endif
 
-const static struct tcm825x_reg tcm825x_default_regs_[] = {
+#ifdef CONFIG_MACH_NOKIA_N800
+const static struct tcm825x_reg tcm825x_regs_n800[] = {
 	/* initial settings for 2.5 V */
 	{0x00, 0x03}, {0x03, 0x29}, {0xaa, 0x2a}, {0xc0, 0x2b},
 	{0x10, 0x2c}, {0x4c, 0x2d}, {0x9c, 0x3f},
@@ -103,6 +106,42 @@ const static struct tcm825x_reg tcm825x_default_regs_[] = {
 	{0x08, 0x5c}, {0x08, 0x5d}, {0x08, 0x5e}, {0x08, 0x5f},
 	{TCM825X_VAL_TERM, TCM825X_REG_TERM}
 };
+#endif
+
+#ifdef CONFIG_MACH_NOKIA_N810
+const static struct tcm825x_reg tcm825x_regs_n810[] = {
+	/* initial settings for 2.5 V */
+	{0x00, 0x03}, {0x03, 0x29}, {0xaa, 0x2a}, {0xc0, 0x2b},
+	{0x10, 0x2c}, {0x4c, 0x2d}, {0x9c, 0x3f},
+
+	/* main settings */
+	{0x00, 0x00}, {0x30, 0x01}, {0x0e, 0x02}, /* initial */
+	{0xcf, 0x04}, {0x02, 0x05}, {0x0d, 0x06}, {0xc0, 0x07},
+	{0x38, 0x08}, {0x50, 0x09}, {0x80, 0x0a}, {0x40, 0x0b},
+	{0x40, 0x0c}, {0x00, 0x0d}, {0x04, 0x0e}, {0x04, 0x0f},
+	{0x22, 0x10}, {0x96, 0x11}, {0xf0, 0x12}, {0x08, 0x13},
+	{0x08, 0x14}, {0x30, 0x15}, {0x30, 0x16}, {0x01, 0x17},
+	{0x40, 0x18}, {0x87, 0x19}, {0x2b, 0x1a}, {0x84, 0x1b},
+	{0x52, 0x1c}, {0x44, 0x1d}, {0x68, 0x1e}, {0x00, 0x1f},
+	{0x00, 0x20}, {0x01, 0x21}, {0x27, 0x22}, {0x40, 0x23},
+	{0x27, 0x24}, {0x5f, 0x25}, {0x00, 0x26}, {0x16, 0x27},
+	{0x23, 0x28}, /* initial */ /* initial */ /* initial */
+	/* initial */ /* initial */ {0x00, 0x2e}, {0x00, 0x2f},
+	{0x00, 0x30}, {0x00, 0x31}, {0x00, 0x32}, {0x00, 0x33},
+	{0x00, 0x34}, {0x00, 0x35}, {0x00, 0x36}, {0x00, 0x37},
+	{0x00, 0x38}, {0x8c, 0x39}, {0xc8, 0x3A}, {0x80, 0x3b},
+	{0x00, 0x3c}, {0x17, 0x3d}, {0x85, 0x3e}, /* initial */
+	{0xa0, 0x40}, {0x00, 0x41}, {0x00, 0x42}, {0x00, 0x43},
+	{0x08, 0x44}, {0x12, 0x45}, {0x00, 0x46}, {0x20, 0x47},
+	{0x30, 0x48}, {0x18, 0x49}, {0x20, 0x4a}, {0x4d, 0x4b},
+	{0x0c, 0x4c}, {0xe0, 0x4d}, {0x20, 0x4e}, {0x89, 0x4f},
+	{0x21, 0x50}, {0x80, 0x51}, {0x02, 0x52}, {0x00, 0x53},
+	{0x30, 0x54}, {0x90, 0x55}, {0x40, 0x56}, {0x06, 0x57},
+	{0x0f, 0x58}, {0x23, 0x59}, {0x08, 0x5A}, {0x04, 0x5b},
+	{0x08, 0x5c}, {0x08, 0x5d}, {0x08, 0x5e}, {0x08, 0x5f},
+	{TCM825X_VAL_TERM, TCM825X_REG_TERM}
+};
+#endif
 
 static int tcm825x_is_okay(void)
 {
@@ -182,7 +221,10 @@ static int tcm825x_power_set(int power)
 
 static const struct tcm825x_reg *tcm825x_default_regs(void)
 {
-	return tcm825x_default_regs_;
+	if (machine_is_nokia_n810())
+		return tcm825x_regs_n810;
+
+	return tcm825x_regs_n800;
 }
 
 #ifdef OMAP24XX_CAMERA_JAM_HACK
@@ -298,12 +340,18 @@ static int tcm825x_ifparm(struct v4l2_ifparm *p)
 	return 0;
 }
 
+static int tcm825x_is_upside_down(void)
+{
+	return machine_is_nokia_n810();
+}
+
 const struct tcm825x_platform_data n800_tcm825x_platform_data = {
-	.is_okay      = tcm825x_is_okay,
-	.power_set    = tcm825x_power_set,
-	.default_regs = tcm825x_default_regs,
-	.needs_reset  = tcm825x_needs_reset,
-	.ifparm	      = tcm825x_ifparm,
+	.is_okay	= tcm825x_is_okay,
+	.power_set	= tcm825x_power_set,
+	.default_regs	= tcm825x_default_regs,
+	.needs_reset	= tcm825x_needs_reset,
+	.ifparm		= tcm825x_ifparm,
+	.is_upside_down	= tcm825x_is_upside_down,
 };
 
 void __init n800_cam_init(void)
-- 
1.5.0.6


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/3] N800: Select tcm825x only if wanted
  2008-05-14 12:05         ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
@ 2008-05-14 12:05           ` Sakari Ailus
  2008-05-16 17:44             ` Tony Lindgren
  2008-05-16 17:44           ` [PATCH 2/3] N810: Don't export camera orientation Tony Lindgren
  1 sibling, 1 reply; 17+ messages in thread
From: Sakari Ailus @ 2008-05-14 12:05 UTC (permalink / raw)
  To: linux-omap

Don't enable automatically TCM825x on N800 unless
VIDEO_HELPER_CHIPS_AUTO is selected.

Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
---
 arch/arm/mach-omap2/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 5c229cc..94beff0 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -35,7 +35,7 @@ config MACH_OMAP_GENERIC
 config MACH_NOKIA_N800
 	bool "Nokia N800"
 	depends on ARCH_OMAP2420
-	select VIDEO_TCM825X if VIDEO_OMAP2
+	select VIDEO_TCM825X if VIDEO_OMAP2 && VIDEO_HELPER_CHIPS_AUTO
 	select CBUS if VIDEO_TCM825X
 	select CBUS_RETU if VIDEO_TCM825X
 	select MENELAUS if VIDEO_TCM825X
-- 
1.5.0.6


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/3] N810: Don't export camera orientation
  2008-05-14 12:04     ` Sakari Ailus
  2008-05-14 12:05       ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus
@ 2008-05-14 22:58       ` Felipe Balbi
  2008-05-15  6:54         ` andrzej zaborowski
  1 sibling, 1 reply; 17+ messages in thread
From: Felipe Balbi @ 2008-05-14 22:58 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: ext Felipe Balbi, linux-omap

On Wed, May 14, 2008 at 03:04:37PM +0300, Sakari Ailus wrote:
> ext Felipe Balbi wrote:
>
> Hello Felipe, and thanks for reviewing the patch! :)
>
>> On Tue, 13 May 2008 19:04:22 +0300, Sakari Ailus <sakari.ailus@nokia.com>
>> wrote:
>>> @@ -298,12 +340,21 @@ static int tcm825x_ifparm(struct v4l2_ifparm *p)
>>>  	return 0;
>>>  }
>>>
>>> +static int tcm825x_is_upside_down(void)
>>> +{
>>> +	if (machine_is_nokia_n810())
>>> +		return 1;
>>> +
>>> +	return 0;
>>> +}
>>> +
>>>  const struct tcm825x_platform_data n800_tcm825x_platform_data = {
>>> -	.is_okay      = tcm825x_is_okay,
>>> -	.power_set    = tcm825x_power_set,
>>> -	.default_regs = tcm825x_default_regs,
>>> -	.needs_reset  = tcm825x_needs_reset,
>>> -	.ifparm	      = tcm825x_ifparm,
>>> +	.is_okay	= tcm825x_is_okay,
>>> +	.power_set	= tcm825x_power_set,
>>> +	.default_regs	= tcm825x_default_regs,
>>> +	.needs_reset	= tcm825x_needs_reset,
>>> +	.ifparm		= tcm825x_ifparm,
>>> +	.is_upside_down	= tcm825x_is_upside_down,
>>
>> ok, now i got your point but this could be:
>> .is_upside_down = machine_is_nokia_n810() ? 1 : 0,
>
> This doesn't work because machine_is_nokia_n810() is not constant.
>
> Anyway, tcm825x_is_upside_down can be made more simple as it could just  
> return machine_is_nokia_n810().
>
> I'll send new patches.

Didn't quite get, machine_is_nokia_n810() will always be true when
running in n810. Could you clarify a bit :-p

-- 
Best Regards,

Felipe Balbi
me@felipebalbi.com
http://blog.felipebalbi.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/3] N810: Don't export camera orientation
  2008-05-14 22:58       ` [PATCH 2/3] N810: Don't export camera orientation Felipe Balbi
@ 2008-05-15  6:54         ` andrzej zaborowski
  2008-05-15  7:57           ` Felipe Balbi
  0 siblings, 1 reply; 17+ messages in thread
From: andrzej zaborowski @ 2008-05-15  6:54 UTC (permalink / raw)
  To: me; +Cc: Sakari Ailus, linux-omap

On 15/05/2008, Felipe Balbi <me@felipebalbi.com> wrote:
> On Wed, May 14, 2008 at 03:04:37PM +0300, Sakari Ailus wrote:
>  > ext Felipe Balbi wrote:
>  >
>  > Hello Felipe, and thanks for reviewing the patch! :)
>  >
>  >> On Tue, 13 May 2008 19:04:22 +0300, Sakari Ailus <sakari.ailus@nokia.com>
>  >> wrote:
>  >>> @@ -298,12 +340,21 @@ static int tcm825x_ifparm(struct v4l2_ifparm *p)
>  >>>     return 0;
>  >>>  }
>  >>>
>  >>> +static int tcm825x_is_upside_down(void)
>  >>> +{
>  >>> +   if (machine_is_nokia_n810())
>  >>> +           return 1;
>  >>> +
>  >>> +   return 0;
>  >>> +}
>  >>> +
>  >>>  const struct tcm825x_platform_data n800_tcm825x_platform_data = {
>  >>> -   .is_okay      = tcm825x_is_okay,
>  >>> -   .power_set    = tcm825x_power_set,
>  >>> -   .default_regs = tcm825x_default_regs,
>  >>> -   .needs_reset  = tcm825x_needs_reset,
>  >>> -   .ifparm       = tcm825x_ifparm,
>  >>> +   .is_okay        = tcm825x_is_okay,
>  >>> +   .power_set      = tcm825x_power_set,
>  >>> +   .default_regs   = tcm825x_default_regs,
>  >>> +   .needs_reset    = tcm825x_needs_reset,
>  >>> +   .ifparm         = tcm825x_ifparm,
>  >>> +   .is_upside_down = tcm825x_is_upside_down,
>  >>
>  >> ok, now i got your point but this could be:
>  >> .is_upside_down = machine_is_nokia_n810() ? 1 : 0,
>  >
>  > This doesn't work because machine_is_nokia_n810() is not constant.
>  >
>  > Anyway, tcm825x_is_upside_down can be made more simple as it could just
>  > return machine_is_nokia_n810().
>  >
>  > I'll send new patches.
>
>  Didn't quite get, machine_is_nokia_n810() will always be true when
>  running in n810. Could you clarify a bit :-p

It'll *return* true, but C initialisers must be constants.  It simply
wouldn't compile.

Cheers
-- 
Please do not print this email unless absolutely necessary. Spread
environmental awareness.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/3] N810: Don't export camera orientation
  2008-05-15  6:54         ` andrzej zaborowski
@ 2008-05-15  7:57           ` Felipe Balbi
  2008-05-15  8:11             ` andrzej zaborowski
  0 siblings, 1 reply; 17+ messages in thread
From: Felipe Balbi @ 2008-05-15  7:57 UTC (permalink / raw)
  To: andrzej zaborowski; +Cc: me, Sakari Ailus, linux-omap

On Thu, May 15, 2008 at 08:54:34AM +0200, andrzej zaborowski wrote:
> On 15/05/2008, Felipe Balbi <me@felipebalbi.com> wrote:
> > On Wed, May 14, 2008 at 03:04:37PM +0300, Sakari Ailus wrote:
> >  > ext Felipe Balbi wrote:
> >  >
> >  > Hello Felipe, and thanks for reviewing the patch! :)
> >  >
> >  >> On Tue, 13 May 2008 19:04:22 +0300, Sakari Ailus <sakari.ailus@nokia.com>
> >  >> wrote:
> >  >>> @@ -298,12 +340,21 @@ static int tcm825x_ifparm(struct v4l2_ifparm *p)
> >  >>>     return 0;
> >  >>>  }
> >  >>>
> >  >>> +static int tcm825x_is_upside_down(void)
> >  >>> +{
> >  >>> +   if (machine_is_nokia_n810())
> >  >>> +           return 1;
> >  >>> +
> >  >>> +   return 0;
> >  >>> +}
> >  >>> +
> >  >>>  const struct tcm825x_platform_data n800_tcm825x_platform_data = {
> >  >>> -   .is_okay      = tcm825x_is_okay,
> >  >>> -   .power_set    = tcm825x_power_set,
> >  >>> -   .default_regs = tcm825x_default_regs,
> >  >>> -   .needs_reset  = tcm825x_needs_reset,
> >  >>> -   .ifparm       = tcm825x_ifparm,
> >  >>> +   .is_okay        = tcm825x_is_okay,
> >  >>> +   .power_set      = tcm825x_power_set,
> >  >>> +   .default_regs   = tcm825x_default_regs,
> >  >>> +   .needs_reset    = tcm825x_needs_reset,
> >  >>> +   .ifparm         = tcm825x_ifparm,
> >  >>> +   .is_upside_down = tcm825x_is_upside_down,
> >  >>
> >  >> ok, now i got your point but this could be:
> >  >> .is_upside_down = machine_is_nokia_n810() ? 1 : 0,
> >  >
> >  > This doesn't work because machine_is_nokia_n810() is not constant.
> >  >
> >  > Anyway, tcm825x_is_upside_down can be made more simple as it could just
> >  > return machine_is_nokia_n810().
> >  >
> >  > I'll send new patches.
> >
> >  Didn't quite get, machine_is_nokia_n810() will always be true when
> >  running in n810. Could you clarify a bit :-p
> 
> It'll *return* true, but C initialisers must be constants.  It simply
> wouldn't compile.

and that's why i was using ?:

machine_is_nokia_n810 ? 1 : 0

the same as:

if (machine_is_nokia_n810)
	return 1;
else
	return 0;

> 
> Cheers
> -- 
> Please do not print this email unless absolutely necessary. Spread
> environmental awareness.

-- 
Best Regards,

Felipe Balbi
me@felipebalbi.com
http://blog.felipebalbi.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/3] N810: Don't export camera orientation
  2008-05-15  7:57           ` Felipe Balbi
@ 2008-05-15  8:11             ` andrzej zaborowski
  2008-05-15  8:17               ` Felipe Balbi
  0 siblings, 1 reply; 17+ messages in thread
From: andrzej zaborowski @ 2008-05-15  8:11 UTC (permalink / raw)
  To: me; +Cc: Sakari Ailus, linux-omap

On 15/05/2008, Felipe Balbi <me@felipebalbi.com> wrote:
> On Thu, May 15, 2008 at 08:54:34AM +0200, andrzej zaborowski wrote:
>  > On 15/05/2008, Felipe Balbi <me@felipebalbi.com> wrote:
>  > > On Wed, May 14, 2008 at 03:04:37PM +0300, Sakari Ailus wrote:
>  > >  > ext Felipe Balbi wrote:
>  > >  >
>  > >  > Hello Felipe, and thanks for reviewing the patch! :)
>  > >  >
>  > >  >> On Tue, 13 May 2008 19:04:22 +0300, Sakari Ailus <sakari.ailus@nokia.com>
>  > >  >> wrote:
>  > >  >>> @@ -298,12 +340,21 @@ static int tcm825x_ifparm(struct v4l2_ifparm *p)
>  > >  >>>     return 0;
>  > >  >>>  }
>  > >  >>>
>  > >  >>> +static int tcm825x_is_upside_down(void)
>  > >  >>> +{
>  > >  >>> +   if (machine_is_nokia_n810())
>  > >  >>> +           return 1;
>  > >  >>> +
>  > >  >>> +   return 0;
>  > >  >>> +}
>  > >  >>> +
>  > >  >>>  const struct tcm825x_platform_data n800_tcm825x_platform_data = {
>  > >  >>> -   .is_okay      = tcm825x_is_okay,
>  > >  >>> -   .power_set    = tcm825x_power_set,
>  > >  >>> -   .default_regs = tcm825x_default_regs,
>  > >  >>> -   .needs_reset  = tcm825x_needs_reset,
>  > >  >>> -   .ifparm       = tcm825x_ifparm,
>  > >  >>> +   .is_okay        = tcm825x_is_okay,
>  > >  >>> +   .power_set      = tcm825x_power_set,
>  > >  >>> +   .default_regs   = tcm825x_default_regs,
>  > >  >>> +   .needs_reset    = tcm825x_needs_reset,
>  > >  >>> +   .ifparm         = tcm825x_ifparm,
>  > >  >>> +   .is_upside_down = tcm825x_is_upside_down,
>  > >  >>
>  > >  >> ok, now i got your point but this could be:
>  > >  >> .is_upside_down = machine_is_nokia_n810() ? 1 : 0,
>  > >  >
>  > >  > This doesn't work because machine_is_nokia_n810() is not constant.
>  > >  >
>  > >  > Anyway, tcm825x_is_upside_down can be made more simple as it could just
>  > >  > return machine_is_nokia_n810().
>  > >  >
>  > >  > I'll send new patches.
>  > >
>  > >  Didn't quite get, machine_is_nokia_n810() will always be true when
>  > >  running in n810. Could you clarify a bit :-p
>  >
>  > It'll *return* true, but C initialisers must be constants.  It simply
>  > wouldn't compile.
>
>
> and that's why i was using ?:
>
>
>  machine_is_nokia_n810 ? 1 : 0

This doesn't change anything - since machine_is_... is not constant,
the whole expression is not constant and is a syntax error.  The
compiler needs to know at compile time whether to store a 0 or a 1 in
the initialiser.
-- 
Please do not print this email unless absolutely necessary. Spread
environmental awareness.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/3] N810: Don't export camera orientation
  2008-05-15  8:11             ` andrzej zaborowski
@ 2008-05-15  8:17               ` Felipe Balbi
  0 siblings, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2008-05-15  8:17 UTC (permalink / raw)
  To: andrzej zaborowski; +Cc: me, Sakari Ailus, linux-omap

On Thu, May 15, 2008 at 10:11:59AM +0200, andrzej zaborowski wrote:
> This doesn't change anything - since machine_is_... is not constant,
> the whole expression is not constant and is a syntax error.  The
> compiler needs to know at compile time whether to store a 0 or a 1 in
> the initialiser.

ugh, that's true :-p
forget about it.

-- 
Best Regards,

Felipe Balbi
me@felipebalbi.com
http://blog.felipebalbi.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration
  2008-05-14 12:05       ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus
  2008-05-14 12:05         ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
@ 2008-05-16 17:42         ` Tony Lindgren
  1 sibling, 0 replies; 17+ messages in thread
From: Tony Lindgren @ 2008-05-16 17:42 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-omap

* Sakari Ailus <sakari.ailus@nokia.com> [080514 06:37]:
> Add invertation of image mirroring register bits to default
> configuration.
> 
> This is useful when the camera module is e.g. mounted upside down.

Pushing today.

Tony

> Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
> ---
>  drivers/media/video/tcm825x.c |    6 ++++++
>  drivers/media/video/tcm825x.h |    1 +
>  2 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/video/tcm825x.c b/drivers/media/video/tcm825x.c
> index e57a646..216638e 100644
> --- a/drivers/media/video/tcm825x.c
> +++ b/drivers/media/video/tcm825x.c
> @@ -523,6 +523,9 @@ static int ioctl_g_ctrl(struct v4l2_int_device *s,
>  	if (val < 0)
>  		return val;
>  
> +	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
> +		val ^= sensor->platform_data->is_upside_down();
> +
>  	vc->value = val;
>  	return 0;
>  }
> @@ -556,6 +559,9 @@ static int ioctl_s_ctrl(struct v4l2_int_device *s,
>  	if (lvc == NULL)
>  		return -EINVAL;
>  
> +	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
> +		val ^= sensor->platform_data->is_upside_down();
> +
>  	val = val << lvc->start_bit;
>  	if (tcm825x_write_reg_mask(client, lvc->reg, val))
>  		return -EIO;
> diff --git a/drivers/media/video/tcm825x.h b/drivers/media/video/tcm825x.h
> index 966765b..770ebac 100644
> --- a/drivers/media/video/tcm825x.h
> +++ b/drivers/media/video/tcm825x.h
> @@ -182,6 +182,7 @@ struct tcm825x_platform_data {
>  	int (*needs_reset)(struct v4l2_int_device *s, void *buf,
>  			   struct v4l2_pix_format *fmt);
>  	int (*ifparm)(struct v4l2_ifparm *p);
> +	int (*is_upside_down)(void);
>  };
>  
>  /* Array of image sizes supported by TCM825X.  These must be ordered from
> -- 
> 1.5.0.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/3] N810: Don't export camera orientation
  2008-05-14 12:05         ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
  2008-05-14 12:05           ` [PATCH 3/3] N800: Select tcm825x only if wanted Sakari Ailus
@ 2008-05-16 17:44           ` Tony Lindgren
  1 sibling, 0 replies; 17+ messages in thread
From: Tony Lindgren @ 2008-05-16 17:44 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-omap

* Sakari Ailus <sakari.ailus@nokia.com> [080514 06:37]:
> On Nokia N810 the camera module is mounted upside down. This affects
> the mirroring controls. This patch inverts the controls for N810.

Pushing.

Tony

> 
> Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
> ---
>  arch/arm/mach-omap2/board-n800-camera.c |   62 +++++++++++++++++++++++++++---
>  1 files changed, 55 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-n800-camera.c b/arch/arm/mach-omap2/board-n800-camera.c
> index 19be30d..b525125 100644
> --- a/arch/arm/mach-omap2/board-n800-camera.c
> +++ b/arch/arm/mach-omap2/board-n800-camera.c
> @@ -28,6 +28,8 @@
>  
>  #include <media/v4l2-int-device.h>
>  
> +#include <asm/mach-types.h>
> +
>  #include <asm/arch/menelaus.h>
>  #include <asm/arch/gpio.h>
>  #include <asm/arch/board.h>
> @@ -71,7 +73,8 @@ static int frames_after_reset;
>  static int saturated_count;
>  #endif
>  
> -const static struct tcm825x_reg tcm825x_default_regs_[] = {
> +#ifdef CONFIG_MACH_NOKIA_N800
> +const static struct tcm825x_reg tcm825x_regs_n800[] = {
>  	/* initial settings for 2.5 V */
>  	{0x00, 0x03}, {0x03, 0x29}, {0xaa, 0x2a}, {0xc0, 0x2b},
>  	{0x10, 0x2c}, {0x4c, 0x2d}, {0x9c, 0x3f},
> @@ -103,6 +106,42 @@ const static struct tcm825x_reg tcm825x_default_regs_[] = {
>  	{0x08, 0x5c}, {0x08, 0x5d}, {0x08, 0x5e}, {0x08, 0x5f},
>  	{TCM825X_VAL_TERM, TCM825X_REG_TERM}
>  };
> +#endif
> +
> +#ifdef CONFIG_MACH_NOKIA_N810
> +const static struct tcm825x_reg tcm825x_regs_n810[] = {
> +	/* initial settings for 2.5 V */
> +	{0x00, 0x03}, {0x03, 0x29}, {0xaa, 0x2a}, {0xc0, 0x2b},
> +	{0x10, 0x2c}, {0x4c, 0x2d}, {0x9c, 0x3f},
> +
> +	/* main settings */
> +	{0x00, 0x00}, {0x30, 0x01}, {0x0e, 0x02}, /* initial */
> +	{0xcf, 0x04}, {0x02, 0x05}, {0x0d, 0x06}, {0xc0, 0x07},
> +	{0x38, 0x08}, {0x50, 0x09}, {0x80, 0x0a}, {0x40, 0x0b},
> +	{0x40, 0x0c}, {0x00, 0x0d}, {0x04, 0x0e}, {0x04, 0x0f},
> +	{0x22, 0x10}, {0x96, 0x11}, {0xf0, 0x12}, {0x08, 0x13},
> +	{0x08, 0x14}, {0x30, 0x15}, {0x30, 0x16}, {0x01, 0x17},
> +	{0x40, 0x18}, {0x87, 0x19}, {0x2b, 0x1a}, {0x84, 0x1b},
> +	{0x52, 0x1c}, {0x44, 0x1d}, {0x68, 0x1e}, {0x00, 0x1f},
> +	{0x00, 0x20}, {0x01, 0x21}, {0x27, 0x22}, {0x40, 0x23},
> +	{0x27, 0x24}, {0x5f, 0x25}, {0x00, 0x26}, {0x16, 0x27},
> +	{0x23, 0x28}, /* initial */ /* initial */ /* initial */
> +	/* initial */ /* initial */ {0x00, 0x2e}, {0x00, 0x2f},
> +	{0x00, 0x30}, {0x00, 0x31}, {0x00, 0x32}, {0x00, 0x33},
> +	{0x00, 0x34}, {0x00, 0x35}, {0x00, 0x36}, {0x00, 0x37},
> +	{0x00, 0x38}, {0x8c, 0x39}, {0xc8, 0x3A}, {0x80, 0x3b},
> +	{0x00, 0x3c}, {0x17, 0x3d}, {0x85, 0x3e}, /* initial */
> +	{0xa0, 0x40}, {0x00, 0x41}, {0x00, 0x42}, {0x00, 0x43},
> +	{0x08, 0x44}, {0x12, 0x45}, {0x00, 0x46}, {0x20, 0x47},
> +	{0x30, 0x48}, {0x18, 0x49}, {0x20, 0x4a}, {0x4d, 0x4b},
> +	{0x0c, 0x4c}, {0xe0, 0x4d}, {0x20, 0x4e}, {0x89, 0x4f},
> +	{0x21, 0x50}, {0x80, 0x51}, {0x02, 0x52}, {0x00, 0x53},
> +	{0x30, 0x54}, {0x90, 0x55}, {0x40, 0x56}, {0x06, 0x57},
> +	{0x0f, 0x58}, {0x23, 0x59}, {0x08, 0x5A}, {0x04, 0x5b},
> +	{0x08, 0x5c}, {0x08, 0x5d}, {0x08, 0x5e}, {0x08, 0x5f},
> +	{TCM825X_VAL_TERM, TCM825X_REG_TERM}
> +};
> +#endif
>  
>  static int tcm825x_is_okay(void)
>  {
> @@ -182,7 +221,10 @@ static int tcm825x_power_set(int power)
>  
>  static const struct tcm825x_reg *tcm825x_default_regs(void)
>  {
> -	return tcm825x_default_regs_;
> +	if (machine_is_nokia_n810())
> +		return tcm825x_regs_n810;
> +
> +	return tcm825x_regs_n800;
>  }
>  
>  #ifdef OMAP24XX_CAMERA_JAM_HACK
> @@ -298,12 +340,18 @@ static int tcm825x_ifparm(struct v4l2_ifparm *p)
>  	return 0;
>  }
>  
> +static int tcm825x_is_upside_down(void)
> +{
> +	return machine_is_nokia_n810();
> +}
> +
>  const struct tcm825x_platform_data n800_tcm825x_platform_data = {
> -	.is_okay      = tcm825x_is_okay,
> -	.power_set    = tcm825x_power_set,
> -	.default_regs = tcm825x_default_regs,
> -	.needs_reset  = tcm825x_needs_reset,
> -	.ifparm	      = tcm825x_ifparm,
> +	.is_okay	= tcm825x_is_okay,
> +	.power_set	= tcm825x_power_set,
> +	.default_regs	= tcm825x_default_regs,
> +	.needs_reset	= tcm825x_needs_reset,
> +	.ifparm		= tcm825x_ifparm,
> +	.is_upside_down	= tcm825x_is_upside_down,
>  };
>  
>  void __init n800_cam_init(void)
> -- 
> 1.5.0.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/3] N800: Select tcm825x only if wanted
  2008-05-14 12:05           ` [PATCH 3/3] N800: Select tcm825x only if wanted Sakari Ailus
@ 2008-05-16 17:44             ` Tony Lindgren
  0 siblings, 0 replies; 17+ messages in thread
From: Tony Lindgren @ 2008-05-16 17:44 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-omap

* Sakari Ailus <sakari.ailus@nokia.com> [080514 06:36]:
> Don't enable automatically TCM825x on N800 unless
> VIDEO_HELPER_CHIPS_AUTO is selected.

Pushing.

Tony


> Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
> ---
>  arch/arm/mach-omap2/Kconfig |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index 5c229cc..94beff0 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -35,7 +35,7 @@ config MACH_OMAP_GENERIC
>  config MACH_NOKIA_N800
>  	bool "Nokia N800"
>  	depends on ARCH_OMAP2420
> -	select VIDEO_TCM825X if VIDEO_OMAP2
> +	select VIDEO_TCM825X if VIDEO_OMAP2 && VIDEO_HELPER_CHIPS_AUTO
>  	select CBUS if VIDEO_TCM825X
>  	select CBUS_RETU if VIDEO_TCM825X
>  	select MENELAUS if VIDEO_TCM825X
> -- 
> 1.5.0.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2008-05-16 17:44 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-13 16:04 [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus
2008-05-13 16:04 ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
2008-05-13 16:04   ` [PATCH 3/3] N800: Select tcm825x only if wanted Sakari Ailus
2008-05-13 20:01   ` [PATCH 2/3] N810: Don't export camera orientation Felipe Balbi
2008-05-14 12:04     ` Sakari Ailus
2008-05-14 12:05       ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus
2008-05-14 12:05         ` [PATCH 2/3] N810: Don't export camera orientation Sakari Ailus
2008-05-14 12:05           ` [PATCH 3/3] N800: Select tcm825x only if wanted Sakari Ailus
2008-05-16 17:44             ` Tony Lindgren
2008-05-16 17:44           ` [PATCH 2/3] N810: Don't export camera orientation Tony Lindgren
2008-05-16 17:42         ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Tony Lindgren
2008-05-14 22:58       ` [PATCH 2/3] N810: Don't export camera orientation Felipe Balbi
2008-05-15  6:54         ` andrzej zaborowski
2008-05-15  7:57           ` Felipe Balbi
2008-05-15  8:11             ` andrzej zaborowski
2008-05-15  8:17               ` Felipe Balbi
2008-05-13 19:53 ` [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox