mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
drm: of: Add drm_of_lvds_get_dual_link_pixel_order_sink()
drm_of_lvds_get_dual_link_pixel_order() gets LVDS dual-link source pixel order. Similar to it, add it's counterpart function drm_of_lvds_get_dual_link_pixel_order_sink() to get LVDS dual-link sink pixel order. Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Liu Ying <victor.liu@nxp.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20241104032806.611890-7-victor.liu@nxp.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
parent
34902c2d02
commit
606410292f
@ -341,8 +341,23 @@ static int drm_of_lvds_get_remote_pixels_type(
|
||||
return pixels_type;
|
||||
}
|
||||
|
||||
static int __drm_of_lvds_get_dual_link_pixel_order(int p1_pt, int p2_pt)
|
||||
{
|
||||
/*
|
||||
* A valid dual-lVDS bus is found when one port is marked with
|
||||
* "dual-lvds-even-pixels", and the other port is marked with
|
||||
* "dual-lvds-odd-pixels", bail out if the markers are not right.
|
||||
*/
|
||||
if (p1_pt + p2_pt != DRM_OF_LVDS_EVEN + DRM_OF_LVDS_ODD)
|
||||
return -EINVAL;
|
||||
|
||||
return p1_pt == DRM_OF_LVDS_EVEN ?
|
||||
DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS :
|
||||
DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_of_lvds_get_dual_link_pixel_order - Get LVDS dual-link pixel order
|
||||
* drm_of_lvds_get_dual_link_pixel_order - Get LVDS dual-link source pixel order
|
||||
* @port1: First DT port node of the Dual-link LVDS source
|
||||
* @port2: Second DT port node of the Dual-link LVDS source
|
||||
*
|
||||
@ -387,20 +402,59 @@ int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1,
|
||||
if (remote_p2_pt < 0)
|
||||
return remote_p2_pt;
|
||||
|
||||
/*
|
||||
* A valid dual-lVDS bus is found when one remote port is marked with
|
||||
* "dual-lvds-even-pixels", and the other remote port is marked with
|
||||
* "dual-lvds-odd-pixels", bail out if the markers are not right.
|
||||
*/
|
||||
if (remote_p1_pt + remote_p2_pt != DRM_OF_LVDS_EVEN + DRM_OF_LVDS_ODD)
|
||||
return -EINVAL;
|
||||
|
||||
return remote_p1_pt == DRM_OF_LVDS_EVEN ?
|
||||
DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS :
|
||||
DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS;
|
||||
return __drm_of_lvds_get_dual_link_pixel_order(remote_p1_pt, remote_p2_pt);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(drm_of_lvds_get_dual_link_pixel_order);
|
||||
|
||||
/**
|
||||
* drm_of_lvds_get_dual_link_pixel_order_sink - Get LVDS dual-link sink pixel order
|
||||
* @port1: First DT port node of the Dual-link LVDS sink
|
||||
* @port2: Second DT port node of the Dual-link LVDS sink
|
||||
*
|
||||
* An LVDS dual-link connection is made of two links, with even pixels
|
||||
* transitting on one link, and odd pixels on the other link. This function
|
||||
* returns, for two ports of an LVDS dual-link sink, which port shall transmit
|
||||
* the even and odd pixels, based on the requirements of the sink.
|
||||
*
|
||||
* The pixel order is determined from the dual-lvds-even-pixels and
|
||||
* dual-lvds-odd-pixels properties in the sink's DT port nodes. If those
|
||||
* properties are not present, or if their usage is not valid, this function
|
||||
* returns -EINVAL.
|
||||
*
|
||||
* If either port is not connected, this function returns -EPIPE.
|
||||
*
|
||||
* @port1 and @port2 are typically DT sibling nodes, but may have different
|
||||
* parents when, for instance, two separate LVDS decoders receive the even and
|
||||
* odd pixels.
|
||||
*
|
||||
* Return:
|
||||
* * DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS - @port1 receives even pixels and @port2
|
||||
* receives odd pixels
|
||||
* * DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS - @port1 receives odd pixels and @port2
|
||||
* receives even pixels
|
||||
* * -EINVAL - @port1 or @port2 are NULL
|
||||
* * -EPIPE - when @port1 or @port2 are not connected
|
||||
*/
|
||||
int drm_of_lvds_get_dual_link_pixel_order_sink(struct device_node *port1,
|
||||
struct device_node *port2)
|
||||
{
|
||||
int sink_p1_pt, sink_p2_pt;
|
||||
|
||||
if (!port1 || !port2)
|
||||
return -EINVAL;
|
||||
|
||||
sink_p1_pt = drm_of_lvds_get_port_pixels_type(port1);
|
||||
if (!sink_p1_pt)
|
||||
return -EPIPE;
|
||||
|
||||
sink_p2_pt = drm_of_lvds_get_port_pixels_type(port2);
|
||||
if (!sink_p2_pt)
|
||||
return -EPIPE;
|
||||
|
||||
return __drm_of_lvds_get_dual_link_pixel_order(sink_p1_pt, sink_p2_pt);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(drm_of_lvds_get_dual_link_pixel_order_sink);
|
||||
|
||||
/**
|
||||
* drm_of_lvds_get_data_mapping - Get LVDS data mapping
|
||||
* @port: DT port node of the LVDS source or sink
|
||||
|
@ -52,6 +52,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
|
||||
struct drm_bridge **bridge);
|
||||
int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1,
|
||||
const struct device_node *port2);
|
||||
int drm_of_lvds_get_dual_link_pixel_order_sink(struct device_node *port1,
|
||||
struct device_node *port2);
|
||||
int drm_of_lvds_get_data_mapping(const struct device_node *port);
|
||||
int drm_of_get_data_lanes_count(const struct device_node *endpoint,
|
||||
const unsigned int min, const unsigned int max);
|
||||
@ -109,6 +111,13 @@ drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int
|
||||
drm_of_lvds_get_dual_link_pixel_order_sink(struct device_node *port1,
|
||||
struct device_node *port2)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int
|
||||
drm_of_lvds_get_data_mapping(const struct device_node *port)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user