tuner: Remove remaining usages of T_DIGITAL_TV
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/4 tuner: Remove remaining usages of T_DIGITAL_TV
A few places used T_DIGITAL_TV internally. Remove the usage of this obsolete mode mask.
drivers/media/common/tuners/tuner-xc2028.c +4 -4
@@ -933,7 +933,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,* that xc2028 will be in a safe state. * Maybe this might also be needed for DTV. */ -if (new_mode ==T_ANALOG_TV ) { +if (new_mode ==V4L2_TUNER_ANALOG_TV ) { rc = send_seq(priv, {0x00, 0x00});/* Analog modes require offset = 0 */
@@ -1054,7 +1054,7 @@ static int xc2028_set_analog_freq(struct dvb_frontend *fe,if (priv->ctrl.input1) type |=INPUT1 ;return generic_set_freq (fe, (625l * p->frequency) /10 , -T_RADIO , type,0 ,0 ); +V4L2_TUNER_RADIO , type,0 ,0 ); }/* if std is not defined, choose one */
@@ -1069,7 +1069,7 @@ static int xc2028_set_analog_freq(struct dvb_frontend *fe, p->std |=parse_audio_std_option ();return generic_set_freq (fe,62500l * p->frequency, -T_ANALOG_TV , type, p->std,0 ); +V4L2_TUNER_ANALOG_TV , type, p->std,0 ); } static int xc2028_set_params(struct dvb_frontend *fe,
@@ -1174,7 +1174,7 @@ static int xc2028_set_params(struct dvb_frontend *fe, }return generic_set_freq (fe, p->frequency, -T_DIGITAL_TV , type,0 , demod); +V4L2_TUNER_DIGITAL_TV , type,0 , demod); }static int xc2028_sleep (struct dvb_frontend *fe)
drivers/media/video/em28xx/em28xx-video.c +1 -1
@@ -2227,7 +2227,7 @@ em28xx_v4l2_read(struct file *filp, char __user *buf, size_t count,*/ if (fh->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) { -if (res_locked (dev,EM28XX_RESOURCE_VIDEO )) +if (res_get (dev,EM28XX_RESOURCE_VIDEO ))return -EBUSY ; return videobuf_read_stream(&fh->vb_vidq, buf, count, pos, 0,
drivers/staging/tm6000/tm6000-cards.c +0 -2
@@ -588,8 +588,6 @@ static void tm6000_config_tuner(struct tm6000_core *dev) tun_setup.mode_mask =0 ;if (dev->caps.has_tuner) tun_setup.mode_mask |= (T_ANALOG_TV |T_RADIO ); -if (dev->caps.has_dvb) - tun_setup.mode_mask |=T_DIGITAL_TV ;switch (dev->tuner_type) {case TUNER_XC2028 :
include/media/tuner.h +1 -1
@@ -161,7 +161,7 @@enum tuner_mode {T_RADIO =1 <<V4L2_TUNER_RADIO ,T_ANALOG_TV =1 <<V4L2_TUNER_ANALOG_TV , -T_DIGITAL_TV =1 <<V4L2_TUNER_DIGITAL_TV , +/* Don't need to map V4L2_TUNER_DIGITAL_TV, as tuner-core won't use it */ };/* Older boards only had a single tuner device. Nowadays multiple tuner
Signature · 1 line
1.7.1
Em 21-02-2011 23:17, Mauro Carvalho Chehab escreveu:
Quoted 50 lines
A few places used
T_DIGITAL_TVinternally. Remove the usage of this obsolete mode mask.Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/common/tuners/tuner-xc2028.c +4
-4@@ -933,7 +933,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,* that xc2028 will be in a safe state. * Maybe this might also be needed for DTV. */ -if (new_mode ==T_ANALOG_TV ) { +if (new_mode ==V4L2_TUNER_ANALOG_TV ) { rc = send_seq(priv, {0x00, 0x00});/* Analog modes require offset = 0 */ @@ -1054,7 +1054,7 @@ static int xc2028_set_analog_freq(struct dvb_frontend *fe,if (priv->ctrl.input1) type |=INPUT1 ;return generic_set_freq (fe, (625l * p->frequency) /10 , -T_RADIO , type,0 ,0 ); +V4L2_TUNER_RADIO , type,0 ,0 ); }/* if std is not defined, choose one */ @@ -1069,7 +1069,7 @@ static int xc2028_set_analog_freq(struct dvb_frontend *fe, p->std |=parse_audio_std_option ();return generic_set_freq (fe,62500l * p->frequency, -T_ANALOG_TV , type, p->std,0 ); +V4L2_TUNER_ANALOG_TV , type, p->std,0 ); } static int xc2028_set_params(struct dvb_frontend *fe,@@ -1174,7 +1174,7 @@ static int xc2028_set_params(struct dvb_frontend *fe, }return generic_set_freq (fe, p->frequency, -T_DIGITAL_TV , type,0 , demod); +V4L2_TUNER_DIGITAL_TV , type,0 , demod); }static int xc2028_sleep (struct dvb_frontend *fe)drivers/media/video/em28xx/em28xx-video.c +0
-0
drivers/media/video/em28xx/em28xx-video.c em28xx_v4l2_read(struct file *filp, char __user *buf, size_t count, · line 2233
Quoted 8 lines
drivers/media/video/em28xx/em28xx-video.c +1
-1@@ -2227,7 +2227,7 @@ em28xx_v4l2_read(struct file *filp, char __user *buf, size_t count,*/ if (fh->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) { -if (res_locked (dev,EM28XX_RESOURCE_VIDEO )) +if (res_get (dev,EM28XX_RESOURCE_VIDEO ))return -EBUSY ; return videobuf_read_stream(&fh->vb_vidq, buf, count, pos, 0,
This hunk obviously doesn't belong here. It were just part of a test I did. I'll discard it at the final version.
Quoted 26 lines
drivers/staging/tm6000/tm6000-cards.c +0
-2@@ -588,8 +588,6 @@ static void tm6000_config_tuner(struct tm6000_core *dev) tun_setup.mode_mask =0 ;if (dev->caps.has_tuner) tun_setup.mode_mask |= (T_ANALOG_TV |T_RADIO ); -if (dev->caps.has_dvb) - tun_setup.mode_mask |=T_DIGITAL_TV ;switch (dev->tuner_type) {case TUNER_XC2028 :include/media/tuner.h +1
-1@@ -161,7 +161,7 @@enum tuner_mode {T_RADIO =1 <<V4L2_TUNER_RADIO ,T_ANALOG_TV =1 <<V4L2_TUNER_ANALOG_TV , -T_DIGITAL_TV =1 <<V4L2_TUNER_DIGITAL_TV , +/* Don't need to map V4L2_TUNER_DIGITAL_TV, as tuner-core won't use it */ };/* Older boards only had a single tuner device. Nowadays multiple tuner
PATCH 2/4 tvp5150: device detection should be done only once
In reply to a message not in the archiveHaving the device detection happening at reset is bad, as every time, it will produce a message like:
tvp5150 2-005c: tvp5150am1 detected.
This only polutes the log and for an accidental kernel hacker, it looks like a real problem. So, move those printk's to happen during device probe.
drivers/media/video/tvp5150.c +21 -21
@@ -737,27 +737,6 @@ static int tvp5150_s_std(struct v4l2_subdev *sd, v4l2_std_id std)static int tvp5150_reset (struct v4l2_subdev *sd,u32 val) {struct tvp5150 *decoder =to_tvp5150 (sd); -u8 msb_id, lsb_id, msb_rom, lsb_rom; - - msb_id =tvp5150_read (sd,TVP5150_MSB_DEV_ID ); - lsb_id =tvp5150_read (sd,TVP5150_LSB_DEV_ID ); - msb_rom =tvp5150_read (sd,TVP5150_ROM_MAJOR_VER ); - lsb_rom =tvp5150_read (sd,TVP5150_ROM_MINOR_VER ); - -if (msb_rom ==4 && lsb_rom ==0 ) {/* Is TVP5150AM1 */ -v4l2_info (sd,"tvp%02x%02xam1 detected.\n" , msb_id, lsb_id); - -/* ITU-T BT.656.4 timing */ -tvp5150_write (sd,TVP5150_REV_SELECT ,0 ); - }else { -if (msb_rom ==3 || lsb_rom ==0x21 ) {/* Is TVP5150A */ -v4l2_info (sd,"tvp%02x%02xa detected.\n" , msb_id, lsb_id); - }else { -v4l2_info (sd,"*** unknown tvp%02x%02x chip detected.\n" , - msb_id, lsb_id); -v4l2_info (sd,"*** Rom ver is %d.%d\n" , msb_rom, lsb_rom); - } - }/* Initializes TVP5150 to its default values */ tvp5150_write_inittab (sd, tvp5150_init_default);
@@ -977,6 +956,7 @@ static int tvp5150_probe(struct i2c_client *c, { struct tvp5150 *core; struct v4l2_subdev *sd; + u8 msb_id, lsb_id, msb_rom, lsb_rom; /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(c->adapter,
@@ -992,6 +972,26 @@ static int tvp5150_probe(struct i2c_client *c,v4l_info (c,"chip found @ 0x%02x (%s)\n" , c->addr <<1 , c->adapter->name); + msb_id =tvp5150_read (sd,TVP5150_MSB_DEV_ID ); + lsb_id =tvp5150_read (sd,TVP5150_LSB_DEV_ID ); + msb_rom =tvp5150_read (sd,TVP5150_ROM_MAJOR_VER ); + lsb_rom =tvp5150_read (sd,TVP5150_ROM_MINOR_VER ); + +if (msb_rom ==4 && lsb_rom ==0 ) {/* Is TVP5150AM1 */ +v4l2_info (sd,"tvp%02x%02xam1 detected.\n" , msb_id, lsb_id); + +/* ITU-T BT.656.4 timing */ +tvp5150_write (sd,TVP5150_REV_SELECT ,0 ); + }else { +if (msb_rom ==3 || lsb_rom ==0x21 ) {/* Is TVP5150A */ +v4l2_info (sd,"tvp%02x%02xa detected.\n" , msb_id, lsb_id); + }else { +v4l2_info (sd,"*** unknown tvp%02x%02x chip detected.\n" , + msb_id, lsb_id); +v4l2_info (sd,"*** Rom ver is %d.%d\n" , msb_rom, lsb_rom); + } + } + core->norm =V4L2_STD_ALL ;/* Default is autodetect */ core->input =TVP5150_COMPOSITE1 ; core->enable =1 ;
Signature · 1 line
1.7.1
PATCH 3/4 em28xx: Fix return value for s_ctrl
In reply to a message not in the archiveOn some cases, driver returns 1. This should be OK, but qv4l2 is too strict about return values.
drivers/media/video/em28xx/em28xx-video.c +1 -1
@@ -1452,7 +1452,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, rc =em28xx_audio_analog_set (dev); } } -return rc; +return (rc <0 ) ? rc :0 ; } static int vidioc_g_tuner(struct file *file, void *priv,
Signature · 1 line
1.7.1
PATCH 4/4 em28xx: properly handle subdev controls
In reply to a message not in the archiveSubdev controls return codes are evil, as they return -EINVAL to mean both unsupported and invalid arguments. Due to that, we need to use a trick to identify what controls are supported by a subdev.
drivers/media/video/em28xx/em28xx-video.c +28 -3
@@ -1387,6 +1387,27 @@ static int vidioc_queryctrl(struct file *file, void *priv,return -EINVAL ; } +/* +* FIXME: This is an indirect way to check if a control exists at a +* subdev. Instead of that hack, maybe the better would be to change all +* subdevs to return -ENOIOCTLCMD, if an ioctl is not supported. +*/ +static int check_subdev_ctrl (struct em28xx *dev,int id) +{ +struct v4l2_queryctrl qc; + +memset (&qc,0 ,sizeof (qc)); + qc.id = id; + +/* enumerate V4L2 device controls */ +v4l2_device_call_all (&dev->v4l2_dev,0 , core, queryctrl, &qc); + +if (qc.type) +return 0 ; +else +return -EINVAL ; +} +static int vidioc_g_ctrl (struct file *file,void *priv,struct v4l2_control *ctrl) {
@@ -1399,7 +1420,6 @@ static int vidioc_g_ctrl(struct file *file, void *priv,return rc; rc =0 ; -/* Set an AC97 control */ if (dev->audio_mode.ac97 !=EM28XX_NO_AC97 ) rc =ac97_get_ctrl (dev, ctrl);
@@ -1408,6 +1428,9 @@ static int vidioc_g_ctrl(struct file *file, void *priv,/* It were not an AC97 control. Sends it to the v4l2 dev interface */ if (rc ==1 ) { +if (check_subdev_ctrl (dev, ctrl->id)) +return -EINVAL ; +v4l2_device_call_all (&dev->v4l2_dev,0 , core, g_ctrl, ctrl); rc =0 ; }
@@ -1434,8 +1457,10 @@ static int vidioc_s_ctrl(struct file *file, void *priv,/* It isn't an AC97 control. Sends it to the v4l2 dev interface */ if (rc ==1 ) { - rc =v4l2_device_call_until_err (&dev->v4l2_dev,0 , core, s_ctrl, ctrl); - + rc =check_subdev_ctrl (dev, ctrl->id); +if (!rc) +v4l2_device_call_all (&dev->v4l2_dev,0 , + core, s_ctrl, ctrl);/* * In the case of non-AC97 volume controls, we still need * to do some setups at em28xx, in order to mute/unmute
Signature · 1 line
1.7.1