Re: [REVIEWv7 PATCH 04/12] vb2: don't free alloc context if it is ERR_PTR
On Tue, Nov 18, 2014 at 9:51 PM, Hans Verkuil hverk...@xs4all.nl wrote: From: Hans Verkuil hans.verk...@cisco.com Don't try to free a pointer containing an ERR_PTR(). Signed-off-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Pawel Osciak pa...@osciak.com -- Best regards, Pawel Osciak -- 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: [REVIEWv7 PATCH 05/12] vb2-dma-sg: add allocation context to dma-sg
On Tue, Nov 18, 2014 at 9:51 PM, Hans Verkuil hverk...@xs4all.nl wrote: From: Hans Verkuil hans.verk...@cisco.com Require that dma-sg also uses an allocation context. This is in preparation for adding prepare/finish memops to sync the memory between DMA and CPU. Signed-off-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Pawel Osciak pa...@osciak.com -- Best regards, Pawel Osciak -- 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: [REVIEWv7 PATCH 09/12] vb2-vmalloc: add support for dmabuf exports
On Tue, Nov 18, 2014 at 9:51 PM, Hans Verkuil hverk...@xs4all.nl wrote: From: Hans Verkuil hansv...@cisco.com Add support for DMABUF exporting to the vb2-vmalloc implementation. All memory models now have support for both importing and exporting of DMABUFs. Signed-off-by: Hans Verkuil hansv...@cisco.com Acked-by: Pawel Osciak pa...@osciak.com --- drivers/media/v4l2-core/videobuf2-vmalloc.c | 171 1 file changed, 171 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c b/drivers/media/v4l2-core/videobuf2-vmalloc.c index bba2460..3966b12 100644 --- a/drivers/media/v4l2-core/videobuf2-vmalloc.c +++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c @@ -213,6 +213,176 @@ static int vb2_vmalloc_mmap(void *buf_priv, struct vm_area_struct *vma) } /*/ +/* DMABUF ops for exporters */ +/*/ + +struct vb2_vmalloc_attachment { + struct sg_table sgt; + enum dma_data_direction dma_dir; +}; + +static int vb2_vmalloc_dmabuf_ops_attach(struct dma_buf *dbuf, struct device *dev, + struct dma_buf_attachment *dbuf_attach) +{ + struct vb2_vmalloc_attachment *attach; + struct vb2_vmalloc_buf *buf = dbuf-priv; + int num_pages = PAGE_ALIGN(buf-size) / PAGE_SIZE; + struct sg_table *sgt; + struct scatterlist *sg; + void *vaddr = buf-vaddr; + int ret; + int i; + + attach = kzalloc(sizeof(*attach), GFP_KERNEL); + if (!attach) + return -ENOMEM; + + sgt = attach-sgt; + ret = sg_alloc_table(sgt, num_pages, GFP_KERNEL); + if (ret) { + kfree(attach); + return ret; + } + for_each_sg(sgt-sgl, sg, sgt-nents, i) { + struct page *page = vmalloc_to_page(vaddr); + + if (!page) { + sg_free_table(sgt); + kfree(attach); + return -ENOMEM; + } + sg_set_page(sg, page, PAGE_SIZE, 0); + vaddr += PAGE_SIZE; + } + + attach-dma_dir = DMA_NONE; + dbuf_attach-priv = attach; + return 0; +} + +static void vb2_vmalloc_dmabuf_ops_detach(struct dma_buf *dbuf, + struct dma_buf_attachment *db_attach) +{ + struct vb2_vmalloc_attachment *attach = db_attach-priv; + struct sg_table *sgt; + + if (!attach) + return; + + sgt = attach-sgt; + + /* release the scatterlist cache */ + if (attach-dma_dir != DMA_NONE) + dma_unmap_sg(db_attach-dev, sgt-sgl, sgt-orig_nents, + attach-dma_dir); + sg_free_table(sgt); + kfree(attach); + db_attach-priv = NULL; +} + +static struct sg_table *vb2_vmalloc_dmabuf_ops_map( + struct dma_buf_attachment *db_attach, enum dma_data_direction dma_dir) +{ + struct vb2_vmalloc_attachment *attach = db_attach-priv; + /* stealing dmabuf mutex to serialize map/unmap operations */ + struct mutex *lock = db_attach-dmabuf-lock; + struct sg_table *sgt; + int ret; + + mutex_lock(lock); + + sgt = attach-sgt; + /* return previously mapped sg table */ + if (attach-dma_dir == dma_dir) { + mutex_unlock(lock); + return sgt; + } + + /* release any previous cache */ + if (attach-dma_dir != DMA_NONE) { + dma_unmap_sg(db_attach-dev, sgt-sgl, sgt-orig_nents, + attach-dma_dir); + attach-dma_dir = DMA_NONE; + } + + /* mapping to the client with new direction */ + ret = dma_map_sg(db_attach-dev, sgt-sgl, sgt-orig_nents, dma_dir); + if (ret = 0) { + pr_err(failed to map scatterlist\n); + mutex_unlock(lock); + return ERR_PTR(-EIO); + } + + attach-dma_dir = dma_dir; + + mutex_unlock(lock); + + return sgt; +} + +static void vb2_vmalloc_dmabuf_ops_unmap(struct dma_buf_attachment *db_attach, + struct sg_table *sgt, enum dma_data_direction dma_dir) +{ + /* nothing to be done here */ +} + +static void vb2_vmalloc_dmabuf_ops_release(struct dma_buf *dbuf) +{ + /* drop reference obtained in vb2_vmalloc_get_dmabuf */ + vb2_vmalloc_put(dbuf-priv); +} + +static void *vb2_vmalloc_dmabuf_ops_kmap(struct dma_buf *dbuf, unsigned long pgnum) +{ + struct vb2_vmalloc_buf *buf = dbuf-priv; + + return buf-vaddr + pgnum * PAGE_SIZE; +} + +static void *vb2_vmalloc_dmabuf_ops_vmap(struct dma_buf *dbuf) +{ + struct vb2_vmalloc_buf *buf = dbuf-priv; + + return buf-vaddr; +} + +static int vb2_vmalloc_dmabuf_ops_mmap(struct dma_buf *dbuf, + struct vm_area_struct *vma) +{ +
Re: [REVIEWv7 PATCH 01/12] videobuf2-core.h: improve documentation
On Tue, Nov 18, 2014 at 9:50 PM, Hans Verkuil hverk...@xs4all.nl wrote: From: Hans Verkuil hans.verk...@cisco.com Document that drivers can access/modify the buffer contents in buf_prepare and buf_finish. That was not clearly stated before. Signed-off-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Pawel Osciak pa...@osciak.com --- include/media/videobuf2-core.h | 32 +--- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 6ef2d01..70ace7c 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -270,22 +270,24 @@ struct vb2_buffer { * queue setup from completing successfully; optional. * @buf_prepare: called every time the buffer is queued from userspace * and from the VIDIOC_PREPARE_BUF ioctl; drivers may - * perform any initialization required before each hardware - * operation in this callback; drivers that support - * VIDIOC_CREATE_BUFS must also validate the buffer size; - * if an error is returned, the buffer will not be queued - * in driver; optional. + * perform any initialization required before each + * hardware operation in this callback; drivers can + * access/modify the buffer here as it is still synced for + * the CPU; drivers that support VIDIOC_CREATE_BUFS must + * also validate the buffer size; if an error is returned, + * the buffer will not be queued in driver; optional. * @buf_finish:called before every dequeue of the buffer back to - * userspace; drivers may perform any operations required - * before userspace accesses the buffer; optional. The - * buffer state can be one of the following: DONE and - * ERROR occur while streaming is in progress, and the - * PREPARED state occurs when the queue has been canceled - * and all pending buffers are being returned to their - * default DEQUEUED state. Typically you only have to do - * something if the state is VB2_BUF_STATE_DONE, since in - * all other cases the buffer contents will be ignored - * anyway. + * userspace; the buffer is synced for the CPU, so drivers + * can access/modify the buffer contents; drivers may + * perform any operations required before userspace + * accesses the buffer; optional. The buffer state can be + * one of the following: DONE and ERROR occur while + * streaming is in progress, and the PREPARED state occurs + * when the queue has been canceled and all pending + * buffers are being returned to their default DEQUEUED + * state. Typically you only have to do something if the + * state is VB2_BUF_STATE_DONE, since in all other cases + * the buffer contents will be ignored anyway. * @buf_cleanup: called once before the buffer is freed; drivers may * perform any additional cleanup; optional. * @start_streaming: called once to enter 'streaming' state; the driver may -- 2.1.1 -- Best regards, Pawel Osciak -- 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: [REVIEWv7 PATCH 12/12] vb2: use dma_map_sg_attrs to prevent unnecessary sync
On Tue, Nov 18, 2014 at 9:51 PM, Hans Verkuil hverk...@xs4all.nl wrote: From: Hans Verkuil hans.verk...@cisco.com By default dma_map_sg syncs the mapped buffer to the device. But buf_prepare expects a buffer syncs for the cpu and the buffer will be synced to the device in the prepare memop. The reverse is true for dma_unmap_sg, buf_finish and the finish memop. To prevent unnecessary syncs we ask dma_(un)map_sg to skip the sync. Signed-off-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Pawel Osciak pa...@osciak.com --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 24 +++ drivers/media/v4l2-core/videobuf2-dma-sg.c | 33 +- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 0bfc488..b481d20 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -511,7 +511,15 @@ static void vb2_dc_put_userptr(void *buf_priv) struct sg_table *sgt = buf-dma_sgt; if (sgt) { - dma_unmap_sg(buf-dev, sgt-sgl, sgt-orig_nents, buf-dma_dir); + DEFINE_DMA_ATTRS(attrs); + + dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs); + /* +* No need to sync to CPU, it's already synced to the CPU +* since the finish() memop will have been called before this. +*/ + dma_unmap_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents, + buf-dma_dir, attrs); if (!vma_is_io(buf-vma)) vb2_dc_sgt_foreach_page(sgt, vb2_dc_put_dirty_page); @@ -568,6 +576,9 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, struct sg_table *sgt; unsigned long contig_size; unsigned long dma_align = dma_get_cache_alignment(); + DEFINE_DMA_ATTRS(attrs); + + dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs); /* Only cache aligned DMA transfers are reliable */ if (!IS_ALIGNED(vaddr | size, dma_align)) { @@ -654,8 +665,12 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, kfree(pages); pages = NULL; - sgt-nents = dma_map_sg(buf-dev, sgt-sgl, sgt-orig_nents, - buf-dma_dir); + /* +* No need to sync to the device, this will happen later when the +* prepare() memop is called. +*/ + sgt-nents = dma_map_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents, + buf-dma_dir, attrs); if (sgt-nents = 0) { pr_err(failed to map scatterlist\n); ret = -EIO; @@ -677,7 +692,8 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, return buf; fail_map_sg: - dma_unmap_sg(buf-dev, sgt-sgl, sgt-orig_nents, buf-dma_dir); + dma_unmap_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents, + buf-dma_dir, attrs); fail_sgt_init: if (!vma_is_io(buf-vma)) diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index c2ec2c4..d75fcf1 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c @@ -107,6 +107,9 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size, struct sg_table *sgt; int ret; int num_pages; + DEFINE_DMA_ATTRS(attrs); + + dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs); if (WARN_ON(alloc_ctx == NULL)) return NULL; @@ -140,9 +143,13 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size, buf-dev = get_device(conf-dev); sgt = buf-sg_table; - if (dma_map_sg(buf-dev, sgt-sgl, sgt-nents, buf-dma_dir) == 0) + /* +* No need to sync to the device, this will happen later when the +* prepare() memop is called. +*/ + if (dma_map_sg_attrs(buf-dev, sgt-sgl, sgt-nents, +buf-dma_dir, attrs) == 0) goto fail_map; - dma_sync_sg_for_cpu(buf-dev, sgt-sgl, sgt-nents, buf-dma_dir); buf-handler.refcount = buf-refcount; buf-handler.put = vb2_dma_sg_put; @@ -175,9 +182,13 @@ static void vb2_dma_sg_put(void *buf_priv) int i = buf-num_pages; if (atomic_dec_and_test(buf-refcount)) { + DEFINE_DMA_ATTRS(attrs); + + dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs); dprintk(1, %s: Freeing buffer of %d pages\n, __func__, buf-num_pages); - dma_unmap_sg(buf-dev, sgt-sgl, sgt-nents, buf-dma_dir); + dma_unmap_sg_attrs(buf-dev, sgt-sgl, sgt-nents, + buf-dma_dir, attrs);
[GIT PULL FOR v3.19] vb2: improvements
- Add allocation context to dma-sg and have vb2 do the dma mapping instead of the driver. This makes it consistent with the way dma-contig behaves and simplifies drivers. - Add support for DMABUF import to dma-sg. - Add support for DMABUF export to dma-sg and dma-vmalloc. - Clarify (and fix) when buffers can safely be written to by the cpu. After this patch series DMABUF is available for all v4l2_memory variants. Regards, Hans The following changes since commit 5937a784c3e5fe8fd1e201f42a2b1ece6c36a6c0: [media] staging: media: bcm2048: fix coding style error (2014-11-21 16:50:37 -0200) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git vb2 for you to fetch changes up to 4ca2ff8bfe1594c1b3aa68a005429ed4d49714e3: vb2: use dma_map_sg_attrs to prevent unnecessary sync (2014-11-23 12:13:06 +0100) Hans Verkuil (12): videobuf2-core.h: improve documentation vb2: replace 'write' by 'dma_dir' vb2: add dma_dir to the alloc memop. vb2: don't free alloc context if it is ERR_PTR vb2-dma-sg: add allocation context to dma-sg vb2-dma-sg: move dma_(un)map_sg here vb2-dma-sg: add dmabuf import support vb2-dma-sg: add support for dmabuf exports vb2-vmalloc: add support for dmabuf exports vivid: enable vb2_expbuf support. vim2m: support expbuf vb2: use dma_map_sg_attrs to prevent unnecessary sync drivers/media/pci/cx23885/cx23885-417.c | 4 +- drivers/media/pci/cx23885/cx23885-core.c| 15 +-- drivers/media/pci/cx23885/cx23885-dvb.c | 4 +- drivers/media/pci/cx23885/cx23885-vbi.c | 10 +- drivers/media/pci/cx23885/cx23885-video.c | 10 +- drivers/media/pci/cx23885/cx23885.h | 1 + drivers/media/pci/saa7134/saa7134-core.c| 18 +++- drivers/media/pci/saa7134/saa7134-empress.c | 1 - drivers/media/pci/saa7134/saa7134-ts.c | 17 +--- drivers/media/pci/saa7134/saa7134-vbi.c | 16 +-- drivers/media/pci/saa7134/saa7134-video.c | 16 +-- drivers/media/pci/saa7134/saa7134.h | 2 +- drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 60 ++- drivers/media/pci/solo6x10/solo6x10.h | 1 + drivers/media/pci/tw68/tw68-core.c | 15 ++- drivers/media/pci/tw68/tw68-video.c | 9 +- drivers/media/pci/tw68/tw68.h | 1 + drivers/media/platform/marvell-ccic/mcam-core.c | 31 +++--- drivers/media/platform/marvell-ccic/mcam-core.h | 1 + drivers/media/platform/vim2m.c | 1 + drivers/media/platform/vivid/vivid-core.c | 2 +- drivers/media/v4l2-core/videobuf2-core.c| 14 ++- drivers/media/v4l2-core/videobuf2-dma-contig.c | 71 - drivers/media/v4l2-core/videobuf2-dma-sg.c | 423 drivers/media/v4l2-core/videobuf2-vmalloc.c | 191 -- include/media/videobuf2-core.h | 42 include/media/videobuf2-dma-sg.h| 3 + 27 files changed, 764 insertions(+), 215 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/3] media: soc_camera: rcar_vin: Add scaling support
From: Koji Matsuoka koji.matsuoka...@renesas.com Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com [g.liakhovet...@gmx.de: minor stylistic and formatting corrections] Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- Kaneko-san, Matsuoka-san, could you please have a look at this version of this your patch? Are my changes to it ok? Also, please test this my branch: http://git.linuxtv.org/cgit.cgi/gliakhovetski/v4l-dvb.git/log/?h=for-3.19-1 before I push it to Mauro. Patches applied more or less cleanly, and there don't seem to be any functional dependencies, that I might have broken, the driver compiles with no warnings, still, would be good if you could test it! Otherwise waiting for updates for other your patches! Patch rcar_vin: Add BT.709 24-bit RGB888 input support is also marked Ok by me, but I couldn't push it yet, because it depends on other patches, that have to be updated. Thanks Guennadi drivers/media/platform/soc_camera/rcar_vin.c | 451 ++- 1 file changed, 442 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c index c60560a..c71ef2b 100644 --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ b/drivers/media/platform/soc_camera/rcar_vin.c @@ -64,6 +64,30 @@ #define VNDMR_REG 0x58/* Video n Data Mode Register */ #define VNDMR2_REG 0x5C/* Video n Data Mode Register 2 */ #define VNUVAOF_REG0x60/* Video n UV Address Offset Register */ +#define VNC1A_REG 0x80/* Video n Coefficient Set C1A Register */ +#define VNC1B_REG 0x84/* Video n Coefficient Set C1B Register */ +#define VNC1C_REG 0x88/* Video n Coefficient Set C1C Register */ +#define VNC2A_REG 0x90/* Video n Coefficient Set C2A Register */ +#define VNC2B_REG 0x94/* Video n Coefficient Set C2B Register */ +#define VNC2C_REG 0x98/* Video n Coefficient Set C2C Register */ +#define VNC3A_REG 0xA0/* Video n Coefficient Set C3A Register */ +#define VNC3B_REG 0xA4/* Video n Coefficient Set C3B Register */ +#define VNC3C_REG 0xA8/* Video n Coefficient Set C3C Register */ +#define VNC4A_REG 0xB0/* Video n Coefficient Set C4A Register */ +#define VNC4B_REG 0xB4/* Video n Coefficient Set C4B Register */ +#define VNC4C_REG 0xB8/* Video n Coefficient Set C4C Register */ +#define VNC5A_REG 0xC0/* Video n Coefficient Set C5A Register */ +#define VNC5B_REG 0xC4/* Video n Coefficient Set C5B Register */ +#define VNC5C_REG 0xC8/* Video n Coefficient Set C5C Register */ +#define VNC6A_REG 0xD0/* Video n Coefficient Set C6A Register */ +#define VNC6B_REG 0xD4/* Video n Coefficient Set C6B Register */ +#define VNC6C_REG 0xD8/* Video n Coefficient Set C6C Register */ +#define VNC7A_REG 0xE0/* Video n Coefficient Set C7A Register */ +#define VNC7B_REG 0xE4/* Video n Coefficient Set C7B Register */ +#define VNC7C_REG 0xE8/* Video n Coefficient Set C7C Register */ +#define VNC8A_REG 0xF0/* Video n Coefficient Set C8A Register */ +#define VNC8B_REG 0xF4/* Video n Coefficient Set C8B Register */ +#define VNC8C_REG 0xF8/* Video n Coefficient Set C8C Register */ /* Register bit fields for R-Car VIN */ /* Video n Main Control Register bits */ @@ -117,6 +141,324 @@ enum chip_id { RCAR_E1, }; +struct vin_coeff { + unsigned short xs_value; + u32 coeff_set[24]; +}; + +static const struct vin_coeff vin_coeff_set[] = { + { 0x, { + 0x, 0x, 0x, + 0x, 0x, 0x, + 0x, 0x, 0x, + 0x, 0x, 0x, + 0x, 0x, 0x, + 0x, 0x, 0x, + 0x, 0x, 0x, + 0x, 0x, 0x }, + }, + { 0x1000, { + 0x000fa400, 0x000fa400, 0x09625902, + 0x03f8, 0x0403, 0x3de0d9f0, + 0x001fffed, 0x0804, 0x3cc1f9c3, + 0x001003de, 0x0c01, 0x3cb34d7f, + 0x002003d2, 0x0c00, 0x3d24a92d, + 0x00200bca, 0x0bff, 0x3df600d2, + 0x002013cc, 0x07ff, 0x3ed70c7e, + 0x00100fde, 0x, 0x3f87c036 }, + }, + { 0x1200, { +
[PATCH] v4l2-dev: vdev-v4l2_dev is always set, so simplify code.
These days vdev-v4l2_dev must always be set. This means that some old code that still tests for a NULL vdev-v4l2_dev can be removed or simplified. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/v4l2-dev.c | 34 ++ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 33617c3..9aa530a 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -194,7 +194,7 @@ static void v4l2_device_release(struct device *cd) mutex_unlock(videodev_lock); #if defined(CONFIG_MEDIA_CONTROLLER) - if (v4l2_dev v4l2_dev-mdev + if (v4l2_dev-mdev vdev-vfl_type != VFL_TYPE_SUBDEV) media_device_unregister_entity(vdev-entity); #endif @@ -207,7 +207,7 @@ static void v4l2_device_release(struct device *cd) * TODO: In the long run all drivers that use v4l2_device should use the * v4l2_device release callback. This check will then be unnecessary. */ - if (v4l2_dev v4l2_dev-release == NULL) + if (v4l2_dev-release == NULL) v4l2_dev = NULL; /* Release video_device and perform other @@ -360,27 +360,22 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) * hack but it will have to do for those drivers that are not * yet converted to use unlocked_ioctl. * -* There are two options: if the driver implements struct -* v4l2_device, then the lock defined there is used to -* serialize the ioctls. Otherwise the v4l2 core lock defined -* below is used. This lock is really bad since it serializes -* completely independent devices. +* All drivers implement struct v4l2_device, so we use the +* lock defined there to serialize the ioctls. * -* Both variants suffer from the same problem: if the driver -* sleeps, then it blocks all ioctls since the lock is still -* held. This is very common for VIDIOC_DQBUF since that -* normally waits for a frame to arrive. As a result any other -* ioctl calls will proceed very, very slowly since each call -* will have to wait for the VIDIOC_QBUF to finish. Things that -* should take 0.01s may now take 10-20 seconds. +* However, if the driver sleeps, then it blocks all ioctls +* since the lock is still held. This is very common for +* VIDIOC_DQBUF since that normally waits for a frame to arrive. +* As a result any other ioctl calls will proceed very, very +* slowly since each call will have to wait for the VIDIOC_QBUF +* to finish. Things that should take 0.01s may now take 10-20 +* seconds. * * The workaround is to *not* take the lock for VIDIOC_DQBUF. * This actually works OK for videobuf-based drivers, since * videobuf will take its own internal lock. */ - static DEFINE_MUTEX(v4l2_ioctl_mutex); - struct mutex *m = vdev-v4l2_dev ? - vdev-v4l2_dev-ioctl_lock : v4l2_ioctl_mutex; + struct mutex *m = vdev-v4l2_dev-ioctl_lock; if (cmd != VIDIOC_DQBUF mutex_lock_interruptible(m)) return -ERESTARTSYS; @@ -938,12 +933,11 @@ int __video_register_device(struct video_device *vdev, int type, int nr, name_base, nr, video_device_node_name(vdev)); /* Increase v4l2_device refcount */ - if (vdev-v4l2_dev) - v4l2_device_get(vdev-v4l2_dev); + v4l2_device_get(vdev-v4l2_dev); #if defined(CONFIG_MEDIA_CONTROLLER) /* Part 5: Register the entity. */ - if (vdev-v4l2_dev vdev-v4l2_dev-mdev + if (vdev-v4l2_dev-mdev vdev-vfl_type != VFL_TYPE_SUBDEV) { vdev-entity.type = MEDIA_ENT_T_DEVNODE_V4L; vdev-entity.name = vdev-name; -- 2.1.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: SAA7164 firmware for Asus MyCinema
Hi Olli, Thank you very much for your answer. I found a data-sheet for TUA6034 at http://pdf.datasheetcatalog.com/datasheet2/4/084ailjhz4xq79otdj14u5laz3py.pdf (found at http://www.datasheetcatalog.com/datasheets_pdf/T/U/A/_/TUA_6034-T.shtml) At the 46th page of the PDF file I found some programming instructions. It may be a good start for write driver for this tuner? I will try to find programming instructions to how can I write driver, but if you (or anybody) have any good start-up instruction for me I am very glade for it. Regards, Zsolt 2014.11.23. 8:54 keltezéssel, Olli Salonen írta: Hi Zsolt, In order to support a card in Linux in general, there needs to be a driver for the PCIe bridge, the demodulator and the tuner. Then these building blocks must be put together in a way that makes sense. You've already identified the PCIe bridge (NXP SAA7164), the demodulator (TDA 10046) and the tuner (Taifun 6034T aka Infineon TUA6034). Now here comes the bad news - even if the PCIe bridge and the demod are supported by existing drivers, the TUA6034 is not supported by currently. You would need to write or get someone to write a driver for the TUA6034. In order for this to be possible you'd need to get the specifications from the manufacturer (often not possible, but worth trying) or reverse-engineer the Windows driver (often quite tricky, especially since taking a trace from a PCIe device can be a lot of work). Might I suggest that you add also a wiki page in the LinuxTV wiki if you're anyway looking at this? Basically you can document the same things you've very well documented on your website there, but please use the template that the other devices on the site are more or less using. http://www.linuxtv.org/wiki/index.php/ASUS is a good starting point. Even if the conclusion is that the card will not work your research might save someone else time in the future. Cheers, -olli On 22 November 2014 at 23:41, Éder Zsolt zsolt.e...@edernet.hu wrote: Hi Olli, Sorry, unfortunately was not me on IRC. So as you wrote, I followed your instructions, and I collect as information as I can from the board. I made a small site quickly with some photos, you found it here: http://myoop.hu/tuner.html While I took the photos I found that my card is Asus MyCinema EHD2-100/PT/FM/AV/RC. Can you help me how should I continue my work with this tuner? Thank you very much in advance. Best regards, Zsolt 2014.11.20. 20:51 keltezéssel, Olli Salonen írta: On Wed, 19 Nov 2014, Éder Zsolt wrote: Hi, I found at the site: http://www.linuxtv.org/wiki/index.php/ATSC_PCIe_Cards that if I have a TV-tuner card which is currently unsupported, you may help me how I can make workable this device. I have an Asus MyCinema EHD3-100/NAQ/FM/AV/MCE RC dual TV-Tuner card with SAA7164 chipset. Did we talk about this in IRC a couple of days ago? If not, you will need to find out which demodulator and tuner are used on that card. You can find those by looking at the physical card. Read the text on the bigger ICs and try to put them in the google to find out the components used. The tuner might be under metal shielding, in which case it might be a bit more tricky to find out. Looking at the files in the Windows driver package might give you some hints as well. Cheers, -olli -- 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 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] v4l2-common: cleanup
Remove or move several obsolete or deprecated control helper functions. A nice little cleanup. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] v4l2-common: move v4l2_ctrl_check to cx2341x
From: Hans Verkuil hans.verk...@cisco.com The v4l2_ctrl_check() helper function is now only used in cx2341x. Move it there and make it static. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/common/cx2341x.c| 29 + drivers/media/v4l2-core/v4l2-common.c | 30 -- include/media/v4l2-common.h | 4 +--- 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/drivers/media/common/cx2341x.c b/drivers/media/common/cx2341x.c index be76315..c07b9db 100644 --- a/drivers/media/common/cx2341x.c +++ b/drivers/media/common/cx2341x.c @@ -931,6 +931,35 @@ static void cx2341x_calc_audio_properties(struct cx2341x_mpeg_params *params) } } +/* Check for correctness of the ctrl's value based on the data from + struct v4l2_queryctrl and the available menu items. Note that + menu_items may be NULL, in that case it is ignored. */ +static int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, + const char * const *menu_items) +{ + if (qctrl-flags V4L2_CTRL_FLAG_DISABLED) + return -EINVAL; + if (qctrl-flags V4L2_CTRL_FLAG_GRABBED) + return -EBUSY; + if (qctrl-type == V4L2_CTRL_TYPE_STRING) + return 0; + if (qctrl-type == V4L2_CTRL_TYPE_BUTTON || + qctrl-type == V4L2_CTRL_TYPE_INTEGER64 || + qctrl-type == V4L2_CTRL_TYPE_CTRL_CLASS) + return 0; + if (ctrl-value qctrl-minimum || ctrl-value qctrl-maximum) + return -ERANGE; + if (qctrl-type == V4L2_CTRL_TYPE_MENU menu_items != NULL) { + if (menu_items[ctrl-value] == NULL || + menu_items[ctrl-value][0] == '\0') + return -EINVAL; + } + if (qctrl-type == V4L2_CTRL_TYPE_BITMASK + (ctrl-value ~qctrl-maximum)) + return -ERANGE; + return 0; +} + int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, struct v4l2_ext_controls *ctrls, unsigned int cmd) { diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 8493209..5b80850 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -80,36 +80,6 @@ MODULE_LICENSE(GPL); /* Helper functions for control handling*/ -/* Check for correctness of the ctrl's value based on the data from - struct v4l2_queryctrl and the available menu items. Note that - menu_items may be NULL, in that case it is ignored. */ -int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, - const char * const *menu_items) -{ - if (qctrl-flags V4L2_CTRL_FLAG_DISABLED) - return -EINVAL; - if (qctrl-flags V4L2_CTRL_FLAG_GRABBED) - return -EBUSY; - if (qctrl-type == V4L2_CTRL_TYPE_STRING) - return 0; - if (qctrl-type == V4L2_CTRL_TYPE_BUTTON || - qctrl-type == V4L2_CTRL_TYPE_INTEGER64 || - qctrl-type == V4L2_CTRL_TYPE_CTRL_CLASS) - return 0; - if (ctrl-value qctrl-minimum || ctrl-value qctrl-maximum) - return -ERANGE; - if (qctrl-type == V4L2_CTRL_TYPE_MENU menu_items != NULL) { - if (menu_items[ctrl-value] == NULL || - menu_items[ctrl-value][0] == '\0') - return -EINVAL; - } - if (qctrl-type == V4L2_CTRL_TYPE_BITMASK - (ctrl-value ~qctrl-maximum)) - return -ERANGE; - return 0; -} -EXPORT_SYMBOL(v4l2_ctrl_check); - /* Fill in a struct v4l2_queryctrl */ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 _min, s32 _max, s32 _step, s32 _def) { diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index c69d91d..1cc0c5b 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -80,10 +80,8 @@ /* - */ -/* Control helper functions */ +/* Control helper function */ -int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, - const char * const *menu_items); int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); /* - */ -- 2.1.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] v4l2-common: remove unused helper functions.
From: Hans Verkuil hans.verk...@cisco.com Several control helper functions are no longer needed since most drivers are now converted to the control framework. So we can delete them. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/v4l2-common.c | 95 --- include/media/v4l2-common.h | 10 2 files changed, 105 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 2e9d81f..8493209 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -135,101 +135,6 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 _min, s32 _max, s32 _ } EXPORT_SYMBOL(v4l2_ctrl_query_fill); -/* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and - the menu. The qctrl pointer may be NULL, in which case it is ignored. - If menu_items is NULL, then the menu items are retrieved using - v4l2_ctrl_get_menu. */ -int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qctrl, - const char * const *menu_items) -{ - int i; - - qmenu-reserved = 0; - if (menu_items == NULL) - menu_items = v4l2_ctrl_get_menu(qmenu-id); - if (menu_items == NULL || - (qctrl (qmenu-index qctrl-minimum || qmenu-index qctrl-maximum))) - return -EINVAL; - for (i = 0; i qmenu-index menu_items[i]; i++) ; - if (menu_items[i] == NULL || menu_items[i][0] == '\0') - return -EINVAL; - strlcpy(qmenu-name, menu_items[qmenu-index], sizeof(qmenu-name)); - return 0; -} -EXPORT_SYMBOL(v4l2_ctrl_query_menu); - -/* Fill in a struct v4l2_querymenu based on the specified array of valid - menu items (terminated by V4L2_CTRL_MENU_IDS_END). - Use this if there are 'holes' in the list of valid menu items. */ -int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids) -{ - const char * const *menu_items = v4l2_ctrl_get_menu(qmenu-id); - - qmenu-reserved = 0; - if (menu_items == NULL || ids == NULL) - return -EINVAL; - while (*ids != V4L2_CTRL_MENU_IDS_END) { - if (*ids++ == qmenu-index) { - strlcpy(qmenu-name, menu_items[qmenu-index], - sizeof(qmenu-name)); - return 0; - } - } - return -EINVAL; -} -EXPORT_SYMBOL(v4l2_ctrl_query_menu_valid_items); - -/* ctrl_classes points to an array of u32 pointers, the last element is - a NULL pointer. Each u32 array is a 0-terminated array of control IDs. - Each array must be sorted low to high and belong to the same control - class. The array of u32 pointers must also be sorted, from low class IDs - to high class IDs. - - This function returns the first ID that follows after the given ID. - When no more controls are available 0 is returned. */ -u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id) -{ - u32 ctrl_class = V4L2_CTRL_ID2CLASS(id); - const u32 *pctrl; - - if (ctrl_classes == NULL) - return 0; - - /* if no query is desired, then check if the ID is part of ctrl_classes */ - if ((id V4L2_CTRL_FLAG_NEXT_CTRL) == 0) { - /* find class */ - while (*ctrl_classes V4L2_CTRL_ID2CLASS(**ctrl_classes) != ctrl_class) - ctrl_classes++; - if (*ctrl_classes == NULL) - return 0; - pctrl = *ctrl_classes; - /* find control ID */ - while (*pctrl *pctrl != id) pctrl++; - return *pctrl ? id : 0; - } - id = V4L2_CTRL_ID_MASK; - id++; /* select next control */ - /* find first class that matches (or is greater than) the class of - the ID */ - while (*ctrl_classes V4L2_CTRL_ID2CLASS(**ctrl_classes) ctrl_class) - ctrl_classes++; - /* no more classes */ - if (*ctrl_classes == NULL) - return 0; - pctrl = *ctrl_classes; - /* find first ctrl within the class that is = ID */ - while (*pctrl *pctrl id) pctrl++; - if (*pctrl) - return *pctrl; - /* we are at the end of the controls of the current class. */ - /* continue with next class if available */ - ctrl_classes++; - if (*ctrl_classes == NULL) - return 0; - return **ctrl_classes; -} -EXPORT_SYMBOL(v4l2_ctrl_next); - /* I2C Helper functions */ #if IS_ENABLED(CONFIG_I2C) diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 48f9748..6b4951d 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -88,16 +88,6 @@ const char *v4l2_ctrl_get_name(u32 id); const char * const *v4l2_ctrl_get_menu(u32 id); const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len); int
[PATCH 2/3] v4l2-ctrl: move function prototypes from common.h to ctrls.h
From: Hans Verkuil hans.verk...@cisco.com For some unknown reason several control prototypes where in v4l2-common.c instead of in v4l2-ctrls.h. Move them and document them. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- include/media/v4l2-common.h | 3 --- include/media/v4l2-ctrls.h | 25 + 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 6b4951d..c69d91d 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -84,9 +84,6 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, const char * const *menu_items); -const char *v4l2_ctrl_get_name(u32 id); -const char * const *v4l2_ctrl_get_menu(u32 id); -const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len); int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); /* - */ diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index b7cd7a6..911f3e5 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -670,6 +670,31 @@ static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, */ void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void *priv); +/** v4l2_ctrl_get_name() - Get the name of the control + * @id:The control ID. + * + * This function returns the name of the given control ID or NULL if it isn't + * a known control. + */ +const char *v4l2_ctrl_get_name(u32 id); + +/** v4l2_ctrl_get_menu() - Get the menu string array of the control + * @id:The control ID. + * + * This function returns the NULL-terminated menu string array name of the + * given control ID or NULL if it isn't a known menu control. + */ +const char * const *v4l2_ctrl_get_menu(u32 id); + +/** v4l2_ctrl_get_int_menu() - Get the integer menu array of the control + * @id:The control ID. + * @len: The size of the integer array. + * + * This function returns the integer array of the given control ID or NULL if it + * if it isn't a known integer menu control. + */ +const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len); + /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver. * @ctrl: The control. * -- 2.1.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: terratec HTC XS HD USB
I will reply my own question. it seems that w_scan is able to find the muxes/services if I push the antenna cable only half way into the tuner stick. I assume my problem is related to RF signal strength. is there a range of valid strengths? On Fri, Nov 21, 2014 at 5:13 PM, Robert N nrober...@gmail.com wrote: Hi, I'm trying to get my USB tuner stick working on an openwrt, but getting some errors. using w_scan to scan the available channels, gives: 113000: sr6900 (time: 00:11) (time: 00:12) signal ok: QAM_64 f = 113000 kHz S6900C999 start_filter:1410: ERROR: ioctl DMX_SET_FILTER failed: 97 Message too long Info: NIT(actual) filter timeout I know the 113Mhz is a valid MUX, because tuner works well under windows. Any hints what could be the reason of the error messages? Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/4] media: ti-vpe: Use data offset for getting dma_addr for a plane
On 11/14/2014 12:20 PM, Nikhil Devshatwar wrote: The data_offset in v4l2_planes structure will help us point to the start of data content for that particular plane. This may be useful when a single buffer contains the data for different planes e.g. Y planes of two fields in the same buffer. With this, user space can pass queue top field and bottom field with same dmafd and different data_offsets. Signed-off-by: Nikhil Devshatwar nikhil...@ti.com --- drivers/media/platform/ti-vpe/vpe.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index 0ae19ee..e59eb81 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -495,6 +495,14 @@ struct vpe_mmr_adb { #define VPE_SET_MMR_ADB_HDR(ctx, hdr, regs, offset_a)\ VPDMA_SET_MMR_ADB_HDR(ctx-mmr_adb, vpe_mmr_adb, hdr, regs, offset_a) + +static inline dma_addr_t vb2_dma_addr_plus_data_offset(struct vb2_buffer *vb, + unsigned int plane_no) +{ + return vb2_dma_contig_plane_dma_addr(vb, plane_no) + + vb-v4l2_planes[plane_no].data_offset; +} + /* * Set the headers for all of the address/data block structures. */ @@ -1002,7 +1010,7 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) int plane = fmt-coplanar ? p_data-vb_part : 0; vpdma_fmt = fmt-vpdma_fmt[plane]; - dma_addr = vb2_dma_contig_plane_dma_addr(vb, plane); + dma_addr = vb2_dma_addr_plus_data_offset(vb, plane); if (!dma_addr) { vpe_err(ctx-dev, acquiring output buffer(%d) dma_addr failed\n, @@ -1042,7 +1050,7 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port) vpdma_fmt = fmt-vpdma_fmt[plane]; - dma_addr = vb2_dma_contig_plane_dma_addr(vb, plane); + dma_addr = vb2_dma_addr_plus_data_offset(vb, plane); if (!dma_addr) { vpe_err(ctx-dev, acquiring input buffer(%d) dma_addr failed\n, I suspect this does not do what you want. data_offset is set by the application for an output stream (i.e. from memory to the hardware) and it is set by the driver for a capture stream (i.e. from hardware to memory). It looks like you expect that it is set by the application for capture streams as well, but that's not true. Regards, Hans -- 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
[GIT PULL FOR v3.19] Various cleanups sg_next fix
The following changes since commit 5937a784c3e5fe8fd1e201f42a2b1ece6c36a6c0: [media] staging: media: bcm2048: fix coding style error (2014-11-21 16:50:37 -0200) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git for-v3.19i for you to fetch changes up to 8b81fc8f5b8b92ff280fe7dc5071eae29c1a7fd3: v4l2-common: move v4l2_ctrl_check to cx2341x (2014-11-23 13:54:21 +0100) Hans Verkuil (5): bttv/cx25821/cx88/ivtv: use sg_next instead of sg++ v4l2-dev: vdev-v4l2_dev is always set, so simplify code. v4l2-common: remove unused helper functions. v4l2-ctrl: move function prototypes from common.h to ctrls.h v4l2-common: move v4l2_ctrl_check to cx2341x Prabhakar Lad (1): media: vivid: use vb2_ops_wait_prepare/finish helper drivers/media/common/cx2341x.c | 29 +++ drivers/media/pci/bt8xx/bttv-risc.c | 12 drivers/media/pci/cx25821/cx25821-core.c | 12 drivers/media/pci/cx88/cx88-core.c | 6 ++-- drivers/media/pci/ivtv/ivtv-udma.c | 2 +- drivers/media/platform/vivid/vivid-core.c| 19 drivers/media/platform/vivid/vivid-core.h| 3 -- drivers/media/platform/vivid/vivid-sdr-cap.c | 4 +-- drivers/media/platform/vivid/vivid-vbi-cap.c | 4 +-- drivers/media/platform/vivid/vivid-vbi-out.c | 4 +-- drivers/media/platform/vivid/vivid-vid-cap.c | 4 +-- drivers/media/platform/vivid/vivid-vid-out.c | 4 +-- drivers/media/v4l2-core/v4l2-common.c| 125 --- drivers/media/v4l2-core/v4l2-dev.c | 34 +- include/media/v4l2-common.h | 17 +-- include/media/v4l2-ctrls.h | 25 16 files changed, 100 insertions(+), 204 deletions(-) -- 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] staging/media/Makefile: drop omap24xx reference
Weird, this line was really removed in my patch, but it was somehow left when it was applied to the tree. Remove it again :-) Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/staging/media/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile index 97bfef9..30fb352 100644 --- a/drivers/staging/media/Makefile +++ b/drivers/staging/media/Makefile @@ -4,7 +4,6 @@ obj-$(CONFIG_LIRC_STAGING) += lirc/ obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/ -obj-$(CONFIG_VIDEO_TCM825X) += omap24xx/ obj-$(CONFIG_DVB_MN88472) += mn88472/ obj-$(CONFIG_DVB_MN88473) += mn88473/ -- 2.1.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/9] clk: sunxi: Make sun4i_a10_mod0_data available outside of clk-mod0.c
The sun6i prcm has mod0 compatible clocks, these need a separate driver because the prcm uses the mfd framework, but we do want to re-use the standard mod0 clk handling from clk-mod0.c for this, export sun4i_a10_mod0_data, so that the prcm mod0 clk driver can use this. Signed-off-by: Hans de Goede hdego...@redhat.com --- drivers/clk/sunxi/clk-mod0.c | 2 +- drivers/clk/sunxi/clk-mod0.h | 8 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/sunxi/clk-mod0.h diff --git a/drivers/clk/sunxi/clk-mod0.c b/drivers/clk/sunxi/clk-mod0.c index 5fb1f7e..7c06d42 100644 --- a/drivers/clk/sunxi/clk-mod0.c +++ b/drivers/clk/sunxi/clk-mod0.c @@ -67,7 +67,7 @@ static struct clk_factors_config sun4i_a10_mod0_config = { .pwidth = 2, }; -static const struct factors_data sun4i_a10_mod0_data __initconst = { +const struct factors_data sun4i_a10_mod0_data = { .enable = 31, .mux = 24, .table = sun4i_a10_mod0_config, diff --git a/drivers/clk/sunxi/clk-mod0.h b/drivers/clk/sunxi/clk-mod0.h new file mode 100644 index 000..49aa9ab --- /dev/null +++ b/drivers/clk/sunxi/clk-mod0.h @@ -0,0 +1,8 @@ +#ifndef __MACH_SUNXI_CLK_MOD0_H +#define __MACH_SUNXI_CLK_MOD0_H + +#include clk-factors.h + +extern const struct factors_data sun4i_a10_mod0_data; + +#endif -- 2.1.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 v2 0/9] sun6i / A31 ir receiver support
Hi All, Here is v2 of my sun6i ir receiver support patch-set as with v1, this touches clk, mfd (for the prcm clks), dts and media/rc code. Changes in v2: -clk: sunxi: Give sunxi_factors_register a registers parameter -Updated commit message to mention the removal of __init -Add error checking to calls of of_iomap -rc: sunxi-cir: Add support for an optional reset controller -Document resets property in devicetree bindings doc Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 7/9] ARM: dts: sun6i: Add ir node
Add a node for the ir receiver found on the A31. Signed-off-by: Hans de Goede hdego...@redhat.com --- arch/arm/boot/dts/sun6i-a31.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index 4aa628b..d33e758 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi @@ -900,6 +900,16 @@ reg = 0x01f01c00 0x300; }; + ir@01f02000 { + compatible = allwinner,sun5i-a13-ir; + clocks = apb0_gates 1, ir_clk; + clock-names = apb, ir; + resets = apb0_rst 1; + interrupts = 0 37 4; + reg = 0x01f02000 0x40; + status = disabled; + }; + r_pio: pinctrl@01f02c00 { compatible = allwinner,sun6i-a31-r-pinctrl; reg = 0x01f02c00 0x400; -- 2.1.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 v2 8/9] ARM: dts: sun6i: Add pinmux settings for the ir pins
Add pinmux settings for the ir receive pin of the A31. Signed-off-by: Hans de Goede hdego...@redhat.com --- arch/arm/boot/dts/sun6i-a31.dtsi | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index d33e758..90b7537 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi @@ -922,6 +922,13 @@ #interrupt-cells = 2; #size-cells = 0; #gpio-cells = 3; + + ir_pins_a: ir@0 { + allwinner,pins = PL4; + allwinner,function = s_ir; + allwinner,drive = 0; + allwinner,pull = 0; + }; }; }; }; -- 2.1.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 v2 3/9] clk: sunxi: Add prcm mod0 clock driver
Add a driver for mod0 clocks found in the prcm. Currently there is only one mod0 clocks in the prcm, the ir clock. Signed-off-by: Hans de Goede hdego...@redhat.com --- Documentation/devicetree/bindings/clock/sunxi.txt | 1 + drivers/clk/sunxi/Makefile| 2 +- drivers/clk/sunxi/clk-sun6i-prcm-mod0.c | 63 +++ drivers/mfd/sun6i-prcm.c | 14 + 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/sunxi/clk-sun6i-prcm-mod0.c diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt b/Documentation/devicetree/bindings/clock/sunxi.txt index ed116df..342c75a 100644 --- a/Documentation/devicetree/bindings/clock/sunxi.txt +++ b/Documentation/devicetree/bindings/clock/sunxi.txt @@ -56,6 +56,7 @@ Required properties: allwinner,sun4i-a10-usb-clk - for usb gates + resets on A10 / A20 allwinner,sun5i-a13-usb-clk - for usb gates + resets on A13 allwinner,sun6i-a31-usb-clk - for usb gates + resets on A31 + allwinner,sun6i-a31-ir-clk - for the ir clock on A31 Required properties for all clocks: - reg : shall be the control register address for the clock. diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile index 7ddc2b5..daf8b1c 100644 --- a/drivers/clk/sunxi/Makefile +++ b/drivers/clk/sunxi/Makefile @@ -10,4 +10,4 @@ obj-y += clk-sun8i-mbus.o obj-$(CONFIG_MFD_SUN6I_PRCM) += \ clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o \ - clk-sun8i-apb0.o + clk-sun8i-apb0.o clk-sun6i-prcm-mod0.o diff --git a/drivers/clk/sunxi/clk-sun6i-prcm-mod0.c b/drivers/clk/sunxi/clk-sun6i-prcm-mod0.c new file mode 100644 index 000..e80f18e --- /dev/null +++ b/drivers/clk/sunxi/clk-sun6i-prcm-mod0.c @@ -0,0 +1,63 @@ +/* + * Allwinner A31 PRCM mod0 clock driver + * + * Copyright (C) 2014 Hans de Goede hdego...@redhat.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/clk-provider.h +#include linux/clkdev.h +#include linux/module.h +#include linux/of_address.h +#include linux/platform_device.h + +#include clk-factors.h +#include clk-mod0.h + +static const struct of_device_id sun6i_a31_prcm_mod0_clk_dt_ids[] = { + { .compatible = allwinner,sun6i-a31-ir-clk }, + { /* sentinel */ } +}; + +static DEFINE_SPINLOCK(sun6i_prcm_mod0_lock); + +static int sun6i_a31_prcm_mod0_clk_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev-dev.of_node; + struct resource *r; + void __iomem *reg; + + if (!np) + return -ENODEV; + + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + reg = devm_ioremap_resource(pdev-dev, r); + if (IS_ERR(reg)) + return PTR_ERR(reg); + + sunxi_factors_register(np, sun4i_a10_mod0_data, + sun6i_prcm_mod0_lock, reg); + return 0; +} + +static struct platform_driver sun6i_a31_prcm_mod0_clk_driver = { + .driver = { + .name = sun6i-a31-prcm-mod0-clk, + .of_match_table = sun6i_a31_prcm_mod0_clk_dt_ids, + }, + .probe = sun6i_a31_prcm_mod0_clk_probe, +}; +module_platform_driver(sun6i_a31_prcm_mod0_clk_driver); + +MODULE_DESCRIPTION(Allwinner A31 PRCM mod0 clock driver); +MODULE_AUTHOR(Hans de Goede hdego...@redhat.com); +MODULE_LICENSE(GPL); diff --git a/drivers/mfd/sun6i-prcm.c b/drivers/mfd/sun6i-prcm.c index 283ab8d..ff1254f 100644 --- a/drivers/mfd/sun6i-prcm.c +++ b/drivers/mfd/sun6i-prcm.c @@ -41,6 +41,14 @@ static const struct resource sun6i_a31_apb0_gates_clk_res[] = { }, }; +static const struct resource sun6i_a31_ir_clk_res[] = { + { + .start = 0x54, + .end = 0x57, + .flags = IORESOURCE_MEM, + }, +}; + static const struct resource sun6i_a31_apb0_rstc_res[] = { { .start = 0xb0, @@ -69,6 +77,12 @@ static const struct mfd_cell sun6i_a31_prcm_subdevs[] = { .resources = sun6i_a31_apb0_gates_clk_res, }, { + .name = sun6i-a31-ir-clk, + .of_compatible = allwinner,sun6i-a31-ir-clk, + .num_resources = ARRAY_SIZE(sun6i_a31_ir_clk_res), + .resources = sun6i_a31_ir_clk_res, + }, + { .name = sun6i-a31-apb0-clock-reset, .of_compatible = allwinner,sun6i-a31-clock-reset, .num_resources = ARRAY_SIZE(sun6i_a31_apb0_rstc_res), -- 2.1.0 -- To unsubscribe
[PATCH v2 1/9] clk: sunxi: Give sunxi_factors_register a registers parameter
Before this commit sunxi_factors_register uses of_iomap(node, 0) to get the clk registers. The sun6i prcm has factor clocks, for which we want to use sunxi_factors_register, but of_iomap(node, 0) does not work for the prcm factor clocks, because the prcm uses the mfd framework, so the registers are not part of the dt-node, instead they are added to the platform_device, as platform_device resources. This commit makes getting the registers the callers duty, so that sunxi_factors_register can be used with mfd instantiated platform device too. While at it also add error checking to the of_iomap calls. This commit also drops the __init function from sunxi_factors_register since platform driver probe functions are not __init. Signed-off-by: Hans de Goede hdego...@redhat.com --- drivers/clk/sunxi/clk-factors.c| 10 -- drivers/clk/sunxi/clk-factors.h| 7 --- drivers/clk/sunxi/clk-mod0.c | 24 ++-- drivers/clk/sunxi/clk-sun8i-mbus.c | 13 +++-- drivers/clk/sunxi/clk-sunxi.c | 11 ++- 5 files changed, 51 insertions(+), 14 deletions(-) diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c index f83ba09..fc4f4b5 100644 --- a/drivers/clk/sunxi/clk-factors.c +++ b/drivers/clk/sunxi/clk-factors.c @@ -156,9 +156,10 @@ static const struct clk_ops clk_factors_ops = { .set_rate = clk_factors_set_rate, }; -struct clk * __init sunxi_factors_register(struct device_node *node, - const struct factors_data *data, - spinlock_t *lock) +struct clk *sunxi_factors_register(struct device_node *node, + const struct factors_data *data, + spinlock_t *lock, + void __iomem *reg) { struct clk *clk; struct clk_factors *factors; @@ -168,11 +169,8 @@ struct clk * __init sunxi_factors_register(struct device_node *node, struct clk_hw *mux_hw = NULL; const char *clk_name = node-name; const char *parents[FACTORS_MAX_PARENTS]; - void __iomem *reg; int i = 0; - reg = of_iomap(node, 0); - /* if we have a mux, we will have 1 parents */ while (i FACTORS_MAX_PARENTS (parents[i] = of_clk_get_parent_name(node, i)) != NULL) diff --git a/drivers/clk/sunxi/clk-factors.h b/drivers/clk/sunxi/clk-factors.h index 9913840..1f5526d 100644 --- a/drivers/clk/sunxi/clk-factors.h +++ b/drivers/clk/sunxi/clk-factors.h @@ -37,8 +37,9 @@ struct clk_factors { spinlock_t *lock; }; -struct clk * __init sunxi_factors_register(struct device_node *node, - const struct factors_data *data, - spinlock_t *lock); +struct clk *sunxi_factors_register(struct device_node *node, + const struct factors_data *data, + spinlock_t *lock, + void __iomem *reg); #endif diff --git a/drivers/clk/sunxi/clk-mod0.c b/drivers/clk/sunxi/clk-mod0.c index 4a56385..5fb1f7e 100644 --- a/drivers/clk/sunxi/clk-mod0.c +++ b/drivers/clk/sunxi/clk-mod0.c @@ -78,7 +78,17 @@ static DEFINE_SPINLOCK(sun4i_a10_mod0_lock); static void __init sun4i_a10_mod0_setup(struct device_node *node) { - sunxi_factors_register(node, sun4i_a10_mod0_data, sun4i_a10_mod0_lock); + void __iomem *reg; + + reg = of_iomap(node, 0); + if (!reg) { + pr_err(Could not get registers for mod0-clk: %s\n, + node-name); + return; + } + + sunxi_factors_register(node, sun4i_a10_mod0_data, + sun4i_a10_mod0_lock, reg); } CLK_OF_DECLARE(sun4i_a10_mod0, allwinner,sun4i-a10-mod0-clk, sun4i_a10_mod0_setup); @@ -86,7 +96,17 @@ static DEFINE_SPINLOCK(sun5i_a13_mbus_lock); static void __init sun5i_a13_mbus_setup(struct device_node *node) { - struct clk *mbus = sunxi_factors_register(node, sun4i_a10_mod0_data, sun5i_a13_mbus_lock); + struct clk *mbus; + void __iomem *reg; + + reg = of_iomap(node, 0); + if (!reg) { + pr_err(Could not get registers for a13-mbus-clk\n); + return; + } + + mbus = sunxi_factors_register(node, sun4i_a10_mod0_data, + sun5i_a13_mbus_lock, reg); /* The MBUS clocks needs to be always enabled */ __clk_get(mbus); diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c index 8e49b44..c0629ff 100644 --- a/drivers/clk/sunxi/clk-sun8i-mbus.c +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c @@ -68,8 +68,17 @@ static DEFINE_SPINLOCK(sun8i_a23_mbus_lock); static void __init sun8i_a23_mbus_setup(struct device_node *node) { - struct clk *mbus = sunxi_factors_register(node, sun8i_a23_mbus_data, -
[PATCH v2 4/9] rc: sunxi-cir: Add support for an optional reset controller
On sun6i the cir block is attached to the reset controller, add support for de-asserting the reset if a reset controller is specified in dt. Signed-off-by: Hans de Goede hdego...@redhat.com Acked-by: Mauro Carvalho Chehab mche...@osg.samsung.com Acked-by: Maxime Ripard maxime.rip...@free-electrons.com --- .../devicetree/bindings/media/sunxi-ir.txt | 2 ++ drivers/media/rc/sunxi-cir.c | 25 -- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt b/Documentation/devicetree/bindings/media/sunxi-ir.txt index 23dd5ad..6b70b9b 100644 --- a/Documentation/devicetree/bindings/media/sunxi-ir.txt +++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt @@ -10,6 +10,7 @@ Required properties: Optional properties: - linux,rc-map-name : Remote control map name. +- resets : phandle + reset specifier pair Example: @@ -17,6 +18,7 @@ ir0: ir@01c21800 { compatible = allwinner,sun4i-a10-ir; clocks = apb0_gates 6, ir0_clk; clock-names = apb, ir; + resets = apb0_rst 1; interrupts = 0 5 1; reg = 0x01C21800 0x40; linux,rc-map-name = rc-rc6-mce; diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c index bcee8e1..895fb65 100644 --- a/drivers/media/rc/sunxi-cir.c +++ b/drivers/media/rc/sunxi-cir.c @@ -23,6 +23,7 @@ #include linux/interrupt.h #include linux/module.h #include linux/of_platform.h +#include linux/reset.h #include media/rc-core.h #define SUNXI_IR_DEV sunxi-ir @@ -95,6 +96,7 @@ struct sunxi_ir { int irq; struct clk *clk; struct clk *apb_clk; + struct reset_control *rst; const char *map_name; }; @@ -166,15 +168,29 @@ static int sunxi_ir_probe(struct platform_device *pdev) return PTR_ERR(ir-clk); } + /* Reset (optional) */ + ir-rst = devm_reset_control_get_optional(dev, NULL); + if (IS_ERR(ir-rst)) { + ret = PTR_ERR(ir-rst); + if (ret == -EPROBE_DEFER) + return ret; + ir-rst = NULL; + } else { + ret = reset_control_deassert(ir-rst); + if (ret) + return ret; + } + ret = clk_set_rate(ir-clk, SUNXI_IR_BASE_CLK); if (ret) { dev_err(dev, set ir base clock failed!\n); - return ret; + goto exit_reset_assert; } if (clk_prepare_enable(ir-apb_clk)) { dev_err(dev, try to enable apb_ir_clk failed\n); - return -EINVAL; + ret = -EINVAL; + goto exit_reset_assert; } if (clk_prepare_enable(ir-clk)) { @@ -271,6 +287,9 @@ exit_clkdisable_clk: clk_disable_unprepare(ir-clk); exit_clkdisable_apb_clk: clk_disable_unprepare(ir-apb_clk); +exit_reset_assert: + if (ir-rst) + reset_control_assert(ir-rst); return ret; } @@ -282,6 +301,8 @@ static int sunxi_ir_remove(struct platform_device *pdev) clk_disable_unprepare(ir-clk); clk_disable_unprepare(ir-apb_clk); + if (ir-rst) + reset_control_assert(ir-rst); spin_lock_irqsave(ir-ir_lock, flags); /* disable IR IRQ */ -- 2.1.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 v2 9/9] ARM: dts: sun6i: Enable ir receiver on the Mele M9
The Mele M9 has an ir receiver, enable it. Signed-off-by: Hans de Goede hdego...@redhat.com --- arch/arm/boot/dts/sun6i-a31-m9.dts | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/sun6i-a31-m9.dts b/arch/arm/boot/dts/sun6i-a31-m9.dts index 4202c64..94ddf9c 100644 --- a/arch/arm/boot/dts/sun6i-a31-m9.dts +++ b/arch/arm/boot/dts/sun6i-a31-m9.dts @@ -83,6 +83,12 @@ reg = 1; }; }; + + ir@01f02000 { + pinctrl-names = default; + pinctrl-0 = ir_pins_a; + status = okay; + }; }; leds { -- 2.1.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 v2 5/9] rc: sunxi-cir: Add support for the larger fifo found on sun5i and sun6i
Add support for the larger fifo found on sun5i and sun6i, having a separate compatible for the ir found on sun5i sun6i also is useful if we ever want to add ir transmit support, because the sun5i sun6i version do not have transmit support. Note this commits also adds checking for the end-of-packet interrupt flag (which was already enabled), as the fifo-data-available interrupt flag only gets set when the trigger-level is exceeded. So far we've been getting away with not doing this because of the low trigger-level, but this is something which we should have done since day one. Signed-off-by: Hans de Goede hdego...@redhat.com Acked-by: Mauro Carvalho Chehab mche...@osg.samsung.com Acked-by: Maxime Ripard maxime.rip...@free-electrons.com --- .../devicetree/bindings/media/sunxi-ir.txt | 2 +- drivers/media/rc/sunxi-cir.c| 21 - 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt b/Documentation/devicetree/bindings/media/sunxi-ir.txt index 6b70b9b..1811a06 100644 --- a/Documentation/devicetree/bindings/media/sunxi-ir.txt +++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt @@ -1,7 +1,7 @@ Device-Tree bindings for SUNXI IR controller found in sunXi SoC family Required properties: -- compatible : should be allwinner,sun4i-a10-ir; +- compatible : allwinner,sun4i-a10-ir or allwinner,sun5i-a13-ir - clocks : list of clock specifiers, corresponding to entries in clock-names property; - clock-names : should contain apb and ir entries; diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c index 895fb65..559b0e3 100644 --- a/drivers/media/rc/sunxi-cir.c +++ b/drivers/media/rc/sunxi-cir.c @@ -56,12 +56,12 @@ #define REG_RXINT_RAI_EN BIT(4) /* Rx FIFO available byte level */ -#define REG_RXINT_RAL(val)(((val) 8) (GENMASK(11, 8))) +#define REG_RXINT_RAL(val)((val) 8) /* Rx Interrupt Status */ #define SUNXI_IR_RXSTA_REG0x30 /* RX FIFO Get Available Counter */ -#define REG_RXSTA_GET_AC(val) (((val) 8) (GENMASK(5, 0))) +#define REG_RXSTA_GET_AC(val) (((val) 8) (ir-fifo_size * 2 - 1)) /* Clear all interrupt status value */ #define REG_RXSTA_CLEARALL0xff @@ -72,10 +72,6 @@ /* CIR_REG register idle threshold */ #define REG_CIR_ITHR(val)(((val) 8) (GENMASK(15, 8))) -/* Hardware supported fifo size */ -#define SUNXI_IR_FIFO_SIZE16 -/* How many messages in FIFO trigger IRQ */ -#define TRIGGER_LEVEL 8 /* Required frequency for IR0 or IR1 clock in CIR mode */ #define SUNXI_IR_BASE_CLK 800 /* Frequency after IR internal divider */ @@ -94,6 +90,7 @@ struct sunxi_ir { struct rc_dev *rc; void __iomem*base; int irq; + int fifo_size; struct clk *clk; struct clk *apb_clk; struct reset_control *rst; @@ -115,11 +112,11 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id) /* clean all pending statuses */ writel(status | REG_RXSTA_CLEARALL, ir-base + SUNXI_IR_RXSTA_REG); - if (status REG_RXINT_RAI_EN) { + if (status (REG_RXINT_RAI_EN | REG_RXINT_RPEI_EN)) { /* How many messages in fifo */ rc = REG_RXSTA_GET_AC(status); /* Sanity check */ - rc = rc SUNXI_IR_FIFO_SIZE ? SUNXI_IR_FIFO_SIZE : rc; + rc = rc ir-fifo_size ? ir-fifo_size : rc; /* If we have data */ for (cnt = 0; cnt rc; cnt++) { /* for each bit in fifo */ @@ -156,6 +153,11 @@ static int sunxi_ir_probe(struct platform_device *pdev) if (!ir) return -ENOMEM; + if (of_device_is_compatible(dn, allwinner,sun5i-a13-ir)) + ir-fifo_size = 64; + else + ir-fifo_size = 16; + /* Clock */ ir-apb_clk = devm_clk_get(dev, apb); if (IS_ERR(ir-apb_clk)) { @@ -271,7 +273,7 @@ static int sunxi_ir_probe(struct platform_device *pdev) * level */ writel(REG_RXINT_ROI_EN | REG_RXINT_RPEI_EN | - REG_RXINT_RAI_EN | REG_RXINT_RAL(TRIGGER_LEVEL - 1), + REG_RXINT_RAI_EN | REG_RXINT_RAL(ir-fifo_size / 2 - 1), ir-base + SUNXI_IR_RXINT_REG); /* Enable IR Module */ @@ -319,6 +321,7 @@ static int sunxi_ir_remove(struct platform_device *pdev) static const struct of_device_id sunxi_ir_match[] = { { .compatible = allwinner,sun4i-a10-ir, }, + { .compatible = allwinner,sun5i-a13-ir, }, {}, }; -- 2.1.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 v2 6/9] ARM: dts: sun6i: Add ir_clk node
Add an ir_clk sub-node to the prcm node. Signed-off-by: Hans de Goede hdego...@redhat.com --- arch/arm/boot/dts/sun6i-a31.dtsi | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index a01b215..4aa628b 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi @@ -882,6 +882,13 @@ apb0_i2c; }; + ir_clk: ir_clk { + #clock-cells = 0; + compatible = allwinner,sun6i-a31-ir-clk; + clocks = osc32k, osc24M; + clock-output-names = ir; + }; + apb0_rst: apb0_rst { compatible = allwinner,sun6i-a31-clock-reset; #reset-cells = 1; -- 2.1.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 2/3] carma-fpga: drop videobuf dependency
From: Hans Verkuil hans.verk...@cisco.com This driver abuses videobuf helper functions. This is a bad idea because: 1) this driver is completely unrelated to media drivers 2) the videobuf API is deprecated and will be removed eventually This patch replaces the videobuf functions with the normal DMA kernel API. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/misc/carma/Kconfig | 3 +- drivers/misc/carma/carma-fpga.c | 98 ++--- 2 files changed, 82 insertions(+), 19 deletions(-) diff --git a/drivers/misc/carma/Kconfig b/drivers/misc/carma/Kconfig index c90370e..c6047fb 100644 --- a/drivers/misc/carma/Kconfig +++ b/drivers/misc/carma/Kconfig @@ -1,7 +1,6 @@ config CARMA_FPGA tristate CARMA DATA-FPGA Access Driver - depends on FSL_SOC PPC_83xx MEDIA_SUPPORT HAS_DMA FSL_DMA - select VIDEOBUF_DMA_SG + depends on FSL_SOC PPC_83xx HAS_DMA FSL_DMA default n help Say Y here to include support for communicating with the data diff --git a/drivers/misc/carma/carma-fpga.c b/drivers/misc/carma/carma-fpga.c index 55e913b..5b12149 100644 --- a/drivers/misc/carma/carma-fpga.c +++ b/drivers/misc/carma/carma-fpga.c @@ -98,6 +98,7 @@ #include linux/seq_file.h #include linux/highmem.h #include linux/debugfs.h +#include linux/vmalloc.h #include linux/kernel.h #include linux/module.h #include linux/poll.h @@ -105,8 +106,6 @@ #include linux/kref.h #include linux/io.h -#include media/videobuf-dma-sg.h - /* system controller registers */ #define SYS_IRQ_SOURCE_CTL 0x24 #define SYS_IRQ_OUTPUT_EN 0x28 @@ -142,7 +141,10 @@ struct fpga_info { struct data_buf { struct list_head entry; - struct videobuf_dmabuf vb; + void *vaddr; + struct scatterlist *sglist; + int sglen; + int nr_pages; size_t size; }; @@ -207,6 +209,68 @@ static void fpga_device_release(struct kref *ref) * Data Buffer Allocation Helpers */ +static int carma_dma_init(struct data_buf *buf, int nr_pages) +{ + struct page *pg; + int i; + + buf-vaddr = vmalloc_32(nr_pages PAGE_SHIFT); + if (NULL == buf-vaddr) { + pr_debug(vmalloc_32(%d pages) failed\n, nr_pages); + return -ENOMEM; + } + + pr_debug(vmalloc is at addr 0x%08lx, size=%d\n, + (unsigned long)buf-vaddr, + nr_pages PAGE_SHIFT); + + memset(buf-vaddr, 0, nr_pages PAGE_SHIFT); + buf-nr_pages = nr_pages; + + buf-sglist = vzalloc(buf-nr_pages * sizeof(*buf-sglist)); + if (NULL == buf-sglist) + goto vzalloc_err; + + sg_init_table(buf-sglist, buf-nr_pages); + for (i = 0; i buf-nr_pages; i++) { + pg = vmalloc_to_page(buf-vaddr + i * PAGE_SIZE); + if (NULL == pg) + goto vmalloc_to_page_err; + sg_set_page(buf-sglist[i], pg, PAGE_SIZE, 0); + } + return 0; + +vmalloc_to_page_err: + vfree(buf-sglist); + buf-sglist = NULL; +vzalloc_err: + vfree(buf-vaddr); + buf-vaddr = NULL; + return -ENOMEM; +} + +static int carma_dma_map(struct device *dev, struct data_buf *buf) +{ + buf-sglen = dma_map_sg(dev, buf-sglist, + buf-nr_pages, DMA_FROM_DEVICE); + + if (0 == buf-sglen) { + pr_warn(%s: dma_map_sg failed\n, __func__); + return -ENOMEM; + } + return 0; +} + +static int carma_dma_unmap(struct device *dev, struct data_buf *buf) +{ + if (!buf-sglen) + return 0; + + dma_unmap_sg(dev, buf-sglist, buf-sglen, DMA_FROM_DEVICE); + buf-sglen = 0; + return 0; +} + /** * data_free_buffer() - free a single data buffer and all allocated memory * @buf: the buffer to free @@ -221,7 +285,8 @@ static void data_free_buffer(struct data_buf *buf) return; /* free all memory */ - videobuf_dma_free(buf-vb); + vfree(buf-sglist); + vfree(buf-vaddr); kfree(buf); } @@ -230,7 +295,7 @@ static void data_free_buffer(struct data_buf *buf) * @bytes: the number of bytes required * * This allocates all space needed for a data buffer. It must be mapped before - * use in a DMA transaction using videobuf_dma_map(). + * use in a DMA transaction using carma_dma_map(). * * Returns NULL on failure */ @@ -252,9 +317,8 @@ static struct data_buf *data_alloc_buffer(const size_t bytes) INIT_LIST_HEAD(buf-entry); buf-size = bytes; - /* allocate the videobuf */ - videobuf_dma_init(buf-vb); - ret = videobuf_dma_init_kernel(buf-vb, DMA_FROM_DEVICE, nr_pages); + /* allocate the buffer */ + ret = carma_dma_init(buf, nr_pages); if (ret) goto out_free_buf; @@ -285,13 +349,13 @@ static void data_free_buffers(struct fpga_device *priv)
[PATCH 3/3] carma-fpga-program: drop videobuf dependency
From: Hans Verkuil hans.verk...@cisco.com This driver abuses videobuf helper functions. This is a bad idea because: 1) this driver is completely unrelated to media drivers 2) the videobuf API is deprecated and will be removed eventually This patch replaces the videobuf functions with the normal DMA kernel API. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/misc/carma/Kconfig | 3 +- drivers/misc/carma/carma-fpga-program.c | 97 +++-- 2 files changed, 81 insertions(+), 19 deletions(-) diff --git a/drivers/misc/carma/Kconfig b/drivers/misc/carma/Kconfig index c6047fb..295882b 100644 --- a/drivers/misc/carma/Kconfig +++ b/drivers/misc/carma/Kconfig @@ -8,8 +8,7 @@ config CARMA_FPGA config CARMA_FPGA_PROGRAM tristate CARMA DATA-FPGA Programmer - depends on FSL_SOC PPC_83xx MEDIA_SUPPORT HAS_DMA FSL_DMA - select VIDEOBUF_DMA_SG + depends on FSL_SOC PPC_83xx HAS_DMA FSL_DMA default n help Say Y here to include support for programming the data processing diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c index eb8942b..a7496e3 100644 --- a/drivers/misc/carma/carma-fpga-program.c +++ b/drivers/misc/carma/carma-fpga-program.c @@ -19,6 +19,7 @@ #include linux/fsldma.h #include linux/interrupt.h #include linux/highmem.h +#include linux/vmalloc.h #include linux/kernel.h #include linux/module.h #include linux/mutex.h @@ -30,8 +31,6 @@ #include linux/fs.h #include linux/io.h -#include media/videobuf-dma-sg.h - /* MPC8349EMDS specific get_immrbase() */ #include sysdev/fsl_soc.h @@ -67,14 +66,79 @@ struct fpga_dev { /* FPGA Bitfile */ struct mutex lock; - struct videobuf_dmabuf vb; - bool vb_allocated; + void *vaddr; + struct scatterlist *sglist; + int sglen; + int nr_pages; + bool buf_allocated; /* max size and written bytes */ size_t fw_size; size_t bytes; }; +static int fpga_dma_init(struct fpga_dev *priv, int nr_pages) +{ + struct page *pg; + int i; + + priv-vaddr = vmalloc_32(nr_pages PAGE_SHIFT); + if (NULL == priv-vaddr) { + pr_debug(vmalloc_32(%d pages) failed\n, nr_pages); + return -ENOMEM; + } + + pr_debug(vmalloc is at addr 0x%08lx, size=%d\n, + (unsigned long)priv-vaddr, + nr_pages PAGE_SHIFT); + + memset(priv-vaddr, 0, nr_pages PAGE_SHIFT); + priv-nr_pages = nr_pages; + + priv-sglist = vzalloc(priv-nr_pages * sizeof(*priv-sglist)); + if (NULL == priv-sglist) + goto vzalloc_err; + + sg_init_table(priv-sglist, priv-nr_pages); + for (i = 0; i priv-nr_pages; i++) { + pg = vmalloc_to_page(priv-vaddr + i * PAGE_SIZE); + if (NULL == pg) + goto vmalloc_to_page_err; + sg_set_page(priv-sglist[i], pg, PAGE_SIZE, 0); + } + return 0; + +vmalloc_to_page_err: + vfree(priv-sglist); + priv-sglist = NULL; +vzalloc_err: + vfree(priv-vaddr); + priv-vaddr = NULL; + return -ENOMEM; +} + +static int fpga_dma_map(struct fpga_dev *priv) +{ + priv-sglen = dma_map_sg(priv-dev, priv-sglist, + priv-nr_pages, DMA_TO_DEVICE); + + if (0 == priv-sglen) { + pr_warn(%s: dma_map_sg failed\n, __func__); + return -ENOMEM; + } + return 0; +} + +static int fpga_dma_unmap(struct fpga_dev *priv) +{ + if (!priv-sglen) + return 0; + + dma_unmap_sg(priv-dev, priv-sglist, priv-sglen, DMA_TO_DEVICE); + priv-sglen = 0; + return 0; +} + /* * FPGA Bitfile Helpers */ @@ -87,8 +151,9 @@ struct fpga_dev { */ static void fpga_drop_firmware_data(struct fpga_dev *priv) { - videobuf_dma_free(priv-vb); - priv-vb_allocated = false; + vfree(priv-sglist); + vfree(priv-vaddr); + priv-buf_allocated = false; priv-bytes = 0; } @@ -427,7 +492,7 @@ static noinline int fpga_program_cpu(struct fpga_dev *priv) dev_dbg(priv-dev, enabled the controller\n); /* Write each chunk of the FPGA bitfile to FPGA programmer */ - ret = fpga_program_block(priv, priv-vb.vaddr, priv-bytes); + ret = fpga_program_block(priv, priv-vaddr, priv-bytes); if (ret) goto out_disable_controller; @@ -463,7 +528,6 @@ out_disable_controller: */ static noinline int fpga_program_dma(struct fpga_dev *priv) { - struct videobuf_dmabuf *vb = priv-vb; struct dma_chan *chan = priv-chan; struct dma_async_tx_descriptor *tx; size_t num_pages, len, avail = 0; @@ -505,7 +569,7 @@ static noinline int fpga_program_dma(struct fpga_dev *priv) } /* Map the buffer for DMA */ - ret =
[PATCH 0/3] carma-fpga: remove videobuf dependency
While checking which drivers were still abusing internal videobuf API functions I came across these carma fpga misc drivers. These drivers have absolutely nothing to do with videobuf or the media subsystem. Drivers shouldn't use those low-level functions in the first place, and in fact in the long run the videobuf API will be removed altogether. So remove the videobuf dependency from these two drivers. This has been compile tested (and that clearly hasn't been done for carma-fpga-program.c recently). Greg, is this something you want to take as misc driver maintainer? That makes more sense than going through the media tree. The first patch should probably go to 3.18. I have no idea if anyone can test this with actual hardware. Ira, is that something you can do? Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] carma-fpga-program.c: fix compile errors
From: Hans Verkuil hans.verk...@cisco.com drivers/misc/carma/carma-fpga-program.c: In function 'fpga_program_dma': drivers/misc/carma/carma-fpga-program.c:529:2: error: expected ';' before 'if' if (ret) { ^ drivers/misc/carma/carma-fpga-program.c: In function 'fpga_read': drivers/misc/carma/carma-fpga-program.c:752:45: error: 'ppos' undeclared (first use in this function) return simple_read_from_buffer(buf, count, ppos, ^ drivers/misc/carma/carma-fpga-program.c:752:45: note: each undeclared identifier is reported only once for each function it appears in drivers/misc/carma/carma-fpga-program.c: In function 'fpga_llseek': drivers/misc/carma/carma-fpga-program.c:765:27: error: 'file' undeclared (first use in this function) return fixed_size_llseek(file, offset, origin, priv-fw_size); ^ drivers/misc/carma/carma-fpga-program.c:759:9: warning: unused variable 'newpos' [-Wunused-variable] loff_t newpos; ^ drivers/misc/carma/carma-fpga-program.c: In function 'fpga_read': drivers/misc/carma/carma-fpga-program.c:754:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/misc/carma/carma-fpga-program.c: In function 'fpga_llseek': drivers/misc/carma/carma-fpga-program.c:766:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ scripts/Makefile.build:263: recipe for target 'drivers/misc/carma/carma-fpga-program.o' failed Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/misc/carma/carma-fpga-program.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c index 339b252..eb8942b 100644 --- a/drivers/misc/carma/carma-fpga-program.c +++ b/drivers/misc/carma/carma-fpga-program.c @@ -525,7 +525,7 @@ static noinline int fpga_program_dma(struct fpga_dev *priv) goto out_dma_unmap; } - ret = fsl_dma_external_start(chan, 1) + ret = fsl_dma_external_start(chan, 1); if (ret) { dev_err(priv-dev, DMA external control setup failed\n); goto out_dma_unmap; @@ -749,20 +749,19 @@ static ssize_t fpga_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { struct fpga_dev *priv = filp-private_data; - return simple_read_from_buffer(buf, count, ppos, + return simple_read_from_buffer(buf, count, f_pos, priv-vb.vaddr, priv-bytes); } static loff_t fpga_llseek(struct file *filp, loff_t offset, int origin) { struct fpga_dev *priv = filp-private_data; - loff_t newpos; /* only read-only opens are allowed to seek */ if ((filp-f_flags O_ACCMODE) != O_RDONLY) return -EINVAL; - return fixed_size_llseek(file, offset, origin, priv-fw_size); + return fixed_size_llseek(filp, offset, origin, priv-fw_size); } static const struct file_operations fpga_fops = { -- 2.1.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL FOR v3.19] Various cleanups sg_next fix
This supersedes the previous pull request. It's identical, but the omap24xx Makefile patch was added. Hans The following changes since commit 5937a784c3e5fe8fd1e201f42a2b1ece6c36a6c0: [media] staging: media: bcm2048: fix coding style error (2014-11-21 16:50:37 -0200) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git for-v3.19i for you to fetch changes up to b0856f476664018cd75dedde9fc1e8d28a194e3c: staging/media/Makefile: drop omap24xx reference (2014-11-23 15:29:48 +0100) Hans Verkuil (6): bttv/cx25821/cx88/ivtv: use sg_next instead of sg++ v4l2-dev: vdev-v4l2_dev is always set, so simplify code. v4l2-common: remove unused helper functions. v4l2-ctrl: move function prototypes from common.h to ctrls.h v4l2-common: move v4l2_ctrl_check to cx2341x staging/media/Makefile: drop omap24xx reference Prabhakar Lad (1): media: vivid: use vb2_ops_wait_prepare/finish helper drivers/media/common/cx2341x.c | 29 +++ drivers/media/pci/bt8xx/bttv-risc.c | 12 drivers/media/pci/cx25821/cx25821-core.c | 12 drivers/media/pci/cx88/cx88-core.c | 6 ++-- drivers/media/pci/ivtv/ivtv-udma.c | 2 +- drivers/media/platform/vivid/vivid-core.c| 19 drivers/media/platform/vivid/vivid-core.h| 3 -- drivers/media/platform/vivid/vivid-sdr-cap.c | 4 +-- drivers/media/platform/vivid/vivid-vbi-cap.c | 4 +-- drivers/media/platform/vivid/vivid-vbi-out.c | 4 +-- drivers/media/platform/vivid/vivid-vid-cap.c | 4 +-- drivers/media/platform/vivid/vivid-vid-out.c | 4 +-- drivers/media/v4l2-core/v4l2-common.c| 125 --- drivers/media/v4l2-core/v4l2-dev.c | 34 +- drivers/staging/media/Makefile | 1 - include/media/v4l2-common.h | 17 +-- include/media/v4l2-ctrls.h | 25 17 files changed, 100 insertions(+), 205 deletions(-) -- 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 5/9] rc: sunxi-cir: Add support for the larger fifo found on sun5i and sun6i
On Fri, Nov 21, 2014 at 11:13:17AM +0100, Hans de Goede wrote: Hi, On 11/21/2014 10:59 AM, Maxime Ripard wrote: On Fri, Nov 21, 2014 at 09:42:09AM +0100, Hans de Goede wrote: Hi, On 11/21/2014 09:26 AM, Maxime Ripard wrote: Hi Mauro, On Thu, Nov 20, 2014 at 02:28:56PM -0200, Mauro Carvalho Chehab wrote: Em Thu, 20 Nov 2014 16:55:24 +0100 Hans de Goede hdego...@redhat.com escreveu: Add support for the larger fifo found on sun5i and sun6i, having a separate compatible for the ir found on sun5i sun6i also is useful if we ever want to add ir transmit support, because the sun5i sun6i version do not have transmit support. Note this commits also adds checking for the end-of-packet interrupt flag (which was already enabled), as the fifo-data-available interrupt flag only gets set when the trigger-level is exceeded. So far we've been getting away with not doing this because of the low trigger-level, but this is something which we should have done since day one. Signed-off-by: Hans de Goede hdego...@redhat.com As this is meant to be merged via some other tree: Acked-by: Mauro Carvalho Chehab mche...@osg.samsung.com I think merging it through your tree would be just fine. Acked-by: Maxime Ripard maxime.rip...@free-electrons.com Heh, I was thinking it would be best if it went through Maxime's tree because it also has some deps on new clk stuff (well the dts have deps on that), but either way works for me. Maxime if you want this go through Mauro's tree, I can send a pull-req to Mauro (I'm a linux-media sub-maintainer), so if that is the case let me know and I'll prepare a pull-req (after fixing the missing reset documentation in the bindings). So much for not reading the cover letter... Sorry. We're getting quite close to the end of the ARM merge window, and I got a couple comments, Lee hasn't commented yet, so I'd say it's a bit too late for this to come in. Oh, but this was not intended for 3.19, this can wait till 3.20 from my pov, sorry if that was not clear. I was assuming that the merge window was more or less closed already, so that this going into 3.20 was expected. Perfect then :) Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com signature.asc Description: Digital signature
[PATCH 2/2] em28xx: Add support for Terratec Cinergy T2 Stick HD
Terratec Cinergy T2 Stick HD [eb1a:8179] is a USB DVB-T/T2/C tuner that contains following components: * Empia EM28178 USB bridge * Silicon Labs Si2168-A30 demodulator * Silicon Labs Si2146-A10 tuner I don't have the remote, so the RC_MAP is a best guess based on the pictures of the remote controllers and other supported Terratec devices with a similar remote. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/usb/em28xx/em28xx-cards.c | 27 +++ drivers/media/usb/em28xx/em28xx-dvb.c | 58 + drivers/media/usb/em28xx/em28xx.h | 1 + 3 files changed, 86 insertions(+) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 71fa51e..382018d 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -479,6 +479,20 @@ static struct em28xx_reg_seq pctv_292e[] = { {-1, -1, -1, -1}, }; +static struct em28xx_reg_seq terratec_t2_stick_hd[] = { + {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0}, + {0x0d, 0xff, 0xff, 600}, + {EM2874_R80_GPIO_P0_CTRL, 0xfc, 0xff, 10}, + {EM2874_R80_GPIO_P0_CTRL, 0xbc, 0xff, 100}, + {EM2874_R80_GPIO_P0_CTRL, 0xfc, 0xff, 100}, + {EM2874_R80_GPIO_P0_CTRL, 0x00, 0xff, 300}, + {EM2874_R80_GPIO_P0_CTRL, 0xf8, 0xff, 100}, + {EM2874_R80_GPIO_P0_CTRL, 0xfc, 0xff, 300}, + {0x0d, 0x42, 0xff, 1000}, + {EM2874_R5F_TS_ENABLE, 0x85, 0xff, 0}, + {-1, -1, -1, -1}, +}; + /* * Button definitions */ @@ -2243,6 +2257,17 @@ struct em28xx_board em28xx_boards[] = { .has_dvb = 1, .ir_codes = RC_MAP_PINNACLE_PCTV_HD, }, + /* eb1a:8179 Terratec Cinergy T2 Stick HD. +* Empia EM28178, Silicon Labs Si2168, Silicon Labs Si2146 */ + [EM28178_BOARD_TERRATEC_T2_STICK_HD] = { + .name = Terratec Cinergy T2 Stick HD, + .def_i2c_bus = 1, + .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ, + .tuner_type= TUNER_ABSENT, + .tuner_gpio= terratec_t2_stick_hd, + .has_dvb = 1, + .ir_codes = RC_MAP_TERRATEC_SLIM_2, + }, }; EXPORT_SYMBOL_GPL(em28xx_boards); @@ -2424,6 +2449,8 @@ struct usb_device_id em28xx_id_table[] = { .driver_info = EM28178_BOARD_PCTV_461E }, { USB_DEVICE(0x2013, 0x025f), .driver_info = EM28178_BOARD_PCTV_292E }, + { USB_DEVICE(0xeb1a, 0x8179), + .driver_info = EM28178_BOARD_TERRATEC_T2_STICK_HD }, { }, }; MODULE_DEVICE_TABLE(usb, em28xx_id_table); diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index 65a456d..536815f 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -1603,6 +1603,64 @@ static int em28xx_dvb_init(struct em28xx *dev) dvb-fe[0]-ops.set_lna = em28xx_pctv_292e_set_lna; } break; + case EM28178_BOARD_TERRATEC_T2_STICK_HD: + { + struct i2c_adapter *adapter; + struct i2c_client *client; + struct i2c_board_info info; + struct si2168_config si2168_config; + struct si2157_config si2157_config; + + /* attach demod */ + si2168_config.i2c_adapter = adapter; + si2168_config.fe = dvb-fe[0]; + si2168_config.ts_mode = SI2168_TS_PARALLEL; + memset(info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, si2168, I2C_NAME_SIZE); + info.addr = 0x64; + info.platform_data = si2168_config; + request_module(info.type); + client = i2c_new_device(dev-i2c_adap[dev-def_i2c_bus], info); + if (client == NULL || client-dev.driver == NULL) { + result = -ENODEV; + goto out_free; + } + + if (!try_module_get(client-dev.driver-owner)) { + i2c_unregister_device(client); + result = -ENODEV; + goto out_free; + } + + dvb-i2c_client_demod = client; + + /* attach tuner */ + memset(si2157_config, 0, sizeof(si2157_config)); + si2157_config.fe = dvb-fe[0]; +
[PATCH 1/2] si2157: Add support for Si2146-A10
The Silicon Labs Si2146 tuner seems to work with the same driver as the Si2157, but there a few exceptions. The powerup command seems to be quite a bit different. In addition there's a property 0207 that requires a different value. Thus another entry is created in the si2157_id table to support also si2146 in this driver. The datasheet is available on manufacturer's website: http://www.silabs.com/support%20documents/technicaldocs/Si2146-short.pdf Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/tuners/si2157.c | 23 +++ drivers/media/tuners/si2157_priv.h | 5 + 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index b086b87..e867b28 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -93,8 +93,13 @@ static int si2157_init(struct dvb_frontend *fe) goto warm; /* power up */ - memcpy(cmd.args, \xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01, 15); - cmd.wlen = 15; + if (s-chiptype == SI2157_CHIPTYPE_SI2146) { + memcpy(cmd.args, \xc0\x05\x01\x00\x00\x0b\x00\x00\x01, 9); + cmd.wlen = 9; + } else { + memcpy(cmd.args, \xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01, 15); + cmd.wlen = 15; + } cmd.rlen = 1; ret = si2157_cmd_execute(s, cmd); if (ret) @@ -114,6 +119,7 @@ static int si2157_init(struct dvb_frontend *fe) #define SI2158_A20 ('A' 24 | 58 16 | '2' 8 | '0' 0) #define SI2157_A30 ('A' 24 | 57 16 | '3' 8 | '0' 0) #define SI2147_A30 ('A' 24 | 47 16 | '3' 8 | '0' 0) + #define SI2146_A10 ('A' 24 | 46 16 | '1' 8 | '0' 0) switch (chip_id) { case SI2158_A20: @@ -121,6 +127,7 @@ static int si2157_init(struct dvb_frontend *fe) break; case SI2157_A30: case SI2147_A30: + case SI2146_A10: goto skip_fw_download; break; default: @@ -275,7 +282,10 @@ static int si2157_set_params(struct dvb_frontend *fe) if (ret) goto err; - memcpy(cmd.args, \x14\x00\x02\x07\x01\x00, 6); + if (s-chiptype == SI2157_CHIPTYPE_SI2146) + memcpy(cmd.args, \x14\x00\x02\x07\x00\x01, 6); + else + memcpy(cmd.args, \x14\x00\x02\x07\x01\x00, 6); cmd.wlen = 6; cmd.rlen = 4; ret = si2157_cmd_execute(s, cmd); @@ -339,6 +349,7 @@ static int si2157_probe(struct i2c_client *client, s-fe = cfg-fe; s-inversion = cfg-inversion; s-fw_loaded = false; + s-chiptype = (u8)id-driver_data; mutex_init(s-i2c_mutex); /* check if the tuner is there */ @@ -355,7 +366,10 @@ static int si2157_probe(struct i2c_client *client, i2c_set_clientdata(client, s); dev_info(s-client-dev, - Silicon Labs Si2157/Si2158 successfully attached\n); + Silicon Labs %s successfully attached\n, + s-chiptype == SI2157_CHIPTYPE_SI2146 ? + Si2146 : Si2147/2157/2158); + return 0; err: dev_dbg(client-dev, failed=%d\n, ret); @@ -380,6 +394,7 @@ static int si2157_remove(struct i2c_client *client) static const struct i2c_device_id si2157_id[] = { {si2157, 0}, + {si2146, 1}, {} }; MODULE_DEVICE_TABLE(i2c, si2157_id); diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index e71ffaf..66ecf30 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h @@ -28,8 +28,13 @@ struct si2157 { bool active; bool fw_loaded; bool inversion; + u8 chiptype; }; +#define SI2157_CHIPTYPE_SI2157 0 +#define SI2157_CHIPTYPE_SI2146 1 + + /* firmare command struct */ #define SI2157_ARGLEN 30 struct si2157_cmd { -- 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: [PATCH 1/2] si2157: Add support for Si2146-A10
On 11/23/2014 10:17 PM, Olli Salonen wrote: The Silicon Labs Si2146 tuner seems to work with the same driver as the Si2157, but there a few exceptions. The powerup command seems to be quite a bit different. In addition there's a property 0207 that requires a different value. Thus another entry is created in the si2157_id table to support also si2146 in this driver. The datasheet is available on manufacturer's website: http://www.silabs.com/support%20documents/technicaldocs/Si2146-short.pdf Signed-off-by: Olli Salonen olli.salo...@iki.fi Acked-by: Antti Palosaari cr...@iki.fi Reviewed-by: Antti Palosaari cr...@iki.fi -- http://palosaari.fi/ -- 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] em28xx: Add support for Terratec Cinergy T2 Stick HD
On 11/23/2014 10:17 PM, Olli Salonen wrote: Terratec Cinergy T2 Stick HD [eb1a:8179] is a USB DVB-T/T2/C tuner that contains following components: * Empia EM28178 USB bridge * Silicon Labs Si2168-A30 demodulator * Silicon Labs Si2146-A10 tuner I don't have the remote, so the RC_MAP is a best guess based on the pictures of the remote controllers and other supported Terratec devices with a similar remote. Signed-off-by: Olli Salonen olli.salo...@iki.fi Reviewed-by: Antti Palosaari cr...@iki.fi Antti -- http://palosaari.fi/ -- 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] media: platform: add VPFE capture driver support for AM437X
From: Benoit Parrot bpar...@ti.com This patch adds Video Processing Front End (VPFE) driver for AM437X family of devices Driver supports the following: - V4L2 API using MMAP buffer access based on videobuf2 api - Asynchronous sensor/decoder sub device registration - DT support Signed-off-by: Benoit Parrot bpar...@ti.com Signed-off-by: Darren Etheridge detheri...@ti.com Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com --- .../devicetree/bindings/media/ti-am437xx-vpfe.txt | 61 + MAINTAINERS|9 + drivers/media/platform/Kconfig |1 + drivers/media/platform/Makefile|2 + drivers/media/platform/am437x/Kconfig | 10 + drivers/media/platform/am437x/Makefile |2 + drivers/media/platform/am437x/vpfe.c | 2764 drivers/media/platform/am437x/vpfe.h | 286 ++ drivers/media/platform/am437x/vpfe_regs.h | 140 + include/uapi/linux/Kbuild |1 + include/uapi/linux/am437x_vpfe.h | 122 + 11 files changed, 3398 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/ti-am437xx-vpfe.txt create mode 100644 drivers/media/platform/am437x/Kconfig create mode 100644 drivers/media/platform/am437x/Makefile create mode 100644 drivers/media/platform/am437x/vpfe.c create mode 100644 drivers/media/platform/am437x/vpfe.h create mode 100644 drivers/media/platform/am437x/vpfe_regs.h create mode 100644 include/uapi/linux/am437x_vpfe.h diff --git a/Documentation/devicetree/bindings/media/ti-am437xx-vpfe.txt b/Documentation/devicetree/bindings/media/ti-am437xx-vpfe.txt new file mode 100644 index 000..3932e76 --- /dev/null +++ b/Documentation/devicetree/bindings/media/ti-am437xx-vpfe.txt @@ -0,0 +1,61 @@ +Texas Instruments AM437x CAMERA (VPFE) +-- + +The Video Processing Front End (VPFE) is a key component for image capture +applications. The capture module provides the system interface and the +processing capability to connect RAW image-sensor modules and video decoders +to the AM437x device. + +Required properties: +- compatible: must be ti,am437x-vpfe +- reg: physical base address and length of the registers set for the device; +- interrupts: should contain IRQ line for the VPFE; +- ti,am437x-vpfe-interface: can be one of the following, + 0 - Raw Bayer Interface. + 1 - 8 Bit BT656 Interface. + 2 - 10 Bit BT656 Interface. + 3 - YCbCr 8 Bit Interface. + 4 - YCbCr 16 Bit Interface. + +VPFE supports a single port node with parallel bus. It should contain one +'port' child node with child 'endpoint' node. Please refer to the bindings +defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + +Example: + vpfe: vpfe@f0034000 { + compatible = ti,am437x-vpfe; + reg = 0x48328000 0x2000; + interrupts = GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH; + + pinctrl-names = default, sleep; + pinctrl-0 = vpfe_pins_default; + pinctrl-1 = vpfe_pins_sleep; + + port { + #address-cells = 1; + #size-cells = 0; + + vpfe0_ep: endpoint { + remote-endpoint = ov2659_1; + ti,am437x-vpfe-interface = 0; + bus-width = 8; + hsync-active = 0; + vsync-active = 0; + }; + }; + }; + + i2c1: i2c@4802a000 { + + ov2659@30 { + compatible = ti,ov2659; + reg = 0x30; + + port { + ov2659_1: endpoint { + remote-endpoint = vpfe0_ep; + bus-width = 8; + mclk-frequency = 1200; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index a6288ca..a42d367 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8537,6 +8537,15 @@ S: Maintained F: drivers/media/platform/davinci/ F: include/media/davinci/ +TI AM437X VPFE DRIVER +M: Lad, Prabhakar prabhakar.cse...@gmail.com +L: linux-media@vger.kernel.org +W: http://linuxtv.org/ +Q: http://patchwork.linuxtv.org/project/linux-media/list/ +T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git +S: Maintained +F: drivers/media/platform/am437x/ + SIS 190 ETHERNET DRIVER M: Francois Romieu rom...@fr.zoreil.com L: net...@vger.kernel.org diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 0c61155..6d94045 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -126,6
cron job: media_tree daily build: OK
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 Nov 24 04:00:17 CET 2014 git branch: test git hash: 5937a784c3e5fe8fd1e201f42a2b1ece6c36a6c0 gcc version:i686-linux-gcc (GCC) 4.9.1 sparse version: v0.5.0-35-gc1c3f96 smatch version: 0.4.1-3153-g7d56ab3 host hardware: x86_64 host os:3.17-3.slh.2-amd64 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: 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.32.27-i686: OK linux-2.6.33.7-i686: OK linux-2.6.34.7-i686: OK linux-2.6.35.9-i686: 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-i686: OK linux-3.17-i686: OK linux-3.18-rc1-i686: OK linux-2.6.32.27-x86_64: OK linux-2.6.33.7-x86_64: OK linux-2.6.34.7-x86_64: OK linux-2.6.35.9-x86_64: 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-x86_64: OK linux-3.17-x86_64: OK linux-3.18-rc1-x86_64: OK apps: OK spec-git: OK sparse: WARNINGS smatch: ERRORS 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
[PATCHv2 1/4] si2157: Add support for Si2146-A10
The Silicon Labs Si2146 tuner seems to work with the same driver as the Si2157, but there a few exceptions. The powerup command seems to be quite a bit different. In addition there's a property 0207 that requires a different value. Thus another entry is created in the si2157_id table to support also si2146 in this driver. The datasheet is available on manufacturer's website: http://www.silabs.com/support%20documents/technicaldocs/Si2146-short.pdf Patch v2 adds also updates the descriptions to contain the newly supported chip. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/tuners/si2157.c | 29 ++--- drivers/media/tuners/si2157.h | 2 +- drivers/media/tuners/si2157_priv.h | 8 ++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index b086b87..a8f2edb9 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2147/2157/2158 silicon tuner driver + * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari cr...@iki.fi * @@ -93,8 +93,13 @@ static int si2157_init(struct dvb_frontend *fe) goto warm; /* power up */ - memcpy(cmd.args, \xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01, 15); - cmd.wlen = 15; + if (s-chiptype == SI2157_CHIPTYPE_SI2146) { + memcpy(cmd.args, \xc0\x05\x01\x00\x00\x0b\x00\x00\x01, 9); + cmd.wlen = 9; + } else { + memcpy(cmd.args, \xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01, 15); + cmd.wlen = 15; + } cmd.rlen = 1; ret = si2157_cmd_execute(s, cmd); if (ret) @@ -114,6 +119,7 @@ static int si2157_init(struct dvb_frontend *fe) #define SI2158_A20 ('A' 24 | 58 16 | '2' 8 | '0' 0) #define SI2157_A30 ('A' 24 | 57 16 | '3' 8 | '0' 0) #define SI2147_A30 ('A' 24 | 47 16 | '3' 8 | '0' 0) + #define SI2146_A10 ('A' 24 | 46 16 | '1' 8 | '0' 0) switch (chip_id) { case SI2158_A20: @@ -121,6 +127,7 @@ static int si2157_init(struct dvb_frontend *fe) break; case SI2157_A30: case SI2147_A30: + case SI2146_A10: goto skip_fw_download; break; default: @@ -275,7 +282,10 @@ static int si2157_set_params(struct dvb_frontend *fe) if (ret) goto err; - memcpy(cmd.args, \x14\x00\x02\x07\x01\x00, 6); + if (s-chiptype == SI2157_CHIPTYPE_SI2146) + memcpy(cmd.args, \x14\x00\x02\x07\x00\x01, 6); + else + memcpy(cmd.args, \x14\x00\x02\x07\x01\x00, 6); cmd.wlen = 6; cmd.rlen = 4; ret = si2157_cmd_execute(s, cmd); @@ -308,7 +318,7 @@ static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) static const struct dvb_tuner_ops si2157_ops = { .info = { - .name = Silicon Labs Si2157/Si2158, + .name = Silicon Labs Si2146/2147/2157/2158, .frequency_min = 11000, .frequency_max = 86200, }, @@ -339,6 +349,7 @@ static int si2157_probe(struct i2c_client *client, s-fe = cfg-fe; s-inversion = cfg-inversion; s-fw_loaded = false; + s-chiptype = (u8)id-driver_data; mutex_init(s-i2c_mutex); /* check if the tuner is there */ @@ -355,7 +366,10 @@ static int si2157_probe(struct i2c_client *client, i2c_set_clientdata(client, s); dev_info(s-client-dev, - Silicon Labs Si2157/Si2158 successfully attached\n); + Silicon Labs %s successfully attached\n, + s-chiptype == SI2157_CHIPTYPE_SI2146 ? + Si2146 : Si2147/2157/2158); + return 0; err: dev_dbg(client-dev, failed=%d\n, ret); @@ -380,6 +394,7 @@ static int si2157_remove(struct i2c_client *client) static const struct i2c_device_id si2157_id[] = { {si2157, 0}, + {si2146, 1}, {} }; MODULE_DEVICE_TABLE(i2c, si2157_id); @@ -396,7 +411,7 @@ static struct i2c_driver si2157_driver = { module_i2c_driver(si2157_driver); -MODULE_DESCRIPTION(Silicon Labs Si2157/Si2158 silicon tuner driver); +MODULE_DESCRIPTION(Silicon Labs Si2146/2147/2157/2158 silicon tuner driver); MODULE_AUTHOR(Antti Palosaari cr...@iki.fi); MODULE_LICENSE(GPL); MODULE_FIRMWARE(SI2158_A20_FIRMWARE); diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h index d3b19ca..8467d08 100644 --- a/drivers/media/tuners/si2157.h +++ b/drivers/media/tuners/si2157.h @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2147/2157/2158 silicon tuner driver + * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari cr...@iki.fi * diff --git
[PATCHv2 2/4] em28xx: Add support for Terratec Cinergy T2 Stick HD
Terratec Cinergy T2 Stick HD [eb1a:8179] is a USB DVB-T/T2/C tuner that contains following components: * Empia EM28178 USB bridge * Silicon Labs Si2168-A30 demodulator * Silicon Labs Si2146-A10 tuner I don't have the remote, so the RC_MAP is a best guess based on the pictures of the remote controllers and other supported Terratec devices with a similar remote. Patch v2 initializes struct si2168_config with zeroes. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/usb/em28xx/em28xx-cards.c | 27 +++ drivers/media/usb/em28xx/em28xx-dvb.c | 59 + drivers/media/usb/em28xx/em28xx.h | 1 + 3 files changed, 87 insertions(+) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 71fa51e..382018d 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -479,6 +479,20 @@ static struct em28xx_reg_seq pctv_292e[] = { {-1, -1, -1, -1}, }; +static struct em28xx_reg_seq terratec_t2_stick_hd[] = { + {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0}, + {0x0d, 0xff, 0xff, 600}, + {EM2874_R80_GPIO_P0_CTRL, 0xfc, 0xff, 10}, + {EM2874_R80_GPIO_P0_CTRL, 0xbc, 0xff, 100}, + {EM2874_R80_GPIO_P0_CTRL, 0xfc, 0xff, 100}, + {EM2874_R80_GPIO_P0_CTRL, 0x00, 0xff, 300}, + {EM2874_R80_GPIO_P0_CTRL, 0xf8, 0xff, 100}, + {EM2874_R80_GPIO_P0_CTRL, 0xfc, 0xff, 300}, + {0x0d, 0x42, 0xff, 1000}, + {EM2874_R5F_TS_ENABLE, 0x85, 0xff, 0}, + {-1, -1, -1, -1}, +}; + /* * Button definitions */ @@ -2243,6 +2257,17 @@ struct em28xx_board em28xx_boards[] = { .has_dvb = 1, .ir_codes = RC_MAP_PINNACLE_PCTV_HD, }, + /* eb1a:8179 Terratec Cinergy T2 Stick HD. +* Empia EM28178, Silicon Labs Si2168, Silicon Labs Si2146 */ + [EM28178_BOARD_TERRATEC_T2_STICK_HD] = { + .name = Terratec Cinergy T2 Stick HD, + .def_i2c_bus = 1, + .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ, + .tuner_type= TUNER_ABSENT, + .tuner_gpio= terratec_t2_stick_hd, + .has_dvb = 1, + .ir_codes = RC_MAP_TERRATEC_SLIM_2, + }, }; EXPORT_SYMBOL_GPL(em28xx_boards); @@ -2424,6 +2449,8 @@ struct usb_device_id em28xx_id_table[] = { .driver_info = EM28178_BOARD_PCTV_461E }, { USB_DEVICE(0x2013, 0x025f), .driver_info = EM28178_BOARD_PCTV_292E }, + { USB_DEVICE(0xeb1a, 0x8179), + .driver_info = EM28178_BOARD_TERRATEC_T2_STICK_HD }, { }, }; MODULE_DEVICE_TABLE(usb, em28xx_id_table); diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index 65a456d..bd12f4c 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -1603,6 +1603,65 @@ static int em28xx_dvb_init(struct em28xx *dev) dvb-fe[0]-ops.set_lna = em28xx_pctv_292e_set_lna; } break; + case EM28178_BOARD_TERRATEC_T2_STICK_HD: + { + struct i2c_adapter *adapter; + struct i2c_client *client; + struct i2c_board_info info; + struct si2168_config si2168_config; + struct si2157_config si2157_config; + + /* attach demod */ + memset(si2168_config, 0, sizeof(si2168_config)); + si2168_config.i2c_adapter = adapter; + si2168_config.fe = dvb-fe[0]; + si2168_config.ts_mode = SI2168_TS_PARALLEL; + memset(info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, si2168, I2C_NAME_SIZE); + info.addr = 0x64; + info.platform_data = si2168_config; + request_module(info.type); + client = i2c_new_device(dev-i2c_adap[dev-def_i2c_bus], info); + if (client == NULL || client-dev.driver == NULL) { + result = -ENODEV; + goto out_free; + } + + if (!try_module_get(client-dev.driver-owner)) { + i2c_unregister_device(client); + result = -ENODEV; + goto out_free; + } + + dvb-i2c_client_demod = client; + + /* attach tuner */ +
[PATCH 3/4] si2157: make checkpatch.pl happy (remove break after goto)
Break after goto is unnecessary. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/tuners/si2157.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index a8f2edb9..3bdf00a 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -129,7 +129,6 @@ static int si2157_init(struct dvb_frontend *fe) case SI2147_A30: case SI2146_A10: goto skip_fw_download; - break; default: dev_err(s-client-dev, unknown chip version Si21%d-%c%c%c\n, -- 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
[PATCH 4/4] si2157: Add support for Si2148-A20
The Silicon Labs Si2148 tuner works as the Si2158, but does not contain analog tuner. A firmware is required for the tuner. Currently the Si2158-A20 firmware will work for Si2148-A20 as well, but as there are no guarantees that that will be the case in future, a unique file name is used for the firmware. The datasheet is available on manufacturer's website: http://www.silabs.com/Support%20Documents/TechnicalDocs/Si2148-short.pdf Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/tuners/si2157.c | 13 + drivers/media/tuners/si2157.h | 2 +- drivers/media/tuners/si2157_priv.h | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index 3bdf00a..e6d7f35 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver + * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari cr...@iki.fi * @@ -118,6 +118,7 @@ static int si2157_init(struct dvb_frontend *fe) #define SI2158_A20 ('A' 24 | 58 16 | '2' 8 | '0' 0) #define SI2157_A30 ('A' 24 | 57 16 | '3' 8 | '0' 0) + #define SI2148_A20 ('A' 24 | 48 16 | '2' 8 | '0' 0) #define SI2147_A30 ('A' 24 | 47 16 | '3' 8 | '0' 0) #define SI2146_A10 ('A' 24 | 46 16 | '1' 8 | '0' 0) @@ -125,6 +126,9 @@ static int si2157_init(struct dvb_frontend *fe) case SI2158_A20: fw_file = SI2158_A20_FIRMWARE; break; + case SI2148_A20: + fw_file = SI2148_A20_FIRMWARE; + break; case SI2157_A30: case SI2147_A30: case SI2146_A10: @@ -317,7 +321,7 @@ static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) static const struct dvb_tuner_ops si2157_ops = { .info = { - .name = Silicon Labs Si2146/2147/2157/2158, + .name = Silicon Labs Si2146/2147/2148/2157/2158, .frequency_min = 11000, .frequency_max = 86200, }, @@ -367,7 +371,7 @@ static int si2157_probe(struct i2c_client *client, dev_info(s-client-dev, Silicon Labs %s successfully attached\n, s-chiptype == SI2157_CHIPTYPE_SI2146 ? - Si2146 : Si2147/2157/2158); + Si2146 : Si2147/2148/2157/2158); return 0; err: @@ -410,7 +414,8 @@ static struct i2c_driver si2157_driver = { module_i2c_driver(si2157_driver); -MODULE_DESCRIPTION(Silicon Labs Si2146/2147/2157/2158 silicon tuner driver); +MODULE_DESCRIPTION(Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver); MODULE_AUTHOR(Antti Palosaari cr...@iki.fi); MODULE_LICENSE(GPL); +MODULE_FIRMWARE(SI2148_A20_FIRMWARE); MODULE_FIRMWARE(SI2158_A20_FIRMWARE); diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h index 8467d08..a564c4a 100644 --- a/drivers/media/tuners/si2157.h +++ b/drivers/media/tuners/si2157.h @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver + * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari cr...@iki.fi * diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index c1ea821..65874e0 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver + * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari cr...@iki.fi * @@ -42,6 +42,7 @@ struct si2157_cmd { unsigned rlen; }; +#define SI2148_A20_FIRMWARE dvb-tuner-si2148-a20-01.fw #define SI2158_A20_FIRMWARE dvb-tuner-si2158-a20-01.fw #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
RE: [PATCH v2 1/4] media: ti-vpe: Use data offset for getting dma_addr for a plane
-Original Message- From: Hans Verkuil [mailto:hverk...@xs4all.nl] Sent: Sunday, November 23, 2014 6:23 PM To: Devshatwar, Nikhil; linux-media@vger.kernel.org Subject: Re: [PATCH v2 1/4] media: ti-vpe: Use data offset for getting dma_addr for a plane On 11/14/2014 12:20 PM, Nikhil Devshatwar wrote: The data_offset in v4l2_planes structure will help us point to the start of data content for that particular plane. This may be useful when a single buffer contains the data for different planes e.g. Y planes of two fields in the same buffer. With this, user space can pass queue top field and bottom field with same dmafd and different data_offsets. Signed-off-by: Nikhil Devshatwar nikhil...@ti.com --- drivers/media/platform/ti-vpe/vpe.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index 0ae19ee..e59eb81 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -495,6 +495,14 @@ struct vpe_mmr_adb { #define VPE_SET_MMR_ADB_HDR(ctx, hdr, regs, offset_a) \ VPDMA_SET_MMR_ADB_HDR(ctx-mmr_adb, vpe_mmr_adb, hdr, regs, offset_a) + +static inline dma_addr_t vb2_dma_addr_plus_data_offset(struct vb2_buffer *vb, + unsigned int plane_no) +{ + return vb2_dma_contig_plane_dma_addr(vb, plane_no) + + vb-v4l2_planes[plane_no].data_offset; +} + /* * Set the headers for all of the address/data block structures. */ @@ -1002,7 +1010,7 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) int plane = fmt-coplanar ? p_data-vb_part : 0; vpdma_fmt = fmt-vpdma_fmt[plane]; - dma_addr = vb2_dma_contig_plane_dma_addr(vb, plane); + dma_addr = vb2_dma_addr_plus_data_offset(vb, plane); if (!dma_addr) { vpe_err(ctx-dev, acquiring output buffer(%d) dma_addr failed\n, @@ -1042,7 +1050,7 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port) vpdma_fmt = fmt-vpdma_fmt[plane]; - dma_addr = vb2_dma_contig_plane_dma_addr(vb, plane); + dma_addr = vb2_dma_addr_plus_data_offset(vb, plane); if (!dma_addr) { vpe_err(ctx-dev, acquiring input buffer(%d) dma_addr failed\n, I suspect this does not do what you want. data_offset is set by the application for an output stream (i.e. from memory to the hardware) and it is set by the driver for a capture stream (i.e. from hardware to memory). It looks like you expect that it is set by the application for capture streams as well, but that's not true. Yes, I agree I should use the new function (with data_offset) only in the add_in_dtd add_in_dtd is called for the OUTPUT streams only (And some internal buffers) Regards, Hans -- 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