[no subject]

2011-10-25 Thread sensoray-dev
commit cf5886c3dd2f65c817cb6ca5e7202fa3a3bdc872
Author: Dean Anderson linux-...@sensoray.com
Date:   Mon Oct 24 15:46:52 2011 -0700

[media]: saa7134: Adding Sensoray 811 and 911 board models to saa7134 driver

Signed-off-by: Dean Anderson linux-...@sensoray.com

diff --git a/Documentation/video4linux/CARDLIST.saa7134 
b/Documentation/video4linux/CARDLIST.saa7134
index 7efae9b..e7ef38a 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -186,3 +186,4 @@
 185 - MagicPro ProHDTV Pro2 DMB-TH/Hybrid  [17de:d136]
 186 - Beholder BeholdTV 501[5ace:5010]
 187 - Beholder BeholdTV 503 FM [5ace:5030]
+188 - Sensoray 811/911 [6000:0811,6000:0911]
diff --git a/drivers/media/video/saa7134/saa7134-cards.c 
b/drivers/media/video/saa7134/saa7134-cards.c
index 0f9fb99..065d0f6 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -5691,6 +5691,27 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE1,
},
},
+   [SAA7134_BOARD_SENSORAY811_911] = {
+   .name   = Sensoray 811/911,
+   .audio_clock= 0x0020,
+   .tuner_type = TUNER_ABSENT,
+   .radio_type = UNSET,
+   .tuner_addr = ADDR_UNSET,
+   .radio_addr = ADDR_UNSET,
+   .inputs = {{
+   .name   = name_comp1,
+   .vmux   = 0,
+   .amux   = LINE1,
+   }, {
+   .name   = name_comp3,
+   .vmux   = 2,
+   .amux   = LINE1,
+   }, {
+   .name   = name_svideo,
+   .vmux   = 8,
+   .amux   = LINE1,
+   } },
+   },
 
 };
 
@@ -6914,6 +6935,18 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subdevice= 0xd136,
.driver_data  = SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2,
}, {
+   .vendor   = PCI_VENDOR_ID_PHILIPS,
+   .device   = PCI_DEVICE_ID_PHILIPS_SAA7133,
+   .subvendor= 0x6000,
+   .subdevice= 0x0811,
+   .driver_data  = SAA7134_BOARD_SENSORAY811_911,
+   }, {
+   .vendor   = PCI_VENDOR_ID_PHILIPS,
+   .device   = PCI_DEVICE_ID_PHILIPS_SAA7133,
+   .subvendor= 0x6000,
+   .subdevice= 0x0911,
+   .driver_data  = SAA7134_BOARD_SENSORAY811_911,
+   }, {
/* --- boards without eeprom + subsystem ID --- */
.vendor   = PCI_VENDOR_ID_PHILIPS,
.device   = PCI_DEVICE_ID_PHILIPS_SAA7134,
diff --git a/drivers/media/video/saa7134/saa7134.h 
b/drivers/media/video/saa7134/saa7134.h
index bc8d6bb..b141464 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -330,6 +330,7 @@ struct saa7134_card_ir {
 #define SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2 185
 #define SAA7134_BOARD_BEHOLD_501186
 #define SAA7134_BOARD_BEHOLD_503FM  187
+#define SAA7134_BOARD_SENSORAY811_911   188
 
 #define SAA7134_MAXBOARDS 32
 #define SAA7134_INPUT_MAX 8

--
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] saa7134: adding Sensoray boards to saa7134 driver

2011-10-25 Thread sensoray-dev
commit cf5886c3dd2f65c817cb6ca5e7202fa3a3bdc872
Author: Dean Anderson linux-...@sensoray.com
Date:   Mon Oct 24 15:46:52 2011 -0700

[media]: saa7134: Adding Sensoray 811 and 911 board models to saa7134 driver

Signed-off-by: Dean Anderson linux-...@sensoray.com

diff --git a/Documentation/video4linux/CARDLIST.saa7134 
b/Documentation/video4linux/CARDLIST.saa7134
index 7efae9b..e7ef38a 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -186,3 +186,4 @@
 185 - MagicPro ProHDTV Pro2 DMB-TH/Hybrid  [17de:d136]
 186 - Beholder BeholdTV 501[5ace:5010]
 187 - Beholder BeholdTV 503 FM [5ace:5030]
+188 - Sensoray 811/911 [6000:0811,6000:0911]
diff --git a/drivers/media/video/saa7134/saa7134-cards.c 
b/drivers/media/video/saa7134/saa7134-cards.c
index 0f9fb99..065d0f6 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -5691,6 +5691,27 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE1,
},
},
+   [SAA7134_BOARD_SENSORAY811_911] = {
+   .name   = Sensoray 811/911,
+   .audio_clock= 0x0020,
+   .tuner_type = TUNER_ABSENT,
+   .radio_type = UNSET,
+   .tuner_addr = ADDR_UNSET,
+   .radio_addr = ADDR_UNSET,
+   .inputs = {{
+   .name   = name_comp1,
+   .vmux   = 0,
+   .amux   = LINE1,
+   }, {
+   .name   = name_comp3,
+   .vmux   = 2,
+   .amux   = LINE1,
+   }, {
+   .name   = name_svideo,
+   .vmux   = 8,
+   .amux   = LINE1,
+   } },
+   },
 
 };
 
@@ -6914,6 +6935,18 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subdevice= 0xd136,
.driver_data  = SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2,
}, {
+   .vendor   = PCI_VENDOR_ID_PHILIPS,
+   .device   = PCI_DEVICE_ID_PHILIPS_SAA7133,
+   .subvendor= 0x6000,
+   .subdevice= 0x0811,
+   .driver_data  = SAA7134_BOARD_SENSORAY811_911,
+   }, {
+   .vendor   = PCI_VENDOR_ID_PHILIPS,
+   .device   = PCI_DEVICE_ID_PHILIPS_SAA7133,
+   .subvendor= 0x6000,
+   .subdevice= 0x0911,
+   .driver_data  = SAA7134_BOARD_SENSORAY811_911,
+   }, {
/* --- boards without eeprom + subsystem ID --- */
.vendor   = PCI_VENDOR_ID_PHILIPS,
.device   = PCI_DEVICE_ID_PHILIPS_SAA7134,
diff --git a/drivers/media/video/saa7134/saa7134.h 
b/drivers/media/video/saa7134/saa7134.h
index bc8d6bb..b141464 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -330,6 +330,7 @@ struct saa7134_card_ir {
 #define SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2 185
 #define SAA7134_BOARD_BEHOLD_501186
 #define SAA7134_BOARD_BEHOLD_503FM  187
+#define SAA7134_BOARD_SENSORAY811_911   188
 
 #define SAA7134_MAXBOARDS 32
 #define SAA7134_INPUT_MAX 8

--
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] bttv: adding Sensoray 611 board to driver.

2011-10-25 Thread sensoray-dev
commit affebd4db94b459f676a14d9bb696c3c2b73643d
Author: Dean Anderson linux-...@sensoray.com
Date:   Tue Oct 25 15:43:55 2011 -0700

[media] bttv: adding Sensoray 611 board to bttv driver

Signed-off-by: Dean Anderson linux-...@sensoray.com

diff --git a/Documentation/video4linux/CARDLIST.bttv 
b/Documentation/video4linux/CARDLIST.bttv
index 4739d56..8948da4 100644
--- a/Documentation/video4linux/CARDLIST.bttv
+++ b/Documentation/video4linux/CARDLIST.bttv
@@ -71,7 +71,7 @@
  70 - Prolink Pixelview PV-BT878P+ (Rev.4C,8E)
  71 - Lifeview FlyVideo 98EZ (capture only) LR51  [1851:1851]
  72 - Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM) [1554:4011]
- 73 - Sensoray 311[6000:0311]
+ 73 - Sensoray 311/611
[6000:0311,6000:0611]
  74 - RemoteVision MX (RV605)
  75 - Powercolor MTV878/ MTV878R/ MTV878F
  76 - Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP) [0e11:0079]
