linux/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h

/*
 * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
 *                VA Linux Systems Inc., Fremont, California.
 * Copyright 2008 Red Hat 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, sublicense,
 * 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 above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * 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 NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
 *
 * Original Authors:
 *   Kevin E. Martin, Rickard E. Faith, Alan Hourihane
 *
 * Kernel port Author: Dave Airlie
 */

#ifndef AMDGPU_MODE_H
#define AMDGPU_MODE_H

#include <drm/display/drm_dp_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_encoder.h>
#include <drm/drm_fixed.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_probe_helper.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/hrtimer.h>
#include "amdgpu_irq.h"

#include <drm/display/drm_dp_mst_helper.h>
#include "modules/inc/mod_freesync.h"
#include "amdgpu_dm_irq_params.h"

struct amdgpu_bo;
struct amdgpu_device;
struct amdgpu_encoder;
struct amdgpu_router;
struct amdgpu_hpd;
struct edid;

#define to_amdgpu_crtc(x)
#define to_amdgpu_connector(x)
#define to_amdgpu_encoder(x)
#define to_amdgpu_framebuffer(x)

#define to_dm_plane_state(x)

#define AMDGPU_MAX_HPD_PINS
#define AMDGPU_MAX_CRTCS
#define AMDGPU_MAX_PLANES
#define AMDGPU_MAX_AFMT_BLOCKS

enum amdgpu_rmx_type {};

enum amdgpu_underscan_type {};

#define AMDGPU_HPD_CONNECT_INT_DELAY_IN_MS
#define AMDGPU_HPD_DISCONNECT_INT_DELAY_IN_MS

enum amdgpu_hpd_id {};

enum amdgpu_crtc_irq {};

enum amdgpu_pageflip_irq {};

enum amdgpu_flip_status {};

#define AMDGPU_MAX_I2C_BUS

/* amdgpu gpio-based i2c
 * 1. "mask" reg and bits
 *    grabs the gpio pins for software use
 *    0=not held  1=held
 * 2. "a" reg and bits
 *    output pin value
 *    0=low 1=high
 * 3. "en" reg and bits
 *    sets the pin direction
 *    0=input 1=output
 * 4. "y" reg and bits
 *    input pin value
 *    0=low 1=high
 */
struct amdgpu_i2c_bus_rec {};

#define AMDGPU_MAX_BIOS_CONNECTOR

/* pll flags */
#define AMDGPU_PLL_USE_BIOS_DIVS
#define AMDGPU_PLL_NO_ODD_POST_DIV
#define AMDGPU_PLL_USE_REF_DIV
#define AMDGPU_PLL_LEGACY
#define AMDGPU_PLL_PREFER_LOW_REF_DIV
#define AMDGPU_PLL_PREFER_HIGH_REF_DIV
#define AMDGPU_PLL_PREFER_LOW_FB_DIV
#define AMDGPU_PLL_PREFER_HIGH_FB_DIV
#define AMDGPU_PLL_PREFER_LOW_POST_DIV
#define AMDGPU_PLL_PREFER_HIGH_POST_DIV
#define AMDGPU_PLL_USE_FRAC_FB_DIV
#define AMDGPU_PLL_PREFER_CLOSEST_LOWER
#define AMDGPU_PLL_USE_POST_DIV
#define AMDGPU_PLL_IS_LCD
#define AMDGPU_PLL_PREFER_MINM_OVER_MAXP

struct amdgpu_pll {};

struct amdgpu_i2c_chan {};

struct amdgpu_afmt {};

/*
 * Audio
 */
struct amdgpu_audio_pin {};

struct amdgpu_audio {};

struct amdgpu_display_funcs {};

struct amdgpu_framebuffer {};

struct amdgpu_mode_info {};

#define AMDGPU_MAX_BL_LEVEL

struct amdgpu_backlight_privdata {};

struct amdgpu_atom_ss {};

struct amdgpu_crtc {};

struct amdgpu_encoder_atom_dig {};

struct amdgpu_encoder {};

struct amdgpu_connector_atom_dig {};

struct amdgpu_gpio_rec {};

struct amdgpu_hpd {};

struct amdgpu_router {};

enum amdgpu_connector_audio {};

enum amdgpu_connector_dither {};

struct amdgpu_dm_dp_aux {};

struct amdgpu_i2c_adapter {};

#define TO_DM_AUX(x)

struct amdgpu_connector {};

/* TODO: start to use this struct and remove same field from base one */
struct amdgpu_mst_connector {};

#define ENCODER_MODE_IS_DP(em)

/* Driver internal use only flags of amdgpu_display_get_crtc_scanoutpos() */
#define DRM_SCANOUTPOS_VALID
#define DRM_SCANOUTPOS_IN_VBLANK
#define DRM_SCANOUTPOS_ACCURATE
#define USE_REAL_VBLANKSTART
#define GET_DISTANCE_TO_VBLANKSTART

void amdgpu_link_encoder_connector(struct drm_device *dev);

struct drm_connector *
amdgpu_get_connector_for_encoder(struct drm_encoder *encoder);
struct drm_connector *
amdgpu_get_connector_for_encoder_init(struct drm_encoder *encoder);
bool amdgpu_dig_monitor_is_duallink(struct drm_encoder *encoder,
				    u32 pixel_clock);

u16 amdgpu_encoder_get_dp_bridge_encoder_id(struct drm_encoder *encoder);
struct drm_encoder *amdgpu_get_external_encoder(struct drm_encoder *encoder);

bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
			      bool use_aux);

void amdgpu_encoder_set_active_device(struct drm_encoder *encoder);

int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev,
			unsigned int pipe, unsigned int flags, int *vpos,
			int *hpos, ktime_t *stime, ktime_t *etime,
			const struct drm_display_mode *mode);

int amdgpufb_remove(struct drm_device *dev, struct drm_framebuffer *fb);

void amdgpu_enc_destroy(struct drm_encoder *encoder);
void amdgpu_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj);
bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
				const struct drm_display_mode *mode,
				struct drm_display_mode *adjusted_mode);
void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
			     struct drm_display_mode *adjusted_mode);
int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);

bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
			bool in_vblank_irq, int *vpos,
			int *hpos, ktime_t *stime, ktime_t *etime,
			const struct drm_display_mode *mode);

/* amdgpu_display.c */
void amdgpu_display_print_display_setup(struct drm_device *dev);
int amdgpu_display_modeset_create_props(struct amdgpu_device *adev);
int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
				   struct drm_modeset_acquire_ctx *ctx);
int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
				struct drm_framebuffer *fb,
				struct drm_pending_vblank_event *event,
				uint32_t page_flip_flags, uint32_t target,
				struct drm_modeset_acquire_ctx *ctx);
extern const struct drm_mode_config_funcs amdgpu_mode_funcs;

#endif