diff mbox

[10/12] video: Add ADV751[13] DT bindings documentation

Message ID 1411589072-28609-11-git-send-email-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart Sept. 24, 2014, 8:04 p.m. UTC
The ADV7511, ADV7511W and ADV7513 are HDMI audio and video transmitters
compatible with HDMI 1.4 and DVI 1.0. They're described in DT using the
OF graph bindings and a list of custom properties pertaining to the
input video bus configuration.

Cc: devicetree@vger.kernel.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../devicetree/bindings/video/adi,adv7511.txt      | 87 ++++++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/adi,adv7511.txt

Comments

Geert Uytterhoeven Sept. 25, 2014, 7:06 a.m. UTC | #1
Hi Laurent,

On Wed, Sep 24, 2014 at 10:04 PM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> +- adi,input-style: The input components arrangement variant (1, 2 or 3).

What's the meaning of the numerical values 1, 2, and 3?

I found this code in "[PATCH 11/12] drm: Add adv7511 encoder driver":

+       input_style = config->input_style == 1 ? 2
+                   : (config->input_style == 2 ? 1 : 3);

which didn't really help much ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Laurent Pinchart Sept. 25, 2014, 9:57 a.m. UTC | #2
Hi Geert,

On Thursday 25 September 2014 09:06:46 Geert Uytterhoeven wrote:
> Hi Laurent,
> 
> On Wed, Sep 24, 2014 at 10:04 PM, Laurent Pinchart
> 
> <laurent.pinchart+renesas@ideasonboard.com> wrote:
> > +- adi,input-style: The input components arrangement variant (1, 2 or 3).
> 
> What's the meaning of the numerical values 1, 2, and 3?
> 
> I found this code in "[PATCH 11/12] drm: Add adv7511 encoder driver":
> 
> +       input_style = config->input_style == 1 ? 2
> +                   : (config->input_style == 2 ? 1 : 3);
> 
> which didn't really help much ;-)

:-)

The ADV751[13]W? datasheets document all the supported input formats. They're 
split in categories, each of them having multiple variants called styles. The 
styles are just numbered 1, 2 and 3 in the tables that describe the formats, 
and there's a register field used to select a style. For some reason style 1 
maps to register value 2, style 2 to register value 1, and style 3 to register 
value 3. Go figure...
Geert Uytterhoeven Sept. 25, 2014, 10:10 a.m. UTC | #3
Hi Laurent,

On Thu, Sep 25, 2014 at 11:57 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Thursday 25 September 2014 09:06:46 Geert Uytterhoeven wrote:
>> On Wed, Sep 24, 2014 at 10:04 PM, Laurent Pinchart
>> <laurent.pinchart+renesas@ideasonboard.com> wrote:
>> > +- adi,input-style: The input components arrangement variant (1, 2 or 3).
>>
>> What's the meaning of the numerical values 1, 2, and 3?
>>
>> I found this code in "[PATCH 11/12] drm: Add adv7511 encoder driver":
>>
>> +       input_style = config->input_style == 1 ? 2
>> +                   : (config->input_style == 2 ? 1 : 3);
>>
>> which didn't really help much ;-)
>
> :-)
>
> The ADV751[13]W? datasheets document all the supported input formats. They're
> split in categories, each of them having multiple variants called styles. The
> styles are just numbered 1, 2 and 3 in the tables that describe the formats,
> and there's a register field used to select a style. For some reason style 1
> maps to register value 2, style 2 to register value 1, and style 3 to register
> value 3. Go figure...

Thanks, that explains it.

Then I suggest to reflect this in the binding:

    - adi,input-style: The input components arrangement variant (1, 2 or 3),
           as listed in the datasheet.

and in the code, e.g. by translating the values using a mapping array?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Laurent Pinchart Sept. 26, 2014, 12:30 p.m. UTC | #4
Hi Geert,

