linux/drivers/gpu/drm/ast/ast_mode.c

/*
 * Copyright 2012 Red Hat Inc.
 * Parts based on xf86-video-ast
 * Copyright (c) 2005 ASPEED Technology Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sub license, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 * USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 *
 */
/*
 * Authors: Dave Airlie <[email protected]>
 */

#include <linux/delay.h>
#include <linux/export.h>
#include <linux/pci.h>

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_damage_helper.h>
#include <drm/drm_edid.h>
#include <drm/drm_format_helper.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_managed.h>
#include <drm/drm_panic.h>
#include <drm/drm_probe_helper.h>

#include "ast_ddc.h"
#include "ast_drv.h"
#include "ast_tables.h"

#define AST_LUT_SIZE

static inline void ast_load_palette_index(struct ast_device *ast,
				     u8 index, u8 red, u8 green,
				     u8 blue)
{}

static void ast_crtc_set_gamma_linear(struct ast_device *ast,
				      const struct drm_format_info *format)
{}

static void ast_crtc_set_gamma(struct ast_device *ast,
			       const struct drm_format_info *format,
			       struct drm_color_lut *lut)
{}

static bool ast_get_vbios_mode_info(const struct drm_format_info *format,
				    const struct drm_display_mode *mode,
				    struct drm_display_mode *adjusted_mode,
				    struct ast_vbios_mode_info *vbios_mode)
{}

static void ast_set_vbios_color_reg(struct ast_device *ast,
				    const struct drm_format_info *format,
				    const struct ast_vbios_mode_info *vbios_mode)
{}

static void ast_set_vbios_mode_reg(struct ast_device *ast,
				   const struct drm_display_mode *adjusted_mode,
				   const struct ast_vbios_mode_info *vbios_mode)
{}

static void ast_set_std_reg(struct ast_device *ast,
			    struct drm_display_mode *mode,
			    struct ast_vbios_mode_info *vbios_mode)
{}

static void ast_set_crtc_reg(struct ast_device *ast,
			     struct drm_display_mode *mode,
			     struct ast_vbios_mode_info *vbios_mode)
{}

static void ast_set_offset_reg(struct ast_device *ast,
			       struct drm_framebuffer *fb)
{}

static void ast_set_dclk_reg(struct ast_device *ast,
			     struct drm_display_mode *mode,
			     struct ast_vbios_mode_info *vbios_mode)
{}

static void ast_set_color_reg(struct ast_device *ast,
			      const struct drm_format_info *format)
{}

static void ast_set_crtthd_reg(struct ast_device *ast)
{}

static void ast_set_sync_reg(struct ast_device *ast,
			     struct drm_display_mode *mode,
			     struct ast_vbios_mode_info *vbios_mode)
{}

static void ast_set_start_address_crt1(struct ast_device *ast,
				       unsigned int offset)
{}

static void ast_wait_for_vretrace(struct ast_device *ast)
{}

/*
 * Planes
 */

static int ast_plane_init(struct drm_device *dev, struct ast_plane *ast_plane,
			  void __iomem *vaddr, u64 offset, unsigned long size,
			  uint32_t possible_crtcs,
			  const struct drm_plane_funcs *funcs,
			  const uint32_t *formats, unsigned int format_count,
			  const uint64_t *format_modifiers,
			  enum drm_plane_type type)
{}

/*
 * Primary plane
 */

static const uint32_t ast_primary_plane_formats[] =;

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

static void ast_handle_damage(struct ast_plane *ast_plane, struct iosys_map *src,
			      struct drm_framebuffer *fb,
			      const struct drm_rect *clip)
{}

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

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

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

static int ast_primary_plane_helper_get_scanout_buffer(struct drm_plane *plane,
						       struct drm_scanout_buffer *sb)
{}

static const struct drm_plane_helper_funcs ast_primary_plane_helper_funcs =;

static const struct drm_plane_funcs ast_primary_plane_funcs =;

static int ast_primary_plane_init(struct ast_device *ast)
{}

/*
 * Cursor plane
 */

static void ast_update_cursor_image(u8 __iomem *dst, const u8 *src, int width, int height)
{}

static void ast_set_cursor_base(struct ast_device *ast, u64 address)
{}

static void ast_set_cursor_location(struct ast_device *ast, u16 x, u16 y,
				    u8 x_offset, u8 y_offset)
{}

static void ast_set_cursor_enabled(struct ast_device *ast, bool enabled)
{}

static const uint32_t ast_cursor_plane_formats[] =;

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

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

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

static const struct drm_plane_helper_funcs ast_cursor_plane_helper_funcs =;

