[PATCH] s2255drv: firmware re-loading changes

2011-01-19 Thread Sensoray Linux Development
Change for firmware re-loading and updated firmware versions.

Signed-off-by: Dean Anderson 


diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index b63f8ca..561909b 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -57,7 +57,7 @@
 #include 
 
 #define S2255_MAJOR_VERSION1
-#define S2255_MINOR_VERSION20
+#define S2255_MINOR_VERSION21
 #define S2255_RELEASE  0
 #define S2255_VERSION  KERNEL_VERSION(S2255_MAJOR_VERSION, \
   S2255_MINOR_VERSION, \
@@ -312,9 +312,9 @@ struct s2255_fh {
 };
 
 /* current cypress EEPROM firmware version */
-#define S2255_CUR_USB_FWVER((3 << 8) | 6)
+#define S2255_CUR_USB_FWVER((3 << 8) | 11)
 /* current DSP FW version */
-#define S2255_CUR_DSP_FWVER 8
+#define S2255_CUR_DSP_FWVER 10102
 /* Need DSP version 5+ for video status feature */
 #define S2255_MIN_DSP_STATUS  5
 #define S2255_MIN_DSP_COLORFILTER 8
@@ -492,9 +492,11 @@ static void planar422p_to_yuv_packed(const unsigned char 
*in,
 
 static void s2255_reset_dsppower(struct s2255_dev *dev)
 {
-   s2255_vendor_req(dev, 0x40, 0x0b0b, 0x0b0b, NULL, 0, 1);
+   s2255_vendor_req(dev, 0x40, 0x0b0b, 0x0b01, NULL, 0, 1);
msleep(10);
s2255_vendor_req(dev, 0x50, 0x, 0x, NULL, 0, 1);
+   msleep(600);
+   s2255_vendor_req(dev, 0x10, 0x, 0x, NULL, 0, 1);
return;
 }
 


--
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] s2255drv: firmware version update, vendor request change

2011-04-04 Thread Sensoray Linux Development
removes obsolete comments. updates firmware versions. firmware vendor request 
simplified.

Signed-off-by: Dean Anderson 
---
 drivers/media/video/s2255drv.c |   22 +++---
 1 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 561909b..2aecdfa 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -16,15 +16,10 @@
  * Example maximum bandwidth utilization:
  *
  * -full size, color mode YUYV or YUV422P: 2 channels at once
- *
  * -full or half size Grey scale: all 4 channels at once
- *
  * -half size, color mode YUYV or YUV422P: all 4 channels at once
- *
  * -full size, color mode YUYV or YUV422P 1/2 frame rate: all 4 channels
  *  at once.
- *  (TODO: Incorporate videodev2 frame rate(FR) enumeration,
- *  which is currently experimental.)
  *
  * 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
@@ -57,7 +52,7 @@
 #include 
 
 #define S2255_MAJOR_VERSION1
-#define S2255_MINOR_VERSION21
+#define S2255_MINOR_VERSION22
 #define S2255_RELEASE  0
 #define S2255_VERSION  KERNEL_VERSION(S2255_MAJOR_VERSION, \
   S2255_MINOR_VERSION, \
@@ -126,7 +121,7 @@
 #define MASK_COLOR   0x00ff
 #define MASK_JPG_QUALITY 0xff00
 #define MASK_INPUT_TYPE  0x000f
-/* frame decimation. Not implemented by V4L yet(experimental in V4L) */
+/* frame decimation. */
 #define FDEC_1 1   /* capture every frame. default */
 #define FDEC_2 2   /* capture every 2nd frame */
 #define FDEC_3 3   /* capture every 3rd frame */
@@ -312,9 +307,9 @@ struct s2255_fh {
 };
 
 /* current cypress EEPROM firmware version */
-#define S2255_CUR_USB_FWVER((3 << 8) | 11)
+#define S2255_CUR_USB_FWVER((3 << 8) | 12)
 /* current DSP FW version */
-#define S2255_CUR_DSP_FWVER 10102
+#define S2255_CUR_DSP_FWVER 10104
 /* Need DSP version 5+ for video status feature */
 #define S2255_MIN_DSP_STATUS  5
 #define S2255_MIN_DSP_COLORFILTER 8
