V4L/DVB (11380): v4l2-subdev: change s_routing prototype

It is no longer needed to use a struct pointer as argument, since v4l2_subdev
doesn't require that ioctl-like approach anymore. Instead just pass the input,
output and config (new!) arguments directly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Hans Verkuil 2009-04-02 11:26:22 -03:00 committed by Mauro Carvalho Chehab
parent c0ff29150d
commit 5325b4272a
57 changed files with 370 additions and 444 deletions

View file

@ -652,7 +652,7 @@ static int au8522_reset(struct v4l2_subdev *sd, u32 val)
}
static int au8522_s_video_routing(struct v4l2_subdev *sd,
const struct v4l2_routing *route)
u32 input, u32 output, u32 config)
{
struct au8522_state *state = to_state(sd);
@ -663,11 +663,11 @@ static int au8522_s_video_routing(struct v4l2_subdev *sd,
closed), and then came back to analog mode */
au8522_writereg(state, 0x106, 1);
if (route->input == AU8522_COMPOSITE_CH1) {
if (input == AU8522_COMPOSITE_CH1) {
au8522_setup_cvbs_mode(state);
} else if (route->input == AU8522_SVIDEO_CH13) {
} else if (input == AU8522_SVIDEO_CH13) {
au8522_setup_svideo_mode(state);
} else if (route->input == AU8522_COMPOSITE_CH4_SIF) {
} else if (input == AU8522_COMPOSITE_CH4_SIF) {
au8522_setup_cvbs_tuner_mode(state);
} else {
printk(KERN_ERR "au8522 mode not currently supported\n");
@ -677,10 +677,10 @@ static int au8522_s_video_routing(struct v4l2_subdev *sd,
}
static int au8522_s_audio_routing(struct v4l2_subdev *sd,
const struct v4l2_routing *route)
u32 input, u32 output, u32 config)
{
struct au8522_state *state = to_state(sd);
set_audio_input(state, route->input);
set_audio_input(state, input);
return 0;
}

View file

@ -219,18 +219,19 @@ static int adv7170_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std)
return 0;
}
static int adv7170_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int adv7170_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct adv7170 *encoder = to_adv7170(sd);
/* RJ: route->input = 0: input is from decoder
route->input = 1: input is from ZR36060
route->input = 2: color bar */
/* RJ: input = 0: input is from decoder
input = 1: input is from ZR36060
input = 2: color bar */
v4l2_dbg(1, debug, sd, "set input from %s\n",
route->input == 0 ? "decoder" : "ZR36060");
input == 0 ? "decoder" : "ZR36060");
switch (route->input) {
switch (input) {
case 0:
adv7170_write(sd, 0x01, 0x20);
adv7170_write(sd, 0x08, TR1CAPT); /* TR1 */
@ -250,11 +251,11 @@ static int adv7170_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *
break;
default:
v4l2_dbg(1, debug, sd, "illegal input: %d\n", route->input);
v4l2_dbg(1, debug, sd, "illegal input: %d\n", input);
return -EINVAL;
}
v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[route->input]);
encoder->input = route->input;
v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[input]);
encoder->input = input;
return 0;
}

View file

@ -237,15 +237,16 @@ static int adv7175_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std)
return 0;
}
static int adv7175_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int adv7175_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct adv7175 *encoder = to_adv7175(sd);
/* RJ: route->input = 0: input is from decoder
route->input = 1: input is from ZR36060
route->input = 2: color bar */
/* RJ: input = 0: input is from decoder
input = 1: input is from ZR36060
input = 2: color bar */
switch (route->input) {
switch (input) {
case 0:
adv7175_write(sd, 0x01, 0x00);
@ -288,11 +289,11 @@ static int adv7175_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *
break;
default:
v4l2_dbg(1, debug, sd, "illegal input: %d\n", route->input);
v4l2_dbg(1, debug, sd, "illegal input: %d\n", input);
return -EINVAL;
}
v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[route->input]);
encoder->input = route->input;
v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[input]);
encoder->input = input;
return 0;
}

View file

@ -1154,7 +1154,6 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
struct au0828_fh *fh = priv;
struct au0828_dev *dev = fh->dev;
int i;
struct v4l2_routing route;
dprintk(1, "VIDIOC_S_INPUT in function %s, input=%d\n", __func__,
index);
@ -1180,9 +1179,8 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
break;
}
route.input = AUVI_INPUT(index).vmux;
route.output = 0;
v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route);
v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing,
AUVI_INPUT(index).vmux, 0, 0);
for (i = 0; i < AU0828_MAX_INPUT; i++) {
int enable = 0;
@ -1205,8 +1203,8 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
}
}
route.input = AUVI_INPUT(index).amux;
v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route);
v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing,
AUVI_INPUT(index).amux, 0, 0);
return 0;
}

View file

