Re: [PATCH 1/6] adv7180: fix broken standards handling
On 04/22/2016 03:03 PM, Hans Verkuil wrote: > From: Hans Verkuil > > The adv7180 attempts to autodetect the standard. Unfortunately this > is seriously broken. > > This patch removes the autodetect completely. Only the querystd op > will detect the standard. Since the design of the adv7180 requires > that you switch to a special autodetect mode you cannot call querystd > when you are streaming. > > So the s_stream op has been added so we know whether we are streaming > or not, and if we are, then querystd returns EBUSY. > > After testing this with a signal generator is became obvious that > a sleep is needed between changing the standard to autodetect and > reading the status. So the autodetect can never have worked well. > > The s_std call now just sets the new standard without any querying. > > If the driver supports the interrupt, then when it detects a standard > change it will signal that by sending the V4L2_EVENT_SOURCE_CHANGE > event. > > With these changes this driver now behaves like all other video > receivers. > > Signed-off-by: Hans Verkuil > Cc: Niklas Söderlund > Cc: Lars-Peter Clausen > Cc: Federico Vaga Thanks for cleaning this up. Acked-by: Lars-Peter Clausen -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv4 07/13] media/platform: convert drivers to use the new vb2_queue dev field
Hi Hans, Thanks for the patch. On Sat, Apr 23, 2016 at 12:03 PM, Hans Verkuil wrote: > From: Hans Verkuil > > Stop using alloc_ctx and just fill in the device pointer. > > Signed-off-by: Hans Verkuil > Cc: "Lad, Prabhakar" > Cc: Scott Jiang > Acked-by: Philipp Zabel > --- > drivers/media/platform/am437x/am437x-vpfe.c| 10 +- > drivers/media/platform/am437x/am437x-vpfe.h| 2 -- > drivers/media/platform/davinci/vpbe_display.c | 12 +--- > drivers/media/platform/davinci/vpif_capture.c | 11 +-- > drivers/media/platform/davinci/vpif_capture.h | 2 -- > drivers/media/platform/davinci/vpif_display.c | 11 +-- > drivers/media/platform/davinci/vpif_display.h | 2 -- > include/media/davinci/vpbe_display.h | 2 -- > 11 files changed, 8 insertions(+), 76 deletions(-) > For all the above Acked-by: Lad, Prabhakar Cheers, --Prabhakar Lad > diff --git a/drivers/media/platform/am437x/am437x-vpfe.c > b/drivers/media/platform/am437x/am437x-vpfe.c > index e749eb7..d22b09d 100644 > --- a/drivers/media/platform/am437x/am437x-vpfe.c > +++ b/drivers/media/platform/am437x/am437x-vpfe.c > @@ -1915,7 +1915,6 @@ static int vpfe_queue_setup(struct vb2_queue *vq, > > if (vq->num_buffers + *nbuffers < 3) > *nbuffers = 3 - vq->num_buffers; > - alloc_ctxs[0] = vpfe->alloc_ctx; > > if (*nplanes) { > if (sizes[0] < size) > @@ -2364,13 +2363,6 @@ static int vpfe_probe_complete(struct vpfe_device > *vpfe) > goto probe_out; > > /* Initialize videobuf2 queue as per the buffer type */ > - vpfe->alloc_ctx = vb2_dma_contig_init_ctx(vpfe->pdev); > - if (IS_ERR(vpfe->alloc_ctx)) { > - vpfe_err(vpfe, "Failed to get the context\n"); > - err = PTR_ERR(vpfe->alloc_ctx); > - goto probe_out; > - } > - > q = &vpfe->buffer_queue; > q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; > q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ; > @@ -2381,11 +2373,11 @@ static int vpfe_probe_complete(struct vpfe_device > *vpfe) > q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > q->lock = &vpfe->lock; > q->min_buffers_needed = 1; > + q->dev = vpfe->pdev; > > err = vb2_queue_init(q); > if (err) { > vpfe_err(vpfe, "vb2_queue_init() failed\n"); > - vb2_dma_contig_cleanup_ctx(vpfe->alloc_ctx); > goto probe_out; > } > > diff --git a/drivers/media/platform/am437x/am437x-vpfe.h > b/drivers/media/platform/am437x/am437x-vpfe.h > index 777bf97..17d7aa4 100644 > --- a/drivers/media/platform/am437x/am437x-vpfe.h > +++ b/drivers/media/platform/am437x/am437x-vpfe.h > @@ -264,8 +264,6 @@ struct vpfe_device { > struct v4l2_rect crop; > /* Buffer queue used in video-buf */ > struct vb2_queue buffer_queue; > - /* Allocator-specific contexts for each plane */ > - struct vb2_alloc_ctx *alloc_ctx; > /* Queue of filled frames */ > struct list_head dma_queue; > /* IRQ lock for DMA queue */ > diff --git a/drivers/media/platform/blackfin/bfin_capture.c > b/drivers/media/platform/blackfin/bfin_capture.c > index d0092da..1e244287 100644 > --- a/drivers/media/platform/blackfin/bfin_capture.c > +++ b/drivers/media/platform/blackfin/bfin_capture.c > @@ -91,8 +91,6 @@ struct bcap_device { > struct bcap_buffer *cur_frm; > /* buffer queue used in videobuf2 */ > struct vb2_queue buffer_queue; > - /* allocator-specific contexts for each plane */ > - struct vb2_alloc_ctx *alloc_ctx; > /* queue of filled frames */ > struct list_head dma_queue; > /* used in videobuf2 callback */ > @@ -209,7 +207,6 @@ static int bcap_queue_setup(struct vb2_queue *vq, > > if (vq->num_buffers + *nbuffers < 2) > *nbuffers = 2; > - alloc_ctxs[0] = bcap_dev->alloc_ctx; > > if (*nplanes) > return sizes[0] < bcap_dev->fmt.sizeimage ? -EINVAL : 0; > @@ -820,12 +817,6 @@ static int bcap_probe(struct platform_device *pdev) > } > bcap_dev->ppi->priv = bcap_dev; > > - bcap_dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); > - if (IS_ERR(bcap_dev->alloc_ctx)) { > - ret = PTR_ERR(bcap_dev->alloc_ctx); > - goto err_free_ppi; > - } > - > vfd = &bcap_dev->video_dev; > /* initialize field of video device */ > vfd->release= video_device_release_empty; > @@ -839,7 +830,7 @@ static int bcap_probe(struct platform_device *pdev) > if (ret) { > v4l2_err(pdev->dev.driver, > "Unable to register v4l2 device\n"); > - goto err_cleanup_ctx; > + goto err_free_ppi; > } > v4l2_info(&bcap_dev->v4l2_dev, "v4l2 device registered\n"); > > @@ -863,6 +854,7 @@ stati
Re: [PATCHv3 05/12] staging/media: convert drivers to use the new vb2_queue dev field
Hi Hans, Thanks for the patch. On Fri, Apr 22, 2016 at 9:38 AM, Hans Verkuil wrote: > From: Hans Verkuil > > Stop using alloc_ctx and just fill in the device pointer. > > Signed-off-by: Hans Verkuil > Cc: "Lad, Prabhakar" > Cc: Laurent Pinchart > --- > drivers/staging/media/davinci_vpfe/vpfe_video.c | 10 +- > drivers/staging/media/davinci_vpfe/vpfe_video.h | 2 -- For the above Acked-by: Lad, Prabhakar Cheers, --Prabhakar Lad > drivers/staging/media/omap4iss/iss_video.c | 10 +- > drivers/staging/media/omap4iss/iss_video.h | 1 - > 4 files changed, 2 insertions(+), 21 deletions(-) > > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c > b/drivers/staging/media/davinci_vpfe/vpfe_video.c > index ea3ddec..77e66e7 100644 > --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c > +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c > @@ -542,7 +542,6 @@ static int vpfe_release(struct file *file) > video->io_usrs = 0; > /* Free buffers allocated */ > vb2_queue_release(&video->buffer_queue); > - vb2_dma_contig_cleanup_ctx(video->alloc_ctx); > } > /* Decrement device users counter */ > video->usrs--; > @@ -1115,7 +1114,6 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, > > *nplanes = 1; > sizes[0] = size; > - alloc_ctxs[0] = video->alloc_ctx; > v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, > "nbuffers=%d, size=%lu\n", *nbuffers, size); > return 0; > @@ -1350,12 +1348,6 @@ static int vpfe_reqbufs(struct file *file, void *priv, > video->memory = req_buf->memory; > > /* Initialize videobuf2 queue as per the buffer type */ > - video->alloc_ctx = vb2_dma_contig_init_ctx(vpfe_dev->pdev); > - if (IS_ERR(video->alloc_ctx)) { > - v4l2_err(&vpfe_dev->v4l2_dev, "Failed to get the context\n"); > - return PTR_ERR(video->alloc_ctx); > - } > - > q = &video->buffer_queue; > q->type = req_buf->type; > q->io_modes = VB2_MMAP | VB2_USERPTR; > @@ -1365,11 +1357,11 @@ static int vpfe_reqbufs(struct file *file, void *priv, > q->mem_ops = &vb2_dma_contig_memops; > q->buf_struct_size = sizeof(struct vpfe_cap_buffer); > q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > + q->dev = vpfe_dev->pdev; > > ret = vb2_queue_init(q); > if (ret) { > v4l2_err(&vpfe_dev->v4l2_dev, "vb2_queue_init() failed\n"); > - vb2_dma_contig_cleanup_ctx(vpfe_dev->pdev); > return ret; > } > > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h > b/drivers/staging/media/davinci_vpfe/vpfe_video.h > index 653334d..aaec440 100644 > --- a/drivers/staging/media/davinci_vpfe/vpfe_video.h > +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.h > @@ -123,8 +123,6 @@ struct vpfe_video_device { > /* Used to store pixel format */ > struct v4l2_format fmt; > struct vb2_queuebuffer_queue; > - /* allocator-specific contexts for each plane */ > - struct vb2_alloc_ctx *alloc_ctx; > /* Queue of filled frames */ > struct list_headdma_queue; > spinlock_t irqlock; > diff --git a/drivers/staging/media/omap4iss/iss_video.c > b/drivers/staging/media/omap4iss/iss_video.c > index cf8da23..3c077e3 100644 > --- a/drivers/staging/media/omap4iss/iss_video.c > +++ b/drivers/staging/media/omap4iss/iss_video.c > @@ -310,8 +310,6 @@ static int iss_video_queue_setup(struct vb2_queue *vq, > if (sizes[0] == 0) > return -EINVAL; > > - alloc_ctxs[0] = video->alloc_ctx; > - > *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); > > return 0; > @@ -1017,13 +1015,6 @@ static int iss_video_open(struct file *file) > goto done; > } > > - video->alloc_ctx = vb2_dma_contig_init_ctx(video->iss->dev); > - if (IS_ERR(video->alloc_ctx)) { > - ret = PTR_ERR(video->alloc_ctx); > - omap4iss_put(video->iss); > - goto done; > - } > - > q = &handle->queue; > > q->type = video->type; > @@ -1033,6 +1024,7 @@ static int iss_video_open(struct file *file) > q->mem_ops = &vb2_dma_contig_memops; > q->buf_struct_size = sizeof(struct iss_buffer); > q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > + q->dev = video->iss->dev; > > ret = vb2_queue_init(q); > if (ret) { > diff --git a/drivers/staging/media/omap4iss/iss_video.h > b/drivers/staging/media/omap4iss/iss_video.h > index c8bd295..d7e05d0 100644 > --- a/drivers/staging/media/omap4iss/iss_video.h > +++ b/drivers/staging/media/omap4iss/iss_video.h > @@ -170,7 +170,6 @@ struct iss_video { > spinlock_t qlock;
Re: [PATCHv4 06/13] staging/media: convert drivers to use the new vb2_queue dev field
Hi Hans, On Sat, Apr 23, 2016 at 12:03 PM, Hans Verkuil wrote: > From: Hans Verkuil > > Stop using alloc_ctx and just fill in the device pointer. > > Signed-off-by: Hans Verkuil > Cc: "Lad, Prabhakar" > Reviewed-by: Laurent Pinchart Acked-by: Lad, Prabhakar Cheers, --Prabhakar Lad > --- > drivers/staging/media/davinci_vpfe/vpfe_video.c | 10 +- > drivers/staging/media/davinci_vpfe/vpfe_video.h | 2 -- > drivers/staging/media/omap4iss/iss_video.c | 10 +- > drivers/staging/media/omap4iss/iss_video.h | 1 - > 4 files changed, 2 insertions(+), 21 deletions(-) > > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c > b/drivers/staging/media/davinci_vpfe/vpfe_video.c > index ea3ddec..77e66e7 100644 > --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c > +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c > @@ -542,7 +542,6 @@ static int vpfe_release(struct file *file) > video->io_usrs = 0; > /* Free buffers allocated */ > vb2_queue_release(&video->buffer_queue); > - vb2_dma_contig_cleanup_ctx(video->alloc_ctx); > } > /* Decrement device users counter */ > video->usrs--; > @@ -1115,7 +1114,6 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, > > *nplanes = 1; > sizes[0] = size; > - alloc_ctxs[0] = video->alloc_ctx; > v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, > "nbuffers=%d, size=%lu\n", *nbuffers, size); > return 0; > @@ -1350,12 +1348,6 @@ static int vpfe_reqbufs(struct file *file, void *priv, > video->memory = req_buf->memory; > > /* Initialize videobuf2 queue as per the buffer type */ > - video->alloc_ctx = vb2_dma_contig_init_ctx(vpfe_dev->pdev); > - if (IS_ERR(video->alloc_ctx)) { > - v4l2_err(&vpfe_dev->v4l2_dev, "Failed to get the context\n"); > - return PTR_ERR(video->alloc_ctx); > - } > - > q = &video->buffer_queue; > q->type = req_buf->type; > q->io_modes = VB2_MMAP | VB2_USERPTR; > @@ -1365,11 +1357,11 @@ static int vpfe_reqbufs(struct file *file, void *priv, > q->mem_ops = &vb2_dma_contig_memops; > q->buf_struct_size = sizeof(struct vpfe_cap_buffer); > q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > + q->dev = vpfe_dev->pdev; > > ret = vb2_queue_init(q); > if (ret) { > v4l2_err(&vpfe_dev->v4l2_dev, "vb2_queue_init() failed\n"); > - vb2_dma_contig_cleanup_ctx(vpfe_dev->pdev); > return ret; > } > > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h > b/drivers/staging/media/davinci_vpfe/vpfe_video.h > index 653334d..aaec440 100644 > --- a/drivers/staging/media/davinci_vpfe/vpfe_video.h > +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.h > @@ -123,8 +123,6 @@ struct vpfe_video_device { > /* Used to store pixel format */ > struct v4l2_format fmt; > struct vb2_queuebuffer_queue; > - /* allocator-specific contexts for each plane */ > - struct vb2_alloc_ctx *alloc_ctx; > /* Queue of filled frames */ > struct list_headdma_queue; > spinlock_t irqlock; > diff --git a/drivers/staging/media/omap4iss/iss_video.c > b/drivers/staging/media/omap4iss/iss_video.c > index cf8da23..3c077e3 100644 > --- a/drivers/staging/media/omap4iss/iss_video.c > +++ b/drivers/staging/media/omap4iss/iss_video.c > @@ -310,8 +310,6 @@ static int iss_video_queue_setup(struct vb2_queue *vq, > if (sizes[0] == 0) > return -EINVAL; > > - alloc_ctxs[0] = video->alloc_ctx; > - > *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); > > return 0; > @@ -1017,13 +1015,6 @@ static int iss_video_open(struct file *file) > goto done; > } > > - video->alloc_ctx = vb2_dma_contig_init_ctx(video->iss->dev); > - if (IS_ERR(video->alloc_ctx)) { > - ret = PTR_ERR(video->alloc_ctx); > - omap4iss_put(video->iss); > - goto done; > - } > - > q = &handle->queue; > > q->type = video->type; > @@ -1033,6 +1024,7 @@ static int iss_video_open(struct file *file) > q->mem_ops = &vb2_dma_contig_memops; > q->buf_struct_size = sizeof(struct iss_buffer); > q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > + q->dev = video->iss->dev; > > ret = vb2_queue_init(q); > if (ret) { > diff --git a/drivers/staging/media/omap4iss/iss_video.h > b/drivers/staging/media/omap4iss/iss_video.h > index c8bd295..d7e05d0 100644 > --- a/drivers/staging/media/omap4iss/iss_video.h > +++ b/drivers/staging/media/omap4iss/iss_video.h > @@ -170,7 +170,6 @@ struct iss_video { > spinlock_t qlock; /* protects dmaqueue and e
Re: [PATCH 1/2] [media] tvp5150: return I2C write operation failure to callers
On Fri, Apr 15, 2016 at 2:00 AM, Javier Martinez Canillas wrote: > The tvp5150_write() function calls i2c_smbus_write_byte_data() that > can fail but does not propagate the error to the caller. Instead it > just prints a debug, so callers can't know if the operation failed. > > So change the function to return the error code to the caller so it > knows that the write failed and also print an error instead of just > printing a debug information. > > While being there remove the inline keyword from tvp5150_write() to > make it consistent with tvp5150_read() and also because it's called > in a lot of places, so making inline is in fact counter productive > since it makes the kernel image size to be much bigger (~16 KiB). > > Signed-off-by: Javier Martinez Canillas Acked-by: Lad, Prabhakar Cheers, --Prabhakar Lad > --- > > drivers/media/i2c/tvp5150.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c > index e5003d94f262..4a2e851b6a3b 100644 > --- a/drivers/media/i2c/tvp5150.c > +++ b/drivers/media/i2c/tvp5150.c > @@ -83,7 +83,7 @@ static int tvp5150_read(struct v4l2_subdev *sd, unsigned > char addr) > return rc; > } > > -static inline void tvp5150_write(struct v4l2_subdev *sd, unsigned char addr, > +static int tvp5150_write(struct v4l2_subdev *sd, unsigned char addr, > unsigned char value) > { > struct i2c_client *c = v4l2_get_subdevdata(sd); > @@ -92,7 +92,9 @@ static inline void tvp5150_write(struct v4l2_subdev *sd, > unsigned char addr, > v4l2_dbg(2, debug, sd, "tvp5150: writing 0x%02x 0x%02x\n", addr, > value); > rc = i2c_smbus_write_byte_data(c, addr, value); > if (rc < 0) > - v4l2_dbg(0, debug, sd, "i2c i/o error: rc == %d\n", rc); > + v4l2_err(sd, "i2c i/o error: rc == %d\n", rc); > + > + return rc; > } > > static void dump_reg_range(struct v4l2_subdev *sd, char *s, u8 init, > -- > 2.5.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] [media] tvp5150: propagate I2C write error in .s_register callback
On Fri, Apr 15, 2016 at 2:00 AM, Javier Martinez Canillas wrote: > The tvp5150_write() function can fail so don't return 0 unconditionally > in tvp5150_s_register() but propagate what's returned by tvp5150_write(). > > Signed-off-by: Javier Martinez Canillas > Acked-by: Lad, Prabhakar Cheers, --Prabhakar Lad > --- > > drivers/media/i2c/tvp5150.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c > index 4a2e851b6a3b..7be456d1b071 100644 > --- a/drivers/media/i2c/tvp5150.c > +++ b/drivers/media/i2c/tvp5150.c > @@ -1161,8 +1161,7 @@ static int tvp5150_g_register(struct v4l2_subdev *sd, > struct v4l2_dbg_register * > > static int tvp5150_s_register(struct v4l2_subdev *sd, const struct > v4l2_dbg_register *reg) > { > - tvp5150_write(sd, reg->reg & 0xff, reg->val & 0xff); > - return 0; > + return tvp5150_write(sd, reg->reg & 0xff, reg->val & 0xff); > } > #endif > > -- > 2.5.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 00/24] Make Nokia N900 cameras working
Those patch series make cameras on Nokia N900 partially working. Some more patches are needed, but I've already sent them for upstreaming so they are not part of the series: https://lkml.org/lkml/2016/4/16/14 https://lkml.org/lkml/2016/4/16/33 As omap3isp driver supports only one endpoint on ccp2 interface, but cameras on N900 require different strobe settings, so far it is not possible to have both cameras correctly working with the same board DTS. DTS patch in the series has the correct settings for the front camera. This is a problem still to be solved. The needed pipeline could be made with: media-ctl -r media-ctl -l '"vs6555 binner 2-0010":1 -> "video-bus-switch":2 [1]' media-ctl -l '"video-bus-switch":0 -> "OMAP3 ISP CCP2":0 [1]' media-ctl -l '"OMAP3 ISP CCP2":1 -> "OMAP3 ISP CCDC":0 [1]' media-ctl -l '"OMAP3 ISP CCDC":2 -> "OMAP3 ISP preview":0 [1]' media-ctl -l '"OMAP3 ISP preview":1 -> "OMAP3 ISP resizer":0 [1]' media-ctl -l '"OMAP3 ISP resizer":1 -> "OMAP3 ISP resizer output":0 [1]' media-ctl -V '"vs6555 pixel array 2-0010":0 [SGRBG10/648x488 (0,0)/648x488 (0,0)/648x488]' media-ctl -V '"vs6555 binner 2-0010":1 [SGRBG10/648x488 (0,0)/648x488 (0,0)/648x488]' media-ctl -V '"OMAP3 ISP CCP2":0 [SGRBG10 648x488]' media-ctl -V '"OMAP3 ISP CCP2":1 [SGRBG10 648x488]' media-ctl -V '"OMAP3 ISP CCDC":2 [SGRBG10 648x488]' media-ctl -V '"OMAP3 ISP preview":1 [UYVY 648x488]' media-ctl -V '"OMAP3 ISP resizer":1 [UYVY 656x488]' and tested with: mplayer -tv driver=v4l2:width=656:height=488:outfmt=uyvy:device=/dev/video6 -vo xv -vf screenshot tv:// Ivaylo Dimitrov (8): smiaregs: Generic i2c register writing et8ek8: Toshiba 5MP sensor driver v4l: of: Support CSI-1 and CCP2 busses media: video-bus-switch: new driver ARM: dts: omap3-n900: enable cameras [media] omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 mode [media] omap3isp: Make sure CSI1 interface is enabled in CPP2 mode ARM: dts: omap3-n900: enable cameras - remove invalid entry Sakari Ailus (10): smiapp-pll: Take existing divisor into account in minimum divisor check smiapp: Add smiapp_has_quirk() to tell whether a quirk is implemented smiapp: Add quirk control support v4l: of: Call CSI2 bus csi2, not csi v4l: of: Obtain data bus type from bus-type property v4l: Add CSI1 and CCP2 bus type to enum v4l2_mbus_type v4l: of: Separate lane parsing from CSI-2 bus parameter parsing dt: bindings: v4l: Add bus-type video interface property dt: bindings: Add CSI1/CCP2 related properties to video-interfaces.txt omap3isp: dt: Add support for CSI1/CCP2 busses Sebastian Reichel (5): media: et8ek8: add device tree binding document media: add subdev type for bus switch smiapp: add CCP2 support v4l2-async: per notifier locking v4l2_device_register_subdev_nodes: allow calling multiple times Tuukka.O Toivonen (1): V4L fixes .../bindings/media/i2c/toshiba,et8ek8.txt | 56 + .../devicetree/bindings/media/video-interfaces.txt | 11 +- arch/arm/boot/dts/omap3-n900.dts | 139 ++ drivers/media/i2c/Kconfig |1 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/smia/Kconfig | 17 + drivers/media/i2c/smia/Makefile|2 + drivers/media/i2c/smia/et8ek8.c| 1788 drivers/media/i2c/smia/smiaregs.c | 724 drivers/media/i2c/smiapp-pll.c |3 +- drivers/media/i2c/smiapp/smiapp-core.c | 18 +- drivers/media/i2c/smiapp/smiapp-quirk.h| 10 +- drivers/media/platform/Kconfig | 10 + drivers/media/platform/Makefile|2 + drivers/media/platform/omap3isp/isp.c | 112 +- drivers/media/platform/omap3isp/ispccp2.c | 34 +- drivers/media/platform/omap3isp/ispreg.h |4 + drivers/media/platform/omap3isp/omap3isp.h |1 + drivers/media/platform/video-bus-switch.c | 366 drivers/media/v4l2-core/v4l2-async.c | 50 +- drivers/media/v4l2-core/v4l2-device.c |3 + drivers/media/v4l2-core/v4l2-of.c | 137 +- include/media/smiaregs.h | 143 ++ include/media/v4l2-async.h |2 + include/media/v4l2-mediabus.h |4 + include/media/v4l2-of.h| 17 + include/uapi/linux/media.h |1 + include/uapi/linux/v4l2-controls.h | 17 + 28 files changed, 3579 insertions(+), 94 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.txt create mode 100644 drivers/media/i2c/smia/Kconfig create mode 100644 drivers/media/i2c/smia/Makefile create mode 100644 drivers/media/i2c/smia/et8ek8.c create mode 100644 drivers/media/i2c/smia/smiaregs.c create mode 100644
[RFC PATCH 01/24] V4L fixes
From: "Tuukka.O Toivonen" Squashed from the following upstream commits: V4L: Create control class for sensor mode V4L: add ad5820 focus specific custom controls V4L: add V4L2_CID_TEST_PATTERN V4L: Add V4L2_CID_MODE_OPSYSCLOCK for reading output system clock Signed-off-by: Tuukka Toivonen Signed-off-by: Pali Rohár --- include/uapi/linux/v4l2-controls.h | 17 + 1 file changed, 17 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index b6a357a..23011cc 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -62,6 +62,7 @@ #define V4L2_CTRL_CLASS_FM_RX 0x00a1 /* FM Receiver controls */ #define V4L2_CTRL_CLASS_RF_TUNER 0x00a2 /* RF tuner controls */ #define V4L2_CTRL_CLASS_DETECT 0x00a3 /* Detection controls */ +#define V4L2_CTRL_CLASS_MODE 0x00a4 /* Sensor mode information */ /* User-class control IDs */ @@ -974,4 +975,20 @@ enum v4l2_detect_md_mode { #define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3) #define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4) +/* SMIA-type sensor information */ +#define V4L2_CID_MODE_CLASS_BASE (V4L2_CTRL_CLASS_MODE | 0x900) +#define V4L2_CID_MODE_CLASS(V4L2_CTRL_CLASS_MODE | 1) +#define V4L2_CID_MODE_FRAME_WIDTH (V4L2_CID_MODE_CLASS_BASE+1) +#define V4L2_CID_MODE_FRAME_HEIGHT (V4L2_CID_MODE_CLASS_BASE+2) +#define V4L2_CID_MODE_VISIBLE_WIDTH(V4L2_CID_MODE_CLASS_BASE+3) +#define V4L2_CID_MODE_VISIBLE_HEIGHT (V4L2_CID_MODE_CLASS_BASE+4) +#define V4L2_CID_MODE_PIXELCLOCK (V4L2_CID_MODE_CLASS_BASE+5) +#define V4L2_CID_MODE_SENSITIVITY (V4L2_CID_MODE_CLASS_BASE+6) +#define V4L2_CID_MODE_OPSYSCLOCK (V4L2_CID_MODE_CLASS_BASE+7) + +/* Control IDs specific to the AD5820 driver as defined by V4L2 */ +#define V4L2_CID_FOCUS_AD5820_BASE (V4L2_CTRL_CLASS_CAMERA | 0x10af) +#define V4L2_CID_FOCUS_AD5820_RAMP_TIME (V4L2_CID_FOCUS_AD5820_BASE+0) +#define V4L2_CID_FOCUS_AD5820_RAMP_MODE (V4L2_CID_FOCUS_AD5820_BASE+1) + #endif -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 22/24] [media] omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 mode
ISP CSI1 module needs all the bits correctly set to work. Signed-off-by: Ivaylo Dimitrov --- drivers/media/platform/omap3isp/isp.c | 2 ++ drivers/media/platform/omap3isp/ispccp2.c | 7 +-- drivers/media/platform/omap3isp/ispreg.h | 4 drivers/media/platform/omap3isp/omap3isp.h | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index e51a1f9..6361fde 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -2056,6 +2056,8 @@ static void isp_of_parse_node_csi1(struct device *dev, * sensor. Frame descriptors, perhaps? */ buscfg->bus.ccp2.crc = 1; + + buscfg->bus.ccp2.vp_clk_pol = 1; } static void isp_of_parse_node_csi2(struct device *dev, diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c index ca09523..7bb7feb 100644 --- a/drivers/media/platform/omap3isp/ispccp2.c +++ b/drivers/media/platform/omap3isp/ispccp2.c @@ -213,14 +213,17 @@ static int ccp2_phyif_config(struct isp_ccp2_device *ccp2, struct isp_device *isp = to_isp_device(ccp2); u32 val; - /* CCP2B mode */ val = isp_reg_readl(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL) | - ISPCCP2_CTRL_IO_OUT_SEL | ISPCCP2_CTRL_MODE; + ISPCCP2_CTRL_MODE; /* Data/strobe physical layer */ BIT_SET(val, ISPCCP2_CTRL_PHY_SEL_SHIFT, ISPCCP2_CTRL_PHY_SEL_MASK, buscfg->phy_layer); + BIT_SET(val, ISPCCP2_CTRL_IO_OUT_SEL_SHIFT, + ISPCCP2_CTRL_IO_OUT_SEL_MASK, buscfg->ccp2_mode); BIT_SET(val, ISPCCP2_CTRL_INV_SHIFT, ISPCCP2_CTRL_INV_MASK, buscfg->strobe_clk_pol); + BIT_SET(val, ISPCCP2_CTRL_VP_CLK_POL_SHIFT, + ISPCCP2_CTRL_VP_CLK_POL_MASK, buscfg->vp_clk_pol); isp_reg_writel(isp, val, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL); val = isp_reg_readl(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_CTRL); diff --git a/drivers/media/platform/omap3isp/ispreg.h b/drivers/media/platform/omap3isp/ispreg.h index b5ea8da..d084839 100644 --- a/drivers/media/platform/omap3isp/ispreg.h +++ b/drivers/media/platform/omap3isp/ispreg.h @@ -87,6 +87,8 @@ #define ISPCCP2_CTRL_PHY_SEL_MASK 0x1 #define ISPCCP2_CTRL_PHY_SEL_SHIFT 1 #define ISPCCP2_CTRL_IO_OUT_SEL(1 << 2) +#define ISPCCP2_CTRL_IO_OUT_SEL_MASK 0x1 +#define ISPCCP2_CTRL_IO_OUT_SEL_SHIFT 2 #define ISPCCP2_CTRL_MODE (1 << 4) #define ISPCCP2_CTRL_VP_CLK_FORCE_ON (1 << 9) #define ISPCCP2_CTRL_INV (1 << 10) @@ -94,6 +96,8 @@ #define ISPCCP2_CTRL_INV_SHIFT 10 #define ISPCCP2_CTRL_VP_ONLY_EN(1 << 11) #define ISPCCP2_CTRL_VP_CLK_POL(1 << 12) +#define ISPCCP2_CTRL_VP_CLK_POL_MASK 0x1 +#define ISPCCP2_CTRL_VP_CLK_POL_SHIFT 12 #define ISPCCP2_CTRL_VPCLK_DIV_SHIFT 15 #define ISPCCP2_CTRL_VPCLK_DIV_MASK0x1 /* [31:15] */ #define ISPCCP2_CTRL_VP_OUT_CTRL_SHIFT 8 /* 3430 bits */ diff --git a/drivers/media/platform/omap3isp/omap3isp.h b/drivers/media/platform/omap3isp/omap3isp.h index 443e8f7..f6d1d0d 100644 --- a/drivers/media/platform/omap3isp/omap3isp.h +++ b/drivers/media/platform/omap3isp/omap3isp.h @@ -108,6 +108,7 @@ struct isp_ccp2_cfg { unsigned int ccp2_mode:1; unsigned int phy_layer:1; unsigned int vpclk_div:2; + unsigned int vp_clk_pol:1; struct isp_csiphy_lanes_cfg lanecfg; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 20/24] ARM: dts: omap3-n900: enable cameras
Signed-off-by: Ivaylo Dimitrov --- arch/arm/boot/dts/omap3-n900.dts | 140 +++ 1 file changed, 140 insertions(+) diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index cc4cab2..03e1613 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts @@ -177,6 +177,84 @@ io-channels = <&twl_madc 0>, <&twl_madc 4>, <&twl_madc 12>; io-channel-names = "temp", "bsi", "vbat"; }; + + rear_camera: camera@0 { + compatible = "linux,camera"; + + module { + model = "TCM8341MD"; + sensor = <&cam1>; + focus = <&autofocus>; + }; + }; + + front_camera: camera@1 { + compatible = "linux,camera"; + + module { + model = "VS6555"; + sensor = <&cam2>; + }; + }; + + video-bus-switch { + compatible = "video-bus-switch"; + + switch-gpios = <&gpio4 1 GPIO_ACTIVE_HIGH>; /* 97 */ + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + csi_switch_in: endpoint { + remote-endpoint = <&csi_isp>; + }; + }; + + port@1 { + reg = <1>; + + csi_switch_out1: endpoint { + remote-endpoint = <&csi_cam1>; + }; + }; + + port@2 { + reg = <2>; + + csi_switch_out2: endpoint { + remote-endpoint = <&csi_cam2>; + }; + }; + }; + }; +}; + +&isp { + vdds_csib-supply = <&vaux2>; + + pinctrl-names = "default"; + pinctrl-0 = <&camera_pins>; + + ports { + port@1 { + reg = <1>; + + csi_isp: endpoint { + remote-endpoint = <&csi_switch_in>; + bus-type = <3>; /* CCP2 */ + clock-lanes = <0>; + data-lanes = <1>; + lane-polarity = <0 0>; + clock-inv = <0>; + strobe = <0>; + crc = <0>; + }; + }; + }; }; &omap3_pmx_core { @@ -341,6 +419,22 @@ OMAP3_CORE1_IOPAD(0x218e, PIN_OUTPUT | MUX_MODE4) /* gpio 157 => cmt_bsi */ >; }; + + camera_pins: pinmux_camera { + pinctrl-single,pins = < + OMAP3_CORE1_IOPAD(0x210c, PIN_OUTPUT | MUX_MODE7) /* cam_hs */ + OMAP3_CORE1_IOPAD(0x210e, PIN_OUTPUT | MUX_MODE7) /* cam_vs */ + OMAP3_CORE1_IOPAD(0x2110, PIN_OUTPUT | MUX_MODE0) /* cam_xclka */ + OMAP3_CORE1_IOPAD(0x211e, PIN_OUTPUT | MUX_MODE7) /* cam_d4 */ + OMAP3_CORE1_IOPAD(0x2122, PIN_INPUT | MUX_MODE0) /* cam_d6 */ + OMAP3_CORE1_IOPAD(0x2124, PIN_INPUT | MUX_MODE0) /* cam_d7 */ + OMAP3_CORE1_IOPAD(0x2126, PIN_INPUT | MUX_MODE0) /* cam_d8 */ + OMAP3_CORE1_IOPAD(0x2128, PIN_INPUT | MUX_MODE0) /* cam_d9 */ + OMAP3_CORE1_IOPAD(0x212a, PIN_OUTPUT | MUX_MODE7) /* cam_d10 */ + OMAP3_CORE1_IOPAD(0x212e, PIN_OUTPUT | MUX_MODE7) /* cam_xclkb */ + OMAP3_CORE1_IOPAD(0x2132, PIN_OUTPUT | MUX_MODE0) /* cam_strobe */ + >; + }; }; &i2c1 { @@ -529,6 +623,28 @@ clock-frequency = <10>; + cam2: camera@10 { + compatible = "nokia,smia"; + reg = <0x10>; + + vana-supply = <&vaux4>; + + clocks = <&isp 0>; + clock-frequency = <960>; + + port { + csi_cam2: endpoint { + link-frequencies = /bits/ 64 <6000>; + bus-type = <3>; /* CCP2 */ + strobe = <0>; + clock-inv = <0>; + crc = <0>; + + remote-endpoint = <&csi_switch_out2>; + }; + }; + }; + tlv320aic3x: tlv320aic3x@18 {
[RFC PATCH 23/24] [media] omap3isp: Make sure CSI1 interface is enabled in CPP2 mode
OMAP3430 needs various syscon CONTROL_CSIRXFE bits set in order to operate. Implement the missing functionality. Signed-off-by: Ivaylo Dimitrov --- drivers/media/platform/omap3isp/ispccp2.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c index 7bb7feb..833eed4 100644 --- a/drivers/media/platform/omap3isp/ispccp2.c +++ b/drivers/media/platform/omap3isp/ispccp2.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "isp.h" #include "ispreg.h" @@ -160,6 +161,32 @@ static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) return ret; } + if (isp->revision == ISP_REVISION_2_0) { + struct media_pad *pad; + struct v4l2_subdev *sensor; + const struct isp_ccp2_cfg *buscfg; + u32 csirxfe; + + pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]); + sensor = media_entity_to_v4l2_subdev(pad->entity); + buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2; + + + if (enable) { + csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ | + OMAP343X_CONTROL_CSIRXFE_RESET; + + if (buscfg->phy_layer) + csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM; + + if (buscfg->strobe_clk_pol) + csirxfe |= OMAP343X_CONTROL_CSIRXFE_CSIB_INV; + } else + csirxfe = 0; + + regmap_write(isp->syscon, isp->syscon_offset, csirxfe); + } + /* Enable/Disable all the LCx channels */ for (i = 0; i < CCP2_LCx_CHANS_NUM; i++) isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_LCx_CTRL(i), -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 15/24] media: add subdev type for bus switch
From: Sebastian Reichel --- include/uapi/linux/media.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index df59ede..244bea1 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -137,6 +137,7 @@ struct media_device_info { * MEDIA_ENT_F_IF_VID_DECODER and/or MEDIA_ENT_F_IF_AUD_DECODER. */ #define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5) +#define MEDIA_ENT_F_SWITCH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 6) #define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWNMEDIA_ENT_F_OLD_SUBDEV_BASE -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 13/24] v4l: of: Support CSI-1 and CCP2 busses
Add support for parsing of CSI-1 and CCP2 bus related properties documented in video-interfaces.txt. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-of.c | 35 +++ include/media/v4l2-of.h | 17 + 2 files changed, 52 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c index 60bbc5f..5c0d0eb 100644 --- a/drivers/media/v4l2-core/v4l2-of.c +++ b/drivers/media/v4l2-core/v4l2-of.c @@ -23,6 +23,8 @@ enum v4l2_of_bus_type { V4L2_OF_BUS_TYPE_CSI2 = 0, V4L2_OF_BUS_TYPE_PARALLEL, + V4L2_OF_BUS_TYPE_CSI1, + V4L2_OF_BUS_TYPE_CCP2, }; static int v4l2_of_parse_lanes(const struct device_node *node, @@ -163,6 +165,35 @@ static void v4l2_of_parse_parallel_bus(const struct device_node *node, } +void v4l2_of_parse_csi1_bus(const struct device_node *node, + struct v4l2_of_endpoint *endpoint, + enum v4l2_of_bus_type bus_type) +{ + struct v4l2_of_bus_mipi_csi1 *bus = &endpoint->bus.mipi_csi1; + u32 v; + + v4l2_of_parse_lanes(node, &bus->clock_lane, NULL, + &bus->data_lane, bus->lane_polarity, + NULL, 1); + + if (!of_property_read_u32(node, "clock-inv", &v)) + bus->clock_inv = v; + + if (!of_property_read_u32(node, "strobe", &v)) + bus->strobe = v; + + if (!of_property_read_u32(node, "data-lane", &v)) + bus->data_lane = v; + + if (!of_property_read_u32(node, "clock-lane", &v)) + bus->clock_lane = v; + + if (bus_type == V4L2_OF_BUS_TYPE_CSI1) + endpoint->bus_type = V4L2_MBUS_CSI1; + else + endpoint->bus_type = V4L2_MBUS_CCP2; +} + /** * v4l2_of_parse_endpoint() - parse all endpoint node properties * @node: pointer to endpoint device_node @@ -216,6 +247,10 @@ int v4l2_of_parse_endpoint(const struct device_node *node, case V4L2_OF_BUS_TYPE_PARALLEL: v4l2_of_parse_parallel_bus(node, endpoint); return 0; + case V4L2_OF_BUS_TYPE_CSI1: + case V4L2_OF_BUS_TYPE_CCP2: + v4l2_of_parse_csi1_bus(node, endpoint, bus_type); + return 0; default: pr_warn("bad bus-type %u, device_node \"%s\"\n", bus_type, node->full_name); diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h index 4dc34b2..63a52ee 100644 --- a/include/media/v4l2-of.h +++ b/include/media/v4l2-of.h @@ -53,6 +53,22 @@ struct v4l2_of_bus_parallel { }; /** + * struct v4l2_of_bus_csi1 - CSI-1/CCP2 data bus structure + * @clock_inv: polarity of clock/strobe signal + *false - not inverted, true - inverted + * @strobe: false - data/clock, true - data/strobe + * @data_lane: the number of the data lane + * @clock_lane: the number of the clock lane + */ +struct v4l2_of_bus_mipi_csi1 { + bool clock_inv; + bool strobe; + bool lane_polarity[2]; + unsigned char data_lane; + unsigned char clock_lane; +}; + +/** * struct v4l2_of_endpoint - the endpoint data structure * @base: struct of_endpoint containing port, id, and local of_node * @bus_type: bus type @@ -66,6 +82,7 @@ struct v4l2_of_endpoint { enum v4l2_mbus_type bus_type; union { struct v4l2_of_bus_parallel parallel; + struct v4l2_of_bus_mipi_csi1 mipi_csi1; struct v4l2_of_bus_mipi_csi2 mipi_csi2; } bus; u64 *link_frequencies; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 03/24] et8ek8: Toshiba 5MP sensor driver
add driver Signed-off-by: Ivaylo Dimitrov --- drivers/media/i2c/smia/Kconfig |8 + drivers/media/i2c/smia/Makefile |1 + drivers/media/i2c/smia/et8ek8.c | 1788 +++ 3 files changed, 1797 insertions(+) create mode 100644 drivers/media/i2c/smia/et8ek8.c diff --git a/drivers/media/i2c/smia/Kconfig b/drivers/media/i2c/smia/Kconfig index d9be497..13ca043 100644 --- a/drivers/media/i2c/smia/Kconfig +++ b/drivers/media/i2c/smia/Kconfig @@ -7,3 +7,11 @@ config VIDEO_SMIAREGS Also a few helper functions are provided to work with binary register lists. + +config VIDEO_ET8EK8 + tristate "ET8EK8 camera sensor support" + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + select VIDEO_SMIAREGS + ---help--- + This is a driver for the Toshiba ET8EK8 5 MP camera sensor. + It is used for example in Nokia N900 (RX-51). diff --git a/drivers/media/i2c/smia/Makefile b/drivers/media/i2c/smia/Makefile index cff67bc..56cf15e 100644 --- a/drivers/media/i2c/smia/Makefile +++ b/drivers/media/i2c/smia/Makefile @@ -1 +1,2 @@ obj-$(CONFIG_VIDEO_SMIAREGS) += smiaregs.o +obj-$(CONFIG_VIDEO_ET8EK8)+= et8ek8.o diff --git a/drivers/media/i2c/smia/et8ek8.c b/drivers/media/i2c/smia/et8ek8.c new file mode 100644 index 000..46c112d --- /dev/null +++ b/drivers/media/i2c/smia/et8ek8.c @@ -0,0 +1,1788 @@ +/* + * drivers/media/video/et8ek8.c + * + * Copyright (C) 2008 Nokia Corporation + * + * Contact: Sakari Ailus + * Tuukka Toivonen + * + * Based on code from Toni Leinonen . + * + * This driver is based on the Micron MT9T012 camera imager driver + * (C) Texas Instruments. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#define DEBUG + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define ET8EK8_NAME"et8ek8" +#define ET8EK8_XCLK_HZ 960 +#define ET8EK8_PRIV_MEM_SIZE 128 + +#define CTRL_GAIN 0 +#define CTRL_EXPOSURE 1 +#define CTRL_TEST_PATTERN 2 + +#define CID_TO_CTRL(id)((id)==V4L2_CID_GAIN ? CTRL_GAIN : \ +(id)==V4L2_CID_EXPOSURE ? CTRL_EXPOSURE : \ +(id)==V4L2_CID_TEST_PATTERN ? CTRL_TEST_PATTERN : \ +-EINVAL) + +struct et8ek8_sensor { + struct v4l2_subdev subdev; + struct media_pad pad; + struct v4l2_mbus_framefmt format; + struct gpio_desc *reset; + struct regulator *vana; + struct clk *ext_clk; + + u16 version; + + struct v4l2_ctrl_handler ctrl_handler; + struct v4l2_ctrl *exposure; + struct v4l2_ctrl *pixel_rate; + struct smia_reglist *current_reglist; + + u8 priv_mem[ET8EK8_PRIV_MEM_SIZE]; + + struct mutex power_lock; + int power_count; +}; + +#define to_et8ek8_sensor(sd) container_of(sd, struct et8ek8_sensor, subdev) + +enum et8ek8_versions { + ET8EK8_REV_1 = 0x0001, + ET8EK8_REV_2, +}; + +/* + * This table describes what should be written to the sensor register + * for each gain value. The gain(index in the table) is in terms of + * 0.1EV, i.e. 10 indexes in the table give 2 time more gain [0] in + * the *analog gain, [1] in the digital gain + * + * Analog gain [dB] = 20*log10(regvalue/32); 0x20..0x100 + */ +static struct et8ek8_gain { + u16 analog; + u16 digital; +} const et8ek8_gain_table[] = { + { 32,0}, /* x1 */ + { 34,0}, + { 37,0}, + { 39,0}, + { 42,0}, + { 45,0}, + { 49,0}, + { 52,0}, + { 56,0}, + { 60,0}, + { 64,0}, /* x2 */ + { 69,0}, + { 74,0}, + { 79,0}, + { 84,0}, + { 91,0}, + { 97,0}, + {104,0}, + {111,0}, + {119,0}, + {128,0}, /* x4 */ + {137,0}, + {147,0}, + {158,0}, + {169,0}, + {181,0}, + {194,0}, + {208,0}, + {223,0}, + {239,0}, + {256,0}, /* x8 */ + {256, 73}, + {256, 152}, + {256, 236}, + {256, 327}, + {256, 424}, +
[RFC PATCH 07/24] v4l: of: Call CSI2 bus csi2, not csi
From: Sakari Ailus The function to parse CSI2 bus parameters was called v4l2_of_parse_csi_bus(), rename it as v4l2_of_parse_csi2_bus() in anticipation of CSI1/CCP2 support. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-of.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c index 93b3368..f2618fd 100644 --- a/drivers/media/v4l2-core/v4l2-of.c +++ b/drivers/media/v4l2-core/v4l2-of.c @@ -20,7 +20,7 @@ #include -static int v4l2_of_parse_csi_bus(const struct device_node *node, +static int v4l2_of_parse_csi2_bus(const struct device_node *node, struct v4l2_of_endpoint *endpoint) { struct v4l2_of_bus_mipi_csi2 *bus = &endpoint->bus.mipi_csi2; @@ -158,7 +158,7 @@ int v4l2_of_parse_endpoint(const struct device_node *node, memset(&endpoint->bus_type, 0, sizeof(*endpoint) - offsetof(typeof(*endpoint), bus_type)); - rval = v4l2_of_parse_csi_bus(node, endpoint); + rval = v4l2_of_parse_csi2_bus(node, endpoint); if (rval) return rval; /* -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 02/24] smiaregs: Generic i2c register writing
Signed-off-by: Ivaylo Dimitrov --- drivers/media/i2c/Kconfig | 1 + drivers/media/i2c/Makefile| 1 + drivers/media/i2c/smia/Kconfig| 9 + drivers/media/i2c/smia/Makefile | 1 + drivers/media/i2c/smia/smiaregs.c | 724 ++ include/media/smiaregs.h | 143 6 files changed, 879 insertions(+) create mode 100644 drivers/media/i2c/smia/Kconfig create mode 100644 drivers/media/i2c/smia/Makefile create mode 100644 drivers/media/i2c/smia/smiaregs.c create mode 100644 include/media/smiaregs.h diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 993dc50..254c106 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -629,6 +629,7 @@ config VIDEO_S5K5BAF camera sensor with an embedded SoC image signal processor. source "drivers/media/i2c/smiapp/Kconfig" +source "drivers/media/i2c/smia/Kconfig" config VIDEO_S5C73M3 tristate "Samsung S5C73M3 sensor support" diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 94f2c99..05e79aa 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_VIDEO_SMIAPP) += smiapp/ obj-$(CONFIG_VIDEO_CX25840) += cx25840/ obj-$(CONFIG_VIDEO_M5MOLS) += m5mols/ obj-y += soc_camera/ +obj-y += smia/ obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o diff --git a/drivers/media/i2c/smia/Kconfig b/drivers/media/i2c/smia/Kconfig new file mode 100644 index 000..d9be497 --- /dev/null +++ b/drivers/media/i2c/smia/Kconfig @@ -0,0 +1,9 @@ +config VIDEO_SMIAREGS + tristate "Generic SMIA I2C register access and register list helper" + depends on I2C + ---help--- + This allows writing and reading SMIA image sensors' I2C registers + easily. + + Also a few helper functions are provided to work with binary + register lists. diff --git a/drivers/media/i2c/smia/Makefile b/drivers/media/i2c/smia/Makefile new file mode 100644 index 000..cff67bc --- /dev/null +++ b/drivers/media/i2c/smia/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_SMIAREGS) += smiaregs.o diff --git a/drivers/media/i2c/smia/smiaregs.c b/drivers/media/i2c/smia/smiaregs.c new file mode 100644 index 000..1479bba --- /dev/null +++ b/drivers/media/i2c/smia/smiaregs.c @@ -0,0 +1,724 @@ +/* + * drivers/media/i2c/smia/smiaregs.c + * + * Copyright (C) 2008 Nokia Corporation + * + * Contact: Sakari Ailus + * Tuukka Toivonen + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include + +/* + * Video control helpers + */ +int smia_ctrl_find(const struct v4l2_queryctrl *ctrls, size_t nctrls, int id) +{ + size_t i; + + for (i = 0; i < nctrls; i++) + if (ctrls[i].id == id) + break; + + if (i == nctrls) + i = -EINVAL; + + return i; +} +EXPORT_SYMBOL_GPL(smia_ctrl_find); + +int smia_ctrl_find_next(const struct v4l2_queryctrl *ctrls, size_t nctrls, + int id) +{ + int i; + u32 best = (u32)-1; + + for (i = 0; i < nctrls; i++) + if (ctrls[i].id > id + && (best == (u32)-1 || ctrls[i].id < ctrls[best].id)) + best = i; + + if (best == (u32)-1) + return -EINVAL; + + return best; +} +EXPORT_SYMBOL_GPL(smia_ctrl_find_next); + +int smia_ctrl_query(const struct v4l2_queryctrl *ctrls, size_t nctrls, + struct v4l2_queryctrl *a) +{ + int id, i; + + id = a->id; + if (id & V4L2_CTRL_FLAG_NEXT_CTRL) { + id &= ~V4L2_CTRL_FLAG_NEXT_CTRL; + i = smia_ctrl_find_next(ctrls, nctrls, id); + } else { + i = smia_ctrl_find(ctrls, nctrls, id); + } + + if (i < 0) + return -EINVAL; + + *a = ctrls[i]; + + return 0; +} +EXPORT_SYMBOL_GPL(smia_ctrl_query); + +int smia_mode_query(const __u32 *ctrls, size_t nctrls, struct v4l2_queryctrl *a) +{ + static const struct { + __u32 id; + char *name; + } ctrl[] = { + { .id = V4L2_CID_MODE_FRAME_WIDTH,.name = "Frame width" }, +
[RFC PATCH 08/24] v4l: of: Obtain data bus type from bus-type property
From: Sakari Ailus Only try parsing bus specific properties in this case. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-of.c | 42 +-- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c index f2618fd..5304137 100644 --- a/drivers/media/v4l2-core/v4l2-of.c +++ b/drivers/media/v4l2-core/v4l2-of.c @@ -20,6 +20,11 @@ #include +enum v4l2_of_bus_type { + V4L2_OF_BUS_TYPE_CSI2 = 0, + V4L2_OF_BUS_TYPE_PARALLEL, +}; + static int v4l2_of_parse_csi2_bus(const struct device_node *node, struct v4l2_of_endpoint *endpoint) { @@ -151,6 +156,7 @@ static void v4l2_of_parse_parallel_bus(const struct device_node *node, int v4l2_of_parse_endpoint(const struct device_node *node, struct v4l2_of_endpoint *endpoint) { + u32 bus_type; int rval; of_graph_parse_endpoint(node, &endpoint->base); @@ -158,17 +164,33 @@ int v4l2_of_parse_endpoint(const struct device_node *node, memset(&endpoint->bus_type, 0, sizeof(*endpoint) - offsetof(typeof(*endpoint), bus_type)); - rval = v4l2_of_parse_csi2_bus(node, endpoint); - if (rval) - return rval; - /* -* Parse the parallel video bus properties only if none -* of the MIPI CSI-2 specific properties were found. -*/ - if (endpoint->bus.mipi_csi2.flags == 0) - v4l2_of_parse_parallel_bus(node, endpoint); + rval = of_property_read_u32(node, "bus-type", &bus_type); + if (rval < 0) { + endpoint->bus_type = 0; + rval = v4l2_of_parse_csi2_bus(node, endpoint); + if (rval) + return rval; + /* +* Parse the parallel video bus properties only if none +* of the MIPI CSI-2 specific properties were found. +*/ + if (endpoint->bus.mipi_csi2.flags == 0) + v4l2_of_parse_parallel_bus(node, endpoint); + + return 0; + } - return 0; + switch (bus_type) { + case V4L2_OF_BUS_TYPE_CSI2: + return v4l2_of_parse_csi2_bus(node, endpoint); + case V4L2_OF_BUS_TYPE_PARALLEL: + v4l2_of_parse_parallel_bus(node, endpoint); + return 0; + default: + pr_warn("bad bus-type %u, device_node \"%s\"\n", + bus_type, node->full_name); + return -EINVAL; + } } EXPORT_SYMBOL(v4l2_of_parse_endpoint); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 17/24] smiapp: add CCP2 support
From: Sebastian Reichel Add support for CCP2 connected SMIA sensors as found on the Nokia N900. Signed-off-by: Sebastian Reichel --- drivers/media/i2c/smiapp/smiapp-core.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index c6a897b..ec19532 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -3016,13 +3016,19 @@ static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev) switch (bus_cfg->bus_type) { case V4L2_MBUS_CSI2: pdata->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2; + pdata->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes; + break; + case V4L2_MBUS_CCP2: + pdata->csi_signalling_mode = (bus_cfg->bus.mipi_csi1.strobe) ? + SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE : + SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK; + pdata->lanes = 1; break; - /* FIXME: add CCP2 support. */ default: + dev_err(dev, "unknown bus protocol\n"); goto out_err; } - pdata->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes; dev_dbg(dev, "lanes %u\n", pdata->lanes); /* xshutdown GPIO is optional */ @@ -3039,7 +3045,7 @@ static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev) goto out_err; } - dev_dbg(dev, "reset %d, nvm %d, clk %d, csi %d\n", pdata->xshutdown, + dev_dbg(dev, "reset %d, nvm %d, clk %d, mode %d\n", pdata->xshutdown, pdata->nvm_size, pdata->ext_clk, pdata->csi_signalling_mode); if (!bus_cfg->nr_of_link_frequencies) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 18/24] v4l2-async: per notifier locking
From: Sebastian Reichel --- drivers/media/v4l2-core/v4l2-async.c | 50 ++-- include/media/v4l2-async.h | 2 ++ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index a4b224d..27789cd 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -56,7 +56,6 @@ static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) static LIST_HEAD(subdev_list); static LIST_HEAD(notifier_list); -static DEFINE_MUTEX(list_lock); static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd) @@ -106,14 +105,17 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier, if (notifier->bound) { ret = notifier->bound(notifier, sd, asd); - if (ret < 0) + if (ret < 0) { + dev_warn(notifier->v4l2_dev->dev, "subdev bound failed\n"); return ret; + } } /* Move from the global subdevice list to notifier's done */ list_move(&sd->async_list, ¬ifier->done); ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd); if (ret < 0) { + dev_warn(notifier->v4l2_dev->dev, "subdev register failed\n"); if (notifier->unbind) notifier->unbind(notifier, sd, asd); return ret; @@ -146,7 +148,7 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev, { struct v4l2_subdev *sd, *tmp; struct v4l2_async_subdev *asd; - int i; + int ret = 0, i; if (!notifier->num_subdevs || notifier->num_subdevs > V4L2_MAX_SUBDEVS) return -EINVAL; @@ -154,6 +156,7 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev, notifier->v4l2_dev = v4l2_dev; INIT_LIST_HEAD(¬ifier->waiting); INIT_LIST_HEAD(¬ifier->done); + mutex_init(¬ifier->lock); for (i = 0; i < notifier->num_subdevs; i++) { asd = notifier->subdevs[i]; @@ -173,28 +176,22 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev, list_add_tail(&asd->list, ¬ifier->waiting); } - mutex_lock(&list_lock); - /* Keep also completed notifiers on the list */ list_add(¬ifier->list, ¬ifier_list); + mutex_lock(¬ifier->lock); list_for_each_entry_safe(sd, tmp, &subdev_list, async_list) { - int ret; - asd = v4l2_async_belongs(notifier, sd); if (!asd) continue; ret = v4l2_async_test_notify(notifier, sd, asd); - if (ret < 0) { - mutex_unlock(&list_lock); - return ret; - } + if (ret < 0) + break; } + mutex_unlock(¬ifier->lock); - mutex_unlock(&list_lock); - - return 0; + return ret; } EXPORT_SYMBOL(v4l2_async_notifier_register); @@ -215,7 +212,7 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) "Failed to allocate device cache!\n"); } - mutex_lock(&list_lock); + mutex_lock(¬ifier->lock); list_del(¬ifier->list); @@ -242,7 +239,7 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) put_device(d); } - mutex_unlock(&list_lock); + mutex_unlock(¬ifier->lock); /* * Call device_attach() to reprobe devices @@ -267,6 +264,7 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) } kfree(dev); + mutex_destroy(¬ifier->lock); notifier->v4l2_dev = NULL; /* @@ -279,6 +277,7 @@ EXPORT_SYMBOL(v4l2_async_notifier_unregister); int v4l2_async_register_subdev(struct v4l2_subdev *sd) { struct v4l2_async_notifier *notifier; + struct v4l2_async_notifier *tmp; /* * No reference taken. The reference is held by the device @@ -288,24 +287,25 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd) if (!sd->of_node && sd->dev) sd->of_node = sd->dev->of_node; - mutex_lock(&list_lock); - INIT_LIST_HEAD(&sd->async_list); - list_for_each_entry(notifier, ¬ifier_list, list) { - struct v4l2_async_subdev *asd = v4l2_async_belongs(notifier, sd); + list_for_each_entry_safe(notifier, tmp, ¬ifier_list, list) { + struct v4l2_async_subdev *asd; + + /* TODO: FIXME: if this is called by ->bound() we will also iterate over the locked notifier */ + mutex_lock_nested(¬ifier->lock, SINGLE_DEPTH_NESTING); + asd = v4l2_asy
[RFC PATCH 19/24] v4l2_device_register_subdev_nodes: allow calling multiple times
From: Sebastian Reichel --- drivers/media/v4l2-core/v4l2-device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index 06fa5f1..5aebe0a 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -238,6 +238,9 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev) if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE)) continue; + if(sd->devnode) + continue; + vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); if (!vdev) { err = -ENOMEM; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 16/24] media: video-bus-switch: new driver
Signed-off-by: Ivaylo Dimitrov --- drivers/media/platform/Kconfig| 10 + drivers/media/platform/Makefile | 2 + drivers/media/platform/video-bus-switch.c | 366 ++ 3 files changed, 378 insertions(+) create mode 100644 drivers/media/platform/video-bus-switch.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 201f5c2..7c91fd2 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -91,6 +91,16 @@ config VIDEO_OMAP3_DEBUG ---help--- Enable debug messages on OMAP 3 camera controller driver. +config VIDEO_BUS_SWITCH + tristate "Video Bus switch" + depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + depends on MEDIA_CONTROLLER + depends on OF + ---help--- + Driver for a GPIO controlled video bus switch, which is used to + connect two camera sensors to the same port a the image signal + processor. + config VIDEO_S3C_CAMIF tristate "Samsung S3C24XX/S3C64XX SoC Camera Interface driver" depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index bbb7bd1..c456917 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -10,6 +10,8 @@ obj-$(CONFIG_VIDEO_MMP_CAMERA) += marvell-ccic/ obj-$(CONFIG_VIDEO_OMAP3) += omap3isp/ +obj-$(CONFIG_VIDEO_BUS_SWITCH) += video-bus-switch.o + obj-$(CONFIG_VIDEO_VIU) += fsl-viu.o obj-$(CONFIG_VIDEO_VIVID) += vivid/ diff --git a/drivers/media/platform/video-bus-switch.c b/drivers/media/platform/video-bus-switch.c new file mode 100644 index 000..7c850fd --- /dev/null +++ b/drivers/media/platform/video-bus-switch.c @@ -0,0 +1,366 @@ +/* + * Generic driver for video bus switches + * + * Copyright (C) 2015 Sebastian Reichel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ + +#define DEBUG + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * TODO: + * isp_subdev_notifier_complete() calls v4l2_device_register_subdev_nodes() + */ + +#define CSI_SWITCH_SUBDEVS 2 +#define CSI_SWITCH_PORTS 3 + +enum vbs_state { + CSI_SWITCH_DISABLED, + CSI_SWITCH_PORT_1, + CSI_SWITCH_PORT_2, +}; + +struct vbs_src_pads { + struct media_entity *src; + int src_pad; +}; + +struct vbs_data { + struct gpio_desc *swgpio; + struct v4l2_subdev subdev; + struct v4l2_async_notifier notifier; + struct media_pad pads[CSI_SWITCH_PORTS]; + struct vbs_src_pads src_pads[CSI_SWITCH_PORTS]; + enum vbs_state state; +}; + +struct vbs_async_subdev { + struct v4l2_subdev *sd; + struct v4l2_async_subdev asd; + u8 port; +}; + +static int vbs_of_parse_nodes(struct device *dev, struct vbs_data *pdata) +{ + struct v4l2_async_notifier *notifier = &pdata->notifier; + struct device_node *node = NULL; + + notifier->subdevs = devm_kcalloc(dev, CSI_SWITCH_SUBDEVS, + sizeof(*notifier->subdevs), GFP_KERNEL); + if (!notifier->subdevs) + return -ENOMEM; + + notifier->num_subdevs = 0; + while (notifier->num_subdevs < CSI_SWITCH_SUBDEVS && + (node = of_graph_get_next_endpoint(dev->of_node, node))) { + struct v4l2_of_endpoint vep; + struct vbs_async_subdev *ssd; + + /* skip first port (connected to isp) */ + v4l2_of_parse_endpoint(node, &vep); + if (vep.base.port == 0) { + struct device_node *ispnode; + + ispnode = of_graph_get_remote_port_parent(node); + if (!ispnode) { + dev_warn(dev, "bad remote port parent\n"); + return -EINVAL; + } + + of_node_put(node); + continue; + } + + ssd = devm_kzalloc(dev, sizeof(*ssd), GFP_KERNEL); + if (!ssd) { + of_node_put(node); + return -ENOMEM; + } + + ssd->port = vep.base.port; + + notifier->subdevs[notifier->num_subdevs] = &ssd->asd; + + ssd->asd.match.of.node = of_graph_get_remote_port_parent(node); + of_node_put(node); + if (!ssd->asd.match.of.node) { + dev_warn(dev, "bad remote port parent\n"); + return -
[RFC PATCH 14/24] media: et8ek8: add device tree binding document
From: Sebastian Reichel Add the document for et8ek8 dt. --- .../bindings/media/i2c/toshiba,et8ek8.txt | 56 ++ 1 file changed, 56 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.txt diff --git a/Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.txt b/Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.txt new file mode 100644 index 000..acb9290 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.txt @@ -0,0 +1,56 @@ +Toshiba ET8EK8 sensor + +Toshiba ET8EK8 is an image sensor used in the Nokia N900. + +Additional information about video interfaces in DT can be found in +Documentation/devicetree/bindings/media/video-interfaces.txt . + +Mandatory properties + + +- compatible: "toshiba,et8ek8" +- reg: I2C address (0x3e, or an alternative address) +- vana-supply: Analogue voltage supply (VANA), typically 2.8 volts (sensor + dependent). +- clocks: External clock to the sensor +- clock-frequency: Frequency of the external clock to the sensor + +Optional properties +--- + +- reset-gpios: XSHUTDOWN GPIO + + +Endpoint node mandatory properties +-- + +- clock-lanes: <0> +- data-lanes: <1> +- remote-endpoint: A phandle to the bus receiver's endpoint node. + +Example +--- + +&i2c2 { + clock-frequency = <40>; + + cam1: camera@3e { + compatible = "toshiba,et8ek8"; + reg = <0x3e>; + + vana-supply = <&vaux4>; + + clocks = <&isp 0>; + clock-frequency = <960>; + + reset-gpio = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* 102 */ + + port { + cam1_1: endpoint { + clock-lanes = <0>; + data-lanes = <1>; + remote-endpoint = <&isp_csi>; + }; + }; + }; +}; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 24/24] ARM: dts: omap3-n900: enable cameras - remove invalid entry
Signed-off-by: Ivaylo Dimitrov --- arch/arm/boot/dts/omap3-n900.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 03e1613..bf74f85 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts @@ -184,7 +184,6 @@ module { model = "TCM8341MD"; sensor = <&cam1>; - focus = <&autofocus>; }; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 11/24] dt: bindings: v4l: Add bus-type video interface property
From: Sakari Ailus In the vast majority of cases the bus type is known to the driver(s) since a receiver or transmitter can only support a single one. There are cases however where different options are possible. Signed-off-by: Sakari Ailus --- Documentation/devicetree/bindings/media/video-interfaces.txt | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt index 9cd2a36..f5b61bd 100644 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt @@ -76,6 +76,10 @@ Optional endpoint properties mode horizontal and vertical synchronization signals are provided to the slave device (data source) by the master device (data sink). In the master mode the data source device is also the source of the synchronization signals. +- bus-type: data bus type. Possible values are: + 0 - CSI2 + 1 - parallel / Bt656 + 2 - CCP2 - bus-width: number of data lines actively used, valid for the parallel busses. - data-shift: on the parallel data busses, if bus-width is used to specify the number of data lines, data-shift can be used to specify which data lines are -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 05/24] smiapp: Add smiapp_has_quirk() to tell whether a quirk is implemented
From: Sakari Ailus Signed-off-by: Sakari Ailus --- drivers/media/i2c/smiapp/smiapp-quirk.h | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-quirk.h b/drivers/media/i2c/smiapp/smiapp-quirk.h index dac5566..209818f 100644 --- a/drivers/media/i2c/smiapp/smiapp-quirk.h +++ b/drivers/media/i2c/smiapp/smiapp-quirk.h @@ -72,9 +72,12 @@ void smiapp_replace_limit(struct smiapp_sensor *sensor, .val = _val,\ } +#define smiapp_has_quirk(sensor, _quirk) \ + ((sensor)->minfo.quirk && \ +(sensor)->minfo.quirk->_quirk) + #define smiapp_call_quirk(sensor, _quirk, ...) \ - ((sensor)->minfo.quirk && \ -(sensor)->minfo.quirk->_quirk ?\ + (smiapp_has_quirk(sensor, _quirk) ? \ (sensor)->minfo.quirk->_quirk(sensor, ##__VA_ARGS__) : 0) #define smiapp_needs_quirk(sensor, _quirk) \ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 12/24] dt: bindings: Add CSI1/CCP2 related properties to video-interfaces.txt
From: Sakari Ailus Document the CSI1/CCP2 properties strobe_clk_inv and strobe_clock properties. The former tells whether the strobe/clock signal is inverted, while the latter signifies the clock or strobe mode. Signed-off-by: Sakari Ailus --- Documentation/devicetree/bindings/media/video-interfaces.txt | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt index f5b61bd..f0523f7 100644 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt @@ -114,9 +114,10 @@ Optional endpoint properties lane and followed by the data lanes in the same order as in data-lanes. Valid values are 0 (normal) and 1 (inverted). The length of the array should be the combined length of data-lanes and clock-lanes properties. - If the lane-polarities property is omitted, the value must be interpreted - as 0 (normal). This property is valid for serial busses only. - +- clock-inv: Clock or strobe signal inversion. + Possible values: 0 -- not inverted; 1 -- inverted +- strobe: Whether the clock signal is used as clock or strobe. Used + with CCP2, for instance. Example --- -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 10/24] v4l: of: Separate lane parsing from CSI-2 bus parameter parsing
From: Sakari Ailus The CSI-1 will need these as well, separate them into a different function. have_clk_lane and num_data_lanes arguments may be NULL; the CSI-1 bus will have no use for them. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-of.c | 60 +-- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c index 5304137..60bbc5f 100644 --- a/drivers/media/v4l2-core/v4l2-of.c +++ b/drivers/media/v4l2-core/v4l2-of.c @@ -25,53 +25,83 @@ enum v4l2_of_bus_type { V4L2_OF_BUS_TYPE_PARALLEL, }; -static int v4l2_of_parse_csi2_bus(const struct device_node *node, -struct v4l2_of_endpoint *endpoint) +static int v4l2_of_parse_lanes(const struct device_node *node, + unsigned char *clock_lane, + bool *have_clk_lane, + unsigned char *data_lanes, + bool *lane_polarities, + unsigned short *__num_data_lanes, + unsigned int max_data_lanes) { - struct v4l2_of_bus_mipi_csi2 *bus = &endpoint->bus.mipi_csi2; struct property *prop; - bool have_clk_lane = false; - unsigned int flags = 0; + unsigned short num_data_lanes = 0; u32 v; prop = of_find_property(node, "data-lanes", NULL); if (prop) { const __be32 *lane = NULL; - unsigned int i; - for (i = 0; i < ARRAY_SIZE(bus->data_lanes); i++) { + for (num_data_lanes = 0; num_data_lanes < max_data_lanes; +num_data_lanes++) { lane = of_prop_next_u32(prop, lane, &v); if (!lane) break; - bus->data_lanes[i] = v; + data_lanes[num_data_lanes] = v; } - bus->num_data_lanes = i; } + if (__num_data_lanes) + *__num_data_lanes = num_data_lanes; prop = of_find_property(node, "lane-polarities", NULL); if (prop) { const __be32 *polarity = NULL; unsigned int i; - for (i = 0; i < ARRAY_SIZE(bus->lane_polarities); i++) { + for (i = 0; i < 1 + max_data_lanes; i++) { polarity = of_prop_next_u32(prop, polarity, &v); if (!polarity) break; - bus->lane_polarities[i] = v; + lane_polarities[i] = v; } - if (i < 1 + bus->num_data_lanes /* clock + data */) { + if (i < 1 + num_data_lanes /* clock + data */) { pr_warn("%s: too few lane-polarities entries (need %u, got %u)\n", - node->full_name, 1 + bus->num_data_lanes, i); + node->full_name, 1 + num_data_lanes, i); return -EINVAL; } } + if (have_clk_lane) + *have_clk_lane = false; + if (!of_property_read_u32(node, "clock-lanes", &v)) { - bus->clock_lane = v; - have_clk_lane = true; + *clock_lane = v; + if (have_clk_lane) + *have_clk_lane = true; } + return 0; +} + +static int v4l2_of_parse_csi2_bus(const struct device_node *node, +struct v4l2_of_endpoint *endpoint) +{ + struct v4l2_of_bus_mipi_csi2 *bus = &endpoint->bus.mipi_csi2; + bool have_clk_lane = false; + unsigned int flags = 0; + int rval; + u32 v; + + rval = v4l2_of_parse_lanes(node, &bus->clock_lane, &have_clk_lane, + bus->data_lanes, bus->lane_polarities, + &bus->num_data_lanes, + ARRAY_SIZE(bus->data_lanes)); + if (rval) + return rval; + + BUILD_BUG_ON(1 + ARRAY_SIZE(bus->data_lanes) + != ARRAY_SIZE(bus->lane_polarities)); + if (of_get_property(node, "clock-noncontinuous", &v)) flags |= V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK; else if (have_clk_lane || bus->num_data_lanes > 0) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 21/24] omap3isp: dt: Add support for CSI1/CCP2 busses
From: Sakari Ailus Obtain the CSI1/CCP2 bus parameters from the OF node. Signed-off-by: Sakari Ailus --- drivers/media/platform/omap3isp/isp.c | 110 -- 1 file changed, 77 insertions(+), 33 deletions(-) diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 5d54e2c..e51a1f9 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -2020,12 +2020,84 @@ enum isp_of_phy { ISP_OF_PHY_CSIPHY2, }; +static void isp_of_parse_node_csi1(struct device *dev, + struct isp_bus_cfg *buscfg, + struct v4l2_of_endpoint *vep) +{ + if (vep->base.port == ISP_OF_PHY_CSIPHY1) + buscfg->interface = ISP_INTERFACE_CCP2B_PHY1; + else + buscfg->interface = ISP_INTERFACE_CCP2B_PHY2; + buscfg->bus.ccp2.lanecfg.clk.pos = vep->bus.mipi_csi1.clock_lane; + buscfg->bus.ccp2.lanecfg.clk.pol = + vep->bus.mipi_csi1.lane_polarity[0]; + dev_dbg(dev, "clock lane polarity %u, pos %u\n", + buscfg->bus.ccp2.lanecfg.clk.pol, + buscfg->bus.ccp2.lanecfg.clk.pos); + + buscfg->bus.ccp2.lanecfg.data[0].pos = vep->bus.mipi_csi2.data_lanes[0]; + buscfg->bus.ccp2.lanecfg.data[0].pol = + vep->bus.mipi_csi2.lane_polarities[1]; + dev_dbg(dev, "data lane polarity %u, pos %u\n", + buscfg->bus.ccp2.lanecfg.data[0].pol, + buscfg->bus.ccp2.lanecfg.data[0].pos); + + buscfg->bus.ccp2.strobe_clk_pol = vep->bus.mipi_csi1.clock_inv; + buscfg->bus.ccp2.phy_layer = vep->bus.mipi_csi1.strobe; + buscfg->bus.ccp2.ccp2_mode = vep->bus_type == V4L2_MBUS_CCP2; + + dev_dbg(dev, "clock_inv %u strobe %u ccp2 %u\n", + buscfg->bus.ccp2.strobe_clk_pol, + buscfg->bus.ccp2.phy_layer, + buscfg->bus.ccp2.ccp2_mode); + /* +* FIXME: now we assume the CRC is always there. +* Implement a way to obtain this information from the +* sensor. Frame descriptors, perhaps? +*/ + buscfg->bus.ccp2.crc = 1; +} + +static void isp_of_parse_node_csi2(struct device *dev, + struct isp_bus_cfg *buscfg, + struct v4l2_of_endpoint *vep) +{ + unsigned int i; + + if (vep->base.port == ISP_OF_PHY_CSIPHY1) + buscfg->interface = ISP_INTERFACE_CSI2C_PHY1; + else + buscfg->interface = ISP_INTERFACE_CSI2A_PHY2; + buscfg->bus.csi2.lanecfg.clk.pos = vep->bus.mipi_csi2.clock_lane; + buscfg->bus.csi2.lanecfg.clk.pol = + vep->bus.mipi_csi2.lane_polarities[0]; + dev_dbg(dev, "clock lane polarity %u, pos %u\n", + buscfg->bus.csi2.lanecfg.clk.pol, + buscfg->bus.csi2.lanecfg.clk.pos); + + for (i = 0; i < ISP_CSIPHY2_NUM_DATA_LANES; i++) { + buscfg->bus.csi2.lanecfg.data[i].pos = + vep->bus.mipi_csi2.data_lanes[i]; + buscfg->bus.csi2.lanecfg.data[i].pol = + vep->bus.mipi_csi2.lane_polarities[i + 1]; + dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i, + buscfg->bus.csi2.lanecfg.data[i].pol, + buscfg->bus.csi2.lanecfg.data[i].pos); + } + + /* +* FIXME: now we assume the CRC is always there. +* Implement a way to obtain this information from the +* sensor. Frame descriptors, perhaps? +*/ + buscfg->bus.csi2.crc = 1; +} + static int isp_of_parse_node(struct device *dev, struct device_node *node, struct isp_async_subdev *isd) { struct isp_bus_cfg *buscfg = &isd->bus; struct v4l2_of_endpoint vep; - unsigned int i; int ret; ret = v4l2_of_parse_endpoint(node, &vep); @@ -2055,38 +2127,10 @@ static int isp_of_parse_node(struct device *dev, struct device_node *node, case ISP_OF_PHY_CSIPHY1: case ISP_OF_PHY_CSIPHY2: - /* FIXME: always assume CSI-2 for now. */ - switch (vep.base.port) { - case ISP_OF_PHY_CSIPHY1: - buscfg->interface = ISP_INTERFACE_CSI2C_PHY1; - break; - case ISP_OF_PHY_CSIPHY2: - buscfg->interface = ISP_INTERFACE_CSI2A_PHY2; - break; - } - buscfg->bus.csi2.lanecfg.clk.pos = vep.bus.mipi_csi2.clock_lane; - buscfg->bus.csi2.lanecfg.clk.pol = - vep.bus.mipi_csi2.lane_polarities[0]; - dev_dbg(dev, "clock lane polarity %u, pos %u\n", - buscfg->bus.csi2.lanecfg.clk.pol, - buscfg->bus.csi2.lanecfg.clk.pos); - - for (i = 0; i < ISP_CSIPHY2_N
[RFC PATCH 04/24] smiapp-pll: Take existing divisor into account in minimum divisor check
From: Sakari Ailus Required added multiplier (and divisor) calculation did not take into account the existing divisor when checking the values against the minimum divisor. Do just that. Signed-off-by: Sakari Ailus --- drivers/media/i2c/smiapp-pll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/smiapp-pll.c b/drivers/media/i2c/smiapp-pll.c index e3348db..5ad1edb 100644 --- a/drivers/media/i2c/smiapp-pll.c +++ b/drivers/media/i2c/smiapp-pll.c @@ -227,7 +227,8 @@ static int __smiapp_pll_calculate( more_mul_factor = lcm(div, pll->pre_pll_clk_div) / div; dev_dbg(dev, "more_mul_factor: %u\n", more_mul_factor); - more_mul_factor = lcm(more_mul_factor, op_limits->min_sys_clk_div); + more_mul_factor = lcm(more_mul_factor, + DIV_ROUND_UP(op_limits->min_sys_clk_div, div)); dev_dbg(dev, "more_mul_factor: min_op_sys_clk_div: %d\n", more_mul_factor); i = roundup(more_mul_min, more_mul_factor); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 09/24] v4l: Add CSI1 and CCP2 bus type to enum v4l2_mbus_type
From: Sakari Ailus CCP2, or CSI-1, is an older single data lane serial bus. Signed-off-by: Sakari Ailus --- include/media/v4l2-mediabus.h | 4 1 file changed, 4 insertions(+) diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h index 34cc99e..315c167 100644 --- a/include/media/v4l2-mediabus.h +++ b/include/media/v4l2-mediabus.h @@ -69,11 +69,15 @@ * @V4L2_MBUS_PARALLEL:parallel interface with hsync and vsync * @V4L2_MBUS_BT656: parallel interface with embedded synchronisation, can * also be used for BT.1120 + * @V4L2_MBUS_CSI1:MIPI CSI-1 serial interface + * @V4L2_MBUS_CCP2:CCP2 (Compact Camera Port 2) * @V4L2_MBUS_CSI2:MIPI CSI-2 serial interface */ enum v4l2_mbus_type { V4L2_MBUS_PARALLEL, V4L2_MBUS_BT656, + V4L2_MBUS_CSI1, + V4L2_MBUS_CCP2, V4L2_MBUS_CSI2, }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 06/24] smiapp: Add quirk control support
From: Sakari Ailus Quirk controls can be set up in the init quirk. Signed-off-by: Sakari Ailus --- drivers/media/i2c/smiapp/smiapp-core.c | 6 ++ drivers/media/i2c/smiapp/smiapp-quirk.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 3dfe387..c6a897b 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -412,6 +412,12 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl) int exposure; int rval; + rval = smiapp_call_quirk(sensor, s_ctrl, ctrl); + if (rval < 0) + return rval; + if (rval > 0) + return 0; + switch (ctrl->id) { case V4L2_CID_ANALOGUE_GAIN: return smiapp_write( diff --git a/drivers/media/i2c/smiapp/smiapp-quirk.h b/drivers/media/i2c/smiapp/smiapp-quirk.h index 209818f..504c16a 100644 --- a/drivers/media/i2c/smiapp/smiapp-quirk.h +++ b/drivers/media/i2c/smiapp/smiapp-quirk.h @@ -32,6 +32,8 @@ struct smiapp_sensor; * @pll_flags: Return flags for the PLL calculator. * @init: Quirk initialisation, called the last in probe(). This is * also appropriate for adding sensor specific controls, for instance. + * @s_ctrl: Set control quirk. Returns 0 if the control isn't + * implemented by the quirk, > 0 if it is. * @reg_access: Register access quirk. The quirk may divert the access * to another register, or no register at all. * @@ -51,6 +53,7 @@ struct smiapp_quirk { int (*post_streamoff)(struct smiapp_sensor *sensor); unsigned long (*pll_flags)(struct smiapp_sensor *sensor); int (*init)(struct smiapp_sensor *sensor); + int (*s_ctrl)(struct smiapp_sensor *sensor, struct v4l2_ctrl *ctrl); int (*reg_access)(struct smiapp_sensor *sensor, bool write, u32 *reg, u32 *val); unsigned long flags; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3 01/12] vb2: add a dev field to use for the default allocation context
Hi Hans, On Saturday 23 Apr 2016 12:37:10 Hans Verkuil wrote: > On 04/23/2016 02:14 AM, Laurent Pinchart wrote: > > On Friday 22 Apr 2016 10:38:08 Hans Verkuil wrote: > >> From: Hans Verkuil > >> > >> The allocation context is nothing more than a per-plane device pointer > >> to use when allocating buffers. So just provide a dev pointer in > >> vb2_queue for that purpose and drivers can skip > >> allocating/releasing/filling in the allocation context unless they > >> require different per-plane device pointers as used by some Samsung > >> SoCs. > >> > >> Signed-off-by: Hans Verkuil > >> Cc: Laurent Pinchart > >> Cc: Sakari Ailus > >> Cc: Mauro Carvalho Chehab > >> Cc: Florian Echtler > >> Cc: Federico Vaga > >> Cc: "Lad, Prabhakar" > >> Cc: Scott Jiang > >> Cc: Philipp Zabel > >> Cc: Fabien Dessenne > >> Cc: Benoit Parrot > >> Cc: Mikhail Ulyanov > >> Cc: Guennadi Liakhovetski > >> Cc: Javier Martin > >> Cc: Jonathan Corbet > >> Cc: Ludovic Desroches > >> Cc: Sergei Shtylyov > >> Cc: Kyungmin Park > >> Cc: Sylwester Nawrocki > >> --- > >> > >> drivers/media/v4l2-core/videobuf2-core.c | 16 +--- > >> include/media/videobuf2-core.h | 3 +++ > >> 2 files changed, 12 insertions(+), 7 deletions(-) > >> > >> diff --git a/drivers/media/v4l2-core/videobuf2-core.c > >> b/drivers/media/v4l2-core/videobuf2-core.c index 5d016f4..88b5e48 100644 > >> --- a/drivers/media/v4l2-core/videobuf2-core.c > >> +++ b/drivers/media/v4l2-core/videobuf2-core.c > >> @@ -206,8 +206,9 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb) > >> > >>for (plane = 0; plane < vb->num_planes; ++plane) { > >> > >>unsigned long size = PAGE_ALIGN(vb->planes[plane].length); > >> > >> - mem_priv = call_ptr_memop(vb, alloc, q->alloc_ctx[plane], > >> -size, dma_dir, q->gfp_flags); > >> + mem_priv = call_ptr_memop(vb, alloc, > >> + q->alloc_ctx[plane] ? : &q->dev, > >> + size, dma_dir, q->gfp_flags); > > > > While the videobuf2-dma-sg allocation context indeed only contains a > > pointer to the device, the videobuf2-dma-contig context also contains a > > dma_attrs. This patch will break the videobuf2-dma-contig alloc > > implementation. > > Good point. I fixed this in the last patch, but that would mean dma-contig > would be broken for the patches in between. > > I'm moving dma_attrs to struct vb2_queue as the first patch, then the rest > will work fine. Couldn't a driver require different dma attributes per plane ? Would it make sense to keep the allocation context structure, and use the struct device and dma attributes stored in the queue when no allocation context is provided ? > I've also taken care of the vsp1_video comments. Thank you. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 00/24] Make Nokia N900 cameras working
Hi! > Those patch series make cameras on Nokia N900 partially working. > Some more patches are needed, but I've already sent them for > upstreaming so they are not part of the series: > > https://lkml.org/lkml/2016/4/16/14 > https://lkml.org/lkml/2016/4/16/33 > > As omap3isp driver supports only one endpoint on ccp2 interface, > but cameras on N900 require different strobe settings, so far > it is not possible to have both cameras correctly working with > the same board DTS. DTS patch in the series has the correct > settings for the front camera. This is a problem still to be > solved. > > The needed pipeline could be made with: Would you have similar pipeline for the back camera? Autofocus and 5MPx makes it more interesting. I understand that different dts will be needed. Thanks, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 01/24] V4L fixes
On Mon 2016-04-25 00:08:01, Ivaylo Dimitrov wrote: > From: "Tuukka.O Toivonen" > > Squashed from the following upstream commits: > > V4L: Create control class for sensor mode > V4L: add ad5820 focus specific custom controls > V4L: add V4L2_CID_TEST_PATTERN > V4L: Add V4L2_CID_MODE_OPSYSCLOCK for reading output system clock > > Signed-off-by: Tuukka Toivonen > Signed-off-by: Pali Rohár I guess you need to append your Signed-off-by: here. Otherwise it looks good, so Acked-by: Pavel Machek (And thanks for all the work). Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 14/41] Documentation: dt: media: fix spelling mistake
Signed-off-by: Eric Engestrom --- Documentation/devicetree/bindings/media/xilinx/video.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/xilinx/video.txt b/Documentation/devicetree/bindings/media/xilinx/video.txt index cbd46fa..68ac210 100644 --- a/Documentation/devicetree/bindings/media/xilinx/video.txt +++ b/Documentation/devicetree/bindings/media/xilinx/video.txt @@ -20,7 +20,7 @@ The following properties are common to all Xilinx video IP cores. - xlnx,video-format: This property represents a video format transmitted on an AXI bus between video IP cores, using its VF code as defined in "AXI4-Stream Video IP and System Design Guide" [UG934]. How the format relates to the IP - core is decribed in the IP core bindings documentation. + core is described in the IP core bindings documentation. - xlnx,video-width: This property qualifies the video format with the sample width expressed as a number of bits per pixel component. All components must -- 2.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 23/41] Documentation: DocBook: fix spelling mistake
Signed-off-by: Eric Engestrom --- Documentation/DocBook/media/dvb/net.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/dvb/net.xml b/Documentation/DocBook/media/dvb/net.xml index d2e44b7..da095ed 100644 --- a/Documentation/DocBook/media/dvb/net.xml +++ b/Documentation/DocBook/media/dvb/net.xml @@ -15,7 +15,7 @@ that are present on the transport stream. This is done through /dev/dvb/adapter?/net? device node. The data will be available via virtual dvb?_? -network interfaces, and will be controled/routed via the standard +network interfaces, and will be controlled/routed via the standard ip tools (like ip, route, netstat, ifconfig, etc). Data types and and ioctl definitions are defined via linux/dvb/net.h header. -- 2.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
cron job: media_tree daily build: WARNINGS
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Mon Apr 25 04:00:15 CEST 2016 git branch: test git hash: e07d46e7e0da86c146f199dae76f879096bc436a gcc version:i686-linux-gcc (GCC) 5.3.0 sparse version: v0.5.0-56-g7647c77 smatch version: v0.5.0-3413-g618cd5c host hardware: x86_64 host os:4.5.0-164 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-exynos: OK linux-git-arm-mx: OK linux-git-arm-omap: OK linux-git-arm-omap1: OK linux-git-arm-pxa: OK linux-git-blackfin-bf561: OK linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.36.4-i686: OK linux-2.6.37.6-i686: OK linux-2.6.38.8-i686: OK linux-2.6.39.4-i686: OK linux-3.0.60-i686: OK linux-3.1.10-i686: OK linux-3.2.37-i686: OK linux-3.3.8-i686: OK linux-3.4.27-i686: OK linux-3.5.7-i686: OK linux-3.6.11-i686: OK linux-3.7.4-i686: OK linux-3.8-i686: OK linux-3.9.2-i686: OK linux-3.10.1-i686: OK linux-3.11.1-i686: OK linux-3.12.23-i686: OK linux-3.13.11-i686: OK linux-3.14.9-i686: OK linux-3.15.2-i686: OK linux-3.16.7-i686: OK linux-3.17.8-i686: OK linux-3.18.7-i686: OK linux-3.19-i686: OK linux-4.0-i686: OK linux-4.1.1-i686: OK linux-4.2-i686: OK linux-4.3-i686: OK linux-4.4-i686: OK linux-4.5-i686: WARNINGS linux-4.6-rc1-i686: OK linux-2.6.36.4-x86_64: OK linux-2.6.37.6-x86_64: OK linux-2.6.38.8-x86_64: OK linux-2.6.39.4-x86_64: OK linux-3.0.60-x86_64: OK linux-3.1.10-x86_64: OK linux-3.2.37-x86_64: OK linux-3.3.8-x86_64: OK linux-3.4.27-x86_64: OK linux-3.5.7-x86_64: OK linux-3.6.11-x86_64: OK linux-3.7.4-x86_64: OK linux-3.8-x86_64: OK linux-3.9.2-x86_64: OK linux-3.10.1-x86_64: OK linux-3.11.1-x86_64: OK linux-3.12.23-x86_64: OK linux-3.13.11-x86_64: OK linux-3.14.9-x86_64: OK linux-3.15.2-x86_64: OK linux-3.16.7-x86_64: OK linux-3.17.8-x86_64: OK linux-3.18.7-x86_64: OK linux-3.19-x86_64: OK linux-4.0-x86_64: OK linux-4.1.1-x86_64: OK linux-4.2-x86_64: OK linux-4.3-x86_64: OK linux-4.4-x86_64: OK linux-4.5-x86_64: WARNINGS linux-4.6-rc1-x86_64: OK apps: OK spec-git: OK sparse: WARNINGS smatch: WARNINGS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
mceusb xhci issue?
Hello, I have a mceusb compatible transceiver that only seems to work with certain computers. I'm testing this on centos7 (3.10.0) and fedora23 (4.4.7). The only difference I can see is that the working computer shows "using uhci_hcd" and the non working shows "using xhci_hcd". Here's the dmesg output of the non-working version: - [ 217.951079] usb 1-5: new full-speed USB device number 10 using xhci_hcd [ 218.104087] usb 1-5: device descriptor read/64, error -71 [ 218.371010] usb 1-5: config 1 interface 0 altsetting 0 endpoint 0x1 has an invalid bInterval 0, changing to 32 [ 218.371019] usb 1-5: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 0, changing to 32 [ 218.373591] usb 1-5: New USB device found, idVendor=1784, idProduct=0006 [ 218.373600] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 218.373605] usb 1-5: Product: eHome Infrared Transceiver [ 218.373608] usb 1-5: Manufacturer: TopSeed Technology Corp. [ 218.373611] usb 1-5: SerialNumber: TS004RrP [ 218.376082] Registered IR keymap rc-rc6-mce [ 218.376277] input: Media Center Ed. eHome Infrared Remote Transceiver (1784:0006) as /devices/pci:00/:00:14.0/usb1/1-5/1-5:1.0/rc/rc0/input13 [ 218.376387] rc0: Media Center Ed. eHome Infrared Remote Transceiver (1784:0006) as /devices/pci:00/:00:14.0/usb1/1-5/1-5:1.0/rc/rc0 [ 218.377439] input: MCE IR Keyboard/Mouse (mceusb) as /devices/virtual/input/input14 [ 218.377733] rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0 [ 218.508970] mceusb 1-5:1.0: Registered TopSeed Technology Corp. eHome Infrared Transceiver with mce emulator interface version 1 [ 218.508976] mceusb 1-5:1.0: 2 tx ports (0x0 cabled) and 2 rx sensors (0x0 active) - and the working version: - [ 407.226018] usb 2-2: new full-speed USB device number 3 using uhci_hcd [ 412.329019] usb 2-2: device descriptor read/64, error -110 [ 412.578054] usb 2-2: config 1 interface 0 altsetting 0 endpoint 0x1 has an invalid bInterval 0, changing to 32 [ 412.578540] usb 2-2: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 0, changing to 32 [ 412.613053] usb 2-2: New USB device found, idVendor=1784, idProduct=0006 [ 412.613542] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 412.614172] usb 2-2: Product: eHome Infrared Transceiver [ 412.615060] usb 2-2: Manufacturer: TopSeed Technology Corp. [ 412.615930] usb 2-2: SerialNumber: TS004RrP [ 412.624068] Registered IR keymap rc-rc6-mce [ 412.624672] input: Media Center Ed. eHome Infrared Remote Transceiver (1784:0006) as /devices/pci:00/:00:1d.0/usb2/2-2/2-2:1.0/rc/rc0/input22 [ 412.625404] rc0: Media Center Ed. eHome Infrared Remote Transceiver (1784:0006) as /devices/pci:00/:00:1d.0/usb2/2-2/2-2:1.0/rc/rc0 [ 412.626251] input: MCE IR Keyboard/Mouse (mceusb) as /devices/virtual/input/input23 [ 412.627627] rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0 [ 412.782038] mceusb 2-2:1.0: Registered TopSeed Technology Corp. eHome Infrared Transceiver with mce emulator interface version 1 [ 412.782594] mceusb 2-2:1.0: 2 tx ports (0x0 cabled) and 2 rx sensors (0x1 active) - It seems like there's been some similar history with this driver: https://patchwork.linuxtv.org/patch/21648/ Any suggestions? Where to go from here? Any tips or workarounds would be appreciated. Thanks, Wade P.S. some notes about leading up to this was posted on the lirc mailing list: https://sourceforge.net/p/lirc/mailman/message/35036744/ https://sourceforge.net/p/lirc/mailman/message/35038602/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7 5/8] [media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver
Hi Hans, On Fri, 2016-04-22 at 15:47 +0200, Hans Verkuil wrote: > On 04/22/2016 06:25 AM, Tiffany Lin wrote: > > Add v4l2 layer encoder driver for MT8173 > > > > Signed-off-by: Tiffany Lin > > > > --- > > drivers/media/platform/Kconfig | 16 + > > drivers/media/platform/Makefile|2 + > > drivers/media/platform/mtk-vcodec/Makefile | 14 + > > drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 339 + > > drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1301 > > > > drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h | 59 + > > .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 467 +++ > > .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 137 +++ > > .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h | 26 + > > .../media/platform/mtk-vcodec/mtk_vcodec_intr.c| 56 + > > .../media/platform/mtk-vcodec/mtk_vcodec_intr.h| 27 + > > .../media/platform/mtk-vcodec/mtk_vcodec_util.c| 96 ++ > > .../media/platform/mtk-vcodec/mtk_vcodec_util.h| 87 ++ > > drivers/media/platform/mtk-vcodec/venc_drv_base.h | 62 + > > drivers/media/platform/mtk-vcodec/venc_drv_if.c| 107 ++ > > drivers/media/platform/mtk-vcodec/venc_drv_if.h| 165 +++ > > drivers/media/platform/mtk-vcodec/venc_ipi_msg.h | 210 > > 17 files changed, 3171 insertions(+) > > create mode 100644 drivers/media/platform/mtk-vcodec/Makefile > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c > > create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h > > create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h > > create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c > > create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h > > create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h > > > > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c > > b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c > > new file mode 100644 > > index 000..b2b662c > > --- /dev/null > > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c > > @@ -0,0 +1,1301 @@ > > +/* V4L2 specification suggests the driver corrects the format struct if > > any of > > + * the dimensions is unsupported > > + */ > > +static int vidioc_try_fmt(struct v4l2_format *f, struct mtk_video_fmt *fmt) > > +{ > > + struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; > > + int i; > > + > > + pix_fmt_mp->field = V4L2_FIELD_NONE; > > + > > + if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { > > + pix_fmt_mp->num_planes = 1; > > + pix_fmt_mp->plane_fmt[0].bytesperline = 0; > > + } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { > > + int tmp_w, tmp_h; > > + > > + pix_fmt_mp->height = clamp(pix_fmt_mp->height, > > + MTK_VENC_MIN_H, > > + MTK_VENC_MAX_H); > > + pix_fmt_mp->width = clamp(pix_fmt_mp->width, > > + MTK_VENC_MIN_W, > > + MTK_VENC_MAX_W); > > Strange indentation. I see this in more places. Can you check this and fix > where needed? > I will fix all this strange indentation in next version. > > + > > + /* find next closer width align 16, heign align 32, size align > > + * 64 rectangle > > + */ > > + tmp_w = pix_fmt_mp->width; > > + tmp_h = pix_fmt_mp->height; > > + v4l_bound_align_image(&pix_fmt_mp->width, > > + MTK_VENC_MIN_W, > > + MTK_VENC_MAX_W, 4, > > + &pix_fmt_mp->height, > > + MTK_VENC_MIN_H, > > + MTK_VENC_MAX_H, 5, 6); > > + > > ... > > > +static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv, > > +struct v4l2_format *f) > > +{ > > + struct mtk_video_fmt *fmt; > > + > > + fmt = mtk_venc_find_format(f); > > + if (!fmt) { > > + f->fmt.pix.pix
Re: [PATCH v7 5/8] [media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver
> > > > ... > > > > > +static int fops_vcodec_open(struct file *file) > > > +{ > > > + struct video_device *vfd = video_devdata(file); > > > + struct mtk_vcodec_dev *dev = video_drvdata(file); > > > + struct mtk_vcodec_ctx *ctx = NULL; > > > + int ret = 0; > > > + > > > + if (dev->instance_mask == ~0UL) { > > > + /* ffz Undefined if no zero exists, err handling here */ > > > + mtk_v4l2_err("Too many open contexts"); > > > + ret = -EBUSY; > > > + goto err_alloc; > > > > I'm not happy seeing this here. You should always be able to open the > > device. > > I would expect to see a check like this in e.g. start_streaming, since > > that's > > where you start to use the hardware for real, and checking if you have > > enough > > resources there is perfectly fine. > > > > If this is an artificial constraint (i.e. not based on a real hardware > > limitation), > > then it should perhaps just be dropped. Such constraints tend to be > > pointless. > > If you want to encode 20 streams simultaneously, then why not? It will be > > very > > slow, but that's not this driver's problem :-) > > > We use ffz to get instance index. > This only make sure that instance id is correct since in ffz > description, > "Undefined if no zero exists, so code should check against ~0UL first." > In this case, it may not be able to move to start_streaming. > Any suggestion that how we do this? The instance index is only used for printing the debug information. No? If that's the case, you can remove instance index and print mtk_vcodec_ctx address for debugging. > > > > > + } > > > + > > > + mutex_lock(&dev->dev_mutex); > > > + > > > + ctx = devm_kzalloc(&dev->plat_dev->dev, sizeof(*ctx), GFP_KERNEL); > > > > Why is this a devm_ call? It is not managed by a device, so it seems to me > > that > > a regular kzalloc is good enough here. > > > > > + if (!ctx) { > > > + ret = -ENOMEM; > > > + goto err_alloc; > > > + } > > > + > > > + ctx->idx = ffz(dev->instance_mask); > > > + v4l2_fh_init(&ctx->fh, video_devdata(file)); > > > + file->private_data = &ctx->fh; > > > + v4l2_fh_add(&ctx->fh); > > > + INIT_LIST_HEAD(&ctx->list); > > > + ctx->dev = dev; > > > + init_waitqueue_head(&ctx->queue); > > > + > > > + if (vfd == dev->vfd_enc) { > > > + ctx->type = MTK_INST_ENCODER; > > > + ret = mtk_vcodec_enc_ctrls_setup(ctx); > > > + if (ret) { > > > + mtk_v4l2_err("Failed to setup controls() (%d)", > > > + ret); > > > + goto err_ctrls_setup; > > > + } > > > + ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev_enc, ctx, > > > +&mtk_vcodec_enc_queue_init); > > > + if (IS_ERR(ctx->m2m_ctx)) { > > > + ret = PTR_ERR(ctx->m2m_ctx); > > > + mtk_v4l2_err("Failed to v4l2_m2m_ctx_init() (%d)", > > > + ret); > > > + goto err_m2m_ctx_init; > > > + } > > > + mtk_vcodec_enc_set_default_params(ctx); > > > + } else { > > > + mtk_v4l2_err("Invalid vfd !"); > > > > This shouldn't be possible at all. I would just drop the 'if (vfd == > > dev->vfd_enc)' check. > Got it, will remove in next version. > > > > > > + ret = -ENOENT; > > > + goto err_m2m_ctx_init; > > > + } > > > + > > > + if (v4l2_fh_is_singular(&ctx->fh)) { > > > + ret = vpu_load_firmware(dev->vpu_plat_dev); > > > + if (ret < 0) { > > > + /* > > > + * Return 0 if downloading firmware successfully, > > > + * otherwise it is failed > > > + */ > > > + mtk_v4l2_err("vpu_load_firmware failed!"); > > > + goto err_load_fw; > > > + } > > > > The fw load seems to be a one-time thing, but here it is done every time > > someone opens the device and nobody else had it open. > > > > If this is a one time thing, then using a bool 'loaded_fw' makes more sense. > > > More than one module use vpu firmware, encoder/decoder/mdp...etc. > If this is first encode instance, we need to check and load vpu > firmware. > vpu_load_firmware will check and load firmware when necessary. > > best regards, > Tiffany > > > + > > > + dev->enc_capability = > > > + vpu_get_venc_hw_capa(dev->vpu_plat_dev); > > > + mtk_v4l2_debug(0, "encoder capability %x", > > > dev->enc_capability); > > > + } > > > + > > > + mtk_v4l2_debug(2, "Create instance [%d]@%p m2m_ctx=%p ", > > > +ctx->idx, ctx, ctx->m2m_ctx); > > > + set_bit(ctx->idx, &dev->instance_mask); > > > + dev->num_instances++; > > > + list_add(&ctx->list, &dev->ctx_list); > > > + > > > + mutex_unlock(&dev->dev_mutex); > > > + mtk_v4l2_debug(0, "%s encoder [%d]", dev_name(&dev->plat_
Re: [RFC PATCH 00/24] Make Nokia N900 cameras working
On 25.04.2016 00:55, Pavel Machek wrote: Hi! Those patch series make cameras on Nokia N900 partially working. Some more patches are needed, but I've already sent them for upstreaming so they are not part of the series: https://lkml.org/lkml/2016/4/16/14 https://lkml.org/lkml/2016/4/16/33 As omap3isp driver supports only one endpoint on ccp2 interface, but cameras on N900 require different strobe settings, so far it is not possible to have both cameras correctly working with the same board DTS. DTS patch in the series has the correct settings for the front camera. This is a problem still to be solved. The needed pipeline could be made with: Would you have similar pipeline for the back camera? Autofocus and 5MPx makes it more interesting. I understand that different dts will be needed. Try with: media-ctl -r media-ctl -l '"et8ek8 3-003e":0 -> "video-bus-switch":1 [1]' media-ctl -l '"video-bus-switch":0 -> "OMAP3 ISP CCP2":0 [1]' media-ctl -l '"OMAP3 ISP CCP2":1 -> "OMAP3 ISP CCDC":0 [1]' media-ctl -l '"OMAP3 ISP CCDC":2 -> "OMAP3 ISP preview":0 [1]' media-ctl -l '"OMAP3 ISP preview":1 -> "OMAP3 ISP resizer":0 [1]' media-ctl -l '"OMAP3 ISP resizer":1 -> "OMAP3 ISP resizer output":0 [1]' media-ctl -V '"et8ek8 3-003e":0 [SGRBG10 864x656]' media-ctl -V '"OMAP3 ISP CCP2":0 [SGRBG10 864x656]' media-ctl -V '"OMAP3 ISP CCP2":1 [SGRBG10 864x656]' media-ctl -V '"OMAP3 ISP CCDC":2 [SGRBG10 864x656]' media-ctl -V '"OMAP3 ISP preview":1 [UYVY 864x656]' media-ctl -V '"OMAP3 ISP resizer":1 [UYVY 800x600]' mplayer -tv driver=v4l2:width=800:height=600:outfmt=uyvy:device=/dev/video6 -vo xv -vf screenshot tv:// Regards, Ivo -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 37/41] Documentation: video4linux: fix spelling mistakes
Signed-off-by: Eric Engestrom --- Documentation/video4linux/vivid.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/video4linux/vivid.txt b/Documentation/video4linux/vivid.txt index e35d376..8da5d2a 100644 --- a/Documentation/video4linux/vivid.txt +++ b/Documentation/video4linux/vivid.txt @@ -294,7 +294,7 @@ the result will be. These inputs support all combinations of the field setting. Special care has been taken to faithfully reproduce how fields are handled for the different -TV standards. This is particularly noticable when generating a horizontally +TV standards. This is particularly noticeable when generating a horizontally moving image so the temporal effect of using interlaced formats becomes clearly visible. For 50 Hz standards the top field is the oldest and the bottom field is the newest in time. For 60 Hz standards that is reversed: the bottom field @@ -313,7 +313,7 @@ will be SMPTE-170M. The pixel aspect ratio will depend on the TV standard. The video aspect ratio can be selected through the 'Standard Aspect Ratio' Vivid control. Choices are '4x3', '16x9' which will give letterboxed widescreen video and -'16x9 Anomorphic' which will give full screen squashed anamorphic widescreen +'16x9 Anamorphic' which will give full screen squashed anamorphic widescreen video that will need to be scaled accordingly. The TV 'tuner' supports a frequency range of 44-958 MHz. Channels are available @@ -862,7 +862,7 @@ RDS Radio Text: RDS Stereo: RDS Artificial Head: RDS Compressed: -RDS Dymanic PTY: +RDS Dynamic PTY: RDS Traffic Announcement: RDS Traffic Program: RDS Music: these are all controls that set the RDS data that is transmitted by -- 2.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html