mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 05:02:12 +00:00
V4L/DVB: Staging: tm6000: Fix coding style issues
Fixed coding style issues founded by checkpatch.pl in files: tm6000-alsa.c,tm6000-cards, tm6000-core.c, tm6000-dvb.c, tm6000-i2c.c, tm6000-stds.c, tm6000-usb-isoc.h, tm6000.h [mchehab@redhat.com: Fix some compilation breakages] Signed-off-by: Timofey Trofimov <tumoxep@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
cee3926f5f
commit
52e0a72a0c
@ -705,7 +705,7 @@ static void get_max_endpoint(struct usb_device *udev,
|
||||
unsigned int size = tmp & 0x7ff;
|
||||
|
||||
if (udev->speed == USB_SPEED_HIGH)
|
||||
size = size * hb_mult (tmp);
|
||||
size = size * hb_mult(tmp);
|
||||
|
||||
if (size > tm_ep->maxsize) {
|
||||
tm_ep->endp = curr_e;
|
||||
|
@ -32,66 +32,64 @@
|
||||
|
||||
#define USB_TIMEOUT 5*HZ /* ms */
|
||||
|
||||
int tm6000_read_write_usb (struct tm6000_core *dev, u8 req_type, u8 req,
|
||||
u16 value, u16 index, u8 *buf, u16 len)
|
||||
int tm6000_read_write_usb(struct tm6000_core *dev, u8 req_type, u8 req,
|
||||
u16 value, u16 index, u8 *buf, u16 len)
|
||||
{
|
||||
int ret, i;
|
||||
unsigned int pipe;
|
||||
static int ini=0, last=0, n=0;
|
||||
u8 *data=NULL;
|
||||
static int ini = 0, last = 0, n = 0;
|
||||
u8 *data = NULL;
|
||||
|
||||
if (len)
|
||||
data = kzalloc(len, GFP_KERNEL);
|
||||
|
||||
|
||||
if (req_type & USB_DIR_IN)
|
||||
pipe=usb_rcvctrlpipe(dev->udev, 0);
|
||||
pipe = usb_rcvctrlpipe(dev->udev, 0);
|
||||
else {
|
||||
pipe=usb_sndctrlpipe(dev->udev, 0);
|
||||
pipe = usb_sndctrlpipe(dev->udev, 0);
|
||||
memcpy(data, buf, len);
|
||||
}
|
||||
|
||||
if (tm6000_debug & V4L2_DEBUG_I2C) {
|
||||
if (!ini)
|
||||
last=ini=jiffies;
|
||||
last = ini = jiffies;
|
||||
|
||||
printk("%06i (dev %p, pipe %08x): ", n, dev->udev, pipe);
|
||||
|
||||
printk( "%s: %06u ms %06u ms %02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(req_type & USB_DIR_IN)?" IN":"OUT",
|
||||
printk("%s: %06u ms %06u ms %02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(req_type & USB_DIR_IN) ? " IN" : "OUT",
|
||||
jiffies_to_msecs(jiffies-last),
|
||||
jiffies_to_msecs(jiffies-ini),
|
||||
req_type, req,value&0xff,value>>8, index&0xff, index>>8,
|
||||
len&0xff, len>>8);
|
||||
last=jiffies;
|
||||
req_type, req, value&0xff, value>>8, index&0xff,
|
||||
index>>8, len&0xff, len>>8);
|
||||
last = jiffies;
|
||||
n++;
|
||||
|
||||
if ( !(req_type & USB_DIR_IN) ) {
|
||||
if (!(req_type & USB_DIR_IN)) {
|
||||
printk(">>> ");
|
||||
for (i=0;i<len;i++) {
|
||||
printk(" %02x",buf[i]);
|
||||
}
|
||||
for (i = 0; i < len; i++)
|
||||
printk(" %02x", buf[i]);
|
||||
printk("\n");
|
||||
}
|
||||
}
|
||||
|
||||
ret = usb_control_msg(dev->udev, pipe, req, req_type, value, index, data,
|
||||
len, USB_TIMEOUT);
|
||||
ret = usb_control_msg(dev->udev, pipe, req, req_type, value, index,
|
||||
data, len, USB_TIMEOUT);
|
||||
|
||||
if (req_type & USB_DIR_IN)
|
||||
memcpy(buf, data, len);
|
||||
|
||||
if (tm6000_debug & V4L2_DEBUG_I2C) {
|
||||
if (ret<0) {
|
||||
if (ret < 0) {
|
||||
if (req_type & USB_DIR_IN)
|
||||
printk("<<< (len=%d)\n",len);
|
||||
printk("<<< (len=%d)\n", len);
|
||||
|
||||
printk("%s: Error #%d\n", __FUNCTION__, ret);
|
||||
} else if (req_type & USB_DIR_IN) {
|
||||
printk("<<< ");
|
||||
for (i=0;i<len;i++) {
|
||||
printk(" %02x",buf[i]);
|
||||
}
|
||||
for (i = 0; i < len; i++)
|
||||
printk(" %02x", buf[i]);
|
||||
printk("\n");
|
||||
}
|
||||
}
|
||||
@ -103,52 +101,52 @@ int tm6000_read_write_usb (struct tm6000_core *dev, u8 req_type, u8 req,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index)
|
||||
int tm6000_set_reg(struct tm6000_core *dev, u8 req, u16 value, u16 index)
|
||||
{
|
||||
return
|
||||
tm6000_read_write_usb (dev, USB_DIR_OUT | USB_TYPE_VENDOR,
|
||||
req, value, index, NULL, 0);
|
||||
tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR,
|
||||
req, value, index, NULL, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tm6000_set_reg);
|
||||
|
||||
int tm6000_get_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index)
|
||||
int tm6000_get_reg(struct tm6000_core *dev, u8 req, u16 value, u16 index)
|
||||
{
|
||||
int rc;
|
||||
u8 buf[1];
|
||||
|
||||
rc=tm6000_read_write_usb (dev, USB_DIR_IN | USB_TYPE_VENDOR, req,
|
||||
value, index, buf, 1);
|
||||
rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR, req,
|
||||
value, index, buf, 1);
|
||||
|
||||
if (rc<0)
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
return *buf;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tm6000_get_reg);
|
||||
|
||||
int tm6000_get_reg16 (struct tm6000_core *dev, u8 req, u16 value, u16 index)
|
||||
int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index)
|
||||
{
|
||||
int rc;
|
||||
u8 buf[2];
|
||||
|
||||
rc=tm6000_read_write_usb (dev, USB_DIR_IN | USB_TYPE_VENDOR, req,
|
||||
value, index, buf, 2);
|
||||
rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR, req,
|
||||
value, index, buf, 2);
|
||||
|
||||
if (rc<0)
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
return buf[1]|buf[0]<<8;
|
||||
}
|
||||
|
||||
int tm6000_get_reg32 (struct tm6000_core *dev, u8 req, u16 value, u16 index)
|
||||
int tm6000_get_reg32(struct tm6000_core *dev, u8 req, u16 value, u16 index)
|
||||
{
|
||||
int rc;
|
||||
u8 buf[4];
|
||||
|
||||
rc=tm6000_read_write_usb (dev, USB_DIR_IN | USB_TYPE_VENDOR, req,
|
||||
value, index, buf, 4);
|
||||
rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR, req,
|
||||
value, index, buf, 4);
|
||||
|
||||
if (rc<0)
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
return buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24;
|
||||
@ -188,7 +186,7 @@ void tm6000_set_fourcc_format(struct tm6000_core *dev)
|
||||
}
|
||||
}
|
||||
|
||||
int tm6000_init_analog_mode (struct tm6000_core *dev)
|
||||
int tm6000_init_analog_mode(struct tm6000_core *dev)
|
||||
{
|
||||
if (dev->dev_type == TM6010) {
|
||||
int val;
|
||||
@ -294,12 +292,10 @@ int tm6000_init_analog_mode (struct tm6000_core *dev)
|
||||
/* Enables soft reset */
|
||||
tm6000_set_reg(dev, TM6010_REQ07_R3F_RESET, 0x01);
|
||||
|
||||
if (dev->scaler) {
|
||||
if (dev->scaler)
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x20);
|
||||
} else {
|
||||
/* Enable Hfilter and disable TS Drop err */
|
||||
else /* Enable Hfilter and disable TS Drop err */
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x80);
|
||||
}
|
||||
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RC3_HSTART1, 0x88);
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0x23);
|
||||
@ -332,13 +328,13 @@ int tm6000_init_analog_mode (struct tm6000_core *dev)
|
||||
/*FIXME: Hack!!! */
|
||||
struct v4l2_frequency f;
|
||||
mutex_lock(&dev->lock);
|
||||
f.frequency=dev->freq;
|
||||
f.frequency = dev->freq;
|
||||
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
|
||||
mutex_unlock(&dev->lock);
|
||||
|
||||
msleep(100);
|
||||
tm6000_set_standard (dev, &dev->norm);
|
||||
tm6000_set_audio_bitrate (dev,48000);
|
||||
tm6000_set_standard(dev, &dev->norm);
|
||||
tm6000_set_audio_bitrate(dev, 48000);
|
||||
|
||||
/* switch dvb led off */
|
||||
if (dev->gpio.dvb_led) {
|
||||
@ -349,7 +345,7 @@ int tm6000_init_analog_mode (struct tm6000_core *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tm6000_init_digital_mode (struct tm6000_core *dev)
|
||||
int tm6000_init_digital_mode(struct tm6000_core *dev)
|
||||
{
|
||||
if (dev->dev_type == TM6010) {
|
||||
int val;
|
||||
@ -366,10 +362,8 @@ int tm6000_init_digital_mode (struct tm6000_core *dev)
|
||||
tm6000_set_reg(dev, TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xfc);
|
||||
tm6000_set_reg(dev, TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0xff);
|
||||
tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe);
|
||||
tm6000_read_write_usb (dev, 0xc0, 0x0e, 0x00c2, 0x0008, buf, 2);
|
||||
printk (KERN_INFO "buf %#x %#x \n", buf[0], buf[1]);
|
||||
|
||||
|
||||
tm6000_read_write_usb(dev, 0xc0, 0x0e, 0x00c2, 0x0008, buf, 2);
|
||||
printk(KERN_INFO"buf %#x %#x\n", buf[0], buf[1]);
|
||||
} else {
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x08);
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x00);
|
||||
@ -377,7 +371,7 @@ int tm6000_init_digital_mode (struct tm6000_core *dev)
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_PULSE_CNT0, 0x08);
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RE2_OUT_SEL2, 0x0c);
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RE8_TYPESEL_MOS_I2S, 0xff);
|
||||
tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0xd8);
|
||||
tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0x00eb, 0xd8);
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x40);
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RC1_TRESHOLD, 0xd0);
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RC3_HSTART1, 0x09);
|
||||
@ -388,14 +382,14 @@ int tm6000_init_digital_mode (struct tm6000_core *dev)
|
||||
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RE2_OUT_SEL2, 0x0c);
|
||||
tm6000_set_reg(dev, TM6010_REQ07_RE8_TYPESEL_MOS_I2S, 0xff);
|
||||
tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0x08);
|
||||
tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0x00eb, 0x08);
|
||||
msleep(50);
|
||||
|
||||
tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00);
|
||||
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00);
|
||||
msleep(50);
|
||||
tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x01);
|
||||
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x01);
|
||||
msleep(50);
|
||||
tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00);
|
||||
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00);
|
||||
msleep(100);
|
||||
}
|
||||
|
||||
@ -567,9 +561,9 @@ struct reg_init tm6010_init_tab[] = {
|
||||
{ TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0xff },
|
||||
};
|
||||
|
||||
int tm6000_init (struct tm6000_core *dev)
|
||||
int tm6000_init(struct tm6000_core *dev)
|
||||
{
|
||||
int board, rc=0, i, size;
|
||||
int board, rc = 0, i, size;
|
||||
struct reg_init *tab;
|
||||
|
||||
if (dev->dev_type == TM6010) {
|
||||
@ -581,12 +575,12 @@ int tm6000_init (struct tm6000_core *dev)
|
||||
}
|
||||
|
||||
/* Load board's initialization table */
|
||||
for (i=0; i< size; i++) {
|
||||
rc= tm6000_set_reg (dev, tab[i].req, tab[i].reg, tab[i].val);
|
||||
if (rc<0) {
|
||||
printk (KERN_ERR "Error %i while setting req %d, "
|
||||
"reg %d to value %d\n", rc,
|
||||
tab[i].req,tab[i].reg, tab[i].val);
|
||||
for (i = 0; i < size; i++) {
|
||||
rc = tm6000_set_reg(dev, tab[i].req, tab[i].reg, tab[i].val);
|
||||
if (rc < 0) {
|
||||
printk(KERN_ERR "Error %i while setting req %d, "
|
||||
"reg %d to value %d\n", rc,
|
||||
tab[i].req, tab[i].reg, tab[i].val);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@ -594,12 +588,11 @@ int tm6000_init (struct tm6000_core *dev)
|
||||
msleep(5); /* Just to be conservative */
|
||||
|
||||
/* Check board version - maybe 10Moons specific */
|
||||
board=tm6000_get_reg32 (dev, REQ_40_GET_VERSION, 0, 0);
|
||||
if (board >=0) {
|
||||
printk (KERN_INFO "Board version = 0x%08x\n",board);
|
||||
} else {
|
||||
printk (KERN_ERR "Error %i while retrieving board version\n",board);
|
||||
}
|
||||
board = tm6000_get_reg32(dev, REQ_40_GET_VERSION, 0, 0);
|
||||
if (board >= 0)
|
||||
printk(KERN_INFO "Board version = 0x%08x\n", board);
|
||||
else
|
||||
printk(KERN_ERR "Error %i while retrieving board version\n", board);
|
||||
|
||||
rc = tm6000_cards_setup(dev);
|
||||
|
||||
@ -610,23 +603,23 @@ int tm6000_set_audio_bitrate(struct tm6000_core *dev, int bitrate)
|
||||
{
|
||||
int val;
|
||||
|
||||
val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x0);
|
||||
printk("Original value=%d\n",val);
|
||||
if (val<0)
|
||||
val = tm6000_get_reg(dev, REQ_07_SET_GET_AVREG, 0xeb, 0x0);
|
||||
printk("Original value=%d\n", val);
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
||||
val &= 0x0f; /* Preserve the audio input control bits */
|
||||
switch (bitrate) {
|
||||
case 44100:
|
||||
val|=0xd0;
|
||||
dev->audio_bitrate=bitrate;
|
||||
val |= 0xd0;
|
||||
dev->audio_bitrate = bitrate;
|
||||
break;
|
||||
case 48000:
|
||||
val|=0x60;
|
||||
dev->audio_bitrate=bitrate;
|
||||
val |= 0x60;
|
||||
dev->audio_bitrate = bitrate;
|
||||
break;
|
||||
}
|
||||
val=tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, val);
|
||||
val = tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xeb, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -44,12 +44,12 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "enable debug message");
|
||||
|
||||
static void inline print_err_status (struct tm6000_core *dev,
|
||||
int packet, int status)
|
||||
static inline void print_err_status(struct tm6000_core *dev,
|
||||
int packet, int status)
|
||||
{
|
||||
char *errmsg = "Unknown";
|
||||
|
||||
switch(status) {
|
||||
switch (status) {
|
||||
case -ENOENT:
|
||||
errmsg = "unlinked synchronuously";
|
||||
break;
|
||||
@ -75,7 +75,7 @@ static void inline print_err_status (struct tm6000_core *dev,
|
||||
errmsg = "Device does not respond";
|
||||
break;
|
||||
}
|
||||
if (packet<0) {
|
||||
if (packet < 0) {
|
||||
dprintk(dev, 1, "URB status %d [%s].\n",
|
||||
status, errmsg);
|
||||
} else {
|
||||
@ -87,19 +87,17 @@ static void inline print_err_status (struct tm6000_core *dev,
|
||||
static void tm6000_urb_received(struct urb *urb)
|
||||
{
|
||||
int ret;
|
||||
struct tm6000_core* dev = urb->context;
|
||||
struct tm6000_core *dev = urb->context;
|
||||
|
||||
if(urb->status != 0) {
|
||||
print_err_status (dev,0,urb->status);
|
||||
}
|
||||
else if(urb->actual_length>0){
|
||||
if (urb->status != 0)
|
||||
print_err_status(dev, 0, urb->status);
|
||||
else if (urb->actual_length > 0)
|
||||
dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer,
|
||||
urb->actual_length);
|
||||
}
|
||||
|
||||
if(dev->dvb->streams > 0) {
|
||||
if (dev->dvb->streams > 0) {
|
||||
ret = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if(ret < 0) {
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "tm6000: error %s\n", __FUNCTION__);
|
||||
kfree(urb->transfer_buffer);
|
||||
usb_free_urb(urb);
|
||||
@ -113,7 +111,7 @@ int tm6000_start_stream(struct tm6000_core *dev)
|
||||
unsigned int pipe, size;
|
||||
struct tm6000_dvb *dvb = dev->dvb;
|
||||
|
||||
printk(KERN_INFO "tm6000: got start stream request %s\n",__FUNCTION__);
|
||||
printk(KERN_INFO "tm6000: got start stream request %s\n", __FUNCTION__);
|
||||
|
||||
if (dev->mode != TM6000_MODE_DIGITAL) {
|
||||
tm6000_init_digital_mode(dev);
|
||||
@ -121,7 +119,7 @@ int tm6000_start_stream(struct tm6000_core *dev)
|
||||
}
|
||||
|
||||
dvb->bulk_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if(dvb->bulk_urb == NULL) {
|
||||
if (dvb->bulk_urb == NULL) {
|
||||
printk(KERN_ERR "tm6000: couldn't allocate urb\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
@ -133,7 +131,7 @@ int tm6000_start_stream(struct tm6000_core *dev)
|
||||
size = size * 15; /* 512 x 8 or 12 or 15 */
|
||||
|
||||
dvb->bulk_urb->transfer_buffer = kzalloc(size, GFP_KERNEL);
|
||||
if(dvb->bulk_urb->transfer_buffer == NULL) {
|
||||
if (dvb->bulk_urb->transfer_buffer == NULL) {
|
||||
usb_free_urb(dvb->bulk_urb);
|
||||
printk(KERN_ERR "tm6000: couldn't allocate transfer buffer!\n");
|
||||
return -ENOMEM;
|
||||
@ -145,20 +143,20 @@ int tm6000_start_stream(struct tm6000_core *dev)
|
||||
tm6000_urb_received, dev);
|
||||
|
||||
ret = usb_clear_halt(dev->udev, pipe);
|
||||
if(ret < 0) {
|
||||
printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",ret,__FUNCTION__);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",
|
||||
ret, __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
} else
|
||||
printk(KERN_ERR "tm6000: pipe resetted\n");
|
||||
}
|
||||
|
||||
/* mutex_lock(&tm6000_driver.open_close_mutex); */
|
||||
ret = usb_submit_urb(dvb->bulk_urb, GFP_KERNEL);
|
||||
|
||||
/* mutex_unlock(&tm6000_driver.open_close_mutex); */
|
||||
if (ret) {
|
||||
printk(KERN_ERR "tm6000: submit of urb failed (error=%i)\n",ret);
|
||||
printk(KERN_ERR "tm6000: submit of urb failed (error=%i)\n",
|
||||
ret);
|
||||
|
||||
kfree(dvb->bulk_urb->transfer_buffer);
|
||||
usb_free_urb(dvb->bulk_urb);
|
||||
@ -172,10 +170,10 @@ void tm6000_stop_stream(struct tm6000_core *dev)
|
||||
{
|
||||
struct tm6000_dvb *dvb = dev->dvb;
|
||||
|
||||
if(dvb->bulk_urb) {
|
||||
printk (KERN_INFO "urb killing\n");
|
||||
if (dvb->bulk_urb) {
|
||||
printk(KERN_INFO "urb killing\n");
|
||||
usb_kill_urb(dvb->bulk_urb);
|
||||
printk (KERN_INFO "urb buffer free\n");
|
||||
printk(KERN_INFO "urb buffer free\n");
|
||||
kfree(dvb->bulk_urb->transfer_buffer);
|
||||
usb_free_urb(dvb->bulk_urb);
|
||||
dvb->bulk_urb = NULL;
|
||||
@ -187,35 +185,34 @@ int tm6000_start_feed(struct dvb_demux_feed *feed)
|
||||
struct dvb_demux *demux = feed->demux;
|
||||
struct tm6000_core *dev = demux->priv;
|
||||
struct tm6000_dvb *dvb = dev->dvb;
|
||||
printk(KERN_INFO "tm6000: got start feed request %s\n",__FUNCTION__);
|
||||
printk(KERN_INFO "tm6000: got start feed request %s\n", __FUNCTION__);
|
||||
|
||||
mutex_lock(&dvb->mutex);
|
||||
if(dvb->streams == 0) {
|
||||
if (dvb->streams == 0) {
|
||||
dvb->streams = 1;
|
||||
/* mutex_init(&tm6000_dev->streming_mutex); */
|
||||
tm6000_start_stream(dev);
|
||||
}
|
||||
else {
|
||||
} else
|
||||
++(dvb->streams);
|
||||
}
|
||||
mutex_unlock(&dvb->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tm6000_stop_feed(struct dvb_demux_feed *feed) {
|
||||
int tm6000_stop_feed(struct dvb_demux_feed *feed)
|
||||
{
|
||||
struct dvb_demux *demux = feed->demux;
|
||||
struct tm6000_core *dev = demux->priv;
|
||||
struct tm6000_dvb *dvb = dev->dvb;
|
||||
|
||||
printk(KERN_INFO "tm6000: got stop feed request %s\n",__FUNCTION__);
|
||||
printk(KERN_INFO "tm6000: got stop feed request %s\n", __FUNCTION__);
|
||||
|
||||
mutex_lock(&dvb->mutex);
|
||||
|
||||
printk (KERN_INFO "stream %#x\n", dvb->streams);
|
||||
printk(KERN_INFO "stream %#x\n", dvb->streams);
|
||||
--(dvb->streams);
|
||||
if(dvb->streams == 0) {
|
||||
printk (KERN_INFO "stop stream\n");
|
||||
if (dvb->streams == 0) {
|
||||
printk(KERN_INFO "stop stream\n");
|
||||
tm6000_stop_stream(dev);
|
||||
/* mutex_destroy(&tm6000_dev->streaming_mutex); */
|
||||
}
|
||||
@ -229,9 +226,9 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev)
|
||||
{
|
||||
struct tm6000_dvb *dvb = dev->dvb;
|
||||
|
||||
if(dev->caps.has_zl10353) {
|
||||
struct zl10353_config config =
|
||||
{.demod_address = dev->demod_addr,
|
||||
if (dev->caps.has_zl10353) {
|
||||
struct zl10353_config config = {
|
||||
.demod_address = dev->demod_addr,
|
||||
.no_tuner = 1,
|
||||
.parallel_ts = 1,
|
||||
.if2 = 45700,
|
||||
@ -240,8 +237,7 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev)
|
||||
|
||||
dvb->frontend = dvb_attach(zl10353_attach, &config,
|
||||
&dev->i2c_adap);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printk(KERN_ERR "tm6000: no frontend defined for the device!\n");
|
||||
return -1;
|
||||
}
|
||||
@ -262,13 +258,13 @@ int register_dvb(struct tm6000_core *dev)
|
||||
|
||||
/* attach the frontend */
|
||||
ret = tm6000_dvb_attach_frontend(dev);
|
||||
if(ret < 0) {
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "tm6000: couldn't attach the frontend!\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T",
|
||||
THIS_MODULE, &dev->udev->dev, adapter_nr);
|
||||
THIS_MODULE, &dev->udev->dev, adapter_nr);
|
||||
dvb->adapter.priv = dev;
|
||||
|
||||
if (dvb->frontend) {
|
||||
@ -321,9 +317,8 @@ int register_dvb(struct tm6000_core *dev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
printk(KERN_ERR "tm6000: no frontend found\n");
|
||||
}
|
||||
|
||||
dvb->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING
|
||||
| DMX_MEMORY_BASED_FILTERING;
|
||||
@ -334,7 +329,7 @@ int register_dvb(struct tm6000_core *dev)
|
||||
dvb->demux.stop_feed = tm6000_stop_feed;
|
||||
dvb->demux.write_to_decoder = NULL;
|
||||
ret = dvb_dmx_init(&dvb->demux);
|
||||
if(ret < 0) {
|
||||
if (ret < 0) {
|
||||
printk("tm6000: dvb_dmx_init failed (errno = %d)\n", ret);
|
||||
goto frontend_err;
|
||||
}
|
||||
@ -344,7 +339,7 @@ int register_dvb(struct tm6000_core *dev)
|
||||
dvb->dmxdev.capabilities = 0;
|
||||
|
||||
ret = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
|
||||
if(ret < 0) {
|
||||
if (ret < 0) {
|
||||
printk("tm6000: dvb_dmxdev_init failed (errno = %d)\n", ret);
|
||||
goto dvb_dmx_err;
|
||||
}
|
||||
@ -354,7 +349,7 @@ int register_dvb(struct tm6000_core *dev)
|
||||
dvb_dmx_err:
|
||||
dvb_dmx_release(&dvb->demux);
|
||||
frontend_err:
|
||||
if(dvb->frontend) {
|
||||
if (dvb->frontend) {
|
||||
dvb_frontend_detach(dvb->frontend);
|
||||
dvb_unregister_frontend(dvb->frontend);
|
||||
}
|
||||
@ -368,7 +363,7 @@ void unregister_dvb(struct tm6000_core *dev)
|
||||
{
|
||||
struct tm6000_dvb *dvb = dev->dvb;
|
||||
|
||||
if(dvb->bulk_urb != NULL) {
|
||||
if (dvb->bulk_urb != NULL) {
|
||||
struct urb *bulk_urb = dvb->bulk_urb;
|
||||
|
||||
kfree(bulk_urb->transfer_buffer);
|
||||
@ -378,7 +373,7 @@ void unregister_dvb(struct tm6000_core *dev)
|
||||
}
|
||||
|
||||
/* mutex_lock(&tm6000_driver.open_close_mutex); */
|
||||
if(dvb->frontend) {
|
||||
if (dvb->frontend) {
|
||||
dvb_frontend_detach(dvb->frontend);
|
||||
dvb_unregister_frontend(dvb->frontend);
|
||||
}
|
||||
@ -388,7 +383,6 @@ void unregister_dvb(struct tm6000_core *dev)
|
||||
dvb_unregister_adapter(&dvb->adapter);
|
||||
mutex_destroy(&dvb->mutex);
|
||||
/* mutex_unlock(&tm6000_driver.open_close_mutex); */
|
||||
|
||||
}
|
||||
|
||||
static int dvb_init(struct tm6000_core *dev)
|
||||
|
@ -40,7 +40,7 @@ static unsigned int i2c_debug = 0;
|
||||
module_param(i2c_debug, int, 0644);
|
||||
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
|
||||
|
||||
#define i2c_dprintk(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \
|
||||
#define i2c_dprintk(lvl, fmt, args...) if (i2c_debug >= lvl) do { \
|
||||
printk(KERN_DEBUG "%s at %s: " fmt, \
|
||||
dev->name, __FUNCTION__ , ##args); } while (0)
|
||||
|
||||
@ -171,7 +171,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
|
||||
return 0;
|
||||
for (i = 0; i < num; i++) {
|
||||
addr = (msgs[i].addr << 1) & 0xff;
|
||||
i2c_dprintk(2,"%s %s addr=0x%x len=%d:",
|
||||
i2c_dprintk(2, "%s %s addr=0x%x len=%d:",
|
||||
(msgs[i].flags & I2C_M_RD) ? "read" : "write",
|
||||
i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len);
|
||||
if (msgs[i].flags & I2C_M_RD) {
|
||||
@ -235,7 +235,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
|
||||
|
||||
return num;
|
||||
err:
|
||||
i2c_dprintk(2," ERROR: %i\n", rc);
|
||||
i2c_dprintk(2, " ERROR: %i\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -266,11 +266,10 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev,
|
||||
if (0 == (i % 16))
|
||||
printk(KERN_INFO "%s: i2c eeprom %02x:", dev->name, i);
|
||||
printk(" %02x", eedata[i]);
|
||||
if ((eedata[i] >= ' ') && (eedata[i] <= 'z')) {
|
||||
if ((eedata[i] >= ' ') && (eedata[i] <= 'z'))
|
||||
bytes[i%16] = eedata[i];
|
||||
} else {
|
||||
bytes[i%16]='.';
|
||||
}
|
||||
else
|
||||
bytes[i%16] = '.';
|
||||
|
||||
i++;
|
||||
|
||||
@ -305,15 +304,15 @@ static u32 functionality(struct i2c_adapter *adap)
|
||||
}
|
||||
|
||||
#define mass_write(addr, reg, data...) \
|
||||
{ const static u8 _val[] = data; \
|
||||
rc=tm6000_read_write_usb(dev,USB_DIR_OUT | USB_TYPE_VENDOR, \
|
||||
REQ_16_SET_GET_I2C_WR1_RDN,(reg<<8)+addr, 0x00, (u8 *) _val, \
|
||||
{ static const u8 _val[] = data; \
|
||||
rc = tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR, \
|
||||
REQ_16_SET_GET_I2C_WR1_RDN, (reg<<8)+addr, 0x00, (u8 *) _val, \
|
||||
ARRAY_SIZE(_val)); \
|
||||
if (rc<0) { \
|
||||
printk(KERN_ERR "Error on line %d: %d\n",__LINE__,rc); \
|
||||
if (rc < 0) { \
|
||||
printk(KERN_ERR "Error on line %d: %d\n", __LINE__, rc); \
|
||||
return rc; \
|
||||
} \
|
||||
msleep (10); \
|
||||
msleep(10); \
|
||||
}
|
||||
|
||||
static struct i2c_algorithm tm6000_algo = {
|
||||
|
@ -763,11 +763,11 @@ static struct tm6000_std_settings svideo_stds[] = {
|
||||
void tm6000_get_std_res(struct tm6000_core *dev)
|
||||
{
|
||||
/* Currently, those are the only supported resoltions */
|
||||
if (dev->norm & V4L2_STD_525_60) {
|
||||
if (dev->norm & V4L2_STD_525_60)
|
||||
dev->height = 480;
|
||||
} else {
|
||||
else
|
||||
dev->height = 576;
|
||||
}
|
||||
|
||||
dev->width = 720;
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// Use the tm6000-hack, instead of the proper initialization code
|
||||
//#define HACK 1
|
||||
/* Use the tm6000-hack, instead of the proper initialization code i*/
|
||||
/* #define HACK 1 */
|
||||
|
||||
#include <linux/videodev2.h>
|
||||
#include <media/v4l2-common.h>
|
||||
@ -98,7 +98,7 @@ enum tm6000_io_method {
|
||||
};
|
||||
|
||||
enum tm6000_mode {
|
||||
TM6000_MODE_UNKNOWN=0,
|
||||
TM6000_MODE_UNKNOWN = 0,
|
||||
TM6000_MODE_ANALOG,
|
||||
TM6000_MODE_DIGITAL,
|
||||
};
|
||||
@ -128,7 +128,7 @@ struct tm6000_dvb {
|
||||
struct dvb_frontend *frontend;
|
||||
struct dmxdev dmxdev;
|
||||
unsigned int streams;
|
||||
struct urb *bulk_urb;
|
||||
struct urb *bulk_urb;
|
||||
struct mutex mutex;
|
||||
};
|
||||
|
||||
@ -159,7 +159,7 @@ struct tm6000_core {
|
||||
enum tm6000_devtype dev_type; /* type of device */
|
||||
|
||||
v4l2_std_id norm; /* Current norm */
|
||||
int width,height; /* Selected resolution */
|
||||
int width, height; /* Selected resolution */
|
||||
|
||||
enum tm6000_core_state state;
|
||||
|
||||
@ -238,7 +238,7 @@ struct tm6000_fh {
|
||||
|
||||
/* video capture */
|
||||
struct tm6000_fmt *fmt;
|
||||
unsigned int width,height;
|
||||
unsigned int width, height;
|
||||
struct videobuf_queue vb_vidq;
|
||||
|
||||
enum v4l2_buf_type type;
|
||||
@ -250,25 +250,24 @@ struct tm6000_fh {
|
||||
|
||||
/* In tm6000-cards.c */
|
||||
|
||||
int tm6000_tuner_callback (void *ptr, int component, int command, int arg);
|
||||
int tm6000_xc5000_callback (void *ptr, int component, int command, int arg);
|
||||
int tm6000_tuner_callback(void *ptr, int component, int command, int arg);
|
||||
int tm6000_xc5000_callback(void *ptr, int component, int command, int arg);
|
||||
int tm6000_cards_setup(struct tm6000_core *dev);
|
||||
|
||||
/* In tm6000-core.c */
|
||||
|
||||
int tm6000_read_write_usb (struct tm6000_core *dev, u8 reqtype, u8 req,
|
||||
int tm6000_read_write_usb(struct tm6000_core *dev, u8 reqtype, u8 req,
|
||||
u16 value, u16 index, u8 *buf, u16 len);
|
||||
int tm6000_get_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index);
|
||||
int tm6000_get_reg(struct tm6000_core *dev, u8 req, u16 value, u16 index);
|
||||
int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index);
|
||||
int tm6000_get_reg32(struct tm6000_core *dev, u8 req, u16 value, u16 index);
|
||||
int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index);
|
||||
int tm6000_set_reg(struct tm6000_core *dev, u8 req, u16 value, u16 index);
|
||||
int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep);
|
||||
int tm6000_init(struct tm6000_core *dev);
|
||||
|
||||
int tm6000_init (struct tm6000_core *dev);
|
||||
|
||||
int tm6000_init_analog_mode (struct tm6000_core *dev);
|
||||
int tm6000_init_digital_mode (struct tm6000_core *dev);
|
||||
int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate);
|
||||
int tm6000_init_analog_mode(struct tm6000_core *dev);
|
||||
int tm6000_init_digital_mode(struct tm6000_core *dev);
|
||||
int tm6000_set_audio_bitrate(struct tm6000_core *dev, int bitrate);
|
||||
|
||||
int tm6000_v4l2_register(struct tm6000_core *dev);
|
||||
int tm6000_v4l2_unregister(struct tm6000_core *dev);
|
||||
@ -284,7 +283,7 @@ void tm6000_close_extension(struct tm6000_core *dev);
|
||||
|
||||
/* In tm6000-stds.c */
|
||||
void tm6000_get_std_res(struct tm6000_core *dev);
|
||||
int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm);
|
||||
int tm6000_set_standard(struct tm6000_core *dev, v4l2_std_id *norm);
|
||||
|
||||
/* In tm6000-i2c.c */
|
||||
int tm6000_i2c_register(struct tm6000_core *dev);
|
||||
@ -298,14 +297,14 @@ int tm6000_vidioc_streamon(struct file *file, void *priv,
|
||||
enum v4l2_buf_type i);
|
||||
int tm6000_vidioc_streamoff(struct file *file, void *priv,
|
||||
enum v4l2_buf_type i);
|
||||
int tm6000_vidioc_reqbufs (struct file *file, void *priv,
|
||||
struct v4l2_requestbuffers *rb);
|
||||
int tm6000_vidioc_querybuf (struct file *file, void *priv,
|
||||
struct v4l2_buffer *b);
|
||||
int tm6000_vidioc_qbuf (struct file *file, void *priv, struct v4l2_buffer *b);
|
||||
int tm6000_vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *b);
|
||||
int tm6000_vidioc_reqbufs(struct file *file, void *priv,
|
||||
struct v4l2_requestbuffers *rb);
|
||||
int tm6000_vidioc_querybuf(struct file *file, void *priv,
|
||||
struct v4l2_buffer *b);
|
||||
int tm6000_vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b);
|
||||
int tm6000_vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b);
|
||||
ssize_t tm6000_v4l2_read(struct file *filp, char __user * buf, size_t count,
|
||||
loff_t * f_pos);
|
||||
loff_t *f_pos);
|
||||
unsigned int tm6000_v4l2_poll(struct file *file,
|
||||
struct poll_table_struct *wait);
|
||||
int tm6000_queue_init(struct tm6000_core *dev);
|
||||
@ -320,7 +319,7 @@ extern int tm6000_debug;
|
||||
|
||||
#define dprintk(dev, level, fmt, arg...) do {\
|
||||
if (tm6000_debug & level) \
|
||||
printk(KERN_INFO "(%lu) %s %s :"fmt, jiffies, \
|
||||
printk(KERN_INFO "(%lu) %s %s :"fmt, jiffies, \
|
||||
dev->name, __FUNCTION__ , ##arg); } while (0)
|
||||
|
||||
#define V4L2_DEBUG_REG 0x0004
|
||||
@ -333,5 +332,3 @@ extern int tm6000_debug;
|
||||
#define tm6000_err(fmt, arg...) do {\
|
||||
printk(KERN_ERR "tm6000 %s :"fmt, \
|
||||
__FUNCTION__ , ##arg); } while (0)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user