diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-01-23 10:52:33 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-02-02 08:51:38 -0500 |
commit | 08b717c2ae8b7e23e1d018dad601fdf12bde3a96 (patch) | |
tree | 92a7168ca490dbfa7ead2d1f70edf2bb7401e414 | |
parent | 851a54effbd808daf8b961f1dc6156c06a96d5f1 (diff) |
[media] adv7180: Add fast switch support
In fast switch mode the adv7180 (and similar) can lock onto a new signal
faster when switching between different inputs. As a downside though it is
no longer able to auto-detect the incoming format.
The fast switch mode is exposed as a boolean v4l control that allows
userspace applications to either enable or disable fast switch mode.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/i2c/adv7180.c | 29 | ||||
-rw-r--r-- | include/uapi/linux/v4l2-controls.h | 4 |
2 files changed, 33 insertions, 0 deletions
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 3c1c866d1e3c..b75878c27c2a 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c | |||
@@ -127,6 +127,9 @@ | |||
127 | #define ADV7180_REG_VPP_SLAVE_ADDR 0xFD | 127 | #define ADV7180_REG_VPP_SLAVE_ADDR 0xFD |
128 | #define ADV7180_REG_CSI_SLAVE_ADDR 0xFE | 128 | #define ADV7180_REG_CSI_SLAVE_ADDR 0xFE |
129 | 129 | ||
130 | #define ADV7180_REG_FLCONTROL 0x40e0 | ||
131 | #define ADV7180_FLCONTROL_FL_ENABLE 0x1 | ||
132 | |||
130 | #define ADV7180_CSI_REG_PWRDN 0x00 | 133 | #define ADV7180_CSI_REG_PWRDN 0x00 |
131 | #define ADV7180_CSI_PWRDN 0x80 | 134 | #define ADV7180_CSI_PWRDN 0x80 |
132 | 135 | ||
@@ -164,6 +167,8 @@ | |||
164 | #define ADV7180_DEFAULT_CSI_I2C_ADDR 0x44 | 167 | #define ADV7180_DEFAULT_CSI_I2C_ADDR 0x44 |
165 | #define ADV7180_DEFAULT_VPP_I2C_ADDR 0x42 | 168 | #define ADV7180_DEFAULT_VPP_I2C_ADDR 0x42 |
166 | 169 | ||
170 | #define V4L2_CID_ADV_FAST_SWITCH (V4L2_CID_USER_ADV7180_BASE + 0x00) | ||
171 | |||
167 | struct adv7180_state; | 172 | struct adv7180_state; |
168 | 173 | ||
169 | #define ADV7180_FLAG_RESET_POWERED BIT(0) | 174 | #define ADV7180_FLAG_RESET_POWERED BIT(0) |
@@ -508,6 +513,18 @@ static int adv7180_s_ctrl(struct v4l2_ctrl *ctrl) | |||
508 | break; | 513 | break; |
509 | ret = adv7180_write(state, ADV7180_REG_SD_SAT_CR, val); | 514 | ret = adv7180_write(state, ADV7180_REG_SD_SAT_CR, val); |
510 | break; | 515 | break; |
516 | case V4L2_CID_ADV_FAST_SWITCH: | ||
517 | if (ctrl->val) { | ||
518 | /* ADI required write */ | ||
519 | adv7180_write(state, 0x80d9, 0x44); | ||
520 | adv7180_write(state, ADV7180_REG_FLCONTROL, | ||
521 | ADV7180_FLCONTROL_FL_ENABLE); | ||
522 | } else { | ||
523 | /* ADI required write */ | ||
524 | adv7180_write(state, 0x80d9, 0xc4); | ||
525 | adv7180_write(state, ADV7180_REG_FLCONTROL, 0x00); | ||
526 | } | ||
527 | break; | ||
511 | default: | 528 | default: |
512 | ret = -EINVAL; | 529 | ret = -EINVAL; |
513 | } | 530 | } |
@@ -520,6 +537,16 @@ static const struct v4l2_ctrl_ops adv7180_ctrl_ops = { | |||
520 | .s_ctrl = adv7180_s_ctrl, | 537 | .s_ctrl = adv7180_s_ctrl, |
521 | }; | 538 | }; |
522 | 539 | ||
540 | static const struct v4l2_ctrl_config adv7180_ctrl_fast_switch = { | ||
541 | .ops = &adv7180_ctrl_ops, | ||
542 | .id = V4L2_CID_ADV_FAST_SWITCH, | ||
543 | .name = "Fast Switching", | ||
544 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
545 | .min = 0, | ||
546 | .max = 1, | ||
547 | .step = 1, | ||
548 | }; | ||
549 | |||
523 | static int adv7180_init_controls(struct adv7180_state *state) | 550 | static int adv7180_init_controls(struct adv7180_state *state) |
524 | { | 551 | { |
525 | v4l2_ctrl_handler_init(&state->ctrl_hdl, 4); | 552 | v4l2_ctrl_handler_init(&state->ctrl_hdl, 4); |
@@ -536,6 +563,8 @@ static int adv7180_init_controls(struct adv7180_state *state) | |||
536 | v4l2_ctrl_new_std(&state->ctrl_hdl, &adv7180_ctrl_ops, | 563 | v4l2_ctrl_new_std(&state->ctrl_hdl, &adv7180_ctrl_ops, |
537 | V4L2_CID_HUE, ADV7180_HUE_MIN, | 564 | V4L2_CID_HUE, ADV7180_HUE_MIN, |
538 | ADV7180_HUE_MAX, 1, ADV7180_HUE_DEF); | 565 | ADV7180_HUE_MAX, 1, ADV7180_HUE_DEF); |
566 | v4l2_ctrl_new_custom(&state->ctrl_hdl, &adv7180_ctrl_fast_switch, NULL); | ||
567 | |||
539 | state->sd.ctrl_handler = &state->ctrl_hdl; | 568 | state->sd.ctrl_handler = &state->ctrl_hdl; |
540 | if (state->ctrl_hdl.error) { | 569 | if (state->ctrl_hdl.error) { |
541 | int err = state->ctrl_hdl.error; | 570 | int err = state->ctrl_hdl.error; |
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 661f119a51b8..9f6e108ff4a0 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h | |||
@@ -170,6 +170,10 @@ enum v4l2_colorfx { | |||
170 | * We reserve 16 controls for this driver. */ | 170 | * We reserve 16 controls for this driver. */ |
171 | #define V4L2_CID_USER_SAA7134_BASE (V4L2_CID_USER_BASE + 0x1060) | 171 | #define V4L2_CID_USER_SAA7134_BASE (V4L2_CID_USER_BASE + 0x1060) |
172 | 172 | ||
173 | /* The base for the adv7180 driver controls. | ||
174 | * We reserve 16 controls for this driver. */ | ||
175 | #define V4L2_CID_USER_ADV7180_BASE (V4L2_CID_USER_BASE + 0x1070) | ||
176 | |||
173 | /* MPEG-class control IDs */ | 177 | /* MPEG-class control IDs */ |
174 | /* The MPEG controls are applicable to all codec controls | 178 | /* The MPEG controls are applicable to all codec controls |
175 | * and the 'MPEG' part of the define is historical */ | 179 | * and the 'MPEG' part of the define is historical */ |