aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2014-02-04 18:23:16 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-25 12:08:51 -0400
commit6fa88045ef7db3d09af80aa00fd7c937b7289387 (patch)
tree7fb55b9117060be014dfd8a76e6139385658d8d9
parentf82f313e9739026ca96342b5b44c5c94072e166a (diff)
[media] adv7604: Add endpoint properties to DT bindings
Add support for the hsync-active, vsync-active and pclk-sample properties to the DT bindings and control BT.656 mode implicitly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--Documentation/devicetree/bindings/media/i2c/adv7604.txt13
-rw-r--r--drivers/media/i2c/adv7604.c34
2 files changed, 45 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index 2efb48f20fb6..c27cede3bd68 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -33,6 +33,19 @@ Optional Properties:
33 33
34 - reset-gpios: Reference to the GPIO connected to the device's reset pin. 34 - reset-gpios: Reference to the GPIO connected to the device's reset pin.
35 35
36Optional Endpoint Properties:
37
38 The following three properties are defined in video-interfaces.txt and are
39 valid for source endpoints only.
40
41 - hsync-active: Horizontal synchronization polarity. Defaults to active low.
42 - vsync-active: Vertical synchronization polarity. Defaults to active low.
43 - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge.
44
45 If none of hsync-active, vsync-active and pclk-sample is specified the
46 endpoint will use embedded BT.656 synchronization.
47
48
36Example: 49Example:
37 50
38 hdmi_receiver@4c { 51 hdmi_receiver@4c {
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 1323189a45fa..1493de6c246f 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -41,6 +41,7 @@
41#include <media/v4l2-ctrls.h> 41#include <media/v4l2-ctrls.h>
42#include <media/v4l2-device.h> 42#include <media/v4l2-device.h>
43#include <media/v4l2-dv-timings.h> 43#include <media/v4l2-dv-timings.h>
44#include <media/v4l2-of.h>
44 45
45static int debug; 46static int debug;
46module_param(debug, int, 0644); 47module_param(debug, int, 0644);
@@ -2678,6 +2679,37 @@ MODULE_DEVICE_TABLE(of, adv7604_of_id);
2678 2679
2679static int adv7604_parse_dt(struct adv7604_state *state) 2680static int adv7604_parse_dt(struct adv7604_state *state)
2680{ 2681{
2682 struct v4l2_of_endpoint bus_cfg;
2683 struct device_node *endpoint;
2684 struct device_node *np;
2685 unsigned int flags;
2686
2687 np = state->i2c_clients[ADV7604_PAGE_IO]->dev.of_node;
2688
2689 /* Parse the endpoint. */
2690 endpoint = of_graph_get_next_endpoint(np, NULL);
2691 if (!endpoint)
2692 return -EINVAL;
2693
2694 v4l2_of_parse_endpoint(endpoint, &bus_cfg);
2695 of_node_put(endpoint);
2696
2697 flags = bus_cfg.bus.parallel.flags;
2698
2699 if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
2700 state->pdata.inv_hs_pol = 1;
2701
2702 if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
2703 state->pdata.inv_vs_pol = 1;
2704
2705 if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
2706 state->pdata.inv_llc_pol = 1;
2707
2708 if (bus_cfg.bus_type == V4L2_MBUS_BT656) {
2709 state->pdata.insert_av_codes = 1;
2710 state->pdata.op_656_range = 1;
2711 }
2712
2681 /* Disable the interrupt for now as no DT-based board uses it. */ 2713 /* Disable the interrupt for now as no DT-based board uses it. */
2682 state->pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED; 2714 state->pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
2683 2715
@@ -2700,9 +2732,7 @@ static int adv7604_parse_dt(struct adv7604_state *state)
2700 state->pdata.disable_cable_det_rst = 0; 2732 state->pdata.disable_cable_det_rst = 0;
2701 state->pdata.default_input = -1; 2733 state->pdata.default_input = -1;
2702 state->pdata.blank_data = 1; 2734 state->pdata.blank_data = 1;
2703 state->pdata.op_656_range = 1;
2704 state->pdata.alt_data_sat = 1; 2735 state->pdata.alt_data_sat = 1;
2705 state->pdata.insert_av_codes = 1;
2706 state->pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0; 2736 state->pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0;
2707 state->pdata.bus_order = ADV7604_BUS_ORDER_RGB; 2737 state->pdata.bus_order = ADV7604_BUS_ORDER_RGB;
2708 2738