V4L/DVB (12853): tm6000: Fix almost all warnings at the driver
Onr warning is left, since it is there for a purpose: tm6000-core.c:218: warning: ISO C90 forbids mixed declarations and code It indicates a place where a temporary hack were added. Tests are needed to be sure that we can remove it. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
427f7facb3
commit
64d339d42d
|
@ -191,6 +191,61 @@ struct usb_device_id tm6000_id_table [] = {
|
||||||
{ },
|
{ },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Tuner callback to provide the proper gpio changes needed for xc2028 */
|
||||||
|
|
||||||
|
static int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
|
||||||
|
{
|
||||||
|
int rc=0;
|
||||||
|
struct tm6000_core *dev = ptr;
|
||||||
|
|
||||||
|
if (dev->tuner_type!=TUNER_XC2028)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
switch (command) {
|
||||||
|
case XC2028_RESET_CLK:
|
||||||
|
tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT,
|
||||||
|
0x02, arg);
|
||||||
|
msleep(10);
|
||||||
|
rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
||||||
|
TM6000_GPIO_CLK, 0);
|
||||||
|
if (rc<0)
|
||||||
|
return rc;
|
||||||
|
msleep(10);
|
||||||
|
rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
||||||
|
TM6000_GPIO_CLK, 1);
|
||||||
|
break;
|
||||||
|
case XC2028_TUNER_RESET:
|
||||||
|
/* Reset codes during load firmware */
|
||||||
|
switch (arg) {
|
||||||
|
case 0:
|
||||||
|
tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
||||||
|
dev->tuner_reset_gpio, 0x00);
|
||||||
|
msleep(130);
|
||||||
|
tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
||||||
|
dev->tuner_reset_gpio, 0x01);
|
||||||
|
msleep(130);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT,
|
||||||
|
0x02, 0x01);
|
||||||
|
msleep(10);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
||||||
|
TM6000_GPIO_CLK, 0);
|
||||||
|
if (rc<0)
|
||||||
|
return rc;
|
||||||
|
msleep(100);
|
||||||
|
rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
||||||
|
TM6000_GPIO_CLK, 1);
|
||||||
|
msleep(100);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (rc);
|
||||||
|
}
|
||||||
|
|
||||||
static void tm6000_config_tuner (struct tm6000_core *dev)
|
static void tm6000_config_tuner (struct tm6000_core *dev)
|
||||||
{
|
{
|
||||||
struct tuner_setup tun_setup;
|
struct tuner_setup tun_setup;
|
||||||
|
@ -202,6 +257,8 @@ static void tm6000_config_tuner (struct tm6000_core *dev)
|
||||||
memset(&tun_setup, 0, sizeof(tun_setup));
|
memset(&tun_setup, 0, sizeof(tun_setup));
|
||||||
tun_setup.type = dev->tuner_type;
|
tun_setup.type = dev->tuner_type;
|
||||||
tun_setup.addr = dev->tuner_addr;
|
tun_setup.addr = dev->tuner_addr;
|
||||||
|
tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
|
||||||
|
tun_setup.tuner_callback = tm6000_tuner_callback;
|
||||||
|
|
||||||
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
|
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
|
||||||
|
|
||||||
|
|
|
@ -203,62 +203,6 @@ static void dec_use(struct i2c_adapter *adap)
|
||||||
msleep (10); \
|
msleep (10); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tuner callback to provide the proper gpio changes needed for xc2028 */
|
|
||||||
|
|
||||||
static int tm6000_tuner_callback(void *ptr, int command, int arg)
|
|
||||||
{
|
|
||||||
int rc=0;
|
|
||||||
struct tm6000_core *dev = ptr;
|
|
||||||
|
|
||||||
if (dev->tuner_type!=TUNER_XC2028)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch (command) {
|
|
||||||
case XC2028_RESET_CLK:
|
|
||||||
tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT,
|
|
||||||
0x02, arg);
|
|
||||||
msleep(10);
|
|
||||||
rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
|
||||||
TM6000_GPIO_CLK, 0);
|
|
||||||
if (rc<0)
|
|
||||||
return rc;
|
|
||||||
msleep(10);
|
|
||||||
rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
|
||||||
TM6000_GPIO_CLK, 1);
|
|
||||||
break;
|
|
||||||
case XC2028_TUNER_RESET:
|
|
||||||
/* Reset codes during load firmware */
|
|
||||||
switch (arg) {
|
|
||||||
case 0:
|
|
||||||
tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
|
||||||
dev->tuner_reset_gpio, 0x00);
|
|
||||||
msleep(130);
|
|
||||||
tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
|
||||||
dev->tuner_reset_gpio, 0x01);
|
|
||||||
msleep(130);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT,
|
|
||||||
0x02, 0x01);
|
|
||||||
msleep(10);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
|
||||||
TM6000_GPIO_CLK, 0);
|
|
||||||
if (rc<0)
|
|
||||||
return rc;
|
|
||||||
msleep(100);
|
|
||||||
rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
|
|
||||||
TM6000_GPIO_CLK, 1);
|
|
||||||
msleep(100);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (rc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct i2c_algorithm tm6000_algo = {
|
static struct i2c_algorithm tm6000_algo = {
|
||||||
.master_xfer = tm6000_i2c_xfer,
|
.master_xfer = tm6000_i2c_xfer,
|
||||||
.functionality = functionality,
|
.functionality = functionality,
|
||||||
|
|
|
@ -1299,7 +1299,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
|
||||||
|
|
||||||
// mutex_lock(&dev->lock);
|
// mutex_lock(&dev->lock);
|
||||||
dev->freq = f->frequency;
|
dev->freq = f->frequency;
|
||||||
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
|
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f);
|
||||||
// mutex_unlock(&dev->lock);
|
// mutex_unlock(&dev->lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1309,9 +1309,9 @@ static int vidioc_s_frequency (struct file *file, void *priv,
|
||||||
File operations for the device
|
File operations for the device
|
||||||
------------------------------------------------------------------*/
|
------------------------------------------------------------------*/
|
||||||
|
|
||||||
static int tm6000_open(struct inode *inode, struct file *file)
|
static int tm6000_open(struct file *file)
|
||||||
{
|
{
|
||||||
int minor = iminor(inode);
|
int minor = video_devdata(file)->minor;
|
||||||
struct tm6000_core *h,*dev = NULL;
|
struct tm6000_core *h,*dev = NULL;
|
||||||
struct tm6000_fh *fh;
|
struct tm6000_fh *fh;
|
||||||
struct list_head *list;
|
struct list_head *list;
|
||||||
|
@ -1432,11 +1432,11 @@ tm6000_poll(struct file *file, struct poll_table_struct *wait)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tm6000_release(struct inode *inode, struct file *file)
|
static int tm6000_release(struct file *file)
|
||||||
{
|
{
|
||||||
struct tm6000_fh *fh = file->private_data;
|
struct tm6000_fh *fh = file->private_data;
|
||||||
struct tm6000_core *dev = fh->dev;
|
struct tm6000_core *dev = fh->dev;
|
||||||
int minor = iminor(inode);
|
int minor = video_devdata(file)->minor;
|
||||||
|
|
||||||
dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users);
|
dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users);
|
||||||
|
|
||||||
|
@ -1462,7 +1462,7 @@ static int tm6000_mmap(struct file *file, struct vm_area_struct * vma)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations tm6000_fops = {
|
static struct v4l2_file_operations tm6000_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = tm6000_open,
|
.open = tm6000_open,
|
||||||
.release = tm6000_release,
|
.release = tm6000_release,
|
||||||
|
@ -1470,7 +1470,6 @@ static struct file_operations tm6000_fops = {
|
||||||
.read = tm6000_read,
|
.read = tm6000_read,
|
||||||
.poll = tm6000_poll,
|
.poll = tm6000_poll,
|
||||||
.mmap = tm6000_mmap,
|
.mmap = tm6000_mmap,
|
||||||
.llseek = no_llseek,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct v4l2_ioctl_ops video_ioctl_ops = {
|
static const struct v4l2_ioctl_ops video_ioctl_ops = {
|
||||||
|
|
Loading…
Reference in New Issue