Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bccfa449 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (11311): v4l: replace 'ioctl' references in v4l i2c drivers



Replace 'VIDIOC_' references in v4l i2c drivers by their new v4l2_subdev
callback names.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 41c129a8
Loading
Loading
Loading
Loading
+12 −11
Original line number Original line Diff line number Diff line
@@ -421,7 +421,7 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
	case KS_INPUT_COMPOSITE_5:
	case KS_INPUT_COMPOSITE_5:
	case KS_INPUT_COMPOSITE_6:
	case KS_INPUT_COMPOSITE_6:
		v4l2_dbg(1, debug, sd,
		v4l2_dbg(1, debug, sd,
			"VIDIOC_S_INPUT %d: Composite\n", route->input);
			"s_routing %d: Composite\n", route->input);
		/* autodetect 50/60 Hz */
		/* autodetect 50/60 Hz */
		ks0127_and_or(sd, KS_CMDA,   0xfc, 0x00);
		ks0127_and_or(sd, KS_CMDA,   0xfc, 0x00);
		/* VSE=0 */
		/* VSE=0 */
@@ -455,7 +455,7 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
	case KS_INPUT_SVIDEO_2:
	case KS_INPUT_SVIDEO_2:
	case KS_INPUT_SVIDEO_3:
	case KS_INPUT_SVIDEO_3:
		v4l2_dbg(1, debug, sd,
		v4l2_dbg(1, debug, sd,
			"VIDIOC_S_INPUT %d: S-Video\n", route->input);
			"s_routing %d: S-Video\n", route->input);
		/* autodetect 50/60 Hz */
		/* autodetect 50/60 Hz */
		ks0127_and_or(sd, KS_CMDA,   0xfc, 0x00);
		ks0127_and_or(sd, KS_CMDA,   0xfc, 0x00);
		/* VSE=0 */
		/* VSE=0 */
@@ -486,7 +486,7 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
		break;
		break;


	case KS_INPUT_YUV656:
	case KS_INPUT_YUV656:
		v4l2_dbg(1, debug, sd, "VIDIOC_S_INPUT 15: YUV656\n");
		v4l2_dbg(1, debug, sd, "s_routing 15: YUV656\n");
		if (ks->norm & V4L2_STD_525_60)
		if (ks->norm & V4L2_STD_525_60)
			/* force 60 Hz */
			/* force 60 Hz */
			ks0127_and_or(sd, KS_CMDA,   0xfc, 0x03);
			ks0127_and_or(sd, KS_CMDA,   0xfc, 0x03);
@@ -531,7 +531,7 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r


	default:
	default:
		v4l2_dbg(1, debug, sd,
		v4l2_dbg(1, debug, sd,
			"VIDIOC_INT_S_VIDEO_ROUTING: Unknown input %d\n", route->input);
			"s_routing: Unknown input %d\n", route->input);
		break;
		break;
	}
	}


@@ -551,23 +551,23 @@ static int ks0127_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
	ks->norm = std;
	ks->norm = std;
	if (std & V4L2_STD_NTSC) {
	if (std & V4L2_STD_NTSC) {
		v4l2_dbg(1, debug, sd,
		v4l2_dbg(1, debug, sd,
			"VIDIOC_S_STD: NTSC_M\n");
			"s_std: NTSC_M\n");
		ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x20);
		ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x20);
	} else if (std & V4L2_STD_PAL_N) {
	} else if (std & V4L2_STD_PAL_N) {
		v4l2_dbg(1, debug, sd,
		v4l2_dbg(1, debug, sd,
			"KS0127_SET_NORM: NTSC_N (fixme)\n");
			"s_std: NTSC_N (fixme)\n");
		ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x40);
		ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x40);
	} else if (std & V4L2_STD_PAL) {
	} else if (std & V4L2_STD_PAL) {
		v4l2_dbg(1, debug, sd,
		v4l2_dbg(1, debug, sd,
			"VIDIOC_S_STD: PAL_N\n");
			"s_std: PAL_N\n");
		ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x20);
		ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x20);
	} else if (std & V4L2_STD_PAL_M) {
	} else if (std & V4L2_STD_PAL_M) {
		v4l2_dbg(1, debug, sd,
		v4l2_dbg(1, debug, sd,
			"KS0127_SET_NORM: PAL_M (fixme)\n");
			"s_std: PAL_M (fixme)\n");
		ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x40);
		ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x40);
	} else if (std & V4L2_STD_SECAM) {
	} else if (std & V4L2_STD_SECAM) {
		v4l2_dbg(1, debug, sd,
		v4l2_dbg(1, debug, sd,
			"KS0127_SET_NORM: SECAM\n");
			"s_std: SECAM\n");


		/* set to secam autodetection */
		/* set to secam autodetection */
		ks0127_and_or(sd, KS_CHROMA, 0xdf, 0x20);
		ks0127_and_or(sd, KS_CHROMA, 0xdf, 0x20);
@@ -579,7 +579,7 @@ static int ks0127_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
			/* force to secam mode */
			/* force to secam mode */
			ks0127_and_or(sd, KS_DEMOD, 0xf0, 0x0f);
			ks0127_and_or(sd, KS_DEMOD, 0xf0, 0x0f);
	} else {
	} else {
		v4l2_dbg(1, debug, sd, "VIDIOC_S_STD: Unknown norm %llx\n",
		v4l2_dbg(1, debug, sd, "s_std: Unknown norm %llx\n",
			       (unsigned long long)std);
			       (unsigned long long)std);
	}
	}
	return 0;
	return 0;
@@ -608,7 +608,6 @@ static int ks0127_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pstd
	u8 status;
	u8 status;
	v4l2_std_id std = V4L2_STD_ALL;
	v4l2_std_id std = V4L2_STD_ALL;


	v4l2_dbg(1, debug, sd, "VIDIOC_QUERYSTD/VIDIOC_INT_G_INPUT_STATUS\n");
	status = ks0127_read(sd, KS_STAT);
	status = ks0127_read(sd, KS_STAT);
	if (!(status & 0x20))		 /* NOVID not set */
	if (!(status & 0x20))		 /* NOVID not set */
		stat = 0;
		stat = 0;
@@ -627,11 +626,13 @@ static int ks0127_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pstd


static int ks0127_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
static int ks0127_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
{
{
	v4l2_dbg(1, debug, sd, "querystd\n");
	return ks0127_status(sd, NULL, std);
	return ks0127_status(sd, NULL, std);
}
}


static int ks0127_g_input_status(struct v4l2_subdev *sd, u32 *status)
static int ks0127_g_input_status(struct v4l2_subdev *sd, u32 *status)
{
{
	v4l2_dbg(1, debug, sd, "g_input_status\n");
	return ks0127_status(sd, status, NULL);
	return ks0127_status(sd, status, NULL);
}
}


+2 −2
Original line number Original line Diff line number Diff line
@@ -931,8 +931,8 @@ static void saa711x_set_v4lstd(struct v4l2_subdev *sd, v4l2_std_id std)
	/* Prevent unnecessary standard changes. During a standard
	/* Prevent unnecessary standard changes. During a standard
	   change the I-Port is temporarily disabled. Any devices
	   change the I-Port is temporarily disabled. Any devices
	   reading from that port can get confused.
	   reading from that port can get confused.
	   Note that VIDIOC_S_STD is also used to switch from
	   Note that s_std is also used to switch from
	   radio to TV mode, so if a VIDIOC_S_STD is broadcast to
	   radio to TV mode, so if a s_std is broadcast to
	   all I2C devices then you do not want to have an unwanted
	   all I2C devices then you do not want to have an unwanted
	   side-effect here. */
	   side-effect here. */
	if (std == state->std)
	if (std == state->std)
+7 −10
Original line number Original line Diff line number Diff line
@@ -778,8 +778,7 @@ static int tuner_s_radio(struct v4l2_subdev *sd)
	struct tuner *t = to_tuner(sd);
	struct tuner *t = to_tuner(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);


	if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO")
	if (set_mode(client, t, V4L2_TUNER_RADIO, "s_radio") == -EINVAL)
			== -EINVAL)
		return 0;
		return 0;
	if (t->radio_freq)
	if (t->radio_freq)
		set_freq(client, t->radio_freq);
		set_freq(client, t->radio_freq);
