linux/drivers/gpu/drm/udl/udl_modeset.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2012 Red Hat
 *
 * based in parts on udlfb.c:
 * Copyright (C) 2009 Roberto De Ioris <[email protected]>
 * Copyright (C) 2009 Jaya Kumar <[email protected]>
 * Copyright (C) 2009 Bernie Thompson <[email protected]>
 */

#include <linux/bitfield.h>

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_damage_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>

#include "udl_drv.h"
#include "udl_edid.h"
#include "udl_proto.h"

/*
 * All DisplayLink bulk operations start with 0xaf (UDL_MSG_BULK), followed by
 * a specific command code. All operations are written to a command buffer, which
 * the driver sends to the device.
 */
static char *udl_set_register(char *buf, u8 reg, u8 val)
{}

static char *udl_vidreg_lock(char *buf)
{}

static char *udl_vidreg_unlock(char *buf)
{}

static char *udl_set_blank_mode(char *buf, u8 mode)
{}

static char *udl_set_color_depth(char *buf, u8 selection)
{}

static char *udl_set_base16bpp(char *buf, u32 base)
{}

/*
 * DisplayLink HW has separate 16bpp and 8bpp framebuffers.
 * In 24bpp modes, the low 323 RGB bits go in the 8bpp framebuffer
 */
static char *udl_set_base8bpp(char *buf, u32 base)
{}

static char *udl_set_register_16(char *wrptr, u8 reg, u16 value)
{}

/*
 * This is kind of weird because the controller takes some
 * register values in a different byte order than other registers.
 */
static char *udl_set_register_16be(char *wrptr, u8 reg, u16 value)
{}

/*
 * LFSR is linear feedback shift register. The reason we have this is
 * because the display controller needs to minimize the clock depth of
 * various counters used in the display path. So this code reverses the
 * provided value into the lfsr16 value by counting backwards to get
 * the value that needs to be set in the hardware comparator to get the
 * same actual count. This makes sense once you read above a couple of
 * times and think about it from a hardware perspective.
 */
static u16 udl_lfsr16(u16 actual_count)
{}

/*
 * This does LFSR conversion on the value that is to be written.
 * See LFSR explanation above for more detail.
 */
static char *udl_set_register_lfsr16(char *wrptr, u8 reg, u16 value)
{}

/*
 * Takes a DRM display mode and converts it into the DisplayLink
 * equivalent register commands.
 */
static char *udl_set_display_mode(char *buf, struct drm_display_mode *mode)
{}

static char *udl_dummy_render(char *wrptr)
{}

static long udl_log_cpp(unsigned int cpp)
{}

static int udl_handle_damage(struct drm_framebuffer *fb,
			     const struct iosys_map *map,
			     const struct drm_rect *clip)
{}

/*
 * Primary plane
 */

static const uint32_t udl_primary_plane_formats[] =;

static const uint64_t udl_primary_plane_fmtmods[] =;

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

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

static const struct drm_plane_helper_funcs udl_primary_plane_helper_funcs =;

static const struct drm_plane_funcs udl_primary_plane_funcs =;

/*
 * CRTC
 */

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

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

static const struct drm_crtc_helper_funcs udl_crtc_helper_funcs =;

static const struct drm_crtc_funcs udl_crtc_funcs =;

/*
 * Encoder
 */

static const struct drm_encoder_funcs udl_encoder_funcs =;

/*
 * Connector
 */

static int udl_connector_helper_get_modes(struct drm_connector *connector)
{}

static int udl_connector_helper_detect_ctx(struct drm_connector *connector,
					   struct drm_modeset_acquire_ctx *ctx,
					   bool force)
{}

static const struct drm_connector_helper_funcs udl_connector_helper_funcs =;

static const struct drm_connector_funcs udl_connector_funcs =;

/*
 * Modesetting
 */

static enum drm_mode_status udl_mode_config_mode_valid(struct drm_device *dev,
						       const struct drm_display_mode *mode)
{}

static const struct drm_mode_config_funcs udl_mode_config_funcs =;

int udl_modeset_init(struct drm_device *dev)
{}