V4L/DVB (7607): CodingStyle fixes
Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
e6a353b0dc
commit
6ea54d938b
@@ -79,10 +79,10 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
|
|||||||
|
|
||||||
if (reg_debug) {
|
if (reg_debug) {
|
||||||
printk(ret < 0 ? " failed!\n" : "%02x values: ", ret);
|
printk(ret < 0 ? " failed!\n" : "%02x values: ", ret);
|
||||||
for (byte = 0; byte < len; byte++) {
|
for (byte = 0; byte < len; byte++)
|
||||||
printk(" %02x", (unsigned char)buf[byte]);
|
printk(KERN_INFO " %02x", (unsigned char)buf[byte]);
|
||||||
}
|
|
||||||
printk("\n");
|
printk(KERN_INFO "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -143,8 +143,8 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
|
|||||||
if (reg_debug) {
|
if (reg_debug) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
printk (" %02x", (unsigned char)buf[i]);
|
printk(KERN_INFO " %02x", (unsigned char)buf[i]);
|
||||||
printk ("\n");
|
printk(KERN_INFO "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bufs)
|
if (!bufs)
|
||||||
@@ -173,8 +173,12 @@ static int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
|
|||||||
{
|
{
|
||||||
int oldval;
|
int oldval;
|
||||||
u8 newval;
|
u8 newval;
|
||||||
if ((oldval = em28xx_read_reg(dev, reg)) < 0)
|
|
||||||
|
oldval = em28xx_read_reg(dev, reg);
|
||||||
|
|
||||||
|
if (oldval < 0)
|
||||||
return oldval;
|
return oldval;
|
||||||
|
|
||||||
newval = (((u8) oldval) & ~bitmask) | (val & bitmask);
|
newval = (((u8) oldval) & ~bitmask) | (val & bitmask);
|
||||||
return em28xx_write_regs(dev, reg, &newval, 1);
|
return em28xx_write_regs(dev, reg, &newval, 1);
|
||||||
}
|
}
|
||||||
@@ -187,15 +191,21 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
|
|||||||
{
|
{
|
||||||
int ret, i;
|
int ret, i;
|
||||||
u8 addr = reg & 0x7f;
|
u8 addr = reg & 0x7f;
|
||||||
if ((ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2)) < 0)
|
|
||||||
|
ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2);
|
||||||
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if ((ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0)
|
|
||||||
|
ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1);
|
||||||
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Wait up to 50 ms for AC97 command to complete */
|
/* Wait up to 50 ms for AC97 command to complete */
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
|
ret = em28xx_read_reg(dev, AC97BUSY_REG);
|
||||||
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (!(ret & 0x01))
|
if (!(ret & 0x01))
|
||||||
return 0;
|
return 0;
|
||||||
msleep(5);
|
msleep(5);
|
||||||
@@ -357,7 +367,8 @@ int em28xx_outfmt_set_yuv422(struct em28xx *dev)
|
|||||||
static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
|
static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
|
||||||
u8 ymin, u8 ymax)
|
u8 ymin, u8 ymax)
|
||||||
{
|
{
|
||||||
em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n", xmin, ymin, xmax, ymax);
|
em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n",
|
||||||
|
xmin, ymin, xmax, ymax);
|
||||||
|
|
||||||
em28xx_write_regs(dev, XMIN_REG, &xmin, 1);
|
em28xx_write_regs(dev, XMIN_REG, &xmin, 1);
|
||||||
em28xx_write_regs(dev, XMAX_REG, &xmax, 1);
|
em28xx_write_regs(dev, XMAX_REG, &xmax, 1);
|
||||||
@@ -372,7 +383,8 @@ static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
|
|||||||
u8 cheight = height;
|
u8 cheight = height;
|
||||||
u8 overflow = (height >> 7 & 0x02) | (width >> 8 & 0x01);
|
u8 overflow = (height >> 7 & 0x02) | (width >> 8 & 0x01);
|
||||||
|
|
||||||
em28xx_coredbg("em28xx Area Set: (%d,%d)\n", (width | (overflow & 2) << 7),
|
em28xx_coredbg("em28xx Area Set: (%d,%d)\n",
|
||||||
|
(width | (overflow & 2) << 7),
|
||||||
(height | (overflow & 1) << 8));
|
(height | (overflow & 1) << 8));
|
||||||
|
|
||||||
em28xx_write_regs(dev, HSTART_REG, &hstart, 1);
|
em28xx_write_regs(dev, HSTART_REG, &hstart, 1);
|
||||||
@@ -396,7 +408,8 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
|
|||||||
buf[0] = v;
|
buf[0] = v;
|
||||||
buf[1] = v >> 8;
|
buf[1] = v >> 8;
|
||||||
em28xx_write_regs(dev, VSCALELOW_REG, (char *)buf, 2);
|
em28xx_write_regs(dev, VSCALELOW_REG, (char *)buf, 2);
|
||||||
/* it seems that both H and V scalers must be active to work correctly */
|
/* it seems that both H and V scalers must be active
|
||||||
|
to work correctly */
|
||||||
mode = (h || v)? 0x30: 0x00;
|
mode = (h || v)? 0x30: 0x00;
|
||||||
}
|
}
|
||||||
return em28xx_write_reg_bits(dev, COMPR_REG, mode, 0x30);
|
return em28xx_write_reg_bits(dev, COMPR_REG, mode, 0x30);
|
||||||
@@ -596,7 +609,9 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets,
|
|||||||
'desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK'
|
'desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK'
|
||||||
should also be using 'desc.bInterval'
|
should also be using 'desc.bInterval'
|
||||||
*/
|
*/
|
||||||
pipe = usb_rcvisocpipe(dev->udev, cap_type == EM28XX_ANALOG_CAPTURE ? 0x82 : 0x84);
|
pipe = usb_rcvisocpipe(dev->udev,
|
||||||
|
cap_type == EM28XX_ANALOG_CAPTURE ? 0x82 : 0x84);
|
||||||
|
|
||||||
usb_fill_int_urb(urb, dev->udev, pipe,
|
usb_fill_int_urb(urb, dev->udev, pipe,
|
||||||
dev->isoc_ctl.transfer_buffer[i], sb_size,
|
dev->isoc_ctl.transfer_buffer[i], sb_size,
|
||||||
em28xx_irq_callback, dma_q, 1);
|
em28xx_irq_callback, dma_q, 1);
|
||||||
|
@@ -97,7 +97,8 @@ static inline void print_err_status(struct em28xx *dev,
|
|||||||
if (packet < 0) {
|
if (packet < 0) {
|
||||||
dprintk(1, "URB status %d [%s].\n", status, errmsg);
|
dprintk(1, "URB status %d [%s].\n", status, errmsg);
|
||||||
} else {
|
} else {
|
||||||
dprintk(1, "URB packet %d, status %d [%s].\n", packet, status, errmsg);
|
dprintk(1, "URB packet %d, status %d [%s].\n",
|
||||||
|
packet, status, errmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +135,8 @@ static inline int dvb_isoc_copy(struct em28xx *dev, struct urb *urb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int start_streaming(struct em28xx_dvb* dvb) {
|
static int start_streaming(struct em28xx_dvb *dvb)
|
||||||
|
{
|
||||||
struct em28xx *dev = dvb->adapter.priv;
|
struct em28xx *dev = dvb->adapter.priv;
|
||||||
|
|
||||||
usb_set_interface(dev->udev, 0, 1);
|
usb_set_interface(dev->udev, 0, 1);
|
||||||
@@ -145,7 +147,8 @@ static int start_streaming(struct em28xx_dvb* dvb) {
|
|||||||
dvb_isoc_copy, EM28XX_DIGITAL_CAPTURE);
|
dvb_isoc_copy, EM28XX_DIGITAL_CAPTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stop_streaming(struct em28xx_dvb* dvb) {
|
static int stop_streaming(struct em28xx_dvb *dvb)
|
||||||
|
{
|
||||||
struct em28xx *dev = dvb->adapter.priv;
|
struct em28xx *dev = dvb->adapter.priv;
|
||||||
|
|
||||||
em28xx_uninit_isoc(dev);
|
em28xx_uninit_isoc(dev);
|
||||||
@@ -167,7 +170,8 @@ static int start_feed(struct dvb_demux_feed *feed)
|
|||||||
|
|
||||||
if (dvb->nfeeds == 1) {
|
if (dvb->nfeeds == 1) {
|
||||||
ret = start_streaming(dvb);
|
ret = start_streaming(dvb);
|
||||||
if(ret < 0) rc = ret;
|
if (ret < 0)
|
||||||
|
rc = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&dvb->lock);
|
mutex_unlock(&dvb->lock);
|
||||||
@@ -182,9 +186,10 @@ static int stop_feed(struct dvb_demux_feed *feed)
|
|||||||
|
|
||||||
mutex_lock(&dvb->lock);
|
mutex_lock(&dvb->lock);
|
||||||
dvb->nfeeds--;
|
dvb->nfeeds--;
|
||||||
if (0 == dvb->nfeeds) {
|
|
||||||
|
if (0 == dvb->nfeeds)
|
||||||
err = stop_streaming(dvb);
|
err = stop_streaming(dvb);
|
||||||
}
|
|
||||||
mutex_unlock(&dvb->lock);
|
mutex_unlock(&dvb->lock);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -360,8 +365,9 @@ static int dvb_init(struct em28xx *dev)
|
|||||||
struct em28xx_dvb *dvb;
|
struct em28xx_dvb *dvb;
|
||||||
|
|
||||||
dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
|
dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
|
||||||
|
|
||||||
if (dvb == NULL) {
|
if (dvb == NULL) {
|
||||||
printk("em28xx_dvb: memory allocation failed\n");
|
printk(KERN_INFO "em28xx_dvb: memory allocation failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
dev->dvb = dvb;
|
dev->dvb = dvb;
|
||||||
@@ -410,9 +416,8 @@ static int dvb_init(struct em28xx *dev)
|
|||||||
/* register everything */
|
/* register everything */
|
||||||
result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev);
|
result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev);
|
||||||
|
|
||||||
if (result < 0) {
|
if (result < 0)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
|
||||||
|
|
||||||
printk(KERN_INFO "Successfully loaded em28xx-dvb\n");
|
printk(KERN_INFO "Successfully loaded em28xx-dvb\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -41,11 +41,21 @@ static unsigned int i2c_debug;
|
|||||||
module_param(i2c_debug, int, 0644);
|
module_param(i2c_debug, int, 0644);
|
||||||
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
|
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
|
||||||
|
|
||||||
#define dprintk1(lvl,fmt, args...) if (i2c_debug>=lvl) do {\
|
|
||||||
printk(fmt, ##args); } while (0)
|
#define dprintk1(lvl, fmt, args...) \
|
||||||
#define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \
|
do { \
|
||||||
|
if (i2c_debug >= lvl) { \
|
||||||
|
printk(fmt, ##args); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define dprintk2(lvl, fmt, args...) \
|
||||||
|
do { \
|
||||||
|
if (i2c_debug >= lvl) { \
|
||||||
printk(KERN_DEBUG "%s at %s: " fmt, \
|
printk(KERN_DEBUG "%s at %s: " fmt, \
|
||||||
dev->name, __func__ , ##args); } while (0)
|
dev->name, __func__ , ##args); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* em2800_i2c_send_max4()
|
* em2800_i2c_send_max4()
|
||||||
@@ -259,10 +269,9 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
|
|||||||
msgs[i].buf,
|
msgs[i].buf,
|
||||||
msgs[i].len);
|
msgs[i].len);
|
||||||
if (i2c_debug >= 2) {
|
if (i2c_debug >= 2) {
|
||||||
for (byte = 0; byte < msgs[i].len; byte++) {
|
for (byte = 0; byte < msgs[i].len; byte++)
|
||||||
printk(" %02x", msgs[i].buf[byte]);
|
printk(" %02x", msgs[i].buf[byte]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/* write bytes */
|
/* write bytes */
|
||||||
if (i2c_debug >= 2) {
|
if (i2c_debug >= 2) {
|
||||||
@@ -330,7 +339,9 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
buf = 0;
|
buf = 0;
|
||||||
if (1 != (err = i2c_master_send(&dev->i2c_client, &buf, 1))) {
|
|
||||||
|
err = i2c_master_send(&dev->i2c_client, &buf, 1);
|
||||||
|
if (err != 1) {
|
||||||
printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n",
|
printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n",
|
||||||
dev->name, err);
|
dev->name, err);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -403,8 +414,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printk(KERN_INFO "Table at 0x%02x, strings=0x%04x, 0x%04x, 0x%04x\n",
|
printk(KERN_INFO "Table at 0x%02x, strings=0x%04x, 0x%04x, 0x%04x\n",
|
||||||
em_eeprom->string_idx_table,em_eeprom->string1,
|
em_eeprom->string_idx_table,
|
||||||
em_eeprom->string2,em_eeprom->string3);
|
em_eeprom->string1,
|
||||||
|
em_eeprom->string2,
|
||||||
|
em_eeprom->string3);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -443,7 +456,8 @@ static int attach_inform(struct i2c_client *client)
|
|||||||
tun_setup.type = TUNER_TDA9887;
|
tun_setup.type = TUNER_TDA9887;
|
||||||
tun_setup.addr = client->addr;
|
tun_setup.addr = client->addr;
|
||||||
|
|
||||||
em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
|
em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR,
|
||||||
|
&tun_setup);
|
||||||
|
|
||||||
tda9887_cfg.tuner = TUNER_TDA9887;
|
tda9887_cfg.tuner = TUNER_TDA9887;
|
||||||
tda9887_cfg.priv = &dev->tda9887_conf;
|
tda9887_cfg.priv = &dev->tda9887_conf;
|
||||||
@@ -464,7 +478,8 @@ static int attach_inform(struct i2c_client *client)
|
|||||||
case 0x8e:
|
case 0x8e:
|
||||||
{
|
{
|
||||||
struct IR_i2c *ir = i2c_get_clientdata(client);
|
struct IR_i2c *ir = i2c_get_clientdata(client);
|
||||||
dprintk1(1,"attach_inform: IR detected (%s).\n",ir->phys);
|
dprintk1(1, "attach_inform: IR detected (%s).\n",
|
||||||
|
ir->phys);
|
||||||
em28xx_set_ir(dev, ir);
|
em28xx_set_ir(dev, ir);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -481,7 +496,8 @@ static int attach_inform(struct i2c_client *client)
|
|||||||
if (!dev->tuner_addr)
|
if (!dev->tuner_addr)
|
||||||
dev->tuner_addr = client->addr;
|
dev->tuner_addr = client->addr;
|
||||||
|
|
||||||
dprintk1(1,"attach inform: detected I2C address %x\n", client->addr << 1);
|
dprintk1(1, "attach inform: detected I2C address %x\n",
|
||||||
|
client->addr << 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,8 +34,10 @@ static unsigned int ir_debug;
|
|||||||
module_param(ir_debug, int, 0644);
|
module_param(ir_debug, int, 0644);
|
||||||
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
|
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
|
||||||
|
|
||||||
#define dprintk(fmt, arg...) if (ir_debug) \
|
#define dprintk(fmt, arg...) \
|
||||||
printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg)
|
if (ir_debug) { \
|
||||||
|
printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg); \
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
@@ -91,7 +93,8 @@ int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
|||||||
((buf[0]&0x10)>>3) | /* 0000 0010 */
|
((buf[0]&0x10)>>3) | /* 0000 0010 */
|
||||||
((buf[0]&0x20)>>5); /* 0000 0001 */
|
((buf[0]&0x20)>>5); /* 0000 0001 */
|
||||||
|
|
||||||
dprintk("ir hauppauge (em2840): code=0x%02x (rcv=0x%02x)\n",code,buf[0]);
|
dprintk("ir hauppauge (em2840): code=0x%02x (rcv=0x%02x)\n",
|
||||||
|
code, buf[0]);
|
||||||
|
|
||||||
/* return key */
|
/* return key */
|
||||||
*ir_key = code;
|
*ir_key = code;
|
||||||
@@ -112,9 +115,8 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dprintk("key %02x\n", buf[2]&0x3f);
|
dprintk("key %02x\n", buf[2]&0x3f);
|
||||||
if (buf[0]!=0x00){
|
if (buf[0] != 0x00)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
*ir_key = buf[2]&0x3f;
|
*ir_key = buf[2]&0x3f;
|
||||||
*ir_raw = buf[2]&0x3f;
|
*ir_raw = buf[2]&0x3f;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
em28xx-video.c - driver for Empia EM2800/EM2820/2840 USB video capture devices
|
em28xx-video.c - driver for Empia EM2800/EM2820/2840 USB
|
||||||
|
video capture devices
|
||||||
|
|
||||||
Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
|
Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
|
||||||
Markus Rechberger <mrechberger@gmail.com>
|
Markus Rechberger <mrechberger@gmail.com>
|
||||||
@@ -58,10 +59,13 @@ static unsigned int isoc_debug;
|
|||||||
module_param(isoc_debug, int, 0644);
|
module_param(isoc_debug, int, 0644);
|
||||||
MODULE_PARM_DESC(isoc_debug, "enable debug messages [isoc transfers]");
|
MODULE_PARM_DESC(isoc_debug, "enable debug messages [isoc transfers]");
|
||||||
|
|
||||||
#define em28xx_isocdbg(fmt, arg...) do {\
|
#define em28xx_isocdbg(fmt, arg...) \
|
||||||
if (isoc_debug) \
|
do {\
|
||||||
|
if (isoc_debug) { \
|
||||||
printk(KERN_INFO "%s %s :"fmt, \
|
printk(KERN_INFO "%s %s :"fmt, \
|
||||||
dev->name, __func__ , ##arg); } while (0)
|
dev->name, __func__ , ##arg); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
MODULE_AUTHOR(DRIVER_AUTHOR);
|
MODULE_AUTHOR(DRIVER_AUTHOR);
|
||||||
MODULE_DESCRIPTION(DRIVER_DESC);
|
MODULE_DESCRIPTION(DRIVER_DESC);
|
||||||
@@ -483,7 +487,8 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb)
|
static void buffer_release(struct videobuf_queue *vq,
|
||||||
|
struct videobuf_buffer *vb)
|
||||||
{
|
{
|
||||||
struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb);
|
struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb);
|
||||||
struct em28xx_fh *fh = vq->priv_data;
|
struct em28xx_fh *fh = vq->priv_data;
|
||||||
@@ -501,7 +506,7 @@ static struct videobuf_queue_ops em28xx_video_qops = {
|
|||||||
.buf_release = buffer_release,
|
.buf_release = buffer_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
/********************* v4l2 interface ******************************************/
|
/********************* v4l2 interface **************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* em28xx_config()
|
* em28xx_config()
|
||||||
@@ -557,12 +562,15 @@ static void video_mux(struct em28xx *dev, int index)
|
|||||||
em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
|
em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
|
||||||
|
|
||||||
if (dev->has_msp34xx) {
|
if (dev->has_msp34xx) {
|
||||||
if (dev->i2s_speed)
|
if (dev->i2s_speed) {
|
||||||
em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed);
|
em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ,
|
||||||
|
&dev->i2s_speed);
|
||||||
|
}
|
||||||
route.input = dev->ctl_ainput;
|
route.input = dev->ctl_ainput;
|
||||||
route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
|
route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
|
||||||
/* Note: this is msp3400 specific */
|
/* Note: this is msp3400 specific */
|
||||||
em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route);
|
em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING,
|
||||||
|
&route);
|
||||||
}
|
}
|
||||||
|
|
||||||
em28xx_audio_analog_set(dev);
|
em28xx_audio_analog_set(dev);
|
||||||
@@ -919,11 +927,11 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
|
|||||||
|
|
||||||
index = dev->ctl_ainput;
|
index = dev->ctl_ainput;
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0)
|
||||||
strcpy(a->name, "Television");
|
strcpy(a->name, "Television");
|
||||||
} else {
|
else
|
||||||
strcpy(a->name, "Line In");
|
strcpy(a->name, "Line In");
|
||||||
}
|
|
||||||
a->capability = V4L2_AUDCAP_STEREO;
|
a->capability = V4L2_AUDCAP_STEREO;
|
||||||
a->index = index;
|
a->index = index;
|
||||||
|
|
||||||
@@ -1607,7 +1615,8 @@ static void em28xx_release_resources(struct em28xx *dev)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* em28xx_v4l2_close()
|
* em28xx_v4l2_close()
|
||||||
* stops streaming and deallocates all resources allocated by the v4l2 calls and ioctls
|
* stops streaming and deallocates all resources allocated by the v4l2
|
||||||
|
* calls and ioctls
|
||||||
*/
|
*/
|
||||||
static int em28xx_v4l2_close(struct inode *inode, struct file *filp)
|
static int em28xx_v4l2_close(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
@@ -1825,7 +1834,7 @@ static struct video_device em28xx_radio_template = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************** usb interface *****************************************/
|
/******************************** usb interface ******************************/
|
||||||
|
|
||||||
|
|
||||||
static LIST_HEAD(em28xx_extension_devlist);
|
static LIST_HEAD(em28xx_extension_devlist);
|
||||||
@@ -2094,7 +2103,8 @@ static int em28xx_usb_probe(struct usb_interface *interface,
|
|||||||
/* Don't register audio interfaces */
|
/* Don't register audio interfaces */
|
||||||
if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
|
if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
|
||||||
em28xx_err(DRIVER_NAME " audio device (%04x:%04x): interface %i, class %i\n",
|
em28xx_err(DRIVER_NAME " audio device (%04x:%04x): interface %i, class %i\n",
|
||||||
udev->descriptor.idVendor,udev->descriptor.idProduct,
|
udev->descriptor.idVendor,
|
||||||
|
udev->descriptor.idProduct,
|
||||||
ifnum,
|
ifnum,
|
||||||
interface->altsetting[0].desc.bInterfaceClass);
|
interface->altsetting[0].desc.bInterfaceClass);
|
||||||
|
|
||||||
@@ -2103,7 +2113,8 @@ static int em28xx_usb_probe(struct usb_interface *interface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
em28xx_err(DRIVER_NAME " new video device (%04x:%04x): interface %i, class %i\n",
|
em28xx_err(DRIVER_NAME " new video device (%04x:%04x): interface %i, class %i\n",
|
||||||
udev->descriptor.idVendor,udev->descriptor.idProduct,
|
udev->descriptor.idVendor,
|
||||||
|
udev->descriptor.idProduct,
|
||||||
ifnum,
|
ifnum,
|
||||||
interface->altsetting[0].desc.bInterfaceClass);
|
interface->altsetting[0].desc.bInterfaceClass);
|
||||||
|
|
||||||
@@ -2123,7 +2134,8 @@ static int em28xx_usb_probe(struct usb_interface *interface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nr >= EM28XX_MAXBOARDS) {
|
if (nr >= EM28XX_MAXBOARDS) {
|
||||||
printk (DRIVER_NAME ": Supports only %i em28xx boards.\n",EM28XX_MAXBOARDS);
|
printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
|
||||||
|
EM28XX_MAXBOARDS);
|
||||||
em28xx_devused &= ~(1<<nr);
|
em28xx_devused &= ~(1<<nr);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -2158,9 +2170,9 @@ static int em28xx_usb_probe(struct usb_interface *interface,
|
|||||||
|
|
||||||
dev->num_alt = uif->num_altsetting;
|
dev->num_alt = uif->num_altsetting;
|
||||||
em28xx_info("Alternate settings: %i\n", dev->num_alt);
|
em28xx_info("Alternate settings: %i\n", dev->num_alt);
|
||||||
// dev->alt_max_pkt_size = kmalloc(sizeof(*dev->alt_max_pkt_size)*
|
/* dev->alt_max_pkt_size = kmalloc(sizeof(*dev->alt_max_pkt_size)* */
|
||||||
dev->alt_max_pkt_size = kmalloc(32*
|
dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL);
|
||||||
dev->num_alt,GFP_KERNEL);
|
|
||||||
if (dev->alt_max_pkt_size == NULL) {
|
if (dev->alt_max_pkt_size == NULL) {
|
||||||
em28xx_errdev("out of memory!\n");
|
em28xx_errdev("out of memory!\n");
|
||||||
em28xx_devused &= ~(1<<nr);
|
em28xx_devused &= ~(1<<nr);
|
||||||
@@ -2213,7 +2225,8 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
|
|||||||
|
|
||||||
em28xx_info("disconnecting %s\n", dev->vdev->name);
|
em28xx_info("disconnecting %s\n", dev->vdev->name);
|
||||||
|
|
||||||
/* wait until all current v4l2 io is finished then deallocate resources */
|
/* wait until all current v4l2 io is finished then deallocate
|
||||||
|
resources */
|
||||||
mutex_lock(&dev->lock);
|
mutex_lock(&dev->lock);
|
||||||
|
|
||||||
wake_up_interruptible_all(&dev->open);
|
wake_up_interruptible_all(&dev->open);
|
||||||
|
@@ -365,7 +365,8 @@ struct em28xx {
|
|||||||
unsigned int video_bytesread; /* Number of bytes read */
|
unsigned int video_bytesread; /* Number of bytes read */
|
||||||
|
|
||||||
unsigned long hash; /* eeprom hash - for boards with generic ID */
|
unsigned long hash; /* eeprom hash - for boards with generic ID */
|
||||||
unsigned long i2c_hash; /* i2c devicelist hash - for boards with generic ID */
|
unsigned long i2c_hash; /* i2c devicelist hash -
|
||||||
|
for boards with generic ID */
|
||||||
|
|
||||||
struct em28xx_audio *adev;
|
struct em28xx_audio *adev;
|
||||||
|
|
||||||
@@ -399,8 +400,8 @@ struct em28xx {
|
|||||||
struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */
|
struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */
|
||||||
char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */
|
char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */
|
||||||
/* helper funcs that call usb_control_msg */
|
/* helper funcs that call usb_control_msg */
|
||||||
int (*em28xx_write_regs) (struct em28xx * dev, u16 reg, char *buf,
|
int (*em28xx_write_regs) (struct em28xx *dev, u16 reg,
|
||||||
int len);
|
char *buf, int len);
|
||||||
int (*em28xx_read_reg) (struct em28xx *dev, u16 reg);
|
int (*em28xx_read_reg) (struct em28xx *dev, u16 reg);
|
||||||
int (*em28xx_read_reg_req_len) (struct em28xx *dev, u8 req, u16 reg,
|
int (*em28xx_read_reg_req_len) (struct em28xx *dev, u8 req, u16 reg,
|
||||||
char *buf, int len);
|
char *buf, int len);
|
||||||
@@ -557,80 +558,80 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
|
|||||||
printk(KERN_WARNING "%s: "fmt,\
|
printk(KERN_WARNING "%s: "fmt,\
|
||||||
dev->name , ##arg); } while (0)
|
dev->name , ##arg); } while (0)
|
||||||
|
|
||||||
inline static int em28xx_compression_disable(struct em28xx *dev)
|
static inline int em28xx_compression_disable(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
/* side effect of disabling scaler and mixer */
|
/* side effect of disabling scaler and mixer */
|
||||||
return em28xx_write_regs(dev, COMPR_REG, "\x00", 1);
|
return em28xx_write_regs(dev, COMPR_REG, "\x00", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_contrast_get(struct em28xx *dev)
|
static inline int em28xx_contrast_get(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
return em28xx_read_reg(dev, YGAIN_REG) & 0x1f;
|
return em28xx_read_reg(dev, YGAIN_REG) & 0x1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_brightness_get(struct em28xx *dev)
|
static inline int em28xx_brightness_get(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
return em28xx_read_reg(dev, YOFFSET_REG);
|
return em28xx_read_reg(dev, YOFFSET_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_saturation_get(struct em28xx *dev)
|
static inline int em28xx_saturation_get(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
return em28xx_read_reg(dev, UVGAIN_REG) & 0x1f;
|
return em28xx_read_reg(dev, UVGAIN_REG) & 0x1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_u_balance_get(struct em28xx *dev)
|
static inline int em28xx_u_balance_get(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
return em28xx_read_reg(dev, UOFFSET_REG);
|
return em28xx_read_reg(dev, UOFFSET_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_v_balance_get(struct em28xx *dev)
|
static inline int em28xx_v_balance_get(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
return em28xx_read_reg(dev, VOFFSET_REG);
|
return em28xx_read_reg(dev, VOFFSET_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_gamma_get(struct em28xx *dev)
|
static inline int em28xx_gamma_get(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
return em28xx_read_reg(dev, GAMMA_REG) & 0x3f;
|
return em28xx_read_reg(dev, GAMMA_REG) & 0x3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_contrast_set(struct em28xx *dev, s32 val)
|
static inline int em28xx_contrast_set(struct em28xx *dev, s32 val)
|
||||||
{
|
{
|
||||||
u8 tmp = (u8) val;
|
u8 tmp = (u8) val;
|
||||||
return em28xx_write_regs(dev, YGAIN_REG, &tmp, 1);
|
return em28xx_write_regs(dev, YGAIN_REG, &tmp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_brightness_set(struct em28xx *dev, s32 val)
|
static inline int em28xx_brightness_set(struct em28xx *dev, s32 val)
|
||||||
{
|
{
|
||||||
u8 tmp = (u8) val;
|
u8 tmp = (u8) val;
|
||||||
return em28xx_write_regs(dev, YOFFSET_REG, &tmp, 1);
|
return em28xx_write_regs(dev, YOFFSET_REG, &tmp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_saturation_set(struct em28xx *dev, s32 val)
|
static inline int em28xx_saturation_set(struct em28xx *dev, s32 val)
|
||||||
{
|
{
|
||||||
u8 tmp = (u8) val;
|
u8 tmp = (u8) val;
|
||||||
return em28xx_write_regs(dev, UVGAIN_REG, &tmp, 1);
|
return em28xx_write_regs(dev, UVGAIN_REG, &tmp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_u_balance_set(struct em28xx *dev, s32 val)
|
static inline int em28xx_u_balance_set(struct em28xx *dev, s32 val)
|
||||||
{
|
{
|
||||||
u8 tmp = (u8) val;
|
u8 tmp = (u8) val;
|
||||||
return em28xx_write_regs(dev, UOFFSET_REG, &tmp, 1);
|
return em28xx_write_regs(dev, UOFFSET_REG, &tmp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_v_balance_set(struct em28xx *dev, s32 val)
|
static inline int em28xx_v_balance_set(struct em28xx *dev, s32 val)
|
||||||
{
|
{
|
||||||
u8 tmp = (u8) val;
|
u8 tmp = (u8) val;
|
||||||
return em28xx_write_regs(dev, VOFFSET_REG, &tmp, 1);
|
return em28xx_write_regs(dev, VOFFSET_REG, &tmp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int em28xx_gamma_set(struct em28xx *dev, s32 val)
|
static inline int em28xx_gamma_set(struct em28xx *dev, s32 val)
|
||||||
{
|
{
|
||||||
u8 tmp = (u8) val;
|
u8 tmp = (u8) val;
|
||||||
return em28xx_write_regs(dev, GAMMA_REG, &tmp, 1);
|
return em28xx_write_regs(dev, GAMMA_REG, &tmp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*FIXME: maxw should be dependent of alt mode */
|
/*FIXME: maxw should be dependent of alt mode */
|
||||||
inline static unsigned int norm_maxw(struct em28xx *dev)
|
static inline unsigned int norm_maxw(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
if (dev->max_range_640_480)
|
if (dev->max_range_640_480)
|
||||||
return 640;
|
return 640;
|
||||||
@@ -638,7 +639,7 @@ inline static unsigned int norm_maxw(struct em28xx *dev)
|
|||||||
return 720;
|
return 720;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static unsigned int norm_maxh(struct em28xx *dev)
|
static inline unsigned int norm_maxh(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
if (dev->max_range_640_480)
|
if (dev->max_range_640_480)
|
||||||
return 480;
|
return 480;
|
||||||
|
Reference in New Issue
Block a user