1 From 34c4ee6f5d7143f6c8be604715f9b52b7540e38d Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Wed, 31 Oct 2018 15:00:04 +0000
4 Subject: [PATCH] media: adv7180: Nasty hack to allow input selection.
6 Whilst the adv7180 driver support s_routing, nothing else
7 does, and there is a missing lump of framework code to
8 define the mapping from connectors on a board to the inputs
9 they represent on the ADV7180.
11 Add a nasty hack to take a module parameter that is passed in
12 to s_routing on any call to G_STD, or S_STD (or subdev
15 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
17 drivers/media/i2c/adv7180.c | 30 ++++++++++++++++++++++++++++--
18 1 file changed, 28 insertions(+), 2 deletions(-)
20 --- a/drivers/media/i2c/adv7180.c
21 +++ b/drivers/media/i2c/adv7180.c
24 #define V4L2_CID_ADV_FAST_SWITCH (V4L2_CID_USER_ADV7180_BASE + 0x00)
26 +static int dbg_input;
27 +module_param(dbg_input, int, 0644);
28 +MODULE_PARM_DESC(dbg_input, "Input number (0-31)");
32 #define ADV7180_FLAG_RESET_POWERED BIT(0)
33 @@ -405,10 +409,24 @@ out:
37 +static void adv7180_check_input(struct v4l2_subdev *sd)
39 + struct adv7180_state *state = to_state(sd);
41 + if (state->input != dbg_input)
42 + if (adv7180_s_routing(sd, dbg_input, 0, 0))
43 + /* Failed - reset dbg_input */
44 + dbg_input = state->input;
47 static int adv7180_g_input_status(struct v4l2_subdev *sd, u32 *status)
49 struct adv7180_state *state = to_state(sd);
50 - int ret = mutex_lock_interruptible(&state->mutex);
53 + adv7180_check_input(sd);
55 + ret = mutex_lock_interruptible(&state->mutex);
59 @@ -434,7 +452,11 @@ static int adv7180_program_std(struct ad
60 static int adv7180_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
62 struct adv7180_state *state = to_state(sd);
63 - int ret = mutex_lock_interruptible(&state->mutex);
66 + adv7180_check_input(sd);
68 + ret = mutex_lock_interruptible(&state->mutex);
72 @@ -456,6 +478,8 @@ static int adv7180_g_std(struct v4l2_sub
74 struct adv7180_state *state = to_state(sd);
76 + adv7180_check_input(sd);
78 *norm = state->curr_norm;
81 @@ -810,6 +834,8 @@ static int adv7180_s_stream(struct v4l2_
85 + adv7180_check_input(sd);
87 /* Must wait until querystd released the lock */
88 ret = mutex_lock_interruptible(&state->mutex);