On Thursday 25 September 2014 12:10:59 Geert Uytterhoeven wrote:
> On Thu, Sep 25, 2014 at 11:57 AM, Laurent Pinchart wrote:
> > On Thursday 25 September 2014 09:06:46 Geert Uytterhoeven wrote:
> >> On Wed, Sep 24, 2014 at 10:04 PM, Laurent Pinchart
> >> 
> >> <laurent.pinchart+renesas@ideasonboard.com> wrote:
> >> > +- adi,input-style: The input components arrangement variant (1, 2 or
> >> > 3).
> >> 
> >> What's the meaning of the numerical values 1, 2, and 3?
> >> 
> >> I found this code in "[PATCH 11/12] drm: Add adv7511 encoder driver":
> >> 
> >> +       input_style = config->input_style == 1 ? 2
> >> +                   : (config->input_style == 2 ? 1 : 3);
> >> 
> >> which didn't really help much ;-)
> >> 
> > :-)
> > 
> > The ADV751[13]W? datasheets document all the supported input formats.
> > They're split in categories, each of them having multiple variants called
> > styles. The styles are just numbered 1, 2 and 3 in the tables that
> > describe the formats, and there's a register field used to select a
> > style. For some reason style 1 maps to register value 2, style 2 to
> > register value 1, and style 3 to register value 3. Go figure...
> 
> Thanks, that explains it.
> 
> Then I suggest to reflect this in the binding:
> 
>     - adi,input-style: The input components arrangement variant (1, 2 or 3),
> as listed in the datasheet.
> 
> and in the code, e.g. by translating the values using a mapping array?

I'll document the property as

- adi,input-style: The input components arrangement variant (1, 2 or 3), as
  listed in the input format tables in the datasheet.

and modify the code to use an array as in

    /*
     * The input style values documented in the datasheet don't match the
     * hardware register field values :-(
     */
    static const unsigned int input_styles[4] = { 0, 2, 1, 3 };

    ...
    regmap_update_bits(adv7511->regmap, ADV7511_REG_VIDEO_INPUT_CFG1, 0x7e,
                       (color_depth << 4) |
                       (input_styles[config->input_style] << 2));

(config->input_style is validated when parsing DT).
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/video/adi,adv7511.txt b/Documentation/devicetree/bindings/video/adi,adv7511.txt
new file mode 100644
index 0000000..aa41d9a
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/adi,adv7511.txt
@@ -0,0 +1,87 @@ 
+Analog Device ADV7511(W)/13 HDMI Encoders
+-----------------------------------------
+
+The ADV7511, ADV7511W and ADV7513 are HDMI audio and video transmitters
+compatible with HDMI 1.4 and DVI 1.0. They support color space conversion,
+S/PDIF, CEC and HDCP.
+
+Required properties:
+
+- compatible: Should be one of "adi,adv7511", "adi,adv7511w" or "adi,adv7513"
+- reg: I2C slave address
+
+The ADV7511 supports a large number of input data formats that differ by their
+color depth, color format, clock mode, bit justification and random
+arrangement of components on the data bus. The combination of the following
+properties describe the input and map directly to the video input tables of the
+ADV7511 datasheet that document all the supported combinations.
+
+- adi,input-depth: Number of bits per color component at the input (8, 10 or
+  12).
+- adi,input-colorspace: The input color space, one of "rgb", "yuv422" or
+  "yuv444".
+- adi,input-clock: The input clock type, one of "1x" (one clock cycle per
+  pixel), "2x" (two clock cycles per pixel), "ddr" (one clock cycle per pixel,
+  data driven on both edges).
+
+The following input format properties are required except in "rgb 1x" and
+"yuv444 1x" modes, in which case they must not be specified.
+
+- adi,input-style: The input components arrangement variant (1, 2 or 3).
+- adi,input-justification: The input bit justification ("left", "evenly",
+  "right").
+
+Optional properties:
+
+- interrupts: Specifier for the ADV7511 interrupt
+- pd-gpios: Specifier for the GPIO connected to the power down signal
+
+- adi,clock-delay: Video data clock delay relative to the pixel clock, in ps
+  (-1200 ps .. 1600 ps). Defaults to no delay.
+- adi,embedded-sync: The input uses synchronization signals embedded in the
+  data stream (similar to BT.656). Defaults to separate H/V synchronization
+  signals.
+
+Required nodes:
+
+The ADV7511 has two video ports. Their connections are modeled using the OF
+graph bindings specified in Documentation/devicetree/bindings/graph.txt.
+
+- Video port 0 for the RGB or YUV input
+- Video port 1 for the HDMI output
+
+
+Example
+-------
+
+	adv7511w: hdmi@39 {
+		compatible = "adi,adv7511w";
+		reg = <39>;
+		interrupt-parent = <&gpio3>;
+		interrupts = <29 IRQ_TYPE_EDGE_FALLING>;
+
+		adi,input-depth = <8>;
+		adi,input-colorspace = "rgb";
+		adi,input-clock = "1x";
+		adi,input-style = <1>;
+		adi,input-justification = "evenly";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				adv7511w_in: endpoint {
+					remote-endpoint = <&dpi_out>;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				adv7511_out: endpoint {
+					remote-endpoint = <&hdmi_connector_in>;
+				};
+			};
+		};
+	};