@ -292,21 +292,22 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
return 0;
}
static int bt819_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int bt819_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct bt819 *decoder = to_bt819(sd);
v4l2_dbg(1, debug, sd, "set input %x\n", route->input);
v4l2_dbg(1, debug, sd, "set input %x\n", input);
if (route->input < 0 || route->input > 7)
if (input < 0 || input > 7)
return -EINVAL;
if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL)
v4l2_err(sd, "no notify found!\n");
if (decoder->input != route->input) {
if (decoder->input != input) {
v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0);
decoder->input = route->input;
decoder->input = input;
/* select mode */
if (decoder->input == 0) {
bt819_setbit(decoder, 0x0b, 6, 0);

View file

@ -142,16 +142,17 @@ static int bt856_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std)
return 0;
}
static int bt856_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int bt856_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct bt856 *encoder = to_bt856(sd);
v4l2_dbg(1, debug, sd, "set input %d\n", route->input);
v4l2_dbg(1, debug, sd, "set input %d\n", input);
/* We only have video bus.
* route->input= 0: input is from bt819
* route->input= 1: input is from ZR36060 */
switch (route->input) {
* input= 0: input is from bt819
* input= 1: input is from ZR36060 */
switch (input) {
case 0:
bt856_setbit(encoder, 0xde, 4, 0);
bt856_setbit(encoder, 0xde, 3, 1);

View file

@ -99,7 +99,8 @@ static int bt866_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std)
return 0;
}
static int bt866_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int bt866_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
static const __u8 init[] = {
0xc8, 0xcc, /* CRSCALE */
@ -137,7 +138,7 @@ static int bt866_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *ro
val = encoder->reg[0xdc];
if (route->input == 0)
if (input == 0)
val |= 0x40; /* CBSWAP */
else
val &= ~0x40; /* !CBSWAP */
@ -145,15 +146,15 @@ static int bt866_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *ro
bt866_write(encoder, 0xdc, val);
val = encoder->reg[0xcc];
if (route->input == 2)
if (input == 2)
val |= 0x01; /* OSDBAR */
else
val &= ~0x01; /* !OSDBAR */
bt866_write(encoder, 0xcc, val);
v4l2_dbg(1, debug, sd, "set input %d\n", route->input);
v4l2_dbg(1, debug, sd, "set input %d\n", input);
switch (route->input) {
switch (input) {
case 0:
case 1:
case 2:

View file

@ -1198,7 +1198,7 @@ audio_mux(struct bttv *btv, int input, int mute)
ctrl.value = btv->mute;
bttv_call_all(btv, core, s_ctrl, &ctrl);
if (btv->sd_msp34xx) {
struct v4l2_routing route;
u32 in;
/* Note: the inputs tuner/radio/extern/intern are translated
to msp routings. This assumes common behavior for all msp3400
@ -1207,11 +1207,11 @@ audio_mux(struct bttv *btv, int input, int mute)
For now this is sufficient. */
switch (input) {
case TVAUDIO_INPUT_RADIO:
route.input = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
break;
case TVAUDIO_INPUT_EXTERN:
route.input = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
in = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
break;
case TVAUDIO_INPUT_INTERN:
@ -1220,7 +1220,7 @@ audio_mux(struct bttv *btv, int input, int mute)
input is the BTTV_BOARD_AVERMEDIA98. I wonder how
that was tested. My guess is that the whole INTERN
input does not work. */
route.input = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
break;
case TVAUDIO_INPUT_TUNER:
@ -1229,21 +1229,18 @@ audio_mux(struct bttv *btv, int input, int mute)
is the only difference between the VOODOOTV_FM
and VOODOOTV_200 */
if (btv->c.type == BTTV_BOARD_VOODOOTV_200)
route.input = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER2, \
in = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER2, \
MSP_DSP_IN_TUNER, MSP_DSP_IN_TUNER);
else
route.input = MSP_INPUT_DEFAULT;
in = MSP_INPUT_DEFAULT;
break;
}
route.output = MSP_OUTPUT_DEFAULT;
v4l2_subdev_call(btv->sd_msp34xx, audio, s_routing, &route);
v4l2_subdev_call(btv->sd_msp34xx, audio, s_routing,
in, MSP_OUTPUT_DEFAULT, 0);
}
if (btv->sd_tvaudio) {
struct v4l2_routing route;
route.input = input;
route.output = 0;
v4l2_subdev_call(btv->sd_tvaudio, audio, s_routing, &route);
v4l2_subdev_call(btv->sd_tvaudio, audio, s_routing,
input, 0, 0);
}
return 0;
}

View file

@ -53,14 +53,15 @@ static inline int cs5345_read(struct v4l2_subdev *sd, u8 reg)
return i2c_smbus_read_byte_data(client, reg);
}
static int cs5345_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int cs5345_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
if ((route->input & 0xf) > 6) {
v4l2_err(sd, "Invalid input %d.\n", route->input);
if ((input & 0xf) > 6) {
v4l2_err(sd, "Invalid input %d.\n", input);
return -EINVAL;
}
cs5345_write(sd, 0x09, route->input & 0xf);
cs5345_write(sd, 0x05, route->input & 0xf0);
cs5345_write(sd, 0x09, input & 0xf);
cs5345_write(sd, 0x05, input & 0xf0);
return 0;
}

