diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-12 12:42:02 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-16 05:59:54 -0500 |
commit | c43875f66140f5457f90fc5f6f6840c74b2762cd (patch) | |
tree | 2914078eabc51cc0707528e241f46981692c2afc | |
parent | 22d50e9a48032893c0259bc134c5373e9d3d13ac (diff) |
[media] tvp5150: replace MEDIA_ENT_F_CONN_TEST by a control
MEDIA_ENT_F_CONN_TEST is not really a connector, it is actually
a signal generator. Also, as other drivers use the
V4L2_CID_TEST_PATTERN control for signal generators, let's change
the driver accordingly.
Tested with Terratec Grabster AV350.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/i2c/tvp5150.c | 45 | ||||
-rw-r--r-- | include/dt-bindings/media/tvp5150.h | 3 |
2 files changed, 29 insertions, 19 deletions
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index b8976028fc82..ef393f5daf2a 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder driver | 2 | * tvp5150 - Texas Instruments TVP5150A/AM1 and TVP5151 video decoder driver |
3 | * | 3 | * |
4 | * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mchehab@infradead.org) | 4 | * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mchehab@infradead.org) |
5 | * This code is placed under the terms of the GNU General Public License v2 | 5 | * This code is placed under the terms of the GNU General Public License v2 |
@@ -27,7 +27,7 @@ | |||
27 | #define TVP5150_MAX_CROP_TOP 127 | 27 | #define TVP5150_MAX_CROP_TOP 127 |
28 | #define TVP5150_CROP_SHIFT 2 | 28 | #define TVP5150_CROP_SHIFT 2 |
29 | 29 | ||
30 | MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver"); | 30 | MODULE_DESCRIPTION("Texas Instruments TVP5150A/TVP5150AM1/TVP5151 video decoder driver"); |
31 | MODULE_AUTHOR("Mauro Carvalho Chehab"); | 31 | MODULE_AUTHOR("Mauro Carvalho Chehab"); |
32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
33 | 33 | ||
@@ -259,8 +259,12 @@ static inline void tvp5150_selmux(struct v4l2_subdev *sd) | |||
259 | int input = 0; | 259 | int input = 0; |
260 | int val; | 260 | int val; |
261 | 261 | ||
262 | if ((decoder->output & TVP5150_BLACK_SCREEN) || !decoder->enable) | 262 | /* Only tvp5150am1 and tvp5151 have signal generator support */ |
263 | input = 8; | 263 | if ((decoder->dev_id == 0x5150 && decoder->rom_ver == 0x0400) || |
264 | (decoder->dev_id == 0x5151 && decoder->rom_ver == 0x0100)) { | ||
265 | if (!decoder->enable) | ||
266 | input = 8; | ||
267 | } | ||
264 | 268 | ||
265 | switch (decoder->input) { | 269 | switch (decoder->input) { |
266 | case TVP5150_COMPOSITE1: | 270 | case TVP5150_COMPOSITE1: |
@@ -795,6 +799,7 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32 val) | |||
795 | static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl) | 799 | static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl) |
796 | { | 800 | { |
797 | struct v4l2_subdev *sd = to_sd(ctrl); | 801 | struct v4l2_subdev *sd = to_sd(ctrl); |
802 | struct tvp5150 *decoder = to_tvp5150(sd); | ||
798 | 803 | ||
799 | switch (ctrl->id) { | 804 | switch (ctrl->id) { |
800 | case V4L2_CID_BRIGHTNESS: | 805 | case V4L2_CID_BRIGHTNESS: |
@@ -808,6 +813,9 @@ static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl) | |||
808 | return 0; | 813 | return 0; |
809 | case V4L2_CID_HUE: | 814 | case V4L2_CID_HUE: |
810 | tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val); | 815 | tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val); |
816 | case V4L2_CID_TEST_PATTERN: | ||
817 | decoder->enable = ctrl->val ? false : true; | ||
818 | tvp5150_selmux(sd); | ||
811 | return 0; | 819 | return 0; |
812 | } | 820 | } |
813 | return -EINVAL; | 821 | return -EINVAL; |
@@ -1022,15 +1030,6 @@ static int tvp5150_link_setup(struct media_entity *entity, | |||
1022 | 1030 | ||
1023 | decoder->input = i; | 1031 | decoder->input = i; |
1024 | 1032 | ||
1025 | /* Only tvp5150am1 and tvp5151 have signal generator support */ | ||
1026 | if ((decoder->dev_id == 0x5150 && decoder->rom_ver == 0x0400) || | ||
1027 | (decoder->dev_id == 0x5151 && decoder->rom_ver == 0x0100)) { | ||
1028 | decoder->output = (i == TVP5150_GENERATOR ? | ||
1029 | TVP5150_BLACK_SCREEN : TVP5150_NORMAL); | ||
1030 | } else { | ||
1031 | decoder->output = TVP5150_NORMAL; | ||
1032 | } | ||
1033 | |||
1034 | tvp5150_selmux(sd); | 1033 | tvp5150_selmux(sd); |
1035 | #endif | 1034 | #endif |
1036 | 1035 | ||
@@ -1074,6 +1073,12 @@ static int tvp5150_s_routing(struct v4l2_subdev *sd, | |||
1074 | 1073 | ||
1075 | decoder->input = input; | 1074 | decoder->input = input; |
1076 | decoder->output = output; | 1075 | decoder->output = output; |
1076 | |||
1077 | if (output == TVP5150_BLACK_SCREEN) | ||
1078 | decoder->enable = false; | ||
1079 | else | ||
1080 | decoder->enable = true; | ||
1081 | |||
1077 | tvp5150_selmux(sd); | 1082 | tvp5150_selmux(sd); |
1078 | return 0; | 1083 | return 0; |
1079 | } | 1084 | } |
@@ -1405,9 +1410,6 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) | |||
1405 | case TVP5150_SVIDEO: | 1410 | case TVP5150_SVIDEO: |
1406 | input->function = MEDIA_ENT_F_CONN_SVIDEO; | 1411 | input->function = MEDIA_ENT_F_CONN_SVIDEO; |
1407 | break; | 1412 | break; |
1408 | case TVP5150_GENERATOR: | ||
1409 | input->function = MEDIA_ENT_F_CONN_TEST; | ||
1410 | break; | ||
1411 | } | 1413 | } |
1412 | 1414 | ||
1413 | input->flags = MEDIA_ENT_FL_CONNECTOR; | 1415 | input->flags = MEDIA_ENT_FL_CONNECTOR; |
@@ -1431,6 +1433,11 @@ err: | |||
1431 | return ret; | 1433 | return ret; |
1432 | } | 1434 | } |
1433 | 1435 | ||
1436 | static const char * const tvp5150_test_patterns[2] = { | ||
1437 | "Disabled", | ||
1438 | "Black screen" | ||
1439 | }; | ||
1440 | |||
1434 | static int tvp5150_probe(struct i2c_client *c, | 1441 | static int tvp5150_probe(struct i2c_client *c, |
1435 | const struct i2c_device_id *id) | 1442 | const struct i2c_device_id *id) |
1436 | { | 1443 | { |
@@ -1488,7 +1495,7 @@ static int tvp5150_probe(struct i2c_client *c, | |||
1488 | 1495 | ||
1489 | core->norm = V4L2_STD_ALL; /* Default is autodetect */ | 1496 | core->norm = V4L2_STD_ALL; /* Default is autodetect */ |
1490 | core->input = TVP5150_COMPOSITE1; | 1497 | core->input = TVP5150_COMPOSITE1; |
1491 | core->enable = 1; | 1498 | core->enable = true; |
1492 | 1499 | ||
1493 | v4l2_ctrl_handler_init(&core->hdl, 5); | 1500 | v4l2_ctrl_handler_init(&core->hdl, 5); |
1494 | v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops, | 1501 | v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops, |
@@ -1502,6 +1509,10 @@ static int tvp5150_probe(struct i2c_client *c, | |||
1502 | v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops, | 1509 | v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops, |
1503 | V4L2_CID_PIXEL_RATE, 27000000, | 1510 | V4L2_CID_PIXEL_RATE, 27000000, |
1504 | 27000000, 1, 27000000); | 1511 | 27000000, 1, 27000000); |
1512 | v4l2_ctrl_new_std_menu_items(&core->hdl, &tvp5150_ctrl_ops, | ||
1513 | V4L2_CID_TEST_PATTERN, | ||
1514 | ARRAY_SIZE(tvp5150_test_patterns), | ||
1515 | 0, 0, tvp5150_test_patterns); | ||
1505 | sd->ctrl_handler = &core->hdl; | 1516 | sd->ctrl_handler = &core->hdl; |
1506 | if (core->hdl.error) { | 1517 | if (core->hdl.error) { |
1507 | res = core->hdl.error; | 1518 | res = core->hdl.error; |
diff --git a/include/dt-bindings/media/tvp5150.h b/include/dt-bindings/media/tvp5150.h index d30865222082..c852a35e916e 100644 --- a/include/dt-bindings/media/tvp5150.h +++ b/include/dt-bindings/media/tvp5150.h | |||
@@ -25,9 +25,8 @@ | |||
25 | #define TVP5150_COMPOSITE0 0 | 25 | #define TVP5150_COMPOSITE0 0 |
26 | #define TVP5150_COMPOSITE1 1 | 26 | #define TVP5150_COMPOSITE1 1 |
27 | #define TVP5150_SVIDEO 2 | 27 | #define TVP5150_SVIDEO 2 |
28 | #define TVP5150_GENERATOR 3 | ||
29 | 28 | ||
30 | #define TVP5150_INPUT_NUM 4 | 29 | #define TVP5150_INPUT_NUM 3 |
31 | 30 | ||
32 | /* TVP5150 HW outputs */ | 31 | /* TVP5150 HW outputs */ |
33 | #define TVP5150_NORMAL 0 | 32 | #define TVP5150_NORMAL 0 |