mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 17:57:38 -04:00
drm/of: add helper to count data-lanes on a remote endpoint
If the DSI panel supports versatile lanes configuration, its driver might require determining the number of DSI data lanes, which is usually specified on the DSI host side of the OF graph. Add new helper as a pair to drm_of_get_data_lanes_count_ep() that lets callers determine number of data-lanes on the remote side of the OF graph. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patch.msgid.link/20260413-waveshare-dsi-touch-v3-6-3aeb53022c32@oss.qualcomm.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
This commit is contained in:
@@ -558,6 +558,40 @@ int drm_of_get_data_lanes_count_ep(const struct device_node *port,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(drm_of_get_data_lanes_count_ep);
|
||||
|
||||
/**
|
||||
* drm_of_get_data_lanes_count_remote - Get DSI/(e)DP data lane count by endpoint
|
||||
* @port: DT port node of the DSI/(e)DP source or sink
|
||||
* @port_reg: identifier (value of reg property) of the parent port node
|
||||
* @reg: identifier (value of reg property) of the endpoint node
|
||||
* @min: minimum supported number of data lanes
|
||||
* @max: maximum supported number of data lanes
|
||||
*
|
||||
* Count DT "data-lanes" property elements in the remote endpoint and check for
|
||||
* validity. This variant uses endpoint specifier.
|
||||
*
|
||||
* Return:
|
||||
* * min..max - positive integer count of "data-lanes" elements
|
||||
* * -EINVAL - the "data-lanes" property is unsupported
|
||||
* * -ENODEV - the "data-lanes" property is missing
|
||||
*/
|
||||
int drm_of_get_data_lanes_count_remote(const struct device_node *port,
|
||||
int port_reg, int reg,
|
||||
const unsigned int min,
|
||||
const unsigned int max)
|
||||
{
|
||||
struct device_node *endpoint, *remote;
|
||||
int ret;
|
||||
|
||||
endpoint = of_graph_get_endpoint_by_regs(port, port_reg, reg);
|
||||
remote = of_graph_get_remote_endpoint(endpoint);
|
||||
of_node_put(endpoint);
|
||||
ret = drm_of_get_data_lanes_count(remote, min, max);
|
||||
of_node_put(remote);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(drm_of_get_data_lanes_count_remote);
|
||||
|
||||
#if IS_ENABLED(CONFIG_DRM_MIPI_DSI)
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,6 +62,10 @@ int drm_of_get_data_lanes_count_ep(const struct device_node *port,
|
||||
int port_reg, int reg,
|
||||
const unsigned int min,
|
||||
const unsigned int max);
|
||||
int drm_of_get_data_lanes_count_remote(const struct device_node *port,
|
||||
int port_reg, int reg,
|
||||
const unsigned int min,
|
||||
const unsigned int max);
|
||||
#else
|
||||
static inline uint32_t drm_of_crtc_port_mask(struct drm_device *dev,
|
||||
struct device_node *port)
|
||||
@@ -140,6 +144,15 @@ drm_of_get_data_lanes_count_ep(const struct device_node *port,
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int
|
||||
drm_of_get_data_lanes_count_remote(const struct device_node *port,
|
||||
int port_reg, int reg,
|
||||
const unsigned int min,
|
||||
const unsigned int max)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_MIPI_DSI)
|
||||
|
||||
Reference in New Issue
Block a user