View file

@ -58,17 +58,18 @@ static int cs53l32a_read(struct v4l2_subdev *sd, u8 reg)
return i2c_smbus_read_byte_data(client, reg);
}
static int cs53l32a_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int cs53l32a_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
/* There are 2 physical inputs, but the second input can be
placed in two modes, the first mode bypasses the PGA (gain),
the second goes through the PGA. Hence there are three
possible inputs to choose from. */
if (route->input > 2) {
v4l2_err(sd, "Invalid input %d.\n", route->input);
if (input > 2) {
v4l2_err(sd, "Invalid input %d.\n", input);
return -EINVAL;
}
cs53l32a_write(sd, 0x01, 0x01 + (route->input << 4));
cs53l32a_write(sd, 0x01, 0x01 + (input << 4));
return 0;
}

View file

@ -33,7 +33,6 @@
int cx18_audio_set_io(struct cx18 *cx)
{
const struct cx18_card_audio_input *in;
struct v4l2_routing route;
u32 val;
int err;
@ -44,13 +43,11 @@ int cx18_audio_set_io(struct cx18 *cx)
in = &cx->card->audio_inputs[cx->audio_input];
/* handle muxer chips */
route.input = in->muxer_input;
route.output = 0;
v4l2_subdev_call(cx->sd_extmux, audio, s_routing, &route);
v4l2_subdev_call(cx->sd_extmux, audio, s_routing,
in->audio_input, 0, 0);
route.input = in->audio_input;
err = cx18_call_hw_err(cx, cx->card->hw_audio_ctrl,
audio, s_routing, &route);
audio, s_routing, in->audio_input, 0, 0);
if (err)
return err;

View file

@ -547,19 +547,19 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input,
}
static int cx18_av_s_video_routing(struct v4l2_subdev *sd,
const struct v4l2_routing *route)
u32 input, u32 output, u32 config)
{
struct cx18_av_state *state = to_cx18_av_state(sd);
struct cx18 *cx = v4l2_get_subdevdata(sd);
return set_input(cx, route->input, state->aud_input);
return set_input(cx, input, state->aud_input);
}
static int cx18_av_s_audio_routing(struct v4l2_subdev *sd,
const struct v4l2_routing *route)
u32 input, u32 output, u32 config)
{
struct cx18_av_state *state = to_cx18_av_state(sd);
struct cx18 *cx = v4l2_get_subdevdata(sd);
return set_input(cx, state->vid_input, route->input);
return set_input(cx, state->vid_input, input);
}
static int cx18_av_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)

View file

@ -156,12 +156,12 @@ static int gpiomux_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
}
static int gpiomux_s_audio_routing(struct v4l2_subdev *sd,
const struct v4l2_routing *route)
u32 input, u32 output, u32 config)
{
struct cx18 *cx = v4l2_get_subdevdata(sd);
u32 data;
switch (route->input) {
switch (input) {
case 0:
data = cx->card->gpio_audio_input.tuner;
break;

View file

@ -932,7 +932,7 @@ static long cx18_default(struct file *file, void *fh, int cmd, void *arg)
CX18_DEBUG_IOCTL("VIDIOC_INT_S_AUDIO_ROUTING(%d, %d)\n",
route->input, route->output);
cx18_call_hw(cx, cx->card->hw_audio_ctrl, audio, s_routing,
route);
route->input, route->output, 0);
break;
}

View file

@ -25,20 +25,8 @@
void cx18_video_set_io(struct cx18 *cx)
{
struct v4l2_routing route;
int inp = cx->active_input;
u32 type;
route.input = cx->card->video_inputs[inp].video_input;
route.output = 0;
v4l2_subdev_call(cx->sd_av, video, s_routing, &route);
type = cx->card->video_inputs[inp].video_type;
if (type == CX18_CARD_INPUT_VID_TUNER)
route.input = 0; /* Tuner */
else if (type < CX18_CARD_INPUT_COMPOSITE1)
route.input = 2; /* S-Video */
else
route.input = 1; /* Composite */
v4l2_subdev_call(cx->sd_av, video, s_routing,
cx->card->video_inputs[inp].video_input, 0, 0);
}

View file

@ -357,10 +357,7 @@ int cx231xx_config(struct cx231xx *dev)
*/
void cx231xx_config_i2c(struct cx231xx *dev)
{
struct v4l2_routing route;
route.input = INPUT(dev->video_input)->vmux;
route.output = 0;
/* u32 input = INPUT(dev->video_input)->vmux; */
call_all(dev, video, s_stream, 1);
}

View file

@ -820,17 +820,12 @@ static struct videobuf_queue_ops cx231xx_video_qops = {
void video_mux(struct cx231xx *dev, int index)
{
struct v4l2_routing route;
route.input = INPUT(index)->vmux;
route.output = 0;
dev->video_input = index;
dev->ctl_ainput = INPUT(index)->amux;
cx231xx_set_video_input_mux(dev, index);
cx25840_call(dev, video, s_routing, &route);
cx25840_call(dev, video, s_routing, INPUT(index)->vmux, 0, 0);
cx231xx_set_audio_input(dev, dev->ctl_ainput);

View file

@ -393,9 +393,6 @@ static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh,
static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input)
{
struct v4l2_routing route;
memset(&route, 0, sizeof(route));
dprintk(1, "%s() video_mux: %d [vmux=%d, gpio=0x%x,0x%x,0x%x,0x%x]\n",
__func__,
input, INPUT(input)->vmux,
@ -403,10 +400,9 @@ static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input)
INPUT(input)->gpio2, INPUT(input)->gpio3);
dev->input = input;
route.input = INPUT(input)->vmux;
/* Tell the internal A/V decoder */
v4l2_subdev_call(dev->sd_cx25840, video, s_routing, &route);
v4l2_subdev_call(dev->sd_cx25840, video, s_routing,
INPUT(input)->vmux, 0, 0);
return 0;
}

View file

@ -1322,22 +1322,24 @@ static int cx25840_s_radio(struct v4l2_subdev *sd)
return 0;
}
static int cx25840_s_video_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int cx25840_s_video_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct cx25840_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
return set_input(client, route->input, state->aud_input);
return set_input(client, input, state->aud_input);
}
static int cx25840_s_audio_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int cx25840_s_audio_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct cx25840_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (state->is_cx25836)
return -EINVAL;
return set_input(client, state->vid_input, route->input);
return set_input(client, state->vid_input, input);
}
static int cx25840_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)

