Re: [PATCH v5] media: platform: Renesas IMR driver

2017-05-07 Thread Kuninori Morimoto

Hi Laurent

> > >> Laurent: what do you think about the need for SoC-specific compatible
> > >> values for the various IM* blocks?
> > > 
> > > There's no documented IP core version register, but when dumping all
> > > configuration registers on H3 and M3-W I noticed that register 0x002c, not
> > > documented in the datasheet, reads 0x14060514 on all four IMR instances in
> > > H3, and 0x20150505 on both instances in M3-W.
> > > 
> > > This looks like a version register to me. If my assumption is correct, we
> > > could do without any SoC-specific compatible string.
> > 
> > I read this assumed version registers on all R-Car SoCs, after writing
> > zero to 0xe6150990 (SMSTPCR8).
> > 
> > IMR-X2 on R-Car H2: 0x12072009
> > IMR-LSX2 on R-Car H2:   0x12072009
> > IMR-LSX3 on R-Car V2H:  0x13052617
> > IMR-LX2 on R-Car M2-W:  0x12072009
> > IMR-LX2 on R-Car M2-N:  0x12072009
> > IMR-LX2 on R-Car E2:0x13091909
> > IMR-LX3 on R-Car V2H:   0x13052617
> > 
> > Note that several IDs are the same, but you know the type from the
> > compatible value.
> > 
> > It would be good to get confirmation from the hardware team that this is
> > indeed a version register.
> 
> Thank you for checking.
> 
> Morimoto-san, do you think there are still people alive in the Gen2 hardware 
> team who could provide the information ? :-) If not, information restricted 
> to 
> Gen3 would still be useful.

Hmm.. I will try to ask to HW team.
My assumption is "No answer for no documented register".
Thus, we have 5% chance (?)
Please wait

Best regards
---
Kuninori Morimoto


Re: [PATCH v1 1/3] of: base: Provide of_graph_get_port_parent()

2017-05-17 Thread Kuninori Morimoto

Hi Kieran

> >> From: Kieran Bingham 
> >>
> >> When handling endpoints, the v4l2 async framework needs to identify the
> >> parent device of a port endpoint.
> >>
> >> Adapt the existing of_graph_get_remote_port_parent() such that a caller
> >> can obtain the parent of a port without parsing the remote-endpoint
> >> first.
> > 
> > A similar patch is already applied as part of the ASoC graph card support.
> > 
> > Rob
> 
> Ah yes, a quick google finds it...
> :  https://patchwork.kernel.org/patch/9658907/
> 
> Surprisingly similar patch ... and a familiar name.
> 
> Morimoto-san - you beat me to it :D !

Interesting.
It was applies today to Mark's (= ALSA SoC Maintainer) branch !
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/?h=topic/of-graph&id=0ef472a973ebbfc20f2f12769e77a8cfd3612778


Best regards
---
Kuninori Morimoto


[PATCH 2/3] media: ti-vpe: cal: use of_graph_get_remote_endpoint()

2017-06-27 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Now, we can use of_graph_get_remote_endpoint(). Let's use it.

Signed-off-by: Kuninori Morimoto 
---
based on 4c9c3d595f1bad021cc126d20879df4016801736
("of_graph: add of_graph_get_remote_endpoint()")

 drivers/media/platform/ti-vpe/cal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/ti-vpe/cal.c 
b/drivers/media/platform/ti-vpe/cal.c
index 177faa3..0c7ddf8 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -1702,7 +1702,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, 
int inst)
asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
asd->match.fwnode.fwnode = of_fwnode_handle(sensor_node);
 
-   remote_ep = of_parse_phandle(ep_node, "remote-endpoint", 0);
+   remote_ep = of_graph_get_remote_endpoint(ep_node);
if (!remote_ep) {
ctx_dbg(3, ctx, "can't get remote-endpoint\n");
goto cleanup_exit;
-- 
1.9.1



Re: [PATCH v1.1 2/2] drm: rcar-du: Repair vblank for DRM page flips using the VSP1

2017-06-30 Thread Kuninori Morimoto

Hi Kieran

> -static void rcar_du_vsp_complete(void *private)
> +static void rcar_du_vsp_complete(void *private, bool completed)
>  {
>   struct rcar_du_crtc *crtc = private;
>  
> - rcar_du_crtc_finish_page_flip(crtc);
> + if (crtc->vblank_enable)
> + drm_crtc_handle_vblank(&crtc->crtc);
> +
> + if (completed)
> + rcar_du_crtc_finish_page_flip(crtc);
>  }

Here, this "vblank_enable" flag, timestamp will be update on 
drm_crtc_handle_vblank().

For example modetest Flip test, if we stop it by Ctrl+C, then, vblank_enable 
will be false,
Then, vblank timestamp isn't updated on waiting method on 
drm_atomic_helper_wait_for_vblanks().
Thus we will have timeout error.

And, print complete is now indicated on VSP Frame End,
in interlace input case, print complete will be indicated to user
on each ODD, EVEN timing.

Before this patch, for example 1080i@60Hz, print complete indication
happen in 30Hz.
After this patch, in interlace case, indication coming 60Hz

Best regards
---
Kuninori Morimoto


[PATCH 2/3][resend] media: ti-vpe: cal: use of_graph_get_remote_endpoint()

2017-07-23 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Now, we can use of_graph_get_remote_endpoint(). Let's use it.

Signed-off-by: Kuninori Morimoto 
Reviewed-by: Sylwester Nawrocki 
Acked-by: Benoit Parrot 
---
based on 4c9c3d595f1bad021cc126d20879df4016801736
("of_graph: add of_graph_get_remote_endpoint()")

 drivers/media/platform/ti-vpe/cal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/ti-vpe/cal.c 
b/drivers/media/platform/ti-vpe/cal.c
index 177faa3..0c7ddf8 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -1702,7 +1702,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, 
int inst)
asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
asd->match.fwnode.fwnode = of_fwnode_handle(sensor_node);
 
-   remote_ep = of_parse_phandle(ep_node, "remote-endpoint", 0);
+   remote_ep = of_graph_get_remote_endpoint(ep_node);
if (!remote_ep) {
ctx_dbg(3, ctx, "can't get remote-endpoint\n");
goto cleanup_exit;
-- 
1.9.1



[PATCH 2/3][resend] media: ti-vpe: cal: use of_graph_get_remote_endpoint()

2017-07-23 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Now, we can use of_graph_get_remote_endpoint(). Let's use it.

Signed-off-by: Kuninori Morimoto 
Reviewed-by: Sylwester Nawrocki 
Acked-by: Benoit Parrot 
---
based on 4c9c3d595f1bad021cc126d20879df4016801736
("of_graph: add of_graph_get_remote_endpoint()")

 drivers/media/platform/ti-vpe/cal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/ti-vpe/cal.c 
b/drivers/media/platform/ti-vpe/cal.c
index 177faa3..0c7ddf8 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -1702,7 +1702,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, 
int inst)
asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
asd->match.fwnode.fwnode = of_fwnode_handle(sensor_node);
 
-   remote_ep = of_parse_phandle(ep_node, "remote-endpoint", 0);
+   remote_ep = of_graph_get_remote_endpoint(ep_node);
if (!remote_ep) {
ctx_dbg(3, ctx, "can't get remote-endpoint\n");
goto cleanup_exit;
-- 
1.9.1



[PATCH][resend] media: ti-vpe: cal: use of_graph_get_remote_endpoint()

2017-08-06 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Now, we can use of_graph_get_remote_endpoint(). Let's use it.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/platform/ti-vpe/cal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/ti-vpe/cal.c 
b/drivers/media/platform/ti-vpe/cal.c
index 177faa3..0c7ddf8 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -1702,7 +1702,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, 
int inst)
asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
asd->match.fwnode.fwnode = of_fwnode_handle(sensor_node);
 
-   remote_ep = of_parse_phandle(ep_node, "remote-endpoint", 0);
+   remote_ep = of_graph_get_remote_endpoint(ep_node);
if (!remote_ep) {
ctx_dbg(3, ctx, "can't get remote-endpoint\n");
goto cleanup_exit;
-- 
1.9.1



Re: [PATCH][resend] media: ti-vpe: cal: use of_graph_get_remote_endpoint()

2017-08-07 Thread Kuninori Morimoto

Hi Hans

> > From: Kuninori Morimoto 
> > 
> > Now, we can use of_graph_get_remote_endpoint(). Let's use it.
> 
> I'm not sure why this is resent. It's part of a pending pull request
> so I expect it to be merged this week.

Sorry, I didn't know that.
Thank you for your help

Best regards
---
Kuninori Morimoto


[PATCH] media: i2c: max2175: convert to SPDX identifiers

2018-08-21 Thread Kuninori Morimoto


From: Kuninori Morimoto 

This patch updates license to use SPDX-License-Identifier
instead of verbose license text.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/i2c/max2175.c | 10 +-
 drivers/media/i2c/max2175.h | 12 ++--
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c
index 008a082..85a3fdf 100644
--- a/drivers/media/i2c/max2175.c
+++ b/drivers/media/i2c/max2175.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Maxim Integrated MAX2175 RF to Bits tuner driver
  *
@@ -6,15 +7,6 @@
  *
  * Copyright (C) 2016 Maxim Integrated Products
  * Copyright (C) 2017 Renesas Electronics Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * 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.
  */
 
 #include 
diff --git a/drivers/media/i2c/max2175.h b/drivers/media/i2c/max2175.h
index eb43373..1ece587 100644
--- a/drivers/media/i2c/max2175.h
+++ b/drivers/media/i2c/max2175.h
@@ -1,4 +1,5 @@
-/*
+/* SPDX-License-Identifier: GPL-2.0
+ *
  * Maxim Integrated MAX2175 RF to Bits tuner driver
  *
  * This driver & most of the hard coded values are based on the reference
@@ -6,15 +7,6 @@
  *
  * Copyright (C) 2016 Maxim Integrated Products
  * Copyright (C) 2017 Renesas Electronics Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * 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.
  */
 
 #ifndef __MAX2175_H__
-- 
2.7.4



compile error at sun6i_video

2019-02-04 Thread Kuninori Morimoto


Hi MultiMedia ML

I got below compile error at SH.

  ...
  CC  drivers/tty/tty_io.o
/opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:
 In function 'sun6i_video_start_streaming':
/opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:141:29:
 error: passing argument 1 of 'media_pipeline_start' from incompatible pointer 
type [-Werror=incompatible-pointer-types]
  ret = media_pipeline_start(&video->vdev.entity, &video->vdev.pipe);
 ^~~
In file included from 
/opt/RB02197/home/morimoto/save/WORK/linux/include/media/media-device.h:26,
 from 
/opt/RB02197/home/morimoto/save/WORK/linux/include/media/v4l2-device.h:24,
 from 
/opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:10:
/opt/RB02197/home/morimoto/save/WORK/linux/include/media/media-entity.h:1030:84:
 note: expected 'struct media_pad *' but argument is of type 'struct 
media_entity *'
 __must_check int media_pipeline_start(struct media_pad *pad,

^  
/opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:205:22:
 error: passing argument 1 of 'media_pipeline_stop' from incompatible pointer 
type [-Werror=incompatible-pointer-types]
  media_pipeline_stop(&video->vdev.entity);
  ^~~
In file included from 
/opt/RB02197/home/morimoto/save/WORK/linux/include/media/media-device.h:26,
 from 
/opt/RB02197/home/morimoto/save/WORK/linux/include/media/v4l2-device.h:24,
 from 
/opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:10:
/opt/RB02197/home/morimoto/save/WORK/linux/include/media/media-entity.h:1055:44:
 note: expected 'struct media_pad *' but argument is of type 'struct 
media_entity *'
 void media_pipeline_stop(struct media_pad *pad);
  ~~^~~
/opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:
 In function 'sun6i_video_stop_streaming':
/opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:229:22:
 error: passing argument 1 of 'media_pipeline_stop' from incompatible pointer 
type [-Werror=incompatible-pointer-types]
  media_pipeline_stop(&video->vdev.entity);
  ^~~
In file included from 
/opt/RB02197/home/morimoto/save/WORK/linux/include/media/media-device.h:26,
 from 
/opt/RB02197/home/morimoto/save/WORK/linux/include/media/v4l2-device.h:24,
 from 
/opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:10:
/opt/RB02197/home/morimoto/save/WORK/linux/include/media/media-entity.h:1055:44:
 note: expected 'struct media_pad *' but argument is of type 'struct 
media_entity *'
 void media_pipeline_stop(struct media_pad *pad);
  ~~^~~


Best regards
---
Kuninori Morimoto


Re: compile error at sun6i_video

2019-02-05 Thread Kuninori Morimoto


Hi Sakari
Cc Niklas

Thank you for your feedback

> > /opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:
> >  In function 'sun6i_video_start_streaming':
> > /opt/RB02197/home/morimoto/save/WORK/linux/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c:141:29:
> >  error: passing argument 1 of 'media_pipeline_start' from incompatible 
> > pointer type [-Werror=incompatible-pointer-types]
> >   ret = media_pipeline_start(&video->vdev.entity, &video->vdev.pipe);
> >  ^~~
(snip)
> Do you have the patches Niklas's v4l2/mux (or my vc) branch in your tree?
> They change a few things on the way and drivers need to be converted.
> Drivers that have been added since the patches were written do need to be
> converted as well, and I suppose the sun6i_video driver is one of them.

I could find your branch at LinuxTV, and merged vc branch,
but unfortunately it can't solve compile issue.
I could understand its background.
It is OK for me if it will be solved on the next version.
I will skip it so far.
Thank you for your help

Best regards
---
Kuninori Morimoto


Re: [PATCH 1/4] v4l: vsp1: Implement partition algorithm restrictions

2017-02-13 Thread Kuninori Morimoto

Hi Laurent, Kieran

Quick response

> Testing SRU-UDS scaling 768x576 - 768x576 - 640x480 in RGB24: fail
> Testing SRU-UDS scaling 768x576 - 768x576 - 768x576 in RGB24: pass
> Testing SRU-UDS scaling 768x576 - 768x576 - 1024x768 in RGB24: pass
> Testing SRU-UDS scaling 768x576 - 1536x1152 - 1280x960 in RGB24: pass
> Testing SRU-UDS scaling 768x576 - 1536x1152 - 1536x1152 in RGB24: pass
> Testing SRU-UDS scaling 768x576 - 1536x1152 - 2048x1536 in RGB24: pass
> Testing UDS-SRU scaling 768x576 - 640x480 - 640x480 in RGB24: pass
> Testing UDS-SRU scaling 768x576 - 640x480 - 1280x960 in RGB24: pass
> Testing UDS-SRU scaling 768x576 - 768x576 - 768x576 in RGB24: pass
> Testing UDS-SRU scaling 768x576 - 768x576 - 1536x1152 in RGB24: pass
> Testing UDS-SRU scaling 768x576 - 1024x768 - 1024x768 in RGB24: pass
> Testing UDS-SRU scaling 768x576 - 1024x768 - 2048x1536 in RGB24: pass
> Testing SRU-UDS scaling 768x576 - 768x576 - 640x480 in YUV444M: fail
> Testing SRU-UDS scaling 768x576 - 768x576 - 768x576 in YUV444M: pass
> Testing SRU-UDS scaling 768x576 - 768x576 - 1024x768 in YUV444M: pass
> Testing SRU-UDS scaling 768x576 - 1536x1152 - 1280x960 in YUV444M: pass
> Testing SRU-UDS scaling 768x576 - 1536x1152 - 1536x1152 in YUV444M: pass
> Testing SRU-UDS scaling 768x576 - 1536x1152 - 2048x1536 in YUV444M: hangs
> Testing UDS-SRU scaling 768x576 - 640x480 - 640x480 in YUV444M: pass
> Testing UDS-SRU scaling 768x576 - 640x480 - 1280x960 in YUV444M: fail
> Testing UDS-SRU scaling 768x576 - 768x576 - 768x576 in YUV444M: pass
> Testing UDS-SRU scaling 768x576 - 768x576 - 1536x1152 in YUV444M: pass
> Testing UDS-SRU scaling 768x576 - 1024x768 - 1024x768 in YUV444M: pass
> Testing UDS-SRU scaling 768x576 - 1024x768 - 2048x1536 in YUV444M: hangs
(snip)
> However, from the above tests it looks like the hardware can live with more 
> relaxed restrictions than the ones implemented here. I haven't tested all UDS 
> scaling ratios, and certainly not under all memory bus load conditions, I 
> might thus be too optimistic. Morimoto-san, would it be possible to get more 
> information about this from the hardware team, to check whether the above two 
> restrictions need to be honoured, or whether they come from an older hardware 
> version ?

I asked it to HW team.
Please wait

Best regards
---
Kuninori Morimoto


Re: [PATCH 1/4] v4l: vsp1: Implement partition algorithm restrictions

2017-02-28 Thread Kuninori Morimoto

Hi Laurent, Kieran

> > Testing SRU-UDS scaling 768x576 - 768x576 - 640x480 in RGB24: fail
> > Testing SRU-UDS scaling 768x576 - 768x576 - 768x576 in RGB24: pass
> > Testing SRU-UDS scaling 768x576 - 768x576 - 1024x768 in RGB24: pass
> > Testing SRU-UDS scaling 768x576 - 1536x1152 - 1280x960 in RGB24: pass
> > Testing SRU-UDS scaling 768x576 - 1536x1152 - 1536x1152 in RGB24: pass
> > Testing SRU-UDS scaling 768x576 - 1536x1152 - 2048x1536 in RGB24: pass
> > Testing UDS-SRU scaling 768x576 - 640x480 - 640x480 in RGB24: pass
> > Testing UDS-SRU scaling 768x576 - 640x480 - 1280x960 in RGB24: pass
> > Testing UDS-SRU scaling 768x576 - 768x576 - 768x576 in RGB24: pass
> > Testing UDS-SRU scaling 768x576 - 768x576 - 1536x1152 in RGB24: pass
> > Testing UDS-SRU scaling 768x576 - 1024x768 - 1024x768 in RGB24: pass
> > Testing UDS-SRU scaling 768x576 - 1024x768 - 2048x1536 in RGB24: pass
> > Testing SRU-UDS scaling 768x576 - 768x576 - 640x480 in YUV444M: fail
> > Testing SRU-UDS scaling 768x576 - 768x576 - 768x576 in YUV444M: pass
> > Testing SRU-UDS scaling 768x576 - 768x576 - 1024x768 in YUV444M: pass
> > Testing SRU-UDS scaling 768x576 - 1536x1152 - 1280x960 in YUV444M: pass
> > Testing SRU-UDS scaling 768x576 - 1536x1152 - 1536x1152 in YUV444M: pass
> > Testing SRU-UDS scaling 768x576 - 1536x1152 - 2048x1536 in YUV444M: hangs
> > Testing UDS-SRU scaling 768x576 - 640x480 - 640x480 in YUV444M: pass
> > Testing UDS-SRU scaling 768x576 - 640x480 - 1280x960 in YUV444M: fail
> > Testing UDS-SRU scaling 768x576 - 768x576 - 768x576 in YUV444M: pass
> > Testing UDS-SRU scaling 768x576 - 768x576 - 1536x1152 in YUV444M: pass
> > Testing UDS-SRU scaling 768x576 - 1024x768 - 1024x768 in YUV444M: pass
> > Testing UDS-SRU scaling 768x576 - 1024x768 - 2048x1536 in YUV444M: hangs
> (snip)
> > However, from the above tests it looks like the hardware can live with more 
> > relaxed restrictions than the ones implemented here. I haven't tested all 
> > UDS 
> > scaling ratios, and certainly not under all memory bus load conditions, I 
> > might thus be too optimistic. Morimoto-san, would it be possible to get 
> > more 
> > information about this from the hardware team, to check whether the above 
> > two 
> > restrictions need to be honoured, or whether they come from an older 
> > hardware 
> > version ?
> 
> I asked it to HW team.
> Please wait

We still not yet get clear answer from HW team.
It is still researching

Best regards
---
Kuninori Morimoto


Re: [PATCH/RFC 1/9] clk: shmobile: r8a7795: Add FCP clocks

2016-03-02 Thread Kuninori Morimoto

Hi Laurent

> > > The parent clock isn't documented in the datasheet, use S2D1 as a best
> > > guess for now.
> > 
> > Would you be able to find out what the parent clock is for the FCP and LVDS 
> > (patch 2/9) clocks ?

It seems FCP clock is based on each SoC
In H3 ES1 case, it is using
 - s2d2 (for 200MHz)
 - s2d1 (for 400MHz)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 1/9] clk: shmobile: r8a7795: Add FCP clocks

2016-03-02 Thread Kuninori Morimoto

Hi Laurent

> > It seems FCP clock is based on each SoC
> > In H3 ES1 case, it is using
> >  - s2d2 (for 200MHz)
> >  - s2d1 (for 400MHz)
> 
> Thank you for the information. Do you mean that different FCP instances use 
> different clocks ? If so, could you tell us which clock is used by each 
> instance in th H3 ES1 ?

Sorry for my confusable mail.
All FCP on H3 ES1 is using above,
but, M3 or E3 will use different clock.

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


Re: [PATCH/RFC 1/9] clk: shmobile: r8a7795: Add FCP clocks

2016-03-03 Thread Kuninori Morimoto

Hi Laurent

> > >>  - s2d2 (for 200MHz)
> > >>  - s2d1 (for 400MHz)
> > > 
> > > Thank you for the information. Do you mean that different FCP instances
> > > use different clocks ? If so, could you tell us which clock is used by
> > > each instance in th H3 ES1 ?
> > 
> > Sorry for my confusable mail.
> > All FCP on H3 ES1 is using above,
> > but, M3 or E3 will use different clock.
> > 
> > Is this more clear ?
> 
> Does it mean that every FCP instance uses both the S2D2 and the S2D1 clocks 
> as 
> functional clocks on H3 ES1 ?

 - s2d2 (200MHz) is for APB-IF,
 - s2d1 (400MHz) is for AXI-IF, and internal

Is this clear answer ?


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


Re: [PATCH/RFC 1/9] clk: shmobile: r8a7795: Add FCP clocks

2016-04-11 Thread Kuninori Morimoto

Hi Laurent

> > > The parent clock isn't documented in the datasheet, use S2D1 as a best
> > > guess for now.
> > 
> > Would you be able to find out what the parent clock is for the FCP and LVDS 
> > (patch 2/9) clocks ?
> 
> Thanks !
> I asked it to HW team

It is too late information for you

LVDS (APB) is using S0D4 (200MHz)

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


Re: [PATCH] Add interlace support to sh_mobile_ceu_camera.c

2010-07-12 Thread Kuninori Morimoto

Dear Guennadi

> I've got a question to you, regarding your interlaced support 
> implementation for the CEU: do I understand it right, that the kind of 
> support you actually have implemented is, that if an interlaced format is 
> now requested from the CEU, it will interpret incoming data as interlaced 
> and deinterlace it internally? 

It is correct excluding "interlaced format is now requested from the CEU". 
Now, the device which request interlace format is video device.
If you use Ecovec, it is tw9910.

> If this is really the case, then, I think, 
> it is a wrong way to implement this functionality. If a user requests 
> interlaced data, it means, (s)he wants it interlaced in memory. Whereas 
> deinterlacing should happen transparently - if the user requested 
> progressive data and your source provides interlaced, you can decide to 
> deinterlace it internally. Or am I misunderstanding your implementation?

Hmm...
Now only "CEU + tw9910" pair use interlace mode in CEU.
But it doesn't support interlace mode from "user space".
(I don't know how to request it from user space)
Now interlace mode is used internally.
This mean, it seems as "progressive mode" from user space.

> Regardless of theoretical correctness - does your patch still work? Have 
> you been able back then to get CEU to deinterlace data, and when have you 
> last tested it?

I tested CEU interlace mode by using Ecovec board.
I can watch correct video image on at least v2.6.34.

I used this command.

VIDIX="-vo fbdev:vidix:sh_veu"
SIZE="-tv width=1280:height=720"
NTSC="-tv norm=NTSC"
OUT="tv:// -tv outfmt=nv12"
DEVICE="-tv device=/dev/video0"
mplayer ${VIDIX} ${SIZE} ${NTSC} ${OUT} ${DEVICE}

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


Re: [PATCH] Add interlace support to sh_mobile_ceu_camera.c

2010-07-13 Thread Kuninori Morimoto

Dear Guennadi


> our luck, that mplayer (and gstreamer?) ignore returned field value. But 
> we'll have to fix this in sh_mobile_ceu_camera.

Hmm  I understand.
I guess, at first, we need test program for it.


> Well, I think, 720p is a little too optimistic for tw9910;) tw9910 works 
> on migor for me, but not on ecovec, although the chip can be detected. Are 
> there any modifications necessary to the kernel or to the board to get it 
> to work? Maybe a jumper or something? I plug in a video signal source in 
> the "video in" connector, next to the "viceo out" one, using the same 
> cable, so, cabling should work too. But I'm only getting select timeouts 
> and no interrupts on the CEU.

Hmm..  strange...
No kernel patch is needed to use tw9910 on Ecovec.

Ahh...
Maybe the criminal is dip-switch.
We can not use "tw9910" and "2nd camera" in same time.

Please check DS2[3] on Ecovec.
It should OFF when you use tw9910.

I wrote dip-switch info on top of
${LINUX}/arch/sh/boards/mach-ecovec24/setup.c
Please check it too.

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


Re: [PATCH] Add interlace support to sh_mobile_ceu_camera.c

2010-07-13 Thread Kuninori Morimoto

Dear hermann

> For now, a dip-switch, you must have been abroad somewhere, can't be a
> criminal. Or?
> 
> http://www.dip-switch.com/?gclid=COjg9Mn86aICFYSdzAodNEcLkQ
> 
> Could you eventually agree with that about what a dip-switch is or do I
> miss what you mean?
> 
> Do you really tell there are still unclear dip-switches in 2010?
> 
> If so, please let's know, but then you can't do anything against such in
> software, of course.

I'm so sorry about my stupid English.
I should not use the words of "criminal".

I should say
"The reason that there are no video output on Ecovec
 might dip-switch setting issue.
 DS2[3] should be OFF when you use video"

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


Re: [PATCH] Add interlace support to sh_mobile_ceu_camera.c

2010-07-14 Thread Kuninori Morimoto

Dear hermann

> Is there any documentation and how can a user know about it?

"Ecovec board" which I and Guennadi were talking about is an evaluation board.
If you buy this board, you can find DVD including manual in its box.
Please check
${DVD}/hardware/user's_manual/eng/rej10j2027-0101_R0P7724LC001121RL_um_1.03.pdf

"dip-switch settings" is wrote in
3.4 "Switch Specification"

If you don't have this board,
but have kernel source code,
you can watch explain comment on top of
${LINUX}/arch/sh/boards/mach-ecovec24/setup.c

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


Re: [PATCH 2/3] soc-camera: mt9t112: modify delay time after initialize

2011-09-19 Thread Kuninori Morimoto

Hi Guennadi, all

> > > mt9t112 camera needs 100 milliseconds for initializing
> > > Special thanks to Phil
> > > 
> > > Signed-off-by: Kuninori Morimoto 
> > > Reported-by: Phil Edworthy 
> > > ---
> > >  drivers/media/video/mt9t112.c |2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
> > > index 7438f8d..e581d8a 100644
> > > --- a/drivers/media/video/mt9t112.c
> > > +++ b/drivers/media/video/mt9t112.c
> > > @@ -885,7 +885,7 @@ static int mt9t112_s_stream(struct v4l2_subdev *sd, 
> > > int enable)
> > >   /* Invert PCLK (Data sampled on falling edge of pixclk) */
> > >   mt9t112_reg_write(ret, client, 0x3C20, param);
> > >  
> > > - mdelay(5);
> > > + mdelay(100);
> > >  
> > >   priv->flags |= INIT_DONE;
> > >   }
> > 
> > Hi Guennadi,
> > 
> > What's the status of this patch?
> > 
> > It applies ok for me, and I couldn't find any reference at the
> > ML why it was not applied yet.
> 
> Hm, yeah... Looks like also this patch:
> 
> > Subject: [PATCH 3/3] soc-camera: mt9t112: The flag which control 
> > camera-init is removed
> > 
> > mt9t112 should always be initialized when camera start.
> > Because current driver doesn't run this operation,
> > it will be un-stable if user side player run open/close several times.
> > Special thanks to Namiki-san
> > 
> > Signed-off-by: Kuninori Morimoto 
> > Reported-by: Takashi Namiki 
> 
> has not been applied nor discussed on the list... For patches that old I 
> would tend to say: if the author / submitter didn't re-submit, then, 
> probably, patches aren't relevant anymore... Although it is quite 
> possible, that I failed to process them back then. Morimoto-san, do you 
> have any information on these patches? Have these problems been solved 
> somehow, so that the patches have become obsolete, or are the problems, 
> that they address, still there?