diff --git a/drivers/media/video/bt8xx/bttv-cards.c 
b/drivers/media/video/bt8xx/bttv-cards.c
index 5939021..076b7f2 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -284,7 +284,8 @@ static struct CARD {
{ 0x10b42636, BTTV_BOARD_HAUPPAUGE878,  STB ??? },
{ 0x217d6606, BTTV_BOARD_WINFAST2000,   Leadtek WinFast TV 2000 },
{ 0xfff6f6ff, BTTV_BOARD_WINFAST2000,   Leadtek WinFast TV 2000 },
-   { 0x03116000, BTTV_BOARD_SENSORAY311,   Sensoray 311 },
+   { 0x03116000, BTTV_BOARD_SENSORAY311_611, Sensoray 311 },
+   { 0x06116000, BTTV_BOARD_SENSORAY311_611, Sensoray 611 },
{ 0x00790e11, BTTV_BOARD_WINDVR,Canopus WinDVR PCI },
{ 0xa0fca1a0, BTTV_BOARD_ZOLTRIX,   Face to Face Tvmax },
{ 0x82b2aa6a, BTTV_BOARD_SIMUS_GVC1100, SIMUS GVC1100 },
@@ -1526,10 +1527,10 @@ struct tvcard bttv_tvcards[] = {
GPIO20,22,23: R30,R29,R28
*/
},
-   [BTTV_BOARD_SENSORAY311] = {
+   [BTTV_BOARD_SENSORAY311_611] = {
/* Clay Kunz ck...@mail.arc.nasa.gov */
-   /* you must jumper JP5 for the card to work */
-   .name   = Sensoray 311,
+   /* you must jumper JP5 for the 311 card (PC/104+) to work */
+   .name   = Sensoray 311/611,
.video_inputs   = 5,
/* .audio_inputs= 0, */
.svhs   = 4,
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index c633359..4db8b7d 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -96,7 +96,7 @@
 #define BTTV_BOARD_PV_BT878P_PLUS  0x46
 #define BTTV_BOARD_FLYVIDEO98EZ0x47
 #define BTTV_BOARD_PV_BT878P_9B0x48
-#define BTTV_BOARD_SENSORAY311 0x49
+#define BTTV_BOARD_SENSORAY311_611 0x49
 #define BTTV_BOARD_RV605   0x4a
 #define BTTV_BOARD_POWERCLR_MTV878 0x4b
 #define BTTV_BOARD_WINDVR  0x4c

--
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: cleanup of device structure

2010-06-01 Thread sensoray-dev
s2255drv: cleanup of device structure

From: Dean Anderson linux-...@sensoray.com

cleanup of device structure.
single channel array instead of multiple arrays in device for
each channel property.
simplifies open callback by removing search for channel index.

Priority: normal

Signed-off-by: Dean Anderson linux-...@sensoray.com

 drivers/media/video/s2255drv.c |  724 +++-
 1 files changed, 352 insertions(+), 372 deletions(-)

---

diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 3c7a79f..8ec7c9a 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -191,7 +191,6 @@ struct s2255_bufferi {
 struct s2255_dmaqueue {
struct list_headactive;
struct s2255_dev*dev;
-   int channel;
 };
 
 /* for firmware loading, fw_state */
@@ -226,51 +225,60 @@ struct s2255_pipeinfo {
 };
 
 struct s2255_fmt; /*forward declaration */
+struct s2255_dev;
+
+struct s2255_channel {
+   struct video_device vdev;
+   int resources;
+   struct s2255_dmaqueue   vidq;
+   struct s2255_bufferibuffer;
+   struct s2255_mode   mode;
+   /* jpeg compression */
+   struct v4l2_jpegcompression jc;
+   /* capture parameters (for high quality mode full size) */
+   struct v4l2_captureparm cap_parm;
+   int cur_frame;
+   int last_frame;
+
+   int b_acquire;
+   /* allocated image size */
+   unsigned long   req_image_size;
+   /* received packet size */
+   unsigned long   pkt_size;
+   int bad_payload;
+   unsigned long   frame_count;
+   /* if JPEG image */
+   int jpg_size;
+   /* if channel configured to default state */
+   int configured;
+   wait_queue_head_t   wait_setmode;
+   int setmode_ready;
+   /* video status items */
+   int vidstatus;
+   wait_queue_head_t   wait_vidstatus;
+   int vidstatus_ready;
+   unsigned intwidth;
+   unsigned intheight;
+   const struct s2255_fmt  *fmt;
+   int idx; /* channel number on device, 0-3 */
+};
+
 
 struct s2255_dev {
-   struct video_device vdev[MAX_CHANNELS];
+   struct s2255_channelchannel[MAX_CHANNELS];
struct v4l2_device  v4l2_dev;
-   atomic_tchannels; /* number of channels registered */
+   atomic_tnum_channels;
int frames;
struct mutexlock;
struct mutexopen_lock;
-   int resources[MAX_CHANNELS];
struct usb_device   *udev;
struct usb_interface*interface;
u8  read_endpoint;
-
-   struct s2255_dmaqueue   vidq[MAX_CHANNELS];
struct timer_list   timer;
struct s2255_fw *fw_data;
struct s2255_pipeinfo   pipe;
-   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];
u32 cc; /* current channel */
-   int b_acquire[MAX_CHANNELS];
-   /* allocated image size */
-   unsigned long   req_image_size[MAX_CHANNELS];
-   /* received packet size */
-   unsigned long   pkt_size[MAX_CHANNELS];
-   int bad_payload[MAX_CHANNELS];
-   unsigned long   frame_count[MAX_CHANNELS];
int frame_ready;
-   /* if JPEG image */
-   int jpg_size[MAX_CHANNELS];
-   /* if channel configured to default state */
-   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;
spinlock_t  slock;
/* dsp firmware version (f2255usb.bin) */
@@ -298,16 +306,10 @@ struct s2255_buffer {
 
 struct s2255_fh {
struct s2255_dev*dev;
-   const struct s2255_fmt  *fmt;
-   unsigned intwidth;
-   unsigned int

s2255drv: V4L2_MODE_HIGHQUALITY correction

2010-04-15 Thread sensoray-dev
# HG changeset patch
# User Dean Anderson linux-...@sensoray.com
# Date 1271371256 25200
# Node ID f12b3074bb02dbb9b9d5af3aa816bd53e6b61dd1
# Parent  bffdebcb994ce8c7e493524087f601f7f1134f09
s2255drv: fix for V4L2_MODE_HIGHQUALITY

From: Dean Anderson linux-...@sensoray.com

V4L2 high quality mode not being saved
comments about experimental API removed

Priority: normal

Signed-off-by: Dean Anderson linux-...@sensoray.com

diff -r bffdebcb994c -r f12b3074bb02 linux/drivers/media/video/s2255drv.c
--- a/linux/drivers/media/video/s2255drv.c  Thu Apr 15 08:48:31 2010 -0700
+++ b/linux/drivers/media/video/s2255drv.c  Thu Apr 15 15:40:56 2010 -0700
@@ -23,8 +23,6 @@
  *
  * -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
@@ -127,7 +125,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 */
@@ -1662,6 +1660,7 @@
}
mode.fdec = fdec;
sp-parm.capture.timeperframe.denominator = def_dem;
+   stream-cap_parm = sp-parm.capture;
s2255_set_mode(channel, mode);
dprintk(4, %s capture mode, %d timeperframe %d/%d, fdec %d\n,
__func__,

--
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


s2255drv: V4L2_MODE_HIGHQUALITY fix

2010-04-15 Thread sensoray-dev
# HG changeset patch
# User Dean Anderson linux-...@sensoray.com
# Date 1271371685 25200
# Node ID fae20d178e2cc96d75a43c50e0f84140022091a3
# Parent  f12b3074bb02dbb9b9d5af3aa816bd53e6b61dd1
s2255drv: V4L2 mode high quality fix

From: Dean Anderson linux-...@sensoray.com

fix for last patch in case it is applied. submitted incorrect patch 
(channel/stream).

Priority: high

Signed-off-by: Dean Anderson linux-...@sensoray.com

diff -r f12b3074bb02 -r fae20d178e2c linux/drivers/media/video/s2255drv.c
--- a/linux/drivers/media/video/s2255drv.c  Thu Apr 15 15:40:56 2010 -0700
+++ b/linux/drivers/media/video/s2255drv.c  Thu Apr 15 15:48:05 2010 -0700
@@ -1660,7 +1660,7 @@
}
mode.fdec = fdec;
sp-parm.capture.timeperframe.denominator = def_dem;
-   stream-cap_parm = sp-parm.capture;
+   channel-cap_parm = sp-parm.capture;
s2255_set_mode(channel, mode);
dprintk(4, %s capture mode, %d timeperframe %d/%d, fdec %d\n,
__func__,

--
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: cleanup of device structure

2010-04-12 Thread sensoray-dev
# HG changeset patch
# User Dean Anderson linux-...@sensoray.com
# Date 1271092523 25200
# Node ID 686a2330f4a6a4c79e299a17663f0f150031098e
# Parent  f2f44853e2eb914d4fc6c7004631839b86fb6d0e
s2255drv: cleanup of device structure

From: Dean Anderson linux-...@sensoray.com

cleanup of device structure
better organization of channels instead of multiple arrays in device
simplifies open callback by removing search for channel index
adding v4l2_device_disconnect

Priority: normal

Signed-off-by: Dean Anderson linux-...@sensoray.com

diff -r f2f44853e2eb -r 686a2330f4a6 linux/drivers/media/video/s2255drv.c
--- a/linux/drivers/media/video/s2255drv.c  Fri Apr 09 15:51:28 2010 -0700
+++ b/linux/drivers/media/video/s2255drv.c  Mon Apr 12 10:15:23 2010 -0700
@@ -191,7 +191,6 @@
 struct s2255_dmaqueue {
struct list_headactive;
struct s2255_dev*dev;
-   int channel;
 };
 
 /* for firmware loading, fw_state */
@@ -226,51 +225,60 @@
 };
 
 struct s2255_fmt; /*forward declaration */
+struct s2255_dev;
+
+struct s2255_channel {
+   struct video_device vdev;
+   int resources;
+   struct s2255_dmaqueue   vidq;
+   struct s2255_bufferibuffer;
+   struct s2255_mode   mode;
+   /* jpeg compression */
+   struct v4l2_jpegcompression jc;
+   /* capture parameters (for high quality mode full size) */
+   struct v4l2_captureparm cap_parm;
+   int cur_frame;
+   int last_frame;
+
+   int b_acquire;
+   /* allocated image size */
+   unsigned long   req_image_size;
+   /* received packet size */
+   unsigned long   pkt_size;
+   int bad_payload;
+   unsigned long   frame_count;
+   /* if JPEG image */
+   int jpg_size;
+   /* if channel configured to default state */
+   int configured;
+   wait_queue_head_t   wait_setmode;
+   int setmode_ready;
+   /* video status items */
+   int vidstatus;
+   wait_queue_head_t   wait_vidstatus;
+   int vidstatus_ready;
+   unsigned intwidth;
+   unsigned intheight;
+   const struct s2255_fmt  *fmt;
+   int idx; /* channel number on device, 0-3 */
+};
+
 
 struct s2255_dev {
-   struct video_device vdev[MAX_CHANNELS];
+   struct s2255_channelchannel[MAX_CHANNELS];
struct v4l2_device  v4l2_dev;
-   atomic_tchannels; /* number of channels registered */
+   atomic_tnum_channels;
int frames;
struct mutexlock;
struct mutexopen_lock;
-   int resources[MAX_CHANNELS];
struct usb_device   *udev;
struct usb_interface*interface;
u8  read_endpoint;
-
-   struct s2255_dmaqueue   vidq[MAX_CHANNELS];
struct timer_list   timer;
struct s2255_fw *fw_data;
struct s2255_pipeinfo   pipe;
-   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];
u32 cc; /* current channel */
-   int b_acquire[MAX_CHANNELS];
-   /* allocated image size */
-   unsigned long   req_image_size[MAX_CHANNELS];
-   /* received packet size */
-   unsigned long   pkt_size[MAX_CHANNELS];
-   int bad_payload[MAX_CHANNELS];
-   unsigned long   frame_count[MAX_CHANNELS];
int frame_ready;
-   /* if JPEG image */
-   int jpg_size[MAX_CHANNELS];
-   /* if channel configured to default state */
-   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;
spinlock_t  slock;
/* dsp firmware version (f2255usb.bin) */
@@ -298,16 +306,10 @@
 
 struct s2255_fh {
struct s2255_dev*dev;
-   const struct s2255_fmt  *fmt;
-   unsigned int  

[PATCH] s2255drv: firmware reload on timeout

2010-04-12 Thread sensoray-dev
# HG changeset patch
# User Dean Anderson linux-...@sensoray.com
# Date 1271095297 25200
# Node ID 88db759d6bdf2f352acf3763a8db3787ba8f7215
# Parent  686a2330f4a6a4c79e299a17663f0f150031098e
s2255drv: firmware reload on timeout

From: Dean Anderson linux-...@sensoray.com

Firmware retry on timeout

Priority: normal

Signed-off-by: Dean Anderson linux-...@sensoray.com

diff -r 686a2330f4a6 -r 88db759d6bdf linux/drivers/media/video/s2255drv.c
--- a/linux/drivers/media/video/s2255drv.c  Mon Apr 12 10:15:23 2010 -0700
+++ b/linux/drivers/media/video/s2255drv.c  Mon Apr 12 11:01:37 2010 -0700
@@ -58,7 +58,7 @@
 #include compat.h
 
 #define S2255_MAJOR_VERSION1
-#define S2255_MINOR_VERSION19
+#define S2255_MINOR_VERSION20
 #define S2255_RELEASE  0
 #define S2255_VERSION  KERNEL_VERSION(S2255_MAJOR_VERSION, \
   S2255_MINOR_VERSION, \
@@ -1753,7 +1753,7 @@
 == S2255_FW_SUCCESS) ||
(atomic_read(dev-fw_data-fw_state)
 == S2255_FW_DISCONNECTING)),
-   msecs_to_jiffies(S2255_LOAD_TIMEOUT));
+  msecs_to_jiffies(S2255_LOAD_TIMEOUT));
/* state may have changed, re-read */
state = atomic_read(dev-fw_data-fw_state);
break;
@@ -1761,27 +1761,38 @@
default:
break;
}
-   mutex_unlock(dev-open_lock);
/* state may have changed in above switch statement */
switch (state) {
case S2255_FW_SUCCESS:
break;
case S2255_FW_FAILED:
printk(KERN_INFO 2255 firmware load failed.\n);
+   mutex_unlock(dev-open_lock);
return -ENODEV;
case S2255_FW_DISCONNECTING:
printk(KERN_INFO %s: disconnecting\n, __func__);
+   mutex_unlock(dev-open_lock);
return -ENODEV;
case S2255_FW_LOADED_DSPWAIT:
case S2255_FW_NOTLOADED:
printk(KERN_INFO %s: firmware not loaded yet
   please try again later\n,
   __func__);
+   /*
+* Timeout on firmware load means device unusable.
+* Set firmware failure state.
+* On next s2255_open the firmware will be reloaded.
+*/
+   atomic_set(dev-fw_data-fw_state,
+  S2255_FW_FAILED);
+   mutex_unlock(dev-open_lock);
return -EAGAIN;
default:
printk(KERN_INFO %s: unknown state\n, __func__);
+   mutex_unlock(dev-open_lock);
return -EFAULT;
}
+   mutex_unlock(dev-open_lock);
/* allocate + initialize per filehandle data */
fh = kzalloc(sizeof(*fh), GFP_KERNEL);
if (NULL == fh)
@@ -2074,7 +2085,6 @@
dprintk(5, setmode ready %d\n, cc);
break;
case S2255_RESPONSE_FW:
-
dev-chn_ready |= (1  cc);
if ((dev-chn_ready  0x0f) != 0x0f)
break;

--
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: v4l2_dev bug fix

2010-04-09 Thread sensoray-dev
# HG changeset patch
# User Dean Anderson linux-...@sensoray.com
# Date 1270850190 25200
# Node ID 040de984898870b01dfe553319aa18edb3a442bb
# Parent  f987f637d904a281992844f2b17f805edd4734c2
s2255drv: v4l2_dev fixed

From: Dean Anderson linux-...@sensoray.com

v4l2_dev should be registered once only.
usb_set_intfdata should not be used when using v4l2_device_register
and a non-NULL argument for the device.

Priority: high

Signed-off-by: Dean Anderson linux-...@sensoray.com

diff -r f987f637d904 -r 040de9848988 linux/drivers/media/video/s2255drv.c
--- a/linux/drivers/media/video/s2255drv.c  Fri Apr 09 14:28:44 2010 -0700
+++ b/linux/drivers/media/video/s2255drv.c  Fri Apr 09 14:56:30 2010 -0700
@@ -229,7 +229,7 @@
 
 struct s2255_dev {
struct video_device vdev[MAX_CHANNELS];
-   struct v4l2_device  v4l2_dev[MAX_CHANNELS];
+   struct v4l2_device  v4l2_dev;
int channels; /* number of channels registered */
int frames;
struct mutexlock;
@@ -278,7 +278,14 @@
u16 pid; /* product id */
struct kref kref;
 };
-#define to_s2255_dev(d) container_of(d, struct s2255_dev, kref)
+
+/* kref will be removed soon */
+#define to_s2255_dev_from_kref(d) container_of(d, struct s2255_dev, kref)
+
+static inline struct s2255_dev *to_s2255_dev(struct v4l2_device *v4l2_dev)
+{
+   return container_of(v4l2_dev, struct s2255_dev, v4l2_dev);
+}
 
 struct s2255_fmt {
char *name;
@@ -1829,7 +1836,7 @@
 
 static void s2255_destroy(struct kref *kref)
 {
-   struct s2255_dev *dev = to_s2255_dev(kref);
+   struct s2255_dev *dev = to_s2255_dev_from_kref(kref);
/* board shutdown stops the read pipe if it is running */
s2255_board_shutdown(dev);
/* make sure firmware still not trying to load */
@@ -1947,11 +1954,9 @@
int ret;
int i;
int cur_nr = video_nr;
-   for (i = 0; i  MAX_CHANNELS; i++) {
-   ret = v4l2_device_register(dev-udev-dev, dev-v4l2_dev[i]);
-   if (ret)
-   goto unreg_v4l2;
-   }
+   ret = v4l2_device_register(dev-interface-dev, dev-v4l2_dev);
+   if (ret)
+   return ret;
/* initialize all video 4 linux */
/* register 4 video devices */
for (i = 0; i  MAX_CHANNELS; i++) {
@@ -1976,7 +1981,7 @@
break;
}
dev-channels++;
-   v4l2_info(dev-v4l2_dev[i], V4L2 device registered as %s\n,
+   v4l2_info(dev-v4l2_dev, V4L2 device registered as %s\n,
  video_device_node_name(dev-vdev[i]));
 
}
@@ -1984,15 +1989,13 @@
   S2255_MAJOR_VERSION,
   S2255_MINOR_VERSION);
/* if no channels registered, return error and probe will fail*/
-   if (dev-channels == 0)
+   if (dev-channels == 0) {
+   v4l2_device_unregister(dev-v4l2_dev);
return ret;
+   }
if (dev-channels != MAX_CHANNELS)
printk(KERN_WARNING s2255: Not all channels available.\n);
return 0;
-unreg_v4l2:
-   for (i-- ; i  0; i--)
-   v4l2_device_unregister(dev-v4l2_dev[i]);
-   return ret;
 }
 
 /* this function moves the usb stream read pipe data
@@ -2595,8 +2598,6 @@
dev_err(interface-dev, Could not find bulk-in endpoint\n);
goto errorEP;
}
-   /* set intfdata */
-   usb_set_intfdata(interface, dev);
init_timer(dev-timer);
dev-timer.function = s2255_timer;
dev-timer.data = (unsigned long)dev-fw_data;
@@ -2681,13 +2682,12 @@
return retval;
 }
 
