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

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

V4L/DVB (11369): v4l2-subdev: add load_fw and use that instead of abusing core->init.



The init callback was used in several places to load firmware. Make a separate
load_fw callback for that. This makes the code a lot more understandable.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7c9fc9d5
Loading
Loading
Loading
Loading
+30 −30
Original line number Diff line number Diff line
@@ -203,11 +203,8 @@ static int cx18_av_reset(struct v4l2_subdev *sd, u32 val)

static int cx18_av_init(struct v4l2_subdev *sd, u32 val)
{
	struct cx18_av_state *state = to_cx18_av_state(sd);
	struct cx18 *cx = v4l2_get_subdevdata(sd);

	switch (val) {
	case CX18_AV_INIT_PLLS:
	/*
	 * The crystal freq used in calculations in this driver will be
	 * 28.636360 MHz.
@@ -230,17 +227,19 @@ static int cx18_av_init(struct v4l2_subdev *sd, u32 val)

	/* SA_MCLK_SEL=1, SA_MCLK_DIV=0x16 */
	cx18_av_write(cx, CXADEC_I2S_MCLK, 0x56);
		break;
	return 0;
}

static int cx18_av_load_fw(struct v4l2_subdev *sd)
{
	struct cx18_av_state *state = to_cx18_av_state(sd);
	struct cx18 *cx = v4l2_get_subdevdata(sd);

	case CX18_AV_INIT_NORMAL:
	default:
	if (!state->is_initialized) {
		/* initialize on first use */
		state->is_initialized = 1;
		cx18_av_initialize(cx);
	}
		break;
	}
	return 0;
}

@@ -1185,6 +1184,7 @@ static const struct v4l2_subdev_core_ops cx18_av_general_ops = {
	.g_chip_ident = cx18_av_g_chip_ident,
	.log_status = cx18_av_log_status,
	.init = cx18_av_init,
	.load_fw = cx18_av_load_fw,
	.reset = cx18_av_reset,
	.queryctrl = cx18_av_queryctrl,
	.g_ctrl = cx18_av_g_ctrl,
+0 −5
Original line number Diff line number Diff line
@@ -328,11 +328,6 @@ static inline struct cx18_av_state *to_cx18_av_state(struct v4l2_subdev *sd)
	return container_of(sd, struct cx18_av_state, sd);
}

enum cx18_av_subdev_init_arg {
	CX18_AV_INIT_NORMAL = 0,
	CX18_AV_INIT_PLLS = 1,
};

/* ----------------------------------------------------------------------- */
/* cx18_av-core.c 							   */
int cx18_av_write(struct cx18 *cx, u16 addr, u8 value);
+2 −2
Original line number Diff line number Diff line
@@ -810,7 +810,7 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
		CX18_ERR("Could not register A/V decoder subdevice\n");
		goto free_map;
	}
	cx18_call_hw(cx, CX18_HW_418_AV, core, init, (u32) CX18_AV_INIT_PLLS);
	cx18_call_hw(cx, CX18_HW_418_AV, core, init, 0);

	/* Initialize GPIO Reset Controller to do chip resets during i2c init */
	if (cx->card->hw_all & CX18_HW_GPIO_RESET_CTRL) {
@@ -1028,7 +1028,7 @@ int cx18_init_on_first_open(struct cx18 *cx)
	cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG);

	/* Init the A/V decoder, if it hasn't been already */
	v4l2_subdev_call(cx->sd_av, core, init, (u32) CX18_AV_INIT_NORMAL);
	v4l2_subdev_call(cx->sd_av, core, load_fw);

	vf.tuner = 0;
	vf.type = V4L2_TUNER_ANALOG_TV;
+1 −1
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ void cx231xx_card_setup(struct cx231xx *dev)
					"cx25840", "cx25840", 0x88 >> 1);
		if (dev->sd_cx25840 == NULL)
			cx231xx_info("cx25840 subdev registration failure\n");
		cx25840_call(dev, core, init, 0);
		cx25840_call(dev, core, load_fw);

	}

+1 −1
Original line number Diff line number Diff line
@@ -741,7 +741,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
	case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
		dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->i2c_bus[2].i2c_adap,
				"cx25840", "cx25840", 0x88 >> 1);
		v4l2_subdev_call(dev->sd_cx25840, core, init, 0);
		v4l2_subdev_call(dev->sd_cx25840, core, load_fw);
		break;
	}

Loading