View file

@ -428,10 +428,8 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
routes for different inputs. HVR-1300 surely does */
if (core->board.audio_chip &&
core->board.audio_chip == V4L2_IDENT_WM8775) {
struct v4l2_routing route;
route.input = INPUT(input).audioroute;
call_all(core, audio, s_routing, &route);
call_all(core, audio, s_routing,
INPUT(input).audioroute, 0, 0);
}
/* cx2388's C-ADC is connected to the tuner only.
When used with S-Video, that ADC is busy dealing with
@ -823,10 +821,8 @@ static int video_open(struct file *file)
if (core->board.radio.audioroute) {
if(core->board.audio_chip &&
core->board.audio_chip == V4L2_IDENT_WM8775) {
struct v4l2_routing route;
route.input = core->board.radio.audioroute;
call_all(core, audio, s_routing, &route);
call_all(core, audio, s_routing,
core->board.radio.audioroute, 0, 0);
}
/* "I2S ADC mode" */
core->tvaudio = WW_I2SADC;

View file

@ -1018,14 +1018,9 @@ EXPORT_SYMBOL_GPL(em28xx_init_isoc);
*/
void em28xx_wake_i2c(struct em28xx *dev)
{
struct v4l2_routing route;
int zero = 0;
route.input = INPUT(dev->ctl_input)->vmux;
route.output = 0;
v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, zero);
v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route);
v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, 0);
v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing,
INPUT(dev->ctl_input)->vmux, 0, 0);
v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0);
}

View file

@ -515,10 +515,6 @@ static struct videobuf_queue_ops em28xx_video_qops = {
static void video_mux(struct em28xx *dev, int index)
{
struct v4l2_routing route;
route.input = INPUT(index)->vmux;
route.output = 0;
dev->ctl_input = index;
dev->ctl_ainput = INPUT(index)->amux;
dev->ctl_aoutput = INPUT(index)->aout;
@ -526,25 +522,22 @@ static void video_mux(struct em28xx *dev, int index)
if (!dev->ctl_aoutput)
dev->ctl_aoutput = EM28XX_AOUT_MASTER;
v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route);
v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing,
INPUT(index)->vmux, 0, 0);
if (dev->board.has_msp34xx) {
if (dev->i2s_speed) {
v4l2_device_call_all(&dev->v4l2_dev, 0, audio,
s_i2s_clock_freq, dev->i2s_speed);
}
route.input = dev->ctl_ainput;
route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
/* Note: this is msp3400 specific */
v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route);
v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing,
dev->ctl_ainput, MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0);
}
if (dev->board.adecoder != EM28XX_NOADECODER) {
route.input = dev->ctl_ainput;
route.output = dev->ctl_aoutput;
v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route);
v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing,
dev->ctl_ainput, dev->ctl_aoutput, 0);
}
em28xx_audio_analog_set(dev);

View file