-
 /* disconnect routine. when board is removed physically or with rmmod */
 static void s2255_disconnect(struct usb_interface *interface)
 {
-   struct s2255_dev *dev = NULL;
+   struct s2255_dev *dev = to_s2255_dev(usb_get_intfdata(interface));
int i;
-   dev = usb_get_intfdata(interface);
+   v4l2_device_unregister(dev-v4l2_dev);
/* unregister each video device. */
for (i = 0; i  MAX_CHANNELS; i++)
if (video_is_registered(dev-vdev[i]))
@@ -2701,7 +2701,6 @@
dev-vidstatus_ready[i] = 1;
wake_up(dev-wait_vidstatus[i]);
}
-   usb_set_intfdata(interface, NULL);
kref_put(dev-kref, s2255_destroy);
dev_info(interface-dev, %s\n, __func__);
 }

--
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: removes kref tracking and videodev parent

2010-04-09 Thread sensoray-dev
# HG changeset patch
# User Dean Anderson linux-...@sensoray.com
# Date 1270853488 25200
# Node ID f2f44853e2eb914d4fc6c7004631839b86fb6d0e
# Parent  040de984898870b01dfe553319aa18edb3a442bb
s2255drv: removes kref tracking and videodev parent

From: Dean Anderson linux-...@sensoray.com

