drm/rockchip: drv: add rockchip_drm_get_sub_dev_type

before this commit, the DMC driver use drm_device_get_by_name() to get drm
connector info, now we use rockchip_drm_get_sub_dev_type() to instead of
it.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: Ief6546d933fbb49e46e6e8d2a99464eb5951e069
This commit is contained in:
Sandy Huang
2021-07-16 17:52:27 +08:00
parent b441d298c9
commit 4f8318d63e
2 changed files with 26 additions and 0 deletions

View File

@@ -138,6 +138,24 @@ struct rockchip_drm_sub_dev *rockchip_drm_get_sub_dev(struct device_node *node)
}
EXPORT_SYMBOL(rockchip_drm_get_sub_dev);
int rockchip_drm_get_sub_dev_type(void)
{
int connector_type = DRM_MODE_CONNECTOR_Unknown;
struct rockchip_drm_sub_dev *sub_dev = NULL;
mutex_lock(&rockchip_drm_sub_dev_lock);
list_for_each_entry(sub_dev, &rockchip_drm_sub_dev_list, list) {
if (sub_dev->connector->encoder) {
connector_type = sub_dev->connector->connector_type;
break;
}
}
mutex_unlock(&rockchip_drm_sub_dev_lock);
return connector_type;
}
EXPORT_SYMBOL(rockchip_drm_get_sub_dev_type);
static const struct drm_display_mode rockchip_drm_default_modes[] = {
/* 4 - 1280x720@60Hz 16:9 */
{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1390,

View File

@@ -192,6 +192,14 @@ void rockchip_drm_register_sub_dev(struct rockchip_drm_sub_dev *sub_dev);
void rockchip_drm_unregister_sub_dev(struct rockchip_drm_sub_dev *sub_dev);
struct rockchip_drm_sub_dev *rockchip_drm_get_sub_dev(struct device_node *node);
int rockchip_drm_add_modes_noedid(struct drm_connector *connector);
#if IS_ENABLED(CONFIG_DRM_ROCKCHIP)
int rockchip_drm_get_sub_dev_type(void);
#else
static inline int rockchip_drm_get_sub_dev_type(void)
{
return DRM_MODE_CONNECTOR_Unknown;
}
#endif
int rockchip_drm_endpoint_is_subdriver(struct device_node *ep);
uint32_t rockchip_drm_of_find_possible_crtcs(struct drm_device *dev,