• Chen-Yu Tsai's avatar
    drm/sun4i: tcon: get TCON ID and matching engine with remote endpoint ID · e8d5bbf7
    Chen-Yu Tsai authored
    The device tree binding for sun4i-drm says:
    
        For all connections between components up to the TCONs in the display
        pipeline, when there are multiple components of the same type at the
        same depth, the local endpoint ID must be the same as the remote
        component's index. For example, if the remote endpoint is Frontend 1,
        then the local endpoint ID must be 1.
    
    We should be able to get the TCON's ID directly from any of the remote
    endpoints from its input port. With the ID, we can then go through the
    list of registered engines and find a matching one by ID.
    
    However the A31 device tree is incorrect. We assumed that there were no
    cross pipeline connections between the backends and TCONs. As a result,
    in all the endpoints between the backends and TCONs of the second
    display pipeline, the endpoint IDs were incorrectly set to 0, when in
    fact they should've been set to 1.
    
    To maintain compatibility with this incorrect device tree, we first
    check if the TCON's input port has 1 or many endpoints. If there are
    more than 1, then it is likely a fixed version, and we can proceed
    with the new method. If there is only 1 endpoint, then it is possibly
    an incorrect version, or it could be the SoC only has one pipeline.
    In either case we fall back to using the old method of traversing
    the input connections to find a matching engine, and then get its
    ID.
    Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
    Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20170908075016.18657-5-wens@csie.org
    e8d5bbf7
sun4i_tcon.c 21.9 KB