kref replaced as suggested in code review
uses atomic variable to track when it is ok to delete device
removes setting of video device parent, which is now
handled in v4l2_device.c

Priority: normal

Signed-off-by: Dean Anderson linux-...@sensoray.com

diff -r 040de9848988 -r f2f44853e2eb linux/drivers/media/video/s2255drv.c
--- a/linux/drivers/media/video/s2255drv.c  Fri Apr 09 14:56:30 2010 -0700
+++ b/linux/drivers/media/video/s2255drv.c  Fri Apr 09 15:51:28 2010 -0700
@@ -230,7 +230,7 @@
 struct s2255_dev {
struct video_device vdev[MAX_CHANNELS];
struct v4l2_device  v4l2_dev;
-   int channels; /* number of channels registered */
+   atomic_tchannels; /* number of channels registered */
int frames;
struct mutexlock;
struct mutexopen_lock;
@@ -276,12 +276,8 @@
/* dsp firmware version (f2255usb.bin) */
int dsp_fw_ver;
u16 pid; /* product id */
-   struct kref kref;
 };
 
-/* kref will be removed soon */
-#define to_s2255_dev_from_kref(d) container_of(d, struct s2255_dev, kref)
-
 static inline struct s2255_dev *to_s2255_dev(struct v4l2_device *v4l2_dev)
 {
return container_of(v4l2_dev, struct s2255_dev, v4l2_dev);
@@ -372,7 +368,7 @@
  struct s2255_mode *mode);
 static int s2255_board_shutdown(struct s2255_dev *dev);
 static void s2255_fwload_start(struct s2255_dev *dev, int reset);
