drm/rockchip: add rockchip_drm_sub_dev_list to record connector

use rockchip_drm_sub_dev_list to manage rockchip drm sub dev and record
connector, offer new method to find connector through the sub_dev_list.

Change-Id: If9508cf9ff51f6f9e1d13c42c60491f4aec4b9c1
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
This commit is contained in:
Sandy Huang
2020-07-02 11:52:32 +08:00
committed by Tao Huang
parent e955b10e28
commit 9cbe0679b6
2 changed files with 67 additions and 0 deletions

View File

@@ -38,6 +38,29 @@
static bool is_support_iommu = true;
static struct drm_driver rockchip_drm_driver;
struct rockchip_drm_mode_set {
struct list_head head;
struct drm_framebuffer *fb;
struct drm_connector *connector;
struct drm_crtc *crtc;
struct drm_display_mode *mode;
int hdisplay;
int vdisplay;
int vrefresh;
int flags;
int picture_aspect_ratio;
int crtc_hsync_end;
int crtc_vsync_end;
int left_margin;
int right_margin;
int top_margin;
int bottom_margin;
bool mode_changed;
int ratio;
};
/**
* rockchip_drm_of_find_possible_crtcs - find the possible CRTCs for an active
* encoder port
@@ -75,6 +98,40 @@ uint32_t rockchip_drm_of_find_possible_crtcs(struct drm_device *dev,
}
EXPORT_SYMBOL(rockchip_drm_of_find_possible_crtcs);
static DEFINE_MUTEX(rockchip_drm_sub_dev_lock);
static LIST_HEAD(rockchip_drm_sub_dev_list);
void rockchip_drm_register_sub_dev(struct rockchip_drm_sub_dev *sub_dev)
{
mutex_lock(&rockchip_drm_sub_dev_lock);
list_add_tail(&sub_dev->list, &rockchip_drm_sub_dev_list);
mutex_unlock(&rockchip_drm_sub_dev_lock);
}
EXPORT_SYMBOL(rockchip_drm_register_sub_dev);
void rockchip_drm_unregister_sub_dev(struct rockchip_drm_sub_dev *sub_dev)
{
mutex_lock(&rockchip_drm_sub_dev_lock);
list_del(&sub_dev->list);
mutex_unlock(&rockchip_drm_sub_dev_lock);
}
EXPORT_SYMBOL(rockchip_drm_unregister_sub_dev);
struct rockchip_drm_sub_dev *rockchip_drm_get_sub_dev(struct device_node *node)
{
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->of_node == node)
break;
}
mutex_unlock(&rockchip_drm_sub_dev_lock);
return sub_dev;
}
EXPORT_SYMBOL(rockchip_drm_get_sub_dev);
int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
const struct rockchip_crtc_funcs *crtc_funcs)
{

View File

@@ -40,6 +40,12 @@ struct iommu_domain;
#define VOP_OUTPUT_IF_HDMI0 BIT(11)
#define VOP_OUTPUT_IF_HDMI1 BIT(12)
struct rockchip_drm_sub_dev {
struct list_head list;
struct drm_connector *connector;
struct device_node *of_node;
};
struct rockchip_sdr2hdr_state {
int sdr2hdr_func;
@@ -181,6 +187,10 @@ int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
const struct rockchip_crtc_funcs *crtc_funcs);
void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc);
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_endpoint_is_subdriver(struct device_node *ep);
uint32_t rockchip_drm_of_find_possible_crtcs(struct drm_device *dev,
struct device_node *port);