This patch is needed for mt9t112 camera initialize.
I thought that it was already applied.

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


Re: [PATCH 2/3] soc-camera: mt9t112: modify delay time after initialize

2011-10-12 Thread Kuninori Morimoto

Hi Guennadi

> There was a question at the bottom of this email, which you might have 
> overseen:-) Could you give me an idea, which patche(es) exactly you meant?

sorry for my super late response.
I losted this email.


> > > > > Subject: [PATCH 2/3] soc-camera: mt9t112: modify delay time after 
> > > > > initialize
(snip)
> > > > > Subject: [PATCH 3/3] soc-camera: mt9t112: The flag which control 
> > > > > camera-init is removed

> > > This patch is needed for mt9t112 camera initialize.
> > > I thought that it was already applied.
> > 
> > Which patch do you mean? Patch 2/3, or 3/3, or both are needed?

Both are needed.
These are bug fix patches

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


Re: [PATCH 2/3] soc-camera: mt9t112: modify delay time after initialize

2011-10-18 Thread Kuninori Morimoto

Hi Guennadi, and Phil

Thank you for your check/test

> > Both are needed.
> > These are bug fix patches
> 
> I tried to capture several frames beginning with the very first one (as 
> much as performance allowed), and I do see several black or wrongly 
> coloured framed in the beginning, but none of those patches, including the 
> proposed 300ms at the end of .s_stream() fixes the problem reliably. So, 
> either this problems, that these patches fix, are specific to the Solution 
> Engine board (is it the one, where the problems have been observed?), or 
> one needs a different testing method. If they are SE-specific - I don't 
> think, getting those fixes in the driver is very important, because 
> mt9t112 data for SE is not in the mainline. If I was testing wrongly, 
> please, tell me how exactly to reproduce those problems and see, how one 
> or another patch fixes them.

I guess mt9t112 camera is used in SE (with local circuit ?)
and Ecovec.
But I forgot detail of this issue (I have no mt9t112 for now).

I think Phil is the person who wanted this patch.

But if this issue happen only SE, I can agree to Guennadi

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


Re: [PATCH] V4L: tw9910: remove bogus ENUMINPUT implementation

2011-06-06 Thread Kuninori Morimoto

Dear Guennadi

Thank you for your email.

> Morimoto-san, sorry, that was a wrong address of yours again in the 
> original mail. With the correct request also comes a request: would it be 
> difficult for you to give this patch a try? If you don't happen to have a 
> set up ready at hand, no problem, I'll dig out some video signal source 
> myself and test.

I'm sorry too.
I don't know why, but I had lost V4L2 ML since last month somehow.
I didn't notice about it.

I tried this patch on SH7724 Ecovec board.
I'm using NTSC video player, and it works well.

But I just played video.
Is this test OK for you ?

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


Re: [PATCH] V4L: tw9910: remove bogus ENUMINPUT implementation

2011-06-07 Thread Kuninori Morimoto

Dear Guennadi

> > I tried this patch on SH7724 Ecovec board.
> > I'm using NTSC video player, and it works well.
> > 
> > But I just played video.
> > Is this test OK for you ?
> 
> Yes, very good, thanks very much! Can I add your "Tested-by" to the patch?

Thanks.
Yes, please add it

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


[PATCH] soc_camera_platform: Add necessary v4l2_subdev_video_ops method

2010-05-10 Thread Kuninori Morimoto
These function are needed to use camera.
This patch was tested with sh_mobile_ceu_camera

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/soc_camera_platform.c |   39 +
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/soc_camera_platform.c 
b/drivers/media/video/soc_camera_platform.c
index 10b003a..d36f732 100644
--- a/drivers/media/video/soc_camera_platform.c
+++ b/drivers/media/video/soc_camera_platform.c
@@ -83,10 +83,49 @@ static int soc_camera_platform_enum_fmt(struct v4l2_subdev 
*sd, int index,
return 0;
 }
 
+static int soc_camera_platform_g_crop(struct v4l2_subdev *sd, struct v4l2_crop 
*a)
+{
+   struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
+
+   a->c.left   = 0;
+   a->c.top= 0;
+   a->c.width  = p->format.width;
+   a->c.height = p->format.height;
+   a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+   return 0;
+}
+
+static int soc_camera_platform_cropcap(struct v4l2_subdev *sd, struct 
v4l2_cropcap *a)
+{
+   struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
+
+   a->bounds.left  = 0;
+   a->bounds.top   = 0;
+   a->bounds.width = p->format.width;
+   a->bounds.height= p->format.height;
+   a->defrect  = a->bounds;
+   a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+   a->pixelaspect.numerator= 1;
+   a->pixelaspect.denominator  = 1;
+
+   return 0;
+}
+
+static int soc_camera_platform_s_fmt(struct v4l2_subdev *sd,
+struct v4l2_mbus_framefmt *mf)
+{
+   return 0;
+}
+
 static struct v4l2_subdev_video_ops platform_subdev_video_ops = {
.s_stream   = soc_camera_platform_s_stream,
.try_mbus_fmt   = soc_camera_platform_try_fmt,
.enum_mbus_fmt  = soc_camera_platform_enum_fmt,
+   .cropcap= soc_camera_platform_cropcap,
+   .g_crop = soc_camera_platform_g_crop,
+   .g_mbus_fmt = soc_camera_platform_try_fmt,
+   .s_mbus_fmt = soc_camera_platform_s_fmt,
 };
 
 static struct v4l2_subdev_ops platform_subdev_ops = {
-- 
1.6.3.3

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


Re: [PATCH] soc_camera_platform: Add necessary v4l2_subdev_video_ops method

2010-05-11 Thread Kuninori Morimoto

Dear Guennadi

Thank you for checking patch

> > +static int soc_camera_platform_s_fmt(struct v4l2_subdev *sd,
> > +struct v4l2_mbus_framefmt *mf)
> > +{
> > +   return 0;
> 
> This function needs not only return 0, but also fill fmt with the current 
> pixel format.

sorry.
Does this "fill" mean "fill mf->" ?

mf->code = ;
mf->colorspace = xxx;

> >  static struct v4l2_subdev_video_ops platform_subdev_video_ops = {
> > .s_stream   = soc_camera_platform_s_stream,
> > .try_mbus_fmt   = soc_camera_platform_try_fmt,
> > .enum_mbus_fmt  = soc_camera_platform_enum_fmt,
> > +   .cropcap= soc_camera_platform_cropcap,
> > +   .g_crop = soc_camera_platform_g_crop,
> > +   .g_mbus_fmt = soc_camera_platform_try_fmt,
> > +   .s_mbus_fmt = soc_camera_platform_s_fmt,
> 
> Wouldn't
> 
> + .s_mbus_fmt = soc_camera_platform_try_fmt,
> 
> work here as well?

g_mbus_fmt / try_mbus_fmt are using same argument,
and in this driver, it needs same operation I think.
(same operation mean it fill mf->)
But should I modify it ?

int (*g_mbus_fmt)(struct v4l2_subdev *sd,  struct v4l2_mbus_framefmt *fmt);
int (*try_mbus_fmt)(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt);


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


[PATCH v2] soc_camera_platform: Add necessary v4l2_subdev_video_ops method

2010-05-11 Thread Kuninori Morimoto
These function are needed to use camera.
This patch was tested with sh_mobile_ceu_camera

Signed-off-by: Kuninori Morimoto 
---
v1 -> v2

o rename soc_camera_platform_try_fmt => soc_camera_platform_fill_fmt
o .try_mbus_fmt / .g_mbus_fmt / .s_mbus_fmt use soc_camera_platform_fill_fmt

I tested this patch, and it works well.

 drivers/media/video/soc_camera_platform.c |   42 ++--
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/soc_camera_platform.c 
b/drivers/media/video/soc_camera_platform.c
index 10b003a..fd4612e 100644
--- a/drivers/media/video/soc_camera_platform.c
+++ b/drivers/media/video/soc_camera_platform.c
@@ -56,8 +56,8 @@ soc_camera_platform_query_bus_param(struct soc_camera_device 
*icd)
return p->bus_param;
 }
 
-static int soc_camera_platform_try_fmt(struct v4l2_subdev *sd,
-  struct v4l2_mbus_framefmt *mf)
+static int soc_camera_platform_fill_fmt(struct v4l2_subdev *sd,
+   struct v4l2_mbus_framefmt *mf)
 {
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
 
@@ -65,6 +65,7 @@ static int soc_camera_platform_try_fmt(struct v4l2_subdev *sd,
mf->height  = p->format.height;
mf->code= p->format.code;
mf->colorspace  = p->format.colorspace;
+   mf->field   = V4L2_FIELD_NONE;
 
return 0;
 }
@@ -83,10 +84,45 @@ static int soc_camera_platform_enum_fmt(struct v4l2_subdev 
*sd, int index,
return 0;
 }
 
+static int soc_camera_platform_g_crop(struct v4l2_subdev *sd,
+ struct v4l2_crop *a)
+{
+   struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
+
+   a->c.left   = 0;
+   a->c.top= 0;
+   a->c.width  = p->format.width;
+   a->c.height = p->format.height;
+   a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+   return 0;
+}
+
+static int soc_camera_platform_cropcap(struct v4l2_subdev *sd,
+  struct v4l2_cropcap *a)
+{
+   struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
+
+   a->bounds.left  = 0;
+   a->bounds.top   = 0;
+   a->bounds.width = p->format.width;
+   a->bounds.height= p->format.height;
+   a->defrect  = a->bounds;
+   a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+   a->pixelaspect.numerator= 1;
+   a->pixelaspect.denominator  = 1;
+
+   return 0;
+}
+
 static struct v4l2_subdev_video_ops platform_subdev_video_ops = {
.s_stream   = soc_camera_platform_s_stream,
-   .try_mbus_fmt   = soc_camera_platform_try_fmt,
.enum_mbus_fmt  = soc_camera_platform_enum_fmt,
+   .cropcap= soc_camera_platform_cropcap,
+   .g_crop = soc_camera_platform_g_crop,
+   .try_mbus_fmt   = soc_camera_platform_fill_fmt,
+   .g_mbus_fmt = soc_camera_platform_fill_fmt,
+   .s_mbus_fmt = soc_camera_platform_fill_fmt,
 };
 
 static struct v4l2_subdev_ops platform_subdev_ops = {
-- 
1.6.3.3

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


Re: [PATCH v2] soc_camera_platform: Add necessary v4l2_subdev_video_ops method

2010-05-11 Thread Kuninori Morimoto

Dear Guennadi

> @@ -65,6 +65,7 @@ static int soc_camera_platform_try_fmt(struct v4l2_subdev 
> *sd,
>   mf->height  = p->format.height;
>   mf->code= p->format.code;
>   mf->colorspace  = p->format.colorspace;
> + mf->field   = V4L2_FIELD_NONE;

I added this in v2.
But I should use p->format.field instead of V4L2_FIELD_NONE
please give me 3rd chance

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


[PATCH v3] soc_camera_platform: Add necessary v4l2_subdev_video_ops method

2010-05-11 Thread Kuninori Morimoto
These function are needed to use camera.
This patch was tested with sh_mobile_ceu_camera

Signed-off-by: Kuninori Morimoto 
---
v2 -> v3

o use p->format.field  instead of V4L2_FIELD_NONE

 drivers/media/video/soc_camera_platform.c |   42 ++--
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/soc_camera_platform.c 
b/drivers/media/video/soc_camera_platform.c
index 10b003a..1df5234 100644
--- a/drivers/media/video/soc_camera_platform.c
+++ b/drivers/media/video/soc_camera_platform.c
@@ -56,8 +56,8 @@ soc_camera_platform_query_bus_param(struct soc_camera_device 
*icd)
return p->bus_param;
 }
 
-static int soc_camera_platform_try_fmt(struct v4l2_subdev *sd,
-  struct v4l2_mbus_framefmt *mf)
+static int soc_camera_platform_fill_fmt(struct v4l2_subdev *sd,
+   struct v4l2_mbus_framefmt *mf)
 {
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
 
@@ -65,6 +65,7 @@ static int soc_camera_platform_try_fmt(struct v4l2_subdev *sd,
mf->height  = p->format.height;
mf->code= p->format.code;
mf->colorspace  = p->format.colorspace;
+   mf->field   = p->format.field;
 
return 0;
 }
@@ -83,10 +84,45 @@ static int soc_camera_platform_enum_fmt(struct v4l2_subdev 
*sd, int index,
return 0;
 }
 
+static int soc_camera_platform_g_crop(struct v4l2_subdev *sd,
+ struct v4l2_crop *a)
+{
+   struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
+
+   a->c.left   = 0;
+   a->c.top= 0;
+   a->c.width  = p->format.width;
+   a->c.height = p->format.height;
+   a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+   return 0;
+}
+
+static int soc_camera_platform_cropcap(struct v4l2_subdev *sd,
+  struct v4l2_cropcap *a)
+{
+   struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
+
+   a->bounds.left  = 0;
+   a->bounds.top   = 0;
+   a->bounds.width = p->format.width;
+   a->bounds.height= p->format.height;
+   a->defrect  = a->bounds;
+   a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+   a->pixelaspect.numerator= 1;
+   a->pixelaspect.denominator  = 1;
+
+   return 0;
+}
+
 static struct v4l2_subdev_video_ops platform_subdev_video_ops = {
.s_stream   = soc_camera_platform_s_stream,
-   .try_mbus_fmt   = soc_camera_platform_try_fmt,
.enum_mbus_fmt  = soc_camera_platform_enum_fmt,
+   .cropcap= soc_camera_platform_cropcap,
+   .g_crop = soc_camera_platform_g_crop,
+   .try_mbus_fmt   = soc_camera_platform_fill_fmt,
+   .g_mbus_fmt = soc_camera_platform_fill_fmt,
+   .s_mbus_fmt = soc_camera_platform_fill_fmt,
 };
 
 static struct v4l2_subdev_ops platform_subdev_ops = {
-- 
1.6.3.3

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


Current status of SuperH soc-camera/CEU driver

2012-04-22 Thread Kuninori Morimoto

Hi Guennadi

Now I'm checking Soc-Camera/CEU driver, and I noticed that
platform settings (maybe) weren't cared even though driver side was updated.
I'm not sure for details, but it makes me misunderstand.
Could you please update these ?

1) e1db704326c9a5164da4e24b01e487c0be687fa2
([media] V4L: sh_mobile_ceu_camera: convert to the new mbus-config subdev 
operations)

This patch removed SH_CEU_FLAG_USE_xxBIT_BUS flags from CEU driver,
but below platform still has this flags.

arch/sh/boards/mach-ap325rxa/
arch/sh/boards/mach-ecovec24/
arch/sh/boards/mach-kfr2r09/
arch/sh/boards/mach-migor/
arch/sh/boards/mach-se/7724/
arch/arm/mach-shmobile/board-ap4evb.c
arch/arm/mach-shmobile/board-mackerel.c

2) ff51345832628eb641805a01213aeae0bb4a23c1
([media] V4L: mt9t112: remove superfluous soc-camera client operations)

this patch remoded MT9T112_FLAG_DATAWIDTH_xx flags from mt9t112 driver,
but Ecovec platform still has it.

arch/sh/boards/mach-ecovec24/


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


Re: Current status of SuperH soc-camera/CEU driver

2012-04-23 Thread Kuninori Morimoto

Hi Guennadi

Thanks for reply.

> AFAICS, all these platforms only use 8 bits, so, none of them is broken. 
> OTOH, I'm not sure any more, what was the motivation behind that removal. 
> Maybe exactly because we didn't have any platforms with 16-bit camera 
> connections and maybe I saw a problem with it, so, I decided to remove 
> them until we get a chance to properly implement and test 16-bits? Do you 
> have such a board?

about 16bit camera, one guy has it, but he is using v3.0 kernel,
so, it is not in trouble at this point.
(it is working)

The motivation was just "misunderstand-able", not super important at this point.
So please keep considering about it.

> > 2) ff51345832628eb641805a01213aeae0bb4a23c1
> > ([media] V4L: mt9t112: remove superfluous soc-camera client operations)
> > 
> > this patch remoded MT9T112_FLAG_DATAWIDTH_xx flags from mt9t112 driver,
> > but Ecovec platform still has it.
> > 
> > arch/sh/boards/mach-ecovec24/
> 
> Perhaps, the reason was more or less the same - no users, untested code.

About this, now, I'm trying to use this camera on new board (but 8bit),
and the platform code was copied from ecovec.
But the camera image was not correct.

So, I checked the platform/ceu/mt9t112, 
and noticed that the driver is using new mbus style,
but platform is still using old style.
And I got confusion.

Now, this code is no users, untested.
So, the reason why image was broken is 50% new board specific issue,
but 50% original code issue.

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


[PATCH] V4L2: sh_mobile_ceu: manage lower 8bit bus

2012-05-07 Thread Kuninori Morimoto
CAMCR::DTIF feild controls camera bus as upper8bit/16bit/lower8bit.
This patch manages unmanaged lower 8bit bus

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/sh_mobile_ceu_camera.c |8 +---
 include/media/sh_mobile_ceu.h  |1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index 424dfac..4e0b654 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -881,11 +881,13 @@ static int sh_mobile_ceu_set_bus_param(struct 
soc_camera_device *icd)
 
value |= common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW ? 1 << 1 : 0;
value |= common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW ? 1 << 0 : 0;
-   value |= pcdev->is_16bit ? 1 << 12 : 0;
 
-   /* CSI2 mode */
-   if (pcdev->pdata->csi2)
+   if (pcdev->pdata->csi2) /* CSI2 mode */
value |= 3 << 12;
+   else if (pcdev->is_16bit)
+   value |= 1 << 12;
+   else if (pcdev->pdata->flags & SH_CEU_FLAG_LOWER_8BIT)
+   value |= 2 << 12;
 
ceu_write(pcdev, CAMCR, value);
 
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index a90a765..6fdb6ad 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -5,6 +5,7 @@
 #define SH_CEU_FLAG_USE_16BIT_BUS  (1 << 1) /* use 16bit bus width */
 #define SH_CEU_FLAG_HSYNC_LOW  (1 << 2) /* default High if possible */
 #define SH_CEU_FLAG_VSYNC_LOW  (1 << 3) /* default High if possible */
+#define SH_CEU_FLAG_LOWER_8BIT (1 << 4) /* default upper 8bit */
 
 struct device;
 struct resource;
-- 
1.7.5.4

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


[PATCH] V4L2: mt9t112: fixup JPEG initialization workaround

2012-05-07 Thread Kuninori Morimoto
From: Masahiro Nakai 

It has been indicated on Atmark Techno Web page
http://armadillo.atmark-techno.com/faq/a800eva-dont-work-camera

Signed-off-by: Masahiro Nakai 
Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/mt9t112.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
index 8d1445f..931a378 100644
--- a/drivers/media/video/mt9t112.c
+++ b/drivers/media/video/mt9t112.c
@@ -453,6 +453,7 @@ static int mt9t112_init_pll(const struct i2c_client *client)
 * I2C Master Clock Divider
 */
mt9t112_reg_write(ret, client, 0x0014, 0x3046);
+   mt9t112_reg_write(ret, client, 0x0016, 0x0400);
mt9t112_reg_write(ret, client, 0x0022, 0x0190);
mt9t112_reg_write(ret, client, 0x3B84, 0x0212);
 
-- 
1.7.5.4

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


Re: [PATCH] V4L: sh-mobile-ceu-camera: restore the bus-width test

2012-05-20 Thread Kuninori Morimoto

Hi Guennadi

> Would be nice if the below patch could be tested with a 16-bit set up. But 
> it should be tested "negatively." This means: I think, also now 16-bit set 
> ups work. The only problem is, that even if your board only connects 8 
> data lines, an attempt to set a 16-bit format wouldn't fail and would, 
> probably, deliver corrupt data. So, the test would be:
> - take a 16-bit set up and choose a 16-bit format - it should work
> - remove the 16-bit flag from the platform data - it would, presumably, 
>   still work, which is a bug
> - apply the patch
> - now verify that 16-bits formats can only be used, if the board specifies 
>   the respective flag in platform data

Thank you about this patch, but we are busy now. Sorry.
We would like to test this, but 16bit camera is using v3.0 kernel now.
And it is difficult to update kernel because of time issue.
(The board itself is not upstreamed)
Of course we will test when we have free time in the future.

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


[PATCH v3] ov772x: add edge contrl support

2009-03-24 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
v2 -> v3
o use edgectrl.strength for judge

Sorry for my miss-understanding.
This patch use edgectrl.strength for judgement.
And the explain in the comment has all.
My datasheet doesn't have details more than this explain.

 drivers/media/video/ov772x.c |   25 +
 include/media/ov772x.h   |   21 +
 2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 34c9819..3226c43 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -816,6 +816,31 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 
width, u32 height,
ov772x_reset(priv->client);
 
/*
+* set Edge Ctrl
+*/
+   if (priv->info->edgectrl.strength) {
+   ret = ov772x_mask_set(priv->client, EDGE0, 0x1F,
+ priv->info->edgectrl.strength);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client, EDGE1, 0x0F,
+ priv->info->edgectrl.threshold);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client, EDGE2, 0xFF,
+ priv->info->edgectrl.upper);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client, EDGE3, 0xFF,
+ priv->info->edgectrl.lower);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+   }
+
+   /*
 * set size format
 */
