On 3/11/26 5:10 AM, Thomas Zimmermann wrote:
> Initialize the mipi-dbi device with drm_mipi_dbi_dev_init() without
> creating a modesetting pipeline. Will allow for mipi-dbi drivers
> without simple-display helpers.
>
> As the new helper is a DRM function, add the drm_ prefix. Mipi-dbi
> interfaces currently lack this.
>
> Signed-off-by: Thomas Zimmermann <[email protected]>
> ---
> drivers/gpu/drm/drm_mipi_dbi.c | 76 ++++++++++++++++++++++++----------
> include/drm/drm_mipi_dbi.h | 4 ++
> 2 files changed, 57 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> index bb6cebc583be..86f38d59c6e9 100644
> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> @@ -554,6 +554,55 @@ static const uint32_t mipi_dbi_formats[] = {
> DRM_FORMAT_XRGB8888,
> };
>
> +/**
> + * drm_mipi_dbi_dev_init - MIPI DBI device initialization
> + * @dbidev: MIPI DBI device structure to initialize
> + * @mode: Hardware display mode
> + * @format: Hardware color format (DRM_FORMAT\_\*).
> + * @rotation: Initial rotation in degrees Counter Clock Wise
> + * @tx_buf_size: Allocate a transmit buffer of this size.
Looks like this is optional, so would be nice to say that here and
explain what the default is if 0 is passed.
> + *
> + * Returns:
> + * Zero on success, negative error code on failure.
> + */
> +int drm_mipi_dbi_dev_init(struct mipi_dbi_dev *dbidev, const struct
> drm_display_mode *mode,
> + u32 format, unsigned int rotation, size_t tx_buf_size)
> +{
> + struct drm_device *drm = &dbidev->drm;
> + int ret;
> +
> + if (!dbidev->dbi.command)
> + return -EINVAL;
> +
> + if (!tx_buf_size) {
> + const struct drm_format_info *info = drm_format_info(format);
> +
> + tx_buf_size = drm_format_info_min_pitch(info, 0,
> mode->hdisplay) *
> + mode->vdisplay;
> + }
> +