Commit f6ebc1b0 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/vc4: Use simple encoder

The vc4 driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarEric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20200305155950.2705-19-tzimmermann@suse.de
parent d877d6ea
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,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 <linux/clk.h> #include <linux/clk.h>
#include <linux/component.h> #include <linux/component.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
...@@ -114,10 +115,6 @@ static const struct debugfs_reg32 dpi_regs[] = { ...@@ -114,10 +115,6 @@ static const struct debugfs_reg32 dpi_regs[] = {
VC4_REG32(DPI_ID), VC4_REG32(DPI_ID),
}; };
static const struct drm_encoder_funcs vc4_dpi_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static void vc4_dpi_encoder_disable(struct drm_encoder *encoder) static void vc4_dpi_encoder_disable(struct drm_encoder *encoder)
{ {
struct vc4_dpi_encoder *vc4_encoder = to_vc4_dpi_encoder(encoder); struct vc4_dpi_encoder *vc4_encoder = to_vc4_dpi_encoder(encoder);
...@@ -309,8 +306,7 @@ static int vc4_dpi_bind(struct device *dev, struct device *master, void *data) ...@@ -309,8 +306,7 @@ static int vc4_dpi_bind(struct device *dev, struct device *master, void *data)
if (ret) if (ret)
DRM_ERROR("Failed to turn on core clock: %d\n", ret); DRM_ERROR("Failed to turn on core clock: %d\n", ret);
drm_encoder_init(drm, dpi->encoder, &vc4_dpi_encoder_funcs, drm_simple_encoder_init(drm, dpi->encoder, DRM_MODE_ENCODER_DPI);
DRM_MODE_ENCODER_DPI, NULL);
drm_encoder_helper_add(dpi->encoder, &vc4_dpi_encoder_helper_funcs); drm_encoder_helper_add(dpi->encoder, &vc4_dpi_encoder_helper_funcs);
ret = vc4_dpi_init_bridge(dpi); ret = vc4_dpi_init_bridge(dpi);
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,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 "vc4_drv.h" #include "vc4_drv.h"
#include "vc4_regs.h" #include "vc4_regs.h"
...@@ -652,15 +653,6 @@ static const struct debugfs_reg32 dsi1_regs[] = { ...@@ -652,15 +653,6 @@ static const struct debugfs_reg32 dsi1_regs[] = {
VC4_REG32(DSI1_ID), VC4_REG32(DSI1_ID),
}; };
static void vc4_dsi_encoder_destroy(struct drm_encoder *encoder)
{
drm_encoder_cleanup(encoder);
}
static const struct drm_encoder_funcs vc4_dsi_encoder_funcs = {
.destroy = vc4_dsi_encoder_destroy,
};
static void vc4_dsi_latch_ulps(struct vc4_dsi *dsi, bool latch) static void vc4_dsi_latch_ulps(struct vc4_dsi *dsi, bool latch)
{ {
u32 afec0 = DSI_PORT_READ(PHY_AFEC0); u32 afec0 = DSI_PORT_READ(PHY_AFEC0);
...@@ -1615,8 +1607,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -1615,8 +1607,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
if (dsi->port == 1) if (dsi->port == 1)
vc4->dsi1 = dsi; vc4->dsi1 = dsi;
drm_encoder_init(drm, dsi->encoder, &vc4_dsi_encoder_funcs, drm_simple_encoder_init(drm, dsi->encoder, DRM_MODE_ENCODER_DSI);
DRM_MODE_ENCODER_DSI, NULL);
drm_encoder_helper_add(dsi->encoder, &vc4_dsi_encoder_helper_funcs); drm_encoder_helper_add(dsi->encoder, &vc4_dsi_encoder_helper_funcs);
ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL, 0); ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL, 0);
...@@ -1656,7 +1647,7 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master, ...@@ -1656,7 +1647,7 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master,
* normally. * normally.
*/ */
list_splice_init(&dsi->bridge_chain, &dsi->encoder->bridge_chain); list_splice_init(&dsi->bridge_chain, &dsi->encoder->bridge_chain);
vc4_dsi_encoder_destroy(dsi->encoder); drm_encoder_cleanup(dsi->encoder);
if (dsi->port == 1) if (dsi->port == 1)
vc4->dsi1 = NULL; vc4->dsi1 = NULL;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_edid.h> #include <drm/drm_edid.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/component.h> #include <linux/component.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -306,15 +307,6 @@ static struct drm_connector *vc4_hdmi_connector_init(struct drm_device *dev, ...@@ -306,15 +307,6 @@ static struct drm_connector *vc4_hdmi_connector_init(struct drm_device *dev,
return connector; return connector;
} }
static void vc4_hdmi_encoder_destroy(struct drm_encoder *encoder)
{
drm_encoder_cleanup(encoder);
}
static const struct drm_encoder_funcs vc4_hdmi_encoder_funcs = {
.destroy = vc4_hdmi_encoder_destroy,
};
static int vc4_hdmi_stop_packet(struct drm_encoder *encoder, static int vc4_hdmi_stop_packet(struct drm_encoder *encoder,
enum hdmi_infoframe_type type) enum hdmi_infoframe_type type)
{ {
...@@ -1394,8 +1386,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -1394,8 +1386,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
} }
pm_runtime_enable(dev); pm_runtime_enable(dev);
drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs, drm_simple_encoder_init(drm, hdmi->encoder, DRM_MODE_ENCODER_TMDS);
DRM_MODE_ENCODER_TMDS, NULL);
drm_encoder_helper_add(hdmi->encoder, &vc4_hdmi_encoder_helper_funcs); drm_encoder_helper_add(hdmi->encoder, &vc4_hdmi_encoder_helper_funcs);
hdmi->connector = hdmi->connector =
...@@ -1453,7 +1444,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -1453,7 +1444,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
vc4_hdmi_connector_destroy(hdmi->connector); vc4_hdmi_connector_destroy(hdmi->connector);
#endif #endif
err_destroy_encoder: err_destroy_encoder:
vc4_hdmi_encoder_destroy(hdmi->encoder); drm_encoder_cleanup(hdmi->encoder);
err_unprepare_hsm: err_unprepare_hsm:
clk_disable_unprepare(hdmi->hsm_clock); clk_disable_unprepare(hdmi->hsm_clock);
pm_runtime_disable(dev); pm_runtime_disable(dev);
...@@ -1472,7 +1463,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, ...@@ -1472,7 +1463,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master,
cec_unregister_adapter(hdmi->cec_adap); cec_unregister_adapter(hdmi->cec_adap);
vc4_hdmi_connector_destroy(hdmi->connector); vc4_hdmi_connector_destroy(hdmi->connector);
vc4_hdmi_encoder_destroy(hdmi->encoder); drm_encoder_cleanup(hdmi->encoder);
clk_disable_unprepare(hdmi->hsm_clock); clk_disable_unprepare(hdmi->hsm_clock);
pm_runtime_disable(dev); pm_runtime_disable(dev);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <drm/drm_edid.h> #include <drm/drm_edid.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 <linux/clk.h> #include <linux/clk.h>
#include <linux/component.h> #include <linux/component.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
...@@ -374,10 +375,6 @@ static struct drm_connector *vc4_vec_connector_init(struct drm_device *dev, ...@@ -374,10 +375,6 @@ static struct drm_connector *vc4_vec_connector_init(struct drm_device *dev,
return connector; return connector;
} }
static const struct drm_encoder_funcs vc4_vec_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static void vc4_vec_encoder_disable(struct drm_encoder *encoder) static void vc4_vec_encoder_disable(struct drm_encoder *encoder)
{ {
struct vc4_vec_encoder *vc4_vec_encoder = to_vc4_vec_encoder(encoder); struct vc4_vec_encoder *vc4_vec_encoder = to_vc4_vec_encoder(encoder);
...@@ -566,8 +563,7 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data) ...@@ -566,8 +563,7 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
pm_runtime_enable(dev); pm_runtime_enable(dev);
drm_encoder_init(drm, vec->encoder, &vc4_vec_encoder_funcs, drm_simple_encoder_init(drm, vec->encoder, DRM_MODE_ENCODER_TVDAC);
DRM_MODE_ENCODER_TVDAC, NULL);
drm_encoder_helper_add(vec->encoder, &vc4_vec_encoder_helper_funcs); drm_encoder_helper_add(vec->encoder, &vc4_vec_encoder_helper_funcs);
vec->connector = vc4_vec_connector_init(drm, vec); vec->connector = vc4_vec_connector_init(drm, vec);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment