linux/drivers/gpu/drm/mxsfb/lcdif_kms.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2022 Marek Vasut <[email protected]>
 *
 * This code is based on drivers/gpu/drm/mxsfb/mxsfb*
 */

#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/media-bus-format.h>
#include <linux/pm_runtime.h>
#include <linux/spinlock.h>

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_color_mgmt.h>
#include <drm/drm_connector.h>
#include <drm/drm_crtc.h>
#include <drm/drm_encoder.h>
#include <drm/drm_fb_dma_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_plane.h>
#include <drm/drm_vblank.h>

#include "lcdif_drv.h"
#include "lcdif_regs.h"

struct lcdif_crtc_state {};

static inline struct lcdif_crtc_state *
to_lcdif_crtc_state(struct drm_crtc_state *s)
{}

/* -----------------------------------------------------------------------------
 * CRTC
 */

/*
 * For conversion from YCbCr to RGB, the CSC operates as follows:
 *
 * |R|   |A1 A2 A3|   |Y  + D1|
 * |G| = |B1 B2 B3| * |Cb + D2|
 * |B|   |C1 C2 C3|   |Cr + D3|
 *
 * The A, B and C coefficients are expressed as Q2.8 fixed point values, and
 * the D coefficients as Q0.8. Despite the reference manual stating the
 * opposite, the D1, D2 and D3 offset values are added to Y, Cb and Cr, not
 * subtracted. They must thus be programmed with negative values.
 */
static const u32 lcdif_yuv2rgb_coeffs[3][2][6] =;

static void lcdif_set_formats(struct lcdif_drm_private *lcdif,
			      struct drm_plane_state *plane_state,
			      const u32 bus_format)
{}

static void lcdif_set_mode(struct lcdif_drm_private *lcdif, u32 bus_flags)
{}

static void lcdif_enable_controller(struct lcdif_drm_private *lcdif)
{}

static void lcdif_disable_controller(struct lcdif_drm_private *lcdif)
{}

static void lcdif_reset_block(struct lcdif_drm_private *lcdif)
{}

static void lcdif_crtc_mode_set_nofb(struct drm_crtc_state *crtc_state,
				     struct drm_plane_state *plane_state)
{}

static int lcdif_crtc_atomic_check(struct drm_crtc *crtc,
				   struct drm_atomic_state *state)
{}

static void lcdif_crtc_atomic_flush(struct drm_crtc *crtc,
				    struct drm_atomic_state *state)
{}

static void lcdif_crtc_atomic_enable(struct drm_crtc *crtc,
				     struct drm_atomic_state *state)
{}

static void lcdif_crtc_atomic_disable(struct drm_crtc *crtc,
				      struct drm_atomic_state *state)
{}

static void lcdif_crtc_atomic_destroy_state(struct drm_crtc *crtc,
					    struct drm_crtc_state *state)
{}

static void lcdif_crtc_reset(struct drm_crtc *crtc)
{}

static struct drm_crtc_state *
lcdif_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
{}

static int lcdif_crtc_enable_vblank(struct drm_crtc *crtc)
{}

static void lcdif_crtc_disable_vblank(struct drm_crtc *crtc)
{}

static const struct drm_crtc_helper_funcs lcdif_crtc_helper_funcs =;

static const struct drm_crtc_funcs lcdif_crtc_funcs =;

/* -----------------------------------------------------------------------------
 * Planes
 */

static int lcdif_plane_atomic_check(struct drm_plane *plane,
				    struct drm_atomic_state *state)
{}

static void lcdif_plane_primary_atomic_update(struct drm_plane *plane,
					      struct drm_atomic_state *state)
{}

static bool lcdif_format_mod_supported(struct drm_plane *plane,
				       uint32_t format,
				       uint64_t modifier)
{}

static const struct drm_plane_helper_funcs lcdif_plane_primary_helper_funcs =;

static const struct drm_plane_funcs lcdif_plane_funcs =;

static const u32 lcdif_primary_plane_formats[] =;

static const u64 lcdif_modifiers[] =;

/* -----------------------------------------------------------------------------
 * Initialization
 */

int lcdif_kms_init(struct lcdif_drm_private *lcdif)
{}