mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-05 05:05:08 +07:00
9a47db8e7a
The DRM kernel API used to be defined in a handful of headers, pulled in through drmP.h. It has since been split in multiple headers for the different DRM components, and drmP.h turned into a legacy header that just pulls in most of the DRM kernel API (and a large number of other miscellaneous kernel headers). In order to speed up compilation, replace inclusion of drmP.h with only the required headers. It turns out that the rcar-du-drm driver already includes most of the necessary headers, so the change is simple. While at it, remove unneeded inclusion of other headers, and unneeded forward declarations of structures. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
84 lines
1.8 KiB
C
84 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* rcar_du_encoder.c -- R-Car Display Unit Encoder
|
|
*
|
|
* Copyright (C) 2013-2014 Renesas Electronics Corporation
|
|
*
|
|
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
|
|
*/
|
|
|
|
#include <linux/export.h>
|
|
|
|
#include <drm/drm_crtc.h>
|
|
#include <drm/drm_crtc_helper.h>
|
|
#include <drm/drm_panel.h>
|
|
|
|
#include "rcar_du_drv.h"
|
|
#include "rcar_du_encoder.h"
|
|
#include "rcar_du_kms.h"
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
* Encoder
|
|
*/
|
|
|
|
static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
|
|
};
|
|
|
|
static const struct drm_encoder_funcs encoder_funcs = {
|
|
.destroy = drm_encoder_cleanup,
|
|
};
|
|
|
|
int rcar_du_encoder_init(struct rcar_du_device *rcdu,
|
|
enum rcar_du_output output,
|
|
struct device_node *enc_node,
|
|
struct device_node *con_node)
|
|
{
|
|
struct rcar_du_encoder *renc;
|
|
struct drm_encoder *encoder;
|
|
struct drm_bridge *bridge = NULL;
|
|
int ret;
|
|
|
|
renc = devm_kzalloc(rcdu->dev, sizeof(*renc), GFP_KERNEL);
|
|
if (renc == NULL)
|
|
return -ENOMEM;
|
|
|
|
renc->output = output;
|
|
encoder = rcar_encoder_to_drm_encoder(renc);
|
|
|
|
dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
|
|
enc_node, output);
|
|
|
|
/* Locate the DRM bridge from the encoder DT node. */
|
|
bridge = of_drm_find_bridge(enc_node);
|
|
if (!bridge) {
|
|
ret = -EPROBE_DEFER;
|
|
goto done;
|
|
}
|
|
|
|
ret = drm_encoder_init(rcdu->ddev, encoder, &encoder_funcs,
|
|
DRM_MODE_ENCODER_NONE, NULL);
|
|
if (ret < 0)
|
|
goto done;
|
|
|
|
drm_encoder_helper_add(encoder, &encoder_helper_funcs);
|
|
|
|
/*
|
|
* Attach the bridge to the encoder. The bridge will create the
|
|
* connector.
|
|
*/
|
|
ret = drm_bridge_attach(encoder, bridge, NULL);
|
|
if (ret) {
|
|
drm_encoder_cleanup(encoder);
|
|
return ret;
|
|
}
|
|
|
|
done:
|
|
if (ret < 0) {
|
|
if (encoder->name)
|
|
encoder->funcs->destroy(encoder);
|
|
devm_kfree(rcdu->dev, renc);
|
|
}
|
|
|
|
return ret;
|
|
}
|