Commit 606cf9ca authored by Mike Isely's avatar Mike Isely Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (5093): Pvrusb2: Emit VIDIOC_S_TUNER correctly



Audio mode changes are not private to the audio chip - other I2C
modules need to see this as well.  And since the command in question
is VIDIOC_S_TUNER which is a standard v4l2 command, we really should
be broadcasting it out.  This change sets up a broadcast pathway for
VIDIOC_S_TUNER and also eliminates the now redundant code from the
audio chip handler.
This fix enables stereo reception for the FM radio

Signed-off-by: default avatarMike Isely <isely@pobox.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 27c7b710
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -43,13 +43,6 @@ static void set_stereo(struct pvr2_msp3400_handler *ctxt)

	pvr2_trace(PVR2_TRACE_CHIPS,"i2c msp3400 v4l2 set_stereo");

	if (hdw->input_val == PVR2_CVAL_INPUT_TV) {
		struct v4l2_tuner vt;
		memset(&vt,0,sizeof(vt));
		vt.audmode = hdw->audiomode_val;
		pvr2_i2c_client_cmd(ctxt->client,VIDIOC_S_TUNER,&vt);
	}

	route.input = MSP_INPUT_DEFAULT;
	route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
	switch (hdw->input_val) {
@@ -77,8 +70,7 @@ static void set_stereo(struct pvr2_msp3400_handler *ctxt)
static int check_stereo(struct pvr2_msp3400_handler *ctxt)
{
	struct pvr2_hdw *hdw = ctxt->hdw;
	return (hdw->input_dirty ||
		hdw->audiomode_dirty);
	return hdw->input_dirty;
}


+9 −6
Original line number Diff line number Diff line
@@ -33,15 +33,17 @@
#define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__)

#define OP_STANDARD 0
#define OP_BCSH 1
#define OP_VOLUME 2
#define OP_FREQ 3
#define OP_AUDIORATE 4
#define OP_SIZE 5
#define OP_LOG 6
#define OP_AUDIOMODE 1
#define OP_BCSH 2
#define OP_VOLUME 3
#define OP_FREQ 4
#define OP_AUDIORATE 5
#define OP_SIZE 6
#define OP_LOG 7

static const struct pvr2_i2c_op * const ops[] = {
	[OP_STANDARD] = &pvr2_i2c_op_v4l2_standard,
	[OP_AUDIOMODE] = &pvr2_i2c_op_v4l2_audiomode,
	[OP_BCSH] = &pvr2_i2c_op_v4l2_bcsh,
	[OP_VOLUME] = &pvr2_i2c_op_v4l2_volume,
	[OP_FREQ] = &pvr2_i2c_op_v4l2_frequency,
@@ -54,6 +56,7 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
	int id;
	id = cp->client->driver->id;
	cp->ctl_mask = ((1 << OP_STANDARD) |
			(1 << OP_AUDIOMODE) |
			(1 << OP_BCSH) |
			(1 << OP_VOLUME) |
			(1 << OP_FREQ) |
+23 −0
Original line number Diff line number Diff line
@@ -140,6 +140,29 @@ const struct pvr2_i2c_op pvr2_i2c_op_v4l2_volume = {
};


static void set_audiomode(struct pvr2_hdw *hdw)
{
	struct v4l2_tuner vt;
	memset(&vt,0,sizeof(vt));
	vt.audmode = hdw->audiomode_val;
	pvr2_i2c_core_cmd(hdw,VIDIOC_S_TUNER,&vt);
}


static int check_audiomode(struct pvr2_hdw *hdw)
{
	return (hdw->input_dirty ||
		hdw->audiomode_dirty);
}


const struct pvr2_i2c_op pvr2_i2c_op_v4l2_audiomode = {
	.check = check_audiomode,
	.update = set_audiomode,
	.name = "v4l2_audiomode",
};


static void set_frequency(struct pvr2_hdw *hdw)
{
	unsigned long fv;
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_bcsh;
extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_volume;
extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_frequency;
extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_size;
extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_audiomode;
extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_log;

void pvr2_v4l2_cmd_stream(struct pvr2_i2c_client *,int);