drm/rockchip: Use simple encoder

The rockchip driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200305155950.2705-13-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann
2020-03-05 16:59:40 +01:00
parent f9b21bde1a
commit 0dbd735448
8 changed files with 19 additions and 49 deletions

View File

@@ -26,6 +26,7 @@
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_panel.h> #include <drm/drm_panel.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
#include "rockchip_drm_drv.h" #include "rockchip_drm_drv.h"
#include "rockchip_drm_vop.h" #include "rockchip_drm_vop.h"
@@ -258,10 +259,6 @@ static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {
.atomic_check = rockchip_dp_drm_encoder_atomic_check, .atomic_check = rockchip_dp_drm_encoder_atomic_check,
}; };
static struct drm_encoder_funcs rockchip_dp_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) static int rockchip_dp_of_probe(struct rockchip_dp_device *dp)
{ {
struct device *dev = dp->dev; struct device *dev = dp->dev;
@@ -309,8 +306,8 @@ static int rockchip_dp_drm_create_encoder(struct rockchip_dp_device *dp)
dev->of_node); dev->of_node);
DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs); DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs);
ret = drm_encoder_init(drm_dev, encoder, &rockchip_dp_encoder_funcs, ret = drm_simple_encoder_init(drm_dev, encoder,
DRM_MODE_ENCODER_TMDS, NULL); DRM_MODE_ENCODER_TMDS);
if (ret) { if (ret) {
DRM_ERROR("failed to initialize encoder with drm\n"); DRM_ERROR("failed to initialize encoder with drm\n");
return ret; return ret;

View File

@@ -20,6 +20,7 @@
#include <drm/drm_edid.h> #include <drm/drm_edid.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
#include "cdn-dp-core.h" #include "cdn-dp-core.h"
#include "cdn-dp-reg.h" #include "cdn-dp-reg.h"
@@ -689,10 +690,6 @@ static const struct drm_encoder_helper_funcs cdn_dp_encoder_helper_funcs = {
.atomic_check = cdn_dp_encoder_atomic_check, .atomic_check = cdn_dp_encoder_atomic_check,
}; };
static const struct drm_encoder_funcs cdn_dp_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static int cdn_dp_parse_dt(struct cdn_dp_device *dp) static int cdn_dp_parse_dt(struct cdn_dp_device *dp)
{ {
struct device *dev = dp->dev; struct device *dev = dp->dev;
@@ -1030,8 +1027,8 @@ static int cdn_dp_bind(struct device *dev, struct device *master, void *data)
dev->of_node); dev->of_node);
DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs); DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs);
ret = drm_encoder_init(drm_dev, encoder, &cdn_dp_encoder_funcs, ret = drm_simple_encoder_init(drm_dev, encoder,
DRM_MODE_ENCODER_TMDS, NULL); DRM_MODE_ENCODER_TMDS);
if (ret) { if (ret) {
DRM_ERROR("failed to initialize encoder with drm\n"); DRM_ERROR("failed to initialize encoder with drm\n");
return ret; return ret;

View File

@@ -21,6 +21,7 @@
#include <drm/bridge/dw_mipi_dsi.h> #include <drm/bridge/dw_mipi_dsi.h>
#include <drm/drm_mipi_dsi.h> #include <drm/drm_mipi_dsi.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_simple_kms_helper.h>
#include "rockchip_drm_drv.h" #include "rockchip_drm_drv.h"
#include "rockchip_drm_vop.h" #include "rockchip_drm_vop.h"
@@ -789,10 +790,6 @@ dw_mipi_dsi_encoder_helper_funcs = {
.disable = dw_mipi_dsi_encoder_disable, .disable = dw_mipi_dsi_encoder_disable,
}; };
static const struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static int rockchip_dsi_drm_create_encoder(struct dw_mipi_dsi_rockchip *dsi, static int rockchip_dsi_drm_create_encoder(struct dw_mipi_dsi_rockchip *dsi,
struct drm_device *drm_dev) struct drm_device *drm_dev)
{ {
@@ -802,8 +799,7 @@ static int rockchip_dsi_drm_create_encoder(struct dw_mipi_dsi_rockchip *dsi,
encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev, encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
dsi->dev->of_node); dsi->dev->of_node);
ret = drm_encoder_init(drm_dev, encoder, &dw_mipi_dsi_encoder_funcs, ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_DSI);
DRM_MODE_ENCODER_DSI, NULL);
if (ret) { if (ret) {
DRM_ERROR("Failed to initialize encoder with drm\n"); DRM_ERROR("Failed to initialize encoder with drm\n");
return ret; return ret;

View File

@@ -14,6 +14,7 @@
#include <drm/drm_edid.h> #include <drm/drm_edid.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
#include "rockchip_drm_drv.h" #include "rockchip_drm_drv.h"
#include "rockchip_drm_vop.h" #include "rockchip_drm_vop.h"
@@ -237,10 +238,6 @@ dw_hdmi_rockchip_mode_valid(struct drm_connector *connector,
return (valid) ? MODE_OK : MODE_BAD; return (valid) ? MODE_OK : MODE_BAD;
} }
static const struct drm_encoder_funcs dw_hdmi_rockchip_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder) static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
{ {
} }
@@ -546,8 +543,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
} }
drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs); drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs);
drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs, drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
DRM_MODE_ENCODER_TMDS, NULL);
platform_set_drvdata(pdev, hdmi); platform_set_drvdata(pdev, hdmi);

