Re: patch: s2255drv high quality mode and video status querying
On Tue, 7 Apr 2009 10:56:36 -0700 (PDT) "Dean A." wrote: > From: Dean Anderson > > This patch adds V4L2 video status capability and V4L2_MODE_HIGHQUALITY > operation. Hi Dean, I have a few comments to add over Trent's one. > > Signed-off-by: Dean Anderson > > --- v4l-dvb-1e670024659d/linux/drivers/media/video/s2255drv.c.orig > 2009-04-07 10:38:42.0 -0700 > +++ v4l-dvb-1e670024659d/linux/drivers/media/video/s2255drv.c 2009-04-07 > 10:42:51.0 -0700 > @@ -57,7 +57,8 @@ > > #define FIRMWARE_FILE_NAME "f2255usb.bin" > > - > +#define S2255_REV_MAJOR 1 > +#define S2255_REV_MINOR 20 > > + > #define S2255_MAJOR_VERSION 1 > #define S2255_MINOR_VERSION 13 Hmm... Why you need two different major/minor versions on your driver? > @@ -1207,8 +1236,8 @@ static int s2255_set_mode(struct s2255_d > struct s2255_mode *mode) > { > int res; > - u32 *buffer; > - unsigned long chn_rev; > + __le32 *buffer; > + u32 chn_rev; Also, please don't mix more than one thing at the same patch. Clearly, you did some endiannes fix at the same patch. Please split it into different patches. > +static int s2255_cmd_status(struct s2255_dev *dev, unsigned long chn, > + u32 *pstatus) > +{ > + int res; > + __le32 *buffer; > + u32 chn_rev; > + > + mutex_lock(&dev->lock); > + chn_rev = G_chnmap[chn]; > + dprintk(4, "s2255_get_status: chan %d\n", chn_rev); > + buffer = kzalloc(512, GFP_KERNEL); > + if (buffer == NULL) { > + dev_err(&dev->udev->dev, "out of mem\n"); > + mutex_unlock(&dev->lock); > + return -ENOMEM; > + } > + /* form the get vid status command */ > + buffer[0] = IN_DATA_TOKEN; > + buffer[1] = cpu_to_le32(chn_rev); > + buffer[2] = CMD_STATUS; > + *pstatus = 0; > + dev->vidstatus_ready[chn] = 0; > + res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); > + kfree(buffer); > + wait_event_timeout(dev->wait_vidstatus[chn], > +(dev->vidstatus_ready[chn] != 0), > +msecs_to_jiffies(S2255_VIDSTATUS_TIMEOUT)); > + if (dev->vidstatus_ready[chn] != 1) { > + printk(KERN_DEBUG "s2255: no vidstatus response\n"); > + res = -EFAULT; > + } > + *pstatus = dev->vidstatus[chn]; > + dprintk(4, "s2255: vid status %d\n", *pstatus); > + mutex_unlock(&dev->lock); > + return res; > +} > + Also, please split "high quality mode" from "video status querying". You should provide one patch per different feature you're adding. Cheers, 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
Re: patch: s2255drv high quality mode and video status querying
On Tue, 7 Apr 2009, Dean A. wrote: > +static int vidioc_g_parm(struct file *file, void *priv, > + struct v4l2_streamparm *sp) > +{ > + struct s2255_fh *fh = priv; > + struct s2255_dev *dev = fh->dev; > + if (sp->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) > + return -EINVAL; You do not need to check the buffer type, video_ioctl2 does it already. -- 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: s2255drv high quality mode and video status querying
From: Dean Anderson This patch adds V4L2 video status capability and V4L2_MODE_HIGHQUALITY operation. Signed-off-by: Dean Anderson --- v4l-dvb-1e670024659d/linux/drivers/media/video/s2255drv.c.orig 2009-04-07 10:38:42.0 -0700 +++ v4l-dvb-1e670024659d/linux/drivers/media/video/s2255drv.c 2009-04-07 10:42:51.0 -0700 @@ -57,7 +57,8 @@ #define FIRMWARE_FILE_NAME "f2255usb.bin" - +#define S2255_REV_MAJOR 1 +#define S2255_REV_MINOR 20 /* default JPEG quality */ #define S2255_DEF_JPEG_QUAL 50 @@ -75,9 +76,13 @@ #define S2255_LOAD_TIMEOUT (5000 + S2255_DSP_BOOTTIME) #define S2255_DEF_BUFS 16 #define S2255_SETMODE_TIMEOUT 500 +#define S2255_VIDSTATUS_TIMEOUT 350 #define MAX_CHANNELS 4 -#define S2255_MARKER_FRAME 0x2255DA4AL -#define S2255_MARKER_RESPONSE 0x2255ACACL +#define S2255_MARKER_FRAME cpu_to_le32(0x2255DA4AL) +#define S2255_MARKER_RESPONSE cpu_to_le32(0x2255ACACL) +#define S2255_RESPONSE_SETMODE cpu_to_le32(0x01) +#define S2255_RESPONSE_FW cpu_to_le32(0x10) +#define S2255_RESPONSE_STATUS cpu_to_le32(0x20) #define S2255_USB_XFER_SIZE(16 * 1024) #define MAX_CHANNELS 4 #define MAX_PIPE_BUFFERS 1 @@ -100,14 +105,16 @@ #define LINE_SZ_DEF640 #define NUM_LINES_DEF 240 - /* predefined settings */ #define FORMAT_NTSC1 #define FORMAT_PAL 2 +/* SCALE_4CIFS is the 2 fields merge into one */ #define SCALE_4CIFS1 /* 640x480(NTSC) or 704x576(PAL) */ #define SCALE_2CIFS2 /* 640x240(NTSC) or 704x288(PAL) */ #define SCALE_1CIFS3 /* 320x240(NTSC) or 352x288(PAL) */ +/* SCALE_4CIFSI is the 2 fields interpolated into one */ +#define SCALE_4CIFSI 4 /* 640x480(NTSC) or 704x576(PAL) high quality */ #define COLOR_YUVPL1 /* YUV planar */ #define COLOR_YUVPK2 /* YUV packed */ @@ -134,12 +141,12 @@ #define DEF_HUE0 /* usb config commands */ -#define IN_DATA_TOKEN 0x2255c0de -#define CMD_2255 0xc2255000 -#define CMD_SET_MODE (CMD_2255 | 0x10) -#define CMD_START (CMD_2255 | 0x20) -#define CMD_STOP (CMD_2255 | 0x30) -#define CMD_STATUS (CMD_2255 | 0x40) +#define IN_DATA_TOKEN cpu_to_le32(0x2255c0de) +#define CMD_2255 cpu_to_le32(0xc2255000) +#define CMD_SET_MODE cpu_to_le32((CMD_2255 | 0x10)) +#define CMD_START cpu_to_le32((CMD_2255 | 0x20)) +#define CMD_STOP cpu_to_le32((CMD_2255 | 0x30)) +#define CMD_STATUS cpu_to_le32((CMD_2255 | 0x40)) struct s2255_mode { u32 format; /* input video format (NTSC, PAL) */ @@ -181,7 +188,6 @@ struct s2255_dmaqueue { struct list_headactive; /* thread for acquisition */ struct task_struct *kthread; - int frame; struct s2255_dev*dev; int channel; }; @@ -211,16 +217,12 @@ struct s2255_pipeinfo { u32 max_transfer_size; u32 cur_transfer_size; u8 *transfer_buffer; - u32 transfer_flags;; u32 state; - u32 prev_state; u32 urb_size; void *stream_urb; void *dev; /* back pointer to s2255_dev struct*/ u32 err_count; - u32 buf_index; u32 idx; - u32 priority_set; }; struct s2255_fmt; /*forward declaration */ @@ -239,14 +241,15 @@ struct s2255_dev { struct video_device *vdev[MAX_CHANNELS]; struct list_heads2255_devlist; struct timer_list timer; - struct s2255_fw *fw_data; - int board_num; - int is_open; + struct s2255_fw *fw_data; struct s2255_pipeinfo pipes[MAX_PIPE_BUFFERS]; struct s2255_bufferibuffer[MAX_CHANNELS]; struct s2255_mode mode[MAX_CHANNELS]; /* jpeg compression */ struct v4l2_jpegcompression jc[MAX_CHANNELS]; + /* capture parameters (for high quality mode full size) */ + struct v4l2_captureparm cap_parm[MAX_CHANNELS]; + const struct s2255_fmt *cur_fmt[MAX_CHANNELS]; int cur_frame[MAX_CHANNELS]; int last_frame[MAX_CHANNELS]; @@ -265,9 +268,16 @@ struct s2255_dev { int chn_configured[MAX_CHANNELS]; wait_queue_head_t wait_setmode[MAX_CHANNELS]; int setmode_ready[MAX_CHANNELS]; + /* video status items */ + int vidstatus[MAX_CHANNELS]; + wait_queue_head_t wait_vidstatus[MAX_CHANNELS]; + int vidstatus_ready[MAX_CHANNELS]; + int chn_ready; struct kref kref; spinlock_t slock; + /* dsp firmware version (f2255usb.bin) */ + int dsp_fw_ver; }; #define to_s2255_dev(d) container_of(d, struct s2255_dev, kref) @@ -298,7 +308,16 @