@@ -793,7 +792,7 @@ static int tuner_s_standby(struct v4l2_subdev *sd, u32 standby)


	tuner_dbg("Putting tuner to sleep\n");
	tuner_dbg("Putting tuner to sleep\n");


	if (check_mode(t, "TUNER_SET_STANDBY") == -EINVAL)
	if (check_mode(t, "s_standby") == -EINVAL)
		return 0;
		return 0;
	t->mode = T_STANDBY;
	t->mode = T_STANDBY;
	if (analog_ops->standby)
	if (analog_ops->standby)
@@ -952,8 +951,7 @@ static int tuner_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
	struct tuner *t = to_tuner(sd);
	struct tuner *t = to_tuner(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);


	if (set_mode(client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD")
	if (set_mode(client, t, V4L2_TUNER_ANALOG_TV, "s_std") == -EINVAL)
			== -EINVAL)
		return 0;
		return 0;


	switch_v4l2();
	switch_v4l2();
@@ -970,8 +968,7 @@ static int tuner_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
	struct tuner *t = to_tuner(sd);
	struct tuner *t = to_tuner(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);


	if (set_mode(client, t, f->type, "VIDIOC_S_FREQUENCY")
	if (set_mode(client, t, f->type, "s_frequency") == -EINVAL)
			== -EINVAL)
		return 0;
		return 0;
	switch_v4l2();
	switch_v4l2();
	set_freq(client, f->frequency);
	set_freq(client, f->frequency);
@@ -984,7 +981,7 @@ static int tuner_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
	struct tuner *t = to_tuner(sd);
	struct tuner *t = to_tuner(sd);
	struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
	struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;


	if (check_mode(t, "VIDIOC_G_FREQUENCY") == -EINVAL)
	if (check_mode(t, "g_frequency") == -EINVAL)
		return 0;
		return 0;
	switch_v4l2();
	switch_v4l2();
	f->type = t->mode;
	f->type = t->mode;
@@ -1008,7 +1005,7 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
	struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
	struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
	struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
	struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;


	if (check_mode(t, "VIDIOC_G_TUNER") == -EINVAL)
	if (check_mode(t, "g_tuner") == -EINVAL)
		return 0;
		return 0;
	switch_v4l2();
	switch_v4l2();


@@ -1057,7 +1054,7 @@ static int tuner_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
	struct tuner *t = to_tuner(sd);
	struct tuner *t = to_tuner(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);


	if (check_mode(t, "VIDIOC_S_TUNER") == -EINVAL)
	if (check_mode(t, "s_tuner") == -EINVAL)
		return 0;
		return 0;


	switch_v4l2();
	switch_v4l2();
+4 −4
Original line number Original line Diff line number Diff line
@@ -631,7 +631,7 @@ static int tvp5150_g_sliced_vbi_cap(struct v4l2_subdev *sd,
	const struct i2c_vbi_ram_value *regs = vbi_ram_default;
	const struct i2c_vbi_ram_value *regs = vbi_ram_default;
	int line;
	int line;


	v4l2_dbg(1, debug, sd, "VIDIOC_G_SLICED_VBI_CAP\n");
	v4l2_dbg(1, debug, sd, "g_sliced_vbi_cap\n");
	memset(cap, 0, sizeof *cap);
	memset(cap, 0, sizeof *cap);


	while (regs->reg != (u16)-1 ) {
	while (regs->reg != (u16)-1 ) {
@@ -830,7 +830,7 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32 val)


static int tvp5150_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int tvp5150_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
{
	v4l2_dbg(1, debug, sd, "VIDIOC_G_CTRL called\n");
	v4l2_dbg(1, debug, sd, "g_ctrl called\n");


	switch (ctrl->id) {
	switch (ctrl->id) {
	case V4L2_CID_BRIGHTNESS:
	case V4L2_CID_BRIGHTNESS:
@@ -860,7 +860,7 @@ static int tvp5150_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
		if (ctrl->value < tvp5150_qctrl[i].minimum ||
		if (ctrl->value < tvp5150_qctrl[i].minimum ||
		    ctrl->value > tvp5150_qctrl[i].maximum)
		    ctrl->value > tvp5150_qctrl[i].maximum)
			return -ERANGE;
			return -ERANGE;
		v4l2_dbg(1, debug, sd, "VIDIOC_S_CTRL: id=%d, value=%d\n",
		v4l2_dbg(1, debug, sd, "s_ctrl: id=%d, value=%d\n",
					ctrl->id, ctrl->value);
					ctrl->id, ctrl->value);
		break;
		break;
	}
	}
@@ -1014,7 +1014,7 @@ static int tvp5150_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
{
{
	int i;
	int i;


	v4l2_dbg(1, debug, sd, "VIDIOC_QUERYCTRL called\n");
	v4l2_dbg(1, debug, sd, "queryctrl called\n");


	for (i = 0; i < ARRAY_SIZE(tvp5150_qctrl); i++)
	for (i = 0; i < ARRAY_SIZE(tvp5150_qctrl); i++)
		if (qc->id && qc->id == tvp5150_qctrl[i].id) {
		if (qc->id && qc->id == tvp5150_qctrl[i].id) {
+4 −4
Original line number Original line Diff line number Diff line
@@ -296,8 +296,6 @@ static int vpx3220_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pst
	int res = V4L2_IN_ST_NO_SIGNAL, status;
	int res = V4L2_IN_ST_NO_SIGNAL, status;
	v4l2_std_id std = 0;
	v4l2_std_id std = 0;


	v4l2_dbg(1, debug, sd, "VIDIOC_QUERYSTD/VIDIOC_INT_G_INPUT_STATUS\n");

	status = vpx3220_fp_read(sd, 0x0f3);
	status = vpx3220_fp_read(sd, 0x0f3);


	v4l2_dbg(1, debug, sd, "status: 0x%04x\n", status);
	v4l2_dbg(1, debug, sd, "status: 0x%04x\n", status);
@@ -336,11 +334,13 @@ static int vpx3220_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pst


static int vpx3220_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
static int vpx3220_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
{
{
	v4l2_dbg(1, debug, sd, "querystd\n");
	return vpx3220_status(sd, NULL, std);
	return vpx3220_status(sd, NULL, std);
}
}


static int vpx3220_g_input_status(struct v4l2_subdev *sd, u32 *status)
static int vpx3220_g_input_status(struct v4l2_subdev *sd, u32 *status)
{
{
	v4l2_dbg(1, debug, sd, "g_input_status\n");
	return vpx3220_status(sd, status, NULL);
	return vpx3220_status(sd, status, NULL);
}
}


@@ -354,7 +354,7 @@ static int vpx3220_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
	   choosen video norm */
	   choosen video norm */
	temp_input = vpx3220_fp_read(sd, 0xf2);
	temp_input = vpx3220_fp_read(sd, 0xf2);


	v4l2_dbg(1, debug, sd, "VIDIOC_S_STD %llx\n", (unsigned long long)std);
	v4l2_dbg(1, debug, sd, "s_std %llx\n", (unsigned long long)std);
	if (std & V4L2_STD_NTSC) {
	if (std & V4L2_STD_NTSC) {
		vpx3220_write_fp_block(sd, init_ntsc, sizeof(init_ntsc) >> 1);
		vpx3220_write_fp_block(sd, init_ntsc, sizeof(init_ntsc) >> 1);
		v4l2_dbg(1, debug, sd, "norm switched to NTSC\n");
		v4l2_dbg(1, debug, sd, "norm switched to NTSC\n");
@@ -410,7 +410,7 @@ static int vpx3220_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *


static int vpx3220_s_stream(struct v4l2_subdev *sd, int enable)
static int vpx3220_s_stream(struct v4l2_subdev *sd, int enable)
{
{
	v4l2_dbg(1, debug, sd, "VIDIOC_STREAM%s\n", enable ? "ON" : "OFF");
	v4l2_dbg(1, debug, sd, "s_stream %s\n", enable ? "on" : "off");


	vpx3220_write(sd, 0xf2, (enable ? 0x1b : 0x00));
	vpx3220_write(sd, 0xf2, (enable ? 0x1b : 0x00));
	return 0;
	return 0;