View File

@@ -19,6 +19,7 @@
#include <drm/drm_edid.h> #include <drm/drm_edid.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
#include "rockchip_drm_drv.h" #include "rockchip_drm_drv.h"
#include "rockchip_drm_vop.h" #include "rockchip_drm_vop.h"
@@ -532,10 +533,6 @@ static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
.atomic_check = inno_hdmi_encoder_atomic_check, .atomic_check = inno_hdmi_encoder_atomic_check,
}; };
static struct drm_encoder_funcs inno_hdmi_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static enum drm_connector_status static enum drm_connector_status
inno_hdmi_connector_detect(struct drm_connector *connector, bool force) inno_hdmi_connector_detect(struct drm_connector *connector, bool force)
{ {
@@ -617,8 +614,7 @@ static int inno_hdmi_register(struct drm_device *drm, struct inno_hdmi *hdmi)
return -EPROBE_DEFER; return -EPROBE_DEFER;
drm_encoder_helper_add(encoder, &inno_hdmi_encoder_helper_funcs); drm_encoder_helper_add(encoder, &inno_hdmi_encoder_helper_funcs);
drm_encoder_init(drm, encoder, &inno_hdmi_encoder_funcs, drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
DRM_MODE_ENCODER_TMDS, NULL);
hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD; hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;

View File

@@ -6,6 +6,7 @@
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
@@ -451,10 +452,6 @@ struct drm_encoder_helper_funcs rk3066_hdmi_encoder_helper_funcs = {
.atomic_check = rk3066_hdmi_encoder_atomic_check, .atomic_check = rk3066_hdmi_encoder_atomic_check,
}; };
static const struct drm_encoder_funcs rk3066_hdmi_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static enum drm_connector_status static enum drm_connector_status
rk3066_hdmi_connector_detect(struct drm_connector *connector, bool force) rk3066_hdmi_connector_detect(struct drm_connector *connector, bool force)
{ {
@@ -557,8 +554,7 @@ rk3066_hdmi_register(struct drm_device *drm, struct rk3066_hdmi *hdmi)
return -EPROBE_DEFER; return -EPROBE_DEFER;
drm_encoder_helper_add(encoder, &rk3066_hdmi_encoder_helper_funcs); drm_encoder_helper_add(encoder, &rk3066_hdmi_encoder_helper_funcs);
drm_encoder_init(drm, encoder, &rk3066_hdmi_encoder_funcs, drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
DRM_MODE_ENCODER_TMDS, NULL);
hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD; hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;

View File

@@ -16,13 +16,14 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h> #include <drm/drm_bridge.h>
#include <drm/drm_dp_helper.h> #include <drm/drm_dp_helper.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_panel.h> #include <drm/drm_panel.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
#include "rockchip_drm_drv.h" #include "rockchip_drm_drv.h"
#include "rockchip_drm_vop.h" #include "rockchip_drm_vop.h"
@@ -435,10 +436,6 @@ struct drm_encoder_helper_funcs px30_lvds_encoder_helper_funcs = {
.atomic_check = rockchip_lvds_encoder_atomic_check, .atomic_check = rockchip_lvds_encoder_atomic_check,
}; };
static const struct drm_encoder_funcs rockchip_lvds_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static int rk3288_lvds_probe(struct platform_device *pdev, static int rk3288_lvds_probe(struct platform_device *pdev,
struct rockchip_lvds *lvds) struct rockchip_lvds *lvds)
{ {
@@ -607,8 +604,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev, encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
dev->of_node); dev->of_node);
ret = drm_encoder_init(drm_dev, encoder, &rockchip_lvds_encoder_funcs, ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_LVDS);
DRM_MODE_ENCODER_LVDS, NULL);
if (ret < 0) { if (ret < 0) {
DRM_DEV_ERROR(drm_dev->dev, DRM_DEV_ERROR(drm_dev->dev,
"failed to initialize encoder: %d\n", ret); "failed to initialize encoder: %d\n", ret);

View File

@@ -14,6 +14,7 @@
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_panel.h> #include <drm/drm_panel.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
#include "rockchip_drm_drv.h" #include "rockchip_drm_drv.h"
#include "rockchip_drm_vop.h" #include "rockchip_drm_vop.h"
@@ -67,10 +68,6 @@ struct drm_encoder_helper_funcs rockchip_rgb_encoder_helper_funcs = {
.atomic_check = rockchip_rgb_encoder_atomic_check, .atomic_check = rockchip_rgb_encoder_atomic_check,
}; };
static const struct drm_encoder_funcs rockchip_rgb_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
struct rockchip_rgb *rockchip_rgb_init(struct device *dev, struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
struct drm_crtc *crtc, struct drm_crtc *crtc,
struct drm_device *drm_dev) struct drm_device *drm_dev)
@@ -126,8 +123,7 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
encoder = &rgb->encoder; encoder = &rgb->encoder;
encoder->possible_crtcs = drm_crtc_mask(crtc); encoder->possible_crtcs = drm_crtc_mask(crtc);
ret = drm_encoder_init(drm_dev, encoder, &rockchip_rgb_encoder_funcs, ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_NONE);
DRM_MODE_ENCODER_NONE, NULL);
if (ret < 0) { if (ret < 0) {
DRM_DEV_ERROR(drm_dev->dev, DRM_DEV_ERROR(drm_dev->dev,
"failed to initialize encoder: %d\n", ret); "failed to initialize encoder: %d\n", ret);