@@ -492,7 +487,7 @@ static void planar422p_to_yuv_packed(const unsigned char 
*in,
 
 static void s2255_reset_dsppower(struct s2255_dev *dev)
 {
-   s2255_vendor_req(dev, 0x40, 0x0b0b, 0x0b01, NULL, 0, 1);
+   s2255_vendor_req(dev, 0x40, 0x, 0x0001, NULL, 0, 1);
msleep(10);
s2255_vendor_req(dev, 0x50, 0x, 0x, NULL, 0, 1);
msleep(600);
@@ -2285,15 +2280,12 @@ static int s2255_board_init(struct s2255_dev *dev)
/* query the firmware */
fw_ver = s2255_get_fx2fw(dev);
 
-   printk(KERN_INFO "2255 usb firmware version %d.%d\n",
+   printk(KERN_INFO "s2255: usb firmware version %d.%d\n",
   (fw_ver >> 8) & 0xff,
   fw_ver & 0xff);
 
if (fw_ver < S2255_CUR_USB_FWVER)
-   dev_err(&dev->udev->dev,
-   "usb firmware not up to date %d.%d\n",
-   (fw_ver >> 8) & 0xff,
-   fw_ver & 0xff);
+   printk(KERN_INFO "s2255: newer USB firmware available\n");
 
for (j = 0; j < MAX_CHANNELS; j++) {
struct s2255_channel *channel = &dev->channel[j];
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] [media] s2255drv: jpeg enable module parameter

2011-04-04 Thread Sensoray Linux Development
Adding jpeg enable module parameter.

Signed-off-by: Dean Anderson 

---
 drivers/media/video/s2255drv.c |   21 -
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 38e5c4b..eb33e1e 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -389,12 +389,17 @@ static unsigned int vid_limit = 16;/* Video memory 
limit, in Mb */
 /* start video number */
 static int video_nr = -1;/* /dev/videoN, -1 for autodetect */
 
+/* Enable jpeg capture. */
+static int jpeg_enable = 1;
+
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Debug level(0-100) default 0");
 module_param(vid_limit, int, 0644);
 MODULE_PARM_DESC(vid_limit, "video memory limit(Mb)");
 module_param(video_nr, int, 0644);
 MODULE_PARM_DESC(video_nr, "start video minor(-1 default autodetect)");
+module_param(jpeg_enable, int, 0644);
+MODULE_PARM_DESC(jpeg_enable, "Jpeg enable(1-on 0-off) default 1");
 
 /* USB device table */
 #define USB_SENSORAY_VID0x1943
@@ -408,6 +413,7 @@ MODULE_DEVICE_TABLE(usb, s2255_table);
 #define BUFFER_TIMEOUT msecs_to_jiffies(400)
 
 /* image formats.  */
+/* JPEG formats must be defined last to support jpeg_enable parameter */
 static const struct s2255_fmt formats[] = {
 {
 .name = "4:2:2, planar, YUV422P",
@@ -424,6 +430,10 @@ static const struct s2255_fmt formats[] = {
 .fourcc = V4L2_PIX_FMT_UYVY,
 .depth = 16
 }, {
+.name = "8bpp GREY",
+.fourcc = V4L2_PIX_FMT_GREY,
+.depth = 8
+}, {
 .name = "JPG",
 .fourcc = V4L2_PIX_FMT_JPEG,
 .depth = 24
@@ -431,10 +441,6 @@ static const struct s2255_fmt formats[] = {
 .name = "MJPG",
 .fourcc = V4L2_PIX_FMT_MJPEG,
 .depth = 24
-}, {
-.name = "8bpp GREY",
-.fourcc = V4L2_PIX_FMT_GREY,
-.depth = 8
 }
 };
 
@@ -609,6 +615,9 @@ static const struct s2255_fmt *format_by_fourcc(int fourcc)
 for (i = 0; i < ARRAY_SIZE(formats); i++) {
 if (-1 == formats[i].fourcc)
 continue;
+if (!jpeg_enable && ((formats[i].fourcc == V4L2_PIX_FMT_JPEG) ||
+ (formats[i].fourcc == V4L2_PIX_FMT_MJPEG)))
+continue;
 if (formats[i].fourcc == fourcc)
 return formats + i;
 }
@@ -856,7 +865,9 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void 
*priv,
 
 if (index >= ARRAY_SIZE(formats))
 return -EINVAL;
-
+if (!jpeg_enable && ((formats[index].fourcc == V4L2_PIX_FMT_JPEG) ||
+ (formats[index].fourcc == V4L2_PIX_FMT_MJPEG)))
+return -EINVAL;
 dprintk(4, "name %s\n", formats[index].name);
 strlcpy(f->description, formats[index].name, sizeof(f->description));
 f->pixelformat = formats[index].fourcc;
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2][media] s2255drv: adding MJPEG format

2011-04-04 Thread Sensoray Linux Development
adding MJPEG format

Signed-off-by: Dean Anderson 
---
 drivers/media/video/s2255drv.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index b12e28e..38e5c4b 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -428,6 +428,10 @@ static const struct s2255_fmt formats[] = {
 .fourcc = V4L2_PIX_FMT_JPEG,
 .depth = 24
 }, {
+.name = "MJPG",
+.fourcc = V4L2_PIX_FMT_MJPEG,
+.depth = 24
+}, {
 .name = "8bpp GREY",
 .fourcc = V4L2_PIX_FMT_GREY,
 .depth = 8
@@ -648,6 +652,7 @@ static void s2255_fillbuff(struct s2255_channel *channel,
 memcpy(vbuf, tmpbuf, buf->vb.width * buf->vb.height);
 break;
 case V4L2_PIX_FMT_JPEG:
+case V4L2_PIX_FMT_MJPEG:
 buf->vb.size = jpgsize;
 memcpy(vbuf, tmpbuf, buf->vb.size);
 break;
@@ -1032,6 +1037,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void 
*priv,
 mode.color |= COLOR_Y8;
 break;
 case V4L2_PIX_FMT_JPEG:
+case V4L2_PIX_FMT_MJPEG:
 mode.color &= ~MASK_COLOR;
 mode.color |= COLOR_JPG;
 mode.color |= (channel->jc.quality << 8);
-- 
1.7.0.4
--
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