Commit ebc3bba5 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB: msp3400: convert to the new control framework

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e3560543
This diff is collapsed.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <media/msp3400.h> #include <media/msp3400.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
...@@ -51,6 +52,7 @@ extern int msp_stereo_thresh; ...@@ -51,6 +52,7 @@ extern int msp_stereo_thresh;
struct msp_state { struct msp_state {
struct v4l2_subdev sd; struct v4l2_subdev sd;
struct v4l2_ctrl_handler hdl;
int rev1, rev2; int rev1, rev2;
int ident; int ident;
u8 has_nicam; u8 has_nicam;
...@@ -87,9 +89,12 @@ struct msp_state { ...@@ -87,9 +89,12 @@ struct msp_state {
int audmode; int audmode;
int rxsubchans; int rxsubchans;
int volume, muted; struct {
int balance, loudness; /* volume cluster */
int bass, treble; struct v4l2_ctrl *volume;
struct v4l2_ctrl *muted;
};
int scan_in_progress; int scan_in_progress;
/* thread */ /* thread */
...@@ -104,6 +109,11 @@ static inline struct msp_state *to_state(struct v4l2_subdev *sd) ...@@ -104,6 +109,11 @@ static inline struct msp_state *to_state(struct v4l2_subdev *sd)
return container_of(sd, struct msp_state, sd); return container_of(sd, struct msp_state, sd);
} }
static inline struct msp_state *ctrl_to_state(struct v4l2_ctrl *ctrl)
{
return container_of(ctrl->handler, struct msp_state, hdl);
}
/* msp3400-driver.c */ /* msp3400-driver.c */
int msp_write_dem(struct i2c_client *client, int addr, int val); int msp_write_dem(struct i2c_client *client, int addr, int val);
int msp_write_dsp(struct i2c_client *client, int addr, int val); int msp_write_dsp(struct i2c_client *client, int addr, int val);
...@@ -111,7 +121,7 @@ int msp_read_dem(struct i2c_client *client, int addr); ...@@ -111,7 +121,7 @@ int msp_read_dem(struct i2c_client *client, int addr);
int msp_read_dsp(struct i2c_client *client, int addr); int msp_read_dsp(struct i2c_client *client, int addr);
int msp_reset(struct i2c_client *client); int msp_reset(struct i2c_client *client);
void msp_set_scart(struct i2c_client *client, int in, int out); void msp_set_scart(struct i2c_client *client, int in, int out);
void msp_set_audio(struct i2c_client *client); void msp_update_volume(struct msp_state *state);
int msp_sleep(struct msp_state *state, int timeout); int msp_sleep(struct msp_state *state, int timeout);
/* msp3400-kthreads.c */ /* msp3400-kthreads.c */
......
...@@ -496,13 +496,13 @@ int msp3400c_thread(void *data) ...@@ -496,13 +496,13 @@ int msp3400c_thread(void *data)
v4l_dbg(1, msp_debug, client, v4l_dbg(1, msp_debug, client,
"thread: no carrier scan\n"); "thread: no carrier scan\n");
state->scan_in_progress = 0; state->scan_in_progress = 0;
msp_set_audio(client); msp_update_volume(state);
continue; continue;
} }
/* mute audio */ /* mute audio */
state->scan_in_progress = 1; state->scan_in_progress = 1;
msp_set_audio(client); msp_update_volume(state);
msp3400c_set_mode(client, MSP_MODE_AM_DETECT); msp3400c_set_mode(client, MSP_MODE_AM_DETECT);
val1 = val2 = 0; val1 = val2 = 0;
...@@ -634,7 +634,7 @@ int msp3400c_thread(void *data) ...@@ -634,7 +634,7 @@ int msp3400c_thread(void *data)
/* unmute */ /* unmute */
state->scan_in_progress = 0; state->scan_in_progress = 0;
msp3400c_set_audmode(client); msp3400c_set_audmode(client);
msp_set_audio(client); msp_update_volume(state);
if (msp_debug) if (msp_debug)
msp3400c_print_mode(client); msp3400c_print_mode(client);
...@@ -679,13 +679,13 @@ int msp3410d_thread(void *data) ...@@ -679,13 +679,13 @@ int msp3410d_thread(void *data)
v4l_dbg(1, msp_debug, client, v4l_dbg(1, msp_debug, client,
"thread: no carrier scan\n"); "thread: no carrier scan\n");
state->scan_in_progress = 0; state->scan_in_progress = 0;
msp_set_audio(client); msp_update_volume(state);
continue; continue;
} }
/* mute audio */ /* mute audio */
state->scan_in_progress = 1; state->scan_in_progress = 1;
msp_set_audio(client); msp_update_volume(state);
/* start autodetect. Note: autodetect is not supported for /* start autodetect. Note: autodetect is not supported for
NTSC-M and radio, hence we force the standard in those NTSC-M and radio, hence we force the standard in those
...@@ -797,7 +797,7 @@ int msp3410d_thread(void *data) ...@@ -797,7 +797,7 @@ int msp3410d_thread(void *data)
/* unmute */ /* unmute */
msp3400c_set_audmode(client); msp3400c_set_audmode(client);
state->scan_in_progress = 0; state->scan_in_progress = 0;
msp_set_audio(client); msp_update_volume(state);
/* monitor tv audio mode, the first time don't wait /* monitor tv audio mode, the first time don't wait
so long to get a quick stereo/bilingual result */ so long to get a quick stereo/bilingual result */
...@@ -974,7 +974,7 @@ int msp34xxg_thread(void *data) ...@@ -974,7 +974,7 @@ int msp34xxg_thread(void *data)
v4l_dbg(1, msp_debug, client, v4l_dbg(1, msp_debug, client,
"thread: no carrier scan\n"); "thread: no carrier scan\n");
state->scan_in_progress = 0; state->scan_in_progress = 0;
msp_set_audio(client); msp_update_volume(state);
continue; continue;
} }
...@@ -1020,7 +1020,7 @@ int msp34xxg_thread(void *data) ...@@ -1020,7 +1020,7 @@ int msp34xxg_thread(void *data)
} }
/* unmute: dispatch sound to scart output, set scart volume */ /* unmute: dispatch sound to scart output, set scart volume */
msp_set_audio(client); msp_update_volume(state);
/* restore ACB */ /* restore ACB */
if (msp_write_dsp(client, 0x13, state->acb)) if (msp_write_dsp(client, 0x13, state->acb))
......
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