-static void s2255_destroy(struct kref *kref);
+static void s2255_destroy(struct s2255_dev *dev);
 static long s2255_vendor_req(struct s2255_dev *dev, unsigned char req,
 u16 index, u16 value, void *buf,
 s32 buf_len, int bOut);
@@ -1720,7 +1716,7 @@
dprintk(1, s2255: open called (dev=%s)\n,
video_device_node_name(vdev));
 
-   for (i = 0; i  dev-channels; i++)
+   for (i = 0; i  MAX_CHANNELS; i++)
if (dev-vdev[i] == vdev) {
cur_channel = i;
break;
@@ -1834,9 +1830,8 @@
return rc;
 }
 
-static void s2255_destroy(struct kref *kref)
+static void s2255_destroy(struct s2255_dev *dev)
 {
-   struct s2255_dev *dev = to_s2255_dev_from_kref(kref);
/* board shutdown stops the read pipe if it is running */
s2255_board_shutdown(dev);
/* make sure firmware still not trying to load */
@@ -1936,7 +1931,9 @@
 static void s2255_video_device_release(struct video_device *vdev)
 {
struct s2255_dev *dev = video_get_drvdata(vdev);
-   kref_put(dev-kref, s2255_destroy);
+   dprintk(4, %s, chnls: %d \n, __func__, atomic_read(dev-channels));
+   if (atomic_dec_and_test(dev-channels))
+   s2255_destroy(dev);
return;
 }
 
@@ -1965,7 +1962,8 @@
dev-vidq[i].channel = i;
/* register 4 video devices */
memcpy(dev-vdev[i], template, sizeof(struct video_device));
-   dev-vdev[i].parent = dev-interface-dev;
+   dev-vdev[i].v4l2_dev = dev-v4l2_dev;
+   video_set_drvdata(dev-vdev[i], dev);
if (video_nr == -1)
ret = video_register_device(dev-vdev[i],
VFL_TYPE_GRABBER,
@@ -1974,13 +1972,12 @@
ret = video_register_device(dev-vdev[i],
VFL_TYPE_GRABBER,
cur_nr + i);
-   video_set_drvdata(dev-vdev[i], dev);
if (ret) {
dev_err(dev-udev-dev,
failed to register video device!\n);
break;
}
-   dev-channels++;
+   atomic_inc(dev-channels);
v4l2_info(dev-v4l2_dev, V4L2 device registered as %s\n,
  video_device_node_name(dev-vdev[i]));
 
@@ -1989,11 +1986,11 @@
   S2255_MAJOR_VERSION,
   S2255_MINOR_VERSION);
/* if no channels registered, return error and probe will fail*/
-   if (dev-channels == 0) {
+   if (atomic_read(dev-channels) == 0) {
v4l2_device_unregister(dev-v4l2_dev);
return ret;
}
-   if (dev-channels != MAX_CHANNELS)
+   if (atomic_read(dev-channels) != MAX_CHANNELS)
printk(KERN_WARNING s2255: Not all channels available.\n);
return 0;
 }
@@ -2566,7 +2563,7 @@
s2255_dev_err(interface-dev, out of 

s2255drv: pull request

2010-04-07 Thread sensoray-dev
Hi Mauro, Could you please pull the following 2255 patches? 


https://patchwork.kernel.org/patch/89099/
https://patchwork.kernel.org/patch/89100/
https://patchwork.kernel.org/patch/89957/
https://patchwork.kernel.org/patch/89958/ 

Also, the official email maintainer(s) contact for the 2255 driver is
now linux-...@sensoray.com.  I'll add it to the driver comments in a
later patch.


Thank and best regards,

Dean Anderson
linux-...@sensoray.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