Re: Regression at gspca core affecting SXGA mode on sn9c201 driver
Hi, On 12/07/2010 09:01 PM, Mauro Carvalho Chehab wrote: Hi Jean-Fronçois, git commit 35680baa6822df98a6ed602e2380aa0a04e18b07 (see enclosed) caused not only a regression at PS/3 Eye webcam (git commit f43402fa55bf5e7e190c176343015122f694857c), but also at sn9c201 driver, when used on SXGA mode. What happens is that only the highest alternate mode is enough for the maximum resolution. I suspect that other drivers broke due to that change. So, IMO, the better is to revert and work on another alternative. I have to agree with Mauro here, dropping back to a lower alt setting for all devices with a usb audio interface is the wrong thing to do. For example I know multiple devices where the highest alt setting does not have a wMaxPacketSize of 1023, but use something lower instead, to make sure there is enough bandwidth left for usb audio even if the highest alt setting get used. Btw, no matter what resolution is used, sn9c201 is setting the same alternate for all modes, spending more USB bandwidth than needed. Why gspca is just getting the highest value for wMaxPacketSize? It should, instead, seek for the minimum packet size that is needed for a given resolution. There are 2 reasons for this: 1) We do not know the minimum packetsize for a given resolution, unlike with uvc where this is arranged in the protocol, for proprietary apps we can only guess 2) Almost all devices supported by gspca are usb-1.1 and thus the framerate is bandwidth limited. We want to deliver the highest framerate possible, and thus get as high an alt setting as possible. I most note that many gspca subdrivers are defective wrt how this is all handled though, in that they don't vary the framerate when the available bandwidth changes. So in many cases if the gspca core cannot get the highest alt setting things may not function at all (because the subdriver fails to select a lower framerate, resulting in parts of frames getting dropped due to bandwidth limitations). Fixing this requires: 1) Figuring out how to change the framerate for each sensor + bridge combo 2) Testing to see what framerate will still work at which alt setting 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
RE: [PATCH 8/8] v4l: videobuf2: add CMA allocator
Hello Marek Szyprowski Wrote: Sent: Monday, December 06, 2010 7:53 PM To: linux-media@vger.kernel.org Cc: m.szyprow...@samsung.com; pa...@osciak.com; kyungmin.p...@samsung.com; andrze...@samsung.com Subject: [PATCH 8/8] v4l: videobuf2: add CMA allocator snip +struct vb2_cma_buf { + struct vb2_cma_conf *conf; + dma_addr_t paddr; + unsigned long size; + struct vm_area_struct *vma; + atomic_trefcount; + struct vb2_vmarea_handler handler; +}; + +static void vb2_cma_put(void *buf_priv); + +static void *vb2_cma_alloc(void *alloc_ctx, unsigned long size) +{ + struct vb2_cma_conf *conf = alloc_ctx; I wonder that how to acquire vb2_cma_cont value without container_of() or explicit type conversion? Does not conversion from alloc_ctx type to vb2_cma_conf type when caller is called. + struct vb2_cma_buf *buf; + + buf = kzalloc(sizeof *buf, GFP_KERNEL); + if (!buf) + return ERR_PTR(-ENOMEM); + + buf-paddr = cma_alloc(conf-dev, conf-type, size, conf- alignment); + if (IS_ERR((void *)buf-paddr)) { + printk(KERN_ERR cma_alloc of size %ld failed\n, size); + kfree(buf); + return ERR_PTR(-ENOMEM); + } + + buf-conf = conf; + buf-size = size; + + buf-handler.refcount = buf-refcount; + buf-handler.put = vb2_cma_put; + buf-handler.arg = buf; + + atomic_inc(buf-refcount); + + return buf; +} + snip +struct vb2_alloc_ctx *vb2_cma_init(struct device *dev, const char *type, + unsigned long alignment); +void vb2_cma_cleanup(struct vb2_alloc_ctx *alloc_ctx); + +struct vb2_alloc_ctx **vb2_cma_init_multi(struct device *dev, + unsigned int num_planes, const char *types[], + unsigned long alignments[]); +void vb2_cma_cleanup_multi(struct vb2_alloc_ctx **alloc_ctxes); + +struct vb2_alloc_ctx *vb2_cma_init(struct device *dev, const char *type, + unsigned long alignment); This function already exist. +void vb2_cma_cleanup(struct vb2_alloc_ctx *alloc_ctx); Same + +extern const struct vb2_mem_ops vb2_cma_memops; + +#endif -- 1.7.1.569.g6f426 -- 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 v3 0/2] OmniVision OV9640 sensor driver cleanup and fix
Hi, These patches apply some cleanups and fix OV9640 driver's priv data retrieving on I2C remove and video_probe functions. I included in this new version one missing fix pointed out by Guennadi Liakhovetski. Despite the patches are simple, they haven't been tested yet due to lack of hw. These patches are intended to 2.6.38. Br, David Cohen --- David Cohen (2): ov9640: use macro to request OmniVision OV9640 sensor private data ov9640: fix OmniVision OV9640 sensor driver's priv data retrieving drivers/media/video/ov9640.c | 19 +-- 1 files changed, 9 insertions(+), 10 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 v3 1/2] ov9640: use macro to request OmniVision OV9640 sensor private data
This cleanup patch creates macro to request OmniVision OV9640 private data, which increases readability. Signed-off-by: David Cohen daco...@gmail.com --- drivers/media/video/ov9640.c | 13 + 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c index 99e9e1d..c6d8e8a 100644 --- a/drivers/media/video/ov9640.c +++ b/drivers/media/video/ov9640.c @@ -31,6 +31,8 @@ #include ov9640.h +#define to_ov9640_sensor(sd) container_of(sd, struct ov9640_priv, subdev) + /* default register setup */ static const struct ov9640_reg ov9640_regs_dflt[] = { { OV9640_COM5, OV9640_COM5_SYSCLK | OV9640_COM5_LONGEXP }, @@ -308,9 +310,7 @@ static unsigned long ov9640_query_bus_param(struct soc_camera_device *icd) /* Get status of additional camera capabilities */ static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov9640_priv *priv = container_of(i2c_get_clientdata(client), - struct ov9640_priv, subdev); + struct ov9640_priv *priv = to_ov9640_sensor(sd); switch (ctrl-id) { case V4L2_CID_VFLIP: @@ -327,8 +327,7 @@ static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) static int ov9640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov9640_priv *priv = container_of(i2c_get_clientdata(client), - struct ov9640_priv, subdev); + struct ov9640_priv *priv = to_ov9640_sensor(sd); int ret = 0; @@ -360,9 +359,7 @@ static int ov9640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) static int ov9640_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov9640_priv *priv = container_of(i2c_get_clientdata(client), - struct ov9640_priv, subdev); + struct ov9640_priv *priv = to_ov9640_sensor(sd); id-ident = priv-model; id-revision= priv-revision; -- 1.7.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 v3 2/2] ov9640: fix OmniVision OV9640 sensor driver's priv data retrieving
OmniVision OV9640 driver wasn't requesting properly its private data on I2C remove and video_probe functions. It was retrieving the V4L2 subdev struct address instead of priv struct's one. This patch fixes such problem. Signed-off-by: David Cohen daco...@gmail.com --- drivers/media/video/ov9640.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c index c6d8e8a..53d88a2 100644 --- a/drivers/media/video/ov9640.c +++ b/drivers/media/video/ov9640.c @@ -651,7 +651,8 @@ static int ov9640_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) static int ov9640_video_probe(struct soc_camera_device *icd, struct i2c_client *client) { - struct ov9640_priv *priv = i2c_get_clientdata(client); + struct v4l2_subdev *sd = i2c_get_clientdata(client); + struct ov9640_priv *priv = to_ov9640_sensor(sd); u8 pid, ver, midh, midl; const char *devname; int ret = 0; @@ -788,7 +789,8 @@ static int ov9640_probe(struct i2c_client *client, static int ov9640_remove(struct i2c_client *client) { - struct ov9640_priv *priv = i2c_get_clientdata(client); + struct v4l2_subdev *sd = i2c_get_clientdata(client); + struct ov9640_priv *priv = to_ov9640_sensor(sd); kfree(priv); return 0; -- 1.7.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: Regression at gspca core affecting SXGA mode on sn9c201 driver
Hi, On 12/08/2010 01:54 PM, Mauro Carvalho Chehab wrote: Em 08-12-2010 08:01, Hans de Goede escreveu: Hi, On 12/07/2010 09:01 PM, Mauro Carvalho Chehab wrote: Hi Jean-Fronçois, git commit 35680baa6822df98a6ed602e2380aa0a04e18b07 (see enclosed) caused not only a regression at PS/3 Eye webcam (git commit f43402fa55bf5e7e190c176343015122f694857c), but also at sn9c201 driver, when used on SXGA mode. What happens is that only the highest alternate mode is enough for the maximum resolution. I suspect that other drivers broke due to that change. So, IMO, the better is to revert and work on another alternative. I have to agree with Mauro here, dropping back to a lower alt setting for all devices with a usb audio interface is the wrong thing to do. Btw, I tested here with other hardware. It completely broke stv06xx driver for devices with audio (046d:08f6 Logitech, Inc. QuickCam Messenger Plus), as there's just one alternate config: gspca: no transfer endpoint found My proposal, for now, is to just revert the logic, enabling the hack only in the specific case where doing alt-1 work (see enclosed patch). I tested the enclosed patch and it fixed for PS/3, Quickcam and Gigaware (the 3 cams where I noticed the breakage). Hmm, looking at your patch I notice that the current patch is completely wrong. Not only does it lower the endpoint to use wrongly in many cases, it also does the lowering *each* time we try to start streaming, so if we have a cam with alt settings 0 - 8 and there is not enough bandwidth we used to try: 8, 7, 6, ... and now we will try 7, 5, 3, ... Notice the skipping of an alt setting each time. Before this broken, should be reverted, patch in some cases we used to lower the nbalt setting in some subdrivers where the highest alt setting causes issues for audio, which would result in trying 7, 6, 5 ... in the example, iow work as intended where as 7, 5, 3, ... clearly is not work as intended. Of course, it will break the specific model(s) where the audio hack work, so we need to do: gspca_dev-audio_hack = 1; On the specific model(s) tested with the hack. For example I know multiple devices where the highest alt setting does not have a wMaxPacketSize of 1023, but use something lower instead, to make sure there is enough bandwidth left for usb audio even if the highest alt setting get used. Btw, no matter what resolution is used, sn9c201 is setting the same alternate for all modes, spending more USB bandwidth than needed. Why gspca is just getting the highest value for wMaxPacketSize? It should, instead, seek for the minimum packet size that is needed for a given resolution. There are 2 reasons for this: 1) We do not know the minimum packetsize for a given resolution, unlike with uvc where this is arranged in the protocol, for proprietary apps we can only guess Ok, but, during the driver development, someone could test it. Right, but many of the drivers come from other sources (old v4l1 drivers) and often we only have one model of many supported models when porting these drivers to the new gspca framework. 2) Almost all devices supported by gspca are usb-1.1 and thus the framerate is bandwidth limited. We want to deliver the highest framerate possible, and thus get as high an alt setting as possible. This is a bogus argument. Core shouldn't assume that all devices are usb 1.1. You're right about the should not assume part, but that does not make this a bogus argument usb-1.1 webcams are bandwidth limited in their framerate, people don't like low framerates so clearly trying to get the highest alt setting and thus allow for the highest framerate is the right thing to do for 1.1 cameras. In the specific case of sn9c20x, it has 8 alternates. This probably means that all those alternates could be used, depending on the bandwidth requirements. At the maximum packet size (alt 8) means to spend 60% of the USB 2.0 traffic for isoc, being required for SXGA. Alt 7 spends 36% and it is enough for VGA resolution. If someone wants to have 2 webcams at VGA resolution, wasting bandwith using alt8 would prevent it, as core don't provide 120% bandwidth ;) I agree that the highest setting should not be used when not needed. The alternate selection should be based on the desired resolution. It is a function of the imagesize, the frame rate, and the line width. On em28xx, we've made a function that estimates the needed alternate. This works pretty well. When the framerate is a fixed number this works well, but it is not a fixed number with webcams. More over some 1.1 webcams use dynamic compression algorithms where the bridge changes the compression quality setting based on available bandwidth. So here we may be able to do the same framerate at a lower alt setting, but this will result in a lower quality picture. I most note that many gspca subdrivers are defective wrt how this is all handled though, in
[PATCH] libv4l: Add support for 8-bits grey format (V4L2_PIX_FMT_GREY)
Grey format is like YUV, with U/V channels with 0. Add the corresponding bits to libv4l, for it to handle this format. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h index 61a8c39..2680ed7 100644 --- a/lib/libv4lconvert/libv4lconvert-priv.h +++ b/lib/libv4lconvert/libv4lconvert-priv.h @@ -127,6 +127,15 @@ void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst, void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst, const struct v4l2_format *src_fmt); +void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, + int width, int height); + +void v4lconvert_grey_to_yuv420(const unsigned char *src, unsigned char *dest, +const struct v4l2_format *src_fmt); + +void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, + int width, int height); + void v4lconvert_rgb565_to_rgb24(const unsigned char *src, unsigned char *dest, int width, int height); diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c index f08996a..26a0978 100644 --- a/lib/libv4lconvert/libv4lconvert.c +++ b/lib/libv4lconvert/libv4lconvert.c @@ -43,6 +43,7 @@ static void v4lconvert_get_framesizes(struct v4lconvert_data *data, v4lconvert_try_format for low resolutions */ static const struct v4lconvert_pixfmt supported_src_pixfmts[] = { SUPPORTED_DST_PIXFMTS, + { V4L2_PIX_FMT_GREY, 0 }, { V4L2_PIX_FMT_YUYV, 0 }, { V4L2_PIX_FMT_YVYU, 0 }, { V4L2_PIX_FMT_UYVY, 0 }, @@ -839,6 +840,23 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, } break; + case V4L2_PIX_FMT_GREY: + switch (dest_pix_fmt) { + case V4L2_PIX_FMT_RGB24: + case V4L2_PIX_FMT_BGR24: + v4lconvert_grey_to_rgb24(src, dest, width, height); + break; + case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_YVU420: + v4lconvert_grey_to_yuv420(src, dest, fmt); + break; + } + if (src_size (width * height)) { + V4LCONVERT_ERR(short grey data frame\n); + errno = EPIPE; + result = -1; + } + break; case V4L2_PIX_FMT_RGB565: switch (dest_pix_fmt) { case V4L2_PIX_FMT_RGB24: diff --git a/lib/libv4lconvert/rgbyuv.c b/lib/libv4lconvert/rgbyuv.c index f205b39..c3b6235 100644 --- a/lib/libv4lconvert/rgbyuv.c +++ b/lib/libv4lconvert/rgbyuv.c @@ -575,3 +575,31 @@ void v4lconvert_rgb565_to_yuv420(const unsigned char *src, unsigned char *dest, src += 2 * src_fmt-fmt.pix.bytesperline - 2 * src_fmt-fmt.pix.width; } } + +void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, + int width, int height) +{ + int j; + while (--height = 0) { + for (j = 0; j width; j++) { + *dest++ = *src; + *dest++ = *src; + *dest++ = *src; + src++; + } + } +} + +void v4lconvert_grey_to_yuv420(const unsigned char *src, unsigned char *dest, + const struct v4l2_format *src_fmt) +{ + int x, y; + + /* Y */ + for (y = 0; y src_fmt-fmt.pix.height; y++) + for (x = 0; x src_fmt-fmt.pix.width; x++) + *dest++ = *src++; + + /* Clear U/V */ + memset(dest, 0, src_fmt-fmt.pix.width * src_fmt-fmt.pix.height / 2); +} -- 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] gspca/sn9c20x: Fix support for mt9m001 (mi1300) sensor
Support for mt9m001 (mi1300) is broken: - Table is incomplete; - Only low-res resolutions are currently supported by the driver; - it complains about broken JPEG headers, as image capture window is wrong. Use the same init found on em28xx driver, and properly report the output format as 8-bits GRAY. Also, check for sensor ID, in order to be sure that the device has a mi1300 sensor. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index e812598..cb08d00 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c @@ -452,6 +452,29 @@ static const struct v4l2_pix_format sxga_mode[] = { .priv = SCALE_1280x1024 | MODE_RAW | MODE_SXGA}, }; +static const struct v4l2_pix_format mono_mode[] = { + {160, 120, V4L2_PIX_FMT_GREY, V4L2_FIELD_NONE, + .bytesperline = 160, + .sizeimage = 160 * 120, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = SCALE_160x120 | MODE_RAW}, + {320, 240, V4L2_PIX_FMT_GREY, V4L2_FIELD_NONE, + .bytesperline = 320, + .sizeimage = 320 * 240 , + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = SCALE_320x240 | MODE_RAW}, + {640, 480, V4L2_PIX_FMT_GREY, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = SCALE_640x480 | MODE_RAW}, + {1280, 1024, V4L2_PIX_FMT_GREY, V4L2_FIELD_NONE, + .bytesperline = 1280, + .sizeimage = 1280 * 1024, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = SCALE_1280x1024 | MODE_RAW | MODE_SXGA}, +}; + static const s16 hsv_red_x[] = { 41, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, @@ -1037,16 +1060,19 @@ static struct i2c_reg_u16 mt9v011_init[] = { }; static struct i2c_reg_u16 mt9m001_init[] = { - {0x0d, 0x0001}, {0x0d, 0x}, {0x01, 0x000e}, - {0x02, 0x0014}, {0x03, 0x03c1}, {0x04, 0x0501}, - {0x05, 0x0083}, {0x06, 0x0006}, {0x0d, 0x0002}, - {0x0a, 0x}, {0x0c, 0x}, {0x11, 0x}, - {0x1e, 0x8000}, {0x5f, 0x8904}, {0x60, 0x}, - {0x61, 0x}, {0x62, 0x0498}, {0x63, 0x}, - {0x64, 0x}, {0x20, 0x111d}, {0x06, 0x00f2}, - {0x05, 0x0013}, {0x09, 0x10f2}, {0x07, 0x0003}, - {0x2b, 0x002a}, {0x2d, 0x002a}, {0x2c, 0x002a}, - {0x2e, 0x0029}, {0x07, 0x0002}, + {0x0d, 0x0001}, + {0x0d, 0x}, + {0x04, 0x0500}, /* hres = 1280 */ + {0x03, 0x0400}, /* vres = 1024 */ + {0x20, 0x1100}, + {0x06, 0x0010}, + {0x2b, 0x0024}, + {0x2e, 0x0024}, + {0x35, 0x0024}, + {0x2d, 0x0020}, + {0x2c, 0x0020}, + {0x09, 0x0ad4}, + {0x35, 0x0057}, }; static struct i2c_reg_u16 mt9m111_init[] = { @@ -1442,6 +1468,25 @@ static int mt9m001_init_sensor(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; int i; + u16 id; + + if (i2c_r2(gspca_dev, 0x00, id) 0) + return -EINVAL; + + /* must be 0x8411 or 0x8421 for colour sensor and 8431 for bw */ + switch (id) { + case 0x8411: + case 0x8421: + info(MT9M001 color sensor detected); + break; + case 0x8431: + info(MT9M001 mono sensor detected); + break; + default: + err(No MT9M001 chip detected, ID = %x\n, id); + return -ENODEV; + } + for (i = 0; i ARRAY_SIZE(mt9m001_init); i++) { if (i2c_w2(gspca_dev, mt9m001_init[i].reg, mt9m001_init[i].val) 0) { @@ -1451,8 +1496,8 @@ static int mt9m001_init_sensor(struct gspca_dev *gspca_dev) } /* disable hflip and vflip */ gspca_dev-ctrl_dis = (1 HFLIP_IDX) | (1 VFLIP_IDX); - sd-hstart = 2; - sd-vstart = 2; + sd-hstart = 1; + sd-vstart = 1; return 0; } @@ -1994,6 +2039,10 @@ static int sd_config(struct gspca_dev *gspca_dev, cam-cam_mode = sxga_mode; cam-nmodes = ARRAY_SIZE(sxga_mode); break; + case SENSOR_MT9M001: + cam-cam_mode = mono_mode; + cam-nmodes = ARRAY_SIZE(mono_mode); + break; default: cam-cam_mode = vga_mode; cam-nmodes = ARRAY_SIZE(vga_mode); @@ -2092,7 +2141,6 @@ static int sd_init(struct gspca_dev *gspca_dev) case SENSOR_MT9M001: if (mt9m001_init_sensor(gspca_dev) 0) return -ENODEV; - info(MT9M001 sensor detected); break; case SENSOR_HV7131R: if
RE: [PATCH 2/8] v4l: videobuf2: add generic memory handling routines
Hello, On Wednesday, December 08, 2010 8:02 AM Sewoon Park wrote: Hello~ There are a lot of code changes compared with version5 patch. Some minor comments below. Thanks for spotting old, outdated comments. I'm sorry that I forgot about them. I will update them asap. snip You mentioned that dma-sg and iommu allocators will definitely call get_user_pages(). There are dms-sg allocator in v6 patch. How to apply it? Please take a look at drivers/media/video/videobuf2-dma-sg.c and include/media/videobuf2-dma-sg.h In the header file there is a vb2_dma_sg_desc structure define. It should be used as the main interface between the allocator and the driver. A pointer to this structure is returned by vb2_dma_sg_plane_desc() inline function (which in turn calls plane_cookie()). This structure contains all the information that might be required to setup scatter-gather or iommu controller: the size of the memory region, number of pages and the array of the pages (see sglist entry and scatterlist structure). This dma-sg allocator supports both mmap and userptr access modes. If there is anything missing please let us know. Best regards -- Marek Szyprowski Samsung Poland RD Center -- 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
Accessing running dvb device
Hi I am trying to run multiple recordings on my dvb device (rtl2832). However when I try to access the frontend settings when a recording is active get_frontend returns nothing. This is using the Linux::DVB::DVBT module any suggestions -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][media] s5p-fimc : Need to modifiy input DMA burst count for FIMC performance.
Hi Hyunwoong, On 12/08/2010 08:12 AM, Hyunwoong Kim wrote: Hello, I am writing this mail to suggest one thing regarding FIMC H/W setting. You wrote the below code for setting S5P_MSCTRL_FRAME_COUNT as one. cfg |= (S5P_MSCTRL_FRAME_COUNT(1) | S5P_MSCTRL_INPUT_MEMORY); I think it’s better way to set the value of S5P_MSCTRL_FRAME_COUNT as 4. Because, this value means input DMA burst count. The default value of input DMA burst count in FIMC is 4. And I guess if the value of less than 4 is set as input DMA burst count, the performance of input DMA in FIMC will be lower. I want to know how about your opinions. I did a test with the input DMA burst value of 1 and 4 and didn't observe an improvement in the image processing time. I guess it could show up when the system bus is heavily loaded or with HD input image size or bigger. The datasheet is not too verbose about this parameter, I am also not sure if it has any impact on the input pixel size alignment. I'm considering making a patch changing input DMA burst count to the default value and I've also noticed that S5P_MSCTRL_FRAME_COUNT_MASK is 3 instead of 0xF. Thank you for review. Regards, -- Sylwester Nawrocki Samsung Poland RD Center -- 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] libv4l: Add support for 8-bits grey format (V4L2_PIX_FMT_GREY)
Hi, On 12/08/2010 03:14 PM, Mauro Carvalho Chehab wrote: Grey format is like YUV, with U/V channels with 0. Add the corresponding bits to libv4l, for it to handle this format. Signed-off-by: Mauro Carvalho Chehabmche...@redhat.com diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h index 61a8c39..2680ed7 100644 --- a/lib/libv4lconvert/libv4lconvert-priv.h +++ b/lib/libv4lconvert/libv4lconvert-priv.h @@ -127,6 +127,15 @@ void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst, void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst, const struct v4l2_format *src_fmt); +void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, + int width, int height); + +void v4lconvert_grey_to_yuv420(const unsigned char *src, unsigned char *dest, +const struct v4l2_format *src_fmt); + +void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, + int width, int height); + void v4lconvert_rgb565_to_rgb24(const unsigned char *src, unsigned char *dest, int width, int height); diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c index f08996a..26a0978 100644 --- a/lib/libv4lconvert/libv4lconvert.c +++ b/lib/libv4lconvert/libv4lconvert.c @@ -43,6 +43,7 @@ static void v4lconvert_get_framesizes(struct v4lconvert_data *data, v4lconvert_try_format for low resolutions */ static const struct v4lconvert_pixfmt supported_src_pixfmts[] = { SUPPORTED_DST_PIXFMTS, + { V4L2_PIX_FMT_GREY, 0 }, { V4L2_PIX_FMT_YUYV, 0 }, { V4L2_PIX_FMT_YVYU, 0 }, { V4L2_PIX_FMT_UYVY, 0 }, @@ -839,6 +840,23 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, } break; + case V4L2_PIX_FMT_GREY: + switch (dest_pix_fmt) { + case V4L2_PIX_FMT_RGB24: + case V4L2_PIX_FMT_BGR24: + v4lconvert_grey_to_rgb24(src, dest, width, height); + break; + case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_YVU420: + v4lconvert_grey_to_yuv420(src, dest, fmt); + break; + } + if (src_size (width * height)) { + V4LCONVERT_ERR(short grey data frame\n); + errno = EPIPE; + result = -1; + } + break; case V4L2_PIX_FMT_RGB565: switch (dest_pix_fmt) { case V4L2_PIX_FMT_RGB24: diff --git a/lib/libv4lconvert/rgbyuv.c b/lib/libv4lconvert/rgbyuv.c index f205b39..c3b6235 100644 --- a/lib/libv4lconvert/rgbyuv.c +++ b/lib/libv4lconvert/rgbyuv.c @@ -575,3 +575,31 @@ void v4lconvert_rgb565_to_yuv420(const unsigned char *src, unsigned char *dest, src += 2 * src_fmt-fmt.pix.bytesperline - 2 * src_fmt-fmt.pix.width; } } + +void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, + int width, int height) +{ + int j; + while (--height= 0) { + for (j = 0; j width; j++) { + *dest++ = *src; + *dest++ = *src; + *dest++ = *src; + src++; + } + } +} + +void v4lconvert_grey_to_yuv420(const unsigned char *src, unsigned char *dest, + const struct v4l2_format *src_fmt) +{ + int x, y; + + /* Y */ + for (y = 0; y src_fmt-fmt.pix.height; y++) + for (x = 0; x src_fmt-fmt.pix.width; x++) + *dest++ = *src++; + + /* Clear U/V */ + memset(dest, 0, src_fmt-fmt.pix.width * src_fmt-fmt.pix.height / 2); This is wrong the 0 value for U/V is 0x80 (U and V are signed, but not two's complement instead their range is up shifted by 0x80) Otherwise the patch looks good. 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
RE: [PATCH v3 2/6] davinci vpbe: VPBE display driver
Hans, Thanks for the comments. Only one comment from me. Rest everything I have taken care. Thanks and Regards, -Manju On Tue, Dec 07, 2010 at 02:13:45, Hans Verkuil wrote: Comments below... On Thursday, December 02, 2010 13:38:36 Manjunath Hadli wrote: This patch implements the coe functionality of the dislay driver, mainly controlling the VENC and other encoders, and acting as the one point interface for the man V4L2 driver.This implements the cre of each of the V4L2 IOCTLs. Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com --- drivers/media/video/davinci/vpbe.c | 847 include/media/davinci/vpbe.h | 186 2 files changed, 1033 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/davinci/vpbe.c create mode 100644 include/media/davinci/vpbe.h diff --git a/drivers/media/video/davinci/vpbe.c b/drivers/media/video/davinci/vpbe.c new file mode 100644 index 000..96c0eea --- /dev/null +++ b/drivers/media/video/davinci/vpbe.c @@ -0,0 +1,847 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA */ #include linux/kernel.h #include linux/init.h +#include linux/module.h #include linux/errno.h #include +linux/fs.h #include linux/string.h #include linux/wait.h +#include linux/time.h #include linux/platform_device.h #include +linux/io.h #include linux/slab.h #include linux/clk.h #include +linux/err.h + +#include media/v4l2-device.h +#include media/davinci/vpbe_types.h #include media/davinci/vpbe.h +#include media/davinci/vpss.h + + +#define VPBE_DEFAULT_OUTPUTComposite +#define VPBE_DEFAULT_MODE ntsc + +static char *def_output = VPBE_DEFAULT_OUTPUT; static char *def_mode += VPBE_DEFAULT_MODE; static struct osd_state *osd_device; static +struct venc_platform_data *venc_device; static int debug; + +module_param(def_output, charp, S_IRUGO); module_param(def_mode, +charp, S_IRUGO); module_param(debug, int, 0644); + +MODULE_PARM_DESC(def_output, vpbe output name (default:Composite)); +MODULE_PARM_DESC(ef_mode, vpbe output mode name (default:ntsc); +MODULE_PARM_DESC(debug, Debug level 0-1); + +MODULE_DESCRIPTION(TI DMXXX VPBE Display controller); +MODULE_LICENSE(GPL); MODULE_AUTHOR(Texas Instruments); + +/** + * vpbe_current_encoder_info - Get config info for current encoder + * @vpbe_dev - vpbe device ptr + * + * Return ptr to current encoder config info */ static struct +encoder_config_info* vpbe_current_encoder_info(struct vpbe_device +*vpbe_dev) { + struct vpbe_display_config *vpbe_config = vpbe_dev-cfg; + int index = vpbe_dev-current_sd_index; + return ((index == 0) ? vpbe_config-venc : + vpbe_config-ext_encoders[index-1]); +} + +/** + * vpbe_find_encoder_sd_index - Given a name find encoder sd index + * + * @vpbe_config - ptr to vpbe cfg + * @output_index - index used by application + * + * Return sd index of the encoder + */ +static int vpbe_find_encoder_sd_index(struct vpbe_display_config *vpbe_config, +int index) +{ + char *encoder_name = vpbe_config-outputs[index].subdev_name; + int i; + + /* Venc is always first */ + if (!strcmp(encoder_name, vpbe_config-venc.module_name)) + return 0; + + for (i = 0; i vpbe_config-num_ext_encoders; i++) { + if (!strcmp(encoder_name, +vpbe_config-ext_encoders[i].module_name)) + return i+1; + } + return -EINVAL; +} + +/** + * vpbe_g_cropcap - Get crop capabilities of the display + * @vpbe_dev - vpbe device ptr + * @cropcap - cropcap is a ptr to struct v4l2_cropcap + * + * Update the crop capabilities in crop cap for current + * mode + */ +static int vpbe_g_cropcap(struct vpbe_device *vpbe_dev, + struct v4l2_cropcap *cropcap) +{ + if (NULL == cropcap) + return -EINVAL; + cropcap-bounds.left = 0; + cropcap-bounds.top = 0; + cropcap-bounds.width = vpbe_dev-current_timings.xres; + cropcap-bounds.height = vpbe_dev-current_timings.yres; +
Re: Regression at gspca core affecting SXGA mode on sn9c201 driver
Em 08-12-2010 12:11, Hans de Goede escreveu: Hi, On 12/08/2010 01:54 PM, Mauro Carvalho Chehab wrote: Em 08-12-2010 08:01, Hans de Goede escreveu: Hi, On 12/07/2010 09:01 PM, Mauro Carvalho Chehab wrote: Hi Jean-Fronçois, git commit 35680baa6822df98a6ed602e2380aa0a04e18b07 (see enclosed) caused not only a regression at PS/3 Eye webcam (git commit f43402fa55bf5e7e190c176343015122f694857c), but also at sn9c201 driver, when used on SXGA mode. What happens is that only the highest alternate mode is enough for the maximum resolution. I suspect that other drivers broke due to that change. So, IMO, the better is to revert and work on another alternative. I have to agree with Mauro here, dropping back to a lower alt setting for all devices with a usb audio interface is the wrong thing to do. Btw, I tested here with other hardware. It completely broke stv06xx driver for devices with audio (046d:08f6 Logitech, Inc. QuickCam Messenger Plus), as there's just one alternate config: gspca: no transfer endpoint found My proposal, for now, is to just revert the logic, enabling the hack only in the specific case where doing alt-1 work (see enclosed patch). I tested the enclosed patch and it fixed for PS/3, Quickcam and Gigaware (the 3 cams where I noticed the breakage). Hmm, looking at your patch I notice that the current patch is completely wrong. Not only does it lower the endpoint to use wrongly in many cases, it also does the lowering *each* time we try to start streaming, so if we have a cam with alt settings 0 - 8 and there is not enough bandwidth we used to try: 8, 7, 6, ... and now we will try 7, 5, 3, ... Notice the skipping of an alt setting each time. Before this broken, should be reverted, patch in some cases we used to lower the nbalt setting in some subdrivers where the highest alt setting causes issues for audio, which would result in trying 7, 6, 5 ... in the example, iow work as intended where as 7, 5, 3, ... clearly is not work as intended. Agreed. Let's then just revert the broken patch. Of course, it will break the specific model(s) where the audio hack work, so we need to do: gspca_dev-audio_hack = 1; On the specific model(s) tested with the hack. For example I know multiple devices where the highest alt setting does not have a wMaxPacketSize of 1023, but use something lower instead, to make sure there is enough bandwidth left for usb audio even if the highest alt setting get used. Btw, no matter what resolution is used, sn9c201 is setting the same alternate for all modes, spending more USB bandwidth than needed. Why gspca is just getting the highest value for wMaxPacketSize? It should, instead, seek for the minimum packet size that is needed for a given resolution. There are 2 reasons for this: 1) We do not know the minimum packetsize for a given resolution, unlike with uvc where this is arranged in the protocol, for proprietary apps we can only guess Ok, but, during the driver development, someone could test it. Right, but many of the drivers come from other sources (old v4l1 drivers) and often we only have one model of many supported models when porting these drivers to the new gspca framework. Ok, so, for some drivers, we might never be able to have a proper fix, due to the lack of resources, but we should try to fix it where possible. 2) Almost all devices supported by gspca are usb-1.1 and thus the framerate is bandwidth limited. We want to deliver the highest framerate possible, and thus get as high an alt setting as possible. This is a bogus argument. Core shouldn't assume that all devices are usb 1.1. You're right about the should not assume part, but that does not make this a bogus argument usb-1.1 webcams are bandwidth limited in their framerate, people don't like low framerates so clearly trying to get the highest alt setting and thus allow for the highest framerate is the right thing to do for 1.1 cameras. Allowing the highest framerate/resolution is the right thing to do also for 2.0 cameras. The point is that, if the user is selecting a lower resolution/framerate, drivers should use lower sizes, to save bandwidth. In the specific case of sn9c20x, it has 8 alternates. This probably means that all those alternates could be used, depending on the bandwidth requirements. At the maximum packet size (alt 8) means to spend 60% of the USB 2.0 traffic for isoc, being required for SXGA. Alt 7 spends 36% and it is enough for VGA resolution. If someone wants to have 2 webcams at VGA resolution, wasting bandwith using alt8 would prevent it, as core don't provide 120% bandwidth ;) I agree that the highest setting should not be used when not needed. Yes, that's my point ;) The alternate selection should be based on the desired resolution. It is a function of the imagesize, the frame rate, and the line width. On
Re: tm6000 and IR
Am 08.12.2010 04:55, schrieb Dmitri Belimov: Hi Stefan Am 06.12.2010 11:02, schrieb Dmitri Belimov: Thank you. When I switched to this branch modules is not crash when USB removed. But disable IR over interrupt after start video/radio With my best regards, Dmitry. changing the interface configuration by initiation isoc urb can deactivating the interrupt in endpoint We configure USB stick when modules is loaded /* Selects the proper interface */ rc = usb_set_interface(usbdev, 0, 1); The USB controller reserved one half of bandwith for ISOC. Other device on USB can work slowely. Much better: when module loaded /* Selects the proper interface */ rc = usb_set_interface(usbdev, 0, 2); when start video/audio/TS /* Selects the proper interface */ rc = usb_set_interface(usbdev, 0, 1); when stop video/audio/TS /* Selects the proper interface */ rc = usb_set_interface(usbdev, 0, 2); And restart int pipe after each selection. What you mean about it? Dynamic bandwith utilization. With my best regards, Dmitry. No. Here (tm6000_prepare_isoc) is that problem. It resetted the active interrupt urb pipe and interrupt urb must reinitialize after call usb_set_interface, I think. static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) { struct tm6000_dmaqueue *dma_q =dev-vidq; int i, j, sb_size, pipe, size, max_packets, num_bufs = 8; struct urb *urb; /* De-allocates all pending stuff */ tm6000_uninit_isoc(dev); usb_set_interface(dev-udev, dev-isoc_in.bInterfaceNumber, dev-isoc_in.bAlternateSetting); pipe = usb_rcvisocpipe(dev-udev, dev-isoc_in.endp-desc.bEndpointAddress USB_ENDPOINT_NUMBER_MASK); size = usb_maxpacket(dev-udev, pipe, usb_pipeout(pipe)); Can you test without call usb_set_interface? Of course. It works. The interrupt pipe is a live after start/stop watch TV. Are you make a patch for this? Mauro, what do you think about this? Other point is IR remotes. The tm6010 may be tm5600/tm6000 too returned only two right bytes when received extended nec. Our remotes was send: 0x86 0x6B 0x00 0xFF tm6010 return after decode: 0x86 0x00 0x86 0x00 If we use full lenght of key for ir_table 1. need add some code for restore losing byte. if (ir_table.name == OUR_TV_CARD_IR_TABLE) return to ir core byte1 0x6B byte0 Or 2. use only high byte of address for filtering a key. I'll try number 2 as more robust. What you mean about it? second once are better, easier and need small code. Stefan Ringel -- 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 v3 2/6] davinci vpbe: VPBE display driver
Hans, Thanks for the comments. Only one comment from me. Rest everything I have taken care. Thanks and Regards, -Manju On Tue, Dec 07, 2010 at 02:13:45, Hans Verkuil wrote: Comments below... On Thursday, December 02, 2010 13:38:36 Manjunath Hadli wrote: This patch implements the coe functionality of the dislay driver, mainly controlling the VENC and other encoders, and acting as the one point interface for the man V4L2 driver.This implements the cre of each of the V4L2 IOCTLs. Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com --- drivers/media/video/davinci/vpbe.c | 847 include/media/davinci/vpbe.h | 186 2 files changed, 1033 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/davinci/vpbe.c create mode 100644 include/media/davinci/vpbe.h diff --git a/drivers/media/video/davinci/vpbe.c b/drivers/media/video/davinci/vpbe.c new file mode 100644 index 000..96c0eea --- /dev/null +++ b/drivers/media/video/davinci/vpbe.c @@ -0,0 +1,847 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA */ #include linux/kernel.h #include linux/init.h +#include linux/module.h #include linux/errno.h #include +linux/fs.h #include linux/string.h #include linux/wait.h +#include linux/time.h #include linux/platform_device.h #include +linux/io.h #include linux/slab.h #include linux/clk.h #include +linux/err.h + +#include media/v4l2-device.h +#include media/davinci/vpbe_types.h #include media/davinci/vpbe.h +#include media/davinci/vpss.h + + +#define VPBE_DEFAULT_OUTPUTComposite +#define VPBE_DEFAULT_MODE ntsc + +static char *def_output = VPBE_DEFAULT_OUTPUT; static char *def_mode += VPBE_DEFAULT_MODE; static struct osd_state *osd_device; static +struct venc_platform_data *venc_device; static int debug; + +module_param(def_output, charp, S_IRUGO); module_param(def_mode, +charp, S_IRUGO); module_param(debug, int, 0644); + +MODULE_PARM_DESC(def_output, vpbe output name (default:Composite)); +MODULE_PARM_DESC(ef_mode, vpbe output mode name (default:ntsc); +MODULE_PARM_DESC(debug, Debug level 0-1); + +MODULE_DESCRIPTION(TI DMXXX VPBE Display controller); +MODULE_LICENSE(GPL); MODULE_AUTHOR(Texas Instruments); + +/** + * vpbe_current_encoder_info - Get config info for current encoder + * @vpbe_dev - vpbe device ptr + * + * Return ptr to current encoder config info */ static struct +encoder_config_info* vpbe_current_encoder_info(struct vpbe_device +*vpbe_dev) { + struct vpbe_display_config *vpbe_config = vpbe_dev-cfg; + int index = vpbe_dev-current_sd_index; + return ((index == 0) ? vpbe_config-venc : + vpbe_config-ext_encoders[index-1]); +} + +/** + * vpbe_find_encoder_sd_index - Given a name find encoder sd index + * + * @vpbe_config - ptr to vpbe cfg + * @output_index - index used by application + * + * Return sd index of the encoder + */ +static int vpbe_find_encoder_sd_index(struct vpbe_display_config *vpbe_config, +int index) +{ + char *encoder_name = vpbe_config-outputs[index].subdev_name; + int i; + + /* Venc is always first */ + if (!strcmp(encoder_name, vpbe_config-venc.module_name)) + return 0; + + for (i = 0; i vpbe_config-num_ext_encoders; i++) { + if (!strcmp(encoder_name, +vpbe_config-ext_encoders[i].module_name)) + return i+1; + } + return -EINVAL; +} + +/** + * vpbe_g_cropcap - Get crop capabilities of the display + * @vpbe_dev - vpbe device ptr + * @cropcap - cropcap is a ptr to struct v4l2_cropcap + * + * Update the crop capabilities in crop cap for current + * mode + */ +static int vpbe_g_cropcap(struct vpbe_device *vpbe_dev, + struct v4l2_cropcap *cropcap) +{ + if (NULL == cropcap) + return -EINVAL; + cropcap-bounds.left = 0; + cropcap-bounds.top = 0; + cropcap-bounds.width = vpbe_dev-current_timings.xres; + cropcap-bounds.height = vpbe_dev-current_timings.yres; +
Re: [PATCH v2] media: rc: ir-lirc-codec: fix integer overflow
On Sun, Dec 05, 2010 at 12:05:22AM +0300, Vasiliy Kulikov wrote: 'n' may be bigger than MAX_INT*sizeof(int), if so checking of truncated (int)(n/sizeof(int)) for LIRCBUF_SIZE overflows and then using nontruncated 'count' doesn't make sense. This is not a security issue as too big 'n' is catched in kmalloc() in memdup_user() call. However, it's better to prevent WARN() in kmalloc(). Signed-off-by: Vasiliy Kulikov seg...@openwall.com Now that I have my head out of my arse wrt the actual issue here, the redundancy issue from v1 is resolved, and I've managed a full night's sleep... ;) Acked-by: Jarod Wilson ja...@redhat.com -- Jarod Wilson ja...@redhat.com -- 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] libv4l: Add support for 8-bits grey format (V4L2_PIX_FMT_GREY)
Em 08-12-2010 13:00, Hans de Goede escreveu: Hi, +/* Clear U/V */ +memset(dest, 0, src_fmt-fmt.pix.width * src_fmt-fmt.pix.height / 2); This is wrong the 0 value for U/V is 0x80 (U and V are signed, but not two's complement instead their range is up shifted by 0x80) Otherwise the patch looks good. True. Yeah, a silly mistake. Ok, I fixed it and added the patch at v4l-utils. Thanks for the review! Mauro -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[cron job] v4l-dvb daily build: WARNINGS
This message is generated daily by a cron job that builds v4l-dvb for the kernels and architectures in the list below. Results of the daily build of v4l-dvb: date:Wed Dec 8 19:00:17 CET 2010 git master: 59365d136d205cc20fe666ca7f89b1c5001b0d5a git media-master: gcc version: i686-linux-gcc (GCC) 4.5.1 host hardware:x86_64 host os: 2.6.32.5 linux-git-armv5: WARNINGS linux-git-armv5-davinci: WARNINGS linux-git-armv5-ixp: WARNINGS linux-git-armv5-omap2: WARNINGS linux-git-i686: WARNINGS linux-git-m32r: WARNINGS linux-git-mips: WARNINGS linux-git-powerpc64: WARNINGS linux-git-x86_64: WARNINGS spec-git: OK sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Wednesday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Wednesday.tar.bz2 The V4L-DVB specification 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
[PATCH 00/12] IR: Fixes for 2.6.37-rc5
These are assorted IR fixes I'd like to see make 2.6.37. They should all be present in media_tree.git now, if I'm not mistaken, albeit under the rc subdir instead of IR. I've got a few reports of issues with buffer parsing in mceusb, streamzap and nuvoton-cir, mostly because I've made similar mistakes in all three of the drivers, which are corrected by patches in this series. There are also some lirc_dev fixups and a key sysfs fix for the streamzap and mceusb drivers. The one piece we could probably do without from this series if we want to keep churn to a minimum would be the DRU253S support patch, but pulling that out may require a bit of massaging of later mceusb bits (not sure, haven't actually tried yet). Dan Carpenter (3): lirc_dev: stray unlock in lirc_dev_fop_poll() lirc_dev: add some __user annotations lirc_dev: fixes in lirc_dev_fop_read() Jarod Wilson (8): [media] mceusb: add support for Conexant Hybrid TV RDU253S [media] nuvoton-cir: improve buffer parsing responsiveness [media] mceusb: fix up reporting of trailing space [media] mceusb: buffer parsing fixups for 1st-gen device [media] IR: add tv power scancode to rc6 mce keymap [media] mceusb: fix keybouce issue after parser simplification streamzap: merge timeout space with trailing space mceusb: add another device ID Paul Bender (1): rc: fix sysfs entry for mceusb and streamzap drivers/media/IR/keymaps/rc-rc6-mce.c | 21 +++-- drivers/media/IR/lirc_dev.c | 33 --- drivers/media/IR/mceusb.c | 151 + drivers/media/IR/nuvoton-cir.c| 10 ++- drivers/media/IR/streamzap.c | 21 +++-- include/media/lirc_dev.h |6 +- 6 files changed, 149 insertions(+), 93 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 01/12] [media] mceusb: add support for Conexant Hybrid TV RDU253S
Another multi-function Conexant device. Interface 0 is IR, though on this model, TX isn't wired up at all, so I've mixed in support for models without TX (and verified that lircd says TX isn't supported when trying to send w/this device). Signed-off-by: Jarod Wilson ja...@redhat.com Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/IR/mceusb.c | 37 +++-- 1 files changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c index 9dce684..e453c6b 100644 --- a/drivers/media/IR/mceusb.c +++ b/drivers/media/IR/mceusb.c @@ -146,6 +146,7 @@ enum mceusb_model_type { MCE_GEN3, MCE_GEN2_TX_INV, POLARIS_EVK, + CX_HYBRID_TV, }; struct mceusb_model { @@ -154,6 +155,7 @@ struct mceusb_model { u32 mce_gen3:1; u32 tx_mask_inverted:1; u32 is_polaris:1; + u32 no_tx:1; const char *rc_map; /* Allow specify a per-board map */ const char *name; /* per-board name */ @@ -183,7 +185,12 @@ static const struct mceusb_model mceusb_model[] = { * to allow testing it */ .rc_map = RC_MAP_RC5_HAUPPAUGE_NEW, - .name = cx231xx MCE IR, + .name = Conexant Hybrid TV (cx231xx) MCE IR, + }, + [CX_HYBRID_TV] = { + .is_polaris = 1, + .no_tx = 1, /* tx isn't wired up at all */ + .name = Conexant Hybrid TV (cx231xx) MCE IR, }, }; @@ -292,9 +299,12 @@ static struct usb_device_id mceusb_dev_table[] = { { USB_DEVICE(VENDOR_NORTHSTAR, 0xe004) }, /* TiVo PC IR Receiver */ { USB_DEVICE(VENDOR_TIVO, 0x2000) }, - /* Conexant SDK */ + /* Conexant Hybrid TV Shelby Polaris SDK */ { USB_DEVICE(VENDOR_CONEXANT, 0x58a1), .driver_info = POLARIS_EVK }, + /* Conexant Hybrid TV RDU253S Polaris */ + { USB_DEVICE(VENDOR_CONEXANT, 0x58a5), + .driver_info = CX_HYBRID_TV }, /* Terminating entry */ { } }; @@ -334,6 +344,7 @@ struct mceusb_dev { u32 connected:1; u32 tx_mask_inverted:1; u32 microsoft_gen1:1; + u32 no_tx:1; } flags; /* transmit support */ @@ -724,7 +735,7 @@ out: return ret ? ret : n; } -/* Sets active IR outputs -- mce devices typically (all?) have two */ +/* Sets active IR outputs -- mce devices typically have two */ static int mceusb_set_tx_mask(void *priv, u32 mask) { struct mceusb_dev *ir = priv; @@ -984,9 +995,11 @@ static void mceusb_get_parameters(struct mceusb_dev *ir) mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); mce_sync_in(ir, NULL, maxp); - /* get the transmitter bitmask */ - mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); - mce_sync_in(ir, NULL, maxp); + if (!ir-flags.no_tx) { + /* get the transmitter bitmask */ + mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); + mce_sync_in(ir, NULL, maxp); + } /* get receiver timeout value */ mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); @@ -1035,9 +1048,11 @@ static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir) props-priv = ir; props-driver_type = RC_DRIVER_IR_RAW; props-allowed_protos = IR_TYPE_ALL; - props-s_tx_mask = mceusb_set_tx_mask; - props-s_tx_carrier = mceusb_set_tx_carrier; - props-tx_ir = mceusb_tx_ir; + if (!ir-flags.no_tx) { + props-s_tx_mask = mceusb_set_tx_mask; + props-s_tx_carrier = mceusb_set_tx_carrier; + props-tx_ir = mceusb_tx_ir; + } ir-props = props; @@ -1151,6 +1166,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, ir-len_in = maxp; ir-flags.microsoft_gen1 = is_microsoft_gen1; ir-flags.tx_mask_inverted = tx_mask_inverted; + ir-flags.no_tx = mceusb_model[model].no_tx; ir-model = model; init_ir_raw_event(ir-rawir); @@ -1191,7 +1207,8 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, mceusb_get_parameters(ir); - mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); + if (!ir-flags.no_tx) + mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); usb_set_intfdata(intf, ir); -- 1.7.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 02/12] [media] nuvoton-cir: improve buffer parsing responsiveness
Rather than waiting for trigger bits, the formula for which was slightly messy, and apparently, not actually 100% complete for some remotes, just call ir_raw_event_handle whenever we finish parsing a chunk of data from the rx fifo, similar to mceusb, as well as whenever we see an 'end of signal data' 0x80 packet. Signed-off-by: Jarod Wilson ja...@redhat.com Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/IR/nuvoton-cir.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/IR/nuvoton-cir.c b/drivers/media/IR/nuvoton-cir.c index 301be53..acc729c 100644 --- a/drivers/media/IR/nuvoton-cir.c +++ b/drivers/media/IR/nuvoton-cir.c @@ -603,6 +603,8 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) count = nvt-pkts; nvt_dbg_verbose(Processing buffer of len %d, count); + init_ir_raw_event(rawir); + for (i = 0; i count; i++) { nvt-pkts--; sample = nvt-buf[i]; @@ -643,11 +645,15 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) * indicates end of IR signal, but new data incoming. In both * cases, it means we're ready to call ir_raw_event_handle */ - if (sample == BUF_PULSE_BIT || ((sample != BUF_LEN_MASK) - (sample BUF_REPEAT_MASK) == BUF_REPEAT_BYTE)) + if ((sample == BUF_PULSE_BIT) nvt-pkts) { + nvt_dbg(Calling ir_raw_event_handle (signal end)\n); ir_raw_event_handle(nvt-rdev); + } } + nvt_dbg(Calling ir_raw_event_handle (buffer empty)\n); + ir_raw_event_handle(nvt-rdev); + if (nvt-pkts) { nvt_dbg(Odd, pkts should be 0 now... (its %u), nvt-pkts); nvt-pkts = 0; -- 1.7.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 03/12] [media] mceusb: fix up reporting of trailing space
We were storing a bunch of spaces at the end of each signal, rather than a single long space. The in-kernel decoders were actually okay with this, but lirc isn't. As suggested by David Härdeman, switch to storing samples using ir_raw_event_store_with_filter, which auto-merges the consecutive space samples for us. This also allows us to bypass having to store rawir samples in our device struct, further simplifying the buffer parsing state machine. Both in-kernel decoders and lirc are happy again with this change. Also included in this patch is proper parsing of 0x9f 0x01 commands, the removal of some magic number usage and some printk spew fixups. Signed-off-by: Jarod Wilson ja...@redhat.com Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/IR/mceusb.c | 45 + 1 files changed, 13 insertions(+), 32 deletions(-) diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c index e453c6b..1811098 100644 --- a/drivers/media/IR/mceusb.c +++ b/drivers/media/IR/mceusb.c @@ -74,6 +74,7 @@ #define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ /* Sub-commands, which follow MCE_COMMAND_HEADER or MCE_HW_CMD_HEADER */ +#define MCE_CMD_SIG_END0x01/* End of signal */ #define MCE_CMD_PING 0x03/* Ping device */ #define MCE_CMD_UNKNOWN0x04/* Unknown */ #define MCE_CMD_UNKNOWN2 0x05/* Unknown */ @@ -422,6 +423,7 @@ static int mceusb_cmdsize(u8 cmd, u8 subcmd) case MCE_CMD_G_RXSENSOR: datasize = 2; break; + case MCE_CMD_SIG_END: case MCE_CMD_S_TXMASK: case MCE_CMD_S_RXSENSOR: datasize = 1; @@ -502,6 +504,9 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, break; case MCE_COMMAND_HEADER: switch (subcmd) { + case MCE_CMD_SIG_END: + dev_info(dev, End of signal\n); + break; case MCE_CMD_PING: dev_info(dev, Ping\n); break; @@ -539,7 +544,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, if (len == 2) dev_info(dev, Get receive sensor\n); else - dev_info(dev, Received pulse count is %d\n, + dev_info(dev, Remaining pulse count is %d\n, ((data1 8) | data2)); break; case MCE_RSP_CMD_INVALID: @@ -763,7 +768,7 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier) if (carrier == 0) { ir-carrier = carrier; - cmdbuf[2] = 0x01; + cmdbuf[2] = MCE_CMD_SIG_END; cmdbuf[3] = MCE_IRDATA_TRAILER; dev_dbg(ir-dev, %s: disabling carrier modulation\n, __func__); @@ -816,25 +821,11 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) rawir.duration = (ir-buf_in[i] MCE_PULSE_MASK) * MCE_TIME_UNIT * 1000; - if ((ir-buf_in[i] MCE_PULSE_MASK) == 0x7f) { - if (ir-rawir.pulse == rawir.pulse) { - ir-rawir.duration += rawir.duration; - } else { - ir-rawir.duration = rawir.duration; - ir-rawir.pulse = rawir.pulse; - } - if (ir-rem) - break; - } - rawir.duration += ir-rawir.duration; - ir-rawir.duration = 0; - ir-rawir.pulse = rawir.pulse; - dev_dbg(ir-dev, Storing %s with duration %d\n, rawir.pulse ? pulse : space, rawir.duration); - ir_raw_event_store(ir-idev, rawir); + ir_raw_event_store_with_filter(ir-idev, rawir); break; case CMD_DATA: ir-rem--; @@ -851,16 +842,8 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) } ir-rem = (ir-cmd MCE_PACKET_LENGTH_MASK); mceusb_dev_printdata(ir, ir-buf_in, i, ir-rem + 1, false); - if (ir-rem) { + if (ir-rem) ir-parser_state = PARSE_IRDATA; - break; - } -
[PATCH 04/12] [media] mceusb: buffer parsing fixups for 1st-gen device
If we pass in an offset, we shouldn't skip 2 bytes. And the first-gen hardware generates a constant stream of interrupts, always with two header bytes, and if there's been no IR, with nothing else. Bail from ir processing without calling ir_handle_raw_event when we get such a buffer delivered to us. Signed-off-by: Jarod Wilson ja...@redhat.com Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/IR/mceusb.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c index 1811098..ed151c8 100644 --- a/drivers/media/IR/mceusb.c +++ b/drivers/media/IR/mceusb.c @@ -446,7 +446,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, return; /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ - if (ir-flags.microsoft_gen1 !out) + if (ir-flags.microsoft_gen1 !out !offset) skip = 2; if (len = skip) @@ -807,6 +807,10 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) if (ir-flags.microsoft_gen1) i = 2; + /* if there's no data, just return now */ + if (buf_len = i) + return; + for (; i buf_len; i++) { switch (ir-parser_state) { case SUBCMD: -- 1.7.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 05/12] [media] IR: add tv power scancode to rc6 mce keymap
And clean up some stray spaces. Signed-off-by: Jarod Wilson ja...@redhat.com Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/IR/keymaps/rc-rc6-mce.c | 21 +++-- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/media/IR/keymaps/rc-rc6-mce.c b/drivers/media/IR/keymaps/rc-rc6-mce.c index 1b7adab..6da955d 100644 --- a/drivers/media/IR/keymaps/rc-rc6-mce.c +++ b/drivers/media/IR/keymaps/rc-rc6-mce.c @@ -26,8 +26,8 @@ static struct ir_scancode rc6_mce[] = { { 0x800f040a, KEY_DELETE }, { 0x800f040b, KEY_ENTER }, - { 0x800f040c, KEY_POWER }, - { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */ + { 0x800f040c, KEY_POWER }, /* PC Power */ + { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */ { 0x800f040e, KEY_MUTE }, { 0x800f040f, KEY_INFO }, @@ -56,31 +56,32 @@ static struct ir_scancode rc6_mce[] = { { 0x800f0422, KEY_OK }, { 0x800f0423, KEY_EXIT }, { 0x800f0424, KEY_DVD }, - { 0x800f0425, KEY_TUNER }, /* LiveTV */ - { 0x800f0426, KEY_EPG },/* Guide */ - { 0x800f0427, KEY_ZOOM }, /* Aspect */ + { 0x800f0425, KEY_TUNER }, /* LiveTV */ + { 0x800f0426, KEY_EPG },/* Guide */ + { 0x800f0427, KEY_ZOOM }, /* Aspect */ { 0x800f043a, KEY_BRIGHTNESSUP }, { 0x800f0446, KEY_TV }, - { 0x800f0447, KEY_AUDIO }, /* My Music */ - { 0x800f0448, KEY_PVR },/* RecordedTV */ + { 0x800f0447, KEY_AUDIO }, /* My Music */ + { 0x800f0448, KEY_PVR },/* RecordedTV */ { 0x800f0449, KEY_CAMERA }, { 0x800f044a, KEY_VIDEO }, { 0x800f044c, KEY_LANGUAGE }, { 0x800f044d, KEY_TITLE }, - { 0x800f044e, KEY_PRINT }, /* Print - HP OEM version of remote */ + { 0x800f044e, KEY_PRINT }, /* Print - HP OEM version of remote */ { 0x800f0450, KEY_RADIO }, - { 0x800f045a, KEY_SUBTITLE }, /* Caption/Teletext */ + { 0x800f045a, KEY_SUBTITLE }, /* Caption/Teletext */ { 0x800f045b, KEY_RED }, { 0x800f045c, KEY_GREEN }, { 0x800f045d, KEY_YELLOW }, { 0x800f045e, KEY_BLUE }, + { 0x800f0465, KEY_POWER2 }, /* TV Power */ { 0x800f046e, KEY_PLAYPAUSE }, - { 0x800f046f, KEY_MEDIA }, /* Start media application (NEW) */ + { 0x800f046f, KEY_MEDIA }, /* Start media application (NEW) */ { 0x800f0480, KEY_BRIGHTNESSDOWN }, { 0x800f0481, KEY_PLAYPAUSE }, -- 1.7.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 07/12] streamzap: merge timeout space with trailing space
There are cases where we get an ending space, and our trailing timeout space then gets sent right after it, which breaks repeat, at least for lirc userspace decoding. Merge the two spaces by way of using ir_raw_event_store_filter, set a timeout value, and we're back to good. Successfully tested with streamzap and windows mce remotes. Signed-off-by: Jarod Wilson ja...@redhat.com --- drivers/media/IR/streamzap.c | 15 +++ 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/media/IR/streamzap.c b/drivers/media/IR/streamzap.c index 548381c..c6157ee 100644 --- a/drivers/media/IR/streamzap.c +++ b/drivers/media/IR/streamzap.c @@ -140,7 +140,9 @@ static struct usb_driver streamzap_driver = { static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) { - ir_raw_event_store(sz-idev, rawir); + dev_dbg(sz-dev, Storing %s with duration %u us\n, + (rawir.pulse ? pulse : space), rawir.duration); + ir_raw_event_store_with_filter(sz-idev, rawir); } static void sz_push_full_pulse(struct streamzap_ir *sz, @@ -167,7 +169,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, rawir.duration *= 1000; rawir.duration = IR_MAX_DURATION; } - dev_dbg(sz-dev, ls %u\n, rawir.duration); sz_push(sz, rawir); sz-idle = false; @@ -180,7 +181,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, sz-sum += rawir.duration; rawir.duration *= 1000; rawir.duration = IR_MAX_DURATION; - dev_dbg(sz-dev, p %u\n, rawir.duration); sz_push(sz, rawir); } @@ -200,7 +200,6 @@ static void sz_push_full_space(struct streamzap_ir *sz, rawir.duration += SZ_RESOLUTION / 2; sz-sum += rawir.duration; rawir.duration *= 1000; - dev_dbg(sz-dev, s %u\n, rawir.duration); sz_push(sz, rawir); } @@ -221,8 +220,6 @@ static void streamzap_callback(struct urb *urb) struct streamzap_ir *sz; unsigned int i; int len; - static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) - IR_MAX_DURATION) | 0x0300); if (!urb) return; @@ -246,7 +243,7 @@ static void streamzap_callback(struct urb *urb) dev_dbg(sz-dev, %s: received urb, len %d\n, __func__, len); for (i = 0; i len; i++) { - dev_dbg(sz-dev, sz idx %d: %x\n, + dev_dbg(sz-dev, sz-buf_in[%d]: %x\n, i, (unsigned char)sz-buf_in[i]); switch (sz-decoder_state) { case PulseSpace: @@ -273,7 +270,7 @@ static void streamzap_callback(struct urb *urb) DEFINE_IR_RAW_EVENT(rawir); rawir.pulse = false; - rawir.duration = timeout; + rawir.duration = sz-props-timeout; sz-idle = true; if (sz-timeout_enabled) sz_push(sz, rawir); @@ -444,6 +441,8 @@ static int __devinit streamzap_probe(struct usb_interface *intf, sz-decoder_state = PulseSpace; /* FIXME: don't yet have a way to set this */ sz-timeout_enabled = true; + sz-props-timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) + IR_MAX_DURATION) | 0x0300); #if 0 /* not yet supported, depends on patches from maxim */ /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ -- 1.7.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 09/12] lirc_dev: stray unlock in lirc_dev_fop_poll()
From: Dan Carpenter erro...@gmail.com We shouldn't unlock here. I think this was a cut and paste error. Signed-off-by: Dan Carpenter erro...@gmail.com Acked-by: Jarod Wilson ja...@redhat.com --- drivers/media/IR/lirc_dev.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/drivers/media/IR/lirc_dev.c b/drivers/media/IR/lirc_dev.c index 8418b14..8ab9d87 100644 --- a/drivers/media/IR/lirc_dev.c +++ b/drivers/media/IR/lirc_dev.c @@ -522,10 +522,8 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait) dev_dbg(ir-d.dev, LOGHEAD poll called\n, ir-d.name, ir-d.minor); - if (!ir-attached) { - mutex_unlock(ir-irctl_lock); + if (!ir-attached) return POLLERR; - } poll_wait(file, ir-buf-wait_poll, wait); -- 1.7.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 11/12] lirc_dev: fixes in lirc_dev_fop_read()
From: Dan Carpenter erro...@gmail.com This makes several changes but they're in one function and sort of related: buf was leaked on error. The leak if we try to read an invalid length is the main concern because it could be triggered over and over. If the copy_to_user() failed, then the original code returned the number of bytes remaining. read() is supposed to be the opposite way, where we return the number of bytes copied. I changed it to just return -EFAULT on errors. Also I changed the debug output from -EFAULT to just fail because it isn't -EFAULT necessarily. And since we go though that path if the length is invalid now, there was another debug print that I removed. Signed-off-by: Dan Carpenter erro...@gmail.com Reviewed-by: Jarod Wilson ja...@redhat.com Acked-by: Jarod Wilson ja...@redhat.com --- drivers/media/IR/lirc_dev.c | 25 +++-- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/media/IR/lirc_dev.c b/drivers/media/IR/lirc_dev.c index fbca94f..6b9fc74 100644 --- a/drivers/media/IR/lirc_dev.c +++ b/drivers/media/IR/lirc_dev.c @@ -647,18 +647,18 @@ ssize_t lirc_dev_fop_read(struct file *file, if (!buf) return -ENOMEM; - if (mutex_lock_interruptible(ir-irctl_lock)) - return -ERESTARTSYS; + if (mutex_lock_interruptible(ir-irctl_lock)) { + ret = -ERESTARTSYS; + goto out_unlocked; + } if (!ir-attached) { - mutex_unlock(ir-irctl_lock); - return -ENODEV; + ret = -ENODEV; + goto out_locked; } if (length % ir-chunk_size) { - dev_dbg(ir-d.dev, LOGHEAD read result = -EINVAL\n, - ir-d.name, ir-d.minor); - mutex_unlock(ir-irctl_lock); - return -EINVAL; + ret = -EINVAL; + goto out_locked; } /* @@ -709,18 +709,23 @@ ssize_t lirc_dev_fop_read(struct file *file, lirc_buffer_read(ir-buf, buf); ret = copy_to_user((void *)buffer+written, buf, ir-buf-chunk_size); - written += ir-buf-chunk_size; + if (!ret) + written += ir-buf-chunk_size; + else + ret = -EFAULT; } } remove_wait_queue(ir-buf-wait_poll, wait); set_current_state(TASK_RUNNING); + +out_locked: mutex_unlock(ir-irctl_lock); out_unlocked: kfree(buf); dev_dbg(ir-d.dev, LOGHEAD read result = %s (%d)\n, - ir-d.name, ir-d.minor, ret ? -EFAULT : OK, ret); + ir-d.name, ir-d.minor, ret ? fail : ok, ret); return ret ? ret : written; } -- 1.7.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 12/12] mceusb: add another device ID
Signed-off-by: Jarod Wilson ja...@redhat.com --- drivers/media/IR/mceusb.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c index 57ef809..eb96561 100644 --- a/drivers/media/IR/mceusb.c +++ b/drivers/media/IR/mceusb.c @@ -283,6 +283,8 @@ static struct usb_device_id mceusb_dev_table[] = { { USB_DEVICE(VENDOR_FORMOSA, 0xe03c) }, /* Formosa Industrial Computing */ { USB_DEVICE(VENDOR_FORMOSA, 0xe03e) }, + /* Fintek eHome Infrared Transceiver (HP branded) */ + { USB_DEVICE(VENDOR_FINTEK, 0x5168) }, /* Fintek eHome Infrared Transceiver */ { USB_DEVICE(VENDOR_FINTEK, 0x0602) }, /* Fintek eHome Infrared Transceiver (in the AOpen MP45) */ -- 1.7.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
dvb_unregister_frontend hanging on fepriv-dvbdev-users when called from smsdvb_unregister_client
Hi, I am trying to figure out why the smsxxx MiniStick isn't unregistered correctly when I pull out the stick while kaffeine is playing. It gets as far as calling smsdvb_unregister_client dvb_unregister_frontend where it hangs at if (fepriv-dvbdev-users -1) wait_event(fepriv-dvbdev-wait_queue, fepriv-dvbdev-users==-1); When I move dvb_unregister_frontend further down, after dvb_dmxdev_release() and dvb_dmx_release() the deadlock is resolved. Pluging the stick back in and repeating the process results in an Ooops in the kdvb-ad thread however, which appears pretty exactly repeatable: Dec 8 22:31:55 localhost kernel: [24035.987045] BUG: unable to handle kernel paging request at 016a2cef Dec 8 22:31:55 localhost kernel: [24035.987052] IP: [c11d486b] do_raw_spin_lock+0xb/0x104 Dec 8 22:31:55 localhost kernel: [24035.987062] *pde = Dec 8 22:31:55 localhost kernel: [24035.987065] Oops: [#1] SMP DEBUG_PAGEALLOC Dec 8 22:31:55 localhost kernel: [24035.987069] last sysfs file: /sys/devices/platform/coretemp.1/temp1_input Dec 8 22:31:55 localhost kernel: [24035.987074] Modules linked in: smsdvb dvb_core rc_rc5_hauppauge_new ir_lirc_codec lirc_dev ir_sony_decoder ir_jvc_decoder ir_rc6_decoder ir_rc5_decoder smsusb ir_nec_decoder smsmdtv ir_core ppp_deflate ppp_async crc_ccitt ppp_generic slhc fuse i915 drm_kms_helper drm i2c_algo_bit video output nfsd lockd nfs_acl auth_rpcgss exportfs autofs4 coretemp w83627ehf hwmon_vid hwmon tun sunrpc xt_multiport nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_tcpudp ipt_LOG xt_limit iptable_filter ip_tables x_tables ipv6 binfmt_misc dm_multipath snd_hda_codec_realtek snd_hda_intel deflate snd_hda_codec zlib_deflate ctr twofish_generic twofish_i586 twofish_common camellia rt2500usb arc4 snd_hwdep serpent ecb snd_seq_dummy snd_seq_oss blowfish cast5 des_generic snd_seq_midi_event xcbc snd_seq rmd160 sha512_generic snd_seq_device rt73usb snd_pcm_oss crc_itu_t crypto_null rt2x00usb snd_mixer_oss rt2x00lib snd_pcm iTCO_wdt iTCO_vendor_support snd_timer mac80211 i2c_i801 option snd intel_aDec 8 22:31:55 localhost kernel: gp i2c_core cfg80211 soundcore agpgart usb_wwan led_class psmouse snd_page_alloc r8169 ppdev mac_hid rfkill usbserial parport_pc mii processor button parport rtc_cmos pcspkr thermal evbug serio_raw piix ata_generic ide_pci_generic pata_acpi sha256_generic cbc aes_i586 aes_generic dm_crypt dm_snapshot dm_zero dm_mirror dm_region_hash dm_log dm_mod ehci_hcd [last unloaded: microcode] Dec 8 22:31:55 localhost kernel: [24035.987199] Dec 8 22:31:55 localhost kernel: [24035.987199] Dec 8 22:31:55 localhost kernel: [24035.987203] Pid: 22798, comm: kdvb-ad-0-fe-0 Not tainted 2.6.36.1v1 #4 945GCM-S/To Be Filled By O.E.M. Dec 8 22:31:55 localhost kernel: [24035.987206] EIP: 0060:[c11d486b] EFLAGS: 00010086 CPU: 1 Dec 8 22:31:55 localhost kernel: [24035.987209] EIP is at do_raw_spin_lock+0xb/0x104 Dec 8 22:31:55 localhost kernel: [24035.987211] EAX: 016a2ceb EBX: 016a2ceb ECX: EDX: Dec 8 22:31:55 localhost kernel: [24035.987214] ESI: 0246 EDI: 016a2ceb EBP: f134be98 ESP: f134be78 Dec 8 22:31:55 localhost kernel: [24035.987216] DS: 007b ES: 007b FS: 00d8 GS: SS: 0068 Dec 8 22:31:55 localhost kernel: [24035.987219] Process kdvb-ad-0-fe-0 (pid: 22798, ti=f134a000 task=f036c800 task.ti=f134a000) Dec 8 22:31:55 localhost kernel: [24035.987221] Stack: Dec 8 22:31:55 localhost kernel: [24035.987223] f9a92613 c104095d 016a2cfb 016a2ceb 0246 016a2ceb Dec 8 22:31:55 localhost kernel: [24035.987230] 0 f134beb8 c13705f9 0002 f9a92613 016a2cd3 Dec 8 22:31:55 localhost kernel: [24035.987238] 0 f134bedc f9a92613 00c9 0286 f134bf14 f006eb20 Dec 8 22:31:55 localhost kernel: [24035.987246] Call Trace: Dec 8 22:31:55 localhost kernel: [24035.987254] [f9a92613] ? smscore_find_client+0x3c/0x8f [smsmdtv] Dec 8 22:31:55 localhost kernel: [24035.987260] [c104095d] ? lock_timer_base+0x1f/0x3e Dec 8 22:31:55 localhost kernel: [24035.987266] [c13705f9] ? _raw_spin_lock_irqsave+0x36/0x3f Dec 8 22:31:55 localhost kernel: [24035.987271] [f9a92613] ? smscore_find_client+0x3c/0x8f [smsmdtv] Dec 8 22:31:55 localhost kernel: [24035.987276] [f9a92613] ? smscore_find_client+0x3c/0x8f [smsmdtv] Dec 8 22:31:55 localhost kernel: [24035.987281] [f9a9277d] ? smscore_validate_client+0x35/0xab [smsmdtv] Dec 8 22:31:55 localhost kernel: [24035.987285] [f9a9284d] ? smsclient_sendrequest+0x5a/0x75 [smsmdtv] Dec 8 22:31:55 localhost kernel: [24035.987290] [f85de1f7] ? smsdvb_sendrequest_and_wait+0x1f/0x44 [smsdvb] Dec 8 22:31:55 localhost kernel: [24035.987294] [f85de250] ? smsdvb_send_statistics_request+0x34/0x36 [smsdvb] Dec 8 22:31:55 localhost kernel: [24035.987298] [f85de372] ? smsdvb_read_status+0x17/0x2f [smsdvb] Dec 8 22:31:55
Re: tm6000 and IR
Hi This is my summary changes: 1. Add vendor specific keymap for USB TV card (try git add file, but git diff doesn't include this into diff) 2. Spilt ir_config and work with a key to different rc_type 3. When rc_type is NEC get first scancode from a scantable cut address and store it for filtering. 4. When a key is pressed on NEC remote check one byte of address and restore full scancode before return. May have a some incorrect work when NEC remotes has same as high address bytes. Big thanks to Trident Co. 0x86 0x6B and 0x86 0xdf This is need because in other TV cards frontend returned full scancode. 5. temporary removed usb_set_interface(dev-udev, This patch for discuss. If all is good I'll made a patch for git. With my best regards, Dmitry. Am 08.12.2010 04:55, schrieb Dmitri Belimov: Hi Stefan Am 06.12.2010 11:02, schrieb Dmitri Belimov: Thank you. When I switched to this branch modules is not crash when USB removed. But disable IR over interrupt after start video/radio With my best regards, Dmitry. changing the interface configuration by initiation isoc urb can deactivating the interrupt in endpoint We configure USB stick when modules is loaded /* Selects the proper interface */ rc = usb_set_interface(usbdev, 0, 1); The USB controller reserved one half of bandwith for ISOC. Other device on USB can work slowely. Much better: when module loaded /* Selects the proper interface */ rc = usb_set_interface(usbdev, 0, 2); when start video/audio/TS /* Selects the proper interface */ rc = usb_set_interface(usbdev, 0, 1); when stop video/audio/TS /* Selects the proper interface */ rc = usb_set_interface(usbdev, 0, 2); And restart int pipe after each selection. What you mean about it? Dynamic bandwith utilization. With my best regards, Dmitry. No. Here (tm6000_prepare_isoc) is that problem. It resetted the active interrupt urb pipe and interrupt urb must reinitialize after call usb_set_interface, I think. static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) { struct tm6000_dmaqueue *dma_q =dev-vidq; int i, j, sb_size, pipe, size, max_packets, num_bufs = 8; struct urb *urb; /* De-allocates all pending stuff */ tm6000_uninit_isoc(dev); usb_set_interface(dev-udev, dev-isoc_in.bInterfaceNumber, dev-isoc_in.bAlternateSetting); pipe = usb_rcvisocpipe(dev-udev, dev-isoc_in.endp-desc.bEndpointAddress USB_ENDPOINT_NUMBER_MASK); size = usb_maxpacket(dev-udev, pipe, usb_pipeout(pipe)); Can you test without call usb_set_interface? Of course. It works. The interrupt pipe is a live after start/stop watch TV. Are you make a patch for this? Mauro, what do you think about this? Other point is IR remotes. The tm6010 may be tm5600/tm6000 too returned only two right bytes when received extended nec. Our remotes was send: 0x86 0x6B 0x00 0xFF tm6010 return after decode: 0x86 0x00 0x86 0x00 If we use full lenght of key for ir_table 1. need add some code for restore losing byte. if (ir_table.name == OUR_TV_CARD_IR_TABLE) return to ir core byte1 0x6B byte0 Or 2. use only high byte of address for filtering a key. I'll try number 2 as more robust. What you mean about it? second once are better, easier and need small code. Stefan Ringel /* behold-wander.h - Keytable for behold_wander Remote Controller * * keymap imported from ir-keymaps.c * * Copyright (c) 2010 by Mauro Carvalho Chehab mche...@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. */ #include media/rc-map.h /* Beholder Intl. Ltd. 2010 * Dmitry Belimov d.beli...@google.com * Keytable is used by BeholdTV Wander/Voyage * The ascii-art picture below (in comments, first row * is the keycode in hex, and subsequent row(s) shows * the button labels (several variants when appropriate) * helps to descide which keycodes to assign to the buttons. */ static struct rc_map_table behold_wander[] = { /* 0x13 0x11 0x1C 0x12 * * Mute Source TV/FM Power * * */ { 0x866b13, KEY_MUTE }, { 0x866b11, KEY_PROPS }, { 0x866b1C, KEY_TUNER }, /* KEY_TV/KEY_RADIO */ { 0x866b12, KEY_POWER }, /* 0x010x020x03 0x0D* * 1 2 3 Stereo * * * * 0x040x050x06 0x19* * 4 5 6 Snapshot * * * * 0x070x080x09 0x10* * 7 8 9Zoom * **/ { 0x866b01, KEY_1 }, { 0x866b02, KEY_2 }, { 0x866b03, KEY_3 }, {