ret = ov772x_write_array(priv->client, priv->win->regs);
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 57db48d..cfdd80e 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -17,10 +17,31 @@
 #define OV772X_FLAG_VFLIP 0x0001 /* Vertical flip image */
 #define OV772X_FLAG_HFLIP 0x0002 /* Horizontal flip image */
 
+/*
+ * for Edge ctrl
+ */
+struct ov772x_edge_ctrl {
+   unsigned char strength;  /* strength control */
+   unsigned char threshold; /* threshold detection */
+   unsigned char upper; /* strength upper limit */
+   unsigned char lower; /* strength lower limit */
+};
+
+#define OV772X_EDGECTRL(s, t, u, l) \
+   {.strength  = (s & 0x1F),\
+.threshold = (t & 0x0F),\
+.upper = (u & 0xFF),\
+.lower = (l & 0xFF),\
+   }
+
+/*
+ * ov772x camera info
+ */
 struct ov772x_camera_info {
unsigned long  buswidth;
unsigned long  flags;
struct soc_camera_link link;
+   struct ov772x_edge_ctrl edgectrl;
 };
 
 #endif /* __OV772X_H__ */
-- 
1.5.6.3

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


[PATCH v4] ov772x: add edge contrl support

2009-03-30 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
v3 -> v4

o comment fix
o change edge ctrl setting order
o considered edge auto control mode and manual control mode
o add DSP auto register comment

 drivers/media/video/ov772x.c |   52 ++---
 include/media/ov772x.h   |   25 
 2 files changed, 73 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 34c9819..182daa5 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -169,11 +169,11 @@
 #define GAM15   0x8C /* Gamma Curve 15th segment input end point */
 #define SLOP0x8D /* Gamma curve highest segment slope */
 #define DNSTH   0x8E /* De-noise threshold */
-#define EDGE0   0x8F /* Edge enhancement control 0 */
-#define EDGE1   0x90 /* Edge enhancement control 1 */
+#define EDGE0   0x8F /* Edge strength  control when manual mode */
+#define EDGE1   0x90 /* Edge threshold control when manual mode */
 #define DNSOFF  0x91 /* Auto De-noise threshold control */
-#define EDGE2   0x92 /* Edge enhancement strength low  point control */
-#define EDGE3   0x93 /* Edge enhancement strength high point control */
+#define EDGE2   0x92 /* Edge strength upper limit when Auto mode */
+#define EDGE3   0x93 /* Edge strength lower limit when Auto mode */
 #define MTX10x94 /* Matrix coefficient 1 */
 #define MTX20x95 /* Matrix coefficient 2 */
 #define MTX30x96 /* Matrix coefficient 3 */
@@ -358,6 +358,14 @@
 #define VOSZ_VGA0xF0
 #define VOSZ_QVGA   0x78
 
+/* DSPAUTO (DSP Auto Function ON/OFF Control) */
+#define AWB_ACTRL   0x80 /* AWB auto threshold control */
+#define DENOISE_ACTRL   0x40 /* De-noise auto threshold control */
+#define EDGE_ACTRL  0x20 /* Edge enhancement auto strength control */
+#define UV_ACTRL0x10 /* UV adjust auto slope control */
+#define SCAL0_ACTRL 0x08 /* Auto scaling factor control */
+#define SCAL1_2_ACTRL   0x04 /* Auto scaling factor control */
+
 /*
  * ID
  */
@@ -816,6 +824,42 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 
width, u32 height,
ov772x_reset(priv->client);
 
/*
+* set Edge Ctrl
+*/
+   if (priv->info->flags & OV772X_FLAG_MAN_EDGE) {
+   /*
+* Edge auto strength is set by default.
+* Remove this bit when manual strength.
+*/
+   ret = ov772x_mask_set(priv->client, DSPAUTO,
+ EDGE_ACTRL, 0x00);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client, EDGE1, 0x0F,
+ priv->info->edgectrl.reg_b);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client, EDGE0, 0x1F,
+ priv->info->edgectrl.reg_a);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   } else if (priv->info->edgectrl.reg_a > priv->info->edgectrl.reg_b) {
+
+   ret = ov772x_mask_set(priv->client, EDGE2, 0xFF,
+ priv->info->edgectrl.reg_a);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client, EDGE3, 0xFF,
+ priv->info->edgectrl.reg_b);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+   }
+
+   /*
 * set size format
 */
ret = ov772x_write_array(priv->client, priv->win->regs);
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 57db48d..75d1f15 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -16,11 +16,36 @@
 /* for flags */
 #define OV772X_FLAG_VFLIP 0x0001 /* Vertical flip image */
 #define OV772X_FLAG_HFLIP 0x0002 /* Horizontal flip image */
+#define OV772X_FLAG_MAN_EDGE  0x0004 /* Manual edge control (default Auto) 
*/
 
+/*
+ * for Edge ctrl
+ *
+ * if OV772X_FLAG_MAN_EDGE
+ *reg_a : strength
+ *reg_b : threshold
+ * else (Auto Edge Control)
+ *reg_a : strength upper limit
+ *reg_b : strength lower limit
+ */
+struct ov772x_edge_ctrl {
+   unsigned char reg_a;
+   unsigned char reg_b;
+};
+
+#define OV772X_EDGECTRL(a, b) \
+   {.reg_a = (a),\
+.reg_b = (b),\
+   }
+
+/*
+ * ov772x camera info
+ */
 struct ov772x_camera_info {
unsigned long  buswidth;
unsigned long  flags;
struct soc_camera_link link;
+   struct ov772x_edge_ctrl edgectrl;
 };
 
 #endif /* __OV772X_H__ */
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscr

[PATCH v5] ov772x: add edge contrl support

2009-03-30 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
v4 -> v5

o use readable struct for edgectrl
o use readable MASK name

 drivers/media/video/ov772x.c |   63 +++--
 include/media/ov772x.h   |   33 ++
 2 files changed, 92 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 34c9819..c0d9112 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -169,11 +169,11 @@
 #define GAM15   0x8C /* Gamma Curve 15th segment input end point */
 #define SLOP0x8D /* Gamma curve highest segment slope */
 #define DNSTH   0x8E /* De-noise threshold */
-#define EDGE0   0x8F /* Edge enhancement control 0 */
-#define EDGE1   0x90 /* Edge enhancement control 1 */
+#define EDGE_STRNGT 0x8F /* Edge strength  control when manual mode */
+#define EDGE_TRSHLD 0x90 /* Edge threshold control when manual mode */
 #define DNSOFF  0x91 /* Auto De-noise threshold control */
-#define EDGE2   0x92 /* Edge enhancement strength low  point control */
-#define EDGE3   0x93 /* Edge enhancement strength high point control */
+#define EDGE_UPPER  0x92 /* Edge strength upper limit when Auto mode */
+#define EDGE_LOWER  0x93 /* Edge strength lower limit when Auto mode */
 #define MTX10x94 /* Matrix coefficient 1 */
 #define MTX20x95 /* Matrix coefficient 2 */
 #define MTX30x96 /* Matrix coefficient 3 */
@@ -358,6 +358,14 @@
 #define VOSZ_VGA0xF0
 #define VOSZ_QVGA   0x78
 
+/* DSPAUTO (DSP Auto Function ON/OFF Control) */
+#define AWB_ACTRL   0x80 /* AWB auto threshold control */
+#define DENOISE_ACTRL   0x40 /* De-noise auto threshold control */
+#define EDGE_ACTRL  0x20 /* Edge enhancement auto strength control */
+#define UV_ACTRL0x10 /* UV adjust auto slope control */
+#define SCAL0_ACTRL 0x08 /* Auto scaling factor control */
+#define SCAL1_2_ACTRL   0x04 /* Auto scaling factor control */
+
 /*
  * ID
  */
@@ -816,6 +824,53 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 
width, u32 height,
ov772x_reset(priv->client);
 
/*
+* Edge Ctrl
+*/
+   if (priv->info->edgectrl.strength & OV772X_MANUAL_EDGE_CTRL) {
+
+   /*
+* Manual Edge Control Mode
+*
+* Edge auto strength bit is set by default.
+* Remove it when manual mode.
+*/
+
+   ret = ov772x_mask_set(priv->client, DSPAUTO, EDGE_ACTRL, 0x00);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client,
+ EDGE_TRSHLD, EDGE_THRESHOLD_MASK,
+ priv->info->edgectrl.threshold);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client,
+ EDGE_STRNGT, EDGE_STRENGTH_MASK,
+ priv->info->edgectrl.strength);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   } else if (priv->info->edgectrl.upper > priv->info->edgectrl.lower) {
+   /*
+* Auto Edge Control Mode
+*
+* set upper and lower limit
+*/
+   ret = ov772x_mask_set(priv->client,
+ EDGE_UPPER, EDGE_UPPER_MASK,
+ priv->info->edgectrl.upper);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client,
+ EDGE_LOWER, EDGE_LOWER_MASK,
+ priv->info->edgectrl.lower);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+   }
+
+   /*
 * set size format
 */
ret = ov772x_write_array(priv->client, priv->win->regs);
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 57db48d..26ad3e4 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -17,10 +17,43 @@
 #define OV772X_FLAG_VFLIP 0x0001 /* Vertical flip image */
 #define OV772X_FLAG_HFLIP 0x0002 /* Horizontal flip image */
 
+/*
+ * for Edge ctrl
+ *
+ * strength also control Auto or Manual Edge Control Mode
+ * see also OV772X_MANUAL_EDGE_CTRL
+ */
+struct ov772x_edge_ctrl {
+   unsigned char strength;
+   unsigned char threshold;
+   unsigned char upper;
+   unsigned char lower;
+};
+
+#define OV772X_MANUAL_EDGE_CTRL0x80 /* un-used bit of strength */
+#define EDGE_STRENGTH_MASK 0x1F
+#define EDGE_THRESHOLD_MASK0x0F
+#define EDGE_UPPER_MASK0xFF
+#define EDGE_L

[PATCH] soc_camera: Add soc_camera_match function

2009-03-30 Thread Kuninori Morimoto

${LINUX}/drivers/base/dd.c :: __device_attach
use driver_match_device function.
It needs bus->match function.

Signed-off-by: Kuninori Morimoto 
---

> Guennadi

I tried latest Linux 2.6.29 from Paul's git
 git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6.git

Then, soc_camera doesn't works.
please check 49b420a13ff95b449947181190b08367348e3e1b
But I'm not sure is this patch correct fix ? 

 drivers/media/video/soc_camera.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 6d8bfd4..a10828b 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -929,12 +929,21 @@ static int soc_camera_resume(struct device *dev)
return ret;
 }
 