@ -248,15 +248,16 @@ static int subdev_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
return 0;
}
static int subdev_s_audio_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int subdev_s_audio_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct ivtv *itv = sd_to_ivtv(sd);
u16 mask, data;
if (route->input > 2)
if (input > 2)
return -EINVAL;
mask = itv->card->gpio_audio_input.mask;
switch (route->input) {
switch (input) {
case 0:
data = itv->card->gpio_audio_input.tuner;
break;
@ -318,17 +319,18 @@ static int subdev_log_status(struct v4l2_subdev *sd)
return 0;
}
static int subdev_s_video_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int subdev_s_video_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct ivtv *itv = sd_to_ivtv(sd);
u16 mask, data;
if (route->input > 2) /* 0:Tuner 1:Composite 2:S-Video */
if (input > 2) /* 0:Tuner 1:Composite 2:S-Video */
return -EINVAL;
mask = itv->card->gpio_video_input.mask;
if (route->input == 0)
if (input == 0)
data = itv->card->gpio_video_input.tuner;
else if (route->input == 1)
else if (input == 1)
data = itv->card->gpio_video_input.composite;
else
data = itv->card->gpio_video_input.svideo;

View file

@ -1033,7 +1033,6 @@ static int ivtv_g_output(struct file *file, void *fh, unsigned int *i)
static int ivtv_s_output(struct file *file, void *fh, unsigned int outp)
{
struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
struct v4l2_routing route;
if (outp >= itv->card->nof_outputs)
return -EINVAL;
@ -1046,9 +1045,9 @@ static int ivtv_s_output(struct file *file, void *fh, unsigned int outp)
itv->active_output, outp);
itv->active_output = outp;
route.input = SAA7127_INPUT_TYPE_NORMAL;
route.output = itv->card->video_outputs[outp].video_output;
ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_routing, &route);
ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_routing,
SAA7127_INPUT_TYPE_NORMAL,
itv->card->video_outputs[outp].video_output, 0);
return 0;
}
@ -1738,7 +1737,8 @@ static long ivtv_default(struct file *file, void *fh, int cmd, void *arg)
case VIDIOC_INT_S_AUDIO_ROUTING: {
struct v4l2_routing *route = arg;
ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing, route);
ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing,
route->input, route->output, 0);
break;
}

View file

@ -34,7 +34,7 @@
void ivtv_audio_set_io(struct ivtv *itv)
{
const struct ivtv_card_audio_input *in;
struct v4l2_routing route;
u32 input, output = 0;
/* Determine which input to use */
if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags))
@ -43,73 +43,77 @@ void ivtv_audio_set_io(struct ivtv *itv)
in = &itv->card->audio_inputs[itv->audio_input];
/* handle muxer chips */
route.input = in->muxer_input;
route.output = 0;
input = in->muxer_input;
if (itv->card->hw_muxer & IVTV_HW_M52790)
route.output = M52790_OUT_STEREO;
v4l2_subdev_call(itv->sd_muxer, audio, s_routing, &route);
output = M52790_OUT_STEREO;
v4l2_subdev_call(itv->sd_muxer, audio, s_routing,
input, output, 0);
route.input = in->audio_input;
route.output = 0;
input = in->audio_input;
output = 0;
if (itv->card->hw_audio & IVTV_HW_MSP34XX)
route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing, &route);
output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing,
input, output, 0);
}
/* Selects the video input and output according to the current
settings. */
void ivtv_video_set_io(struct ivtv *itv)
{
struct v4l2_routing route;
int inp = itv->active_input;
u32 input;
u32 type;
route.input = itv->card->video_inputs[inp].video_input;
route.output = 0;
v4l2_subdev_call(itv->sd_video, video, s_routing, &route);
v4l2_subdev_call(itv->sd_video, video, s_routing,
itv->card->video_inputs[inp].video_input, 0, 0);
type = itv->card->video_inputs[inp].video_type;
if (type == IVTV_CARD_INPUT_VID_TUNER) {
route.input = 0; /* Tuner */
input = 0; /* Tuner */
} else if (type < IVTV_CARD_INPUT_COMPOSITE1) {
route.input = 2; /* S-Video */
input = 2; /* S-Video */
} else {
route.input = 1; /* Composite */
input = 1; /* Composite */
}
if (itv->card->hw_video & IVTV_HW_GPIO)
ivtv_call_hw(itv, IVTV_HW_GPIO, video, s_routing, &route);
ivtv_call_hw(itv, IVTV_HW_GPIO, video, s_routing,
input, 0, 0);
if (itv->card->hw_video & IVTV_HW_UPD64031A) {
if (type == IVTV_CARD_INPUT_VID_TUNER ||
type >= IVTV_CARD_INPUT_COMPOSITE1) {
/* Composite: GR on, connect to 3DYCS */
route.input = UPD64031A_GR_ON | UPD64031A_3DYCS_COMPOSITE;
input = UPD64031A_GR_ON | UPD64031A_3DYCS_COMPOSITE;
} else {
/* S-Video: GR bypassed, turn it off */
route.input = UPD64031A_GR_OFF | UPD64031A_3DYCS_DISABLE;
input = UPD64031A_GR_OFF | UPD64031A_3DYCS_DISABLE;
}
route.input |= itv->card->gr_config;
input |= itv->card->gr_config;
ivtv_call_hw(itv, IVTV_HW_UPD64031A, video, s_routing, &route);
ivtv_call_hw(itv, IVTV_HW_UPD64031A, video, s_routing,
input, 0, 0);
}
if (itv->card->hw_video & IVTV_HW_UPD6408X) {
route.input = UPD64083_YCS_MODE;
input = UPD64083_YCS_MODE;
if (type > IVTV_CARD_INPUT_VID_TUNER &&
type < IVTV_CARD_INPUT_COMPOSITE1) {
/* S-Video uses YCNR mode and internal Y-ADC, the upd64031a
is not used. */
route.input |= UPD64083_YCNR_MODE;
/* S-Video uses YCNR mode and internal Y-ADC, the
upd64031a is not used. */
input |= UPD64083_YCNR_MODE;
}
else if (itv->card->hw_video & IVTV_HW_UPD64031A) {
/* Use upd64031a output for tuner and composite(CX23416GYC only) inputs */
if ((type == IVTV_CARD_INPUT_VID_TUNER)||
(itv->card->type == IVTV_CARD_CX23416GYC)) {
route.input |= UPD64083_EXT_Y_ADC;
}
/* Use upd64031a output for tuner and
composite(CX23416GYC only) inputs */
if (type == IVTV_CARD_INPUT_VID_TUNER ||
itv->card->type == IVTV_CARD_CX23416GYC) {
input |= UPD64083_EXT_Y_ADC;
}
}
ivtv_call_hw(itv, IVTV_HW_UPD6408X, video, s_routing, &route);
ivtv_call_hw(itv, IVTV_HW_UPD6408X, video, s_routing,
input, 0, 0);
}
}

