marvell-ccic: add soc camera support on marvell-ccic
v3 cover marvell-ccic: add soc camera support on marvell-ccic
The following patches series will add soc_camera support on marvell-ccic
Patch set V3 - Change log:
- correct and enhance the implementation of some functions
- replace most of preprocessor instruction with runtime detect
- use devm_clk_get and devm_gpio_request which were missed in previous version
- change code format in some funcions: replace if-else with switch
- change some confused variable names
- remove unnecessary functions: buf_init, buf_cleanup ...
- remove unnecessary keyword: inline, extern ...
- remove unnecessary include header file name
- remove duplicated and unused code
- remove unnecessary initialization of ret variable
- [PATCH 09/15] change description
Patch set V2 - Change log:
- remove register definition patch
- split big patch to some small patches
- split mcam-core.c to mcam-core.c and mcam-core-standard.c
- add mcam-core-soc.c for soc camera support
- split 3 frame buffers support patch into 2 patches
Patch set V1:
Log:
- add mmp register definition
- add soc_camera support on mcam core and mmp driver
- add 3 frames buffers support in DMA_CONTIG mode
Thanks
Albert Wang
--
Albert Wang (7):
[media] marvell-ccic: add get_mcam function for marvell-ccic driver [media] marvell-ccic: split mcam-core into 2 parts for soc_camera
support
[media] marvell-ccic: add soc_camera support in mcam core [media] marvell-ccic: add soc_camera support in mmp driver [media] marvell-ccic: add dma burst mode support in marvell-ccic
driver
[media] marvell-ccic: use unsigned int type replace int type [media] marvell-ccic: add 3 frame buffers support in DMA_CONTIG mode
Libin Yang (8):
[media] marvell-ccic: use internal variable replace global frame
stats variable:w
[media] marvell-ccic: add MIPI support for marvell-ccic driver [media] marvell-ccic: add clock tree support for marvell-ccic driver [media] marvell-ccic: reset ccic phy when stop streaming for
stability
[media] marvell-ccic: refine mcam_set_contig_buffer function [media] marvell-ccic: add new formats support for marvell-ccic driver [media] marvell-ccic: add SOF / EOF pair check for marvell-ccic
driver
[media] marvell-ccic: switch to resource managed allocation and
request
drivers/media/platform/Makefile | 4 +- drivers/media/platform/marvell-ccic/Kconfig | 22 + drivers/media/platform/marvell-ccic/Makefile | 6 +- .../media/platform/marvell-ccic/mcam-core-soc.c | 416 +++++++ .../media/platform/marvell-ccic/mcam-core-soc.h | 19 + .../platform/marvell-ccic/mcam-core-standard.c | 820 +++++++++++++ .../platform/marvell-ccic/mcam-core-standard.h | 26 + drivers/media/platform/marvell-ccic/mcam-core.c | 1276 +++++--------------- drivers/media/platform/marvell-ccic/mcam-core.h | 155 ++- drivers/media/platform/marvell-ccic/mmp-driver.c | 347 ++++-- include/media/mmp-camera.h | 21 + 11 files changed, 2071 insertions(+), 1041 deletions(-) create mode 100644 drivers/media/platform/marvell-ccic/mcam-core-soc.c create mode 100644 drivers/media/platform/marvell-ccic/mcam-core-soc.h create mode 100644 drivers/media/platform/marvell-ccic/mcam-core-standard.c create mode 100644 drivers/media/platform/marvell-ccic/mcam-core-standard.h
Signature · 1 line
1.7.9.5
PATCH v3 1/15 marvell-ccic: use internal variable replace global frame stats variable
From: Libin Yang <[email protected]>
This patch replaces the global frame stats variables by using internal variables in mcam_camera structure.
--- drivers/media/platform/marvell-ccic/mcam-core.c | 30 ++++++++++------------- drivers/media/platform/marvell-ccic/mcam-core.h | 9 +++++++ 2 files changed, 22 insertions(+), 17 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core.c +13 -17
@@ -30,13 +30,6 @@#include "mcam-core.h" -/* -* Basic frame stats - to be deleted shortly -*/ -static int frames; -static int singles; -static int delivered; -#ifdef MCAM_MODE_VMALLOC /* * Internal DMA buffer management. Since the controller cannot do S/G I/O,
@@ -367,10 +360,10 @@ static void mcam_frame_tasklet(unsigned long data)if (!test_bit (bufno, &cam->flags))continue ;if (list_empty (&cam->buffers)) { - singles++; + cam->frame_state.singles++;break ;/* Leave it valid, hope for better later */ } - delivered++; + cam->frame_state.delivered++;clear_bit (bufno, &cam->flags); buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, queue);
@@ -452,7 +445,7 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)mcam_reg_write (cam, frame ==0 ?REG_Y0BAR :REG_Y1BAR ,vb2_dma_contig_plane_dma_addr (&buf->vb_buf,0 ));set_bit (CF_SINGLE_BUFFER , &cam->flags); - singles++; + cam->frame_state.singles++;return ; }/*
@@ -485,7 +478,7 @@ static void mcam_dma_contig_done(struct mcam_camera *cam, int frame)struct mcam_vb_buffer *buf = cam->vb_bufs[frame];if (!test_bit (CF_SINGLE_BUFFER , &cam->flags)) { - delivered++; + cam->frame_state.delivered++;mcam_buffer_done (cam, frame, &buf->vb_buf); }mcam_set_contig_buffer (cam, frame);
@@ -578,13 +571,13 @@ static void mcam_dma_sg_done(struct mcam_camera *cam, int frame)*/ }else {set_bit (CF_SG_RESTART , &cam->flags); - singles++; + cam->frame_state.singles++; cam->vb_bufs[0 ] =NULL ; }/* * Now we can give the completed frame back to user space. */ - delivered++; + cam->frame_state.delivered++;mcam_buffer_done (cam, frame, &buf->vb_buf); }
@@ -1545,7 +1538,9 @@ static int mcam_v4l_open(struct file *filp) filp->private_data = cam; - frames = singles = delivered =0 ; + cam->frame_state.frames =0 ; + cam->frame_state.singles =0 ; + cam->frame_state.delivered =0 ;mutex_lock (&cam->s_mutex);if (cam->users ==0 ) { ret =mcam_setup_vb2 (cam);
@@ -1566,8 +1561,9 @@ static int mcam_v4l_release(struct file *filp) {struct mcam_camera *cam = filp->private_data; -cam_dbg (cam,"Release, %d frames, %d singles, %d delivered\n" , frames, - singles, delivered); +cam_dbg (cam,"Release, %d frames, %d singles, %d delivered\n" , + cam->frame_state.frames, cam->frame_state.singles, + cam->frame_state.delivered);mutex_lock (&cam->s_mutex); (cam->users)--;if (cam->users ==0 ) {
@@ -1660,7 +1656,7 @@ static void mcam_frame_complete(struct mcam_camera *cam, int frame)clear_bit (CF_DMA_ACTIVE , &cam->flags); cam->next_buf = frame; cam->buf_seq[frame] = ++(cam->sequence); - frames++; + cam->frame_state.frames++;/* * "This should never happen" */
drivers/media/platform/marvell-ccic/mcam-core.h +9 -0
@@ -73,6 +73,14 @@ static inline int mcam_buffer_mode_supported(enum mcam_buffer_mode mode) } } +/* +* Basic frame states +*/ +struct mcam_frame_state { +unsigned int frames; +unsigned int singles; +unsigned int delivered; +};/* * A description of one of our devices.
@@ -108,6 +116,7 @@ struct mcam_camera {unsigned long flags;/* Buffer status, mainly (dev_lock) */ int users;/* How many open FDs */ +struct mcam_frame_state frame_state;/* Frame state counter */ /* * Subsystem structures. */
Signature · 1 line
1.7.9.5
Re: [PATCH V3 01/15] [media] marvell-ccic: use internal variable replace global frame stats variable
Quoted 2 lines · On Sat, 15 Dec 2012 17:57:50 +0800 Albert Wang <[email protected]> wrote:
This patch replaces the global frame stats variables by using internal variables in
mcam_camerastructure.
This one seems fine. Someday it might be nice to have proper stats rather than my debugging hack, complete with a nice sysfs interface and all that.
jon
Re: [PATCH V3 01/15] [media] marvell-ccic: use internal variable replace global frame stats variable
Em Sun, 16 Dec 2012 08:36:59 -0700
Jonathan Corbet <[email protected]> escreveu:
Quoted 11 lines
Quoted 2 lines · On Sat, 15 Dec 2012 17:57:50 +0800 Albert Wang <[email protected]> wrote:
This patch replaces the global frame stats variables by using internal variables in
mcam_camerastructure.This one seems fine. Someday it might be nice to have proper stats rather than my debugging hack, complete with a nice sysfs interface and all that.
Acked-by Jonathan Corbet <[email protected]>
While I understand that a v4 will popup, due to some comments done on the other patches on this v3, this patch seems pretty much independent. So, I'll just apply it right now, and tag the others as "changes_requested" at patchwork.
Regards,
Mauro
Re: [PATCH V3 01/15] [media] marvell-ccic: use internal variable replace global frame stats variable
In reply to Albert WangQuoted 7 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch replaces the global frame stats variables by using internal variables in
mcam_camerastructure.Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>
Thanks
Guennadi
Quoted 132 lines
--- drivers/media/platform/marvell-ccic/mcam-core.c | 30 ++++++++++------------- drivers/media/platform/marvell-ccic/mcam-core.h | 9 +++++++ 2 files changed, 22 insertions(+), 17 deletions(-)drivers/media/platform/marvell-ccic/mcam-core.c +13
-17@@ -30,13 +30,6 @@#include "mcam-core.h" -/* -* Basic frame stats - to be deleted shortly -*/ -static int frames; -static int singles; -static int delivered; -#ifdef MCAM_MODE_VMALLOC /* * Internal DMA buffer management. Since the controller cannot do S/G I/O, @@ -367,10 +360,10 @@ static void mcam_frame_tasklet(unsigned long data)if (!test_bit (bufno, &cam->flags))continue ;if (list_empty (&cam->buffers)) { - singles++; + cam->frame_state.singles++;break ;/* Leave it valid, hope for better later */ } - delivered++; + cam->frame_state.delivered++;clear_bit (bufno, &cam->flags); buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, queue);@@ -452,7 +445,7 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)mcam_reg_write (cam, frame ==0 ?REG_Y0BAR :REG_Y1BAR ,vb2_dma_contig_plane_dma_addr (&buf->vb_buf,0 ));set_bit (CF_SINGLE_BUFFER , &cam->flags); - singles++; + cam->frame_state.singles++;return ; }/* @@ -485,7 +478,7 @@ static void mcam_dma_contig_done(struct mcam_camera *cam, int frame)struct mcam_vb_buffer *buf = cam->vb_bufs[frame];if (!test_bit (CF_SINGLE_BUFFER , &cam->flags)) { - delivered++; + cam->frame_state.delivered++;mcam_buffer_done (cam, frame, &buf->vb_buf); }mcam_set_contig_buffer (cam, frame);@@ -578,13 +571,13 @@ static void mcam_dma_sg_done(struct mcam_camera *cam, int frame)*/ }else {set_bit (CF_SG_RESTART , &cam->flags); - singles++; + cam->frame_state.singles++; cam->vb_bufs[0 ] =NULL ; }/* * Now we can give the completed frame back to user space. */ - delivered++; + cam->frame_state.delivered++;mcam_buffer_done (cam, frame, &buf->vb_buf); }@@ -1545,7 +1538,9 @@ static int mcam_v4l_open(struct file *filp) filp->private_data = cam; - frames = singles = delivered =0 ; + cam->frame_state.frames =0 ; + cam->frame_state.singles =0 ; + cam->frame_state.delivered =0 ;mutex_lock (&cam->s_mutex);if (cam->users ==0 ) { ret =mcam_setup_vb2 (cam);@@ -1566,8 +1561,9 @@ static int mcam_v4l_release(struct file *filp) {struct mcam_camera *cam = filp->private_data; -cam_dbg (cam,"Release, %d frames, %d singles, %d delivered\n" , frames, - singles, delivered); +cam_dbg (cam,"Release, %d frames, %d singles, %d delivered\n" , + cam->frame_state.frames, cam->frame_state.singles, + cam->frame_state.delivered);mutex_lock (&cam->s_mutex); (cam->users)--;if (cam->users ==0 ) {@@ -1660,7 +1656,7 @@ static void mcam_frame_complete(struct mcam_camera *cam, int frame)clear_bit (CF_DMA_ACTIVE , &cam->flags); cam->next_buf = frame; cam->buf_seq[frame] = ++(cam->sequence); - frames++; + cam->frame_state.frames++;/* * "This should never happen" */ drivers/media/platform/marvell-ccic/mcam-core.h +9
-0@@ -73,6 +73,14 @@ static inline int mcam_buffer_mode_supported(enum mcam_buffer_mode mode) } } +/* +* Basic frame states +*/ +struct mcam_frame_state { +unsigned int frames; +unsigned int singles; +unsigned int delivered; +};/* * A description of one of our devices. @@ -108,6 +116,7 @@ struct mcam_camera {unsigned long flags;/* Buffer status, mainly (dev_lock) */ int users;/* How many open FDs */ +struct mcam_frame_state frame_state;/* Frame state counter */ /* * Subsystem structures. */ Signature · 1 line
1.7.9.5
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
PATCH v3 2/15 marvell-ccic: add MIPI support for marvell-ccic driver
In reply to Albert WangFrom: Libin Yang <[email protected]>
This patch adds the MIPI support for marvell-ccic. Board driver should determine whether using MIPI or not.
--- drivers/media/platform/marvell-ccic/mcam-core.c | 70 ++++++++++++++++++++ drivers/media/platform/marvell-ccic/mcam-core.h | 24 ++++++- drivers/media/platform/marvell-ccic/mmp-driver.c | 75 +++++++++++++++++++++- include/media/mmp-camera.h | 10 +++ 4 files changed, 177 insertions(+), 2 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core.c +70 -0
@@ -19,6 +19,7 @@#include <linux/delay.h> #include <linux/vmalloc.h> #include <linux/io.h> +#include <linux/clk.h> #include <linux/videodev2.h> #include <media/v4l2-device.h> #include <media/v4l2-ioctl.h>
@@ -253,6 +254,50 @@ static void mcam_ctlr_stop(struct mcam_camera *cam)mcam_reg_clear_bit (cam,REG_CTRL0 ,C0_ENABLE ); } +static int mcam_config_mipi (struct mcam_camera *mcam,int enable) +{ +if (mcam->bus_type ==V4L2_MBUS_CSI2 && enable) { +/* Using MIPI mode and enable MIPI */ +cam_dbg (mcam,"camera: DPHY3=0x%x, DPHY5=0x%x, DPHY6=0x%x\n" , + mcam->dphy[0 ], mcam->dphy[1 ], mcam->dphy[2 ]); +mcam_reg_write (mcam,REG_CSI2_DPHY3 , mcam->dphy[0 ]); +mcam_reg_write (mcam,REG_CSI2_DPHY6 , mcam->dphy[2 ]); +mcam_reg_write (mcam,REG_CSI2_DPHY5 , mcam->dphy[1 ]); + +if (mcam->mipi_enabled ==0 ) { +/* +* 0x41 actives 1 lane +* 0x43 actives 2 lanes +* 0x47 actives 4 lanes +* There is no 3 lanes case +*/ +switch (mcam->lane) { +case 1 : +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x41 ); +break ; +case 2 : +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x43 ); +break ; +case 4 : +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x47 ); +break ; +default : +cam_err (mcam,"camera: lane number set err" ); +return -EINVAL ; + } + mcam->mipi_enabled =1 ; + } + }else { +/* Using Parallel mode or disable MIPI */ +mcam_reg_write (mcam,REG_CSI2_DPHY3 ,0x0 ); +mcam_reg_write (mcam,REG_CSI2_DPHY6 ,0x0 ); +mcam_reg_write (mcam,REG_CSI2_DPHY5 ,0x0 ); +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x0 ); + mcam->mipi_enabled =0 ; + } +return 0 ; +} +/* ------------------------------------------------------------------- */ #ifdef MCAM_MODE_VMALLOC
@@ -656,6 +701,15 @@ static void mcam_ctlr_image(struct mcam_camera *cam)*/ mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC ,C0_SIFM_MASK ); + +/* +* This field controls the generation of EOF(DVP only) +*/ +if (cam->bus_type !=V4L2_MBUS_CSI2 ) { +mcam_reg_set_bit (cam,REG_CTRL0 , +C0_EOF_VSYNC |C0_VEDGE_CTRL ); +mcam_reg_write (cam,REG_CTRL3 ,0x4 ); + } }
@@ -886,6 +940,16 @@ static int mcam_read_setup(struct mcam_camera *cam)spin_lock_irqsave (&cam->dev_lock, flags);clear_bit (CF_DMA_ACTIVE , &cam->flags);mcam_reset_buffers (cam); +/* +* Update CSI2_DPHY value +*/ +if (cam->calc_dphy) + cam->calc_dphy (cam); +cam_dbg (cam,"camera: DPHY sets: dphy3=0x%x, dphy5=0x%x, dphy6=0x%x\n" , + cam->dphy[0 ], cam->dphy[1 ], cam->dphy[2 ]); + ret =mcam_config_mipi (cam,1 ); +if (ret <0 ) +return ret;mcam_ctlr_irq_enable (cam); cam->state =S_STREAMING ;if (!test_bit (CF_SG_RESTART , &cam->flags))
@@ -1551,6 +1615,11 @@ static int mcam_v4l_open(struct file *filp)mcam_set_config_needed (cam,1 ); } (cam->users)++; + cam->pll1 =devm_clk_get (cam->dev,"pll1" ); +if (IS_ERR (cam->pll1)) { +cam_err (cam,"Could not get pll1 clock\n" ); + ret =PTR_ERR (cam->pll1); + } out:mutex_unlock (&cam->s_mutex);return ret;
@@ -1569,6 +1638,7 @@ static int mcam_v4l_release(struct file *filp)if (cam->users ==0 ) {mcam_ctlr_stop_dma (cam);mcam_cleanup_vb2 (cam); +mcam_config_mipi (cam,0 );mcam_ctlr_power_down (cam);if (cam->buffer_mode == B_vmalloc && alloc_bufs_at_read)mcam_free_dma_bufs (cam);
drivers/media/platform/marvell-ccic/mcam-core.h +23 -1
@@ -101,11 +101,21 @@ struct mcam_camera {short int clock_speed;/* Sensor clock speed, default 30 */ short int use_smbus;/* SMBUS or straight I2c? */ enum mcam_buffer_mode buffer_mode; + +enum v4l2_mbus_type bus_type; +/* MIPI support */ +int *dphy; +int mipi_enabled; +int lane;/* lane number */ + +struct clk *pll1; +/* * Callbacks from the core to the platform code. */ void (*plat_power_up) (struct mcam_camera *cam);void (*plat_power_down) (struct mcam_camera *cam); +void (*calc_dphy)(struct mcam_camera *cam);/* * Everything below here is private to the mcam core and
@@ -218,6 +228,15 @@ int mccic_resume(struct mcam_camera *cam);#define REG_Y0BAR 0x00#define REG_Y1BAR 0x04#define REG_Y2BAR 0x08 + +/* +* register definitions for MIPI support +*/ +#define REG_CSI2_CTRL0 0x100 +#define REG_CSI2_DPHY3 0x12c +#define REG_CSI2_DPHY5 0x134 +#define REG_CSI2_DPHY6 0x138 +/* ... */ #define REG_IMGPITCH 0x24/* Image pitch register */
@@ -292,7 +311,9 @@ int mccic_resume(struct mcam_camera *cam);#define C0_DOWNSCALE 0x08000000/* Enable downscaler */ #define C0_SIFM_MASK 0xc0000000/* SIF mode bits */ #define C0_SIF_HVSYNC 0x00000000/* Use H/VSYNC */ -#define CO_SOF_NOSYNC 0x40000000/* Use inband active signaling */ +#define C0_SOF_NOSYNC 0x40000000/* Use inband active signaling */ +#define C0_EOF_VSYNC 0x00400000/* Generate EOF by VSYNC */ +#define C0_VEDGE_CTRL 0x00800000/* Detect falling edge of VSYNC */ /* Bits below C1_444ALPHA are not present in Cafe */ #define REG_CTRL1 0x40/* Control 1 */
@@ -308,6 +329,7 @@ int mccic_resume(struct mcam_camera *cam);#define C1_TWOBUFS 0x08000000/* Use only two DMA buffers */ #define C1_PWRDWN 0x10000000/* Power down */ +#define REG_CTRL3 0x1ec/* CCIC parallel mode */ #define REG_CLKCTRL 0x88/* Clock control */ #define CLK_DIV_MASK 0x0000ffff/* Upper bits RW "reserved" */
drivers/media/platform/marvell-ccic/mmp-driver.c +74 -1
107 lines not on this page · raw message
include/media/mmp-camera.h +10 -0
@@ -1,3 +1,4 @@ +#include <media/v4l2-mediabus.h> /* * Information for the Marvell Armada MMP camera */
@@ -6,4 +7,13 @@ struct mmp_camera_platform_data {struct platform_device *i2c_device;int sensor_power_gpio;int sensor_reset_gpio; +enum v4l2_mbus_type bus_type; +/* +* MIPI support +*/ +int dphy[3 ];/* DPHY: CSI2_DPHY3, CSI2_DPHY5, CSI2_DPHY6 */ +int dphy3_algo;/* Exist 2 algos for calculate CSI2_DPHY3 */ +int mipi_enabled;/* MIPI enabled flag */ +int lane;/* ccic used lane number; 0 means DVP mode */ +int lane_clk; };
Signature · 1 line
1.7.9.5
Re: [PATCH V3 02/15] [media] marvell-ccic: add MIPI support for marvell-ccic driver
Quoted 4 lines · On Sat, 15 Dec 2012 17:57:51 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch adds the MIPI support for marvell-ccic. Board driver should determine whether using MIPI or not.
There are limits to how deeply I can review this, since I know little about the MIPI mode and don't have any hardware that uses it. So I'm assuming that it all works :) My comments are on a different level.
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_ctlr_stop(struct mcam_camera *cam) · line 265
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.c +9
-0+static int mcam_config_mipi (struct mcam_camera *mcam,int enable) +{ +if (mcam->bus_type ==V4L2_MBUS_CSI2 && enable) { +/* Using MIPI mode and enable MIPI */ +cam_dbg (mcam,"camera: DPHY3=0x%x, DPHY5=0x%x, DPHY6=0x%x\n" , + mcam->dphy[0 ], mcam->dphy[1 ], mcam->dphy[2 ]); +mcam_reg_write (mcam,REG_CSI2_DPHY3 , mcam->dphy[0 ]); +mcam_reg_write (mcam,REG_CSI2_DPHY6 , mcam->dphy[2 ]); +mcam_reg_write (mcam,REG_CSI2_DPHY5 , mcam->dphy[1 ]);
Is there a reason you're writing them in something other than direct increasing order? If so, a comment saying why might help somebody in ghe future.
Quoted 7 lines
drivers/media/platform/marvell-ccic/mcam-core.c +7
-0+if (mcam->mipi_enabled ==0 ) { +/* +* 0x41 actives 1 lane +* 0x43 actives 2 lanes +* 0x47 actives 4 lanes +* There is no 3 lanes case +*/
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_ctlr_stop(struct mcam_camera *cam) · line 283
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-0+switch (mcam->lane) { +case 1 : +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x41 ); +break ; +case 2 : +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x43 ); +break ; +case 4 : +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x47 ); +break ;
Can we have defined symbols rather than magic constants here?
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_ctlr_image(struct mcam_camera *cam) · line 711
Quoted 12 lines
drivers/media/platform/marvell-ccic/mcam-core.c +8
-0@@ -656,6 +701,15 @@ static void mcam_ctlr_image(struct mcam_camera *cam)*/ mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC ,C0_SIFM_MASK ); + +/* +* This field controls the generation of EOF(DVP only) +*/ +if (cam->bus_type !=V4L2_MBUS_CSI2 ) { +mcam_reg_set_bit (cam,REG_CTRL0 , +C0_EOF_VSYNC |C0_VEDGE_CTRL ); +mcam_reg_write (cam,REG_CTRL3 ,0x4 );
Again, how about a symbol, or at least an explanation of what 0x4 means?
Quoted 3 lines
drivers/media/platform/marvell-ccic/mcam-core.c +1
-0+ } }
[...]
drivers/media/platform/marvell-ccic/mcam-core.c static int mcam_v4l_open(struct file *filp) · line 1622
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.c +5
-0@@ -1551,6 +1615,11 @@ static int mcam_v4l_open(struct file *filp)mcam_set_config_needed (cam,1 ); } (cam->users)++; + cam->pll1 =devm_clk_get (cam->dev,"pll1" ); +if (IS_ERR (cam->pll1)) { +cam_err (cam,"Could not get pll1 clock\n" ); + ret =PTR_ERR (cam->pll1); + }
This looks like it gets the clock in all cases? Is that right?
drivers/media/platform/marvell-ccic/mcam-core.h int mccic_resume(struct mcam_camera *cam); · line 316
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.h +3
-1#define REG_IMGPITCH 0x24/* Image pitch register */ @@ -292,7 +311,9 @@ int mccic_resume(struct mcam_camera *cam);#define C0_DOWNSCALE 0x08000000/* Enable downscaler */ #define C0_SIFM_MASK 0xc0000000/* SIF mode bits */ #define C0_SIF_HVSYNC 0x00000000/* Use H/VSYNC */ -#define CO_SOF_NOSYNC 0x40000000/* Use inband active signaling */ +#define C0_SOF_NOSYNC 0x40000000/* Use inband active signaling */ +#define C0_EOF_VSYNC 0x00400000/* Generate EOF by VSYNC */ +#define C0_VEDGE_CTRL 0x00800000/* Detect falling edge of VSYNC */
Being the retentive sort of guy I am, I try to keep definitions like these in numerical order. Any chance you could humor me and maintain that?
drivers/media/platform/marvell-ccic/mcam-core.h int mccic_resume(struct mcam_camera *cam); · line 334
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.h +1
-0/* Bits below C1_444ALPHA are not present in Cafe */ #define REG_CTRL1 0x40/* Control 1 */ @@ -308,6 +329,7 @@ int mccic_resume(struct mcam_camera *cam);#define C1_TWOBUFS 0x08000000/* Use only two DMA buffers */ #define C1_PWRDWN 0x10000000/* Power down */ +#define REG_CTRL3 0x1ec/* CCIC parallel mode */ #define REG_CLKCTRL 0x88/* Clock control */ #define CLK_DIV_MASK 0x0000ffff/* Upper bits RW "reserved" */
Here, too, I'd rather keep them in order if possible.
Quoted 18 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +18
-0+/* +* calc the dphy register values +* There are three dphy registers being used. +* dphy[0] can be set with a default value +* or be calculated dynamically +*/ +void mmpcam_calc_dphy (struct mcam_camera *mcam) +{ +struct mmp_camera *cam =mcam_to_cam (mcam); +struct mmp_camera_platform_data *pdata = cam->pdev->dev.platform_data; +struct device *dev = &cam->pdev->dev; +unsigned long tx_clk_esc; + +/* +* If dphy[0] is calculated dynamically, +* pdata->lane_clk should be already set +* either in the board driver statically +* or in the sensor driver dynamically.
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera *mcam) · line 183
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +10
-0+*/ +switch (pdata->dphy3_algo) { +case 1 : +/* +* dphy3_algo == 1 +* Calculate CSI2_DPHY3 algo for PXA910 +*/ + pdata->dphy[0 ] = ((1 + pdata->lane_clk *80 /1000 ) &0xff ) <<8 + | (1 + pdata->lane_clk *35 /1000 ); +break ;
What are the chances of getting a comment or some other reference so that a naive reader like me has a chance of understanding what this calculation does? Where do all those constants come from?
Quoted 15 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +15
-0+case 2 : +/* +* dphy3_algo == 2 +* Calculate CSI2_DPHY3 algo for PXA2128 +*/ + pdata->dphy[0 ] = + ((2 + pdata->lane_clk *110 /1000 ) &0xff ) <<8 + | (1 + pdata->lane_clk *35 /1000 ); +break ; +default : +/* +* dphy3_algo == 0 +* Use default CSI2_DPHY3 value for PXA688/PXA988 +*/ +dev_dbg (dev,"camera: use the default CSI2_DPHY3 value\n" );
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera *mcam) · line 208
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +10
-0+ } + +/* +* pll1 will never be changed, it is a fixed value +*/ + +if (IS_ERR (mcam->pll1)) +return ; + + tx_clk_esc =clk_get_rate (mcam->pll1) /1000000 /12 ;
Being who I am (see "retentive" above) I'll always parenthesize an expression like this to make the intended order of operations explicit.
Mostly low-level comments, it's looking pretty good.
jon
RE: [PATCH V3 02/15] [media] marvell-ccic: add MIPI support for marvell-ccic driver
Hi, Jonathan
Quoted 26 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Sunday, 16 December, 2012 23:55
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 02/15] [media] marvell-ccic: add MIPI support for marvell-ccic driverQuoted 4 lines · On Sat, 15 Dec 2012 17:57:51 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch adds the MIPI support for marvell-ccic. Board driver should determine whether using MIPI or not.
There are limits to how deeply I can review this, since I know little about the MIPI mode and don't have any hardware that uses it. So I'm assuming that it all works :) My comments are on a different level.
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_ctlr_stop(struct mcam_camera *cam)
Quoted 5 lines
drivers/media/platform/marvell-ccic/mcam-core.c +5
-0+static int mcam_config_mipi (struct mcam_camera *mcam,int enable) +{ +if (mcam->bus_type ==V4L2_MBUS_CSI2 && enable) { +/* Using MIPI mode and enable MIPI */ + cam_dbg(mcam, "camera: DPHY3=0x%x, DPHY5=0x%x,DPHY6=0x%x\n",
Quoted 8 lines
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_ctlr_stop(struct mcam_camera *cam) · line 265
Quoted 4 lines
drivers/media/platform/marvell-ccic/mcam-core.c +4
-0+ mcam->dphy[0], mcam->dphy[1], mcam->dphy[2]); +mcam_reg_write (mcam,REG_CSI2_DPHY3 , mcam->dphy[0 ]); +mcam_reg_write (mcam,REG_CSI2_DPHY6 , mcam->dphy[2 ]); +mcam_reg_write (mcam,REG_CSI2_DPHY5 , mcam->dphy[1 ]);Is there a reason you're writing them in something other than direct increasing order? If so, a comment saying why might help somebody in ghe future.
[Albert Wang] Oh, actually there is no strict sequence to write these MIPI registers.
We can change it with direct increasing order, also we can add some comments for describing the definition. :)
Quoted 11 lines
Quoted 11 lines
drivers/media/platform/marvell-ccic/mcam-core.c +11
-0+if (mcam->mipi_enabled ==0 ) { +/* +* 0x41 actives 1 lane +* 0x43 actives 2 lanes +* 0x47 actives 4 lanes +* There is no 3 lanes case +*/ +switch (mcam->lane) { +case 1 : +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x41 ); +break ;
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_ctlr_stop(struct mcam_camera *cam) · line 283
Quoted 6 lines
drivers/media/platform/marvell-ccic/mcam-core.c +6
-0+case 2 : +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x43 ); +break ; +case 4 : +mcam_reg_write (mcam,REG_CSI2_CTRL0 ,0x47 ); +break ;Can we have defined symbols rather than magic constants here?
[Albert Wang] Sure, we can do it in the next version.
Quoted 6 lines
Quoted 6 lines
drivers/media/platform/marvell-ccic/mcam-core.c +2
-0@@ -656,6 +701,15 @@ static void mcam_ctlr_image(struct mcam_camera *cam)*/ mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC ,C0_SIFM_MASK ); + +/*
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_ctlr_image(struct mcam_camera *cam) · line 711
Quoted 6 lines
drivers/media/platform/marvell-ccic/mcam-core.c +6
-0+* This field controls the generation of EOF(DVP only) +*/ +if (cam->bus_type !=V4L2_MBUS_CSI2 ) { +mcam_reg_set_bit (cam,REG_CTRL0 , +C0_EOF_VSYNC |C0_VEDGE_CTRL ); +mcam_reg_write (cam,REG_CTRL3 ,0x4 );Again, how about a symbol, or at least an explanation of what
0x4means?
[Albert Wang] OK, will do it.
Quoted 4 lines
Quoted 3 lines
drivers/media/platform/marvell-ccic/mcam-core.c +1
-0+ } }[...]
Quoted 12 lines
drivers/media/platform/marvell-ccic/mcam-core.c static int mcam_v4l_open(struct file *filp) · line 1622
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.c +5
-0@@ -1551,6 +1615,11 @@ static int mcam_v4l_open(struct file *filp)mcam_set_config_needed (cam,1 ); } (cam->users)++; + cam->pll1 =devm_clk_get (cam->dev,"pll1" ); +if (IS_ERR (cam->pll1)) { +cam_err (cam,"Could not get pll1 clock\n" ); + ret =PTR_ERR (cam->pll1); + }This looks like it gets the clock in all cases? Is that right?
[Albert Wang] Em, we need it in MIPI mode, it looks we should limit the usage in the MIPI mode. We will update it.
Quoted 11 lines
drivers/media/platform/marvell-ccic/mcam-core.h int mccic_resume(struct mcam_camera *cam); · line 316
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.h +3
-1#define REG_IMGPITCH 0x24/* Image pitch register */ @@ -292,7 +311,9 @@ int mccic_resume(struct mcam_camera *cam);#define C0_DOWNSCALE 0x08000000/* Enable downscaler */ #define C0_SIFM_MASK 0xc0000000/* SIF mode bits */ #define C0_SIF_HVSYNC 0x00000000/* Use H/VSYNC */ -#define CO_SOF_NOSYNC 0x40000000/* Use inband active signaling */ +#define C0_SOF_NOSYNC 0x40000000/* Use inband active signaling */ +#define C0_EOF_VSYNC 0x00400000/* Generate EOF by VSYNC */ +#define C0_VEDGE_CTRL 0x00800000/* Detect falling edge of VSYNC */
Quoted 3 lines
Being the retentive sort of guy I am, I try to keep definitions like these in numerical order. Any chance you could humor me and maintain that?
[Albert Wang] OK, we will update it and keep it with numerical order. BTW, there is a typo in CO_SOF_NOSYNC
Quoted 6 lines
Quoted 6 lines
drivers/media/platform/marvell-ccic/mcam-core.h +0
-0/* Bits below C1_444ALPHA are not present in Cafe */ #define REG_CTRL1 0x40/* Control 1 */ @@ -308,6 +329,7 @@ int mccic_resume(struct mcam_camera *cam);#define C1_TWOBUFS 0x08000000/* Use only two DMA buffers */ #define C1_PWRDWN 0x10000000/* Power down */
Quoted 6 lines
drivers/media/platform/marvell-ccic/mcam-core.h int mccic_resume(struct mcam_camera *cam); · line 334
Quoted 3 lines
drivers/media/platform/marvell-ccic/mcam-core.h +1
-0+#define REG_CTRL3 0x1ec/* CCIC parallel mode */ #define REG_CLKCTRL 0x88/* Clock control */ #define CLK_DIV_MASK 0x0000ffff/* Upper bits RW "reserved" */ Here, too, I'd rather keep them in order if possible.
[Albert Wang] OK, we will change it.
Quoted 24 lines
Quoted 24 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +24
-0+/* +* calc the dphy register values +* There are three dphy registers being used. +* dphy[0] can be set with a default value +* or be calculated dynamically +*/ +void mmpcam_calc_dphy (struct mcam_camera *mcam) +{ +struct mmp_camera *cam =mcam_to_cam (mcam); +struct mmp_camera_platform_data *pdata = cam->pdev->dev.platform_data; +struct device *dev = &cam->pdev->dev; +unsigned long tx_clk_esc; + +/* +* If dphy[0] is calculated dynamically, +* pdata->lane_clk should be already set +* either in the board driver statically +* or in the sensor driver dynamically. +*/ +switch (pdata->dphy3_algo) { +case 1 : +/* +* dphy3_algo == 1 +* Calculate CSI2_DPHY3 algo for PXA910
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera *mcam) · line 183
Quoted 4 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +4
-0+*/ + pdata->dphy[0 ] = ((1 + pdata->lane_clk *80 /1000 ) &0xff ) <<8 + | (1 + pdata->lane_clk *35 /1000 ); +break ;What are the chances of getting a comment or some other reference so that a naive reader like me has a chance of understanding what this calculation does? Where do all those constants come from?
[Albert Wang] The calculation is based on MIPI CSI2 spec, it looks it's very difficult to describe it in some sentences. But, anyway we will try to do it.
Quoted 20 lines
Quoted 20 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +20
-0+case 2 : +/* +* dphy3_algo == 2 +* Calculate CSI2_DPHY3 algo for PXA2128 +*/ + pdata->dphy[0 ] = + ((2 + pdata->lane_clk *110 /1000 ) &0xff ) <<8 + | (1 + pdata->lane_clk *35 /1000 ); +break ; +default : +/* +* dphy3_algo == 0 +* Use default CSI2_DPHY3 value for PXA688/PXA988 +*/ +dev_dbg (dev,"camera: use the default CSI2_DPHY3 value\n" ); + } + +/* +* pll1 will never be changed, it is a fixed value +*/
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera *mcam) · line 208
Quoted 5 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +5
-0+ +if (IS_ERR (mcam->pll1)) +return ; + + tx_clk_esc =clk_get_rate (mcam->pll1) /1000000 /12 ;Being who I am (see "retentive" above) I'll always parenthesize an expression like this to make the intended order of operations explicit.
[Albert Wang] Yes, an expression with parenthesis is more explicit.
Quoted 3 lines
Mostly low-level comments, it's looking pretty good.
jon
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 02/15] [media] marvell-ccic: add MIPI support for marvell-ccic driver
In reply to Albert WangHi Albert
Looks quite good to me, thanks for addressing my comments! Just a minor nitpick below:
Quoted 8 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the MIPI support for marvell-ccic. Board driver should determine whether using MIPI or not.
Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>---
A general request for future revisions: it would help if you could list changes since the last version here - after any Sob's and the "---" line.
Quoted 5 lines
drivers/media/platform/marvell-ccic/mcam-core.c | 70 ++++++++++++++++++++ drivers/media/platform/marvell-ccic/mcam-core.h | 24 ++++++- drivers/media/platform/marvell-ccic/mmp-driver.c | 75 +++++++++++++++++++++- include/media/mmp-camera.h | 10 +++ 4 files changed, 177 insertions(+), 2 deletions(-)
[snip]
Quoted 4 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0
[snip]
drivers/media/platform/marvell-ccic/mmp-driver.c static int mmpcam_probe(struct platform_device *pdev) · line 255
Quoted 6 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0@@ -183,8 +251,14 @@ static int mmpcam_probe(struct platform_device *pdev) mcam = &cam->mcam; mcam->plat_power_up = mmpcam_power_up; mcam->plat_power_down = mmpcam_power_down; + mcam->calc_dphy = mmpcam_calc_dphy; + mcam->pll1 =NULL ;
Strictly speaking this is not needed, it's allocated using kzalloc(). Kinda pointless to use kzalloc() and then explicitly initialise each field, including 0 / NULL...
drivers/media/platform/marvell-ccic/mmp-driver.c static int mmpcam_probe(struct platform_device *pdev) · line 260
Quoted 5 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +3
-0mcam->dev = &pdev->dev; mcam->use_smbus =0 ; + mcam->bus_type = pdata->bus_type; + mcam->dphy = pdata->dphy; + mcam->mipi_enabled =0 ;
ditto
drivers/media/platform/marvell-ccic/mmp-driver.c static int mmpcam_probe(struct platform_device *pdev) · line 264
Quoted 4 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-0+ mcam->lane = pdata->lane; mcam->chip_id =V4L2_IDENT_ARMADA610 ; mcam->buffer_mode = B_DMA_sg;spin_lock_init (&mcam->dev_lock);
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
RE: [PATCH V3 02/15] [media] marvell-ccic: add MIPI support for marvell-ccic driver
Hi, Guennadi
Happy New Year!
Thank you for your review!
Quoted 43 lines
-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: Tuesday, 01 January, 2013 23:28
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 02/15] [media] marvell-ccic: add MIPI support for marvell-ccic driverHi Albert
Looks quite good to me, thanks for addressing my comments! Just a minor nitpick below:
Quoted 8 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the MIPI support for marvell-ccic. Board driver should determine whether using MIPI or not.
Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>---
A general request for future revisions: it would help if you could list changes since the last version here - after any Sob's and the "---" line.
Quoted 5 lines
drivers/media/platform/marvell-ccic/mcam-core.c | 70 ++++++++++++++++++++ drivers/media/platform/marvell-ccic/mcam-core.h | 24 ++++++- drivers/media/platform/marvell-ccic/mmp-driver.c | 75 +++++++++++++++++++++- include/media/mmp-camera.h | 10 +++ 4 files changed, 177 insertions(+), 2 deletions(-)[snip]
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mmp-driver.cQuoted 3 lines
index c4c17fe..603fa0a 100755
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0[snip]
Quoted 11 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static int mmpcam_probe(struct platform_device *pdev) · line 255
Quoted 6 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0@@ -183,8 +251,14 @@ static int mmpcam_probe(struct platform_device *pdev) mcam = &cam->mcam; mcam->plat_power_up = mmpcam_power_up; mcam->plat_power_down = mmpcam_power_down; + mcam->calc_dphy = mmpcam_calc_dphy; + mcam->pll1 =NULL ;Strictly speaking this is not needed, it's allocated using
kzalloc(). Kinda pointless to usekzalloc()and then explicitly initialise each field, including 0 / NULL...
[Albert Wang] OK, We will update it.
Quoted 8 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static int mmpcam_probe(struct platform_device *pdev) · line 260
Quoted 5 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +3
-0mcam->dev = &pdev->dev; mcam->use_smbus =0 ; + mcam->bus_type = pdata->bus_type; + mcam->dphy = pdata->dphy; + mcam->mipi_enabled =0 ;ditto
Quoted 11 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static int mmpcam_probe(struct platform_device *pdev) · line 264
Quoted 4 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-0+ mcam->lane = pdata->lane; mcam->chip_id =V4L2_IDENT_ARMADA610 ; mcam->buffer_mode = B_DMA_sg;spin_lock_init (&mcam->dev_lock);Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Thanks
Albert Wang
86-21-61092656
PATCH v3 3/15 marvell-ccic: add clock tree support for marvell-ccic driver
In reply to Albert WangFrom: Libin Yang <[email protected]>
This patch adds the clock tree support for marvell-ccic.
Each board may require different clk enabling sequence. Developer need add the clk_name in correct sequence in board driver to use this feature.
--- drivers/media/platform/marvell-ccic/mcam-core.h | 4 ++ drivers/media/platform/marvell-ccic/mmp-driver.c | 57 +++++++++++++++++++++- include/media/mmp-camera.h | 5 ++ 3 files changed, 65 insertions(+), 1 deletion(-)
drivers/media/platform/marvell-ccic/mcam-core.h +4 -0
@@ -88,6 +88,7 @@ struct mcam_frame_state {* the dev_lock spinlock; they are marked as such by comments. * dev_lock is also required for access to device registers. */ +#define NR_MCAM_CLK 4struct mcam_camera {/* * These fields should be set by the platform code prior to
@@ -109,6 +110,9 @@ struct mcam_camera {int lane;/* lane number */ struct clk *pll1; +/* clock tree support */ +struct clk *clk[NR_MCAM_CLK ]; +int clk_num;/* * Callbacks from the core to the platform code.
drivers/media/platform/marvell-ccic/mmp-driver.c +56 -1
111 lines not on this page · raw message
include/media/mmp-camera.h +5 -0
@@ -16,4 +16,9 @@ struct mmp_camera_platform_data {int mipi_enabled;/* MIPI enabled flag */ int lane;/* ccic used lane number; 0 means DVP mode */ int lane_clk; +/* +* clock tree support +*/ +char *clk_name[4 ]; +int clk_num; };
Signature · 1 line
1.7.9.5
Re: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driver
Quoted 14 lines · On Sat, 15 Dec 2012 17:57:52 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch adds the clock tree support for marvell-ccic.
Each board may require different clk enabling sequence. Developer need add the
clk_namein correct sequence in board driver to use this feature.drivers/media/platform/marvell-ccic/mmp-driver.c +6
-0+static void mcam_clk_set (struct mcam_camera *mcam,int on) +{ +unsigned int i; + +if (on) { +for (i =0 ; i < mcam->clk_num; i++) {
drivers/media/platform/marvell-ccic/mmp-driver.c static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev) · line 122
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +10
-0+if (mcam->clk[i]) +clk_enable (mcam->clk[i]); + } + }else { +for (i = mcam->clk_num; i >0 ; i--) { +if (mcam->clk[i -1 ]) +clk_disable (mcam->clk[i -1 ]); + } + } +}
A couple of minor comments:
- This function is always called with a constant value for "on". It would be easier to read (and less prone to unfortunate brace errors) if it were just two functions: mcam_clk_enable() and mcam_clk_disable().
- I'd write the second for loop as:
for (i = mcal->clk_num - 1; i >= 0; i==) {just to match the values used in the other direction and avoid the subscript arithmetic.
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 254
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0+static void mcam_init_clk (struct mcam_camera *mcam, +struct mmp_camera_platform_data *pdata,int init)
So why does an "init" function have an "init" parameter? Again, I think this would be far better split into two functions. Among other things, that would help to reduce the deep nesting below.
Quoted 17 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +17
-0+{ +unsigned int i; + +if (NR_MCAM_CLK < pdata->clk_num) { +dev_err (mcam->dev,"Too many mcam clocks defined\n" ); + mcam->clk_num =0 ; +return ; + } + +if (init) { +for (i =0 ; i < pdata->clk_num; i++) { +if (pdata->clk_name[i] !=NULL ) { + mcam->clk[i] =devm_clk_get (mcam->dev, + pdata->clk_name[i]); +if (IS_ERR (mcam->clk[i])) { + dev_err(mcam->dev, + "Could not get clk: %s\n",
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 281
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +10
-0+ pdata->clk_name[i]); + mcam->clk_num =0 ; +return ; + } + } + } + mcam->clk_num = pdata->clk_num; + }else + mcam->clk_num =0 ; +}
Again, minor comments, but I do think the code would be improved by splitting those functions. Meanwhile:
jon
RE: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driver
Hi, Jonathan
Quoted 38 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:03
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell- ccic driverQuoted 14 lines · On Sat, 15 Dec 2012 17:57:52 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch adds the clock tree support for marvell-ccic.
Each board may require different clk enabling sequence. Developer need add the
clk_namein correct sequence in board driver to use this feature.drivers/media/platform/marvell-ccic/mmp-driver.c +6
-0+static void mcam_clk_set (struct mcam_camera *mcam,int on) +{ +unsigned int i; + +if (on) { +for (i =0 ; i < mcam->clk_num; i++) {drivers/media/platform/marvell-ccic/mmp-driver.c static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev) · line 122
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +10
-0+if (mcam->clk[i]) +clk_enable (mcam->clk[i]); + } + }else { +for (i = mcam->clk_num; i >0 ; i--) { +if (mcam->clk[i -1 ]) +clk_disable (mcam->clk[i -1 ]); + } + } +}A couple of minor comments:
Quoted 4 lines
- This function is always called with a constant value for "on". It would be easier to read (and less prone to unfortunate brace errors) if it were just two functions:
mcam_clk_enable()andmcam_clk_disable().
[Albert Wang] OK, that's fine to split it to 2 functions. :)
Quoted 7 lines
- I'd write the second for loop as:
for (i = mcal->clk_num - 1; i >= 0; i==) {just to match the values used in the other direction and avoid the subscript arithmetic.
[Albert Wang] Yes, we can improve it. :)
Quoted 7 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 254
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0+static void mcam_init_clk (struct mcam_camera *mcam, +struct mmp_camera_platform_data *pdata,int init)So why does an "init" function have an "init" parameter? Again, I think this would be far better split into two functions. Among other things, that would help to reduce the deep nesting below.
[Albert Wang] Yes, the parameter name is confused. And we will split this function too. :)
Quoted 31 lines
Quoted 17 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +17
-0+{ +unsigned int i; + +if (NR_MCAM_CLK < pdata->clk_num) { +dev_err (mcam->dev,"Too many mcam clocks defined\n" ); + mcam->clk_num =0 ; +return ; + } + +if (init) { +for (i =0 ; i < pdata->clk_num; i++) { +if (pdata->clk_name[i] !=NULL ) { + mcam->clk[i] =devm_clk_get (mcam->dev, + pdata->clk_name[i]); +if (IS_ERR (mcam->clk[i])) { + dev_err(mcam->dev, + "Could not get clk: %s\n",drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 281
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +10
-0+ pdata->clk_name[i]); + mcam->clk_num =0 ; +return ; + } + } + } + mcam->clk_num = pdata->clk_num; + }else + mcam->clk_num =0 ; +}Again, minor comments, but I do think the code would be improved by splitting those functions. Meanwhile:
Quoted 3 lines
Acked-by Jonathan Corbet <[email protected]>jon
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driver
On 2012-12-16 22:51, Albert Wang wrote:
[...]
Quoted 26 lines
Quoted 20 lines
Quoted 7 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +6
-0+static void mcam_clk_set (struct mcam_camera *mcam,int on) +{ +unsigned int i; + +if (on) { +for (i =0 ; i < mcam->clk_num; i++) {drivers/media/platform/marvell-ccic/mmp-driver.c static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev) · line 122
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +10
-0+if (mcam->clk[i]) +clk_enable (mcam->clk[i]); + } + }else { +for (i = mcam->clk_num; i >0 ; i--) { +if (mcam->clk[i -1 ]) +clk_disable (mcam->clk[i -1 ]); + } + } +}A couple of minor comments:
Quoted 4 lines
- This function is always called with a constant value for "on". It would be easier to read (and less prone to unfortunate brace errors) if it were just two functions:
mcam_clk_enable()andmcam_clk_disable().[Albert Wang] OK, that's fine to split it to 2 functions. :)
Quoted 8 lines
Quoted 7 lines
- I'd write the second for loop as:
for (i = mcal->clk_num - 1; i >= 0; i==) {just to match the values used in the other direction and avoid the subscript arithmetic.
[Albert Wang] Yes, we can improve it. :)
Bewar: i is unsigned so testing i >= 0 will loop forever.
[...]
RE: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driver
Hi, Nicolas
Thank you for your reminder. :)
Happy New Year!
Quoted 40 lines
-----Original Message-----
From: Nicolas THERY [mailto:[email protected]]
Sent: Friday, 04 January, 2013 01:38
To: Albert Wang
Cc: Jonathan Corbet; [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell- ccic driverOn 2012-12-16 22:51, Albert Wang wrote:
[...]Quoted 28 lines
Quoted 20 lines
Quoted 7 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +6
-0+static void mcam_clk_set (struct mcam_camera *mcam,int on) +{ +unsigned int i; + +if (on) { +for (i =0 ; i < mcam->clk_num; i++) {drivers/media/platform/marvell-ccic/mmp-driver.c static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev) · line 122
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +10
-0+if (mcam->clk[i]) +clk_enable (mcam->clk[i]); + } + }else { +for (i = mcam->clk_num; i >0 ; i--) { +if (mcam->clk[i -1 ]) +clk_disable (mcam->clk[i -1 ]); + } + } +}A couple of minor comments:
Quoted 4 lines
- This function is always called with a constant value for "on". It would be easier to read (and less prone to unfortunate brace errors) if it were just two functions:
mcam_clk_enable()andmcam_clk_disable().[Albert Wang] OK, that's fine to split it to 2 functions. :)
Quoted 2 lines
- I'd write the second for loop as:
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
for (i = mcal->clk_num - 1; i >= 0; i==) {just to match the values used in the other direction and avoid the subscript arithmetic.
[Albert Wang] Yes, we can improve it. :)
Bewar: i is unsigned so testing i >= 0 will loop forever.
[Albert Wang] Yes, it looks my original code can work. :)
Quoted 1 line
[...]
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driver
In reply to Albert WangQuoted 43 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the clock tree support for marvell-ccic.
Each board may require different clk enabling sequence. Developer need add the
clk_namein correct sequence in board driver to use this feature.Signed-off-by Libin Yang <[email protected]>Signed-off-by Albert Wang <[email protected]>--- drivers/media/platform/marvell-ccic/mcam-core.h | 4 ++ drivers/media/platform/marvell-ccic/mmp-driver.c | 57 +++++++++++++++++++++- include/media/mmp-camera.h | 5 ++ 3 files changed, 65 insertions(+), 1 deletion(-)drivers/media/platform/marvell-ccic/mcam-core.h +4
-0@@ -88,6 +88,7 @@ struct mcam_frame_state {* the dev_lock spinlock; they are marked as such by comments. * dev_lock is also required for access to device registers. */ +#define NR_MCAM_CLK 4struct mcam_camera {/* * These fields should be set by the platform code prior to @@ -109,6 +110,9 @@ struct mcam_camera {int lane;/* lane number */ struct clk *pll1; +/* clock tree support */ +struct clk *clk[NR_MCAM_CLK ]; +int clk_num;/* * Callbacks from the core to the platform code. drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0
drivers/media/platform/marvell-ccic/mmp-driver.c static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev) · line 107
Quoted 4 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-0@@ -104,6 +104,23 @@ static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev)#define REG_CCIC_DCGCR 0x28/* CCIC dyn clock gate ctrl reg */ #define REG_CCIC_CRCR 0x50/* CCIC clk reset ctrl reg */ +static void mcam_clk_set (struct mcam_camera *mcam,int on)
Personally, I would also make two functions out of this - "on" and "off," but that's a matter of taste, perhaps.
Quoted 38 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +20
-0+{ +unsigned int i; + +if (on) { +for (i =0 ; i < mcam->clk_num; i++) { +if (mcam->clk[i]) +clk_enable (mcam->clk[i]); + } + }else { +for (i = mcam->clk_num; i >0 ; i--) { +if (mcam->clk[i -1 ]) +clk_disable (mcam->clk[i -1 ]); + } + } +} +/* * Power control. */ @@ -134,6 +151,8 @@ static void mmpcam_power_up(struct mcam_camera *mcam)mdelay (5 );gpio_set_value (pdata->sensor_reset_gpio,1 );/* reset is active low */ mdelay (5 ); + +mcam_clk_set (mcam,1 ); }static void mmpcam_power_down (struct mcam_camera *mcam)@@ -151,6 +170,8 @@ static void mmpcam_power_down(struct mcam_camera *mcam) pdata = cam->pdev->dev.platform_data;gpio_set_value (pdata->sensor_power_gpio,0 );gpio_set_value (pdata->sensor_reset_gpio,0 ); + +mcam_clk_set (mcam,0 ); }/*
drivers/media/platform/marvell-ccic/mmp-driver.c void mmpcam_calc_dphy(struct mcam_camera *mcam) · line 226
Quoted 5 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-1@@ -202,7 +223,7 @@ void mmpcam_calc_dphy(struct mcam_camera *mcam)* pll1 will never be changed, it is a fixed value */ -if (IS_ERR (mcam->pll1)) +if (IS_ERR_OR_NULL (mcam->pll1))
Why are you changing this? If this really were needed, you should do this already in the previous patch, where you add these lines. But I don't think this is a good idea, don't think Russell would like this :-) NULL is a valid clock. Only a negative error is a failure. In fact, if you like, you could initialise .pll1 to ERR_PTR(-EINVAL) in your previous patch in mmpcam_probe().
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 254
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0return ; tx_clk_esc =clk_get_rate (mcam->pll1) /1000000 /12 ;@@ -229,6 +250,35 @@ static irqreturn_t mmpcam_irq(int irq, void *data)return IRQ_RETVAL (handled); } +static void mcam_init_clk (struct mcam_camera *mcam, +struct mmp_camera_platform_data *pdata,int init)
I don't think this "int init" makes sense. Please, remove the parameter and you actually don't need the de-initialisation, no reason to set num_clk = 0 before freeing memory.
Quoted 4 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +4
-0+{ +unsigned int i; + +if (NR_MCAM_CLK < pdata->clk_num) {
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 268
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +10
-0+dev_err (mcam->dev,"Too many mcam clocks defined\n" ); + mcam->clk_num =0 ; +return ; + } + +if (init) { +for (i =0 ; i < pdata->clk_num; i++) { +if (pdata->clk_name[i] !=NULL ) { + mcam->clk[i] =devm_clk_get (mcam->dev, + pdata->clk_name[i]);
Sorry, no. Passing clock names in platform data doesn't look right to me. Clock names are a property of the consumer device, not of clock supplier. Also, your platform tells you to get clk_num clocks, you fail to get one of them, you don't continue trying the rest and just return with no error. This seems strange, usually a failure to get clocks, that the platform tells you to get, is fatal.
Quoted 6 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +6
-0+if (IS_ERR (mcam->clk[i])) { +dev_err (mcam->dev, +"Could not get clk: %s\n" , + pdata->clk_name[i]); + mcam->clk_num =0 ; +return ;
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 284
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +7
-0+ } + } + } + mcam->clk_num = pdata->clk_num; + }else + mcam->clk_num =0 ; +}static int mmpcam_probe (struct platform_device *pdev) {
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
RE: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driver
Hi, Guennadi
Quoted 56 lines
-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: Wednesday, 02 January, 2013 00:06
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell- ccic driverQuoted 10 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the clock tree support for marvell-ccic.
Each board may require different clk enabling sequence. Developer need add the
clk_namein correct sequence in board driver to use this feature.Signed-off-by Libin Yang <[email protected]>Signed-off-by Albert Wang <[email protected]>Review
Quoted 7 lines
--- drivers/media/platform/marvell-ccic/mcam-core.h | 4 ++ drivers/media/platform/marvell-ccic/mmp-driver.c | 57 +++++++++++++++++++++- include/media/mmp-camera.h | 5 ++ 3 files changed, 65 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mcam-core.hReview
Quoted 22 lines
index ca63010..86e634e 100755
drivers/media/platform/marvell-ccic/mcam-core.h +4
-0@@ -88,6 +88,7 @@ struct mcam_frame_state {* the dev_lock spinlock; they are marked as such by comments. * dev_lock is also required for access to device registers. */ +#define NR_MCAM_CLK 4struct mcam_camera {/* * These fields should be set by the platform code prior to @@ -109,6 +110,9 @@ struct mcam_camera {int lane;/* lane number */ struct clk *pll1; +/* clock tree support */ +struct clk *clk[NR_MCAM_CLK ]; +int clk_num;/* * Callbacks from the core to the platform code. (quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mmp-driver.cdrivers/media/platform/marvell-ccic/mmp-driver.c static struct mmp_camera *mmpcam_find_device(struct
Quoted 4 lines
index 603fa0a..2c4dce3 100755
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0@@ -104,6 +104,23 @@ static struct mmp_camera *mmpcam_find_device(struct
platform_device*pdev)
Quoted 8 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev) · line 107
Quoted 4 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-0#define REG_CCIC_DCGCR 0x28/* CCIC dyn clock gate ctrl reg */ #define REG_CCIC_CRCR 0x50/* CCIC clk reset ctrl reg */ +static void mcam_clk_set (struct mcam_camera *mcam,int on)Personally, I would also make two functions out of this - "on" and "off," but that's a matter of taste, perhaps.
[Albert Wang] That's we have planned to do in next version.
Quoted 42 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera
Quoted 29 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +18
-0+{ +unsigned int i; + +if (on) { +for (i =0 ; i < mcam->clk_num; i++) { +if (mcam->clk[i]) +clk_enable (mcam->clk[i]); + } + }else { +for (i = mcam->clk_num; i >0 ; i--) { +if (mcam->clk[i -1 ]) +clk_disable (mcam->clk[i -1 ]); + } + } +} +/* * Power control. */ @@ -134,6 +151,8 @@ static void mmpcam_power_up(struct mcam_camera *mcam)mdelay (5 );gpio_set_value (pdata->sensor_reset_gpio,1 );/* reset is active low */ mdelay (5 ); + +mcam_clk_set (mcam,1 ); }static void mmpcam_power_down (struct mcam_camera *mcam)@@ -151,6 +170,8 @@ static void mmpcam_power_down(struct mcam_camera*mcam)
Quoted 12 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0pdata = cam->pdev->dev.platform_data;gpio_set_value (pdata->sensor_power_gpio,0 );gpio_set_value (pdata->sensor_reset_gpio,0 ); + +mcam_clk_set (mcam,0 ); }/* @@ -202,7 +223,7 @@ void mmpcam_calc_dphy(struct mcam_camera *mcam)* pll1 will never be changed, it is a fixed value */
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c void mmpcam_calc_dphy(struct mcam_camera *mcam) · line 226
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-1-if (IS_ERR (mcam->pll1)) +if (IS_ERR_OR_NULL (mcam->pll1))Why are you changing this? If this really were needed, you should do this already in the previous patch, where you add these lines. But I don't think this is a good idea, don't think Russell would like this :-) NULL is a valid clock. Only a negative error is a failure. In fact, if you like, you could initialise .pll1 to
ERR_PTR(-EINVAL)in your previous patch inmmpcam_probe().
[Albert Wang] We will double check it if it's our mistake. Thanks.
Quoted 7 lines
Quoted 7 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0return ; tx_clk_esc =clk_get_rate (mcam->pll1) /1000000 /12 ;@@ -229,6 +250,35 @@ static irqreturn_t mmpcam_irq(int irq, void *data)return IRQ_RETVAL (handled); }
Quoted 7 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 254
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0+static void mcam_init_clk (struct mcam_camera *mcam, +struct mmp_camera_platform_data *pdata,int init)I don't think this "int init" makes sense. Please, remove the parameter and you actually don't need the de-initialisation, no reason to set
num_clk= 0 before freeing memory.
[Albert Wang] OK, we will double check it.
Quoted 13 lines
Quoted 13 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +13
-0+{ +unsigned int i; + +if (NR_MCAM_CLK < pdata->clk_num) { +dev_err (mcam->dev,"Too many mcam clocks defined\n" ); + mcam->clk_num =0 ; +return ; + } + +if (init) { +for (i =0 ; i < pdata->clk_num; i++) { +if (pdata->clk_name[i] !=NULL ) { + mcam->clk[i] = devm_clk_get(mcam->dev,
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 268
Quoted 1 line
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-0+ pdata->clk_name[i]);Sorry, no. Passing clock names in platform data doesn't look right to me. Clock names are a property of the consumer device, not of clock supplier. Also, your platform tells you to get
clk_numclocks, you fail to get one of them, you don't continue trying the rest and just return with no error. This seems strange, usually a failure to get clocks, that the platform tells you to get, is fatal.
[Albert Wang] We will update it.
Quoted 14 lines
Quoted 14 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +13
-0+if (IS_ERR (mcam->clk[i])) { +dev_err (mcam->dev, +"Could not get clk: %s\n" , + pdata->clk_name[i]); + mcam->clk_num =0 ; +return ; + } + } + } + mcam->clk_num = pdata->clk_num; + }else + mcam->clk_num =0 ; +}
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 284
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0static int mmpcam_probe (struct platform_device *pdev) {Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Thanks
Albert Wang
86-21-61092656
RE: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driver
In reply to Guennadi LiakhovetskiHi Guennadi,
Thanks for your review. Please see my comments below.
Quoted 26 lines
-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: Wednesday, January 02, 2013 12:06 AM
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driverQuoted 16 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the clock tree support for marvell-ccic.
Each board may require different clk enabling sequence. Developer need add the
clk_namein correct sequence in board driver to use this feature.Signed-off-by Libin Yang <[email protected]>Signed-off-by Albert Wang <[email protected]>--- drivers/media/platform/marvell-ccic/mcam-core.h | 4 ++ drivers/media/platform/marvell-ccic/mmp-driver.c | 57 +++++++++++++++++++++- include/media/mmp-camera.h | 5 ++ 3 files changed, 65 insertions(+), 1 deletion(-)
[snip]
Quoted 5 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mmp-driver.cQuoted 3 lines
index 603fa0a..2c4dce3 100755
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0
[snip]
Quoted 9 lines
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0+ +mcam_clk_set (mcam,0 ); }/* @@ -202,7 +223,7 @@ void mmpcam_calc_dphy(struct mcam_camera *mcam)* pll1 will never be changed, it is a fixed value */
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c void mmpcam_calc_dphy(struct mcam_camera *mcam) · line 226
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-1-if (IS_ERR (mcam->pll1)) +if (IS_ERR_OR_NULL (mcam->pll1))Why are you changing this? If this really were needed, you should do this already in the previous patch, where you add these lines. But I don't think this is a good idea, don't think Russell would like this :-) NULL is a valid clock. Only a negative error is a failure. In fact, if you like, you could initialise .pll1 to
ERR_PTR(-EINVAL)in your previous patch inmmpcam_probe().
In the below code, we will use platform related clk_get_rate() to get the rate. In the function we do not judge the clk is NULL or not. If we do not judge here, we need judge for NULL in the later, otherwise, error may happen. Or do you think it is better that we should judge the pointer in the function clk_get_rate()?
Quoted 8 lines
Quoted 8 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0return ; tx_clk_esc =clk_get_rate (mcam->pll1) /1000000 /12 ;@@ -229,6 +250,35 @@ static irqreturn_t mmpcam_irq(int irq, void *data)return IRQ_RETVAL (handled); }
Quoted 6 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 254
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0+static void mcam_init_clk (struct mcam_camera *mcam, +struct mmp_camera_platform_data *pdata,int init)I don't think this "int init" makes sense. Please, remove the parameter and you actually don't need the de-initialisation, no reason to set
num_clk= 0 before freeing memory.
Yes, the init parameter is not good here, which make confusion.
The driver de-initiatives the clks because
I want to make sure the driver will never enable the clks after de-initialization. After second consideration based on your suggestion, I will remove de-initialization, because this scenario will never happen.
Quoted 14 lines
Quoted 14 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +13
-0+{ +unsigned int i; + +if (NR_MCAM_CLK < pdata->clk_num) { +dev_err (mcam->dev,"Too many mcam clocks defined\n" ); + mcam->clk_num =0 ; +return ; + } + +if (init) { +for (i =0 ; i < pdata->clk_num; i++) { +if (pdata->clk_name[i] !=NULL ) { + mcam->clk[i] = devm_clk_get(mcam->dev,
Quoted 8 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 268
Quoted 1 line
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-0+ pdata->clk_name[i]);Sorry, no. Passing clock names in platform data doesn't look right to me. Clock names are a property of the consumer device, not of clock supplier. Also, your platform tells you to get
clk_numclocks, you fail to get one of them, you don't continue trying the rest and just return with no error. This seems strange, usually a failure to get clocks, that the platform tells you to get, is fatal.
I agree that after failing to get the clk, we should return error instead of just returning.
For the clock names, the clock names are different on different platforms. So we need platform data passing the clock names. Do you have any suggestions?
Quoted 15 lines
Quoted 15 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +13
-0+if (IS_ERR (mcam->clk[i])) { +dev_err (mcam->dev, +"Could not get clk: %s\n" , + pdata->clk_name[i]); + mcam->clk_num =0 ; +return ; + } + } + } + mcam->clk_num = pdata->clk_num; + }else + mcam->clk_num =0 ; +}
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static irqreturn_t mmpcam_irq(int irq, void *data) · line 284
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0static int mmpcam_probe (struct platform_device *pdev) {Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Regards,
Libin
RE: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driver
Hi Libin
Quoted 58 lines · Libin Yang
Hi Guennadi,
Thanks for your review. Please see my comments below.
Quoted 26 lines
-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: Wednesday, January 02, 2013 12:06 AM
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driverQuoted 16 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the clock tree support for marvell-ccic.
Each board may require different clk enabling sequence. Developer need add the
clk_namein correct sequence in board driver to use this feature.Signed-off-by Libin Yang <[email protected]>Signed-off-by Albert Wang <[email protected]>--- drivers/media/platform/marvell-ccic/mcam-core.h | 4 ++ drivers/media/platform/marvell-ccic/mmp-driver.c | 57 +++++++++++++++++++++- include/media/mmp-camera.h | 5 ++ 3 files changed, 65 insertions(+), 1 deletion(-)[snip]
Quoted 5 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mmp-driver.cQuoted 3 lines
index 603fa0a..2c4dce3 100755
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0[snip]
Quoted 9 lines
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0+ +mcam_clk_set (mcam,0 ); }/* @@ -202,7 +223,7 @@ void mmpcam_calc_dphy(struct mcam_camera *mcam)* pll1 will never be changed, it is a fixed value */ Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c void mmpcam_calc_dphy(struct mcam_camera *mcam) · line 226
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-1-if (IS_ERR (mcam->pll1)) +if (IS_ERR_OR_NULL (mcam->pll1))Why are you changing this? If this really were needed, you should do this already in the previous patch, where you add these lines. But I don't think this is a good idea, don't think Russell would like this :-) NULL is a valid clock. Only a negative error is a failure. In fact, if you like, you could initialise .pll1 to
ERR_PTR(-EINVAL)in your previous patch inmmpcam_probe().
Quoted 4 lines
In the below code, we will use platform related
clk_get_rate()to get the rate. In the function we do not judge the clk is NULL or not. If we do not judge here, we need judge for NULL in the later, otherwise, error may happen. Or do you think it is better that we should judge the pointer in the functionclk_get_rate()?
I think, there is a problem here. Firstly, if you really want to check for "clock API not supported" or a similar type of condition by checking get_clk() return value for NULL, you should do this immediately in the patch, where you add this code: in "[PATCH V3 02/15] [media] marvell-ccic:
add MIPI support for marvell-ccic driver." Secondly, it's probably ok to check this to say - no clock, co reason to try to use it, in which case you skip calculating your ->dphy[2] value, and it remains == 0, presumably, is this what you want to have? But, I think, there's a bigger problem in your patch #02/15: you don't check for mcam->dphy != NULL. So, I think, this has to be fixed in that patch, not here.
[snip]
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +13
-0+{ +unsigned int i; + +if (NR_MCAM_CLK < pdata->clk_num) { +dev_err (mcam->dev,"Too many mcam clocks defined\n" ); + mcam->clk_num =0 ; +return ; + } + +if (init) { +for (i =0 ; i < pdata->clk_num; i++) { +if (pdata->clk_name[i] !=NULL ) { + mcam->clk[i] = devm_clk_get(mcam->dev,Quoted 8 lines
drivers/media/platform/marvell-ccic/mmp-driver.c
Quoted 1 line
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-0+ pdata->clk_name[i]);Sorry, no. Passing clock names in platform data doesn't look right to me. Clock names are a property of the consumer device, not of clock supplier. Also, your platform tells you to get
clk_numclocks, you fail to get one of them, you don't continue trying the rest and just return with no error. This seems strange, usually a failure to get clocks, that the platform tells you to get, is fatal.
Quoted 5 lines
I agree that after failing to get the clk, we should return error instead of just returning.
For the clock names, the clock names are different on different platforms. So we need platform data passing the clock names. Do you have any suggestions?
I think you should use the same names on all platforms. As I said, those are names of _consumer_ clocks, not of supplier. And the consumer on all platforms is the same - your camera unit. If you cannot remove existing clock entries for compatibility reasons you, probably, can just add clock lookup entries for them. In the _very_ worst case, maybe make a table of clock names and, depending on the SoC type use one of them, but that's really also not very apropriate, not sure, whether that would be accepted.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
RE: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driver
Hi Guennadi,
Please see my comments below.
Quoted 16 lines
-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: Friday, January 04, 2013 6:25 PM
To: Libin Yang
Cc: Albert Wang; [email protected]; [email protected]
Subject: RE: [PATCH V3 03/15] [media] marvell-ccic: add clock tree support for marvell-ccic driverHi Libin
Quoted 4 lines · Libin Yang
Hi Guennadi,
Thanks for your review. Please see my comments below.
[snip]
Quoted 20 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
/*
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0@@ -202,7 +223,7 @@ void mmpcam_calc_dphy(struct mcam_camera *mcam)* pll1 will never be changed, it is a fixed value */ Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c void mmpcam_calc_dphy(struct mcam_camera *mcam) · line 226
Quoted 2 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-1-if (IS_ERR (mcam->pll1)) +if (IS_ERR_OR_NULL (mcam->pll1))Why are you changing this? If this really were needed, you should do this already in the previous patch, where you add these lines. But I don't think this is a good idea, don't think Russell would like this :-) NULL is a valid clock. Only a negative error is a failure. In fact, if you like, you could initialise .pll1 to
ERR_PTR(-EINVAL)in your previous patch inmmpcam_probe().Quoted 4 lines
In the below code, we will use platform related
clk_get_rate()to get the rate. In the function we do not judge the clk is NULL or not. If we do not judge here, we need judge for NULL in the later, otherwise, error may happen. Or do you think it is better that we should judge the pointer in the functionclk_get_rate()?
Quoted 10 lines
I think, there is a problem here. Firstly, if you really want to check for "clock API not supported" or a similar type of condition by checking
get_clk()return value for NULL, you should do this immediately in the patch, where you add this code: in "[PATCH V3 02/15] [media] marvell-ccic:
add MIPI support for marvell-ccic driver." Secondly, it's probably ok to check this to say - no clock, co reason to try to use it, in which case you skip calculating your ->dphy[2] value, and it remains == 0, presumably, is this what you want to have? But, I think, there's a bigger problem in your patch #02/15: you don't check formcam->dphy!= NULL. So, I think, this has to be fixed in that patch, not here.
Your understanding is right. We will try to use the default value if the pll1 is not available. So we just return if pll1 is error or NULL. And mostly the default value should work. And this reminds me that there is a little issue:
we should not return fail in the mcam_v4l_open() function when failing to get the pll1 clk because we can also use the default values.
What I plan to code in the next version is:
1. Remove the judgement of (IS_ERR(cam->pll1)) in the open function when get the clk.
2. Still use IS_ERR_OR_NULL(mcam->pll1), so that we can use the default vaule if pll1 is not available.
What do you think of it?
mcam->dphy != NULL may be a critical issue. Thanks for digging out this bug. We will fix it in the next version.
Quoted 31 lines
[snip]
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +13
-0+{ +unsigned int i; + +if (NR_MCAM_CLK < pdata->clk_num) { +dev_err (mcam->dev,"Too many mcam clocks defined\n" ); + mcam->clk_num =0 ; +return ; + } + +if (init) { +for (i =0 ; i < pdata->clk_num; i++) { +if (pdata->clk_name[i] !=NULL ) { + mcam->clk[i] = devm_clk_get(mcam->dev,Quoted 8 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ pdata->clk_name[i]);Sorry, no. Passing clock names in platform data doesn't look right to me. Clock names are a property of the consumer device, not of clock supplier. Also, your platform tells you to get
clk_numclocks, you fail to get one of them, you don't continue trying the rest and just return with no error. This seems strange, usually a failure to get clocks, that the platform tells you to get, is fatal.Quoted 5 lines
I agree that after failing to get the clk, we should return error instead of just returning.
For the clock names, the clock names are different on different platforms. So we need platform data passing the clock names. Do you have any suggestions?
Quoted 7 lines
I think you should use the same names on all platforms. As I said, those are names of _consumer_ clocks, not of supplier. And the consumer on all platforms is the same - your camera unit. If you cannot remove existing clock entries for compatibility reasons you, probably, can just add clock lookup entries for them. In the _very_ worst case, maybe make a table of clock names and, depending on the SoC type use one of them, but that's really also not very apropriate, not sure, whether that would be accepted.
OK, I see. I will use the names directly in the camera driver without getting them from the platform data.
Quoted 7 lines
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Regards,
Libin
PATCH v3 4/15 marvell-ccic: reset ccic phy when stop streaming for stability
In reply to Albert WangFrom: Libin Yang <[email protected]>
This patch adds the reset ccic phy operation when stop streaming.
Without reset ccic phy, the next start streaming may be unstable.
Also need add CCIC2 definition when PXA688/PXA2128 support dual ccics.
--- drivers/media/platform/marvell-ccic/mcam-core.c | 6 ++++++ drivers/media/platform/marvell-ccic/mcam-core.h | 2 ++ drivers/media/platform/marvell-ccic/mmp-driver.c | 25 ++++++++++++++++++++++ 3 files changed, 33 insertions(+)
drivers/media/platform/marvell-ccic/mcam-core.c +6 -0
@@ -1058,6 +1058,12 @@ static int mcam_vb_stop_streaming(struct vb2_queue *vq)return -EINVAL ;mcam_ctlr_stop_dma (cam);/* +* Reset the CCIC PHY after stopping streaming, +* otherwise, the CCIC may be unstable. +*/ +if (cam->ctlr_reset) + cam->ctlr_reset (cam); +/* * VB2 reclaims the buffers, so we need to forget * about them. */
drivers/media/platform/marvell-ccic/mcam-core.h +2 -0
@@ -103,6 +103,7 @@ struct mcam_camera {short int use_smbus;/* SMBUS or straight I2c? */ enum mcam_buffer_mode buffer_mode; +int ccic_id;enum v4l2_mbus_type bus_type;/* MIPI support */ int *dphy;
@@ -120,6 +121,7 @@ struct mcam_camera {void (*plat_power_up) (struct mcam_camera *cam);void (*plat_power_down) (struct mcam_camera *cam);void (*calc_dphy)(struct mcam_camera *cam); +void (*ctlr_reset)(struct mcam_camera *cam);/* * Everything below here is private to the mcam core and
drivers/media/platform/marvell-ccic/mmp-driver.c +25 -0
@@ -103,6 +103,7 @@ static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev)#define CPU_SUBSYS_PMU_BASE 0xd4282800#define REG_CCIC_DCGCR 0x28/* CCIC dyn clock gate ctrl reg */ #define REG_CCIC_CRCR 0x50/* CCIC clk reset ctrl reg */ +#define REG_CCIC2_CRCR 0xf4/* CCIC2 clk reset ctrl reg */ static void mcam_clk_set (struct mcam_camera *mcam,int on) {
@@ -174,6 +175,28 @@ static void mmpcam_power_down(struct mcam_camera *mcam)mcam_clk_set (mcam,0 ); } +void mcam_ctlr_reset (struct mcam_camera *mcam) +{ +unsigned long val; +struct mmp_camera *cam =mcam_to_cam (mcam); + +if (mcam->ccic_id) { +/* +* Using CCIC2 +*/ + val =ioread32 (cam->power_regs +REG_CCIC2_CRCR ); +iowrite32 (val & ~0x2 , cam->power_regs +REG_CCIC2_CRCR ); +iowrite32 (val |0x2 , cam->power_regs +REG_CCIC2_CRCR ); + }else { +/* +* Using CCIC1 +*/ + val =ioread32 (cam->power_regs +REG_CCIC_CRCR ); +iowrite32 (val & ~0x2 , cam->power_regs +REG_CCIC_CRCR ); +iowrite32 (val |0x2 , cam->power_regs +REG_CCIC_CRCR ); + } +} +/* * calc the dphy register values * There are three dphy registers being used.
@@ -301,10 +324,12 @@ static int mmpcam_probe(struct platform_device *pdev) mcam = &cam->mcam; mcam->plat_power_up = mmpcam_power_up; mcam->plat_power_down = mmpcam_power_down; + mcam->ctlr_reset = mcam_ctlr_reset; mcam->calc_dphy = mmpcam_calc_dphy; mcam->pll1 =NULL ; mcam->dev = &pdev->dev; mcam->use_smbus =0 ; + mcam->ccic_id = pdev->id; mcam->bus_type = pdata->bus_type; mcam->dphy = pdata->dphy; mcam->mipi_enabled =0 ;
Signature · 1 line
1.7.9.5
Re: [PATCH V3 04/15] [media] marvell-ccic: reset ccic phy when stop streaming for stability
Quoted 8 lines · On Sat, 15 Dec 2012 17:57:53 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch adds the reset ccic phy operation when stop streaming.
Without reset ccic phy, the next start streaming may be unstable.
Also need add CCIC2 definition when PXA688/PXA2128 support dual ccics.
As with all of these, I've not been able to test it, but it looks OK to me.
jon
Re: [PATCH V3 04/15] [media] marvell-ccic: reset ccic phy when stop streaming for stability
In reply to Albert WangQuoted 10 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the reset ccic phy operation when stop streaming.
Without reset ccic phy, the next start streaming may be unstable.
Also need add CCIC2 definition when PXA688/PXA2128 support dual ccics.
Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>
Thanks
Guennadi
Quoted 100 lines
--- drivers/media/platform/marvell-ccic/mcam-core.c | 6 ++++++ drivers/media/platform/marvell-ccic/mcam-core.h | 2 ++ drivers/media/platform/marvell-ccic/mmp-driver.c | 25 ++++++++++++++++++++++ 3 files changed, 33 insertions(+)drivers/media/platform/marvell-ccic/mcam-core.c +6
-0@@ -1058,6 +1058,12 @@ static int mcam_vb_stop_streaming(struct vb2_queue *vq)return -EINVAL ;mcam_ctlr_stop_dma (cam);/* +* Reset the CCIC PHY after stopping streaming, +* otherwise, the CCIC may be unstable. +*/ +if (cam->ctlr_reset) + cam->ctlr_reset (cam); +/* * VB2 reclaims the buffers, so we need to forget * about them. */ drivers/media/platform/marvell-ccic/mcam-core.h +2
-0@@ -103,6 +103,7 @@ struct mcam_camera {short int use_smbus;/* SMBUS or straight I2c? */ enum mcam_buffer_mode buffer_mode; +int ccic_id;enum v4l2_mbus_type bus_type;/* MIPI support */ int *dphy;@@ -120,6 +121,7 @@ struct mcam_camera {void (*plat_power_up) (struct mcam_camera *cam);void (*plat_power_down) (struct mcam_camera *cam);void (*calc_dphy)(struct mcam_camera *cam); +void (*ctlr_reset)(struct mcam_camera *cam);/* * Everything below here is private to the mcam core and drivers/media/platform/marvell-ccic/mmp-driver.c +25
-0@@ -103,6 +103,7 @@ static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev)#define CPU_SUBSYS_PMU_BASE 0xd4282800#define REG_CCIC_DCGCR 0x28/* CCIC dyn clock gate ctrl reg */ #define REG_CCIC_CRCR 0x50/* CCIC clk reset ctrl reg */ +#define REG_CCIC2_CRCR 0xf4/* CCIC2 clk reset ctrl reg */ static void mcam_clk_set (struct mcam_camera *mcam,int on) {@@ -174,6 +175,28 @@ static void mmpcam_power_down(struct mcam_camera *mcam)mcam_clk_set (mcam,0 ); } +void mcam_ctlr_reset (struct mcam_camera *mcam) +{ +unsigned long val; +struct mmp_camera *cam =mcam_to_cam (mcam); + +if (mcam->ccic_id) { +/* +* Using CCIC2 +*/ + val =ioread32 (cam->power_regs +REG_CCIC2_CRCR ); +iowrite32 (val & ~0x2 , cam->power_regs +REG_CCIC2_CRCR ); +iowrite32 (val |0x2 , cam->power_regs +REG_CCIC2_CRCR ); + }else { +/* +* Using CCIC1 +*/ + val =ioread32 (cam->power_regs +REG_CCIC_CRCR ); +iowrite32 (val & ~0x2 , cam->power_regs +REG_CCIC_CRCR ); +iowrite32 (val |0x2 , cam->power_regs +REG_CCIC_CRCR ); + } +} +/* * calc the dphy register values * There are three dphy registers being used. @@ -301,10 +324,12 @@ static int mmpcam_probe(struct platform_device *pdev) mcam = &cam->mcam; mcam->plat_power_up = mmpcam_power_up; mcam->plat_power_down = mmpcam_power_down; + mcam->ctlr_reset = mcam_ctlr_reset; mcam->calc_dphy = mmpcam_calc_dphy; mcam->pll1 =NULL ; mcam->dev = &pdev->dev; mcam->use_smbus =0 ; + mcam->ccic_id = pdev->id; mcam->bus_type = pdata->bus_type; mcam->dphy = pdata->dphy; mcam->mipi_enabled =0 ;Signature · 1 line
1.7.9.5
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
PATCH v3 5/15 marvell-ccic: refine mcam_set_contig_buffer function
In reply to Albert WangFrom: Libin Yang <[email protected]>
This patch refines mcam_set_contig_buffer() in mcam core
--- drivers/media/platform/marvell-ccic/mcam-core.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core.c +10 -11
@@ -486,22 +486,21 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)*/ if (list_empty (&cam->buffers)) { buf = cam->vb_bufs[frame ^0x1 ]; - cam->vb_bufs[frame] = buf; -mcam_reg_write (cam, frame ==0 ?REG_Y0BAR :REG_Y1BAR , -vb2_dma_contig_plane_dma_addr (&buf->vb_buf,0 ));set_bit (CF_SINGLE_BUFFER , &cam->flags); cam->frame_state.singles++; -return ; + }else { +/* +* OK, we have a buffer we can use. +*/ + buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, + queue); +list_del_init (&buf->queue); +clear_bit (CF_SINGLE_BUFFER , &cam->flags); } -/* -* OK, we have a buffer we can use. -*/ - buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, queue); -list_del_init (&buf->queue); + + cam->vb_bufs[frame] = buf;mcam_reg_write (cam, frame ==0 ?REG_Y0BAR :REG_Y1BAR ,vb2_dma_contig_plane_dma_addr (&buf->vb_buf,0 )); - cam->vb_bufs[frame] = buf; -clear_bit (CF_SINGLE_BUFFER , &cam->flags); }/*
Signature · 1 line
1.7.9.5
Re: [PATCH V3 05/15] [media] marvell-ccic: refine mcam_set_contig_buffer function
Quoted 3 lines · On Sat, 15 Dec 2012 17:57:54 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch refines
mcam_set_contig_buffer()in mcam core
It might be nice if the changelog said *why* this was being done - don't worry about insulting my ugly code :) But no biggie...
jon
RE: [PATCH V3 05/15] [media] marvell-ccic: refine mcam_set_contig_buffer function
Hi, Jonathan
Quoted 8 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:07
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 05/15] [media] marvell-ccic: refinemcam_set_contig_bufferfunction
Quoted 8 lines
Quoted 3 lines · On Sat, 15 Dec 2012 17:57:54 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch refines
mcam_set_contig_buffer()in mcam coreIt might be nice if the changelog said *why* this was being done -
[Albert Wang] We just want to reduce some redundancy code. :)
Quoted 5 lines
don't worry about insulting my ugly code :) But no biggie...
Acked-by Jonathan Corbet <[email protected]>jon
Thanks
Albert Wang
86-21-61092656
PATCH v3 6/15 marvell-ccic: add new formats support for marvell-ccic driver
In reply to Albert WangFrom: Libin Yang <[email protected]>
This patch adds the new formats support for marvell-ccic.
--- drivers/media/platform/marvell-ccic/mcam-core.c | 175 ++++++++++++++++++----- drivers/media/platform/marvell-ccic/mcam-core.h | 6 + 2 files changed, 149 insertions(+), 32 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core.c +143 -32
@@ -111,6 +111,30 @@ static struct mcam_format_struct { .bpp = 2, }, { + .desc = "UYVY 4:2:2", + .pixelformat = V4L2_PIX_FMT_UYVY, + .mbus_code = V4L2_MBUS_FMT_UYVY8_2X8, + .bpp = 2, + }, + { + .desc = "YUV 4:2:2 PLANAR", + .pixelformat = V4L2_PIX_FMT_YUV422P, + .mbus_code = V4L2_MBUS_FMT_UYVY8_2X8, + .bpp = 2, + }, + { + .desc = "YUV 4:2:0 PLANAR", + .pixelformat = V4L2_PIX_FMT_YUV420, + .mbus_code = V4L2_MBUS_FMT_YUYV8_1_5X8, + .bpp = 2, + }, + { + .desc = "YVU 4:2:0 PLANAR", + .pixelformat = V4L2_PIX_FMT_YVU420, + .mbus_code = V4L2_MBUS_FMT_YVYU8_1_5X8, + .bpp = 2, + }, + { .desc = "RGB 444", .pixelformat = V4L2_PIX_FMT_RGB444, .mbus_code = V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE,
@@ -169,6 +193,12 @@ struct mcam_dma_desc {u32 segment_len; }; +struct yuv_pointer_t { +dma_addr_t y; +dma_addr_t u; +dma_addr_t v; +}; +/* * Our buffer type for working with videobuf2. Note that the vb2 * developers have decreed that struct vb2_buffer must be at the
@@ -180,6 +210,7 @@ struct mcam_vb_buffer {struct mcam_dma_desc *dma_desc;/* Descriptor virtual address */ dma_addr_t dma_desc_pa;/* Descriptor physical address */ int dma_desc_nent;/* Number of mapped descriptors */ +struct yuv_pointer_t yuv_p; };static inline struct mcam_vb_buffer *vb_to_mvb (struct vb2_buffer *vb)
@@ -470,6 +501,18 @@ static inline int mcam_check_dma_buffers(struct mcam_camera *cam)/* * DMA-contiguous code. */ + +static bool mcam_fmt_is_planar (__u32 pfmt) +{ +switch (pfmt) { +case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : +return true; + } +return false; +} +/* * Set up a contiguous buffer for the given frame. Here also is where * the underrun strategy is set: if there is no buffer available, reuse
@@ -481,6 +524,8 @@ static inline int mcam_check_dma_buffers(struct mcam_camera *cam)static void mcam_set_contig_buffer (struct mcam_camera *cam,int frame) {struct mcam_vb_buffer *buf; +struct v4l2_pix_format *fmt = &cam->pix_format; +/* * If there are no available buffers, go into single mode */
@@ -499,8 +544,13 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame) } cam->vb_bufs[frame] = buf; -mcam_reg_write (cam, frame ==0 ?REG_Y0BAR :REG_Y1BAR , -vb2_dma_contig_plane_dma_addr (&buf->vb_buf,0 )); +mcam_reg_write (cam, frame ==0 ?REG_Y0BAR :REG_Y1BAR , buf->yuv_p.y); +if (mcam_fmt_is_planar (fmt->pixelformat)) { +mcam_reg_write (cam, frame ==0 ? +REG_U0BAR :REG_U1BAR , buf->yuv_p.u); +mcam_reg_write (cam, frame ==0 ? +REG_V0BAR :REG_V1BAR , buf->yuv_p.v); + } }/*
@@ -658,49 +708,85 @@ static inline void mcam_sg_restart(struct mcam_camera *cam)*/ static void mcam_ctlr_image (struct mcam_camera *cam) { -int imgsz;struct v4l2_pix_format *fmt = &cam->pix_format; +u32 widthy =0 , widthuv =0 , imgsz_h, imgsz_w; + +cam_dbg (cam,"camera: bytesperline = %d; height = %d\n" , + fmt->bytesperline, fmt->sizeimage / fmt->bytesperline); + imgsz_h = (fmt->height <<IMGSZ_V_SHIFT ) &IMGSZ_V_MASK ; + imgsz_w = fmt->bytesperline &IMGSZ_H_MASK ; + +switch (fmt->pixelformat) { +case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_UYVY : + widthy = fmt->width *2 ; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_JPEG : + imgsz_h = (fmt->sizeimage / fmt->bytesperline) <<IMGSZ_V_SHIFT ; + widthy = fmt->bytesperline; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : + imgsz_w = (fmt->bytesperline *4 /3 ) &IMGSZ_H_MASK ; + widthy = fmt->width; + widthuv = fmt->width /2 ; +break ; +default : + widthy = fmt->bytesperline; + widthuv =0 ; + } + +mcam_reg_write_mask (cam,REG_IMGPITCH , widthuv <<16 | widthy, +IMGP_YP_MASK |IMGP_UVP_MASK ); +mcam_reg_write (cam,REG_IMGSIZE , imgsz_h | imgsz_w); +mcam_reg_write (cam,REG_IMGOFFSET ,0x0 ); - imgsz = ((fmt->height <<IMGSZ_V_SHIFT ) &IMGSZ_V_MASK ) | - (fmt->bytesperline &IMGSZ_H_MASK ); -mcam_reg_write (cam,REG_IMGSIZE , imgsz); -mcam_reg_write (cam,REG_IMGOFFSET ,0 ); -/* YPITCH just drops the last two bits */ -mcam_reg_write_mask (cam,REG_IMGPITCH , fmt->bytesperline, -IMGP_YP_MASK );/* * Tell the controller about the image format we are using. */ -switch (cam->pix_format.pixelformat) { +switch (fmt->pixelformat) { +case V4L2_PIX_FMT_YUV422P : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PLANAR |C0_YUVE_YVYU ,C0_DF_MASK ); +break ; +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_420PL |C0_YUVE_YVYU ,C0_DF_MASK ); +break ;case V4L2_PIX_FMT_YUYV : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV , -C0_DF_MASK ); -break ; - +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_UYVY ,C0_DF_MASK ); +break ; +case V4L2_PIX_FMT_UYVY : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV ,C0_DF_MASK ); +break ; +case V4L2_PIX_FMT_JPEG : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV ,C0_DF_MASK ); +break ;case V4L2_PIX_FMT_RGB444 : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_RGB |C0_RGBF_444 |C0_RGB4_XRGB , -C0_DF_MASK ); +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_RGB |C0_RGBF_444 |C0_RGB4_XRGB ,C0_DF_MASK );/* Alpha value? */ -break ; - +break ;case V4L2_PIX_FMT_RGB565 : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_RGB |C0_RGBF_565 |C0_RGB5_BGGR , -C0_DF_MASK ); -break ; - +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_RGB |C0_RGBF_565 |C0_RGB5_BGGR ,C0_DF_MASK ); +break ;default : -cam_err (cam,"Unknown format %x\n" , cam->pix_format.pixelformat); -break ; +cam_err (cam,"camera: unknown format: %#x\n" , fmt->pixelformat); +break ; } +/* * Make sure it knows we want to use hsync/vsync. */ -mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC , -C0_SIFM_MASK ); - +mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC ,C0_SIFM_MASK );/* * This field controls the generation of EOF(DVP only) */
@@ -711,7 +797,6 @@ static void mcam_ctlr_image(struct mcam_camera *cam) } } -/* * Configure the controller for operation; caller holds the * device mutex.
@@ -984,11 +1069,37 @@ static void mcam_vb_buf_queue(struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb);struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct v4l2_pix_format *fmt = &cam->pix_format;unsigned long flags;int start; +dma_addr_t dma_handle; +u32 pixel_count = fmt->width * fmt->height;spin_lock_irqsave (&cam->dev_lock, flags); + dma_handle =vb2_dma_contig_plane_dma_addr (vb,0 ); +BUG_ON (!dma_handle); start = (cam->state ==S_BUFWAIT ) && !list_empty (&cam->buffers); + +switch (cam->pix_format.pixelformat) { +case V4L2_PIX_FMT_YUV422P : + mvb->yuv_p.y = dma_handle; + mvb->yuv_p.u = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.v = mvb->yuv_p.u + pixel_count /2 ; +break ; +case V4L2_PIX_FMT_YUV420 : + mvb->yuv_p.y = dma_handle; + mvb->yuv_p.u = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.v = mvb->yuv_p.u + pixel_count /4 ; +break ; +case V4L2_PIX_FMT_YVU420 : + mvb->yuv_p.y = dma_handle; + mvb->yuv_p.v = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.u = mvb->yuv_p.v + pixel_count /4 ; +break ; +default : + mvb->yuv_p.y = dma_handle; + } +list_add (&mvb->queue, &cam->buffers);if (cam->state ==S_STREAMING &&test_bit (CF_SG_RESTART , &cam->flags))mcam_sg_restart (cam);
drivers/media/platform/marvell-ccic/mcam-core.h +6 -0
@@ -234,6 +234,12 @@ int mccic_resume(struct mcam_camera *cam);#define REG_Y0BAR 0x00#define REG_Y1BAR 0x04#define REG_Y2BAR 0x08 +#define REG_U0BAR 0x0c +#define REG_U1BAR 0x10 +#define REG_U2BAR 0x14 +#define REG_V0BAR 0x18 +#define REG_V1BAR 0x1C +#define REG_V2BAR 0x20/* * register definitions for MIPI support
Signature · 1 line
1.7.9.5
Re: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driver
Quoted 3 lines · On Sat, 15 Dec 2012 17:57:55 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch adds the new formats support for marvell-ccic.
Once again, just one second-order comment:
drivers/media/platform/marvell-ccic/mcam-core.c static inline int mcam_check_dma_buffers(struct mcam_camera *cam) · line 514
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-0+static bool mcam_fmt_is_planar (__u32 pfmt) +{ +switch (pfmt) { +case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : +return true; + } +return false; +}
This seems like the kind of thing that would be useful in a number of places; I'd be tempted to push it up a level and make it available to all V4L2 drivers. Of course, that means making it work for *all* formats, which would be a pain.
But, then, I can see some potential future pain if somebody adds a new format and forgets to tweak this function here. Rather than adding a new switch, could you put a "planar" flag into struct mcam_format_struct instead? That would help to keep all this information together.
jon
RE: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driver
Hi, Jonathan
Quoted 33 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:17
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driverQuoted 3 lines · On Sat, 15 Dec 2012 17:57:55 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch adds the new formats support for marvell-ccic.
Once again, just one second-order comment:
drivers/media/platform/marvell-ccic/mcam-core.c static inline int mcam_check_dma_buffers(struct mcam_camera *cam) · line 514
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-0+static bool mcam_fmt_is_planar (__u32 pfmt) +{ +switch (pfmt) { +case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : +return true; + } +return false; +}This seems like the kind of thing that would be useful in a number of places; I'd be tempted to push it up a level and make it available to all V4L2 drivers. Of course, that means making it work for *all* formats, which would be a pain.
Quoted 5 lines
But, then, I can see some potential future pain if somebody adds a new format and forgets to tweak this function here. Rather than adding a new switch, could you put a "planar" flag into struct
mcam_format_structinstead? That would help to keep all this information together.
[Albert Wang] Yes, it looks make sense, we will think about it in next version.
Quoted 1 line
jon
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driver
In reply to Albert WangQuoted 15 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the new formats support for marvell-ccic.
Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>--- drivers/media/platform/marvell-ccic/mcam-core.c | 175 ++++++++++++++++++----- drivers/media/platform/marvell-ccic/mcam-core.h | 6 + 2 files changed, 149 insertions(+), 32 deletions(-)drivers/media/platform/marvell-ccic/mcam-core.c +0
-0
[snip]
Quoted 20 lines
drivers/media/platform/marvell-ccic/mcam-core.c +14
-1@@ -658,49 +708,85 @@ static inline void mcam_sg_restart(struct mcam_camera *cam)*/ static void mcam_ctlr_image (struct mcam_camera *cam) { -int imgsz;struct v4l2_pix_format *fmt = &cam->pix_format; +u32 widthy =0 , widthuv =0 , imgsz_h, imgsz_w; + +cam_dbg (cam,"camera: bytesperline = %d; height = %d\n" , + fmt->bytesperline, fmt->sizeimage / fmt->bytesperline); + imgsz_h = (fmt->height <<IMGSZ_V_SHIFT ) &IMGSZ_V_MASK ; + imgsz_w = fmt->bytesperline &IMGSZ_H_MASK ; + +switch (fmt->pixelformat) { +case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_UYVY : + widthy = fmt->width *2 ; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_JPEG :
drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam) · line 735
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-0+ imgsz_h = (fmt->sizeimage / fmt->bytesperline) <<IMGSZ_V_SHIFT ; + widthy = fmt->bytesperline; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : + imgsz_w = (fmt->bytesperline *4 /3 ) &IMGSZ_H_MASK ; + widthy = fmt->width; + widthuv = fmt->width /2 ;
I might be wrong, but the above doesn't look right to me. Firstly, YUV422P is a 4:2:2 format, whereas YUV420 and YVU420 are 4:2:0 formats, so, I would expect calculations for them to differ. Besides, bytesperline * 4 / 3 doesn't look right for any of them. If this is what I think - total number of bytes per line, i.e., sizeimage / height, than shouldn't YAU422P have
+ imgsz_w = fmt->bytesperline & IMGSZ_H_MASK;
and the other two
+ imgsz_w = (fmt->bytesperline * 3 / 2) & IMGSZ_H_MASK;
? But maybe I'm wrong, please, double-check and confirm.
Quoted 101 lines
drivers/media/platform/marvell-ccic/mcam-core.c +43
-29+break ; +default : + widthy = fmt->bytesperline; + widthuv =0 ; + } + +mcam_reg_write_mask (cam,REG_IMGPITCH , widthuv <<16 | widthy, +IMGP_YP_MASK |IMGP_UVP_MASK ); +mcam_reg_write (cam,REG_IMGSIZE , imgsz_h | imgsz_w); +mcam_reg_write (cam,REG_IMGOFFSET ,0x0 ); - imgsz = ((fmt->height <<IMGSZ_V_SHIFT ) &IMGSZ_V_MASK ) | - (fmt->bytesperline &IMGSZ_H_MASK ); -mcam_reg_write (cam,REG_IMGSIZE , imgsz); -mcam_reg_write (cam,REG_IMGOFFSET ,0 ); -/* YPITCH just drops the last two bits */ -mcam_reg_write_mask (cam,REG_IMGPITCH , fmt->bytesperline, -IMGP_YP_MASK );/* * Tell the controller about the image format we are using. */ -switch (cam->pix_format.pixelformat) { +switch (fmt->pixelformat) { +case V4L2_PIX_FMT_YUV422P : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PLANAR |C0_YUVE_YVYU ,C0_DF_MASK ); +break ; +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_420PL |C0_YUVE_YVYU ,C0_DF_MASK ); +break ;case V4L2_PIX_FMT_YUYV : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV , -C0_DF_MASK ); -break ; - +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_UYVY ,C0_DF_MASK ); +break ; +case V4L2_PIX_FMT_UYVY : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV ,C0_DF_MASK ); +break ; +case V4L2_PIX_FMT_JPEG : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV ,C0_DF_MASK ); +break ;case V4L2_PIX_FMT_RGB444 : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_RGB |C0_RGBF_444 |C0_RGB4_XRGB , -C0_DF_MASK ); +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_RGB |C0_RGBF_444 |C0_RGB4_XRGB ,C0_DF_MASK );/* Alpha value? */ -break ; - +break ;case V4L2_PIX_FMT_RGB565 : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_RGB |C0_RGBF_565 |C0_RGB5_BGGR , -C0_DF_MASK ); -break ; - +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_RGB |C0_RGBF_565 |C0_RGB5_BGGR ,C0_DF_MASK ); +break ;default : -cam_err (cam,"Unknown format %x\n" , cam->pix_format.pixelformat); -break ; +cam_err (cam,"camera: unknown format: %#x\n" , fmt->pixelformat); +break ; } +/* * Make sure it knows we want to use hsync/vsync. */ -mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC , -C0_SIFM_MASK ); - +mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC ,C0_SIFM_MASK );/* * This field controls the generation of EOF(DVP only) */ @@ -711,7 +797,6 @@ static void mcam_ctlr_image(struct mcam_camera *cam) } } -/* * Configure the controller for operation; caller holds the * device mutex. @@ -984,11 +1069,37 @@ static void mcam_vb_buf_queue(struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb);struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct v4l2_pix_format *fmt = &cam->pix_format;unsigned long flags;int start; +dma_addr_t dma_handle;
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_vb_buf_queue(struct vb2_buffer *vb) · line 1085
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +7
-0+u32 pixel_count = fmt->width * fmt->height;spin_lock_irqsave (&cam->dev_lock, flags); + dma_handle =vb2_dma_contig_plane_dma_addr (vb,0 ); +BUG_ON (!dma_handle); start = (cam->state ==S_BUFWAIT ) && !list_empty (&cam->buffers); + +switch (cam->pix_format.pixelformat) { +case V4L2_PIX_FMT_YUV422P : + mvb->yuv_p.y = dma_handle;
The above line is common for all cases, perhaps just put it above switch?
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-0+ mvb->yuv_p.u = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.v = mvb->yuv_p.u + pixel_count /2 ; +break ; +case V4L2_PIX_FMT_YUV420 : + mvb->yuv_p.y = dma_handle; + mvb->yuv_p.u = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.v = mvb->yuv_p.u + pixel_count /4 ; +break ; +case V4L2_PIX_FMT_YVU420 : + mvb->yuv_p.y = dma_handle;
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_vb_buf_queue(struct vb2_buffer *vb) · line 1105
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +7
-0+ mvb->yuv_p.v = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.u = mvb->yuv_p.v + pixel_count /4 ; +break ; +default : + mvb->yuv_p.y = dma_handle; + } +list_add (&mvb->queue, &cam->buffers);if (cam->state ==S_STREAMING &&test_bit (CF_SG_RESTART , &cam->flags))mcam_sg_restart (cam);
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
RE: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driver
Hi, Guennadi
Quoted 70 lines
-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: Wednesday, 02 January, 2013 00:56
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driverQuoted 4 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the new formats support for marvell-ccic.
Review
Quoted 8 lines
Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>--- drivers/media/platform/marvell-ccic/mcam-core.c | 175 ++++++++++++++++++----- drivers/media/platform/marvell-ccic/mcam-core.h | 6 + 2 files changed, 149 insertions(+), 32 deletions(-)(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mcam-core.cQuoted 3 lines
index 3cc1d0c..a679917 100755
drivers/media/platform/marvell-ccic/mcam-core.c +0
-0[snip]
drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera
Quoted 1 line
drivers/media/platform/marvell-ccic/mcam-core.c +0
-0@@ -658,49 +708,85 @@ static inline void mcam_sg_restart(struct mcam_camera*cam)
Quoted 19 lines
drivers/media/platform/marvell-ccic/mcam-core.c +14
-1*/ static void mcam_ctlr_image (struct mcam_camera *cam) { -int imgsz;struct v4l2_pix_format *fmt = &cam->pix_format; +u32 widthy =0 , widthuv =0 , imgsz_h, imgsz_w; + +cam_dbg (cam,"camera: bytesperline = %d; height = %d\n" , + fmt->bytesperline, fmt->sizeimage / fmt->bytesperline); + imgsz_h = (fmt->height <<IMGSZ_V_SHIFT ) &IMGSZ_V_MASK ; + imgsz_w = fmt->bytesperline &IMGSZ_H_MASK ; + +switch (fmt->pixelformat) { +case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_UYVY : + widthy = fmt->width *2 ; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_JPEG :drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam) · line 735
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-0+ imgsz_h = (fmt->sizeimage / fmt->bytesperline) <<IMGSZ_V_SHIFT ; + widthy = fmt->bytesperline; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : + imgsz_w = (fmt->bytesperline *4 /3 ) &IMGSZ_H_MASK ; + widthy = fmt->width; + widthuv = fmt->width /2 ;I might be wrong, but the above doesn't look right to me. Firstly, YUV422P is a 4:2:2 format, whereas YUV420 and YVU420 are 4:2:0 formats, so, I would expect calculations for them to differ. Besides, bytesperline * 4 / 3 doesn't look right for any of them. If this is what I think - total number of bytes per line, i.e., sizeimage / height, than shouldn't YAU422P have
drivers/media/platform/marvell-ccic/mcam-core.c +1
-0+ imgsz_w = fmt->bytesperline &IMGSZ_H_MASK ;and the other two
(quoted diff) +1
-0+ imgsz_w = (fmt->bytesperline * 3 / 2) & IMGSZ_H_MASK;
Quoted 2 lines
? But maybe I'm wrong, please, double-check and confirm.
[Albert Wang] It looks they are both 12 bit planar format, they have same imgsz_w. Anyway, we will double check it after back to office.
Quoted 110 lines
Quoted 16 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-5+break ; +default : + widthy = fmt->bytesperline; + widthuv =0 ; + } + +mcam_reg_write_mask (cam,REG_IMGPITCH , widthuv <<16 | widthy, +IMGP_YP_MASK |IMGP_UVP_MASK ); +mcam_reg_write (cam,REG_IMGSIZE , imgsz_h | imgsz_w); +mcam_reg_write (cam,REG_IMGOFFSET ,0x0 ); - imgsz = ((fmt->height <<IMGSZ_V_SHIFT ) &IMGSZ_V_MASK ) | - (fmt->bytesperline &IMGSZ_H_MASK ); -mcam_reg_write (cam,REG_IMGSIZE , imgsz); -mcam_reg_write (cam,REG_IMGOFFSET ,0 ); -/* YPITCH just drops the last two bits */ drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam)
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +4
-3-mcam_reg_write_mask (cam,REG_IMGPITCH , fmt->bytesperline, -IMGP_YP_MASK );/* * Tell the controller about the image format we are using. */ -switch (cam->pix_format.pixelformat) { +switch (fmt->pixelformat) { +case V4L2_PIX_FMT_YUV422P : + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_YUV | C0_YUV_PLANAR | C0_YUVE_YVYU,
C0_DF_MASK);drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam)
Quoted 5 lines
drivers/media/platform/marvell-ccic/mcam-core.c +5
-0+break ; +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_YUV | C0_YUV_420PL | C0_YUVE_YVYU,
C0_DF_MASK);drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam)
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.c +3
-5+break ;case V4L2_PIX_FMT_YUYV : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV , -C0_DF_MASK ); -break ; - + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_YUV | C0_YUV_PACKED | C0_YUVE_UYVY,
C0_DF_MASK);drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam)
Quoted 4 lines
drivers/media/platform/marvell-ccic/mcam-core.c +4
-0+break ; +case V4L2_PIX_FMT_UYVY : + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_YUV | C0_YUV_PACKED | C0_YUVE_YUYV,
C0_DF_MASK);drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam)
Quoted 4 lines
drivers/media/platform/marvell-ccic/mcam-core.c +4
-0+break ; +case V4L2_PIX_FMT_JPEG : + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_YUV | C0_YUV_PACKED | C0_YUVE_YUYV,
C0_DF_MASK);drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam)
Quoted 7 lines
drivers/media/platform/marvell-ccic/mcam-core.c +3
-3+break ;case V4L2_PIX_FMT_RGB444 : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_RGB |C0_RGBF_444 |C0_RGB4_XRGB , -C0_DF_MASK ); + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_RGB | C0_RGBF_444 | C0_RGB4_XRGB,
C0_DF_MASK);drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam)
Quoted 12 lines
drivers/media/platform/marvell-ccic/mcam-core.c +3
-7/* Alpha value? */ -break ; - +break ;case V4L2_PIX_FMT_RGB565 : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_RGB |C0_RGBF_565 |C0_RGB5_BGGR , -C0_DF_MASK ); -break ; - + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_RGB | C0_RGBF_565 | C0_RGB5_BGGR,
C0_DF_MASK);Quoted 36 lines
drivers/media/platform/marvell-ccic/mcam-core.c +8
-6+break ;default : -cam_err (cam,"Unknown format %x\n" , cam->pix_format.pixelformat); -break ; +cam_err (cam,"camera: unknown format: %#x\n" , fmt->pixelformat); +break ; } +/* * Make sure it knows we want to use hsync/vsync. */ -mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC , -C0_SIFM_MASK ); - +mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC ,C0_SIFM_MASK );/* * This field controls the generation of EOF(DVP only) */ @@ -711,7 +797,6 @@ static void mcam_ctlr_image(struct mcam_camera *cam) } } -/* * Configure the controller for operation; caller holds the * device mutex. @@ -984,11 +1069,37 @@ static void mcam_vb_buf_queue(struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb);struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct v4l2_pix_format *fmt = &cam->pix_format;unsigned long flags;int start; +dma_addr_t dma_handle; +u32 pixel_count = fmt->width * fmt->height;
Quoted 11 lines
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_vb_buf_queue(struct vb2_buffer *vb) · line 1085
Quoted 8 lines
drivers/media/platform/marvell-ccic/mcam-core.c +6
-0spin_lock_irqsave (&cam->dev_lock, flags); + dma_handle =vb2_dma_contig_plane_dma_addr (vb,0 ); +BUG_ON (!dma_handle); start = (cam->state ==S_BUFWAIT ) && !list_empty (&cam->buffers); + +switch (cam->pix_format.pixelformat) { +case V4L2_PIX_FMT_YUV422P : + mvb->yuv_p.y = dma_handle;The above line is common for all cases, perhaps just put it above switch?
[Albert Wang] OK, we can do that in next version.
Quoted 19 lines
Quoted 19 lines
drivers/media/platform/marvell-ccic/mcam-core.c +17
-0+ mvb->yuv_p.u = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.v = mvb->yuv_p.u + pixel_count /2 ; +break ; +case V4L2_PIX_FMT_YUV420 : + mvb->yuv_p.y = dma_handle; + mvb->yuv_p.u = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.v = mvb->yuv_p.u + pixel_count /4 ; +break ; +case V4L2_PIX_FMT_YVU420 : + mvb->yuv_p.y = dma_handle; + mvb->yuv_p.v = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.u = mvb->yuv_p.v + pixel_count /4 ; +break ; +default : + mvb->yuv_p.y = dma_handle; + } +list_add (&mvb->queue, &cam->buffers);if (cam->state ==S_STREAMING &&test_bit (CF_SG_RESTART , &cam->flags))
Quoted 8 lines
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_vb_buf_queue(struct vb2_buffer *vb) · line 1105
Quoted 1 line
drivers/media/platform/marvell-ccic/mcam-core.c +0
-0mcam_sg_restart (cam);Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Thanks
Albert Wang
86-21-61092656
RE: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driver
Hi Albert
Quoted 12 lines · Albert Wang
Quoted 12 lines
drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam) · line 735
Quoted 6 lines
drivers/media/platform/marvell-ccic/mcam-core.c +6
-0+case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : + imgsz_w = (fmt->bytesperline *4 /3 ) &IMGSZ_H_MASK ; + widthy = fmt->width; + widthuv = fmt->width /2 ;I might be wrong, but the above doesn't look right to me. Firstly, YUV422P is a 4:2:2 format, whereas YUV420 and YVU420 are 4:2:0 formats, so, I would expect calculations for them to differ. Besides, bytesperline * 4 / 3 doesn't look right for any of them. If this is what I think - total number of bytes per line, i.e., sizeimage / height, than shouldn't YAU422P
Quoted 8 lines
Quoted 6 lines
have
drivers/media/platform/marvell-ccic/mcam-core.c +1
-0+ imgsz_w = fmt->bytesperline &IMGSZ_H_MASK ;and the other two
(quoted diff) +1
-0+ imgsz_w = (fmt->bytesperline * 3 / 2) & IMGSZ_H_MASK;? But maybe I'm wrong, please, double-check and confirm.
[Albert Wang] It looks they are both 12 bit planar format, they have same
imgsz_w. Anyway, we will double check it after back to office.
_Both_ YUV420 and YVU420 - yes, but YUV422P is 16-bit.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
RE: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driver
In reply to Guennadi LiakhovetskiHi Guennadi,
Please see my comments below.
Quoted 69 lines
-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: Wednesday, January 02, 2013 12:56 AM
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driverQuoted 4 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the new formats support for marvell-ccic.
Review
Quoted 8 lines
Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>--- drivers/media/platform/marvell-ccic/mcam-core.c | 175 ++++++++++++++++++----- drivers/media/platform/marvell-ccic/mcam-core.h | 6 + 2 files changed, 149 insertions(+), 32 deletions(-)(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mcam-core.cQuoted 3 lines
index 3cc1d0c..a679917 100755
drivers/media/platform/marvell-ccic/mcam-core.c +0
-0[snip]
Quoted 20 lines
drivers/media/platform/marvell-ccic/mcam-core.c +14
-1@@ -658,49 +708,85 @@ static inline void mcam_sg_restart(struct mcam_camera *cam)*/ static void mcam_ctlr_image (struct mcam_camera *cam) { -int imgsz;struct v4l2_pix_format *fmt = &cam->pix_format; +u32 widthy =0 , widthuv =0 , imgsz_h, imgsz_w; + +cam_dbg (cam,"camera: bytesperline = %d; height = %d\n" , + fmt->bytesperline, fmt->sizeimage / fmt->bytesperline); + imgsz_h = (fmt->height <<IMGSZ_V_SHIFT ) &IMGSZ_V_MASK ; + imgsz_w = fmt->bytesperline &IMGSZ_H_MASK ; + +switch (fmt->pixelformat) { +case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_UYVY : + widthy = fmt->width *2 ; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_JPEG :drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam) · line 735
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-0+ imgsz_h = (fmt->sizeimage / fmt->bytesperline) <<IMGSZ_V_SHIFT ; + widthy = fmt->bytesperline; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : + imgsz_w = (fmt->bytesperline *4 /3 ) &IMGSZ_H_MASK ; + widthy = fmt->width; + widthuv = fmt->width /2 ;I might be wrong, but the above doesn't look right to me. Firstly, YUV422P is a 4:2:2 format, whereas YUV420 and YVU420 are 4:2:0 formats, so, I would expect calculations for them to differ. Besides, bytesperline * 4 / 3 doesn't look right for any of them. If this is what I think - total number of bytes per line, i.e., sizeimage / height, than shouldn't YAU422P have
drivers/media/platform/marvell-ccic/mcam-core.c +1
-0+ imgsz_w = fmt->bytesperline &IMGSZ_H_MASK ;and the other two
(quoted diff) +1
-0+ imgsz_w = (fmt->bytesperline * 3 / 2) & IMGSZ_H_MASK;
Quoted 2 lines
? But maybe I'm wrong, please, double-check and confirm.
Basically, I agree with you. We are checking with our HW team how the value is calculated out. And we will update here as soon as we get the answer.
Quoted 134 lines
Quoted 16 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-5+break ; +default : + widthy = fmt->bytesperline; + widthuv =0 ; + } + +mcam_reg_write_mask (cam,REG_IMGPITCH , widthuv <<16 | widthy, +IMGP_YP_MASK |IMGP_UVP_MASK ); +mcam_reg_write (cam,REG_IMGSIZE , imgsz_h | imgsz_w); +mcam_reg_write (cam,REG_IMGOFFSET ,0x0 ); - imgsz = ((fmt->height <<IMGSZ_V_SHIFT ) &IMGSZ_V_MASK ) | - (fmt->bytesperline &IMGSZ_H_MASK ); -mcam_reg_write (cam,REG_IMGSIZE , imgsz); -mcam_reg_write (cam,REG_IMGOFFSET ,0 ); -/* YPITCH just drops the last two bits */ drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam)
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +4
-3-mcam_reg_write_mask (cam,REG_IMGPITCH , fmt->bytesperline, -IMGP_YP_MASK );/* * Tell the controller about the image format we are using. */ -switch (cam->pix_format.pixelformat) { +switch (fmt->pixelformat) { +case V4L2_PIX_FMT_YUV422P : + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_YUV | C0_YUV_PLANAR | C0_YUVE_YVYU,
C0_DF_MASK);Quoted 75 lines
drivers/media/platform/marvell-ccic/mcam-core.c +29
-21+break ; +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_420PL |C0_YUVE_YVYU ,C0_DF_MASK ); +break ;case V4L2_PIX_FMT_YUYV : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV , -C0_DF_MASK ); -break ; - +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_UYVY ,C0_DF_MASK ); +break ; +case V4L2_PIX_FMT_UYVY : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV ,C0_DF_MASK ); +break ; +case V4L2_PIX_FMT_JPEG : +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_YUV |C0_YUV_PACKED |C0_YUVE_YUYV ,C0_DF_MASK ); +break ;case V4L2_PIX_FMT_RGB444 : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_RGB |C0_RGBF_444 |C0_RGB4_XRGB , -C0_DF_MASK ); +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_RGB |C0_RGBF_444 |C0_RGB4_XRGB ,C0_DF_MASK );/* Alpha value? */ -break ; - +break ;case V4L2_PIX_FMT_RGB565 : -mcam_reg_write_mask (cam,REG_CTRL0 , -C0_DF_RGB |C0_RGBF_565 |C0_RGB5_BGGR , -C0_DF_MASK ); -break ; - +mcam_reg_write_mask (cam,REG_CTRL0 , +C0_DF_RGB |C0_RGBF_565 |C0_RGB5_BGGR ,C0_DF_MASK ); +break ;default : -cam_err (cam,"Unknown format %x\n" , cam->pix_format.pixelformat); -break ; +cam_err (cam,"camera: unknown format: %#x\n" , fmt->pixelformat); +break ; } +/* * Make sure it knows we want to use hsync/vsync. */ -mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC , -C0_SIFM_MASK ); - +mcam_reg_write_mask (cam,REG_CTRL0 ,C0_SIF_HVSYNC ,C0_SIFM_MASK );/* * This field controls the generation of EOF(DVP only) */ @@ -711,7 +797,6 @@ static void mcam_ctlr_image(struct mcam_camera *cam) } } -/* * Configure the controller for operation; caller holds the * device mutex. @@ -984,11 +1069,37 @@ static void mcam_vb_buf_queue(struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb);struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct v4l2_pix_format *fmt = &cam->pix_format;unsigned long flags;int start; +dma_addr_t dma_handle;drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_vb_buf_queue(struct vb2_buffer *vb) · line 1085
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +7
-0+u32 pixel_count = fmt->width * fmt->height;spin_lock_irqsave (&cam->dev_lock, flags); + dma_handle =vb2_dma_contig_plane_dma_addr (vb,0 ); +BUG_ON (!dma_handle); start = (cam->state ==S_BUFWAIT ) && !list_empty (&cam->buffers); + +switch (cam->pix_format.pixelformat) { +case V4L2_PIX_FMT_YUV422P : + mvb->yuv_p.y = dma_handle;The above line is common for all cases, perhaps just put it above switch?
Quoted 19 lines
drivers/media/platform/marvell-ccic/mcam-core.c +17
-0+ mvb->yuv_p.u = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.v = mvb->yuv_p.u + pixel_count /2 ; +break ; +case V4L2_PIX_FMT_YUV420 : + mvb->yuv_p.y = dma_handle; + mvb->yuv_p.u = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.v = mvb->yuv_p.u + pixel_count /4 ; +break ; +case V4L2_PIX_FMT_YVU420 : + mvb->yuv_p.y = dma_handle; + mvb->yuv_p.v = mvb->yuv_p.y + pixel_count; + mvb->yuv_p.u = mvb->yuv_p.v + pixel_count /4 ; +break ; +default : + mvb->yuv_p.y = dma_handle; + } +list_add (&mvb->queue, &cam->buffers);if (cam->state ==S_STREAMING &&test_bit (CF_SG_RESTART , &cam->flags))
Quoted 8 lines
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_vb_buf_queue(struct vb2_buffer *vb) · line 1105
Quoted 1 line
drivers/media/platform/marvell-ccic/mcam-core.c +0
-0mcam_sg_restart (cam);Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Regards,
Libin
RE: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driver
In reply to Guennadi LiakhovetskiHi Guennadi,
Below is the update for widthy, widthuv and imgsz_w setting.
Quoted 69 lines
-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: Wednesday, January 02, 2013 12:56 AM
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 06/15] [media] marvell-ccic: add new formats support for marvell-ccic driverQuoted 4 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the new formats support for marvell-ccic.
Review
Quoted 8 lines
Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>--- drivers/media/platform/marvell-ccic/mcam-core.c | 175 ++++++++++++++++++----- drivers/media/platform/marvell-ccic/mcam-core.h | 6 + 2 files changed, 149 insertions(+), 32 deletions(-)(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mcam-core.cQuoted 3 lines
index 3cc1d0c..a679917 100755
drivers/media/platform/marvell-ccic/mcam-core.c +0
-0[snip]
Quoted 20 lines
drivers/media/platform/marvell-ccic/mcam-core.c +14
-1@@ -658,49 +708,85 @@ static inline void mcam_sg_restart(struct mcam_camera *cam)*/ static void mcam_ctlr_image (struct mcam_camera *cam) { -int imgsz;struct v4l2_pix_format *fmt = &cam->pix_format; +u32 widthy =0 , widthuv =0 , imgsz_h, imgsz_w; + +cam_dbg (cam,"camera: bytesperline = %d; height = %d\n" , + fmt->bytesperline, fmt->sizeimage / fmt->bytesperline); + imgsz_h = (fmt->height <<IMGSZ_V_SHIFT ) &IMGSZ_V_MASK ; + imgsz_w = fmt->bytesperline &IMGSZ_H_MASK ; + +switch (fmt->pixelformat) { +case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_UYVY : + widthy = fmt->width *2 ; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_JPEG :drivers/media/platform/marvell-ccic/mcam-core.c static inline void mcam_sg_restart(struct mcam_camera *cam) · line 735
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +10
-0+ imgsz_h = (fmt->sizeimage / fmt->bytesperline) <<IMGSZ_V_SHIFT ; + widthy = fmt->bytesperline; + widthuv =0 ; +break ; +case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_YUV420 : +case V4L2_PIX_FMT_YVU420 : + imgsz_w = (fmt->bytesperline *4 /3 ) &IMGSZ_H_MASK ; + widthy = fmt->width; + widthuv = fmt->width /2 ;I might be wrong, but the above doesn't look right to me. Firstly, YUV422P is a 4:2:2 format, whereas YUV420 and YVU420 are 4:2:0 formats, so, I would expect calculations for them to differ. Besides, bytesperline * 4 / 3 doesn't look right for any of them. If this is what I think - total number of bytes per line, i.e., sizeimage / height, than shouldn't YAU422P have
drivers/media/platform/marvell-ccic/mcam-core.c +1
-0+ imgsz_w = fmt->bytesperline &IMGSZ_H_MASK ;and the other two
(quoted diff) +1
-0+ imgsz_w = (fmt->bytesperline * 3 / 2) & IMGSZ_H_MASK;
Quoted 2 lines
? But maybe I'm wrong, please, double-check and confirm.
First of all, the setting bytesperline in this file is wrong. It should be like the setting in the mcam-core-soc.c in the later patch. It's my fault missing modifying the bytesperline when adding the new formats. Besides the bytesperline in mcam-core-soc.c is a little wrong. I will update it in the new version of patch.
For imgsz_w setting, this is for the CCIC input data format, which is from sensor, while 'switch (fmt->pixelformat)' is CCIC output data format. It seems a little confusing using fmt->pixelformat here. Using mcam_formats->mbus_code seems more reasonable. Anyway,
each fmt->pixelformat must have one mcam_formats->mbus_code correspondingly.
Although, our spec says it supports YUV420 input. Our HW team told me we only use YUV422 and the length is width * 2. So it seems some mbus_code is wrong set here.
It seems in this case such format will be never used as we can see ov7670 does not support yuv420.
Regards,
Libin
PATCH v3 7/15 marvell-ccic: add SOF / EOF pair check for marvell-ccic driver
In reply to Albert WangFrom: Libin Yang <[email protected]>
This patch adds the SOFx/EOFx pair check for marvell-ccic.
When switching format, the last EOF may not arrive when stop streamning. And the EOF will be detected in the next start streaming.
Must ensure clear the obsolete frame flags before every really start streaming.
--- drivers/media/platform/marvell-ccic/mcam-core.c | 30 ++++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core.c +26 -4
@@ -94,6 +94,9 @@ MODULE_PARM_DESC(buffer_mode,#define CF_CONFIG_NEEDED 4/* Must configure hardware */ #define CF_SINGLE_BUFFER 5/* Running with a single buffer */ #define CF_SG_RESTART 6/* SG restart needed */ +#define CF_FRAME_SOF0 7/* Frame 0 started */ +#define CF_FRAME_SOF1 8 +#define CF_FRAME_SOF2 9 #define sensor_call(cam, o, f, args...) \ v4l2_subdev_call(cam->sensor, o, f, ##args)
@@ -251,8 +254,10 @@ static void mcam_reset_buffers(struct mcam_camera *cam)int i; cam->next_buf =-1 ; -for (i =0 ; i < cam->nbufs; i++) +for (i =0 ; i < cam->nbufs; i++) {clear_bit (i, &cam->flags); +clear_bit (CF_FRAME_SOF0 + i, &cam->flags); + } }static inline int mcam_needs_config (struct mcam_camera *cam)
@@ -1134,6 +1139,7 @@ static void mcam_vb_wait_finish(struct vb2_queue *vq)static int mcam_vb_start_streaming (struct vb2_queue *vq,unsigned int count) {struct mcam_camera *cam =vb2_get_drv_priv (vq); +unsigned int frame;if (cam->state !=S_IDLE ) {INIT_LIST_HEAD (&cam->buffers);
@@ -1151,6 +1157,14 @@ static int mcam_vb_start_streaming(struct vb2_queue *vq, unsigned int count) cam->state =S_BUFWAIT ;return 0 ; } + +/* +* Ensure clear the obsolete frame flags +* before every really start streaming +*/ +for (frame =0 ; frame < cam->nbufs; frame++) +clear_bit (CF_FRAME_SOF0 + frame, &cam->flags); +return mcam_read_setup (cam); }
@@ -1875,9 +1889,11 @@ int mccic_irq(struct mcam_camera *cam, unsigned int irqs)* each time. */ for (frame =0 ; frame < cam->nbufs; frame++) -if (irqs & (IRQ_EOF0 << frame)) { +if (irqs & (IRQ_EOF0 << frame) && +test_bit (CF_FRAME_SOF0 + frame, &cam->flags)) {mcam_frame_complete (cam, frame); handled =1 ; +clear_bit (CF_FRAME_SOF0 + frame, &cam->flags);if (cam->buffer_mode == B_DMA_sg)break ; }
@@ -1886,9 +1902,15 @@ int mccic_irq(struct mcam_camera *cam, unsigned int irqs)* code assumes that we won't get multiple frame interrupts * at once; may want to rethink that. */ -if (irqs & (IRQ_SOF0 |IRQ_SOF1 |IRQ_SOF2 )) { +for (frame =0 ; frame < cam->nbufs; frame++) { +if (irqs & (IRQ_SOF0 << frame)) { +set_bit (CF_FRAME_SOF0 + frame, &cam->flags); + handled =IRQ_HANDLED ; + } + } + +if (handled ==IRQ_HANDLED ) {set_bit (CF_DMA_ACTIVE , &cam->flags); - handled =1 ;if (cam->buffer_mode == B_DMA_sg)mcam_ctlr_stop (cam); }
Signature · 1 line
1.7.9.5
Re: [PATCH V3 07/15] [media] marvell-ccic: add SOF / EOF pair check for marvell-ccic driver
Quoted 8 lines · On Sat, 15 Dec 2012 17:57:56 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch adds the SOFx/EOFx pair check for marvell-ccic.
When switching format, the last EOF may not arrive when stop streamning. And the EOF will be detected in the next start streaming.
Must ensure clear the obsolete frame flags before every really start streaming.
"obsolete" doesn't quite read right; it suggests that the flags only apply to older hardware. I'd suggest "left over" or some such (in the code comment too). Otherwise seems fine.
jon
RE: [PATCH V3 07/15] [media] marvell-ccic: add SOF / EOF pair check for marvell-ccic driver
Hi, Jonathan
Quoted 15 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:19
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 07/15] [media] marvell-ccic: add SOF / EOF pair check for marvell-ccic driverQuoted 4 lines · On Sat, 15 Dec 2012 17:57:56 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch adds the SOFx/EOFx pair check for marvell-ccic.
Quoted 9 lines
Quoted 4 lines
When switching format, the last EOF may not arrive when stop streamning. And the EOF will be detected in the next start streaming.
Must ensure clear the obsolete frame flags before every really start streaming.
"obsolete" doesn't quite read right; it suggests that the flags only apply to older hardware. I'd suggest "left over" or some such (in the code comment too). Otherwise seems fine.
[Albert Wang] OK, we will change the "bad" word. :)
Quoted 3 lines
Acked-by Jonathan Corbet <[email protected]>jon
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 07/15] [media] marvell-ccic: add SOF / EOF pair check for marvell-ccic driver
In reply to Albert WangQuoted 8 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch adds the SOFx/EOFx pair check for marvell-ccic.
When switching format, the last EOF may not arrive when stop streamning. And the EOF will be detected in the next start streaming.
Must ensure clear the obsolete frame flags before every really start streaming.
Apart from the remark, that Jon has made:
Thanks
Guennadi
Quoted 90 lines
Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>--- drivers/media/platform/marvell-ccic/mcam-core.c | 30 ++++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-)drivers/media/platform/marvell-ccic/mcam-core.c +26
-4@@ -94,6 +94,9 @@ MODULE_PARM_DESC(buffer_mode,#define CF_CONFIG_NEEDED 4/* Must configure hardware */ #define CF_SINGLE_BUFFER 5/* Running with a single buffer */ #define CF_SG_RESTART 6/* SG restart needed */ +#define CF_FRAME_SOF0 7/* Frame 0 started */ +#define CF_FRAME_SOF1 8 +#define CF_FRAME_SOF2 9 #define sensor_call(cam, o, f, args...) \ v4l2_subdev_call(cam->sensor, o, f, ##args)@@ -251,8 +254,10 @@ static void mcam_reset_buffers(struct mcam_camera *cam)int i; cam->next_buf =-1 ; -for (i =0 ; i < cam->nbufs; i++) +for (i =0 ; i < cam->nbufs; i++) {clear_bit (i, &cam->flags); +clear_bit (CF_FRAME_SOF0 + i, &cam->flags); + } }static inline int mcam_needs_config (struct mcam_camera *cam)@@ -1134,6 +1139,7 @@ static void mcam_vb_wait_finish(struct vb2_queue *vq)static int mcam_vb_start_streaming (struct vb2_queue *vq,unsigned int count) {struct mcam_camera *cam =vb2_get_drv_priv (vq); +unsigned int frame;if (cam->state !=S_IDLE ) {INIT_LIST_HEAD (&cam->buffers);@@ -1151,6 +1157,14 @@ static int mcam_vb_start_streaming(struct vb2_queue *vq, unsigned int count) cam->state =S_BUFWAIT ;return 0 ; } + +/* +* Ensure clear the obsolete frame flags +* before every really start streaming +*/ +for (frame =0 ; frame < cam->nbufs; frame++) +clear_bit (CF_FRAME_SOF0 + frame, &cam->flags); +return mcam_read_setup (cam); }@@ -1875,9 +1889,11 @@ int mccic_irq(struct mcam_camera *cam, unsigned int irqs)* each time. */ for (frame =0 ; frame < cam->nbufs; frame++) -if (irqs & (IRQ_EOF0 << frame)) { +if (irqs & (IRQ_EOF0 << frame) && +test_bit (CF_FRAME_SOF0 + frame, &cam->flags)) {mcam_frame_complete (cam, frame); handled =1 ; +clear_bit (CF_FRAME_SOF0 + frame, &cam->flags);if (cam->buffer_mode == B_DMA_sg)break ; }@@ -1886,9 +1902,15 @@ int mccic_irq(struct mcam_camera *cam, unsigned int irqs)* code assumes that we won't get multiple frame interrupts * at once; may want to rethink that. */ -if (irqs & (IRQ_SOF0 |IRQ_SOF1 |IRQ_SOF2 )) { +for (frame =0 ; frame < cam->nbufs; frame++) { +if (irqs & (IRQ_SOF0 << frame)) { +set_bit (CF_FRAME_SOF0 + frame, &cam->flags); + handled =IRQ_HANDLED ; + } + } + +if (handled ==IRQ_HANDLED ) {set_bit (CF_DMA_ACTIVE , &cam->flags); - handled =1 ;if (cam->buffer_mode == B_DMA_sg)mcam_ctlr_stop (cam); }Signature · 1 line
1.7.9.5
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
PATCH v3 8/15 marvell-ccic: switch to resource managed allocation and request
In reply to Albert WangFrom: Libin Yang <[email protected]>
This patch switchs to resource managed allocation and request in mmp-driver. It can remove free resource operations.
--- drivers/media/platform/marvell-ccic/mmp-driver.c | 56 ++++++++-------------- 1 file changed, 20 insertions(+), 36 deletions(-)
drivers/media/platform/marvell-ccic/mmp-driver.c +20 -36
@@ -315,7 +315,7 @@ static int mmpcam_probe(struct platform_device *pdev)if (!pdata)return -ENODEV ; - cam =kzalloc (sizeof (*cam),GFP_KERNEL ); + cam =devm_kzalloc (&pdev->dev,sizeof (*cam),GFP_KERNEL );if (cam ==NULL )return -ENOMEM ; cam->pdev = pdev;
@@ -343,14 +343,12 @@ static int mmpcam_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (res ==NULL ) {dev_err (&pdev->dev,"no iomem resource!\n" ); - ret = -ENODEV ; - goto out_free; +return -ENODEV ; } - mcam->regs =ioremap (res->start,resource_size (res)); + mcam->regs =devm_request_and_ioremap (&pdev->dev, res);if (mcam->regs ==NULL ) {dev_err (&pdev->dev,"MMIO ioremap fail\n" ); - ret = -ENODEV ; - goto out_free; +return -ENODEV ; }/* * Power/clock memory is elsewhere; get it too. Perhaps this
@@ -359,14 +357,12 @@ static int mmpcam_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,1 );if (res ==NULL ) {dev_err (&pdev->dev,"no power resource!\n" ); - ret = -ENODEV ; - goto out_unmap1; +return -ENODEV ; } - cam->power_regs =ioremap (res->start,resource_size (res)); + cam->power_regs =devm_request_and_ioremap (&pdev->dev, res);if (cam->power_regs ==NULL ) {dev_err (&pdev->dev,"power MMIO ioremap fail\n" ); - ret = -ENODEV ; - goto out_unmap1; +return -ENODEV ; }mcam_init_clk (mcam, pdata,1 );
@@ -376,25 +372,27 @@ static int mmpcam_probe(struct platform_device *pdev)*/ mcam->i2c_adapter =platform_get_drvdata (pdata->i2c_device);if (mcam->i2c_adapter ==NULL ) { - ret = -ENODEV ;dev_err (&pdev->dev,"No i2c adapter\n" ); - goto out_unmap2; + ret = -ENODEV ; + goto out_uninit_clk; }/* * Sensor GPIO pins. */ - ret =gpio_request (pdata->sensor_power_gpio,"cam-power" ); + ret =devm_gpio_request (&pdev->dev, pdata->sensor_power_gpio, +"cam-power" );if (ret) {dev_err (&pdev->dev,"Can't get sensor power gpio %d" , pdata->sensor_power_gpio); - goto out_unmap2; + goto out_uninit_clk; }gpio_direction_output (pdata->sensor_power_gpio,0 ); - ret =gpio_request (pdata->sensor_reset_gpio,"cam-reset" ); + ret =devm_gpio_request (&pdev->dev, pdata->sensor_reset_gpio, +"cam-reset" );if (ret) {dev_err (&pdev->dev,"Can't get sensor reset gpio %d" , pdata->sensor_reset_gpio); - goto out_gpio; + goto out_uninit_clk; }gpio_direction_output (pdata->sensor_reset_gpio,0 );
@@ -404,7 +402,7 @@ static int mmpcam_probe(struct platform_device *pdev)mmpcam_power_up (mcam); ret =mccic_register (mcam);if (ret) - goto out_gpio2; + goto out_power_down;/* * Finally, set up our IRQ now that the core is ready to * deal with it.
@@ -415,8 +413,8 @@ static int mmpcam_probe(struct platform_device *pdev) goto out_unregister; } cam->irq = res->start; - ret =request_irq (cam->irq, mmpcam_irq,IRQF_SHARED , -"mmp-camera" , mcam); + ret =devm_request_irq (&pdev->dev, cam->irq, mmpcam_irq,IRQF_SHARED , +"mmp-camera" , mcam);if (ret ==0 ) {mmpcam_add_device (cam);return 0 ;
@@ -424,18 +422,10 @@ static int mmpcam_probe(struct platform_device *pdev) out_unregister:mccic_shutdown (mcam); -out_gpio2: +out_power_down:mmpcam_power_down (mcam); -gpio_free (pdata->sensor_reset_gpio); -out_gpio: -gpio_free (pdata->sensor_power_gpio); -out_unmap2: +out_uninit_clk:mcam_init_clk (mcam, pdata,0 ); -iounmap (cam->power_regs); -out_unmap1: -iounmap (mcam->regs); -out_free: -kfree (cam);return ret; }
@@ -446,16 +436,10 @@ static int mmpcam_remove(struct mmp_camera *cam)struct mmp_camera_platform_data *pdata;mmpcam_remove_device (cam); -free_irq (cam->irq, mcam);mccic_shutdown (mcam);mmpcam_power_down (mcam); pdata = cam->pdev->dev.platform_data; -gpio_free (pdata->sensor_reset_gpio); -gpio_free (pdata->sensor_power_gpio); -iounmap (cam->power_regs); -iounmap (mcam->regs);mcam_init_clk (mcam, pdata,0 ); -kfree (cam);return 0 ; }
Signature · 1 line
1.7.9.5
Re: [PATCH V3 08/15] [media] marvell-ccic: switch to resource managed allocation and request
Quoted 4 lines · On Sat, 15 Dec 2012 17:57:57 +0800 Albert Wang <[email protected]> wrote:
From: Libin Yang <[email protected]>
This patch switchs to resource managed allocation and request in mmp-driver. It can remove free resource operations.
But that takes away half the challenge of getting all this stuff right! :)
jon
Re: [PATCH V3 08/15] [media] marvell-ccic: switch to resource managed allocation and request
In reply to Albert WangQuoted 61 lines · Albert Wang
From: Libin Yang <[email protected]>
This patch switchs to resource managed allocation and request in mmp-driver. It can remove free resource operations.
Signed-off-by Albert Wang <[email protected]>Signed-off-by Libin Yang <[email protected]>--- drivers/media/platform/marvell-ccic/mmp-driver.c | 56 ++++++++-------------- 1 file changed, 20 insertions(+), 36 deletions(-)drivers/media/platform/marvell-ccic/mmp-driver.c +7
-11@@ -315,7 +315,7 @@ static int mmpcam_probe(struct platform_device *pdev)if (!pdata)return -ENODEV ; - cam =kzalloc (sizeof (*cam),GFP_KERNEL ); + cam =devm_kzalloc (&pdev->dev,sizeof (*cam),GFP_KERNEL );if (cam ==NULL )return -ENOMEM ; cam->pdev = pdev;@@ -343,14 +343,12 @@ static int mmpcam_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (res ==NULL ) {dev_err (&pdev->dev,"no iomem resource!\n" ); - ret = -ENODEV ; - goto out_free; +return -ENODEV ; } - mcam->regs =ioremap (res->start,resource_size (res)); + mcam->regs =devm_request_and_ioremap (&pdev->dev, res);if (mcam->regs ==NULL ) {dev_err (&pdev->dev,"MMIO ioremap fail\n" ); - ret = -ENODEV ; - goto out_free; +return -ENODEV ; }/* * Power/clock memory is elsewhere; get it too. Perhaps this @@ -359,14 +357,12 @@ static int mmpcam_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,1 );if (res ==NULL ) {dev_err (&pdev->dev,"no power resource!\n" ); - ret = -ENODEV ; - goto out_unmap1; +return -ENODEV ; } - cam->power_regs =ioremap (res->start,resource_size (res)); + cam->power_regs =devm_request_and_ioremap (&pdev->dev, res);if (cam->power_regs ==NULL ) {dev_err (&pdev->dev,"power MMIO ioremap fail\n" ); - ret = -ENODEV ; - goto out_unmap1; +return -ENODEV ; }mcam_init_clk (mcam, pdata,1 );
drivers/media/platform/marvell-ccic/mmp-driver.c static int mmpcam_probe(struct platform_device *pdev) · line 377
Quoted 8 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-2@@ -376,25 +372,27 @@ static int mmpcam_probe(struct platform_device *pdev)*/ mcam->i2c_adapter =platform_get_drvdata (pdata->i2c_device);if (mcam->i2c_adapter ==NULL ) { - ret = -ENODEV ;dev_err (&pdev->dev,"No i2c adapter\n" ); - goto out_unmap2; + ret = -ENODEV ; + goto out_uninit_clk;
Looks good in principle, but it will become a bit simpler yet after you change your patch 03/15 to not use mcam_init_clk() for clock deinitialisation, but that's going to be just a minor modification.
Thanks
Guennadi
Quoted 86 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +11
-23}/* * Sensor GPIO pins. */ - ret =gpio_request (pdata->sensor_power_gpio,"cam-power" ); + ret =devm_gpio_request (&pdev->dev, pdata->sensor_power_gpio, +"cam-power" );if (ret) {dev_err (&pdev->dev,"Can't get sensor power gpio %d" , pdata->sensor_power_gpio); - goto out_unmap2; + goto out_uninit_clk; }gpio_direction_output (pdata->sensor_power_gpio,0 ); - ret =gpio_request (pdata->sensor_reset_gpio,"cam-reset" ); + ret =devm_gpio_request (&pdev->dev, pdata->sensor_reset_gpio, +"cam-reset" );if (ret) {dev_err (&pdev->dev,"Can't get sensor reset gpio %d" , pdata->sensor_reset_gpio); - goto out_gpio; + goto out_uninit_clk; }gpio_direction_output (pdata->sensor_reset_gpio,0 );@@ -404,7 +402,7 @@ static int mmpcam_probe(struct platform_device *pdev)mmpcam_power_up (mcam); ret =mccic_register (mcam);if (ret) - goto out_gpio2; + goto out_power_down;/* * Finally, set up our IRQ now that the core is ready to * deal with it. @@ -415,8 +413,8 @@ static int mmpcam_probe(struct platform_device *pdev) goto out_unregister; } cam->irq = res->start; - ret =request_irq (cam->irq, mmpcam_irq,IRQF_SHARED , -"mmp-camera" , mcam); + ret =devm_request_irq (&pdev->dev, cam->irq, mmpcam_irq,IRQF_SHARED , +"mmp-camera" , mcam);if (ret ==0 ) {mmpcam_add_device (cam);return 0 ;@@ -424,18 +422,10 @@ static int mmpcam_probe(struct platform_device *pdev) out_unregister:mccic_shutdown (mcam); -out_gpio2: +out_power_down:mmpcam_power_down (mcam); -gpio_free (pdata->sensor_reset_gpio); -out_gpio: -gpio_free (pdata->sensor_power_gpio); -out_unmap2: +out_uninit_clk:mcam_init_clk (mcam, pdata,0 ); -iounmap (cam->power_regs); -out_unmap1: -iounmap (mcam->regs); -out_free: -kfree (cam);return ret; }@@ -446,16 +436,10 @@ static int mmpcam_remove(struct mmp_camera *cam)struct mmp_camera_platform_data *pdata;mmpcam_remove_device (cam); -free_irq (cam->irq, mcam);mccic_shutdown (mcam);mmpcam_power_down (mcam); pdata = cam->pdev->dev.platform_data; -gpio_free (pdata->sensor_reset_gpio); -gpio_free (pdata->sensor_power_gpio); -iounmap (cam->power_regs); -iounmap (mcam->regs);mcam_init_clk (mcam, pdata,0 ); -kfree (cam);return 0 ; }Signature · 1 line
1.7.9.5
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
PATCH v3 9/15 marvell-ccic: add get_mcam function for marvell-ccic driver
In reply to Albert WangThis patch adds get_mcam() inline function which is prepared for adding soc_camera support in marvell-ccic driver
--- drivers/media/platform/marvell-ccic/mcam-core.c | 27 ++++++++++++++--------- drivers/media/platform/marvell-ccic/mcam-core.h | 5 +++++ 2 files changed, 22 insertions(+), 10 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core.c +17 -10
@@ -1057,7 +1057,7 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq, unsigned int *num_planes, unsigned int sizes[], void *alloc_ctxs[]) { - struct mcam_camera *cam = vb2_get_drv_priv(vq); + struct mcam_camera *cam = get_mcam(vq);int minbufs = (cam->buffer_mode == B_DMA_contig) ?3 :2 ; sizes[0 ] = cam->pix_format.sizeimage;
@@ -1073,14 +1073,17 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq,static void mcam_vb_buf_queue (struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb); -struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct mcam_camera *cam =get_mcam (vb->vb2_queue);struct v4l2_pix_format *fmt = &cam->pix_format;unsigned long flags;int start;dma_addr_t dma_handle; +unsigned long size;u32 pixel_count = fmt->width * fmt->height;spin_lock_irqsave (&cam->dev_lock, flags); + size =vb2_plane_size (vb,0 ); +vb2_set_plane_payload (vb,0 , size); dma_handle =vb2_dma_contig_plane_dma_addr (vb,0 );BUG_ON (!dma_handle); start = (cam->state ==S_BUFWAIT ) && !list_empty (&cam->buffers);
@@ -1121,14 +1124,14 @@ static void mcam_vb_buf_queue(struct vb2_buffer *vb)*/ static void mcam_vb_wait_prepare (struct vb2_queue *vq) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);mutex_unlock (&cam->s_mutex); }static void mcam_vb_wait_finish (struct vb2_queue *vq) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);mutex_lock (&cam->s_mutex); }
@@ -1138,9 +1141,12 @@ static void mcam_vb_wait_finish(struct vb2_queue *vq)*/ static int mcam_vb_start_streaming (struct vb2_queue *vq,unsigned int count) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);unsigned int frame; +if (count <2 ) +return -EINVAL ; +if (cam->state !=S_IDLE ) {INIT_LIST_HEAD (&cam->buffers);return -EINVAL ;
@@ -1170,7 +1176,7 @@ static int mcam_vb_start_streaming(struct vb2_queue *vq, unsigned int count)static int mcam_vb_stop_streaming (struct vb2_queue *vq) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);unsigned long flags;if (cam->state ==S_BUFWAIT ) {
@@ -1181,6 +1187,7 @@ static int mcam_vb_stop_streaming(struct vb2_queue *vq)if (cam->state !=S_STREAMING )return -EINVAL ;mcam_ctlr_stop_dma (cam); + cam->state =S_IDLE ;/* * Reset the CCIC PHY after stopping streaming, * otherwise, the CCIC may be unstable.
@@ -1216,7 +1223,7 @@ static const struct vb2_ops mcam_vb2_ops = {static int mcam_vb_sg_buf_init (struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb); -struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct mcam_camera *cam =get_mcam (vb->vb2_queue);int ndesc = cam->pix_format.sizeimage/PAGE_SIZE +1 ; mvb->dma_desc = dma_alloc_coherent(cam->dev,
@@ -1232,7 +1239,7 @@ static int mcam_vb_sg_buf_init(struct vb2_buffer *vb)static int mcam_vb_sg_buf_prepare (struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb); -struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct mcam_camera *cam =get_mcam (vb->vb2_queue);struct vb2_dma_sg_desc *sgd =vb2_dma_sg_plane_desc (vb,0 );struct mcam_dma_desc *desc = mvb->dma_desc;struct scatterlist *sg;
@@ -1252,7 +1259,7 @@ static int mcam_vb_sg_buf_prepare(struct vb2_buffer *vb)static int mcam_vb_sg_buf_finish (struct vb2_buffer *vb) { -struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct mcam_camera *cam =get_mcam (vb->vb2_queue);struct vb2_dma_sg_desc *sgd =vb2_dma_sg_plane_desc (vb,0 );dma_unmap_sg (cam->dev, sgd->sglist, sgd->num_pages,DMA_FROM_DEVICE );
@@ -1261,7 +1268,7 @@ static int mcam_vb_sg_buf_finish(struct vb2_buffer *vb)static void mcam_vb_sg_buf_cleanup (struct vb2_buffer *vb) { -struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct mcam_camera *cam =get_mcam (vb->vb2_queue);struct mcam_vb_buffer *mvb =vb_to_mvb (vb);int ndesc = cam->pix_format.sizeimage/PAGE_SIZE +1 ;
drivers/media/platform/marvell-ccic/mcam-core.h +5 -0
@@ -216,6 +216,11 @@ static inline void mcam_reg_set_bit(struct mcam_camera *cam,mcam_reg_write_mask (cam, reg, val, val); } +static inline struct mcam_camera *get_mcam (struct vb2_queue *vq) +{ +return vb2_get_drv_priv (vq); +} +/* * Functions for use by platform code. */
Signature · 1 line
1.7.9.5
Re: [PATCH V3 09/15] [media] marvell-ccic: add get_mcam function for marvell-ccic driver
Quoted 2 lines · On Sat, 15 Dec 2012 17:57:58 +0800 Albert Wang <[email protected]> wrote:
This patch adds
get_mcam()inline function which is prepared for addingsoc_camerasupport in marvell-ccic driver
Time for a bikeshed moment: "get" generally is understood to mean incrementing a reference count in kernel code. Can it have a name like vbq_to_mcam() instead?
Also:
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.c +1
-1@@ -1073,14 +1073,17 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq,static void mcam_vb_buf_queue (struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb); -struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct mcam_camera *cam =get_mcam (vb->vb2_queue);struct v4l2_pix_format *fmt = &cam->pix_format;unsigned long flags;int start;
drivers/media/platform/marvell-ccic/mcam-core.c static int mcam_vb_queue_setup(struct vb2_queue *vq, · line 1089
Quoted 10 lines
drivers/media/platform/marvell-ccic/mcam-core.c +3
-0dma_addr_t dma_handle; +unsigned long size;u32 pixel_count = fmt->width * fmt->height;spin_lock_irqsave (&cam->dev_lock, flags); + size =vb2_plane_size (vb,0 ); +vb2_set_plane_payload (vb,0 , size); dma_handle =vb2_dma_contig_plane_dma_addr (vb,0 );BUG_ON (!dma_handle); start = (cam->state ==S_BUFWAIT ) && !list_empty (&cam->buffers);
There is an unrelated change here that belongs in a separate patch.
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_vb_wait_finish(struct vb2_queue *vq) · line 1149
Quoted 11 lines
drivers/media/platform/marvell-ccic/mcam-core.c +4
-1@@ -1138,9 +1141,12 @@ static void mcam_vb_wait_finish(struct vb2_queue *vq)*/ static int mcam_vb_start_streaming (struct vb2_queue *vq,unsigned int count) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);unsigned int frame; +if (count <2 ) +return -EINVAL ; +
Here too - unrelated change.
Quoted 13 lines
drivers/media/platform/marvell-ccic/mcam-core.c +1
-1if (cam->state !=S_IDLE ) {INIT_LIST_HEAD (&cam->buffers);return -EINVAL ;@@ -1170,7 +1176,7 @@ static int mcam_vb_start_streaming(struct vb2_queue *vq, unsigned int count)static int mcam_vb_stop_streaming (struct vb2_queue *vq) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);unsigned long flags;if (cam->state ==S_BUFWAIT ) {
drivers/media/platform/marvell-ccic/mcam-core.c static int mcam_vb_stop_streaming(struct vb2_queue *vq) · line 1190
Quoted 4 lines
drivers/media/platform/marvell-ccic/mcam-core.c +1
-0@@ -1181,6 +1187,7 @@ static int mcam_vb_stop_streaming(struct vb2_queue *vq)if (cam->state !=S_STREAMING )return -EINVAL ;mcam_ctlr_stop_dma (cam); + cam->state =S_IDLE ;
...and also here ...
jon
RE: [PATCH V3 09/15] [media] marvell-ccic: add get_mcam function for marvell-ccic driver
Hi, Jonathan
Quoted 11 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:25
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 09/15] [media] marvell-ccic: addget_mcamfunction for marvell- ccic driverOn Sat, 15 Dec 2012 17:57:58 +0800
Albert Wang <[email protected]> wrote:
Quoted 7 lines
Quoted 2 lines
This patch adds
get_mcam()inline function which is prepared for addingsoc_camerasupport in marvell-ccic driverTime for a bikeshed moment: "get" generally is understood to mean incrementing a reference count in kernel code. Can it have a name like
vbq_to_mcam()instead?
[Albert Wang] Sure. It looks your name is more professional. :)
Quoted 15 lines
Also:
Quoted 13 lines
drivers/media/platform/marvell-ccic/mcam-core.c +2
-1@@ -1073,14 +1073,17 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq,static void mcam_vb_buf_queue (struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb); -struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct mcam_camera *cam =get_mcam (vb->vb2_queue);struct v4l2_pix_format *fmt = &cam->pix_format;unsigned long flags;int start;dma_addr_t dma_handle; +unsigned long size;u32 pixel_count = fmt->width * fmt->height;
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.c static int mcam_vb_queue_setup(struct vb2_queue *vq, · line 1089
Quoted 6 lines
drivers/media/platform/marvell-ccic/mcam-core.c +2
-0spin_lock_irqsave (&cam->dev_lock, flags); + size =vb2_plane_size (vb,0 ); +vb2_set_plane_payload (vb,0 , size); dma_handle =vb2_dma_contig_plane_dma_addr (vb,0 );BUG_ON (!dma_handle); start = (cam->state ==S_BUFWAIT ) && !list_empty (&cam->buffers);There is an unrelated change here that belongs in a separate patch.
[Albert Wang] OK
Quoted 8 lines
Quoted 8 lines
drivers/media/platform/marvell-ccic/mcam-core.c +1
-1@@ -1138,9 +1141,12 @@ static void mcam_vb_wait_finish(struct vb2_queue *vq)*/ static int mcam_vb_start_streaming (struct vb2_queue *vq,unsigned int count) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);unsigned int frame;
Quoted 6 lines
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_vb_wait_finish(struct vb2_queue *vq) · line 1149
Quoted 3 lines
drivers/media/platform/marvell-ccic/mcam-core.c +3
-0+if (count <2 ) +return -EINVAL ; +Here too - unrelated change.
[Albert Wang] Em, it looks we should add a new patch to contain these changes. :)
Quoted 21 lines
drivers/media/platform/marvell-ccic/mcam-core.c static int mcam_vb_start_streaming(struct vb2_queue *vq,
Quoted 4 lines
drivers/media/platform/marvell-ccic/mcam-core.c +0
-0if (cam->state !=S_IDLE ) {INIT_LIST_HEAD (&cam->buffers);return -EINVAL ;@@ -1170,7 +1176,7 @@ static int mcam_vb_start_streaming(struct vb2_queue *vq,unsigned int count)
drivers/media/platform/marvell-ccic/mcam-core.c static int mcam_vb_stop_streaming(struct vb2_queue *vq) · line 1190
Quoted 13 lines
drivers/media/platform/marvell-ccic/mcam-core.c +2
-1static int mcam_vb_stop_streaming (struct vb2_queue *vq) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);unsigned long flags;if (cam->state ==S_BUFWAIT ) {@@ -1181,6 +1187,7 @@ static int mcam_vb_stop_streaming(struct vb2_queue *vq)if (cam->state !=S_STREAMING )return -EINVAL ;mcam_ctlr_stop_dma (cam); + cam->state =S_IDLE ;...and also here ...
Quoted 1 line
jon
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 09/15] [media] marvell-ccic: add get_mcam function for marvell-ccic driver
In reply to Jonathan CorbetQuoted 25 lines · Jonathan Corbet
Quoted 2 lines · On Sat, 15 Dec 2012 17:57:58 +0800 Albert Wang <[email protected]> wrote:
This patch adds
get_mcam()inline function which is prepared for addingsoc_camerasupport in marvell-ccic driverTime for a bikeshed moment: "get" generally is understood to mean incrementing a reference count in kernel code. Can it have a name like
vbq_to_mcam()instead?Also:
Quoted 13 lines
drivers/media/platform/marvell-ccic/mcam-core.c +2
-1@@ -1073,14 +1073,17 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq,static void mcam_vb_buf_queue (struct vb2_buffer *vb) {struct mcam_vb_buffer *mvb =vb_to_mvb (vb); -struct mcam_camera *cam =vb2_get_drv_priv (vb->vb2_queue); +struct mcam_camera *cam =get_mcam (vb->vb2_queue);struct v4l2_pix_format *fmt = &cam->pix_format;unsigned long flags;int start;dma_addr_t dma_handle; +unsigned long size;u32 pixel_count = fmt->width * fmt->height;
Quoted 8 lines
drivers/media/platform/marvell-ccic/mcam-core.c static int mcam_vb_queue_setup(struct vb2_queue *vq, · line 1089
Quoted 6 lines
drivers/media/platform/marvell-ccic/mcam-core.c +2
-0spin_lock_irqsave (&cam->dev_lock, flags); + size =vb2_plane_size (vb,0 ); +vb2_set_plane_payload (vb,0 , size); dma_handle =vb2_dma_contig_plane_dma_addr (vb,0 );BUG_ON (!dma_handle); start = (cam->state ==S_BUFWAIT ) && !list_empty (&cam->buffers);There is an unrelated change here that belongs in a separate patch.
Right, agree.
Thanks
Guennadi
Quoted 34 lines
drivers/media/platform/marvell-ccic/mcam-core.c static void mcam_vb_wait_finish(struct vb2_queue *vq) · line 1149
Quoted 11 lines
drivers/media/platform/marvell-ccic/mcam-core.c +4
-1@@ -1138,9 +1141,12 @@ static void mcam_vb_wait_finish(struct vb2_queue *vq)*/ static int mcam_vb_start_streaming (struct vb2_queue *vq,unsigned int count) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);unsigned int frame; +if (count <2 ) +return -EINVAL ; +Here too - unrelated change.
Quoted 13 lines
drivers/media/platform/marvell-ccic/mcam-core.c +1
-1if (cam->state !=S_IDLE ) {INIT_LIST_HEAD (&cam->buffers);return -EINVAL ;@@ -1170,7 +1176,7 @@ static int mcam_vb_start_streaming(struct vb2_queue *vq, unsigned int count)static int mcam_vb_stop_streaming (struct vb2_queue *vq) { -struct mcam_camera *cam =vb2_get_drv_priv (vq); +struct mcam_camera *cam =get_mcam (vq);unsigned long flags;if (cam->state ==S_BUFWAIT ) {drivers/media/platform/marvell-ccic/mcam-core.c static int mcam_vb_stop_streaming(struct vb2_queue *vq) · line 1190
Quoted 4 lines
drivers/media/platform/marvell-ccic/mcam-core.c +1
-0@@ -1181,6 +1187,7 @@ static int mcam_vb_stop_streaming(struct vb2_queue *vq)if (cam->state !=S_STREAMING )return -EINVAL ;mcam_ctlr_stop_dma (cam); + cam->state =S_IDLE ;...and also here ...
Quoted 2 lines
jon
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
PATCH v3 10/15 marvell-ccic: split mcam-core into 2 parts for soc_camera support
In reply to Albert WangThis patch splits mcam-core into 2 parts to prepare for soc_camera support.
The first part remains in mcam-core.c. This part includes the HW operations and vb2 callback functions.
The second part is moved to mcam-core-standard.c. This part is relevant with the implementation of using V4L2.
--- drivers/media/platform/marvell-ccic/Makefile | 4 +- .../platform/marvell-ccic/mcam-core-standard.c | 820 +++++++++++++++++ .../platform/marvell-ccic/mcam-core-standard.h | 26 + drivers/media/platform/marvell-ccic/mcam-core.c | 944 +------------------- drivers/media/platform/marvell-ccic/mcam-core.h | 54 ++ 5 files changed, 939 insertions(+), 909 deletions(-) create mode 100644 drivers/media/platform/marvell-ccic/mcam-core-standard.c create mode 100644 drivers/media/platform/marvell-ccic/mcam-core-standard.h
drivers/media/platform/marvell-ccic/Makefile +2 -2
@@ -1,6 +1,6 @@ obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o cafe_ccic-y := cafe-driver.o mcam-core.o -obj-$(CONFIG_VIDEO_MMP_CAMERA) += mmp_camera.o -mmp_camera-y := mmp-driver.o mcam-core.o +obj-$(CONFIG_VIDEO_MMP_CAMERA) += mmp_camera_standard.o +mmp_camera_standard-y := mmp-driver.o mcam-core.o mcam-core-standard.o
drivers/media/platform/marvell-ccic/mcam-core-standard.c new file +820 -0
820 lines not on this page · raw message
drivers/media/platform/marvell-ccic/mcam-core-standard.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Marvell camera core structures. +* +* Copyright 2011 Jonathan Corbet [email protected] +*/ +extern bool mcam_alloc_bufs_at_read; +extern int mcam_n_dma_bufs; +extern int mcam_buffer_mode; +extern const struct vb2_ops mcam_vb2_sg_ops; +extern const struct vb2_ops mcam_vb2_ops; + +void mcam_ctlr_stop_dma (struct mcam_camera *cam); +int mcam_config_mipi (struct mcam_camera *mcam,int enable); +void mcam_ctlr_power_up (struct mcam_camera *cam); +void mcam_ctlr_power_down (struct mcam_camera *cam); +void mcam_free_dma_bufs (struct mcam_camera *cam); +void mcam_ctlr_dma_sg (struct mcam_camera *cam); +void mcam_dma_sg_done (struct mcam_camera *cam,int frame); +int mcam_check_dma_buffers (struct mcam_camera *cam); +void mcam_set_config_needed (struct mcam_camera *cam,int needed); +int __mcam_cam_reset (struct mcam_camera *cam); +int mcam_alloc_dma_bufs (struct mcam_camera *cam,int loadtime); +void mcam_ctlr_dma_contig (struct mcam_camera *cam); +void mcam_dma_contig_done (struct mcam_camera *cam,int frame); +void mcam_ctlr_dma_vmalloc (struct mcam_camera *cam); +void mcam_vmalloc_done (struct mcam_camera *cam,int frame);
drivers/media/platform/marvell-ccic/mcam-core.c +37 -907
1,140 lines not on this page · raw message
drivers/media/platform/marvell-ccic/mcam-core.h +54 -0
70 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts for soc_camera support
Quoted 7 lines · On Sat, 15 Dec 2012 17:57:59 +0800 Albert Wang <[email protected]> wrote:
This patch splits mcam-core into 2 parts to prepare for
soc_camerasupport.The first part remains in
mcam-core.c. This part includes the HW operations and vb2 callback functions.The second part is moved to
mcam-core-standard.c. This part is relevant with the implementation of using V4L2.
OK, I'll confess I'm still not 100% sold on this part. Can I repeat the questions I raised before?
- Is the soc_camera mode necessary? Is there something you're trying to do that can't be done without it? Or, at least, does it add sufficient benefit to be worth this work? It would be nice if the reasoning behind this change were put into the changelog.
- If the soc_camera change is deemed to be worthwhile, is there anything preventing you from doing it 100% so it's the only mode used?
The split as you've done it here is an improvement over what came before, but it still results in a lot of duplicated code; it also adds a *lot* of symbols to the global namespace. If this is really the only way then we'll find a way to make it work, but I'd like to be sure that we can't do something better.
Thanks,
jon
RE: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts for soc_camera support
Hi, Jonathan
Quoted 19 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:37
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts forsoc_camerasupportQuoted 7 lines · On Sat, 15 Dec 2012 17:57:59 +0800 Albert Wang <[email protected]> wrote:
This patch splits mcam-core into 2 parts to prepare for
soc_camerasupport.The first part remains in
mcam-core.c. This part includes the HW operations and vb2 callback functions.The second part is moved to
mcam-core-standard.c. This part is relevant with the implementation of using V4L2.
Quoted 8 lines
OK, I'll confess I'm still not 100% sold on this part. Can I repeat the questions I raised before?
- Is the
soc_cameramode necessary? Is there something you're trying to do that can't be done without it? Or, at least, does it add sufficient benefit to be worth this work? It would be nice if the reasoning behind this change were put into the changelog.
[Albert Wang] We just want to add one more option for user. :) And we split it to 2 parts because we want to keep the original mode.
Quoted 4 lines
- If the
soc_camerachange is deemed to be worthwhile, is there anything preventing you from doing it 100% so it's the only mode used?
[Albert Wang] No, but current all Marvell platform have used the soc_camera in camera driver. :) So we just hope the marvell-ccic can have this option. :)
Quoted 9 lines
The split as you've done it here is an improvement over what came before, but it still results in a lot of duplicated code; it also adds a *lot* of symbols to the global namespace. If this is really the only way then we'll find a way to make it work, but I'd like to be sure that we can't do something better.
Thanks,
jon
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts for soc_camera support
Quoted 8 lines · On Sun, 16 Dec 2012 14:12:11 -0800 Albert Wang <[email protected]> wrote:
Quoted 5 lines
- Is the
soc_cameramode necessary? Is there something you're trying to do that can't be done without it? Or, at least, does it add sufficient benefit to be worth this work? It would be nice if the reasoning behind this change were put into the changelog.[Albert Wang] We just want to add one more option for user. :) And we split it to 2 parts because we want to keep the original mode.
Quoted 6 lines
Quoted 4 lines
- If the
soc_camerachange is deemed to be worthwhile, is there anything preventing you from doing it 100% so it's the only mode used?[Albert Wang] No, but current all Marvell platform have used the
soc_camerain camera driver. :) So we just hope the marvell-ccic can have this option. :)
OK, so this, I think, is the one remaining point of disagreement here; unfortunately it's a biggish one.
Users, I believe, don't really care which underlying framework the driver is using; they just want a camera implementing the V4L2 spec. So, this particular option does not have any real value for them. But it has a real cost in terms of duplicated code, added complexity, and namespace pollution. If you believe I'm wrong, please tell me why, but I think that this option is not worth the cost.
The reason for the soc_camera conversion is because that's how your drivers do it — not necessarily the strongest of reasons. Of course, the reason for keeping things as they are is because that's how the in-tree drivers does it; not necessarily a whole lot stronger.
I'm not sold on the soc_camera conversion, but neither am I implacably opposed to it. But I *really* dislike the idea of having both, I don't see that leading to good things in the long run. So can I ask one more
time: if soc_camera is important to you, could you please just convert the driver over 100% and drop the other mode entirely? It seems that should be easier than trying to support both, and it should certainly be easier to maintain in the future.
I'm sorry to be obnoxious about this.
Meanwhile, the bulk of this last patch series seems good; most of them have my acks, and I saw acks from Guennadi on some as well. I would recommend that you separate those out into a different series and submit them for merging, presumably for 3.9. That will give you a bit less code to carry going forward as this last part gets worked out.
Thanks again for doing this work and persevering with it!
jon
RE: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts for soc_camera support
Hi, Jonathan
Quoted 42 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 23:29
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts forsoc_camerasupportQuoted 5 lines · On Sun, 16 Dec 2012 14:12:11 -0800 Albert Wang <[email protected]> wrote:
Quoted 5 lines
- Is the
soc_cameramode necessary? Is there something you're trying to do that can't be done without it? Or, at least, does it add sufficient benefit to be worth this work? It would be nice if the reasoning behind this change were put into the changelog.Quoted 8 lines
[Albert Wang] We just want to add one more option for user. :) And we split it to 2 parts because we want to keep the original mode.
Quoted 4 lines
- If the
soc_camerachange is deemed to be worthwhile, is there anything preventing you from doing it 100% so it's the only mode used?[Albert Wang] No, but current all Marvell platform have used the
soc_camerain cameradriver. :)
Quoted 1 line
So we just hope the marvell-ccic can have this option. :)
OK, so this, I think, is the one remaining point of disagreement here; unfortunately it's a biggish one.
Users, I believe, don't really care which underlying framework the driver is using; they just want a camera implementing the V4L2 spec. So, this particular option does not have any real value for them. But it has a real cost in terms of duplicated code, added complexity, and namespace pollution. If you believe I'm wrong, please tell me why, but I think that this option is not worth the cost.
The reason for the
soc_cameraconversion is because that's how your drivers do it — not necessarily the strongest of reasons. Of course, the reason for keeping things as they are is because that's how the in-tree drivers does it; not necessarily a whole lot stronger.
Quoted 8 lines
I'm not sold on the
soc_cameraconversion, but neither am I implacably opposed to it. But I *really* dislike the idea of having both, I don't see that leading to good things in the long run. So can I ask one more
time: ifsoc_camerais important to you, could you please just convert the driver over 100% and drop the other mode entirely? It seems that should be easier than trying to support both, and it should certainly be easier to maintain in the future.
[Albert Wang] So if we add B_DMA_SG and B_VMALLOC support and OLPC XO 1.0 support in soc_camera mode. Then we can just remove the original mode and only support soc_camera mode in marvell-ccic?
Quoted 11 lines
I'm sorry to be obnoxious about this.
Meanwhile, the bulk of this last patch series seems good; most of them have my acks, and I saw acks from Guennadi on some as well. I would recommend that you separate those out into a different series and submit them for merging, presumably for 3.9. That will give you a bit less code to carry going forward as this last part gets worked out.
Thanks again for doing this work and persevering with it!
jon
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts for soc_camera support
Quoted 2 lines · On Mon, 17 Dec 2012 19:04:26 -0800 Albert Wang <[email protected]> wrote:
[Albert Wang] So if we add
B_DMA_SGandB_VMALLOCsupport and OLPC XO 1.0 support insoc_cameramode. Then we can just remove the original mode and only supportsoc_cameramode in marvell-ccic?
That is the idea, yes. Unless there is some real value to supporting both modes (that I've not seen), I think it's far better to support just one of them. Trying to support duplicated modes just leads to pain in the long run, in my experience.
I can offer to *try* to find time to help with XO 1.0 testing when the time comes.
Thanks,
jon
RE: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts for soc_camera support
Hi, Jonathan
Quoted 12 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Wednesday, 19 December, 2012 03:15
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts forsoc_camerasupportQuoted 1 line · On Mon, 17 Dec 2012 19:04:26 -0800 Albert Wang <[email protected]> wrote:
[Albert Wang] So if we add
B_DMA_SGandB_VMALLOCsupport and OLPC XO 1.0
Quoted 9 lines
support in
soc_cameramode.Quoted 1 line
Then we can just remove the original mode and only support
soc_cameramode inmarvell-ccic?
That is the idea, yes. Unless there is some real value to supporting both modes (that I've not seen), I think it's far better to support just one of them. Trying to support duplicated modes just leads to pain in the long run, in my experience.
[Albert Wang] OK, we will update and submit the remained patches except for the 3 patches related with soc_camera support as the first part. Then we will submit the soc_camera support patches after we rework the patches and add B_DMA_SG and B_VMALLOC support and OLPC XO 1.0 support.
Quoted 3 lines
I can offer to *try* to find time to help with XO 1.0 testing when the time comes.
[Albert Wang] Thank you very much! We were worried about how to get the OLPC XO 1.0 HW. That would be a great help! :)
Quoted 3 lines
Thanks,
jon
Thanks
Albert Wang
86-21-61092656
RE: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts for soc_camera support
In reply to Jonathan CorbetHi, Jonathan
As you know, we are working on adding B_DMA_SG support on soc_camera mode.
We found there is some code we can't understand in irq handler:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
if (handled == IRQ_HANDLED) {
set_bit(CF_DMA_ACTIVE, &cam->flags);
if (cam->buffer_mode == B_DMA_sg)
mcam_ctlr_stop(cam);
}<<<<<<
The question is why we need stop ccic in irq handler when buffer mode is B_DMA_sg?
Quoted 1 line
Quoted 1 line
Quoted 1 line
if (cam->buffer_mode == B_DMA_sg) mcam_ctlr_stop(cam);
<<<
Currently we tested B_DMA_sg mode on our platform, and this buffer mode can work only if we comment these 2 lines.
Could you please help us take a look if you have time?
Thank you very much for your help! :)
Thanks
Albert Wang
86-21-61092656
Quoted 51 lines
-----Original Message-----
From: Albert Wang
Sent: Wednesday, 19 December, 2012 04:48
To: 'Jonathan Corbet'
Cc: [email protected]; [email protected]; Libin Yang
Subject: RE: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts forsoc_camerasupportHi, Jonathan
Quoted 12 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Wednesday, 19 December, 2012 03:15
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts forsoc_camerasupportQuoted 1 line · On Mon, 17 Dec 2012 19:04:26 -0800 Albert Wang <[email protected]> wrote:
[Albert Wang] So if we add
B_DMA_SGandB_VMALLOCsupport and OLPC XO 1.0Quoted 9 lines
support in
soc_cameramode.Quoted 1 line
Then we can just remove the original mode and only support
soc_cameramode inmarvell-ccic?
That is the idea, yes. Unless there is some real value to supporting both modes (that I've not seen), I think it's far better to support just one of them. Trying to support duplicated modes just leads to pain in the long run, in my experience.
[Albert Wang] OK, we will update and submit the remained patches except for the 3 patches related with
soc_camerasupport as the first part.
Then we will submit thesoc_camerasupport patches after we rework the patches and addB_DMA_SGandB_VMALLOCsupport and OLPC XO 1.0 support.Quoted 3 lines
I can offer to *try* to find time to help with XO 1.0 testing when the time comes.
[Albert Wang] Thank you very much! We were worried about how to get the OLPC XO 1.0 HW. That would be a great help! :)
Quoted 3 lines
Thanks,
jon
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts for soc_camera support
My apologies for the slow response...I'm running far behind.
Quoted 4 lines · On Thu, 31 Jan 2013 00:29:13 -0800 Albert Wang <[email protected]> wrote:
As you know, we are working on adding
B_DMA_SGsupport onsoc_cameramode.We found there is some code we can't understand in irq handler:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 8 lines
if (handled == IRQ_HANDLED) { set_bit(CF_DMA_ACTIVE, &cam->flags); if (cam->buffer_mode == B_DMA_sg) mcam_ctlr_stop(cam); }<<<<<<
The question is why we need stop ccic in irq handler when buffer mode is
B_DMA_sg?
That's actually intended to be addressed by this comment in the DMA setup code:
/*
* Frame completion with S/G is trickier. We can't muck with
* a descriptor chain on the fly, since the controller buffers it
* internally. So we have to actually stop and restart; Marvell
* says this is the way to do it.
*
...and, indeed, at the time, I was told by somebody at Marvell that I needed to stop the controller before I could store a new descriptor into the chain. I don't see how it could work otherwise, really?
I'd be happy to see this code go, it always felt a bit hacky. But the controller buffers the descriptor chain deep inside its unreachable guts, so one has to mess with it carefully.
Thanks,
jon
RE: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts for soc_camera support
Hi, Jonathan
Thanks a lot for explaining it. :)
Quoted 36 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Tuesday, 05 February, 2013 11:14
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 10/15] [media] marvell-ccic: split mcam-core into 2 parts forsoc_camerasupportMy apologies for the slow response...I'm running far behind.
Quoted 4 lines · On Thu, 31 Jan 2013 00:29:13 -0800 Albert Wang <[email protected]> wrote:
As you know, we are working on adding
B_DMA_SGsupport onsoc_cameramode.We found there is some code we can't understand in irq handler:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 8 lines
if (handled == IRQ_HANDLED) { set_bit(CF_DMA_ACTIVE, &cam->flags); if (cam->buffer_mode == B_DMA_sg) mcam_ctlr_stop(cam); }<<<<<<
The question is why we need stop ccic in irq handler when buffer mode is
B_DMA_sg?That's actually intended to be addressed by this comment in the DMA setup code:
/*
* Frame completion with S/G is trickier. We can't muck with
* a descriptor chain on the fly, since the controller buffers it
* internally. So we have to actually stop and restart; Marvell
* says this is the way to do it.
*
Quoted 4 lines
...and, indeed, at the time, I was told by somebody at Marvell that I needed to stop the controller before I could store a new descriptor into the chain. I don't see how it could work otherwise, really?
[Albert Wang] Em.., maybe I guess there was some flaw in old version. We indeed can work on current platform without the code.
Quoted 4 lines
I'd be happy to see this code go, it always felt a bit hacky. But the controller buffers the descriptor chain deep inside its unreachable guts, so one has to mess with it carefully.
[Albert Wang] I suppose your platform should work with the original code.
So how do you think this time we will keep the original code in the patches?
If there is something wrong with it when you test the patches on your platform, maybe we can try to change it. :
Quoted 3 lines
Thanks,
jon
Thanks
Albert Wang
86-21-61092656
PATCH v3 11/15 marvell-ccic: add soc_camera support in mcam core
In reply to Albert WangThis patch adds the soc_camera support in mcam core.
It creates the file mcam-core-soc.c and mcam-core-soc.h to support soc_camera in mcam core.
To use the soc_camera feature, platform driver, such as mmp-driver.c, should also be modified.
--- drivers/media/platform/marvell-ccic/Makefile | 2 + .../media/platform/marvell-ccic/mcam-core-soc.c | 416 ++++++++++++++++++++ .../media/platform/marvell-ccic/mcam-core-soc.h | 19 + drivers/media/platform/marvell-ccic/mcam-core.c | 2 +- drivers/media/platform/marvell-ccic/mcam-core.h | 31 ++ include/media/mmp-camera.h | 3 + 6 files changed, 472 insertions(+), 1 deletion(-) create mode 100644 drivers/media/platform/marvell-ccic/mcam-core-soc.c create mode 100644 drivers/media/platform/marvell-ccic/mcam-core-soc.h
drivers/media/platform/marvell-ccic/Makefile +2 -0
@@ -4,3 +4,5 @@ cafe_ccic-y := cafe-driver.o mcam-core.o obj-$(CONFIG_VIDEO_MMP_CAMERA) += mmp_camera_standard.o mmp_camera_standard-y := mmp-driver.o mcam-core.o mcam-core-standard.o +obj-$(CONFIG_VIDEO_MMP_SOC_CAMERA) += mmp_camera_soc.o +mmp_camera_soc-y := mmp-driver.o mcam-core.o mcam-core-soc.o
drivers/media/platform/marvell-ccic/mcam-core-soc.c new file +416 -0
416 lines not on this page · raw message
drivers/media/platform/marvell-ccic/mcam-core-soc.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Marvell camera core structures. +* +* Copyright (C) 2009-2012 Marvell International Ltd. +* +* Author: Libin Yang <[email protected]> +* Albert Wang <[email protected]> +* +*/ +extern const struct vb2_ops mcam_vb2_ops; + +void mcam_ctlr_power_up (struct mcam_camera *cam); +void mcam_ctlr_power_down (struct mcam_camera *cam); +void mcam_dma_contig_done (struct mcam_camera *cam,int frame); +void mcam_ctlr_stop (struct mcam_camera *cam); +int mcam_config_mipi (struct mcam_camera *mcam,int enable); +void mcam_ctlr_image (struct mcam_camera *cam); +void mcam_set_config_needed (struct mcam_camera *cam,int needed); +void mcam_ctlr_dma_contig (struct mcam_camera *cam);
drivers/media/platform/marvell-ccic/mcam-core.c +1 -1
@@ -154,7 +154,7 @@ static void mcam_ctlr_start(struct mcam_camera *cam)mcam_reg_set_bit (cam,REG_CTRL0 ,C0_ENABLE ); } -static void mcam_ctlr_stop (struct mcam_camera *cam) +void mcam_ctlr_stop (struct mcam_camera *cam) {mcam_reg_clear_bit (cam,REG_CTRL0 ,C0_ENABLE ); }
drivers/media/platform/marvell-ccic/mcam-core.h +31 -0
@@ -10,6 +10,8 @@#include <media/v4l2-common.h> #include <media/v4l2-dev.h> #include <media/videobuf2-core.h> +#include <media/soc_camera.h> +#include <media/soc_mediabus.h> /* * Create our own symbols for the supported buffer modes, but, for now,
@@ -32,8 +34,13 @@#error One of the videobuf buffer modes must be selected in the config#endif +#ifdef CONFIG_VIDEO_MRVL_SOC_CAMERA +#define sensor_call(cam, o, f, args...) \ + v4l2_subdev_call(soc_camera_to_subdev(cam->icd), o, f, ##args) +#else #define sensor_call(cam, o, f, args...) \ v4l2_subdev_call(cam->sensor, o, f, ##args) +#endif /* * Debugging and related.
@@ -102,6 +109,10 @@ struct mcam_frame_state {*/ #define NR_MCAM_CLK 4struct mcam_camera { +#ifdef CONFIG_VIDEO_MRVL_SOC_CAMERA +struct soc_camera_host soc_host; +struct soc_camera_device *icd; +#endif /* * These fields should be set by the platform code prior to * calling mcam_register().
@@ -115,6 +126,11 @@ struct mcam_camera {short int use_smbus;/* SMBUS or straight I2c? */ enum mcam_buffer_mode buffer_mode; +int mclk_min; +int mclk_src; +int mclk_div; +char *card_name; +int ccic_id;enum v4l2_mbus_type bus_type;/* MIPI support */
@@ -258,10 +274,20 @@ static inline void mcam_reg_set_bit(struct mcam_camera *cam,mcam_reg_write_mask (cam, reg, val, val); } +#ifdef CONFIG_VIDEO_MRVL_SOC_CAMERA +static inline struct mcam_camera *get_mcam (struct vb2_queue *vq) +{ +struct soc_camera_device *icd =container_of (vq, + struct soc_camera_device, vb2_vidq); +struct soc_camera_host *ici =to_soc_camera_host (icd->parent); +return ici->priv; +} +#else static inline struct mcam_camera *get_mcam (struct vb2_queue *vq) {return vb2_get_drv_priv (vq); } +#endif /* * Functions for use by platform code.
@@ -273,6 +299,9 @@ void mccic_shutdown(struct mcam_camera *cam);void mccic_suspend (struct mcam_camera *cam);int mccic_resume (struct mcam_camera *cam);#endif +#ifdef CONFIG_VIDEO_MRVL_SOC_CAMERA +int mcam_soc_camera_host_register (struct mcam_camera *mcam); +#endif /* * Register definitions for the m88alp01 camera interface. Offsets in bytes
@@ -377,6 +406,7 @@ int mccic_resume(struct mcam_camera *cam);/* Bits below C1_444ALPHA are not present in Cafe */ #define REG_CTRL1 0x40/* Control 1 */ #define C1_CLKGATE 0x00000001/* Sensor clock gate */ +#define C1_RESERVED 0x0000003c/* Reserved and shouldn't be changed */ #define C1_DESC_ENA 0x00000100/* DMA descriptor enable */ #define C1_DESC_3WORD 0x00000200/* Three-word descriptors used */ #define C1_444ALPHA 0x00f00000/* Alpha field in RGB444 */
@@ -387,6 +417,7 @@ int mccic_resume(struct mcam_camera *cam);#define C1_DMAB_MASK 0x06000000#define C1_TWOBUFS 0x08000000/* Use only two DMA buffers */ #define C1_PWRDWN 0x10000000/* Power down */ +#define C1_DMAPOSTED 0x40000000/* DMA Posted Select */ #define REG_CTRL3 0x1ec/* CCIC parallel mode */ #define REG_CLKCTRL 0x88/* Clock control */
include/media/mmp-camera.h +3 -0
@@ -8,6 +8,9 @@ struct mmp_camera_platform_data {int sensor_power_gpio;int sensor_reset_gpio;enum v4l2_mbus_type bus_type; +int mclk_min; +int mclk_src; +int mclk_div;/* * MIPI support */
Signature · 1 line
1.7.9.5
PATCH v3 12/15 marvell-ccic: add soc_camera support in mmp driver
In reply to Albert WangThis patch adds the soc_camera support in the platform driver: mmp-driver.c. Specified board driver also should be modified to support soc_camera by passing some platform datas to platform driver.
Currently the soc_camera mode in mmp driver only supports B_DMA_contig mode.
--- drivers/media/platform/Makefile | 4 +- drivers/media/platform/marvell-ccic/Kconfig | 22 ++++ drivers/media/platform/marvell-ccic/mmp-driver.c | 147 ++++++++++++++-------- include/media/mmp-camera.h | 2 + 4 files changed, 120 insertions(+), 55 deletions(-)
drivers/media/platform/Makefile +2 -2
@@ -11,8 +11,6 @@ obj-$(CONFIG_VIDEO_TIMBERDALE) += timblogiw.o obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o -obj-$(CONFIG_VIDEO_CAFE_CCIC) += marvell-ccic/ -obj-$(CONFIG_VIDEO_MMP_CAMERA) += marvell-ccic/ obj-$(CONFIG_VIDEO_OMAP2) += omap2cam.o obj-$(CONFIG_VIDEO_OMAP3) += omap3isp/
@@ -43,6 +41,8 @@ obj-$(CONFIG_VIDEO_SH_VOU) += sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_VIDEO_MARVELL_CCIC) += marvell-ccic/ + obj-y += davinci/ obj-$(CONFIG_ARCH_OMAP) += omap/
drivers/media/platform/marvell-ccic/Kconfig +22 -0
@@ -1,23 +1,45 @@ +config VIDEO_MARVELL_CCIC + tristate +config VIDEO_MRVL_SOC_CAMERA + bool + config VIDEO_CAFE_CCIC tristate "Marvell 88ALP01 (Cafe) CMOS Camera Controller support" depends on PCI && I2C && VIDEO_V4L2 select VIDEO_OV7670 select VIDEOBUF2_VMALLOC select VIDEOBUF2_DMA_CONTIG + select VIDEO_MARVELL_CCIC ---help--- This is a video4linux2 driver for the Marvell 88ALP01 integrated CMOS camera controller. This is the controller found on first- generation OLPC systems. +choice + prompt "Camera support on Marvell MMP" + depends on ARCH_MMP && VIDEO_V4L2 + optional config VIDEO_MMP_CAMERA tristate "Marvell Armada 610 integrated camera controller support" depends on ARCH_MMP && I2C && VIDEO_V4L2 select VIDEO_OV7670 select I2C_GPIO select VIDEOBUF2_DMA_SG + select VIDEO_MARVELL_CCIC ---help--- This is a Video4Linux2 driver for the integrated camera controller found on Marvell Armada 610 application processors (and likely beyond). This is the controller found in OLPC XO 1.75 systems. +config VIDEO_MMP_SOC_CAMERA + bool "Marvell MMP camera driver based on SOC_CAMERA" + depends on VIDEO_DEV && SOC_CAMERA && ARCH_MMP && VIDEO_V4L2 + select VIDEOBUF2_DMA_CONTIG + select VIDEO_MARVELL_CCIC + select VIDEO_MRVL_SOC_CAMERA + ---help--- + This is a Video4Linux2 driver for the Marvell Mobile Soc + PXA910/PXA688/PXA2128/PXA988 CCIC + (CMOS Camera Interface Controller) +endchoice
drivers/media/platform/marvell-ccic/mmp-driver.c +94 -53
225 lines not on this page · raw message
include/media/mmp-camera.h +2 -0
@@ -7,10 +7,12 @@ struct mmp_camera_platform_data {struct platform_device *i2c_device;int sensor_power_gpio;int sensor_reset_gpio; +char name[16 ];enum v4l2_mbus_type bus_type;int mclk_min;int mclk_src;int mclk_div; +int chip_id;/* * MIPI support */
Signature · 1 line
1.7.9.5
Re: [PATCH V3 12/15] [media] marvell-ccic: add soc_camera support in mmp driver
Quoted 5 lines · On Sat, 15 Dec 2012 17:58:01 +0800 Albert Wang <[email protected]> wrote:
This patch adds the
soc_camerasupport in the platform driver:mmp-driver.c. Specified board driver also should be modified to supportsoc_cameraby passing some platform datas to platform driver.Currently the
soc_cameramode in mmp driver only supportsB_DMA_contigmode.
You do intend to add the other modes (or SG, at least) in the future?
drivers/media/platform/marvell-ccic/Kconfig line 4
Quoted 7 lines
drivers/media/platform/marvell-ccic/Kconfig +4
-0@@ -1,23 +1,45 @@ +config VIDEO_MARVELL_CCIC + tristate +config VIDEO_MRVL_SOC_CAMERA + bool
If Linus sees this you'll get an unpleasant reminder that vowels are not actually in short supply; I'd suggest spelling out "MARVELL".
Quoted 16 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +4
-0@@ -28,6 +28,10 @@#include <linux/list.h> #include <linux/pm.h> #include <linux/clk.h> +#include <linux/regulator/consumer.h> +#include <media/videobuf2-dma-contig.h> +#include <media/soc_camera.h> +#include <media/soc_mediabus.h> #include "mcam-core.h"
drivers/media/platform/marvell-ccic/mmp-driver.c struct mmp_camera { · line 48
Quoted 5 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0@@ -40,6 +44,8 @@ struct mmp_camera {struct platform_device *pdev;struct mcam_camera mcam;struct list_head devlist; +/* will change here */ +struct clk *clk[3 ];/* CCIC_GATE, CCIC_RST, CCIC_DBG clocks */
What does that comment mean?
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_up(struct mcam_camera *mcam) · line 153
Quoted 11 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-3int irq; };@@ -144,15 +150,17 @@ static void mmpcam_power_up(struct mcam_camera *mcam)* Provide power to the sensor. */ mcam_reg_write (mcam,REG_CLKCTRL ,0x60000002 ); - pdata = cam->pdev->dev.platform_data; -gpio_set_value (pdata->sensor_power_gpio,1 ); -mdelay (5 ); +if (mcam->chip_id ==V4L2_IDENT_ARMADA610 ) {
I'm seeing a lot of these tests being added to the code. I can imagine more in the future as new chipsets are supported in the driver. Maybe it's time to add a structure to hide chipset-specific low-level operations? It would make the code a lot cleaner.
Actually, things like mmpcam_power_up() were meant to be exactly that. Can we just define a different version of this function for different chipsets?
Quoted 20 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +9
-5+ pdata = cam->pdev->dev.platform_data; +gpio_set_value (pdata->sensor_power_gpio,1 ); +mdelay (5 ); +/* reset is active low */ +gpio_set_value (pdata->sensor_reset_gpio,0 ); +mdelay (5 ); +gpio_set_value (pdata->sensor_reset_gpio,1 ); +mdelay (5 ); + }mcam_reg_clear_bit (mcam,REG_CTRL1 ,0x10000000 ); -gpio_set_value (pdata->sensor_reset_gpio,0 );/* reset is active low */ -mdelay (5 ); -gpio_set_value (pdata->sensor_reset_gpio,1 );/* reset is active low */ -mdelay (5 ); -mcam_clk_set (mcam,1 ); }@@ -165,13 +173,14 @@ static void mmpcam_power_down(struct mcam_camera *mcam)*/
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera *mcam) · line 176
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-7iowrite32 (0 , cam->power_regs +REG_CCIC_DCGCR );iowrite32 (0 , cam->power_regs +REG_CCIC_CRCR ); -/* -* Shut down the sensor. -*/ - pdata = cam->pdev->dev.platform_data; -gpio_set_value (pdata->sensor_power_gpio,0 ); -gpio_set_value (pdata->sensor_reset_gpio,0 ); - +if (mcam->chip_id ==V4L2_IDENT_ARMADA610 ) {
Same comment applies here.
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera *mcam) · line 184
Quoted 8 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +7
-0+/* +* Shut down the sensor. +*/ + pdata = cam->pdev->dev.platform_data; +gpio_set_value (pdata->sensor_power_gpio,0 ); +gpio_set_value (pdata->sensor_reset_gpio,0 ); + }mcam_clk_set (mcam,0 );
jon
RE: [PATCH V3 12/15] [media] marvell-ccic: add soc_camera support in mmp driver
Hi, Jonathan
Quoted 11 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:46
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 12/15] [media] marvell-ccic: addsoc_camerasupport in mmp driverOn Sat, 15 Dec 2012 17:58:01 +0800
Albert Wang <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
This patch adds the
soc_camerasupport in the platform driver:mmp-driver.c. Specified board driver also should be modified to supportsoc_cameraby passing some platform datas to platform driver.Currently the
soc_cameramode in mmp driver only supportsB_DMA_contigmode.You do intend to add the other modes (or SG, at least) in the future?
[Albert Wang] Yes, if need we can add the other modes in the future.
Quoted 11 lines
drivers/media/platform/marvell-ccic/Kconfig line 4
Quoted 7 lines
drivers/media/platform/marvell-ccic/Kconfig +4
-0@@ -1,23 +1,45 @@ +config VIDEO_MARVELL_CCIC + tristate +config VIDEO_MRVL_SOC_CAMERA + boolIf Linus sees this you'll get an unpleasant reminder that vowels are not actually in short supply; I'd suggest spelling out "MARVELL".
[Albert Wang] Sorry, we will change it.
Quoted 16 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mmp-driver.cQuoted 14 lines
index 40c243e..cd850f4 100755
drivers/media/platform/marvell-ccic/mmp-driver.c +4
-0@@ -28,6 +28,10 @@#include <linux/list.h> #include <linux/pm.h> #include <linux/clk.h> +#include <linux/regulator/consumer.h> +#include <media/videobuf2-dma-contig.h> +#include <media/soc_camera.h> +#include <media/soc_mediabus.h> #include "mcam-core.h"
Quoted 9 lines
drivers/media/platform/marvell-ccic/mmp-driver.c struct mmp_camera { · line 48
Quoted 6 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +2
-0@@ -40,6 +44,8 @@ struct mmp_camera {struct platform_device *pdev;struct mcam_camera mcam;struct list_head devlist; +/* will change here */ +struct clk *clk[3 ];/* CCIC_GATE, CCIC_RST, CCIC_DBG clocks */ What does that comment mean?
[Albert Wang] It means there are 3 clk setting, gate_clk, rst_clk, dbg_clk. Forgive me, the name of CCIC_DBG register is not good, but it's our actual register name. :(
Quoted 5 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_up(struct mcam_camera
Quoted 4 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +0
-0int irq; };@@ -144,15 +150,17 @@ static void mmpcam_power_up(struct mcam_camera*mcam)
Quoted 13 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_up(struct mcam_camera *mcam) · line 153
Quoted 7 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-3* Provide power to the sensor. */ mcam_reg_write (mcam,REG_CLKCTRL ,0x60000002 ); - pdata = cam->pdev->dev.platform_data; -gpio_set_value (pdata->sensor_power_gpio,1 ); -mdelay (5 ); +if (mcam->chip_id ==V4L2_IDENT_ARMADA610 ) {I'm seeing a lot of these tests being added to the code. I can imagine more in the future as new chipsets are supported in the driver. Maybe it's time to add a structure to hide chipset-specific low-level operations? It would make the code a lot cleaner.
[Albert Wang] OK, we will do it.
Quoted 3 lines
Actually, things like
mmpcam_power_up()were meant to be exactly that. Can we just define a different version of this function for different chipsets?
[Albert Wang] Sure.
Quoted 34 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera
Quoted 19 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +9
-5+ pdata = cam->pdev->dev.platform_data; +gpio_set_value (pdata->sensor_power_gpio,1 ); +mdelay (5 ); +/* reset is active low */ +gpio_set_value (pdata->sensor_reset_gpio,0 ); +mdelay (5 ); +gpio_set_value (pdata->sensor_reset_gpio,1 ); +mdelay (5 ); + }mcam_reg_clear_bit (mcam,REG_CTRL1 ,0x10000000 ); -gpio_set_value (pdata->sensor_reset_gpio,0 );/* reset is active low */ -mdelay (5 ); -gpio_set_value (pdata->sensor_reset_gpio,1 );/* reset is active low */ -mdelay (5 ); -mcam_clk_set (mcam,1 ); }@@ -165,13 +173,14 @@ static void mmpcam_power_down(struct mcam_camera*mcam)
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera *mcam) · line 176
Quoted 11 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +1
-7*/ iowrite32 (0 , cam->power_regs +REG_CCIC_DCGCR );iowrite32 (0 , cam->power_regs +REG_CCIC_CRCR ); -/* -* Shut down the sensor. -*/ - pdata = cam->pdev->dev.platform_data; -gpio_set_value (pdata->sensor_power_gpio,0 ); -gpio_set_value (pdata->sensor_reset_gpio,0 ); - +if (mcam->chip_id ==V4L2_IDENT_ARMADA610 ) {Same comment applies here.
Quoted 10 lines
drivers/media/platform/marvell-ccic/mmp-driver.c static void mmpcam_power_down(struct mcam_camera *mcam) · line 184
Quoted 8 lines
drivers/media/platform/marvell-ccic/mmp-driver.c +7
-0+/* +* Shut down the sensor. +*/ + pdata = cam->pdev->dev.platform_data; +gpio_set_value (pdata->sensor_power_gpio,0 ); +gpio_set_value (pdata->sensor_reset_gpio,0 ); + }mcam_clk_set (mcam,0 );jon
Thanks
Albert Wang
86-21-61092656
PATCH v3 13/15 marvell-ccic: add dma burst mode support in marvell-ccic driver
In reply to Albert WangThis patch adds the dma burst size config support for marvell-ccic. Developer can set the dma burst size in specified board driver.
--- .../media/platform/marvell-ccic/mcam-core-soc.c | 2 +- drivers/media/platform/marvell-ccic/mcam-core.h | 7 ++++--- drivers/media/platform/marvell-ccic/mmp-driver.c | 11 +++++++++++ include/media/mmp-camera.h | 1 + 4 files changed, 17 insertions(+), 4 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core-soc.c +1 -1
@@ -83,7 +83,7 @@ static int mcam_camera_add_device(struct soc_camera_device *icd)mcam_ctlr_stop (mcam);mcam_set_config_needed (mcam,1 );mcam_reg_write (mcam,REG_CTRL1 , -C1_RESERVED |C1_DMAPOSTED ); + mcam->burst |C1_RESERVED |C1_DMAPOSTED );mcam_reg_write (mcam,REG_CLKCTRL , (mcam->mclk_src <<29 ) | mcam->mclk_div);cam_dbg (mcam,"camera: set sensor mclk = %dMHz\n" , mcam->mclk_min);
drivers/media/platform/marvell-ccic/mcam-core.h +4 -3
@@ -126,6 +126,7 @@ struct mcam_camera {short int use_smbus;/* SMBUS or straight I2c? */ enum mcam_buffer_mode buffer_mode; +int burst;int mclk_min;int mclk_src;int mclk_div;
@@ -411,9 +412,9 @@ int mcam_soc_camera_host_register(struct mcam_camera *mcam);#define C1_DESC_3WORD 0x00000200/* Three-word descriptors used */ #define C1_444ALPHA 0x00f00000/* Alpha field in RGB444 */ #define C1_ALPHA_SHFT 20 -#define C1_DMAB32 0x00000000/* 32-byte DMA burst */ -#define C1_DMAB16 0x02000000/* 16-byte DMA burst */ -#define C1_DMAB64 0x04000000/* 64-byte DMA burst */ +#define C1_DMAB64 0x00000000/* 64-byte DMA burst */ +#define C1_DMAB128 0x02000000/* 128-byte DMA burst */ +#define C1_DMAB256 0x04000000/* 256-byte DMA burst */ #define C1_DMAB_MASK 0x06000000#define C1_TWOBUFS 0x08000000/* Use only two DMA buffers */ #define C1_PWRDWN 0x10000000/* Power down */
drivers/media/platform/marvell-ccic/mmp-driver.c +11 -0
@@ -400,6 +400,17 @@ static int mmpcam_probe(struct platform_device *pdev) mcam->dphy = pdata->dphy; mcam->mipi_enabled =0 ; mcam->lane = pdata->lane; +switch (pdata->dma_burst) { +case 128 : + mcam->burst =C1_DMAB128 ; +break ; +case 256 : + mcam->burst =C1_DMAB256 ; +break ; +default : + mcam->burst =C1_DMAB64 ; +break ; + }INIT_LIST_HEAD (&mcam->buffers);/*
include/media/mmp-camera.h +1 -0
@@ -13,6 +13,7 @@ struct mmp_camera_platform_data {int mclk_src;int mclk_div;int chip_id; +int dma_burst;/* * MIPI support */
Signature · 1 line
1.7.9.5
Re: [PATCH V3 13/15] [media] marvell-ccic: add dma burst mode support in marvell-ccic driver
drivers/media/platform/marvell-ccic/mcam-core.h struct mcam_camera { · line 129
Quoted 12 lines · On Sat, 15 Dec 2012 17:58:02 +0800 Albert Wang <[email protected]> wrote:
This patch adds the dma burst size config support for marvell-ccic. Developer can set the dma burst size in specified board driver.
drivers/media/platform/marvell-ccic/mcam-core.h +1
-0@@ -126,6 +126,7 @@ struct mcam_camera {short int use_smbus;/* SMBUS or straight I2c? */ enum mcam_buffer_mode buffer_mode; +int burst;
That's a register flag value, seems it should be unsigned (says the guy who is admittedly sloppy about such things).
drivers/media/platform/marvell-ccic/mcam-core.h int mcam_soc_camera_host_register(struct mcam_camera *mcam); · line 417
Quoted 13 lines
drivers/media/platform/marvell-ccic/mcam-core.h +3
-3int mclk_min;int mclk_src;int mclk_div;@@ -411,9 +412,9 @@ int mcam_soc_camera_host_register(struct mcam_camera *mcam);#define C1_DESC_3WORD 0x00000200/* Three-word descriptors used */ #define C1_444ALPHA 0x00f00000/* Alpha field in RGB444 */ #define C1_ALPHA_SHFT 20 -#define C1_DMAB32 0x00000000/* 32-byte DMA burst */ -#define C1_DMAB16 0x02000000/* 16-byte DMA burst */ -#define C1_DMAB64 0x04000000/* 64-byte DMA burst */ +#define C1_DMAB64 0x00000000/* 64-byte DMA burst */ +#define C1_DMAB128 0x02000000/* 128-byte DMA burst */ +#define C1_DMAB256 0x04000000/* 256-byte DMA burst */
Interesting, did I just get those wrong somehow? Or might they have been different in the Cafe days?
jon
RE: [PATCH V3 13/15] [media] marvell-ccic: add dma burst mode support in marvell-ccic driver
Hi, Jonathan
Quoted 23 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:49
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 13/15] [media] marvell-ccic: add dma burst mode support in marvell-ccic driverReview
Quoted 4 lines · On Sat, 15 Dec 2012 17:58:02 +0800 Albert Wang <[email protected]> wrote:
This patch adds the dma burst size config support for marvell-ccic. Developer can set the dma burst size in specified board driver.
(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mcam-core.hQuoted 7 lines
index 57442e0..e1025f2 100755
drivers/media/platform/marvell-ccic/mcam-core.h +0
-0@@ -126,6 +126,7 @@ struct mcam_camera {short int use_smbus;/* SMBUS or straight I2c? */ enum mcam_buffer_mode buffer_mode;
Quoted 5 lines
drivers/media/platform/marvell-ccic/mcam-core.h struct mcam_camera { · line 129
Quoted 1 line
drivers/media/platform/marvell-ccic/mcam-core.h +1
-0+int burst;That's a register flag value, seems it should be unsigned (says the guy who is admittedly sloppy about such things).
[Albert Wang] Yes, you are right.
Quoted 5 lines
drivers/media/platform/marvell-ccic/mcam-core.h int mcam_soc_camera_host_register(struct mcam_camera
Quoted 4 lines
drivers/media/platform/marvell-ccic/mcam-core.h +0
-0int mclk_min;int mclk_src;int mclk_div;@@ -411,9 +412,9 @@ int mcam_soc_camera_host_register(struct mcam_camera*mcam);
Quoted 13 lines
drivers/media/platform/marvell-ccic/mcam-core.h int mcam_soc_camera_host_register(struct mcam_camera *mcam); · line 417
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.h +3
-3#define C1_DESC_3WORD 0x00000200/* Three-word descriptors used */ #define C1_444ALPHA 0x00f00000/* Alpha field in RGB444 */ #define C1_ALPHA_SHFT 20 -#define C1_DMAB32 0x00000000/* 32-byte DMA burst */ -#define C1_DMAB16 0x02000000/* 16-byte DMA burst */ -#define C1_DMAB64 0x04000000/* 64-byte DMA burst */ +#define C1_DMAB64 0x00000000/* 64-byte DMA burst */ +#define C1_DMAB128 0x02000000/* 128-byte DMA burst */ +#define C1_DMAB256 0x04000000/* 256-byte DMA burst */ Interesting, did I just get those wrong somehow? Or might they have been different in the Cafe days?
[Albert Wang] Yes, it looks the original definitions are wrong. We can't find them in all Marvell documents. :) Just correct them.
Quoted 3 lines
Acked-by Jonathan Corbet <[email protected]>jon
Thanks
Albert Wang
86-21-61092656
PATCH v3 14/15 marvell-ccic: use unsigned int type replace int type
In reply to Albert WangThis patch use unsigned int type replace int type in marvell-ccic.
These variables: frame number, buf number, irq... should be unsigned.
--- .../media/platform/marvell-ccic/mcam-core-soc.h | 2 +- .../platform/marvell-ccic/mcam-core-standard.h | 10 ++++----- drivers/media/platform/marvell-ccic/mcam-core.c | 22 ++++++++++---------- drivers/media/platform/marvell-ccic/mcam-core.h | 2 +- drivers/media/platform/marvell-ccic/mmp-driver.c | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core-soc.h +1 -1
@@ -11,7 +11,7 @@ extern const struct vb2_ops mcam_vb2_ops;void mcam_ctlr_power_up (struct mcam_camera *cam);void mcam_ctlr_power_down (struct mcam_camera *cam); -void mcam_dma_contig_done (struct mcam_camera *cam,int frame); +void mcam_dma_contig_done (struct mcam_camera *cam,unsigned int frame);void mcam_ctlr_stop (struct mcam_camera *cam);int mcam_config_mipi (struct mcam_camera *mcam,int enable);void mcam_ctlr_image (struct mcam_camera *cam);
drivers/media/platform/marvell-ccic/mcam-core-standard.h +5 -5
@@ -4,8 +4,8 @@* Copyright 2011 Jonathan Corbet [email protected] */ extern bool mcam_alloc_bufs_at_read; -extern int mcam_n_dma_bufs; -extern int mcam_buffer_mode; +extern unsigned int mcam_n_dma_bufs; +extern unsigned int mcam_buffer_mode;extern const struct vb2_ops mcam_vb2_sg_ops;extern const struct vb2_ops mcam_vb2_ops;
@@ -15,12 +15,12 @@ void mcam_ctlr_power_up(struct mcam_camera *cam);void mcam_ctlr_power_down (struct mcam_camera *cam);void mcam_free_dma_bufs (struct mcam_camera *cam);void mcam_ctlr_dma_sg (struct mcam_camera *cam); -void mcam_dma_sg_done (struct mcam_camera *cam,int frame); +void mcam_dma_sg_done (struct mcam_camera *cam,unsigned int frame);int mcam_check_dma_buffers (struct mcam_camera *cam);void mcam_set_config_needed (struct mcam_camera *cam,int needed);int __mcam_cam_reset (struct mcam_camera *cam);int mcam_alloc_dma_bufs (struct mcam_camera *cam,int loadtime);void mcam_ctlr_dma_contig (struct mcam_camera *cam); -void mcam_dma_contig_done (struct mcam_camera *cam,int frame); +void mcam_dma_contig_done (struct mcam_camera *cam,unsigned int frame);void mcam_ctlr_dma_vmalloc (struct mcam_camera *cam); -void mcam_vmalloc_done (struct mcam_camera *cam,int frame); +void mcam_vmalloc_done (struct mcam_camera *cam,unsigned int frame);
drivers/media/platform/marvell-ccic/mcam-core.c +11 -11
@@ -106,7 +106,7 @@ static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_buffer *vb)/* * Hand a completed buffer back to user space. */ -static void mcam_buffer_done (struct mcam_camera *cam,int frame, +static void mcam_buffer_done (struct mcam_camera *cam,unsigned int frame,struct vb2_buffer *vbuf) { vbuf->v4l2_buf.bytesused = cam->pix_format.sizeimage;
@@ -120,7 +120,7 @@ static void mcam_buffer_done(struct mcam_camera *cam, int frame,*/ static void mcam_reset_buffers (struct mcam_camera *cam) { -int i; +unsigned int i; cam->next_buf =-1 ;for (i =0 ; i < cam->nbufs; i++) {
@@ -215,7 +215,7 @@ int mcam_config_mipi(struct mcam_camera *mcam, int enable)*/ int mcam_alloc_dma_bufs (struct mcam_camera *cam,int loadtime) { -int i; +unsigned int i;mcam_set_config_needed (cam,1 );if (loadtime)
@@ -256,7 +256,7 @@ int mcam_alloc_dma_bufs(struct mcam_camera *cam, int loadtime)void mcam_free_dma_bufs (struct mcam_camera *cam) { -int i; +unsigned int i;for (i =0 ; i < cam->nbufs; i++) { dma_free_coherent(cam->dev, cam->dma_buf_size,
@@ -295,7 +295,7 @@ void mcam_ctlr_dma_vmalloc(struct mcam_camera *cam)static void mcam_frame_tasklet (unsigned long data) {struct mcam_camera *cam = (struct mcam_camera *) data; -int i; +unsigned int i;unsigned long flags;struct mcam_vb_buffer *buf;
@@ -343,7 +343,7 @@ int mcam_check_dma_buffers(struct mcam_camera *cam)return 0 ; } -void mcam_vmalloc_done (struct mcam_camera *cam,int frame) +void mcam_vmalloc_done (struct mcam_camera *cam,unsigned int frame) {tasklet_schedule (&cam->s_tasklet); }
@@ -395,7 +395,7 @@ static bool mcam_fmt_is_planar(__u32 pfmt)* space. In this way, we always have a buffer to DMA to and don't * have to try to play games stopping and restarting the controller. */ -static void mcam_set_contig_buffer (struct mcam_camera *cam,int frame) +static void mcam_set_contig_buffer (struct mcam_camera *cam,unsigned int frame) {struct mcam_vb_buffer *buf;struct v4l2_pix_format *fmt = &cam->pix_format;
@@ -441,7 +441,7 @@ void mcam_ctlr_dma_contig(struct mcam_camera *cam)/* * Frame completion handling. */ -void mcam_dma_contig_done (struct mcam_camera *cam,int frame) +void mcam_dma_contig_done (struct mcam_camera *cam,unsigned int frame) {struct mcam_vb_buffer *buf = cam->vb_bufs[frame];
@@ -517,7 +517,7 @@ void mcam_ctlr_dma_sg(struct mcam_camera *cam)* safely change the DMA descriptor array here and restart things * (assuming there's another buffer waiting to go). */ -void mcam_dma_sg_done (struct mcam_camera *cam,int frame) +void mcam_dma_sg_done (struct mcam_camera *cam,unsigned int frame) {struct mcam_vb_buffer *buf = cam->vb_bufs[0 ];
@@ -865,7 +865,7 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq, void *alloc_ctxs[]) {struct mcam_camera *cam =get_mcam (vq); -int minbufs = (cam->buffer_mode == B_DMA_contig) ?3 :2 ; +unsigned int minbufs = (cam->buffer_mode == B_DMA_contig) ?3 :2 ; sizes[0 ] = cam->pix_format.sizeimage; *num_planes =1 ;/* Someday we have to support planar formats... */
@@ -1103,7 +1103,7 @@ const struct vb2_ops mcam_vb2_sg_ops = {/* * Interrupt handler stuff */ -static void mcam_frame_complete (struct mcam_camera *cam,int frame) +static void mcam_frame_complete (struct mcam_camera *cam,unsigned int frame) {/* * Basic frame housekeeping.
drivers/media/platform/marvell-ccic/mcam-core.h +1 -1
@@ -192,7 +192,7 @@ struct mcam_camera {/* Mode-specific ops, set at open time */ void (*dma_setup)(struct mcam_camera *cam); -void (*frame_complete)(struct mcam_camera *cam,int frame); +void (*frame_complete)(struct mcam_camera *cam,unsigned int frame);/* Current operating parameters */ u32 sensor_type;/* Currently ov7670 only */
drivers/media/platform/marvell-ccic/mmp-driver.c +1 -1
@@ -46,7 +46,7 @@ struct mmp_camera {struct list_head devlist;/* will change here */ struct clk *clk[3 ];/* CCIC_GATE, CCIC_RST, CCIC_DBG clocks */ -int irq; +unsigned int irq; };static inline struct mmp_camera *mcam_to_cam (struct mcam_camera *mcam)
Signature · 1 line
1.7.9.5
Re: [PATCH V3 14/15] [media] marvell-ccic: use unsigned int type replace int type
Quoted 3 lines · On Sat, 15 Dec 2012 17:58:03 +0800 Albert Wang <[email protected]> wrote:
This patch use unsigned int type replace int type in marvell-ccic.
These variables: frame number, buf number, irq... should be unsigned.
jon
PATCH v3 15/15 marvell-ccic: add 3 frame buffers support in DMA_CONTIG mode
In reply to Albert WangThis patch adds support of 3 frame buffers in DMA-contiguous mode.
In current DMA_CONTIG mode, only 2 frame buffers can be supported. Actually, Marvell CCIC can support at most 3 frame buffers.
Currently 2 frame buffers mode will be used by default. To use 3 frame buffers mode, can do:
define MAX_FRAME_BUFS 3
in mcam-core.h
--- drivers/media/platform/marvell-ccic/mcam-core.c | 59 +++++++++++++++++------ drivers/media/platform/marvell-ccic/mcam-core.h | 11 +++++ 2 files changed, 55 insertions(+), 15 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core.c +44 -15
@@ -400,13 +400,32 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, unsigned int frame)struct mcam_vb_buffer *buf;struct v4l2_pix_format *fmt = &cam->pix_format; -/* -* If there are no available buffers, go into single mode -*/ if (list_empty (&cam->buffers)) { - buf = cam->vb_bufs[frame ^0x1 ]; -set_bit (CF_SINGLE_BUFFER , &cam->flags); - cam->frame_state.singles++; +/* +* If there are no available buffers +* go into single buffer mode +* +* If CCIC use Two Buffers mode +* will use another remaining frame buffer +* frame 0 -> buf 1 +* frame 1 -> buf 0 +* +* If CCIC use Three Buffers mode +* will use the 2rd remaining frame buffer +* frame 0 -> buf 2 +* frame 1 -> buf 0 +* frame 2 -> buf 1 +*/ + buf = cam->vb_bufs[(frame + (MAX_FRAME_BUFS -1 )) + %MAX_FRAME_BUFS ]; +if (cam->frame_state.usebufs ==0 ) + cam->frame_state.usebufs++; +else { +set_bit (CF_SINGLE_BUFFER , &cam->flags); + cam->frame_state.singles++; +if (cam->frame_state.usebufs <2 ) + cam->frame_state.usebufs++; + } }else {/* * OK, we have a buffer we can use.
@@ -415,15 +434,15 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, unsigned int frame) queue);list_del_init (&buf->queue);clear_bit (CF_SINGLE_BUFFER , &cam->flags); +if (cam->frame_state.usebufs != (3 -MAX_FRAME_BUFS )) + cam->frame_state.usebufs--; } cam->vb_bufs[frame] = buf; -mcam_reg_write (cam, frame ==0 ?REG_Y0BAR :REG_Y1BAR , buf->yuv_p.y); +mcam_reg_write (cam,REG_Y0BAR + (frame <<2 ), buf->yuv_p.y);if (mcam_fmt_is_planar (fmt->pixelformat)) { -mcam_reg_write (cam, frame ==0 ? -REG_U0BAR :REG_U1BAR , buf->yuv_p.u); -mcam_reg_write (cam, frame ==0 ? -REG_V0BAR :REG_V1BAR , buf->yuv_p.v); +mcam_reg_write (cam,REG_U0BAR + (frame <<2 ), buf->yuv_p.u); +mcam_reg_write (cam,REG_V0BAR + (frame <<2 ), buf->yuv_p.v); } }
@@ -432,10 +451,14 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, unsigned int frame)*/ void mcam_ctlr_dma_contig (struct mcam_camera *cam) { -mcam_reg_set_bit (cam,REG_CTRL1 ,C1_TWOBUFS ); - cam->nbufs =2 ; -mcam_set_contig_buffer (cam,0 ); -mcam_set_contig_buffer (cam,1 ); +unsigned int frame; + + cam->nbufs =MAX_FRAME_BUFS ; +for (frame =0 ; frame < cam->nbufs; frame++) +mcam_set_contig_buffer (cam, frame); + +if (cam->nbufs ==2 ) +mcam_reg_set_bit (cam,REG_CTRL1 ,C1_TWOBUFS ); }/*
@@ -978,6 +1001,12 @@ static int mcam_vb_start_streaming(struct vb2_queue *vq, unsigned int count)for (frame =0 ; frame < cam->nbufs; frame++)clear_bit (CF_FRAME_SOF0 + frame, &cam->flags); +/* +* If CCIC use Two Buffers mode, init usebufs == 1 +* If CCIC use Three Buffers mode, init usebufs == 0 +*/ + cam->frame_state.usebufs =3 -MAX_FRAME_BUFS ; +return mcam_read_setup (cam); }
drivers/media/platform/marvell-ccic/mcam-core.h +11 -0
@@ -62,6 +62,13 @@ enum mcam_state {#define MAX_DMA_BUFS 3/* +* CCIC can support at most 3 frame buffers in DMA_CONTIG buffer mode +* 2 - Use Two Buffers mode +* 3 - Use Three Buffers mode +*/ +#define MAX_FRAME_BUFS 2/* Current marvell-ccic used Two Buffers mode */ + +/* * Different platforms work best with different buffer modes, so we * let the platform pick. */
@@ -99,6 +106,10 @@ struct mcam_frame_state {unsigned int frames;unsigned int singles;unsigned int delivered; +/* +* Only usebufs == 2 can enter single buffer mode +*/ +unsigned int usebufs; };/*
Signature · 1 line
1.7.9.5
Re: [PATCH V3 15/15] [media] marvell-ccic: add 3 frame buffers support in DMA_CONTIG mode
Quoted 9 lines · On Sat, 15 Dec 2012 17:58:04 +0800 Albert Wang <[email protected]> wrote:
This patch adds support of 3 frame buffers in DMA-contiguous mode.
In current
DMA_CONTIGmode, only 2 frame buffers can be supported. Actually, Marvell CCIC can support at most 3 frame buffers.Currently 2 frame buffers mode will be used by default. To use 3 frame buffers mode, can do:
defineMAX_FRAME_BUFS3
inmcam-core.h
Now that the code supports three buffers properly, is there any reason not to use that mode by default?
Did you test that it works properly if allocation of the third buffer fails?
Otherwise looks OK except for one thing:
Quoted 19 lines
drivers/media/platform/marvell-ccic/mcam-core.h +7
-0@@ -62,6 +62,13 @@ enum mcam_state {#define MAX_DMA_BUFS 3/* +* CCIC can support at most 3 frame buffers in DMA_CONTIG buffer mode +* 2 - Use Two Buffers mode +* 3 - Use Three Buffers mode +*/ +#define MAX_FRAME_BUFS 2/* Current marvell-ccic used Two Buffers mode */ + +/* * Different platforms work best with different buffer modes, so we * let the platform pick. */
drivers/media/platform/marvell-ccic/mcam-core.h struct mcam_frame_state { · line 113
Quoted 8 lines
drivers/media/platform/marvell-ccic/mcam-core.h +4
-0@@ -99,6 +106,10 @@ struct mcam_frame_state {unsigned int frames;unsigned int singles;unsigned int delivered; +/* +* Only usebufs == 2 can enter single buffer mode +*/ +unsigned int usebufs; };
What is the purpose of the "usebufs" field? The code maintains it in various places, but I don't see anywhere that actually uses that value for anything.
Thanks,
jon
RE: [PATCH V3 15/15] [media] marvell-ccic: add 3 frame buffers support in DMA_CONTIG mode
Hi, Jonathan
Quoted 16 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:56
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 15/15] [media] marvell-ccic: add 3 frame buffers support inDMA_CONTIGmodeQuoted 5 lines · On Sat, 15 Dec 2012 17:58:04 +0800 Albert Wang <[email protected]> wrote:
This patch adds support of 3 frame buffers in DMA-contiguous mode.
In current
DMA_CONTIGmode, only 2 frame buffers can be supported. Actually, Marvell CCIC can support at most 3 frame buffers.
Quoted 8 lines
Quoted 4 lines
Currently 2 frame buffers mode will be used by default. To use 3 frame buffers mode, can do:
defineMAX_FRAME_BUFS3
inmcam-core.hNow that the code supports three buffers properly, is there any reason not to use that mode by default?
[Albert Wang] Because the original code use the two buffers mode, so we keep it. :)
Quoted 2 lines
Did you test that it works properly if allocation of the third buffer fails?
[Albert Wang] Yes, we test it in our Marvell platforms.
Quoted 26 lines
Otherwise looks OK except for one thing:
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/media/platform/marvell-ccic/mcam-core.hQuoted 22 lines
index 765d47c..9bf31c8 100755
drivers/media/platform/marvell-ccic/mcam-core.h +8
-0@@ -62,6 +62,13 @@ enum mcam_state {#define MAX_DMA_BUFS 3/* +* CCIC can support at most 3 frame buffers in DMA_CONTIG buffer mode +* 2 - Use Two Buffers mode +* 3 - Use Three Buffers mode +*/ +#define MAX_FRAME_BUFS 2/* Current marvell-ccic used Two Buffers mode */ + +/* * Different platforms work best with different buffer modes, so we * let the platform pick. */ @@ -99,6 +106,10 @@ struct mcam_frame_state {unsigned int frames;unsigned int singles;unsigned int delivered; +/*
Quoted 9 lines
drivers/media/platform/marvell-ccic/mcam-core.h struct mcam_frame_state { · line 113
Quoted 4 lines
drivers/media/platform/marvell-ccic/mcam-core.h +3
-0+* Only usebufs == 2 can enter single buffer mode +*/ +unsigned int usebufs; };What is the purpose of the "usebufs" field? The code maintains it in various places, but I don't see anywhere that actually uses that value for anything.
[Albert Wang] Two buffers mode doesn't need it.
But Three buffers mode need it indicates which conditions we need set the single buffer flag. I used "tribufs" as the name in the previous version, but it looks it's a confused name when we merged Two buffers mode and Three buffers mode with same code by removing #ifdef based on your comments months ago. :) So we just changed the name with "usebufs".
Quoted 3 lines
Thanks,
jon
Thanks
Albert Wang
86-21-61092656
Re: [PATCH V3 15/15] [media] marvell-ccic: add 3 frame buffers support in DMA_CONTIG mode
Quoted 9 lines · On Sun, 16 Dec 2012 14:34:31 -0800 Albert Wang <[email protected]> wrote:
Quoted 4 lines
What is the purpose of the "usebufs" field? The code maintains it in various places, but I don't see anywhere that actually uses that value for anything.
[Albert Wang] Two buffers mode doesn't need it.
But Three buffers mode need it indicates which conditions we need set the single buffer flag. I used "tribufs" as the name in the previous version, but it looks it's a confused name when we merged Two buffers mode and Three buffers mode with same code by removing #ifdef based on your comments months ago. :) So we just changed the name with "usebufs".
OK, I misread the code a bit, sorry. I do find the variable confusing still, but it clearly does play a role.
I think that using three buffers by default would make sense. I don't think that increased overruns are an unbreakable ABI feature :)
Feel free to add my ack to this one.
Thanks,
jon
RE: [PATCH V3 15/15] [media] marvell-ccic: add 3 frame buffers support in DMA_CONTIG mode
Hi, Jonathan
Quoted 21 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 06:55
To: Albert Wang
Cc: [email protected]; [email protected]; Libin Yang
Subject: Re: [PATCH V3 15/15] [media] marvell-ccic: add 3 frame buffers support inDMA_CONTIGmodeQuoted 6 lines · On Sun, 16 Dec 2012 14:34:31 -0800 Albert Wang <[email protected]> wrote:
Quoted 4 lines
What is the purpose of the "usebufs" field? The code maintains it in various places, but I don't see anywhere that actually uses that value for anything.
[Albert Wang] Two buffers mode doesn't need it.
But Three buffers mode need it indicates which conditions we need set the singlebuffer flag.
Quoted 1 line
I used "tribufs" as the name in the previous version, but it looks it's a confused name
when we merged
Quoted 1 line
Two buffers mode and Three buffers mode with same code by removing #ifdef based
Quoted 9 lines
on your comments months ago. :)
Quoted 1 line
So we just changed the name with "usebufs".
OK, I misread the code a bit, sorry. I do find the variable confusing still, but it clearly does play a role.
I think that using three buffers by default would make sense. I don't think that increased overruns are an unbreakable ABI feature :)
[Albert Wang] OK, we can change the default to three buffers mode.
Quoted 5 lines
Feel free to add my ack to this one.
Thanks,
jon
Thanks
Albert Wang
86-21-61092656
Quoted 1 line · On Sat, 15 Dec 2012 17:57:49 +0800 Albert Wang <[email protected]> wrote:
The following patches series will add
soc_camerasupport on marvell-ccic
Overall, this patch set has come a long way - great work!
As I commented on the specific patches, I still have some concerns about the soc_camera part of it. There's various quibbles with the rest, but mostly not much that's serious. I think this work is getting close to being ready.
Thanks,
jon
Jonathan Corbet / LWN.net / [email protected]
Hi, Jonathan
Thank you very much for taking your weekend time to review our patches! :)
Thanks
Albert Wang
86-21-61092656
Quoted 26 lines
-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Monday, 17 December, 2012 00:58
To: Albert Wang
Cc: [email protected]; [email protected]
Subject: Re: [PATCH V3 00/15] [media] marvell-ccic: add soc camera support on marvell- ccicQuoted 1 line · On Sat, 15 Dec 2012 17:57:49 +0800 Albert Wang <[email protected]> wrote:
The following patches series will add
soc_camerasupport on marvell-ccicOverall, this patch set has come a long way - great work!
As I commented on the specific patches, I still have some concerns about the
soc_camerapart of it. There's various quibbles with the rest, but mostly not much that's serious. I think this work is getting close to being ready.Thanks,
jon
Jonathan Corbet / LWN.net / [email protected]