[PATCH 22/22] [media] tvp5150: Change default input source selection behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The default input is still TVP5150_COMPOSITE1, but if the platform
supports DT the default will be changed to the first valid connector.
First in this context means the connector at the lowest port number.

Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
 drivers/media/i2c/tvp5150.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 3645d1166118..8b40cf721853 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -1835,7 +1835,7 @@ static int tvp5150_probe(struct i2c_client *c,
 	struct v4l2_subdev *sd;
 	struct device_node *np = c->dev.of_node;
 	struct regmap *map;
-	int res;
+	int res, i;
 
 	/* Check if the adapter supports the needed features */
 	if (!i2c_check_functionality(c->adapter,
@@ -1881,7 +1881,16 @@ static int tvp5150_probe(struct i2c_client *c,
 
 	core->norm = V4L2_STD_ALL;	/* Default is autodetect */
 	core->detected_norm = V4L2_STD_UNKNOWN;
+	/*
+	 * Default is TVP5150_COMPOSITE1.
+	 * In case of OF support, default is first valid port
+	 */
 	core->input = TVP5150_COMPOSITE1;
+	for (i = 0; i < TVP5150_PORT_NUM - 1; i++)
+		if (core->endpoints[i]) {
+			core->input = i;
+			break;
+		}
 	core->enable = true;
 
 	v4l2_ctrl_handler_init(&core->hdl, 5);
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux