@@ -40,7 +40,6 @@
#include <drm/drm_gem_vram_helper.h>
#include <drm/drm_plane_helper.h>
#include <drm/drm_probe_helper.h>
-#include <drm/drm_simple_kms_helper.h>
#include "ast_drv.h"
#include "ast_tables.h"
@@ -964,7 +963,7 @@ static int ast_encoder_init(struct drm_device *dev)
struct drm_encoder *encoder = &ast->encoder;
int ret;
- ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
+ ret = drm_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
if (ret)
return ret;
@@ -152,6 +152,43 @@ int drm_encoder_init_funcs(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_encoder_init_funcs);
+static const struct drm_encoder_funcs drm_simple_encoder_funcs_cleanup = {
+ .destroy = drm_encoder_cleanup,
+};
+
+/**
+ * drm_simple_init - Initialize a preallocated encoder with basic functionality.
+ * @dev: drm device
+ * @encoder: the encoder to initialize
+ * @encoder_type: user visible type of the encoder
+ *
+ * Initialises a preallocated encoder that has no further functionality.
+ * Settings for possible CRTC and clones are left to their initial values.
+ * The encoder will be cleaned up automatically as part of the mode-setting
+ * cleanup.
+ *
+ * The caller of drm_encoder_init() is responsible for freeing
+ * the encoder's memory after the encoder has been cleaned up. At the
+ * moment this only works reliably if the encoder data structure is
+ * stored in the device structure. Free the encoder's memory as part of
+ * the device release function.
+ *
+ * FIXME: Later improvements to DRM's resource management may allow for
+ * an automated kfree() of the encoder's memory.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_simple_init(struct drm_device *dev,
+ struct drm_encoder *encoder,
+ int encoder_type)
+{
+ return drm_encoder_init_funcs(dev, encoder,
+ &drm_simple_encoder_funcs_cleanup,
+ encoder_type, NULL);
+}
+EXPORT_SYMBOL(drm_encoder_init);
+
/**
* drm_encoder_cleanup - cleans up an initialised encoder
* @encoder: encoder to cleanup
@@ -26,51 +26,8 @@
* entity. Some flexibility for code reuse is provided through a separately
* allocated &drm_connector object and supporting optional &drm_bridge
* encoder drivers.
- *
- * Many drivers require only a very simple encoder that fulfills the minimum
- * requirements of the display pipeline and does not add additional
- * functionality. The function drm_simple_encoder_init() provides an
- * implementation of such an encoder.
*/
-static const struct drm_encoder_funcs drm_simple_encoder_funcs_cleanup = {
- .destroy = drm_encoder_cleanup,
-};
-
-/**
- * drm_simple_encoder_init - Initialize a preallocated encoder with
- * basic functionality.
- * @dev: drm device
- * @encoder: the encoder to initialize
- * @encoder_type: user visible type of the encoder
- *
- * Initialises a preallocated encoder that has no further functionality.
- * Settings for possible CRTC and clones are left to their initial values.
- * The encoder will be cleaned up automatically as part of the mode-setting
- * cleanup.
- *
- * The caller of drm_simple_encoder_init() is responsible for freeing
- * the encoder's memory after the encoder has been cleaned up. At the
- * moment this only works reliably if the encoder data structure is
- * stored in the device structure. Free the encoder's memory as part of
- * the device release function.
- *
- * FIXME: Later improvements to DRM's resource management may allow for
- * an automated kfree() of the encoder's memory.
- *
- * Returns:
- * Zero on success, error code on failure.
- */
-int drm_simple_encoder_init(struct drm_device *dev,
- struct drm_encoder *encoder,
- int encoder_type)
-{
- return drm_encoder_init_funcs(dev, encoder,
- &drm_simple_encoder_funcs_cleanup,
- encoder_type, NULL);
-}
-EXPORT_SYMBOL(drm_simple_encoder_init);
-
static enum drm_mode_status
drm_simple_kms_crtc_mode_valid(struct drm_crtc *crtc,
const struct drm_display_mode *mode)
@@ -327,7 +284,7 @@ int drm_simple_display_pipe_init(struct drm_device *dev,
return ret;
encoder->possible_crtcs = drm_crtc_mask(crtc);
- ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_NONE);
+ ret = drm_encoder_init(dev, encoder, DRM_MODE_ENCODER_NONE);
if (ret || !connector)
return ret;
@@ -15,7 +15,6 @@
#include <drm/drm_fourcc.h>
#include <drm/drm_plane_helper.h>
#include <drm/drm_probe_helper.h>
-#include <drm/drm_simple_kms_helper.h>
#include "mgag200_drv.h"
@@ -1630,12 +1629,10 @@ int mgag200_modeset_init(struct mga_device *mdev)
mga_crtc_init(mdev);
- ret = drm_simple_encoder_init(mdev->dev, encoder,
- DRM_MODE_ENCODER_DAC);
+ ret = drm_encoder_init(mdev->dev, encoder, DRM_MODE_ENCODER_DAC);
if (ret) {
drm_err(mdev->dev,
- "drm_simple_encoder_init() failed, error %d\n",
- ret);
+ "drm_encoder_init() failed, error %d\n", ret);
return ret;
}
encoder->possible_crtcs = 0x1;
@@ -31,7 +31,6 @@
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_plane_helper.h>
#include <drm/drm_probe_helper.h>
-#include <drm/drm_simple_kms_helper.h>
#include "qxl_drv.h"
#include "qxl_object.h"
@@ -1088,11 +1087,9 @@ static int qdev_output_init(struct drm_device *dev, int num_output)
drm_connector_init(dev, &qxl_output->base,
&qxl_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL);
- ret = drm_simple_encoder_init(dev, &qxl_output->enc,
- DRM_MODE_ENCODER_VIRTUAL);
+ ret = drm_encoder_init(dev, &qxl_output->enc, DRM_MODE_ENCODER_VIRTUAL);
if (ret) {
- drm_err(dev, "drm_simple_encoder_init() failed, error %d\n",
- ret);
+ drm_err(dev, "drm_encoder_init() failed, error %d\n", ret);
goto err_drm_connector_cleanup;
}
@@ -191,6 +191,9 @@ int drm_encoder_init_funcs(struct drm_device *dev,
const struct drm_encoder_funcs *funcs,
int encoder_type, const char *name, ...);
+int drm_encoder_init(struct drm_device *dev,
+ struct drm_encoder *encoder,
+ int encoder_type);
/**
* drm_encoder_index - find the index of a registered encoder
* @encoder: encoder to find index for
@@ -181,8 +181,4 @@ int drm_simple_display_pipe_init(struct drm_device *dev,
const uint64_t *format_modifiers,
struct drm_connector *connector);
-int drm_simple_encoder_init(struct drm_device *dev,
- struct drm_encoder *encoder,
- int encoder_type);
-
#endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */
A lot of drivers requires only a basic encoder with no need to extend the functionality. This was previously implemented in drm_simple_kms_helper.c but encoders are not necessarily simple despite no need for a drm_encoder_funcs for adding functionality. Move the init function to drm_encoder.c to reflect this. And adjust the name to drm_encoder_init(). Drop include of drm_simple_kms_helper.h in the touched drivers as it is no logner required. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Dave Airlie <airlied@redhat.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Emil Velikov <emil.velikov@collabora.com> Cc: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Cc: "José Roberto de Souza" <jose.souza@intel.com> --- drivers/gpu/drm/ast/ast_mode.c | 3 +- drivers/gpu/drm/drm_encoder.c | 37 ++++++++++++++++++++ drivers/gpu/drm/drm_simple_kms_helper.c | 45 +------------------------ drivers/gpu/drm/mgag200/mgag200_mode.c | 7 ++-- drivers/gpu/drm/qxl/qxl_display.c | 7 ++-- include/drm/drm_encoder.h | 3 ++ include/drm/drm_simple_kms_helper.h | 4 --- 7 files changed, 46 insertions(+), 60 deletions(-)