View file

@ -409,11 +409,12 @@ static void ks0127_init(struct v4l2_subdev *sd)
}
}
static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int ks0127_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct ks0127 *ks = to_ks0127(sd);
switch (route->input) {
switch (input) {
case KS_INPUT_COMPOSITE_1:
case KS_INPUT_COMPOSITE_2:
case KS_INPUT_COMPOSITE_3:
@ -421,13 +422,13 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
case KS_INPUT_COMPOSITE_5:
case KS_INPUT_COMPOSITE_6:
v4l2_dbg(1, debug, sd,
"s_routing %d: Composite\n", route->input);
"s_routing %d: Composite\n", input);
/* autodetect 50/60 Hz */
ks0127_and_or(sd, KS_CMDA, 0xfc, 0x00);
/* VSE=0 */
ks0127_and_or(sd, KS_CMDA, ~0x40, 0x00);
/* set input line */
ks0127_and_or(sd, KS_CMDB, 0xb0, route->input);
ks0127_and_or(sd, KS_CMDB, 0xb0, input);
/* non-freerunning mode */
ks0127_and_or(sd, KS_CMDC, 0x70, 0x0a);
/* analog input */
@ -455,13 +456,13 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
case KS_INPUT_SVIDEO_2:
case KS_INPUT_SVIDEO_3:
v4l2_dbg(1, debug, sd,
"s_routing %d: S-Video\n", route->input);
"s_routing %d: S-Video\n", input);
/* autodetect 50/60 Hz */
ks0127_and_or(sd, KS_CMDA, 0xfc, 0x00);
/* VSE=0 */
ks0127_and_or(sd, KS_CMDA, ~0x40, 0x00);
/* set input line */
ks0127_and_or(sd, KS_CMDB, 0xb0, route->input);
ks0127_and_or(sd, KS_CMDB, 0xb0, input);
/* non-freerunning mode */
ks0127_and_or(sd, KS_CMDC, 0x70, 0x0a);
/* analog input */
@ -496,7 +497,7 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
ks0127_and_or(sd, KS_CMDA, 0xff, 0x40); /* VSE=1 */
/* set input line and VALIGN */
ks0127_and_or(sd, KS_CMDB, 0xb0, (route->input | 0x40));
ks0127_and_or(sd, KS_CMDB, 0xb0, (input | 0x40));
/* freerunning mode, */
/* TSTGEN = 1 TSTGFR=11 TSTGPH=0 TSTGPK=0 VMEM=1*/
ks0127_and_or(sd, KS_CMDC, 0x70, 0x87);
@ -531,7 +532,7 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
default:
v4l2_dbg(1, debug, sd,
"s_routing: Unknown input %d\n", route->input);
"s_routing: Unknown input %d\n", input);
break;
}

View file

@ -69,12 +69,13 @@ static int m52790_write(struct v4l2_subdev *sd)
part of the audio output routing. The normal case is that another
chip takes care of the actual muting so making it part of the
output routing seems to be the right thing to do for now. */
static int m52790_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route)
static int m52790_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct m52790_state *state = to_state(sd);
state->input = route->input;
state->output = route->output;
state->input = input;
state->output = output;
m52790_write(sd);
return 0;
}

View file

@ -505,25 +505,26 @@ static int msp_s_std(struct v4l2_subdev *sd, v4l2_std_id id)
return 0;
}
static int msp_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *rt)
static int msp_s_routing(struct v4l2_subdev *sd,
u32 input, u32 output, u32 config)
{
struct msp_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
int tuner = (rt->input >> 3) & 1;
int sc_in = rt->input & 0x7;
int sc1_out = rt->output & 0xf;
int sc2_out = (rt->output >> 4) & 0xf;
int tuner = (input >> 3) & 1;
int sc_in = input & 0x7;
int sc1_out = output & 0xf;
int sc2_out = (output >> 4) & 0xf;
u16 val, reg;
int i;
int extern_input = 1;
if (state->routing.input == rt->input &&
state->routing.output == rt->output)
if (state->route_in == input && state->route_out == output)
return 0;
state->routing = *rt;
state->route_in = input;
state->route_out = output;
/* check if the tuner input is used */
for (i = 0; i < 5; i++) {
if (((rt->input >> (4 + i * 4)) & 0xf) == 0)
if (((input >> (4 + i * 4)) & 0xf) == 0)
extern_input = 0;
}
state->mode = extern_input ? MSP_MODE_EXTERN : MSP_MODE_AM_DETECT;
@ -673,7 +674,7 @@ static int msp_log_status(struct v4l2_subdev *sd)
}
v4l_info(client, "Audmode: 0x%04x\n", state->audmode);
v4l_info(client, "Routing: 0x%08x (input) 0x%08x (output)\n",
state->routing.input, state->routing.output);
state->route_in, state->route_out);
v4l_info(client, "ACB: 0x%04x\n", state->acb);
return 0;
}
@ -761,8 +762,8 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
state->i2s_mode = 0;
init_waitqueue_head(&state->wq);
/* These are the reset input/output positions */
state->routing.input = MSP_INPUT_DEFAULT;
state->routing.output = MSP_OUTPUT_DEFAULT;
state->route_in = MSP_INPUT_DEFAULT;
state->route_out = MSP_OUTPUT_DEFAULT;
state->rev1 = msp_read_dsp(client, 0x1e);
if (state->rev1 != -1)

View file

