Commit 64d339d4 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

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: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 427f7fac
......@@ -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)
{
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));
tun_setup.type = dev->tuner_type;
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);
......
......@@ -203,62 +203,6 @@ static void dec_use(struct i2c_adapter *adap)
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 = {
.master_xfer = tm6000_i2c_xfer,
.functionality = functionality,
......
......@@ -1299,7 +1299,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
// mutex_lock(&dev->lock);
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);
return 0;
......@@ -1309,9 +1309,9 @@ static int vidioc_s_frequency (struct file *file, void *priv,
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_fh *fh;
struct list_head *list;
......@@ -1432,11 +1432,11 @@ tm6000_poll(struct file *file, struct poll_table_struct *wait)
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_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);
......@@ -1462,7 +1462,7 @@ static int tm6000_mmap(struct file *file, struct vm_area_struct * vma)
return ret;
}
static struct file_operations tm6000_fops = {
static struct v4l2_file_operations tm6000_fops = {
.owner = THIS_MODULE,
.open = tm6000_open,
.release = tm6000_release,
......@@ -1470,7 +1470,6 @@ static struct file_operations tm6000_fops = {
.read = tm6000_read,
.poll = tm6000_poll,
.mmap = tm6000_mmap,
.llseek = no_llseek,
};
static const struct v4l2_ioctl_ops video_ioctl_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment