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
4
* Copyright (c) 2005,2006 Mauro Carvalho Chehab (mchehab@infradead.org)
5
5
* This code is placed under the terms of the GNU General Public License v2
27
27
#define TVP5150_MAX_CROP_TOP 127
28
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
31
MODULE_AUTHOR ("Mauro Carvalho Chehab" );
32
32
MODULE_LICENSE ("GPL" );
33
33
@@ -259,8 +259,12 @@ static inline void tvp5150_selmux(struct v4l2_subdev *sd)
259
259
int input = 0 ;
260
260
int val ;
261
261
262
- if ((decoder -> output & TVP5150_BLACK_SCREEN ) || !decoder -> enable )
263
- input = 8 ;
262
+ /* Only tvp5150am1 and tvp5151 have signal generator support */
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
269
switch (decoder -> input ) {
266
270
case TVP5150_COMPOSITE1 :
@@ -795,6 +799,7 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32 val)
795
799
static int tvp5150_s_ctrl (struct v4l2_ctrl * ctrl )
796
800
{
797
801
struct v4l2_subdev * sd = to_sd (ctrl );
802
+ struct tvp5150 * decoder = to_tvp5150 (sd );
798
803
799
804
switch (ctrl -> id ) {
800
805
case V4L2_CID_BRIGHTNESS :
@@ -808,6 +813,9 @@ static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl)
808
813
return 0 ;
809
814
case V4L2_CID_HUE :
810
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
819
return 0 ;
812
820
}
813
821
return - EINVAL ;
@@ -1022,15 +1030,6 @@ static int tvp5150_link_setup(struct media_entity *entity,
1022
1030
1023
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
1033
tvp5150_selmux (sd );
1035
1034
#endif
1036
1035
@@ -1074,6 +1073,12 @@ static int tvp5150_s_routing(struct v4l2_subdev *sd,
1074
1073
1075
1074
decoder -> input = input ;
1076
1075
decoder -> output = output ;
1076
+
1077
+ if (output == TVP5150_BLACK_SCREEN )
1078
+ decoder -> enable = false;
1079
+ else
1080
+ decoder -> enable = true;
1081
+
1077
1082
tvp5150_selmux (sd );
1078
1083
return 0 ;
1079
1084
}
@@ -1405,9 +1410,6 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
1405
1410
case TVP5150_SVIDEO :
1406
1411
input -> function = MEDIA_ENT_F_CONN_SVIDEO ;
1407
1412
break ;
1408
- case TVP5150_GENERATOR :
1409
- input -> function = MEDIA_ENT_F_CONN_TEST ;
1410
- break ;
1411
1413
}
1412
1414
1413
1415
input -> flags = MEDIA_ENT_FL_CONNECTOR ;
@@ -1431,6 +1433,11 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
1431
1433
return ret ;
1432
1434
}
1433
1435
1436
+ static const char * const tvp5150_test_patterns [2 ] = {
1437
+ "Disabled" ,
1438
+ "Black screen"
1439
+ };
1440
+
1434
1441
static int tvp5150_probe (struct i2c_client * c ,
1435
1442
const struct i2c_device_id * id )
1436
1443
{
@@ -1488,7 +1495,7 @@ static int tvp5150_probe(struct i2c_client *c,
1488
1495
1489
1496
core -> norm = V4L2_STD_ALL ; /* Default is autodetect */
1490
1497
core -> input = TVP5150_COMPOSITE1 ;
1491
- core -> enable = 1 ;
1498
+ core -> enable = true ;
1492
1499
1493
1500
v4l2_ctrl_handler_init (& core -> hdl , 5 );
1494
1501
v4l2_ctrl_new_std (& core -> hdl , & tvp5150_ctrl_ops ,
@@ -1502,6 +1509,10 @@ static int tvp5150_probe(struct i2c_client *c,
1502
1509
v4l2_ctrl_new_std (& core -> hdl , & tvp5150_ctrl_ops ,
1503
1510
V4L2_CID_PIXEL_RATE , 27000000 ,
1504
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
1516
sd -> ctrl_handler = & core -> hdl ;
1506
1517
if (core -> hdl .error ) {
1507
1518
res = core -> hdl .error ;
0 commit comments