static const struct drm_plane_funcs ast_cursor_plane_funcs =;

static int ast_cursor_plane_init(struct ast_device *ast)
{}

/*
 * CRTC
 */

static enum drm_mode_status
ast_crtc_helper_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *mode)
{}

static void ast_crtc_helper_mode_set_nofb(struct drm_crtc *crtc)
{}

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

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

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

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

static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs =;

static void ast_crtc_reset(struct drm_crtc *crtc)
{}

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

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

static const struct drm_crtc_funcs ast_crtc_funcs =;

static int ast_crtc_init(struct drm_device *dev)
{}

/*
 * VGA Encoder
 */

static const struct drm_encoder_funcs ast_vga_encoder_funcs =;

/*
 * VGA Connector
 */

static const struct drm_connector_helper_funcs ast_vga_connector_helper_funcs =;

static const struct drm_connector_funcs ast_vga_connector_funcs =;

static int ast_vga_connector_init(struct drm_device *dev, struct drm_connector *connector)
{}

static int ast_vga_output_init(struct ast_device *ast)
{}

/*
 * SIL164 Encoder
 */

static const struct drm_encoder_funcs ast_sil164_encoder_funcs =;

/*
 * SIL164 Connector
 */

static const struct drm_connector_helper_funcs ast_sil164_connector_helper_funcs =;

static const struct drm_connector_funcs ast_sil164_connector_funcs =;

static int ast_sil164_connector_init(struct drm_device *dev, struct drm_connector *connector)
{}

static int ast_sil164_output_init(struct ast_device *ast)
{}

/*
 * DP501 Encoder
 */

static const struct drm_encoder_funcs ast_dp501_encoder_funcs =;

static void ast_dp501_encoder_helper_atomic_enable(struct drm_encoder *encoder,
						   struct drm_atomic_state *state)
{}

static void ast_dp501_encoder_helper_atomic_disable(struct drm_encoder *encoder,
						    struct drm_atomic_state *state)
{}

static const struct drm_encoder_helper_funcs ast_dp501_encoder_helper_funcs =;

/*
 * DP501 Connector
 */

static int ast_dp501_connector_helper_get_modes(struct drm_connector *connector)
{}

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

static const struct drm_connector_helper_funcs ast_dp501_connector_helper_funcs =;

static const struct drm_connector_funcs ast_dp501_connector_funcs =;

static int ast_dp501_connector_init(struct drm_device *dev, struct drm_connector *connector)
{}

static int ast_dp501_output_init(struct ast_device *ast)
{}

/*
 * ASPEED Display-Port Encoder
 */

static const struct drm_encoder_funcs ast_astdp_encoder_funcs =;

static void ast_astdp_encoder_helper_atomic_mode_set(struct drm_encoder *encoder,
						     struct drm_crtc_state *crtc_state,
						     struct drm_connector_state *conn_state)
{}

static void ast_astdp_encoder_helper_atomic_enable(struct drm_encoder *encoder,
						   struct drm_atomic_state *state)
{}

static void ast_astdp_encoder_helper_atomic_disable(struct drm_encoder *encoder,
						    struct drm_atomic_state *state)
{}

static const struct drm_encoder_helper_funcs ast_astdp_encoder_helper_funcs =;

/*
 * ASPEED Display-Port Connector
 */

static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)
{}

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

static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs =;

static const struct drm_connector_funcs ast_astdp_connector_funcs =;

static int ast_astdp_connector_init(struct drm_device *dev, struct drm_connector *connector)
{}

static int ast_astdp_output_init(struct ast_device *ast)
{}

/*
 * BMC virtual Connector
 */

static const struct drm_encoder_funcs ast_bmc_encoder_funcs =;

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

static int ast_bmc_connector_helper_get_modes(struct drm_connector *connector)
{}

static const struct drm_connector_helper_funcs ast_bmc_connector_helper_funcs =;

static const struct drm_connector_funcs ast_bmc_connector_funcs =;

static int ast_bmc_connector_init(struct drm_device *dev,
				  struct ast_bmc_connector *bmc_connector,
				  struct drm_connector *physical_connector)
{}

static int ast_bmc_output_init(struct ast_device *ast,
			       struct drm_connector *physical_connector)
{}

/*
 * Mode config
 */

static void ast_mode_config_helper_atomic_commit_tail(struct drm_atomic_state *state)
{}

static const struct drm_mode_config_helper_funcs ast_mode_config_helper_funcs =;

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

static const struct drm_mode_config_funcs ast_mode_config_funcs =;

int ast_mode_config_init(struct ast_device *ast)
{}