+int soc_camera_match(struct device *dev, struct device_driver *drv)
+{
+   struct soc_camera_device *icd = to_soc_camera_dev(dev);
+   struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
+
+   return ici->nr == icd->iface;
+}
+
 static struct bus_type soc_camera_bus_type = {
.name   = "soc-camera",
.probe  = soc_camera_probe,
.remove = soc_camera_remove,
.suspend= soc_camera_suspend,
.resume = soc_camera_resume,
+   .match  = soc_camera_match,
 };
 
 static struct device_driver ic_drv = {
-- 
1.5.6.3

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


Re: [PATCH 0/5] soc-camera: convert to platform device

2009-04-19 Thread Kuninori Morimoto

Hi Magnus

> >> > http://www.open-technology.de/download/20090415/ based on linux-next
> >> > history branch, commit ID in -base file. Don't be surprised, that
> >> > patch-set also contains a few not directly related patches.
> >>
> >> Testing on Migo-R board with 2.6.30-rc2-git-something and the
> >> following cherry-picked patches:
> >>
> >> 0007-driver-core-fix-driver_match_device.patch
> >> 0033-soc-camera-host-driver-cleanup.patch
> >> 0034-soc-camera-remove-an-extra-device-generation-from-s.patch
> >> 0035-soc-camera-simplify-register-access-routines-in-mul.patch
> >> and part of 0036 (avoiding rejects, ap325 seems broken btw)
> >
> > Have I broken it or is it unrelated?

I don't know about current 2.6.30-rc2 git.
But when I used 2.6.30-rc1, It doesn't work either.
The reason was soc_camera_bus_type doesn't has "match" function.
please check 49b420a13ff95b449947181190b08367348e3e1b

And please see
http://marc.info/?t=12324585986&r=1&w=2

I send patch to this problem.
2009/03/31
[PATCH] soc_camera: Add soc_camera_match function

And please check this patch.
This patch needed on ov772x, but may be rc2 already have it.

06/09: ov772x: wrong pointer for soc_camera_link is modified
http://linuxtv.org/hg/~gliakhovetski/v4l-dvb?cmd=changeset;node=157893ad8d0b


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


Re: [PATCH 1/2] soc-camera: add a new driver for the RJ54N1CB0C camera sensor from Sharp

2009-10-04 Thread Kuninori Morimoto

Dear Guennadi

> diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
> index e706cee..2851e5e 100644
> --- a/drivers/media/video/Makefile
> +++ b/drivers/media/video/Makefile
> @@ -79,6 +79,7 @@ obj-$(CONFIG_SOC_CAMERA_MT9V022)+= mt9v022.o
>  obj-$(CONFIG_SOC_CAMERA_OV772X)  += ov772x.o
>  obj-$(CONFIG_SOC_CAMERA_OV9640)  += ov9640.o
>  obj-$(CONFIG_SOC_CAMERA_TW9910)  += tw9910.o
> +obj-$(CONFIG_SOC_CAMERA_RJ54N1)  += rj54n1cb0c.o

alphabet order wrong ?
'R' is earlier than 'T' ?

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


[PATCH] soc-camera: tw9910: Revision 0 and 1 are able to use

2009-10-09 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/tw9910.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 269ab04..7bf90a2 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -883,11 +883,12 @@ static int tw9910_video_probe(struct soc_camera_device 
*icd,
 
/*
 * check and show Product ID
+* So far only revisions 0 and 1 have been seen
 */
val = i2c_smbus_read_byte_data(client, ID);
 
if (0x0B != GET_ID(val) ||
-   0x00 != GET_ReV(val)) {
+   0x01 < GET_ReV(val)) {
dev_err(&client->dev,
"Product ID error %x:%x\n", GET_ID(val), GET_ReV(val));
return -ENODEV;
-- 
1.6.0.4

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


[PATCH 2/5] soc-camera: tw9910: Add output signal control

2009-10-12 Thread Kuninori Morimoto
tw9910 can control output signal.
This patch will stop all signal when video was stopped.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/tw9910.c |   35 ---
 1 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 5152d56..8bda689 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -152,7 +152,8 @@
 /* 1 : non-auto */
 #define VSCTL   0x08 /* 1 : Vertical out ctrl by DVALID */
 /* 0 : Vertical out ctrl by HACTIVE and DVALID */
-#define OEN 0x04 /* Output Enable together with TRI_SEL. */
+#define OEN 0x00 /* Enable output */
+#define EN_TRI_SEL  0x04 /* TRI_SEL output */
 
 /* OUTCTR1 */
 #define VSP_LO  0x00 /* 0 : VS pin output polarity is active low */
@@ -236,7 +237,6 @@ struct tw9910_priv {
 
 static const struct regval_list tw9910_default_regs[] =
 {
-   { OPFORM,  0x00 },
{ OUTCTR1, VSP_LO | VSSL_VVALID | HSP_HI | HSSL_HSYNC },
ENDMARKER,
 };
@@ -513,19 +513,32 @@ static int tw9910_s_stream(struct v4l2_subdev *sd, int 
enable)
 {
struct i2c_client *client = sd->priv;
struct tw9910_priv *priv = to_tw9910(client);
+   u8 val;
 
-   if (!enable)
+   if (!enable) {
+   switch (priv->rev) {
+   case 0:
+   val = EN_TRI_SEL | 0x2;
+   break;
+   case 1:
+   val = EN_TRI_SEL | 0x3;
+   break;
+   }
return 0;
+   } else {
 
-   if (!priv->scale) {
-   dev_err(&client->dev, "norm select error\n");
-   return -EPERM;
+   if (!priv->scale) {
+   dev_err(&client->dev, "norm select error\n");
+   return -EPERM;
+   }
+
+   dev_dbg(&client->dev, "%s %dx%d\n",
+   priv->scale->name,
+   priv->scale->width,
+   priv->scale->height);
}
 
-   dev_dbg(&client->dev, "%s %dx%d\n",
-priv->scale->name,
-priv->scale->width,
-priv->scale->height);
+   tw9910_mask_set(client, OPFORM, 0x7, val);
 
return 0;
 }
-- 
1.6.0.4

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


[PATCH 3/5] soc-camera: tw9910: Add output pin control.

2009-10-12 Thread Kuninori Morimoto
tw9910 can select output pin width and vs/hs pin feature.
This patch add new flags definition to control it.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/tw9910.c |   72 --
 include/media/tw9910.h   |   21 +++-
 2 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 8bda689..bdabc9a 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -201,12 +201,6 @@
 /*
  * structure
  */
-
-struct regval_list {
-   unsigned char reg_num;
-   unsigned char value;
-};
-
 struct tw9910_scale_ctrl {
char   *name;
unsigned short  width;
@@ -229,18 +223,6 @@ struct tw9910_priv {
int rev;
 };
 
-/*
- * register settings
- */
-
-#define ENDMARKER { 0xff, 0xff }
-
-static const struct regval_list tw9910_default_regs[] =
-{
-   { OUTCTR1, VSP_LO | VSSL_VVALID | HSP_HI | HSSL_HSYNC },
-   ENDMARKER,
-};
-
 static const struct soc_camera_data_format tw9910_color_fmt[] = {
{
.name   = "VYUY",
@@ -442,20 +424,6 @@ static int tw9910_set_hsync(struct i2c_client *client,
return ret;
 }
 
-static int tw9910_write_array(struct i2c_client *client,
- const struct regval_list *vals)
-{
-   while (vals->reg_num != 0xff) {
-   int ret = i2c_smbus_write_byte_data(client,
-   vals->reg_num,
-   vals->value);
-   if (ret < 0)
-   return ret;
-   vals++;
-   }
-   return 0;
-}
-
 static int tw9910_mask_set(struct i2c_client *client, u8 command,
   u8 mask, u8 set)
 {
@@ -469,6 +437,24 @@ static int tw9910_mask_set(struct i2c_client *client, u8 
command,
return i2c_smbus_write_byte_data(client, command, val);
 }
 
+static int tw9910_set_outputcontrol(struct i2c_client *client)
+{
+   struct tw9910_priv *priv = to_tw9910(client);
+   u32 flags = priv->info->flags;
+   u8 val = 0;
+
+   if (flags & TW9910_FLG_VS_ACTIVE_HIGH)
+   val |= (1 << 7);
+
+   if (flags & TW9910_FLG_HS_ACTIVE_HIGH)
+   val |= (1 << 3);
+
+   val |= ((flags & TW9910_FLG_VS_MASK) >> TW9910_FLG_VS_SHIFT) << 4;
+   val |= ((flags & TW9910_FLG_HS_MASK) >> TW9910_FLG_HS_SHIFT) << 0;
+
+   return tw9910_mask_set(client, OUTCTR1, 0xff, val);
+}
+
 static void tw9910_reset(struct i2c_client *client)
 {
i2c_smbus_write_byte_data(client, ACNTL1, SRESET);
@@ -513,7 +499,7 @@ static int tw9910_s_stream(struct v4l2_subdev *sd, int 
enable)
 {
struct i2c_client *client = sd->priv;
struct tw9910_priv *priv = to_tw9910(client);
-   u8 val;
+   u8 val = OEN;
 
if (!enable) {
switch (priv->rev) {
@@ -556,7 +542,12 @@ static unsigned long tw9910_query_bus_param(struct 
soc_camera_device *icd)
struct soc_camera_link *icl = to_soc_camera_link(icd);
unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
-   SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth;
+   SOCAM_DATA_ACTIVE_HIGH;
+
+   if (TW9910_FLG_DATAWIDTH_16 & priv->info->flags)
+   flags |= SOCAM_DATAWIDTH_16;
+   else
+   flags |= SOCAM_DATAWIDTH_8;
 
return soc_camera_apply_sensor_flags(icl, flags);
 }
@@ -648,7 +639,7 @@ static int tw9910_s_crop(struct v4l2_subdev *sd, struct 
v4l2_crop *a)
 * reset hardware
 */
tw9910_reset(client);
-   ret = tw9910_write_array(client, tw9910_default_regs);
+   ret = tw9910_set_outputcontrol(client);
if (ret < 0)
goto tw9910_set_fmt_error;
 
@@ -656,7 +647,7 @@ static int tw9910_s_crop(struct v4l2_subdev *sd, struct 
v4l2_crop *a)
 * set bus width
 */
val = 0x00;
-   if (SOCAM_DATAWIDTH_16 == priv->info->buswidth)
+   if (TW9910_FLG_DATAWIDTH_16 & priv->info->flags)
val = LEN;
 
ret = tw9910_mask_set(client, OPFORM, LEN, val);
@@ -888,15 +879,6 @@ static int tw9910_video_probe(struct soc_camera_device 
*icd,
to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
return -ENODEV;
 
-   /*
-* tw9910 only use 8 or 16 bit bus width
-*/
-   if (SOCAM_DATAWIDTH_16 != priv->info->buswidth &&
-   SOCAM_DATAWIDTH_8  != priv->info->buswidth) {
-   dev_err(&client->dev, "bus width error\n");
-   return -ENODEV;
-   }
-
icd->formats = tw9910_color_fmt;
icd->num_formats = ARRAY_SIZE(tw9910_color

[PATCH 4/5] soc-camera: tw9910: Remove crop setting

2009-10-12 Thread Kuninori Morimoto

Current driver had been set default value for copping,
but this value need not be changed at now.
In addition, default value is different by Revision 0 and 1.
So, this patch remove this settings

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/tw9910.c |   55 --
 1 files changed, 0 insertions(+), 55 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index bdabc9a..59158bb 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -209,13 +209,6 @@ struct tw9910_scale_ctrl {
u16 vscale;
 };
 
-struct tw9910_cropping_ctrl {
-   u16 vdelay;
-   u16 vactive;
-   u16 hdelay;
-   u16 hactive;
-};
-
 struct tw9910_priv {
struct v4l2_subdevsubdev;
struct tw9910_video_info   *info;
@@ -322,13 +315,6 @@ static const struct tw9910_scale_ctrl tw9910_pal_scales[] 
= {
},
 };
 
-static const struct tw9910_cropping_ctrl tw9910_cropping_ctrl = {
-   .vdelay  = 0x0012,
-   .vactive = 0x00F0,
-   .hdelay  = 0x0010,
-   .hactive = 0x02D0,
-};
-
 /*
  * general function
  */
@@ -360,40 +346,6 @@ static int tw9910_set_scale(struct i2c_client *client,
return ret;
 }
 
-static int tw9910_set_cropping(struct i2c_client *client,
-  const struct tw9910_cropping_ctrl *cropping)
-{
-   int ret;
-
-   ret = i2c_smbus_write_byte_data(client, CROP_HI,
-   (cropping->vdelay  & 0x0300) >> 2 |
-   (cropping->vactive & 0x0300) >> 4 |
-   (cropping->hdelay  & 0x0300) >> 6 |
-   (cropping->hactive & 0x0300) >> 8);
-   if (ret < 0)
-   return ret;
-
-   ret = i2c_smbus_write_byte_data(client, VDELAY_LO,
-   cropping->vdelay & 0x00FF);
-   if (ret < 0)
-   return ret;
-
-   ret = i2c_smbus_write_byte_data(client, VACTIVE_LO,
-   cropping->vactive & 0x00FF);
-   if (ret < 0)
-   return ret;
-
-   ret = i2c_smbus_write_byte_data(client, HDELAY_LO,
-   cropping->hdelay & 0x00FF);
-   if (ret < 0)
-   return ret;
-
-   ret = i2c_smbus_write_byte_data(client, HACTIVE_LO,
-   cropping->hactive & 0x00FF);
-
-   return ret;
-}
-
 static int tw9910_set_hsync(struct i2c_client *client,
const u16 start, const u16 end)
 {
@@ -690,13 +642,6 @@ static int tw9910_s_crop(struct v4l2_subdev *sd, struct 
v4l2_crop *a)
goto tw9910_set_fmt_error;
 
/*
-* set cropping
-*/
-   ret = tw9910_set_cropping(client, &tw9910_cropping_ctrl);
-   if (ret < 0)
-   goto tw9910_set_fmt_error;
-
-   /*
 * set hsync
 */
ret = tw9910_set_hsync(client,
-- 
1.6.0.4

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


[PATCH 5/5] soc-camera: tw9910: Add revision control on tw9910_set_hsync

2009-10-12 Thread Kuninori Morimoto
10 - 3 bit hsync control are same as Rev0/Rev1.
But only rev1 can control more 3 bit for hsync.
This patch modify this problem

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/tw9910.c |   26 +-
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 59158bb..a688c11 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -349,6 +349,7 @@ static int tw9910_set_scale(struct i2c_client *client,
 static int tw9910_set_hsync(struct i2c_client *client,
const u16 start, const u16 end)
 {
+   struct tw9910_priv *priv = to_tw9910(client);
int ret;
 
/* bit 10 - 3 */
@@ -363,15 +364,22 @@ static int tw9910_set_hsync(struct i2c_client *client,
if (ret < 0)
return ret;
 
-   /* bit 2 - 0 */
-   ret = i2c_smbus_read_byte_data(client, HSLOWCTL);
-   if (ret < 0)
-   return ret;
+   /* FIXME
+*
+* So far only revisions 0 and 1 have been seen
+*/
+   if (1 == priv->rev) {
 
-   ret = i2c_smbus_write_byte_data(client, HSLOWCTL,
-   (ret   & 0x88)|
-   (start & 0x0007) << 4 |
-   (end   & 0x0007));
+   /* bit 2 - 0 */
+   ret = i2c_smbus_read_byte_data(client, HSLOWCTL);
+   if (ret < 0)
+   return ret;
+
+   ret = i2c_smbus_write_byte_data(client, HSLOWCTL,
+   (ret   & 0x88)|
+   (start & 0x0007) << 4 |
+   (end   & 0x0007));
+   }
 
return ret;
 }
-- 
1.6.0.4

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


[PATCH 1/5] soc-camera: tw9910: Add revision control

2009-10-13 Thread Kuninori Morimoto
Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/tw9910.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index df7934d..5152d56 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -225,6 +225,7 @@ struct tw9910_priv {
struct v4l2_subdevsubdev;
struct tw9910_video_info   *info;
const struct tw9910_scale_ctrl *scale;
+   int rev;
 };
 
 /*
@@ -570,8 +571,11 @@ static int tw9910_enum_input(struct soc_camera_device *icd,
 static int tw9910_g_chip_ident(struct v4l2_subdev *sd,
   struct v4l2_dbg_chip_ident *id)
 {
+   struct i2c_client *client = sd->priv;
+   struct tw9910_priv *priv = to_tw9910(client);
+
id->ident = V4L2_IDENT_TW9910;
-   id->revision = 0;
+   id->revision = priv->rev;
 
return 0;
 }
@@ -896,6 +900,8 @@ static int tw9910_video_probe(struct soc_camera_device *icd,
return -ENODEV;
}
 
+   priv->rev = GET_ReV(val);
+
dev_info(&client->dev,
 "tw9910 Product ID %0x:%0x\n", GET_ID(val), GET_ReV(val));
 
-- 
1.6.0.4

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


[PATCH 0/5] tw9910: Revision control patches

2009-10-13 Thread Kuninori Morimoto

Dear Guennadi

Kuninori Morimoto :
  soc-camera: tw9910: Add revision control
  soc-camera: tw9910: Add output signal control
  soc-camera: tw9910: Add output pin control.
  soc-camera: tw9910: Remove crop setting
  soc-camera: tw9910: Add revision control on tw9910_set_hsync

I have tw9910 Rev0 and Rev1,
and it have a little difference.
These patches absorbs the difference of revision. 
And add new flags for platform.

These patches are tested on EcoVec24 and MigoR board.

These patches are depend on
30 Sep 2009[PATCH 0/4] tw9910: Add INTERLACE TB/BT support

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


Re: [PATCH 2/5] soc-camera: tw9910: Add output signal control

2009-10-13 Thread Kuninori Morimoto

Dear Guennadi

Thank you for checking patch

> Is this to tri-state the output? Ok, from the datasheet it tri-states all 
> outputs except clocks. My copy of the datasheet is funny at this point. It 
(snip)
> #define OEN_TRI_SEL_ALL_ON0
> #define OEN_TRI_SEL_CLK_ON4

OK

> Ok, it's 8:30 here, so, I might be still not quite awake... but I fail to 
> understand, why you bother calculating val above if you anyway just return 
(snip)
> dreaming. Oh, I see, you fix it in the next patch. Please, don't do that! 
> Don't introduce bugs to fix them in a later patch. Do it here.

oh my god.
It is very buggy patch.
It seems to had broken while patch clean up

> While at it, could you also fix that typo copied from the datasheet: 
> s/HSGEGIN/HSBEGIN/g?

OK

>>  struct tw9910_video_info {
>> -unsigned long  buswidth;
>> +u32  flags;
>>  enum tw9910_mpout_pin  mpout;
>>  struct soc_camera_link link;
>>  u16 start_offset;
>
>Hm, I am not convinced I liked all this. Do we understand what these 
>configuration options are doing? Datasheet is not very verbose on that 
>occasion. Is this configuration really platform-specific? What values have 
>you found meaningful in which cases?

I need research about this.
I might have made a big mistake. 

I should re-check my patches and consider all of your comment.
Thank you

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


[PATCH v2] soc-camera: tw9910: modify V/H outpit pin setting to use VALID

2009-11-12 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
v1 -> v2

o remove un-understandable explain.
  -> tw9910_query_bus_param need not modify now
o move OUTCTR1 setting to tw9910_set_bus_param

 drivers/media/video/tw9910.c |   38 --
 1 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 6d8dede..82135f2 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -239,18 +239,6 @@ struct tw9910_priv {
u32 revision;
 };
 
-/*
- * register settings
- */
-
-#define ENDMARKER { 0xff, 0xff }
-
-static const struct regval_list tw9910_default_regs[] =
-{
-   { OUTCTR1, VSP_LO | VSSL_VVALID | HSP_HI | HSSL_HSYNC },
-   ENDMARKER,
-};
-
 static const enum v4l2_imgbus_pixelcode tw9910_color_codes[] = {
V4L2_IMGBUS_FMT_VYUY,
 };
@@ -463,20 +451,6 @@ static int tw9910_set_hsync(struct i2c_client *client,
return ret;
 }
 
-static int tw9910_write_array(struct i2c_client *client,
- const struct regval_list *vals)
-{
-   while (vals->reg_num != 0xff) {
-   int ret = i2c_smbus_write_byte_data(client,
-   vals->reg_num,
-   vals->value);
-   if (ret < 0)
-   return ret;
-   vals++;
-   }
-   return 0;
-}
-
 static void tw9910_reset(struct i2c_client *client)
 {
tw9910_mask_set(client, ACNTL1, SRESET, SRESET);
@@ -578,7 +552,14 @@ static int tw9910_s_stream(struct v4l2_subdev *sd, int 
enable)
 static int tw9910_set_bus_param(struct soc_camera_device *icd,
unsigned long flags)
 {
-   return 0;
+   struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+   struct i2c_client *client = sd->priv;
+
+   /*
+* set OUTCTR1
+*/
+   return i2c_smbus_write_byte_data(client, OUTCTR1,
+VSSL_VVALID | HSSL_DVALID);
 }
 
 static unsigned long tw9910_query_bus_param(struct soc_camera_device *icd)
@@ -681,9 +662,6 @@ static int tw9910_s_crop(struct v4l2_subdev *sd, struct 
v4l2_crop *a)
 * reset hardware
 */
tw9910_reset(client);
-   ret = tw9910_write_array(client, tw9910_default_regs);
-   if (ret < 0)
-   goto tw9910_set_fmt_error;
 
/*
 * set bus width
-- 
1.6.3.3

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


Re: [PATCH v2] soc-camera: tw9910: modify V/H outpit pin setting to use VALID

2009-11-13 Thread Kuninori Morimoto

Dear Guennadi

Thank you for checking patch

> + ret = i2c_smbus_write_byte_data(client, OUTCTR1,
> + VSP_LO | VSSL_VVALID |
> + HSP_LO | HSSL_DVALID);
> 
> now you dropped VSP_LO | HSP_LO, could you, please, explain, why? Also, 
> sorry for not explaining properly. Yesterday I wrote

Because VSP_LO = HSP_LO = 0.
And when I use xVALID, xSP_LO mean ACTIVE HI.

So, I drop these explain because it is just un-understandable.

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


Re: [PATCH v2] soc-camera: tw9910: modify V/H outpit pin setting to use VALID

2009-11-15 Thread Kuninori Morimoto

Dear Guennadi

Thank you

> Oh, indeed. Ok, but can you add proper support for both high and low 
> polarities?

I think your order will be added in next patch.
"Add polarities support"
I will send it
OK ?

By the way.
Maybe I should ask you about it.

My question is that who select ACTIVE HI / LOW ?

-
unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
+   SOCAM_VSYNC_ACTIVE_LOW | SOCAM_HSYNC_ACTIVE_LOW |
SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth;
-

If I add above, and (for example) CEU - tw9910 case,
tw9910_query_bus_param will be used in
sh_mobile_ceu_set_bus_param.

Then, the answer from soc_camera_bus_param_compatible
have both xSYNC_ACTIVE_HIGH/LOW.
In this case, CEU behavior will be LOW,
though it have HIGH.
Please check it.

In my opinion, the answer from soc_camera_bus_param_compatible
should not have both ACTIVE HIGH/LOW.
This value will be used in tw9910_set_bus_param too.

I guess, to add your order, we needs more than 2 patches.

"modify soc_camera_bus_param_compatible behavior"
"tw9910: Add polarities support"

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


[PATCH] soc-camera: Add mt9t112 camera support

2009-11-19 Thread Kuninori Morimoto
Signed-off-by: Kuninori Morimoto 
---
>> Guennadi

I add new number in v4l2-chip-ident.h
Is it OK for you ?

This camera is very picky.
So, it have a lot of constant value.

The register of mt9t112 and mt9t111 are same.
But I have mt9t112 only.
mt9t111 should also work, but I can not check.

This patch is based on your 20091105 patches.

 drivers/media/video/Kconfig |6 +
 drivers/media/video/Makefile|1 +
 drivers/media/video/mt9t112.c   | 1158 +++
 include/media/mt9t112.h |   32 ++
 include/media/v4l2-chip-ident.h |2 +
 5 files changed, 1199 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/mt9t112.c
 create mode 100644 include/media/mt9t112.h

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 0ab7ccd..0aec969 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -840,6 +840,12 @@ config SOC_CAMERA_MT9T031
help
  This driver supports MT9T031 cameras from Micron.
 
+config SOC_CAMERA_MT9T112
+   tristate "mt9t112 support"
+   depends on SOC_CAMERA && I2C
+   help
+ This driver supports MT9T112 cameras from Aptina.
+
 config SOC_CAMERA_MT9V022
tristate "mt9v022 support"
depends on SOC_CAMERA && I2C
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 62d8907..b0e27b2 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -75,6 +75,7 @@ obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
 obj-$(CONFIG_SOC_CAMERA_MT9M001)   += mt9m001.o
 obj-$(CONFIG_SOC_CAMERA_MT9M111)   += mt9m111.o
 obj-$(CONFIG_SOC_CAMERA_MT9T031)   += mt9t031.o
+obj-$(CONFIG_SOC_CAMERA_MT9T112)   += mt9t112.o
 obj-$(CONFIG_SOC_CAMERA_MT9V022)   += mt9v022.o
 obj-$(CONFIG_SOC_CAMERA_OV772X)+= ov772x.o
 obj-$(CONFIG_SOC_CAMERA_OV9640)+= ov9640.o
diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
new file mode 100644
index 000..8ca2128
--- /dev/null
+++ b/drivers/media/video/mt9t112.c
@@ -0,0 +1,1158 @@
+/*
+ * mt9t112 Camera Driver
+ *
+ * Copyright (C) 2009 Renesas Solutions Corp.
+ * Kuninori Morimoto 
+ *
+ * Based on ov772x driver, mt9m111 driver,
+ *
+ * Copyright (C) 2008 Kuninori Morimoto 
+ * Copyright (C) 2008, Robert Jarzmik 
+ * Copyright 2006-7 Jonathan Corbet 
+ * Copyright (C) 2008 Magnus Damm
+ * Copyright (C) 2008, Guennadi Liakhovetski 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* you can check PLL/clock info */
+/* #define EXT_CLOCK 2400 */
+
+/
+
+
+   macro
+
+
+/
+/*
+ * frame size
+ */
+#define MAX_WIDTH   2048
+#define MAX_HEIGHT  1536
+
+#define VGA_WIDTH   640
+#define VGA_HEIGHT  480
+
+/*
+ * macro of read/write
+ */
+#define ECHECKER(x)\
+   do {\
+   ret = x;\
+   if (ret < 0)\
+   return ret; \
+   } while (0)
+
+#define mt9t112_reg_write(a, b)  ECHECKER(__mt9t112_reg_write(client, a, b))
+#define mt9t112_mcu_write(a, b)  ECHECKER(__mt9t112_mcu_write(client, a, b))
+
+#define mt9t112_reg_mask_set(a, b, c)\
+   ECHECKER(__mt9t112_reg_mask_set(client, a, b, c))
+#define mt9t112_mcu_mask_set(a, b, c)\
+   ECHECKER(__mt9t112_mcu_mask_set(client, a, b, c))
+
+#define mt9t112_reg_read(a)  __mt9t112_reg_read(client, a)
+#define mt9t112_mcu_read(a)  __mt9t112_mcu_read(client, a)
+
+/*
+ * Logical address
+ */
+#define _VAR(id, offset, base) (base | (id & 0x1f) << 10 | (offset & 0x3ff))
+#define VAR(id, offset)  _VAR(id, offset, 0x)
+#define VAR8(id, offset) _VAR(id, offset, 0x8000)
+
+/
+
+
+   struct
+
+
+/
+struct mt9t112_frame_size {
+   u16 width;
+   u16 height;
+};
+
+struct mt9t112_format {
+   const enum v4l2_imgbus_pixelcode code;
+   u16 fmt;
+   u16 order;
+};
+
+struct mt9t112_priv {
+   struct v4l2_subdev   subdev;
+   struct mt9t112_camera_info  *info;
+   struct i2c_client   *client;
+   struct soc_camera_device icd;
+   struct mt9t112_frame_sizeframe;
+   const struct mt9t112_format *format;
+   int  model;
+   u32

Re: [PATCH v2] soc-camera: tw9910: modify V/H outpit pin setting to use VALID

2009-11-19 Thread Kuninori Morimoto

Dear Guennadi

Thank you for your comment !

> > I think your order will be added in next patch.
> > "Add polarities support"
> > I will send it
> > OK ?
> 
> Ok, we can do that too.

Thank you

> This is how the pxa_camera.c driver does it in pxa_camera_set_bus_param(). 
> What actually happens in sh_mobile_ceu_camera.c, is that it keeps both 
> polarities in its call to the client, so, the client picks up randomly one 
> of them, then the host does the same. So, with a probability of 1/2 they 
> will choose opposite polarities:-)
> 
> > I guess, to add your order, we needs more than 2 patches.
> > 
> > "modify soc_camera_bus_param_compatible behavior"
> 
> No. We should fix the sh-CEU driver.

Thank you !!
I can understand !!
I will study pxa_camera_set_bus_param.

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


[PATCH] soc-camera: sh_mobile_ceu_camera: Add support sync polarity selection

2009-11-19 Thread Kuninori Morimoto
Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/sh_mobile_ceu_camera.c |   25 +
 include/media/sh_mobile_ceu.h  |3 +++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index 746aed0..e5cee0f 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -660,6 +660,31 @@ static int sh_mobile_ceu_set_bus_param(struct 
soc_camera_device *icd,
if (!common_flags)
return -EINVAL;
 
+   /* Make choises, based on platform preferences */
+   if ((common_flags & SOCAM_HSYNC_ACTIVE_HIGH) &&
+   (common_flags & SOCAM_HSYNC_ACTIVE_LOW)) {
+   if (pcdev->pdata->flags & SH_CEU_FLAG_HSP)
+   common_flags &= ~SOCAM_HSYNC_ACTIVE_HIGH;
+   else
+   common_flags &= ~SOCAM_HSYNC_ACTIVE_LOW;
+   }
+
+   if ((common_flags & SOCAM_VSYNC_ACTIVE_HIGH) &&
+   (common_flags & SOCAM_VSYNC_ACTIVE_LOW)) {
+   if (pcdev->pdata->flags & SH_CEU_FLAG_VSP)
+   common_flags &= ~SOCAM_VSYNC_ACTIVE_HIGH;
+   else
+   common_flags &= ~SOCAM_VSYNC_ACTIVE_LOW;
+   }
+
+   if ((common_flags & SOCAM_PCLK_SAMPLE_RISING) &&
+   (common_flags & SOCAM_PCLK_SAMPLE_FALLING)) {
+   if (pcdev->pdata->flags & SH_CEU_FLAG_PCP)
+   common_flags &= ~SOCAM_PCLK_SAMPLE_RISING;
+   else
+   common_flags &= ~SOCAM_PCLK_SAMPLE_FALLING;
+   }
+
ret = icd->ops->set_bus_param(icd, common_flags);
if (ret < 0)
return ret;
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 0f3524c..3726daf 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -3,6 +3,9 @@
 
 #define SH_CEU_FLAG_USE_8BIT_BUS   (1 << 0) /* use  8bit bus width */
 #define SH_CEU_FLAG_USE_16BIT_BUS  (1 << 1) /* use 16bit bus width */
+#define SH_CEU_FLAG_PCP(1 << 2) /* Pixel clock 
polarity */
+#define SH_CEU_FLAG_HSP(1 << 3) /* Horizontal sync 
polarity */
+#define SH_CEU_FLAG_VSP(1 << 4) /* Vertical sync 
polarity */
 
 struct sh_mobile_ceu_info {
unsigned long flags;
-- 
1.6.3.3

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


[PATCH] soc-camera: tw9910: Add sync polarity support

2009-11-19 Thread Kuninori Morimoto
Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/tw9910.c |   22 +++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index a4ba720..243207d 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -166,7 +166,7 @@
 #define VSSL_FIELD  0x20 /*   2 : FIELD  */
 #define VSSL_VVALID 0x30 /*   3 : VVALID */
 #define VSSL_ZERO   0x70 /*   7 : 0  */
-#define HSP_LOW 0x00 /* 0 : HS pin output polarity is active low */
+#define HSP_LO  0x00 /* 0 : HS pin output polarity is active low */
 #define HSP_HI  0x08 /* 1 : HS pin output polarity is active high.*/
 /* HS pin output control */
 #define HSSL_HACT   0x00 /*   0 : HACT   */
@@ -175,6 +175,11 @@
 #define HSSL_HLOCK  0x03 /*   3 : HLOCK  */
 #define HSSL_ASYNCW 0x04 /*   4 : ASYNCW */
 #define HSSL_ZERO   0x07 /*   7 : 0  */
+/* xSSL_xVALID polarity */
+#define VSP_V_LOVSP_HI /* xSSL_xVALID case, polarity will be inverted */
+#define VSP_V_HIVSP_LO
+#define HSP_V_LOHSP_HI
+#define HSP_V_HIHSP_LO
 
 /* ACNTL1 */
 #define SRESET  0x80 /* resets the device to its default state
@@ -513,12 +518,22 @@ static int tw9910_set_bus_param(struct soc_camera_device 
*icd,
 {
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct i2c_client *client = sd->priv;
+   u8 val = VSSL_VVALID | HSSL_DVALID;
 
/*
 * set OUTCTR1
 */
-   return i2c_smbus_write_byte_data(client, OUTCTR1,
-VSSL_VVALID | HSSL_DVALID);
+   if (flags & SOCAM_HSYNC_ACTIVE_LOW)
+   val |= HSP_V_LO;
+   else
+   val |= HSP_V_HI;
+
+   if (flags & SOCAM_VSYNC_ACTIVE_LOW)
+   val |= VSP_V_LO;
+   else
+   val |= VSP_V_HI;
+
+   return i2c_smbus_write_byte_data(client, OUTCTR1, val);
 }
 
 static unsigned long tw9910_query_bus_param(struct soc_camera_device *icd)
@@ -528,6 +543,7 @@ static unsigned long tw9910_query_bus_param(struct 
soc_camera_device *icd)
struct soc_camera_link *icl = to_soc_camera_link(icd);
unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
+   SOCAM_VSYNC_ACTIVE_LOW  | SOCAM_HSYNC_ACTIVE_LOW  |
SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth;
 
return soc_camera_apply_sensor_flags(icl, flags);
-- 
1.6.3.3

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


Re: [PATCH v2] soc-camera: tw9910: modify V/H outpit pin setting to use VALID

2009-11-23 Thread Kuninori Morimoto

Dear Guennadi


> Hm, strange... This doesn't work at all for me. Getting only timeouts. 
> Have you tested this on Migo-R?

Hmm.. strange...
It works well on my environment.
Of course Migo-R too.

my environment is based on your 20091105 patches
and my patches

Kuninori Morimoto (13):
  soc-camera: tw9910: Add revision control
  soc-camera: tw9910: fix a persistent ID calculation
  soc-camera: tw9910: Add tri-state control
  soc-camera: tw9910: Add power control
  soc-camera: tw9910: tw9910_set_hsync clean up
  soc-camera: tw9910: Add revision control on tw9910_set_hsync
->soc-camera: tw9910: modify V/H outpit pin setting to use VALID
  soc-camera: tw9910: modify output format
  soc-camera: tw9910: remove cropping
  soc-camera: sh_mobile_ceu: Add V4L2_FIELD_INTERLACED_BT/TB support
  soc-camera: tw9910: use V4L2_FIELD_INTERLACED_BT
  soc-camera: sh_mobile_ceu_camera: Add support sync polarity selection
  soc-camera: tw9910: Add sync polarity support

if you use arrow point,
you can get strange color output, but get image I think.
(to get correct color, next "modify output format" is needed)


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


Re: [PATCH/RFC] sh_mobile_ceu_camera: fix pass-through geometry parameters and try_fmt reporting

2009-11-23 Thread Kuninori Morimoto

> Fix geometry parameter calculations for the pass-through mode, using the 
> imagebus API, Also fix try-fmt result reporting for natively supported by 
> the driver pixel formats.
> 
> Signed-off-by: Guennadi Liakhovetski 
> ---
> 
> Marked as RFC because this is based on my imagebus tree. Otherwise this is 
> nothing new, I've had this fix for a while in my tree, just forgot to post 
> together with the rest, when presenting my imagebus stack.

This patch seems solve my "broken image" problem !!

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


Re: [PATCH] soc-camera: sh_mobile_ceu_camera: Add support sync polarity selection

2009-11-23 Thread Kuninori Morimoto

Dear Guennadi

Thank you checking

> In any case, this confirms, how important good name choice is:-) Now, HSP, 
> etc. have nothing to do with SH, on CEU these fields are called HDPOL and 
> VDPOL. But I would suggest some descriptive names, like 
> SH_CEU_FLAG_HSYNC_HIGH or similar.

OK. I understand.
I will modify it as soon as possible !!

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


Re: [PATCH] soc-camera: tw9910: Add sync polarity support

2009-11-23 Thread Kuninori Morimoto

Dear Guennadi

> > -#define HSP_LOW 0x00 /* 0 : HS pin output polarity is active low */
> > +#define HSP_LO  0x00 /* 0 : HS pin output polarity is active low */
> 
> I would remove field names with "0" values completely. Also see below
(snip)
> > +#define VSP_V_LOVSP_HI /* xSSL_xVALID case, polarity will be inverted 
> > */
> > +#define VSP_V_HIVSP_LO
> > +#define HSP_V_LOHSP_HI
> > +#define HSP_V_HIHSP_LO
> 
> I wouldn't add these - just add a comment below and use reverted 
> [HV]SP_{HI,LO} macros.

Hmm OK.

> + /*
> +  * We use VVALID and DVALID signals to control VSYNC and HSYNC
> +  * outputs, in this mode their polarity is inverted.
> +  */
> + if (flags & SOCAM_HSYNC_ACTIVE_LOW)
> +     val |= HSP_HI;
> 
> without any else, agree?

agree.
OK I will modify it.

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


[PATCH v2] soc-camera: sh_mobile_ceu_camera: Add support sync polarity selection

2009-11-23 Thread Kuninori Morimoto
Signed-off-by: Kuninori Morimoto 
---
v1 -> v2

o remove pclock field
o rename macro

 drivers/media/video/sh_mobile_ceu_camera.c |   17 +
 include/media/sh_mobile_ceu.h  |2 ++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index b259884..3980fcd 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -674,6 +674,23 @@ static int sh_mobile_ceu_set_bus_param(struct 
soc_camera_device *icd,
if (!common_flags)
return -EINVAL;
 
+   /* Make choises, based on platform preferences */
+   if ((common_flags & SOCAM_HSYNC_ACTIVE_HIGH) &&
+   (common_flags & SOCAM_HSYNC_ACTIVE_LOW)) {
+   if (pcdev->pdata->flags & SH_CEU_FLAG_HSYNC_LOW)
+   common_flags &= ~SOCAM_HSYNC_ACTIVE_HIGH;
+   else
+   common_flags &= ~SOCAM_HSYNC_ACTIVE_LOW;
+   }
+
+   if ((common_flags & SOCAM_VSYNC_ACTIVE_HIGH) &&
+   (common_flags & SOCAM_VSYNC_ACTIVE_LOW)) {
+   if (pcdev->pdata->flags & SH_CEU_FLAG_VSYNC_LOW)
+   common_flags &= ~SOCAM_VSYNC_ACTIVE_HIGH;
+   else
+   common_flags &= ~SOCAM_VSYNC_ACTIVE_LOW;
+   }
+
ret = icd->ops->set_bus_param(icd, common_flags);
if (ret < 0)
return ret;
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 0f3524c..b677478 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -3,6 +3,8 @@
 
 #define SH_CEU_FLAG_USE_8BIT_BUS   (1 << 0) /* use  8bit bus width */
 #define SH_CEU_FLAG_USE_16BIT_BUS  (1 << 1) /* use 16bit bus width */
+#define SH_CEU_FLAG_HSYNC_LOW  (1 << 2) /* default High if possible */
+#define SH_CEU_FLAG_VSYNC_LOW  (1 << 3) /* default High if possible */
 
 struct sh_mobile_ceu_info {
unsigned long flags;
-- 
1.6.3.3

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


[PATCH v2] soc-camera: tw9910: Add sync polarity support

2009-11-23 Thread Kuninori Morimoto
Signed-off-by: Kuninori Morimoto 
---
v1 -> v2

o remove noisy macro
o add explain for polarity inverte 

 drivers/media/video/tw9910.c |   14 --
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index a4ba720..fe46c2c 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -513,12 +513,21 @@ static int tw9910_set_bus_param(struct soc_camera_device 
*icd,
 {
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct i2c_client *client = sd->priv;
+   u8 val = VSSL_VVALID | HSSL_DVALID;
 
/*
 * set OUTCTR1
+*
+* We use VVALID and DVALID signals to control VSYNC and HSYNC
+* outputs, in this mode their polarity is inverted.
 */
-   return i2c_smbus_write_byte_data(client, OUTCTR1,
-VSSL_VVALID | HSSL_DVALID);
+   if (flags & SOCAM_HSYNC_ACTIVE_LOW)
+   val |= HSP_HI;
+
+   if (flags & SOCAM_VSYNC_ACTIVE_LOW)
+   val |= VSP_HI;
+
+   return i2c_smbus_write_byte_data(client, OUTCTR1, val);
 }
 
 static unsigned long tw9910_query_bus_param(struct soc_camera_device *icd)
@@ -528,6 +537,7 @@ static unsigned long tw9910_query_bus_param(struct 
soc_camera_device *icd)
struct soc_camera_link *icl = to_soc_camera_link(icd);
unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
+   SOCAM_VSYNC_ACTIVE_LOW  | SOCAM_HSYNC_ACTIVE_LOW  |
SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth;
 
return soc_camera_apply_sensor_flags(icl, flags);
-- 
1.6.3.3

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


Re: [PATCH] soc-camera: Add mt9t112 camera support

2009-11-25 Thread Kuninori Morimoto

Hi Magnus

> Do you have any mt9t112 platform data for the ecovec board? I'd like
> to try out this patch but I don't know which board specific parts that
> are missing!

Yes I have.
I attached it.
This platform patch is based on Guennadi's latest patches.

I also attached tw9910 platform patch.
Please apply in order of tw9910 -> mt9t112.

Best regards
--
Kuninori Morimoto


0001-sh-mach-ecovec24-Add-tw9910-support.patch
Description: Binary data


0002-sh-mach-ecovec24-Add-mt9t112-camera-support.patch
Description: Binary data


Re: [PATCH] soc-camera: Add mt9t112 camera support

2009-11-26 Thread Kuninori Morimoto

Hi Magnus

> So now I've done some testing of the mt9t112 sensor hooked up to CEU0
> on the ecovec board. I tried 16-bit RGB and NV12 in various
> resolutions with mplayer. My only comment is that it seems to take a
> bit of time to setup the sensor initially, but that may be something
> related to the camera sensor itself.

Yes, This driver needs long time for init only once.
I think you can find it on last of mt9t112_init_pll.
This driver is very picky...

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


Re: soc-camera: what's in the queue for 2.6.33

2009-12-06 Thread Kuninori Morimoto

Dear Guennadi

Sorry for late response

> Morimoto-san: I modified a bit your mt9t112 driver, apart from just 
> porting it to the current mediabus version. Please check, if you agree 
> with all changes and if it still works:-)

Of course I agree.
But sorry I'm very busy this week, so, I can not test it now.
I hope it works =)

> Guennadi Liakhovetski (14):
(snip)
>   soc-camera: Add mt9t112 camera driver

I think this mt9t112 driver patch should under my name =)

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


How to know which camera is /dev/videoX

2009-12-24 Thread Kuninori Morimoto

Dear Guennadi

Now my board (EcoVec) can use 2 soc-camera (mt9t112 / tw9910),
and mt9t112 can attach/detach.

If mt9t112 is attached,
/dev/video0 = mt9t112
/dev/video1 = tw9910

But if mt9t112 is detached, it will
/dev/video0 = tw9910

Now I would like to know which camera is /dev/video0.
my /dev/video0 is

> ls -l /dev/video0
> crw--w  1 root 1000 81, 0 Jun  9  2009 /dev/video0

I cheked 81:0 's name

> cat /sys/dev/char/81\:0/name
> sh_mobile_ceu.1

Above name is host of soc-camera for me.
Are there any way to know camera name (mt9t112/tw9910) ?

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


Re: How to know which camera is /dev/videoX

2009-12-27 Thread Kuninori Morimoto

Dear Guennadi, Andy

Thank you for your help !!

It is possible to identify it by this method.

check videoX
/sys/bus/soc-camera/devices/0-0/video4linux:video0
/sys/bus/soc-camera/devices/1-0/video4linux:video1

get name
/sys/bus/soc-camera/devices/0-0/control/name  -> mt9t112
/sys/bus/soc-camera/devices/1-0/control/name  -> tw9910

> $ v4l2-ctl --list-devices
> $ v4l2-ctl -d /dev/video0 -D
> $ v4l2-ctl -d /dev/video0 --log-status
> $ v4l2-ctl -d /dev/video1 -D
> $ v4l2-ctl -d /dev/video1 --log-status

wow... I didn't know this way.
Thank you for your nice advice !!
It will be good help for me

Thanks again !!

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


Re: [PATCH v2] soc-camera: fix missing clean up on error path

2009-06-21 Thread Kuninori Morimoto

Dear Guennadi

Thank you for your hard work

> > soc_camera_video_stop is called from icd->ops->remove 
> > I think it have dead lock by icd->video_lock.
> > 
> > my kernel is from Paul's git and it's Makefile said 2.6.30-rc6
> 
> Yes, you're right. Please, try this version, but this is a bigger change, 
> also affecting the regular (not error) path, so, I will have to test it 
> too.

Thanks. but I'm very busy now.
Please wait for me.

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


Re: [PATCH v2] soc-camera: fix missing clean up on error path

2009-06-25 Thread Kuninori Morimoto

Dear Guennadi

> > Yes, you're right. Please, try this version, but this is a bigger change, 
> > also affecting the regular (not error) path, so, I will have to test it 
> > too.
> 
> Thanks. but I'm very busy now.
> Please wait for me.

I tested this patch.
And I works well for me !!

Thank you

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


[PATCH 1/2] ov772x: bit mask operation fix on ov772x_mask_set.

2009-01-18 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/ov772x.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index b75420d..c8e10d3 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -566,8 +566,11 @@ static int ov772x_mask_set(struct i2c_client *client,
  u8  set)
 {
s32 val = i2c_smbus_read_byte_data(client, command);
+   if (val < 0)
+   return val;
+
val &= ~mask;
-   val |=  set;
+   val |= (set & mask);
 
return i2c_smbus_write_byte_data(client, command, val);
 }
-- 
1.5.6.3

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


[PATCH v2 2/2] ov772x: Add image flip support

2009-01-18 Thread Kuninori Morimoto
o ov772x_camera_info :: flags supports default image flip.
o V4L2_CID_VFLIP/HFLIP supports image flip on user side.
Thank Magnus for advice.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/ov772x.c |   97 --
 include/media/ov772x.h   |5 ++
 2 files changed, 98 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 3341857..ca0cf3c 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -218,9 +218,10 @@
 
 /* COM3 */
 #define SWAP_MASK   0x38
+#define IMG_MASK0xC0
 
-#define VFIMG_ON_OFF0x80   /* Vertical flip image ON/OFF selection */
-#define HMIMG_ON_OFF0x40   /* Horizontal mirror image ON/OFF selection */
+#define VFLIP_IMG   0x80   /* Vertical flip image ON/OFF selection */
+#define HFLIP_IMG   0x40   /* Horizontal mirror image ON/OFF selection */
 #define SWAP_RGB0x20   /* Swap B/R  output sequence in RGB mode */
 #define SWAP_YUV0x10   /* Swap Y/UV output sequence in YUV mode */
 #define SWAP_ML 0x08   /* Swap output MSB/LSB */
@@ -540,6 +541,27 @@ static const struct ov772x_win_size ov772x_win_qvga = {
.regs = ov772x_qvga_regs,
 };
 
+static const struct v4l2_queryctrl ov772x_controls[] = {
+   {
+   .id = V4L2_CID_VFLIP,
+   .type   = V4L2_CTRL_TYPE_BOOLEAN,
+   .name   = "Flip Vertically",
+   .minimum= 0,
+   .maximum= 1,
+   .step   = 1,
+   .default_value  = 0,
+   },
+   {
+   .id = V4L2_CID_HFLIP,
+   .type   = V4L2_CTRL_TYPE_BOOLEAN,
+   .name   = "Flip Horizontally",
+   .minimum= 0,
+   .maximum= 1,
+   .step   = 1,
+   .default_value  = 0,
+   },
+};
+
 
 /*
  * general function
@@ -650,6 +672,60 @@ static unsigned long ov772x_query_bus_param(struct 
soc_camera_device *icd)
return soc_camera_apply_sensor_flags(icl, flags);
 }
 
+static int ov772x_get_control(struct soc_camera_device *icd,
+ struct v4l2_control *ctrl)
+{
+   struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
+   s32 val;
+
+   switch (ctrl->id) {
+   case V4L2_CID_VFLIP:
+   val = i2c_smbus_read_byte_data(priv->client, COM3);
+   if (val < 0)
+   return val;
+   if (priv->info->flags & OV772X_FLAG_VFLIP)
+   val ^= VFLIP_IMG;
+   val &= VFLIP_IMG;
+   ctrl->value = !!val;
+   break;
+   case V4L2_CID_HFLIP:
+   val = i2c_smbus_read_byte_data(priv->client, COM3);
+   if (val < 0)
+   return val;
+   if (priv->info->flags & OV772X_FLAG_HFLIP)
+   val ^= HFLIP_IMG;
+   val &= HFLIP_IMG;
+   ctrl->value = !!val;
+   break;
+   }
+   return 0;
+}
+
+static int ov772x_set_control(struct soc_camera_device *icd,
+ struct v4l2_control *ctrl)
+{
+   struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
+   int ret = 0;
+   u8 val;
+
+   switch (ctrl->id) {
+   case V4L2_CID_VFLIP:
+   val = (ctrl->value) ? VFLIP_IMG : 0x00;
+   if (priv->info->flags & OV772X_FLAG_VFLIP)
+   val ^= VFLIP_IMG;
+   ret = ov772x_mask_set(priv->client, COM3, VFLIP_IMG, val);
+   break;
+   case V4L2_CID_HFLIP:
+   val = (ctrl->value) ? HFLIP_IMG : 0x00;
+   if (priv->info->flags & OV772X_FLAG_HFLIP)
+   val ^= HFLIP_IMG;
+   ret = ov772x_mask_set(priv->client, COM3, HFLIP_IMG, val);
+   break;
+   }
+
+   return ret;
+}
+
 static int ov772x_get_chip_id(struct soc_camera_device *icd,
  struct v4l2_dbg_chip_ident   *id)
 {
@@ -720,7 +796,7 @@ static int ov772x_set_fmt(struct soc_camera_device *icd,
 {
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
int ret = -EINVAL;
-   u8  val;
+   u8  val, mask;
int i;
 
/*
@@ -768,8 +844,17 @@ static int ov772x_set_fmt(struct soc_camera_device *icd,
 * set COM3
 */
val = priv->fmt->com3;
+   if (priv->info->flags & OV772X_FLAG_VFLIP)
+   val |= VFLIP_IMG;
+   if (priv->info->flags & OV772X_FLAG_HFLIP)
+   val |= HFLIP_IMG;
+
+   mask = SWAP_MASK;
+   if (IMG_MASK & val)
+   mask |= IMG_MASK;
+
ret = ov772x_mask_set(

[PATCH v2 1/2] ov772x: bit mask operation fix on ov772x_mask_set.

2009-01-19 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
v1 -> v2
remove superfluous parenthesis.

 drivers/media/video/ov772x.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 80218d3..7cf4fbe 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -565,8 +565,11 @@ static int ov772x_mask_set(struct i2c_client *client,
  u8  set)
 {
s32 val = i2c_smbus_read_byte_data(client, command);
+   if (val < 0)
+   return val;
+
val &= ~mask;
-   val |=  set;
+   val |= set & mask;
 
return i2c_smbus_write_byte_data(client, command, val);
 }
-- 
1.5.6.3

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


[PATCH v3 1/2] ov772x: Add image flip support

2009-01-19 Thread Kuninori Morimoto
o ov772x_camera_info :: flags supports default image flip.
o V4L2_CID_VFLIP/HFLIP supports image flip for user side.
Thank Magnus for advice.

Signed-off-by: Kuninori Morimoto 
---
v2 -> v3
o remove superfluous parenthesis.
o remember v/h flipped
o fix get_control method
o fix MASK define

 drivers/media/video/ov772x.c |   88 --
 include/media/ov772x.h   |5 ++
 2 files changed, 89 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 7cf4fbe..681a11b 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -217,10 +217,11 @@
 #define OCAP_4x 0x03   /* 4x */
 
 /* COM3 */
-#define SWAP_MASK   0x38
+#define SWAP_MASK   (SWAP_RGB | SWAP_YUV | SWAP_ML)
+#define IMG_MASK(VFLIP_IMG | HFLIP_IMG)
 
-#define VFIMG_ON_OFF0x80   /* Vertical flip image ON/OFF selection */
-#define HMIMG_ON_OFF0x40   /* Horizontal mirror image ON/OFF selection */
+#define VFLIP_IMG   0x80   /* Vertical flip image ON/OFF selection */
+#define HFLIP_IMG   0x40   /* Horizontal mirror image ON/OFF selection */
 #define SWAP_RGB0x20   /* Swap B/R  output sequence in RGB mode */
 #define SWAP_YUV0x10   /* Swap Y/UV output sequence in YUV mode */
 #define SWAP_ML 0x08   /* Swap output MSB/LSB */
@@ -395,6 +396,8 @@ struct ov772x_priv {
const struct ov772x_color_format *fmt;
const struct ov772x_win_size *win;
int   model;
+   unsigned int  flag_vflip:1;
+   unsigned int  flag_hflip:1;
 };
 
 #define ENDMARKER { 0xff, 0xff }
@@ -540,6 +543,27 @@ static const struct ov772x_win_size ov772x_win_qvga = {
.regs = ov772x_qvga_regs,
 };
 
+static const struct v4l2_queryctrl ov772x_controls[] = {
+   {
+   .id = V4L2_CID_VFLIP,
+   .type   = V4L2_CTRL_TYPE_BOOLEAN,
+   .name   = "Flip Vertically",
+   .minimum= 0,
+   .maximum= 1,
+   .step   = 1,
+   .default_value  = 0,
+   },
+   {
+   .id = V4L2_CID_HFLIP,
+   .type   = V4L2_CTRL_TYPE_BOOLEAN,
+   .name   = "Flip Horizontally",
+   .minimum= 0,
+   .maximum= 1,
+   .step   = 1,
+   .default_value  = 0,
+   },
+};
+
 
 /*
  * general function
@@ -650,6 +674,49 @@ static unsigned long ov772x_query_bus_param(struct 
soc_camera_device *icd)
return soc_camera_apply_sensor_flags(icl, flags);
 }
 
+static int ov772x_get_control(struct soc_camera_device *icd,
+ struct v4l2_control *ctrl)
+{
+   struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
+
+   switch (ctrl->id) {
+   case V4L2_CID_VFLIP:
+   ctrl->value = priv->flag_vflip;
+   break;
+   case V4L2_CID_HFLIP:
+   ctrl->value = priv->flag_hflip;
+   break;
+   }
+   return 0;
+}
+
+static int ov772x_set_control(struct soc_camera_device *icd,
+ struct v4l2_control *ctrl)
+{
+   struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
+   int ret = 0;
+   u8 val;
+
+   switch (ctrl->id) {
+   case V4L2_CID_VFLIP:
+   val = ctrl->value ? VFLIP_IMG : 0x00;
+   priv->flag_vflip = ctrl->value;
+   if (priv->info->flags & OV772X_FLAG_VFLIP)
+   val ^= VFLIP_IMG;
+   ret = ov772x_mask_set(priv->client, COM3, VFLIP_IMG, val);
+   break;
+   case V4L2_CID_HFLIP:
+   val = ctrl->value ? HFLIP_IMG : 0x00;
+   priv->flag_hflip = ctrl->value;
+   if (priv->info->flags & OV772X_FLAG_HFLIP)
+   val ^= HFLIP_IMG;
+   ret = ov772x_mask_set(priv->client, COM3, HFLIP_IMG, val);
+   break;
+   }
+
+   return ret;
+}
+
 static int ov772x_get_chip_id(struct soc_camera_device *icd,
  struct v4l2_dbg_chip_ident   *id)
 {
@@ -768,8 +835,17 @@ static int ov772x_set_fmt(struct soc_camera_device *icd,
 * set COM3
 */
val = priv->fmt->com3;
+   if (priv->info->flags & OV772X_FLAG_VFLIP)
+   val |= VFLIP_IMG;
+   if (priv->info->flags & OV772X_FLAG_HFLIP)
+   val |= HFLIP_IMG;
+   if (priv->flag_vflip)
+   val ^= VFLIP_IMG;
+   if (priv->flag_hflip)
+   val ^= HFLIP_IMG;
+
ret = ov772x_mask_set(priv->client,
- COM3, SWAP_MASK, val);
+ COM3, S

[PATCH] tw9910: bit mask operation fix on tw9910_mask_set.

2009-01-21 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/tw9910.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 52c0357..17d8205 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -460,9 +460,11 @@ static int tw9910_mask_set(struct i2c_client *client, u8 
command,
   u8 mask, u8 set)
 {
s32 val = i2c_smbus_read_byte_data(client, command);
+   if (val < 0)
+   return val;
 
val &= ~mask;
-   val |=  set;
+   val |= set & mask;
 
return i2c_smbus_write_byte_data(client, command, val);
 }
-- 
1.5.6.3

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


[PATCH] ov772x: add support S_CROP operation.

2009-01-22 Thread Kuninori Morimoto
ov772x_set_fmt had returned NULL when pixfmt is 0,
although it mean only geometry change.
This patch modify this problem.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/ov772x.c |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 681a11b..30eb80e 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -792,12 +792,15 @@ static int ov772x_set_fmt(struct soc_camera_device *icd,
 
/*
 * select format
+* when pixfmt is 0, only geometry change
 */
-   priv->fmt = NULL;
-   for (i = 0; i < ARRAY_SIZE(ov772x_cfmts); i++) {
-   if (pixfmt == ov772x_cfmts[i].fourcc) {
-   priv->fmt = ov772x_cfmts + i;
-   break;
+   if (pixfmt) {
+   priv->fmt = NULL;
+   for (i = 0; i < ARRAY_SIZE(ov772x_cfmts); i++) {
+   if (pixfmt == ov772x_cfmts[i].fourcc) {
+   priv->fmt = ov772x_cfmts + i;
+   break;
+   }
}
}
if (!priv->fmt)
-- 
1.5.6.3

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


[PATCH] sh_mobile_ceu_camera: NV12/21/16/61 are added only once.

2009-01-22 Thread Kuninori Morimoto
NV12/21/16/61 had been added every time
UYVY/VYUY/YUYV/YVYU appears on get_formats.
This patch modify this problem.

Signed-off-by: Kuninori Morimoto 
---
[before]
Format NV12   (12 bits, NV12): Planar NV12
Format NV21   (12 bits, NV21): Planar NV21
Format unknown (0x3631564e) ( 0 bits, NV16): Unknown 0x3631564e
Format unknown (0x3136564e) ( 0 bits, NV61): Unknown 0x3136564e
Format YUYV   (16 bits, YUYV): Packed YUY2
Format NV12   (12 bits, NV12): Planar NV12
Format NV21   (12 bits, NV21): Planar NV21
Format unknown (0x3631564e) ( 0 bits, NV16): Unknown 0x3631564e
Format unknown (0x3136564e) ( 0 bits, NV61): Unknown 0x3136564e
Format unknown (0x55595659) ( 0 bits, YVYU): Packed YVYU
Format NV12   (12 bits, NV12): Planar NV12
Format NV21   (12 bits, NV21): Planar NV21
Format unknown (0x3631564e) ( 0 bits, NV16): Unknown 0x3631564e
Format unknown (0x3136564e) ( 0 bits, NV61): Unknown 0x3136564e
Format UYVY   (16 bits, UYVY): Packed UYVY
Format RGB555 (16 bits, RGB555): BGR 15-bit
Format RGB555X (16 bits, RGB555X): Unknown 0x51424752
Format RGB565 (16 bits, RGB565): BGR 16-bit
Format RGB565X (16 bits, RGB565X): Unknown 0x52424752

[after]
Format NV12   (12 bits, NV12): Planar NV12
Format NV21   (12 bits, NV21): Planar NV21
Format unknown (0x3631564e) ( 0 bits, NV16): Unknown 0x3631564e
Format unknown (0x3136564e) ( 0 bits, NV61): Unknown 0x3136564e
Format YUYV   (16 bits, YUYV): Packed YUY2
Format unknown (0x55595659) ( 0 bits, YVYU): Packed YVYU
Format UYVY   (16 bits, UYVY): Packed UYVY
Format RGB555 (16 bits, RGB555): BGR 15-bit
Format RGB555X (16 bits, RGB555X): Unknown 0x51424752
Format RGB565 (16 bits, RGB565): BGR 16-bit
Format RGB565X (16 bits, RGB565X): Unknown 0x52424752

 drivers/media/video/sh_mobile_ceu_camera.c |   64 
 1 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index 9a2586b..9cde91a 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -555,42 +555,50 @@ static int sh_mobile_ceu_get_formats(struct 
soc_camera_device *icd, int idx,
 struct soc_camera_format_xlate *xlate)
 {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-   int ret, k, n;
+   int ret, i, k, n;
int formats = 0;
 
ret = sh_mobile_ceu_try_bus_param(icd);
if (ret < 0)
return 0;
 
-   switch (icd->formats[idx].fourcc) {
-   case V4L2_PIX_FMT_UYVY:
-   case V4L2_PIX_FMT_VYUY:
-   case V4L2_PIX_FMT_YUYV:
-   case V4L2_PIX_FMT_YVYU:
-   n = ARRAY_SIZE(sh_mobile_ceu_formats);
-   formats += n;
-   for (k = 0; xlate && k < n; k++) {
-   xlate->host_fmt = &sh_mobile_ceu_formats[k];
-   xlate->cam_fmt = icd->formats + idx;
-   xlate->buswidth = icd->formats[idx].depth;
-   xlate++;
-   dev_dbg(&ici->dev, "Providing format %s using %s\n",
-   sh_mobile_ceu_formats[k].name,
-   icd->formats[idx].name);
-   }
-   default:
-   /* Generic pass-through */
-   formats++;
-   if (xlate) {
-   xlate->host_fmt = icd->formats + idx;
-   xlate->cam_fmt = icd->formats + idx;
-   xlate->buswidth = icd->formats[idx].depth;
-   xlate++;
-   dev_dbg(&ici->dev,
-   "Providing format %s in pass-through mode\n",
-   icd->formats[idx].name);
+   /* yuv color format check when idx == 0 */
+   if (idx)
+   goto yuv_check_done;
+
+   for (i = 0 ; i < icd->num_formats ; i++) {
+   switch (icd->formats[i].fourcc) {
+   case V4L2_PIX_FMT_UYVY:
+   case V4L2_PIX_FMT_VYUY:
+   case V4L2_PIX_FMT_YUYV:
+   case V4L2_PIX_FMT_YVYU:
+   n = ARRAY_SIZE(sh_mobile_ceu_formats);
+   formats += n;
+   for (k = 0; xlate && k < n; k++) {
+   xlate->host_fmt = &sh_mobile_ceu_formats[k];
+   xlate->cam_fmt = icd->formats + i;
+   xlate->buswidth = icd->formats[i].depth;
+   xlate++;
+   dev_dbg(&ici->dev,
+   "Providing format %s using %s\n",
+   sh_mobile_ceu_formats[k].name,
+   icd->formats[i].name);
+  

[PATCH] tw9910: color format check is added on set_fmt

2009-01-30 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/tw9910.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 1a9c6fd..57027c0 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -647,6 +647,19 @@ static int tw9910_set_fmt(struct soc_camera_device *icd, 
__u32 pixfmt,
struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd);
int ret  = -EINVAL;
u8  val;
+   int i;
+
+   /*
+* check color format
+*/
+   for (i = 0 ; i < ARRAY_SIZE(tw9910_color_fmt) ; i++) {
+   if (pixfmt == tw9910_color_fmt[i].fourcc) {
+   ret = 0;
+   break;
+   }
+   }
+   if (ret < 0)
+   goto tw9910_set_fmt_error;
 
/*
 * select suitable norm
-- 
1.5.6.3

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


[PATCH] sh_mobile_ceu: SOCAM flags are prepared at itself.

2009-01-30 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Magnus Damm 
---
 drivers/media/video/sh_mobile_ceu_camera.c |   27 +--
 include/media/sh_mobile_ceu.h  |5 +++--
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index 9cde91a..07b7b4c 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -101,6 +101,29 @@ struct sh_mobile_ceu_dev {
const struct soc_camera_data_format *camera_fmt;
 };
 
+static unsigned long make_bus_param(struct sh_mobile_ceu_dev *pcdev)
+{
+   unsigned long flags;
+
+   flags = SOCAM_SLAVE |
+   SOCAM_PCLK_SAMPLE_RISING |
+   SOCAM_HSYNC_ACTIVE_HIGH |
+   SOCAM_HSYNC_ACTIVE_LOW |
+   SOCAM_VSYNC_ACTIVE_HIGH |
+   SOCAM_VSYNC_ACTIVE_LOW;
+
+   if (pcdev->pdata->flags & SH_CEU_FLAG_USE_8BIT_BUS)
+   flags |= SOCAM_DATAWIDTH_8;
+
+   if (pcdev->pdata->flags & SH_CEU_FLAG_USE_16BIT_BUS)
+   flags |= SOCAM_DATAWIDTH_16;
+
+   if (flags & SOCAM_DATAWIDTH_MASK)
+   return flags;
+
+   return 0;
+}
+
 static void ceu_write(struct sh_mobile_ceu_dev *priv,
  unsigned long reg_offs, u32 data)
 {
@@ -396,7 +419,7 @@ static int sh_mobile_ceu_set_bus_param(struct 
soc_camera_device *icd,
 
camera_flags = icd->ops->query_bus_param(icd);
common_flags = soc_camera_bus_param_compatible(camera_flags,
-  pcdev->pdata->flags);
+  make_bus_param(pcdev));
if (!common_flags)
return -EINVAL;
 
@@ -517,7 +540,7 @@ static int sh_mobile_ceu_try_bus_param(struct 
soc_camera_device *icd)
 
camera_flags = icd->ops->query_bus_param(icd);
common_flags = soc_camera_bus_param_compatible(camera_flags,
-  pcdev->pdata->flags);
+  make_bus_param(pcdev));
if (!common_flags)
return -EINVAL;
 
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index b5dbefe..0f3524c 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -1,10 +1,11 @@
 #ifndef __ASM_SH_MOBILE_CEU_H__
 #define __ASM_SH_MOBILE_CEU_H__
 
-#include 
+#define SH_CEU_FLAG_USE_8BIT_BUS   (1 << 0) /* use  8bit bus width */
+#define SH_CEU_FLAG_USE_16BIT_BUS  (1 << 1) /* use 16bit bus width */
 
 struct sh_mobile_ceu_info {
-   unsigned long flags; /* SOCAM_... */
+   unsigned long flags;
 };
 
 #endif /* __ASM_SH_MOBILE_CEU_H__ */
-- 
1.5.6.3

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


[PATCH 1/2] soc_camera: Add FLDPOL flags

2009-01-30 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
 include/media/soc_camera.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 7440d92..2c7ecdf 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -231,6 +231,8 @@ static inline struct v4l2_queryctrl const 
*soc_camera_find_qctrl(
 #define SOCAM_PCLK_SAMPLE_FALLING  (1 << 13)
 #define SOCAM_DATA_ACTIVE_HIGH (1 << 14)
 #define SOCAM_DATA_ACTIVE_LOW  (1 << 15)
+#define SOCAM_FLDPOL_ACTIVE_HIGH   (1 << 16)
+#define SOCAM_FLDPOL_ACTIVE_LOW(1 << 17)
 
 #define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \
  SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \
-- 
1.5.6.3

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


[PATCH 2/2] sh_mobile_ceu: Add FLDPOL operation

2009-01-30 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/sh_mobile_ceu_camera.c |7 +++
 include/media/sh_mobile_ceu.h  |2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index 07b7b4c..366e5f5 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -118,6 +118,12 @@ static unsigned long make_bus_param(struct 
sh_mobile_ceu_dev *pcdev)
if (pcdev->pdata->flags & SH_CEU_FLAG_USE_16BIT_BUS)
flags |= SOCAM_DATAWIDTH_16;
 
+   if (pcdev->pdata->flags & SH_CEU_FLAG_USE_FLDPOL_HIGH)
+   flags |= SOCAM_FLDPOL_ACTIVE_HIGH;
+
+   if (pcdev->pdata->flags & SH_CEU_FLAG_USE_FLDPOL_LOW)
+   flags |= SOCAM_FLDPOL_ACTIVE_LOW;
+
if (flags & SOCAM_DATAWIDTH_MASK)
return flags;
 
@@ -474,6 +480,7 @@ static int sh_mobile_ceu_set_bus_param(struct 
soc_camera_device *icd,
icd->current_fmt->fourcc == V4L2_PIX_FMT_NV61)
value ^= 0x0100; /* swap U, V to change from NV1x->NVx1 */
 
+   value |= common_flags & SOCAM_FLDPOL_ACTIVE_LOW ? 1 << 16 : 0;
value |= common_flags & SOCAM_VSYNC_ACTIVE_LOW ? 1 << 1 : 0;
value |= common_flags & SOCAM_HSYNC_ACTIVE_LOW ? 1 << 0 : 0;
value |= buswidth == 16 ? 1 << 12 : 0;
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 0f3524c..1549401 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -3,6 +3,8 @@
 
 #define SH_CEU_FLAG_USE_8BIT_BUS   (1 << 0) /* use  8bit bus width */
 #define SH_CEU_FLAG_USE_16BIT_BUS  (1 << 1) /* use 16bit bus width */
+#define SH_CEU_FLAG_USE_FLDPOL_HIGH(1 << 2) /* top field if FLD is high */
+#define SH_CEU_FLAG_USE_FLDPOL_LOW (1 << 3) /* top field if FLD is low */
 
 struct sh_mobile_ceu_info {
unsigned long flags;
-- 
1.5.6.3

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


[PATCH v2] sh_mobile_ceu: SOCAM flags are prepared at itself

2009-02-04 Thread Kuninori Morimoto
>From 32fde76488032405b48afa4ed0b30c9184e855b5 Mon Sep 17 00: 00:00 2001

sh_mobile_ceu can supports bus width 8, 16 and other flags.
But it can not support SOCAM_SLAVE,
because it does not support any clocks.

Signed-off-by: Kuninori Morimoto 
---
v1 -> v2
o change SLAVE -> MASTER

 drivers/media/video/sh_mobile_ceu_camera.c |   27 +--
 include/media/sh_mobile_ceu.h  |5 +++--
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index 9a2586b..aa20745 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -101,6 +101,29 @@ struct sh_mobile_ceu_dev {
const struct soc_camera_data_format *camera_fmt;
 };
 
+static unsigned long make_bus_param(struct sh_mobile_ceu_dev *pcdev)
+{
+   unsigned long flags;
+
+   flags = SOCAM_MASTER |
+   SOCAM_PCLK_SAMPLE_RISING |
+   SOCAM_HSYNC_ACTIVE_HIGH |
+   SOCAM_HSYNC_ACTIVE_LOW |
+   SOCAM_VSYNC_ACTIVE_HIGH |
+   SOCAM_VSYNC_ACTIVE_LOW;
+
+   if (pcdev->pdata->flags & SH_CEU_FLAG_USE_8BIT_BUS)
+   flags |= SOCAM_DATAWIDTH_8;
+
+   if (pcdev->pdata->flags & SH_CEU_FLAG_USE_16BIT_BUS)
+   flags |= SOCAM_DATAWIDTH_16;
+
+   if (flags & SOCAM_DATAWIDTH_MASK)
+   return flags;
+
+   return 0;
+}
+
 static void ceu_write(struct sh_mobile_ceu_dev *priv,
  unsigned long reg_offs, u32 data)
 {
@@ -396,7 +419,7 @@ static int sh_mobile_ceu_set_bus_param(struct 
soc_camera_device *icd,
 
camera_flags = icd->ops->query_bus_param(icd);
common_flags = soc_camera_bus_param_compatible(camera_flags,
-  pcdev->pdata->flags);
+  make_bus_param(pcdev));
if (!common_flags)
return -EINVAL;
 
@@ -517,7 +540,7 @@ static int sh_mobile_ceu_try_bus_param(struct 
soc_camera_device *icd)
 
camera_flags = icd->ops->query_bus_param(icd);
common_flags = soc_camera_bus_param_compatible(camera_flags,
-  pcdev->pdata->flags);
+  make_bus_param(pcdev));
if (!common_flags)
return -EINVAL;
 
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index b5dbefe..0f3524c 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -1,10 +1,11 @@
 #ifndef __ASM_SH_MOBILE_CEU_H__
 #define __ASM_SH_MOBILE_CEU_H__
 
-#include 
+#define SH_CEU_FLAG_USE_8BIT_BUS   (1 << 0) /* use  8bit bus width */
+#define SH_CEU_FLAG_USE_16BIT_BUS  (1 << 1) /* use 16bit bus width */
 
 struct sh_mobile_ceu_info {
-   unsigned long flags; /* SOCAM_... */
+   unsigned long flags;
 };
 
 #endif /* __ASM_SH_MOBILE_CEU_H__ */
-- 
1.5.6.3

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


[PATCH v2 1/2] soc_camera: Add SOCAM_FIELD_ID_ACTIVE_{HIGH,LOW} flags

2009-02-04 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
v1 -> v2
o field name fix

 include/media/soc_camera.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 7440d92..74a4cc5 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -231,6 +231,8 @@ static inline struct v4l2_queryctrl const 
*soc_camera_find_qctrl(
 #define SOCAM_PCLK_SAMPLE_FALLING  (1 << 13)
 #define SOCAM_DATA_ACTIVE_HIGH (1 << 14)
 #define SOCAM_DATA_ACTIVE_LOW  (1 << 15)
+#define SOCAM_FIELD_ID_ACTIVE_HIGH (1 << 16)
+#define SOCAM_FIELD_ID_ACTIVE_LOW  (1 << 17)
 
 #define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \
  SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \
-- 
1.5.6.3

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


[PATCH v2 2/2] sh_mobile_ceu: Add field signal operation

2009-02-04 Thread Kuninori Morimoto
sh_mobile_ceu can support "field signal" from external module.
To support this operation, SH_CEU_FLAG_USE_FLDID_{HIGH, LOW}
are added to header.

Signed-off-by: Kuninori Morimoto 
---
v1 -> v2
o field name fix

 drivers/media/video/sh_mobile_ceu_camera.c |7 +++
 include/media/sh_mobile_ceu.h  |2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index aa20745..1f746e1 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -118,6 +118,12 @@ static unsigned long make_bus_param(struct 
sh_mobile_ceu_dev *pcdev)
if (pcdev->pdata->flags & SH_CEU_FLAG_USE_16BIT_BUS)
flags |= SOCAM_DATAWIDTH_16;
 
+   if (pcdev->pdata->flags & SH_CEU_FLAG_USE_FLDID_HIGH)
+   flags |= SOCAM_FIELD_ID_ACTIVE_HIGH;
+
+   if (pcdev->pdata->flags & SH_CEU_FLAG_USE_FLDID_LOW)
+   flags |= SOCAM_FIELD_ID_ACTIVE_LOW;
+
if (flags & SOCAM_DATAWIDTH_MASK)
return flags;
 
@@ -474,6 +480,7 @@ static int sh_mobile_ceu_set_bus_param(struct 
soc_camera_device *icd,
icd->current_fmt->fourcc == V4L2_PIX_FMT_NV61)
value ^= 0x0100; /* swap U, V to change from NV1x->NVx1 */
 
+   value |= common_flags & SOCAM_FIELD_ID_ACTIVE_LOW ? 1 << 16 : 0;
value |= common_flags & SOCAM_VSYNC_ACTIVE_LOW ? 1 << 1 : 0;
value |= common_flags & SOCAM_HSYNC_ACTIVE_LOW ? 1 << 0 : 0;
value |= buswidth == 16 ? 1 << 12 : 0;
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 0f3524c..8da9437 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -3,6 +3,8 @@
 
 #define SH_CEU_FLAG_USE_8BIT_BUS   (1 << 0) /* use  8bit bus width */
 #define SH_CEU_FLAG_USE_16BIT_BUS  (1 << 1) /* use 16bit bus width */
+#define SH_CEU_FLAG_USE_FLDID_HIGH (1 << 2) /* top field if FLD is high */
+#define SH_CEU_FLAG_USE_FLDID_LOW  (1 << 3) /* top field if FLD is low */
 
 struct sh_mobile_ceu_info {
unsigned long flags;
-- 
1.5.6.3

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


[PATCH] ov772x: use soft sleep mode in stop_capture

2009-02-19 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/ov772x.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 681a11b..6889fa8 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -646,6 +646,8 @@ static int ov772x_start_capture(struct soc_camera_device 
*icd)
return -EPERM;
}
 
+   ov772x_mask_set(priv->client, COM2, SOFT_SLEEP_MODE, 0);
+
dev_dbg(&icd->dev,
 "format %s, win %s\n", priv->fmt->name, priv->win->name);
 
@@ -654,6 +656,8 @@ static int ov772x_start_capture(struct soc_camera_device 
*icd)
 
 static int ov772x_stop_capture(struct soc_camera_device *icd)
 {
+   struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
+   ov772x_mask_set(priv->client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE);
return 0;
 }
 
-- 
1.5.6.3

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


[PATCH] sh_mobile_ceu: Add SOCAM_DATA_ACTIVE_{HIGH/LOW} flags

2009-03-02 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/sh_mobile_ceu_camera.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index 96cf857..bb10899 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -107,6 +107,8 @@ static unsigned long make_bus_param(struct 
sh_mobile_ceu_dev *pcdev)
 
flags = SOCAM_MASTER |
SOCAM_PCLK_SAMPLE_RISING |
+   SOCAM_DATA_ACTIVE_HIGH |
+   SOCAM_DATA_ACTIVE_LOW |
SOCAM_HSYNC_ACTIVE_HIGH |
SOCAM_HSYNC_ACTIVE_LOW |
SOCAM_VSYNC_ACTIVE_HIGH |
-- 
1.5.6.3

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


[PATCH] ov772x: Add extra setting method

2009-03-02 Thread Kuninori Morimoto
This patch add support extra register settings for platform.
For instance, platform comes to be able to use the
special setting like lens.

Signed-off-by: Kuninori Morimoto 
---
Thank you Magnus for your nice comment.

 drivers/media/video/ov772x.c |   15 ---
 include/media/ov772x.h   |7 +++
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 84b0fc1..f07d558 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -368,11 +368,6 @@
 /*
  * struct
  */
-struct regval_list {
-   unsigned char reg_num;
-   unsigned char value;
-};
-
 struct ov772x_color_format {
char *name;
__u32 fourcc;
@@ -400,8 +395,6 @@ struct ov772x_priv {
unsigned int  flag_hflip:1;
 };
 
-#define ENDMARKER { 0xff, 0xff }
-
 /*
  * register setting for window size
  */
@@ -815,6 +808,14 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 
width, u32 height,
 */
ov772x_reset(priv->client);
 
+   /* set extra setting */
+   if (priv->info->extra) {
+   ret = ov772x_write_array(priv->client,
+priv->info->extra);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+   }
+
/*
 * set size format
 */
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 57db48d..8a20a1e 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -13,6 +13,12 @@
 
 #include 
 
+#define ENDMARKER { 0xff, 0xff }
+struct regval_list {
+   unsigned char reg_num;
+   unsigned char value;
+};
+
 /* for flags */
 #define OV772X_FLAG_VFLIP 0x0001 /* Vertical flip image */
 #define OV772X_FLAG_HFLIP 0x0002 /* Horizontal flip image */
@@ -21,6 +27,7 @@ struct ov772x_camera_info {
unsigned long  buswidth;
unsigned long  flags;
struct soc_camera_link link;
+   const struct regval_list *extra;
 };
 
 #endif /* __OV772X_H__ */
-- 
1.5.6.3

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


[PATCH] ov772x: wrong pointer for soc_camera_link is modified

2009-03-19 Thread Kuninori Morimoto
priv->client->dev.platrom_data mean ov772x_camera_info in ov772x driver.
So, struct soc_camera_link doesn't exist there.
This patch modify this bug.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/ov772x.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 84b0fc1..34c9819 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -670,7 +670,7 @@ static int ov772x_set_bus_param(struct soc_camera_device 
*icd,
 static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
 {
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
-   struct soc_camera_link *icl = priv->client->dev.platform_data;
+   struct soc_camera_link *icl = &priv->info->link;
unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth;
-- 
1.5.6.3

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


[PATCH] ov772x: add edge contrl support

2009-03-22 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
This patch is 1st step for extra settings

 drivers/media/video/ov772x.c |   34 ++
 include/media/ov772x.h   |   25 +
 2 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 34c9819..a951327 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -358,6 +358,15 @@
 #define VOSZ_VGA0xF0
 #define VOSZ_QVGA   0x78
 
+/* EDGE CTRL
+ * see alse
+ *ov772x.h :: for Edge ctrl
+ */
+#define EDGE0CTRL(param) (((param) >> 24) & 0x1F)
+#define EDGE1CTRL(param) (((param) >> 16) & 0x0F)
+#define EDGE2CTRL(param) (((param) >>  8) & 0xFF)
+#define EDGE3CTRL(param) (((param) >>  0) & 0xFF)
+
 /*
  * ID
  */
@@ -816,6 +825,31 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 
width, u32 height,
ov772x_reset(priv->client);
 
/*
+* set Edge Ctrl if platform has edgectrl
+*/
+   if (priv->info->edgectrl & OV772X_EDGECTRL_ENABLE) {
+   ret = ov772x_mask_set(priv->client,
+   EDGE0, 0x1F, EDGE0CTRL(priv->info->edgectrl));
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client,
+   EDGE1, 0x0F, EDGE1CTRL(priv->info->edgectrl));
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client,
+   EDGE2, 0xFF, EDGE2CTRL(priv->info->edgectrl));
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+
+   ret = ov772x_mask_set(priv->client,
+   EDGE3, 0xFF, EDGE3CTRL(priv->info->edgectrl));
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+   }
+
+   /*
 * set size format
 */
ret = ov772x_write_array(priv->client, priv->win->regs);
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 57db48d..5b083dc 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -17,9 +17,34 @@
 #define OV772X_FLAG_VFLIP 0x0001 /* Vertical flip image */
 #define OV772X_FLAG_HFLIP 0x0002 /* Horizontal flip image */
 
+/*
+ * for Edge ctrl
+ *
+ * strength  : (for EDGE0) Edge enhancement strength control
+ * threshold : (for EDGE1) Edge enhancement threshold control
+ * low   : (for EDGE2) Edge enhancement strength Low point control
+ * high  : (for EDGE3) Edge enhancement strength High point control
+ *
+ * Meaning of edgectrl bit
+ *
+ * Exx0       
+ *
+ * E: use edgectrl or not (OV772X_EDGECTRL_ENABLE)
+ * 0: for Edge0 ctrl
+ * 1: for Edge1 ctrl
+ * 2: for Edge2 ctrl
+ * 3: for Edge3 ctrl
+ */
+#define OV772X_EDGECTRL_ENABLE 0x8000
+#define OV772X_EDGECTRL(strength, threshold, low, high) \
+   (OV772X_EDGECTRL_ENABLE | \
+(strength & 0x1F) << 24 | (threshold & 0x0F) << 16 | \
+(low & 0xFF) << 8 | (high & 0xFF) << 0)
+
 struct ov772x_camera_info {
unsigned long  buswidth;
unsigned long  flags;
+   unsigned long  edgectrl;
struct soc_camera_link link;
 };
 
-- 
1.5.6.3

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


[PATCH v2] ov772x: add edge contrl support

2009-03-23 Thread Kuninori Morimoto

Signed-off-by: Kuninori Morimoto 
---
I used flags to judge though
I said I use edge_threshold un-used 4 bit.

v1 -> v2
o add struct ov772x_edge_ctrl
o add new flags

 drivers/media/video/ov772x.c |   31 +++
 include/media/ov772x.h   |   26 +++---
 2 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 34c9819..ae832e6 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -816,6 +816,37 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 
width, u32 height,
ov772x_reset(priv->client);
 
/*
+* set Edge Ctrl
+*/
+   if (priv->info->flags & OV772X_FLAG_EDGE_STRENGTH) {
+   ret = ov772x_mask_set(priv->client, EDGE0, 0x1F,
+ priv->info->edgectrl.strength);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+   }
+
+   if (priv->info->flags & OV772X_FLAG_EDGE_THRESHOLD) {
+   ret = ov772x_mask_set(priv->client, EDGE1, 0x0F,
+ priv->info->edgectrl.threshold);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+   }
+
+   if (priv->info->flags & OV772X_FLAG_EDGE_LOW) {
+   ret = ov772x_mask_set(priv->client, EDGE2, 0xFF,
+ priv->info->edgectrl.low);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+   }
+
+   if (priv->info->flags & OV772X_FLAG_EDGE_HIGH) {
+   ret = ov772x_mask_set(priv->client, EDGE3, 0xFF,
+ priv->info->edgectrl.high);
+   if (ret < 0)
+   goto ov772x_set_fmt_error;
+   }
+
+   /*
 * set size format
 */
ret = ov772x_write_array(priv->client, priv->win->regs);
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 57db48d..c5051c7 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -13,14 +13,34 @@
 
 #include 
 
-/* for flags */
-#define OV772X_FLAG_VFLIP 0x0001 /* Vertical flip image */
-#define OV772X_FLAG_HFLIP 0x0002 /* Horizontal flip image */
+/*
+ * for flags
+ */
+#define OV772X_FLAG_VFLIP  (1 << 0) /* Vertical flip image */
+#define OV772X_FLAG_HFLIP  (1 << 1) /* Horizontal flip image */
+#define OV772X_FLAG_EDGE_STRENGTH  (1 << 2) /* Edge Ctrl strength */
+#define OV772X_FLAG_EDGE_THRESHOLD (1 << 3) /* Edge ctrl threshold */
+#define OV772X_FLAG_EDGE_LOW   (1 << 4) /* Edge ctrl low */
+#define OV772X_FLAG_EDGE_HIGH  (1 << 5) /* Edge ctrl high */
 
+/*
+ * for Edge ctrl
+ */
+struct ov772x_edge_ctrl {
+   unsigned char strength;  /* strength control */
+   unsigned char threshold; /* threshold control */
+   unsigned char low;   /* strength Low point control */
+   unsigned char high;  /* strength High point control */
+};
+
+/*
+ * ov772x camera info
+ */
 struct ov772x_camera_info {
unsigned long  buswidth;
unsigned long  flags;
struct soc_camera_link link;
+   struct ov772x_edge_ctrl edgectrl;
 };
 
 #endif /* __OV772X_H__ */
-- 
1.5.6.3

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


[PATCH] soc-camera: ov772x: Add buswidth selection flags for platform

2010-01-04 Thread Kuninori Morimoto
This patch remove "buswidth" struct member and add new flags for 
ov772x_camera_info.
And it also modify ap325rxa/migor setup.c

Signed-off-by: Kuninori Morimoto 
---
 arch/sh/boards/mach-ap325rxa/setup.c |4 ++--
 arch/sh/boards/mach-migor/setup.c|2 +-
 drivers/media/video/ov772x.c |   28 
 include/media/ov772x.h   |7 ---
 4 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/arch/sh/boards/mach-ap325rxa/setup.c 
b/arch/sh/boards/mach-ap325rxa/setup.c
index 1f5fa5c..71f556f 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -471,8 +471,8 @@ static struct i2c_board_info ap325rxa_i2c_camera[] = {
 };
 
 static struct ov772x_camera_info ov7725_info = {
-   .buswidth   = SOCAM_DATAWIDTH_8,
-   .flags  = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
+   .flags  = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP | \
+ OV772X_FLAG_8BIT,
.edgectrl   = OV772X_AUTO_EDGECTRL(0xf, 0),
 };
 
diff --git a/arch/sh/boards/mach-migor/setup.c 
b/arch/sh/boards/mach-migor/setup.c
index 507c77b..9b4676f 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -431,7 +431,7 @@ static struct i2c_board_info migor_i2c_camera[] = {
 };
 
 static struct ov772x_camera_info ov7725_info = {
-   .buswidth   = SOCAM_DATAWIDTH_8,
+   .flags  = OV772X_FLAG_8BIT,
 };
 
 static struct soc_camera_link ov7725_link = {
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 3a45e94..12cb66f 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -547,7 +547,6 @@ static const struct v4l2_queryctrl ov772x_controls[] = {
},
 };
 
-
 /*
  * general function
  */
@@ -634,9 +633,18 @@ static unsigned long ov772x_query_bus_param(struct 
soc_camera_device *icd)
struct soc_camera_link *icl = to_soc_camera_link(icd);
unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
-   SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth;
+   SOCAM_DATA_ACTIVE_HIGH;
+
+   if (priv->info->flags & OV772X_FLAG_8BIT)
+   flags |= SOCAM_DATAWIDTH_8;
+
+   if (priv->info->flags & OV772X_FLAG_10BIT)
+   flags |= SOCAM_DATAWIDTH_10;
 
-   return soc_camera_apply_sensor_flags(icl, flags);
+   if (flags & SOCAM_DATAWIDTH_MASK)
+   return soc_camera_apply_sensor_flags(icl, flags);
+
+   return 0;
 }
 
 static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
@@ -1040,15 +1048,6 @@ static int ov772x_video_probe(struct soc_camera_device 
*icd,
return -ENODEV;
 
/*
-* ov772x only use 8 or 10 bit bus width
-*/
-   if (SOCAM_DATAWIDTH_10 != priv->info->buswidth &&
-   SOCAM_DATAWIDTH_8  != priv->info->buswidth) {
-   dev_err(&client->dev, "bus width error\n");
-   return -ENODEV;
-   }
-
-   /*
 * check and show product ID and manufacturer ID
 */
pid = i2c_smbus_read_byte_data(client, PID);
@@ -1130,7 +1129,6 @@ static int ov772x_probe(struct i2c_client *client,
const struct i2c_device_id *did)
 {
struct ov772x_priv*priv;
-   struct ov772x_camera_info *info;
struct soc_camera_device  *icd = client->dev.platform_data;
struct i2c_adapter*adapter = to_i2c_adapter(client->dev.parent);
struct soc_camera_link*icl;
@@ -1145,8 +1143,6 @@ static int ov772x_probe(struct i2c_client *client,
if (!icl || !icl->priv)
return -EINVAL;
 
-   info = icl->priv;
-
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_err(&adapter->dev,
"I2C-Adapter doesn't support "
@@ -1158,7 +1154,7 @@ static int ov772x_probe(struct i2c_client *client,
if (!priv)
return -ENOMEM;
 
-   priv->info = info;
+   priv->info = icl->priv;
 
v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops);
 
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 14c77ef..7e83745 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -15,8 +15,10 @@
 #include 
 
 /* for flags */
-#define OV772X_FLAG_VFLIP 0x0001 /* Vertical flip image */
-#define OV772X_FLAG_HFLIP 0x0002 /* Horizontal flip image */
+#define OV772X_FLAG_VFLIP  (1 << 0) /* Vertical flip image */
+#define OV772X_FLAG_HFLIP  (1 << 1) /* Horizontal flip image */
+#define OV772X_FLAG_8BIT   (1 << 2) /*  8bit buswidth */
+#define OV772X_FLAG_10BIT  (1 << 3) /* 10bit bus

Re: [PATCH] soc-camera: ov772x: Add buswidth selection flags for platform

2010-01-05 Thread Kuninori Morimoto

Dear Guennadi

Thank you for checking patch

> Can you explain a bit why this patch is needed? Apart from a slight 
> stylistic improvement and a saving of 4 bytes of platform data per camera 
> instance? Is it going to be needed for some future changes?

This patch is not so important/necessary at once.
 -> for saving of 4 bytes.

>   if (!is_power_of_2(priv->info->flags & (OV772X_FLAG_8BIT | 
> OV772X_FLAG_10BIT)))
>   return 0;
> 
> make sense here? Or even just modify your tests above to
(snip)
> Adding a "default:" case just above the "case OV772X_FLAG_10BIT:" line 
> would seem like a good idea to me too.

I understand.

> > +#define OV772X_FLAG_8BIT   (1 << 2) /*  8bit buswidth */
> > +#define OV772X_FLAG_10BIT  (1 << 3) /* 10bit buswidth */

May I suggest here ?
What do you think if it have only 10BIT flag,
and check/operation like this ?

if (priv->info->flags & OV772X_FLAG_10BIT) {
flags |= SOCAM_DATAWIDTH_10;
else
flags |= SOCAM_DATAWIDTH_8;

This case, below check became not needed,
Does this operation make sense for you ?

> > /*
> > -* ov772x only use 8 or 10 bit bus width
> > -*/
> > -   if (SOCAM_DATAWIDTH_10 != priv->info->buswidth &&
> > -   SOCAM_DATAWIDTH_8  != priv->info->buswidth) {
> > -   dev_err(&client->dev, "bus width error\n");
> > -   return -ENODEV;
> > -   }


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


[PATCH] soc-camera: ov772x: Modify buswidth control

2010-01-06 Thread Kuninori Morimoto
This patch remove "buswidth" struct member,
and it expect that default buswidth is 10 bit.
You can select 8 bit buswidth by new flag.
This patch also modify ap325rxa/migor setup.c

Signed-off-by: Kuninori Morimoto 
---
This patch is v2 of
"soc-camera: ov772x: Add buswidth selection flags for platform"

v1 -> v2

o remove 10BIT flag
o white space -> tab on ov772x_camera_info
o ov772x_query_bus_param return is not changed

 arch/sh/boards/mach-ap325rxa/setup.c |4 ++--
 arch/sh/boards/mach-migor/setup.c|2 +-
 drivers/media/video/ov772x.c |   22 +++---
 include/media/ov772x.h   |   10 +-
 4 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/arch/sh/boards/mach-ap325rxa/setup.c 
b/arch/sh/boards/mach-ap325rxa/setup.c
index 1f5fa5c..71f556f 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -471,8 +471,8 @@ static struct i2c_board_info ap325rxa_i2c_camera[] = {
 };
 
 static struct ov772x_camera_info ov7725_info = {
-   .buswidth   = SOCAM_DATAWIDTH_8,
-   .flags  = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
+   .flags  = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP | \
+ OV772X_FLAG_8BIT,
.edgectrl   = OV772X_AUTO_EDGECTRL(0xf, 0),
 };
 
diff --git a/arch/sh/boards/mach-migor/setup.c 
b/arch/sh/boards/mach-migor/setup.c
index 507c77b..9b4676f 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -431,7 +431,7 @@ static struct i2c_board_info migor_i2c_camera[] = {
 };
 
 static struct ov772x_camera_info ov7725_info = {
-   .buswidth   = SOCAM_DATAWIDTH_8,
+   .flags  = OV772X_FLAG_8BIT,
 };
 
 static struct soc_camera_link ov7725_link = {
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 3a45e94..7f8ece3 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -547,7 +547,6 @@ static const struct v4l2_queryctrl ov772x_controls[] = {
},
 };
 
-
 /*
  * general function
  */
@@ -634,7 +633,12 @@ static unsigned long ov772x_query_bus_param(struct 
soc_camera_device *icd)
struct soc_camera_link *icl = to_soc_camera_link(icd);
unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
-   SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth;
+   SOCAM_DATA_ACTIVE_HIGH;
+
+   if (priv->info->flags & OV772X_FLAG_8BIT)
+   flags |= SOCAM_DATAWIDTH_8;
+   else
+   flags |= SOCAM_DATAWIDTH_10;
 
return soc_camera_apply_sensor_flags(icl, flags);
 }
@@ -1040,15 +1044,6 @@ static int ov772x_video_probe(struct soc_camera_device 
*icd,
return -ENODEV;
 
/*
-* ov772x only use 8 or 10 bit bus width
-*/
-   if (SOCAM_DATAWIDTH_10 != priv->info->buswidth &&
-   SOCAM_DATAWIDTH_8  != priv->info->buswidth) {
-   dev_err(&client->dev, "bus width error\n");
-   return -ENODEV;
-   }
-
-   /*
 * check and show product ID and manufacturer ID
 */
pid = i2c_smbus_read_byte_data(client, PID);
@@ -1130,7 +1125,6 @@ static int ov772x_probe(struct i2c_client *client,
const struct i2c_device_id *did)
 {
struct ov772x_priv*priv;
-   struct ov772x_camera_info *info;
struct soc_camera_device  *icd = client->dev.platform_data;
struct i2c_adapter*adapter = to_i2c_adapter(client->dev.parent);
struct soc_camera_link*icl;
@@ -1145,8 +1139,6 @@ static int ov772x_probe(struct i2c_client *client,
if (!icl || !icl->priv)
return -EINVAL;
 
-   info = icl->priv;
-
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_err(&adapter->dev,
"I2C-Adapter doesn't support "
@@ -1158,7 +1150,7 @@ static int ov772x_probe(struct i2c_client *client,
if (!priv)
return -ENOMEM;
 
-   priv->info = info;
+   priv->info = icl->priv;
 
v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops);
 
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 14c77ef..548bf11 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -15,8 +15,9 @@
 #include 
 
 /* for flags */
-#define OV772X_FLAG_VFLIP 0x0001 /* Vertical flip image */
-#define OV772X_FLAG_HFLIP 0x0002 /* Horizontal flip image */
+#define OV772X_FLAG_VFLIP  (1 << 0) /* Vertical flip image */
+#define OV772X_FLAG_HFLIP  (1 << 1) /* Horizontal flip image */
+#define OV772X_FLAG_8BIT   (1 << 2) /* default 10 bit */
 
 /*
  * for Edge ctrl
@@ -53,9 +54,8 @@ struct ov

How to change fps on soc-camera ?

2010-01-06 Thread Kuninori Morimoto

Hi all

Now I have mt9t112 / ov772x soc-camera.
And it can change fps by register setting.
So, I would like to add such support to driver.

But I don't know how to order it from user program.
Can you please teach me about it ?

# in my easy search, using ioctrl with VIDIOC_S_PARM
# seems good, I'm not sure though

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


[PATCH 0/3] soc-camera: mt9t112: bug fix patches

2010-02-01 Thread Kuninori Morimoto

Dear Guennadi
[Cc] Phil, Namiki-san

These patches are bug fix for mt9t112 camera

Kuninori Morimoto (3):
  soc-camera: mt9t112: modify exiting conditions from standby mode
  soc-camera: mt9t112: modify delay time after initialize
  soc-camera: mt9t112: The flag which control camera-init is removed

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


[PATCH 1/3] soc-camera: mt9t112: modify exiting conditions from standby mode

2010-02-01 Thread Kuninori Morimoto
This polling is needed if camera is in standby mode.
But current exiting condition is inverted.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/video/mt9t112.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
index fc4dd60..7438f8d 100644
--- a/drivers/media/video/mt9t112.c
+++ b/drivers/media/video/mt9t112.c
@@ -514,7 +514,7 @@ static int mt9t112_init_pll(const struct i2c_client *client)
/* poll to verify out of standby. Must Poll this bit */
for (i = 0; i < 100; i++) {
mt9t112_reg_read(data, client, 0x0018);
-   if (0x4000 & data)
+   if (!(0x4000 & data))
break;
 
mdelay(10);
-- 
1.6.3.3

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


[PATCH 2/3] soc-camera: mt9t112: modify delay time after initialize

2010-02-01 Thread Kuninori Morimoto
mt9t112 camera needs 100 milliseconds for initializing
Special thanks to Phil

Signed-off-by: Kuninori Morimoto 
Reported-by: Phil Edworthy 
---
 drivers/media/video/mt9t112.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
index 7438f8d..e581d8a 100644
--- a/drivers/media/video/mt9t112.c
+++ b/drivers/media/video/mt9t112.c
@@ -885,7 +885,7 @@ static int mt9t112_s_stream(struct v4l2_subdev *sd, int 
enable)
/* Invert PCLK (Data sampled on falling edge of pixclk) */
mt9t112_reg_write(ret, client, 0x3C20, param);
 
-   mdelay(5);
+   mdelay(100);
 
priv->flags |= INIT_DONE;
}
-- 
1.6.3.3

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


[PATCH 3/3] soc-camera: mt9t112: The flag which control camera-init is removed

2010-02-01 Thread Kuninori Morimoto
mt9t112 should always be initialized when camera start.
Because current driver doesn't run this operation,
it will be un-stable if user side player run open/close several times.
Special thanks to Namiki-san

Signed-off-by: Kuninori Morimoto 
Reported-by: Takashi Namiki 
---
 drivers/media/video/mt9t112.c |   20 ++--
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
index e581d8a..bd5ef62 100644
--- a/drivers/media/video/mt9t112.c
+++ b/drivers/media/video/mt9t112.c
@@ -106,9 +106,6 @@ struct mt9t112_priv {
struct mt9t112_frame_sizeframe;
const struct mt9t112_format *format;
int  model;
-   u32  flags;
-/* for flags */
-#define INIT_DONE  (1<<0)
 };
 
 /
@@ -876,19 +873,14 @@ static int mt9t112_s_stream(struct v4l2_subdev *sd, int 
enable)
return ret;
}
 
-   if (!(priv->flags & INIT_DONE)) {
-   u16 param = (MT9T112_FLAG_PCLK_RISING_EDGE &
-priv->info->flags) ? 0x0001 : 0x;
+   ECHECKER(ret, mt9t112_init_camera(client));
 
-   ECHECKER(ret, mt9t112_init_camera(client));
+   /* Invert PCLK (Data sampled on falling edge of pixclk) */
+   mt9t112_reg_write(ret, client, 0x3C20,
+ (MT9T112_FLAG_PCLK_RISING_EDGE & priv->info->flags) ?
+ 0x0001 : 0x);
 
-   /* Invert PCLK (Data sampled on falling edge of pixclk) */
-   mt9t112_reg_write(ret, client, 0x3C20, param);
-
-   mdelay(100);
-
-   priv->flags |= INIT_DONE;
-   }
+   mdelay(100);
 
mt9t112_mcu_write(ret, client, VAR(26, 7), priv->format->fmt);
mt9t112_mcu_write(ret, client, VAR(26, 9), priv->format->order);
-- 
1.6.3.3

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


Re: [PATCH 1/2] soc-camera: add support for VIDIOC_S_PARM and VIDIOC_G_PARM ioctls

2010-02-11 Thread Kuninori Morimoto

Dear Guennadi

Thank you for your hack

> + .vidioc_g_parm   = soc_camera_g_parm,
> + .vidioc_s_parm   = soc_camera_s_parm,

If soc_camera_g_param was defined, 
VIDIOC_G_PARM operation will be changed in v4l2-ioctl.c :: __video_do_ioctl
In fact, It was my anxiety.
But this patch seems good for me.
Thank you

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


Re: [PATCH 1/4] v4l: vsp1: Implement partition algorithm restrictions

2017-03-05 Thread Kuninori Morimoto

Hi Laurent, Kieran

> > > Testing SRU-UDS scaling 768x576 - 768x576 - 640x480 in RGB24: fail
> > > Testing SRU-UDS scaling 768x576 - 768x576 - 768x576 in RGB24: pass
> > > Testing SRU-UDS scaling 768x576 - 768x576 - 1024x768 in RGB24: pass
> > > Testing SRU-UDS scaling 768x576 - 1536x1152 - 1280x960 in RGB24: pass
> > > Testing SRU-UDS scaling 768x576 - 1536x1152 - 1536x1152 in RGB24: pass
> > > Testing SRU-UDS scaling 768x576 - 1536x1152 - 2048x1536 in RGB24: pass
> > > Testing UDS-SRU scaling 768x576 - 640x480 - 640x480 in RGB24: pass
> > > Testing UDS-SRU scaling 768x576 - 640x480 - 1280x960 in RGB24: pass
> > > Testing UDS-SRU scaling 768x576 - 768x576 - 768x576 in RGB24: pass
> > > Testing UDS-SRU scaling 768x576 - 768x576 - 1536x1152 in RGB24: pass
> > > Testing UDS-SRU scaling 768x576 - 1024x768 - 1024x768 in RGB24: pass
> > > Testing UDS-SRU scaling 768x576 - 1024x768 - 2048x1536 in RGB24: pass
> > > Testing SRU-UDS scaling 768x576 - 768x576 - 640x480 in YUV444M: fail
> > > Testing SRU-UDS scaling 768x576 - 768x576 - 768x576 in YUV444M: pass
> > > Testing SRU-UDS scaling 768x576 - 768x576 - 1024x768 in YUV444M: pass
> > > Testing SRU-UDS scaling 768x576 - 1536x1152 - 1280x960 in YUV444M: pass
> > > Testing SRU-UDS scaling 768x576 - 1536x1152 - 1536x1152 in YUV444M: pass
> > > Testing SRU-UDS scaling 768x576 - 1536x1152 - 2048x1536 in YUV444M: hangs
> > > Testing UDS-SRU scaling 768x576 - 640x480 - 640x480 in YUV444M: pass
> > > Testing UDS-SRU scaling 768x576 - 640x480 - 1280x960 in YUV444M: fail
> > > Testing UDS-SRU scaling 768x576 - 768x576 - 768x576 in YUV444M: pass
> > > Testing UDS-SRU scaling 768x576 - 768x576 - 1536x1152 in YUV444M: pass
> > > Testing UDS-SRU scaling 768x576 - 1024x768 - 1024x768 in YUV444M: pass
> > > Testing UDS-SRU scaling 768x576 - 1024x768 - 2048x1536 in YUV444M: hangs
> > (snip)
> > > However, from the above tests it looks like the hardware can live with 
> > > more 
> > > relaxed restrictions than the ones implemented here. I haven't tested all 
> > > UDS 
> > > scaling ratios, and certainly not under all memory bus load conditions, I 
> > > might thus be too optimistic. Morimoto-san, would it be possible to get 
> > > more 
> > > information about this from the hardware team, to check whether the above 
> > > two 
> > > restrictions need to be honoured, or whether they come from an older 
> > > hardware 
> > > version ?
> > 
> > I asked it to HW team.
> > Please wait

I'm still waiting from HW team's response, but can you check
"32.3.7 Image partition for VSPI processing" on v0.53 datasheet ?
(v0.53 is for ES2.0, but this chapter should be same for ES1.x / ES2.0)
You may / may not find something from here

Best regards
---
Kuninori Morimoto


  1   2   >