From 6195da85a3c11b3c8ac195ff5ef08c69e6f968e8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 2 Jul 2008 15:59:29 +0000 Subject: zr36067: Delete dead code From: Jean Delvare This has been commented out for years, it's about time to get rid of it. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/zoran_card.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/zoran_card.c b/linux/drivers/media/video/zoran_card.c index 56d8edecc..cc45ae5cd 100644 --- a/linux/drivers/media/video/zoran_card.c +++ b/linux/drivers/media/video/zoran_card.c @@ -359,14 +359,6 @@ i2cid_to_modulename (u16 i2c_id) case I2C_DRIVERID_VPX3220: name = "vpx3220"; break; -/* case I2C_DRIVERID_VPX3224: - name = "vpx3224"; - break; - case I2C_DRIVERID_MSE3000: - name = "mse3000"; - break;*/ - default: - break; } return name; @@ -387,8 +379,6 @@ codecid_to_modulename (u16 codecid) case CODEC_TYPE_ZR36016: name = "zr36016"; break; - default: - break; } return name; @@ -429,7 +419,6 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { .type = DC10_old, .name = "DC10(old)", .i2c_decoder = I2C_DRIVERID_VPX3220, - /*.i2c_encoder = I2C_DRIVERID_MSE3000,*/ .video_codec = CODEC_TYPE_ZR36050, .video_vfe = CODEC_TYPE_ZR36016, -- cgit v1.2.3 From 09524e72d1ea817fdbbd18d7219b824588d66278 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 2 Jul 2008 16:01:21 +0000 Subject: bt819: Fix a debug message From: Jean Delvare Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/bt819.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/drivers/media/video/bt819.c b/linux/drivers/media/video/bt819.c index 402bccaf7..90be239cc 100644 --- a/linux/drivers/media/video/bt819.c +++ b/linux/drivers/media/video/bt819.c @@ -517,7 +517,7 @@ bt819_detect_client (struct i2c_adapter *adapter, dprintk(1, KERN_INFO - "saa7111.c: detecting bt819 client on address 0x%x\n", + "bt819: detecting bt819 client on address 0x%x\n", address << 1); /* Check if the adapter supports the needed features */ -- cgit v1.2.3 From 40623bc5fb02d968ab90fbe4479458cda3ef6f52 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 30 Jun 2008 21:28:34 +0000 Subject: Sensoray 2255 V4l driver checkpatch fixes From: Dean Anderson This patch fixes some coding style issues. It also fixes a NULL de-reference on driver unload. The permissions for the module parameters were changed to 0644. Signed-off-by: Dean Anderson Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/s2255drv.c | 61 +++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 26 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/s2255drv.c b/linux/drivers/media/video/s2255drv.c index aca8c3d90..6eb396ffc 100644 --- a/linux/drivers/media/video/s2255drv.c +++ b/linux/drivers/media/video/s2255drv.c @@ -68,17 +68,17 @@ /* maximum time for DSP to start responding after last FW word loaded(ms) */ #define S2255_DSP_BOOTTIME 400 /* maximum time to wait for firmware to load (ms) */ -#define S2255_LOAD_TIMEOUT (5000+S2255_DSP_BOOTTIME) +#define S2255_LOAD_TIMEOUT (5000 + S2255_DSP_BOOTTIME) #define S2255_DEF_BUFS 16 #define MAX_CHANNELS 4 #define FRAME_MARKER 0x2255DA4AL -#define MAX_PIPE_USBBLOCK (40*1024) -#define DEFAULT_PIPE_USBBLOCK (16*1024) +#define MAX_PIPE_USBBLOCK (40 * 1024) +#define DEFAULT_PIPE_USBBLOCK (16 * 1024) #define MAX_CHANNELS 4 #define MAX_PIPE_BUFFERS 1 #define SYS_FRAMES 4 /* maximum size is PAL full size plus room for the marker header(s) */ -#define SYS_FRAMES_MAXSIZE (720*288*2*2 + 4096) +#define SYS_FRAMES_MAXSIZE (720 * 288 * 2 * 2 + 4096) #define DEF_USB_BLOCK (4096) #define LINE_SZ_4CIFS_NTSC 640 #define LINE_SZ_2CIFS_NTSC 640 @@ -169,7 +169,7 @@ struct s2255_bufferi { #define DEF_MODEI_NTSC_CONT {FORMAT_NTSC, DEF_SCALE, DEF_COLOR, \ DEF_FDEC, DEF_BRIGHT, DEF_CONTRAST, DEF_SATURATION, \ - DEF_HUE, 0, DEF_USB_BLOCK, 0 } + DEF_HUE, 0, DEF_USB_BLOCK, 0} struct s2255_dmaqueue { struct list_head active; @@ -276,6 +276,10 @@ struct s2255_fh { struct s2255_mode mode; }; +/* + * TODO: fixme S2255_MAX_USERS. Do not limit open driver handles. + * Limit V4L to one stream at a time. + */ #define S2255_MAX_USERS 1 #define CUR_USB_FWVER 774 /* current cypress EEPROM firmware version */ @@ -294,7 +298,7 @@ struct s2255_fh { #define PREFIX_SIZE 512 /* Channels on box are in reverse order */ -static unsigned long G_chnmap[MAX_CHANNELS] = { 3, 2, 1, 0 }; +static unsigned long G_chnmap[MAX_CHANNELS] = {3, 2, 1, 0}; static LIST_HEAD(s2255_devlist); @@ -330,11 +334,11 @@ static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ /* start video number */ static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ -module_param(debug, int, 0); +module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Debug level(0-100) default 0"); -module_param(vid_limit, int, 0); +module_param(vid_limit, int, 0644); MODULE_PARM_DESC(vid_limit, "video memory limit(Mb)"); -module_param(video_nr, int, 0); +module_param(video_nr, int, 0644); MODULE_PARM_DESC(video_nr, "start video minor(-1 default autodetect)"); /* USB device table */ @@ -438,7 +442,10 @@ static int norm_minh(struct video_device *vdev) } -/* converts 2255 planar format to yuyv or uyvy */ +/* + * TODO: fixme: move YUV reordering to hardware + * converts 2255 planar format to yuyv or uyvy + */ static void planar422p_to_yuv_packed(const unsigned char *in, unsigned char *out, int width, int height, @@ -503,7 +510,7 @@ static void s2255_fwchunk_complete(struct urb *urb) struct usb_device *udev = urb->dev; int len; dprintk(100, "udev %p urb %p", udev, urb); - + /* TODO: fixme. reflect change in status */ if (urb->status) { dev_err(&udev->dev, "URB failed with status %d", urb->status); return; @@ -683,7 +690,7 @@ static int buffer_setup(struct videobuf_queue *vq, unsigned int *count, if (0 == *count) *count = S2255_DEF_BUFS; - while (*size * *count > vid_limit * 1024 * 1024) + while (*size * (*count) > vid_limit * 1024 * 1024) (*count)--; return 0; @@ -790,7 +797,7 @@ static int res_get(struct s2255_dev *dev, struct s2255_fh *fh) static int res_locked(struct s2255_dev *dev, struct s2255_fh *fh) { - return (dev->resources[fh->channel]); + return dev->resources[fh->channel]; } static void res_free(struct s2255_dev *dev, struct s2255_fh *fh) @@ -807,7 +814,8 @@ static int vidioc_querycap(struct file *file, void *priv, struct s2255_dev *dev = fh->dev; strlcpy(cap->driver, "s2255", sizeof(cap->driver)); strlcpy(cap->card, "s2255", sizeof(cap->card)); - strlcpy(cap->bus_info, dev_name(&dev->udev->dev), sizeof(cap->bus_info)); + strlcpy(cap->bus_info, dev_name(&dev->udev->dev), + sizeof(cap->bus_info)); cap->version = S2255_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; @@ -840,8 +848,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, f->fmt.pix.pixelformat = fh->fmt->fourcc; f->fmt.pix.bytesperline = f->fmt.pix.width * (fh->fmt->depth >> 3); f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; - - return (0); + return 0; } static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, @@ -962,7 +969,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ret = vidioc_try_fmt_vid_cap(file, fh, f); if (ret < 0) - return (ret); + return ret; fmt = format_by_fourcc(f->fmt.pix.pixelformat); @@ -1337,7 +1344,7 @@ static int vidioc_enum_input(struct file *file, void *priv, inp->type = V4L2_INPUT_TYPE_CAMERA; inp->std = S2255_NORMS; strlcpy(inp->name, "Camera", sizeof(inp->name)); - return (0); + return 0; } static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) @@ -1361,7 +1368,7 @@ static int vidioc_queryctrl(struct file *file, void *priv, for (i = 0; i < ARRAY_SIZE(s2255_qctrl); i++) if (qc->id && qc->id == s2255_qctrl[i].id) { memcpy(qc, &(s2255_qctrl[i]), sizeof(*qc)); - return (0); + return 0; } dprintk(4, "query_ctrl -EINVAL %d\n", qc->id); @@ -1376,7 +1383,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, for (i = 0; i < ARRAY_SIZE(s2255_qctrl); i++) if (ctrl->id == s2255_qctrl[i].id) { ctrl->value = qctl_regs[i]; - return (0); + return 0; } dprintk(4, "g_ctrl -EINVAL\n"); @@ -1396,7 +1403,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, if (ctrl->id == s2255_qctrl[i].id) { if (ctrl->value < s2255_qctrl[i].minimum || ctrl->value > s2255_qctrl[i].maximum) - return (-ERANGE); + return -ERANGE; qctl_regs[i] = ctrl->value; /* update the mode to the corresponding value */ @@ -1572,6 +1579,11 @@ static void s2255_destroy(struct kref *kref) usb_free_urb(dev->fw_data->fw_urb); dev->fw_data->fw_urb = NULL; } + /* + * TODO: fixme(above, below): potentially leaving timers alive. + * do not ignore timeout below if + * it occurs. + */ /* make sure we aren't waiting for the DSP */ if (atomic_read(&dev->fw_data->fw_state) == S2255_FW_LOADED_DSPWAIT) { @@ -1583,15 +1595,12 @@ static void s2255_destroy(struct kref *kref) } if (dev->fw_data) { + if (dev->fw_data->fw) + release_firmware(dev->fw_data->fw); kfree(dev->fw_data->pfw_data); kfree(dev->fw_data); } - if (dev->fw_data->fw) { - release_firmware(dev->fw_data->fw); - dev->fw_data->fw = NULL; - } - usb_put_dev(dev->udev); dprintk(1, "%s", __func__); kfree(dev); -- cgit v1.2.3 From 5d6597046c8d57aa650a06343c4d63ba7dbe57dc Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 30 Jun 2008 20:57:39 +0000 Subject: OV7670: don't reject unsupported settings From: Daniel Drake For VIDIOC_G_FMT/VIDIOC_TRY_FMT, the V4L2 API spec states: "Drivers should not return an error code unless the input is ambiguous" "Very simple, inflexible devices may even ignore all input and always return the default parameters." "When the requested buffer type is not supported drivers return an EINVAL error code." i.e. returning errors for unsupported fields is bad, and it's ok to unconditionally overwrite user-requested settings This patch makes ov7670 meet that behaviour, and brings it in line with other drivers e.g. stk-webcam. It also fixes compatibility with (unpatched) gstreamer. Signed-off-by: Daniel Drake Acked-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/ov7670.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/ov7670.c b/linux/drivers/media/video/ov7670.c index f226161bc..dcf7678a8 100644 --- a/linux/drivers/media/video/ov7670.c +++ b/linux/drivers/media/video/ov7670.c @@ -704,17 +704,17 @@ static int ov7670_try_fmt(struct i2c_client *c, struct v4l2_format *fmt, for (index = 0; index < N_OV7670_FMTS; index++) if (ov7670_formats[index].pixelformat == pix->pixelformat) break; - if (index >= N_OV7670_FMTS) - return -EINVAL; + if (index >= N_OV7670_FMTS) { + /* default to first format */ + index = 0; + pix->pixelformat = ov7670_formats[0].pixelformat; + } if (ret_fmt != NULL) *ret_fmt = ov7670_formats + index; /* * Fields: the OV devices claim to be progressive. */ - if (pix->field == V4L2_FIELD_ANY) - pix->field = V4L2_FIELD_NONE; - else if (pix->field != V4L2_FIELD_NONE) - return -EINVAL; + pix->field = V4L2_FIELD_NONE; /* * Round requested image size down to the nearest * we support, but not below the smallest. -- cgit v1.2.3 From 58cfc4da3781701f2b8da0d4cb6618b6179f223e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 12 Jul 2008 09:27:59 -0300 Subject: saa7134: Add support for analog only ASUSTeK P7131 From: Hermann Pitton saa7134: add a separate entry for the ASUSTeK P7131 analog only and do some eeprom detection to escape from the TVFM35 with the same PCI subsystem on auto detection. Signed-off-by: Hermann Pitton Signed-off-by: Mauro Carvalho Chehab --- linux/Documentation/video4linux/CARDLIST.saa7134 | 1 + linux/drivers/media/video/saa7134/saa7134-cards.c | 43 +++++++++++++++++++++++ linux/drivers/media/video/saa7134/saa7134-input.c | 1 + linux/drivers/media/video/saa7134/saa7134.h | 1 + 4 files changed, 46 insertions(+) (limited to 'linux') diff --git a/linux/Documentation/video4linux/CARDLIST.saa7134 b/linux/Documentation/video4linux/CARDLIST.saa7134 index 171905e87..39868af9c 100644 --- a/linux/Documentation/video4linux/CARDLIST.saa7134 +++ b/linux/Documentation/video4linux/CARDLIST.saa7134 @@ -144,3 +144,4 @@ 143 -> Beholder BeholdTV M63 [5ace:6191] 144 -> Beholder BeholdTV M6 Extra [5ace:6193] 145 -> AVerMedia MiniPCI DVB-T Hybrid M103 [1461:f636] +146 -> ASUSTeK P7131 Analog diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c index a2a4ca6f8..0d4dca518 100644 --- a/linux/drivers/media/video/saa7134/saa7134-cards.c +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c @@ -3558,6 +3558,39 @@ struct saa7134_board saa7134_boards[] = { .amux = TV, .gpio = 0x0200000, }, + }, + [SAA7134_BOARD_ASUSTeK_P7131_ANALOG] = { + .name = "ASUSTeK P7131 Analog", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .gpiomask = 1 << 21, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + .gpio = 0x0000000, + }, { + .name = name_comp1, + .vmux = 3, + .amux = LINE2, + }, { + .name = name_comp2, + .vmux = 0, + .amux = LINE2, + }, { + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + } }, + .radio = { + .name = name_radio, + .amux = TV, + .gpio = 0x0200000, + }, }, [SAA7134_BOARD_SABRENT_TV_PCB05] = { .name = "Sabrent PCMCIA TV-PCB05", @@ -5704,6 +5737,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_FLYDVBT_LR301: case SAA7134_BOARD_ASUSTeK_P7131_DUAL: case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: + case SAA7134_BOARD_ASUSTeK_P7131_ANALOG: case SAA7134_BOARD_FLYDVBTDUO: case SAA7134_BOARD_PROTEUS_2309: case SAA7134_BOARD_AVERMEDIA_A16AR: @@ -6044,6 +6078,15 @@ int saa7134_board_init2(struct saa7134_dev *dev) i2c_transfer(&dev->i2c_adap, &msg, 1); break; } + case SAA7134_BOARD_ASUSTeK_TVFM35: + /* The card below is detected as card=53, but is different */ + if (dev->autodetected && (dev->eedata[0x27] == 0x03)) { + dev->board = SAA7134_BOARD_ASUSTeK_P7131_ANALOG; + printk(KERN_INFO "%s: P7131 analog only, using " + "entry of %s\n", + dev->name, saa7134_boards[dev->board].name); + } + break; case SAA7134_BOARD_HAUPPAUGE_HVR1110: hauppauge_eeprom(dev, dev->eedata+0x80); /* break intentionally omitted */ diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c index 0ad81e690..89fc7dfc2 100644 --- a/linux/drivers/media/video/saa7134/saa7134-input.c +++ b/linux/drivers/media/video/saa7134/saa7134-input.c @@ -409,6 +409,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) break; case SAA7134_BOARD_ASUSTeK_P7131_DUAL: case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: + case SAA7134_BOARD_ASUSTeK_P7131_ANALOG: ir_codes = ir_codes_asus_pc39; mask_keydown = 0x0040000; rc5_gpio = 1; diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h index 4a9bebb2d..c438682cd 100644 --- a/linux/drivers/media/video/saa7134/saa7134.h +++ b/linux/drivers/media/video/saa7134/saa7134.h @@ -268,6 +268,7 @@ struct saa7134_format { #define SAA7134_BOARD_BEHOLD_M63 143 #define SAA7134_BOARD_BEHOLD_M6_EXTRA 144 #define SAA7134_BOARD_AVERMEDIA_M103 145 +#define SAA7134_BOARD_ASUSTeK_P7131_ANALOG 146 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.3 From 1256e66660d3ac435768ff432e02a5fa45c572cb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 12 Jul 2008 10:24:29 -0300 Subject: saa7134: fix compilation From: Mauro Carvalho Chehab Previous patch added a macro that it is not yet defined. Disable that part of the code for now. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/saa7134/saa7134-cards.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux') diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c index 0d4dca518..08597a558 100644 --- a/linux/drivers/media/video/saa7134/saa7134-cards.c +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c @@ -6078,6 +6078,8 @@ int saa7134_board_init2(struct saa7134_dev *dev) i2c_transfer(&dev->i2c_adap, &msg, 1); break; } +#if 0 + /* FIXME: This entry doesn't exist yet */ case SAA7134_BOARD_ASUSTeK_TVFM35: /* The card below is detected as card=53, but is different */ if (dev->autodetected && (dev->eedata[0x27] == 0x03)) { @@ -6087,6 +6089,7 @@ int saa7134_board_init2(struct saa7134_dev *dev) dev->name, saa7134_boards[dev->board].name); } break; +#endif case SAA7134_BOARD_HAUPPAUGE_HVR1110: hauppauge_eeprom(dev, dev->eedata+0x80); /* break intentionally omitted */ -- cgit v1.2.3