@ -80,7 +80,8 @@ struct msp_state {
int i2s_mode;
int main, second; /* sound carrier */
int input;
struct v4l2_routing routing;
u32 route_in;
u32 route_out;
/* v4l2 */
int audmode;

View file

@ -188,7 +188,7 @@ void msp3400c_set_mode(struct i2c_client *client, int mode)
{
struct msp_state *state = to_state(i2c_get_clientdata(client));
struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode];
int tuner = (state->routing.input >> 3) & 1;
int tuner = (state->route_in >> 3) & 1;
int i;
v4l_dbg(1, msp_debug, client, "set_mode: %d\n", mode);
@ -896,7 +896,7 @@ static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in)
static void msp34xxg_set_sources(struct i2c_client *client)
{
struct msp_state *state = to_state(i2c_get_clientdata(client));
u32 in = state->routing.input;
u32 in = state->route_in;
msp34xxg_set_source(client, 0x0008, (in >> 4) & 0xf);
/* quasi-peak detector is set to same input as the loudspeaker (MAIN) */
@ -912,7 +912,7 @@ static void msp34xxg_set_sources(struct i2c_client *client)
static void msp34xxg_reset(struct i2c_client *client)
{
struct msp_state *state = to_state(i2c_get_clientdata(client));
int tuner = (state->routing.input >> 3) & 1;
int tuner = (state->route_in >> 3) & 1;
int modus;
/* initialize std to 1 (autodetect) to signal that no standard is

View file

@ -83,9 +83,14 @@ static struct {
static int video_audio_connect[MXB_INPUTS] =
{ 0, 1, 3, 3 };
struct mxb_routing {
u32 input;
u32 output;
};
/* These are the necessary input-output-pins for bringing one audio source
(see above) to the CD-output. Note that gain is set to 0 in this table. */
static struct v4l2_routing TEA6420_cd[MXB_AUDIOS + 1][2] = {
static struct mxb_routing TEA6420_cd[MXB_AUDIOS + 1][2] = {
{ { 1, 1 }, { 1, 1 } }, /* Tuner */
{ { 5, 1 }, { 6, 1 } }, /* AUX 1 */
{ { 4, 1 }, { 6, 1 } }, /* AUX 2 */
@ -97,7 +102,7 @@ static struct v4l2_routing TEA6420_cd[MXB_AUDIOS + 1][2] = {
/* These are the necessary input-output-pins for bringing one audio source
(see above) to the line-output. Note that gain is set to 0 in this table. */
static struct v4l2_routing TEA6420_line[MXB_AUDIOS + 1][2] = {
static struct mxb_routing TEA6420_line[MXB_AUDIOS + 1][2] = {
{ { 2, 3 }, { 1, 2 } },
{ { 5, 3 }, { 6, 2 } },
{ { 4, 3 }, { 6, 2 } },
@ -134,10 +139,6 @@ struct mxb
#define saa7111a_call(mxb, o, f, args...) \
v4l2_subdev_call(mxb->saa7111a, o, f, ##args)
#define tea6420_1_call(mxb, o, f, args...) \
v4l2_subdev_call(mxb->tea6420_1, o, f, ##args)
#define tea6420_2_call(mxb, o, f, args...) \
v4l2_subdev_call(mxb->tea6420_2, o, f, ##args)
#define tda9840_call(mxb, o, f, args...) \
v4l2_subdev_call(mxb->tda9840, o, f, ##args)
#define tea6415c_call(mxb, o, f, args...) \
@ -147,6 +148,22 @@ struct mxb
#define call_all(dev, o, f, args...) \
v4l2_device_call_until_err(&dev->v4l2_dev, 0, o, f, ##args)
static inline void tea6420_route_cd(struct mxb *mxb, int idx)
{
v4l2_subdev_call(mxb->tea6420_1, audio, s_routing,
TEA6420_cd[idx][0].input, TEA6420_cd[idx][0].output, 0);
v4l2_subdev_call(mxb->tea6420_2, audio, s_routing,
TEA6420_cd[idx][1].input, TEA6420_cd[idx][1].output, 0);
}
static inline void tea6420_route_line(struct mxb *mxb, int idx)
{
v4l2_subdev_call(mxb->tea6420_1, audio, s_routing,
TEA6420_line[idx][0].input, TEA6420_line[idx][0].output, 0);
v4l2_subdev_call(mxb->tea6420_2, audio, s_routing,
TEA6420_line[idx][1].input, TEA6420_line[idx][1].output, 0);
}
static struct saa7146_extension extension;
static int mxb_probe(struct saa7146_dev *dev)
@ -268,7 +285,6 @@ static int mxb_init_done(struct saa7146_dev* dev)
struct i2c_msg msg;
struct tuner_setup tun_setup;
v4l2_std_id std = V4L2_STD_PAL_BG;
struct v4l2_routing route;
int i = 0, err = 0;
@ -277,9 +293,8 @@ static int mxb_init_done(struct saa7146_dev* dev)
/* select tuner-output on saa7111a */
i = 0;
route.input = SAA7115_COMPOSITE0;
route.output = SAA7111_FMT_CCIR | SAA7111_VBI_BYPASS;
saa7111a_call(mxb, video, s_routing, &route);
saa7111a_call(mxb, video, s_routing, SAA7115_COMPOSITE0,
SAA7111_FMT_CCIR | SAA7111_VBI_BYPASS, 0);
/* select a tuner type */
tun_setup.mode_mask = T_ANALOG_TV;
@ -296,20 +311,14 @@ static int mxb_init_done(struct saa7146_dev* dev)
tuner_call(mxb, core, s_std, std);
/* mute audio on tea6420s */
tea6420_1_call(mxb, audio, s_routing, &TEA6420_line[6][0]);
tea6420_2_call(mxb, audio, s_routing, &TEA6420_line[6][1]);
tea6420_1_call(mxb, audio, s_routing, &TEA6420_cd[6][0]);
tea6420_2_call(mxb, audio, s_routing, &TEA6420_cd[6][1]);
tea6420_route_line(mxb, 6);
tea6420_route_cd(mxb, 6);
/* switch to tuner-channel on tea6415c */
route.input = 3;
route.output = 17;
tea6415c_call(mxb, video, s_routing, &route);
tea6415c_call(mxb, video, s_routing, 3, 17, 0);
/* select tuner-output on multicable on tea6415c */
route.input = 3;
route.output = 13;
tea6415c_call(mxb, video, s_routing, &route);
tea6415c_call(mxb, video, s_routing, 3, 13, 0);
/* the rest for mxb */
mxb->cur_input = 0;
@ -433,18 +442,9 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *vc)
if (vc->id == V4L2_CID_AUDIO_MUTE) {
mxb->cur_mute = vc->value;
if (!vc->value) {
/* switch the audio-source */
tea6420_1_call(mxb, audio, s_routing,
&TEA6420_line[video_audio_connect[mxb->cur_input]][0]);
tea6420_2_call(mxb, audio, s_routing,
&TEA6420_line[video_audio_connect[mxb->cur_input]][1]);
} else {
tea6420_1_call(mxb, audio, s_routing,
&TEA6420_line[6][0]);
tea6420_2_call(mxb, audio, s_routing,
&TEA6420_line[6][1]);
}
/* switch the audio-source */
tea6420_route_line(mxb, vc->value ? 6 :
video_audio_connect[mxb->cur_input]);
DEB_EE(("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d.\n", vc->value));
}