1450N/A/*
1450N/A * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1450N/A */
1450N/A
1450N/A/*
1450N/A * Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
1450N/A * Copyright (c) 2007-2008, 2013, Intel Corporation
1450N/A * Jesse Barnes <jesse.barnes@intel.com>
1450N/A *
1450N/A * Permission is hereby granted, free of charge, to any person obtaining a
1450N/A * copy of this software and associated documentation files (the "Software"),
1450N/A * to deal in the Software without restriction, including without limitation
1450N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1450N/A * and/or sell copies of the Software, and to permit persons to whom the
1450N/A * Software is furnished to do so, subject to the following conditions:
1450N/A *
1450N/A * The above copyright notice and this permission notice (including the next
1450N/A * paragraph) shall be included in all copies or substantial portions of the
1450N/A * Software.
1450N/A *
1450N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1450N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1450N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1450N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1450N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1450N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1450N/A * IN THE SOFTWARE.
1450N/A */
1450N/A#ifndef __INTEL_DRV_H__
1450N/A#define __INTEL_DRV_H__
1450N/A
1450N/A#include "i915_drv.h"
1450N/A#include "i915_drm.h"
1450N/A#include "drm_crtc.h"
1450N/A#include "drm_sun_i2c.h" /* OSOL_i915 */
1450N/A#include "drm_crtc_helper.h"
1450N/A#include "drm_fb_helper.h"
1450N/A#include "drm_dp_helper.h"
1450N/A
1450N/A#define MSLEEP(x) do { \
1450N/A if (in_dbg_master()) \
1450N/A mdelay(x); \
1450N/A else \
1450N/A msleep(x); \
1450N/A} while(0)
1450N/A
1450N/A#define KHz(x) (1000*x)
1450N/A#define MHz(x) KHz(1000*x)
1450N/A
1450N/A/*
1450N/A * Display related stuff
1450N/A */
1450N/A
1450N/A/* store information about an Ixxx DVO */
1450N/A/* The i830->i865 use multiple DVOs with multiple i2cs */
1450N/A/* the i915, i945 have a single sDVO i2c bus - which is different */
1450N/A#define MAX_OUTPUTS 6
1450N/A/* maximum connectors per crtcs in the mode set */
1450N/A#define INTELFB_CONN_LIMIT 4
1450N/A
1450N/A#define INTEL_I2C_BUS_DVO 1
1450N/A#define INTEL_I2C_BUS_SDVO 2
1450N/A
1450N/A/* these are outputs from the chip - integrated only
1450N/A external chips are via DVO or SDVO output */
1450N/A#define INTEL_OUTPUT_UNUSED 0
1450N/A#define INTEL_OUTPUT_ANALOG 1
1450N/A#define INTEL_OUTPUT_DVO 2
1450N/A#define INTEL_OUTPUT_SDVO 3
1450N/A#define INTEL_OUTPUT_LVDS 4
1450N/A#define INTEL_OUTPUT_TVOUT 5
1450N/A#define INTEL_OUTPUT_HDMI 6
1450N/A#define INTEL_OUTPUT_DISPLAYPORT 7
1450N/A#define INTEL_OUTPUT_EDP 8
1450N/A#define INTEL_OUTPUT_UNKNOWN 9
1450N/A
1450N/A#define INTEL_DVO_CHIP_NONE 0
1450N/A#define INTEL_DVO_CHIP_LVDS 1
1450N/A#define INTEL_DVO_CHIP_TMDS 2
1450N/A#define INTEL_DVO_CHIP_TVOUT 4
1450N/A
1450N/Astruct intel_framebuffer {
1450N/A struct drm_framebuffer base;
1450N/A struct drm_i915_gem_object *obj;
1450N/A};
1450N/A
1450N/Astruct intel_fbdev {
1450N/A struct drm_fb_helper helper;
1450N/A struct intel_framebuffer ifb;
1450N/A struct list_head fbdev_list;
1450N/A struct drm_display_mode *our_mode;
1450N/A};
1450N/A
1450N/Astruct intel_encoder {
1450N/A struct drm_encoder base;
1450N/A /*
1450N/A * The new crtc this encoder will be driven from. Only differs from
1450N/A * base->crtc while a modeset is in progress.
1450N/A */
1450N/A struct intel_crtc *new_crtc;
1450N/A
1450N/A int type;
1450N/A int type_size;
1450N/A /*
1450N/A * Intel hw has only one MUX where encoders could be clone, hence a
1450N/A * simple flag is enough to compute the possible_clones mask.
1450N/A */
1450N/A bool cloneable;
1450N/A bool connectors_active;
1450N/A void (*hot_plug)(struct intel_encoder *);
1450N/A bool (*compute_config)(struct intel_encoder *,
1450N/A struct intel_crtc_config *);
1450N/A void (*pre_pll_enable)(struct intel_encoder *);
1450N/A void (*pre_enable)(struct intel_encoder *);
1450N/A void (*enable)(struct intel_encoder *);
1450N/A void (*mode_set)(struct intel_encoder *intel_encoder);
1450N/A void (*disable)(struct intel_encoder *);
1450N/A void (*post_disable)(struct intel_encoder *);
1450N/A /* Read out the current hw state of this connector, returning true if
1450N/A * the encoder is active. If the encoder is enabled it also set the pipe
1450N/A * it is connected to in the pipe parameter. */
1450N/A bool (*get_hw_state)(struct intel_encoder *, enum pipe *pipe);
1450N/A /* Reconstructs the equivalent mode flags for the current hardware
1450N/A * state. This must be called _after_ display->get_pipe_config has
1450N/A * pre-filled the pipe config. Note that intel_encoder->base.crtc must
1450N/A * be set correctly before calling this function. */
1450N/A void (*get_config)(struct intel_encoder *,
1450N/A struct intel_crtc_config *pipe_config);
1450N/A int crtc_mask;
1450N/A enum hpd_pin hpd_pin;
1450N/A};
1450N/A
1450N/Astruct intel_panel {
1450N/A struct drm_display_mode *fixed_mode;
1450N/A int fitting_mode;
1450N/A};
1450N/A
1450N/Astruct intel_connector {
1450N/A struct drm_connector base;
1450N/A /*
1450N/A * The fixed encoder this connector is connected to.
1450N/A */
1450N/A struct intel_encoder *encoder;
1450N/A
1450N/A /*
1450N/A * The new encoder this connector will be driven. Only differs from
1450N/A * encoder while a modeset is in progress.
1450N/A */
1450N/A struct intel_encoder *new_encoder;
1450N/A
1450N/A /* Reads out the current hw, returning true if the connector is enabled
1450N/A * and active (i.e. dpms ON state). */
1450N/A bool (*get_hw_state)(struct intel_connector *);
1450N/A
1450N/A /* Panel info for eDP and LVDS */
1450N/A struct intel_panel panel;
1450N/A
1450N/A /* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */
1450N/A struct edid *edid;
1450N/A
1450N/A /* since POLL and HPD connectors may use the same HPD line keep the native
1450N/A state of connector->polled in case hotplug storm detection changes it */
1450N/A u8 polled;
1450N/A};
1450N/A
1450N/Atypedef struct dpll {
1450N/A /* given values */
1450N/A int n;
1450N/A int m1, m2;
1450N/A int p1, p2;
1450N/A /* derived values */
1450N/A int dot;
1450N/A int vco;
1450N/A int m;
1450N/A int p;
1450N/A} intel_clock_t;
1450N/A
1450N/Astruct intel_crtc_config {
1450N/A /**
1450N/A * quirks - bitfield with hw state readout quirks
1450N/A *
1450N/A * For various reasons the hw state readout code might not be able to
1450N/A * completely faithfully read out the current state. These cases are
1450N/A * tracked with quirk flags so that fastboot and state checker can act
1450N/A * accordingly.
1450N/A */
1450N/A#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
1450N/A unsigned long quirks;
1450N/A
1450N/A struct drm_display_mode requested_mode;
1450N/A struct drm_display_mode adjusted_mode;
1450N/A /* This flag must be set by the encoder's compute_config callback if it
1450N/A * changes the crtc timings in the mode to prevent the crtc fixup from
1450N/A * overwriting them. Currently only lvds needs that. */
1450N/A bool timings_set;
1450N/A /* Whether to set up the PCH/FDI. Note that we never allow sharing
1450N/A * between pch encoders and cpu encoders. */
1450N/A bool has_pch_encoder;
1450N/A
1450N/A /* CPU Transcoder for the pipe. Currently this can only differ from the
1450N/A * pipe on Haswell (where we have a special eDP transcoder). */
1450N/A enum transcoder cpu_transcoder;
1450N/A
1450N/A /*
1450N/A * Use reduced/limited/broadcast rbg range, compressing from the full
1450N/A * range fed into the crtcs.
1450N/A */
1450N/A bool limited_color_range;
1450N/A
1450N/A /* DP has a bunch of special case unfortunately, so mark the pipe
1450N/A * accordingly. */
1450N/A bool has_dp_encoder;
1450N/A
1450N/A /*
1450N/A * Enable dithering, used when the selected pipe bpp doesn't match the
1450N/A * plane bpp.
1450N/A */
1450N/A bool dither;
1450N/A
1450N/A /* Controls for the clock computation, to override various stages. */
1450N/A bool clock_set;
1450N/A
1450N/A /* SDVO TV has a bunch of special case. To make multifunction encoders
1450N/A * work correctly, we need to track this at runtime.*/
1450N/A bool sdvo_tv_clock;
1450N/A
1450N/A /*
1450N/A * crtc bandwidth limit, don't increase pipe bpp or clock if not really
1450N/A * required. This is set in the 2nd loop of calling encoder's
1450N/A * ->compute_config if the first pick doesn't work out.
1450N/A */
1450N/A bool bw_constrained;
1450N/A
1450N/A /* Settings for the intel dpll used on pretty much everything but
1450N/A * haswell. */
1450N/A struct dpll dpll;
1450N/A
1450N/A /* Selected dpll when shared or DPLL_ID_PRIVATE. */
1450N/A enum intel_dpll_id shared_dpll;
1450N/A
1450N/A /* Actual register state of the dpll, for shared dpll cross-checking. */
1450N/A struct intel_dpll_hw_state dpll_hw_state;
1450N/A
1450N/A int pipe_bpp;
1450N/A struct intel_link_m_n dp_m_n;
1450N/A
1450N/A /*
1450N/A * Frequence the dpll for the port should run at. Differs from the
1450N/A * adjusted dotclock e.g. for DP or 12bpc hdmi mode.
1450N/A */
1450N/A int port_clock;
1450N/A
1450N/A /* Used by SDVO (and if we ever fix it, HDMI). */
1450N/A unsigned pixel_multiplier;
1450N/A
1450N/A /* Panel fitter controls for gen2-gen4 + VLV */
1450N/A struct {
1450N/A u32 control;
1450N/A u32 pgm_ratios;
1450N/A u32 lvds_border_bits;
1450N/A } gmch_pfit;
1450N/A
1450N/A /* Panel fitter placement and size for Ironlake+ */
1450N/A struct {
1450N/A u32 pos;
1450N/A u32 size;
1450N/A } pch_pfit;
1450N/A
1450N/A /* FDI configuration, only valid if has_pch_encoder is set. */
1450N/A int fdi_lanes;
1450N/A struct intel_link_m_n fdi_m_n;
1450N/A
1450N/A bool ips_enabled;
1450N/A};
1450N/Astruct intel_crtc {
1450N/A struct drm_crtc base;
1450N/A enum pipe pipe;
1450N/A enum plane plane;
1450N/A u8 lut_r[256], lut_g[256], lut_b[256];
1450N/A /*
1450N/A * Whether the crtc and the connected output pipeline is active. Implies
1450N/A * that crtc->enabled is set, i.e. the current mode configuration has
1450N/A * some outputs connected to this crtc.
1450N/A */
1450N/A bool active;
1450N/A bool eld_vld;
1450N/A bool primary_disabled; /* is the crtc obscured by a plane? */
1450N/A bool lowfreq_avail;
1450N/A struct intel_overlay *overlay;
1450N/A struct intel_unpin_work *unpin_work;
1450N/A
1450N/A atomic_t unpin_work_count;
1450N/A
1450N/A /* Display surface base address adjustement for pageflips. Note that on
1450N/A * gen4+ this only adjusts up to a tile, offsets within a tile are
1450N/A * handled in the hw itself (with the TILEOFF register). */
1450N/A unsigned long dspaddr_offset;
1450N/A
1450N/A struct drm_i915_gem_object *cursor_bo;
1450N/A uint32_t cursor_addr;
1450N/A int16_t cursor_x, cursor_y;
1450N/A int16_t cursor_width, cursor_height;
1450N/A bool cursor_visible;
1450N/A
1450N/A struct intel_crtc_config config;
1450N/A
1450N/A uint32_t ddi_pll_sel;
1450N/A
1450N/A /* reset counter value when the last flip was submitted */
1450N/A unsigned int reset_counter;
1450N/A
1450N/A /* Access to these should be protected by dev_priv->irq_lock. */
1450N/A bool cpu_fifo_underrun_disabled;
1450N/A bool pch_fifo_underrun_disabled;
1450N/A};
1450N/A
1450N/Astruct intel_plane {
1450N/A struct drm_plane base;
1450N/A int plane;
1450N/A enum pipe pipe;
1450N/A struct drm_i915_gem_object *obj;
1450N/A bool can_scale;
1450N/A int max_downscale;
1450N/A u32 lut_r[1024], lut_g[1024], lut_b[1024];
1450N/A int crtc_x, crtc_y;
1450N/A unsigned int crtc_w, crtc_h;
1450N/A uint32_t src_x, src_y;
1450N/A uint32_t src_w, src_h;
1450N/A
1450N/A /* Since we need to change the watermarks before/after
1450N/A * enabling/disabling the planes, we need to store the parameters here
1450N/A * as the other pieces of the struct may not reflect the values we want
1450N/A * for the watermark calculations. Currently only Haswell uses this.
1450N/A */
1450N/A struct {
1450N/A bool enable;
1450N/A uint8_t bytes_per_pixel;
1450N/A uint32_t horiz_pixels;
1450N/A } wm;
1450N/A
1450N/A void (*update_plane)(struct drm_plane *plane,
1450N/A struct drm_framebuffer *fb,
1450N/A struct drm_i915_gem_object *obj,
1450N/A int crtc_x, int crtc_y,
1450N/A unsigned int crtc_w, unsigned int crtc_h,
1450N/A int x, int y,
1450N/A uint32_t src_w, uint32_t src_h);
1450N/A void (*disable_plane)(struct drm_plane *plane);
1450N/A int (*update_colorkey)(struct drm_plane *plane,
1450N/A struct drm_intel_sprite_colorkey *key);
1450N/A void (*get_colorkey)(struct drm_plane *plane,
1450N/A struct drm_intel_sprite_colorkey *key);
1450N/A};
1450N/A
1450N/Astruct intel_watermark_params {
1450N/A unsigned long fifo_size;
1450N/A unsigned long max_wm;
1450N/A unsigned long default_wm;
1450N/A unsigned long guard_size;
1450N/A unsigned long cacheline_size;
1450N/A};
1450N/A
1450N/Astruct cxsr_latency {
1450N/A int is_desktop;
1450N/A int is_ddr3;
1450N/A unsigned long fsb_freq;
1450N/A unsigned long mem_freq;
1450N/A unsigned long display_sr;
1450N/A unsigned long display_hpll_disable;
1450N/A unsigned long cursor_sr;
1450N/A unsigned long cursor_hpll_disable;
1450N/A};
1450N/A
1450N/A#define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
1450N/A#define to_intel_connector(x) container_of(x, struct intel_connector, base)
1450N/A#define to_intel_encoder(x) container_of(x, struct intel_encoder, base)
1450N/A#define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
1450N/A#define to_intel_plane(x) container_of(x, struct intel_plane, base)
1450N/A
1450N/A#define DIP_HEADER_SIZE 5
1450N/A
1450N/A#define DIP_TYPE_AVI 0x82
1450N/A#define DIP_VERSION_AVI 0x2
1450N/A#define DIP_LEN_AVI 13
1450N/A#define DIP_AVI_PR_1 0
1450N/A#define DIP_AVI_PR_2 1
1450N/A#define DIP_AVI_RGB_QUANT_RANGE_DEFAULT (0 << 2)
1450N/A#define DIP_AVI_RGB_QUANT_RANGE_LIMITED (1 << 2)
1450N/A#define DIP_AVI_RGB_QUANT_RANGE_FULL (2 << 2)
1450N/A
1450N/A#define DIP_TYPE_SPD 0x83
1450N/A#define DIP_VERSION_SPD 0x1
1450N/A#define DIP_LEN_SPD 25
1450N/A#define DIP_SPD_UNKNOWN 0
1450N/A#define DIP_SPD_DSTB 0x1
1450N/A#define DIP_SPD_DVDP 0x2
1450N/A#define DIP_SPD_DVHS 0x3
1450N/A#define DIP_SPD_HDDVR 0x4
1450N/A#define DIP_SPD_DVC 0x5
1450N/A#define DIP_SPD_DSC 0x6
1450N/A#define DIP_SPD_VCD 0x7
1450N/A#define DIP_SPD_GAME 0x8
1450N/A#define DIP_SPD_PC 0x9
1450N/A#define DIP_SPD_BD 0xa
1450N/A#define DIP_SPD_SCD 0xb
1450N/A
1450N/Astruct dip_infoframe {
1450N/A uint8_t type; /* HB0 */
1450N/A uint8_t ver; /* HB1 */
1450N/A uint8_t len; /* HB2 - body len, not including checksum */
1450N/A uint8_t ecc; /* Header ECC */
1450N/A uint8_t checksum; /* PB0 */
1450N/A union {
1450N/A struct {
1450N/A /* PB1 - Y 6:5, A 4:4, B 3:2, S 1:0 */
1450N/A uint8_t Y_A_B_S;
1450N/A /* PB2 - C 7:6, M 5:4, R 3:0 */
1450N/A uint8_t C_M_R;
1450N/A /* PB3 - ITC 7:7, EC 6:4, Q 3:2, SC 1:0 */
1450N/A uint8_t ITC_EC_Q_SC;
1450N/A /* PB4 - VIC 6:0 */
1450N/A uint8_t VIC;
1450N/A /* PB5 - PR 3:0 */
1450N/A uint8_t YQ_CN_PR;
1450N/A /* PB6 to PB13 */
1450N/A uint16_t top_bar_end;
1450N/A uint16_t bottom_bar_start;
1450N/A uint16_t left_bar_end;
1450N/A uint16_t right_bar_start;
1450N/A } avi;
1450N/A struct {
1450N/A uint8_t vn[8];
1450N/A uint8_t pd[16];
1450N/A uint8_t sdi;
1450N/A } spd;
1450N/A uint8_t payload[27];
1450N/A } __attribute__ ((packed)) body;
1450N/A} __attribute__((packed));
1450N/A
1450N/Astruct intel_hdmi {
1450N/A u32 hdmi_reg;
1450N/A int ddc_bus;
1450N/A uint32_t color_range;
1450N/A bool color_range_auto;
1450N/A bool has_hdmi_sink;
1450N/A bool has_audio;
1450N/A enum hdmi_force_audio force_audio;
1450N/A bool rgb_quant_range_selectable;
1450N/A void (*write_infoframe)(struct drm_encoder *encoder,
1450N/A struct dip_infoframe *frame);
1450N/A void (*set_infoframes)(struct drm_encoder *encoder,
1450N/A struct drm_display_mode *adjusted_mode);
1450N/A};
1450N/A
1450N/A#define DP_MAX_DOWNSTREAM_PORTS 0x10
1450N/A#define DP_LINK_CONFIGURATION_SIZE 9
1450N/A
1450N/Astruct intel_dp {
1450N/A uint32_t output_reg;
1450N/A uint32_t aux_ch_ctl_reg;
1450N/A uint32_t DP;
1450N/A uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE];
1450N/A bool has_audio;
1450N/A enum hdmi_force_audio force_audio;
1450N/A uint32_t color_range;
1450N/A bool color_range_auto;
1450N/A uint8_t link_bw;
1450N/A uint8_t lane_count;
1450N/A uint8_t dpcd[DP_RECEIVER_CAP_SIZE];
1450N/A uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
1450N/A struct i2c_adapter adapter;
1450N/A struct i2c_algo_dp_aux_data algo;
1450N/A uint8_t train_set[4];
1450N/A int panel_power_up_delay;
1450N/A int panel_power_down_delay;
1450N/A int panel_power_cycle_delay;
1450N/A int backlight_on_delay;
1450N/A int backlight_off_delay;
1450N/A timeout_id_t vdd_worktimer_id;
1450N/A bool want_panel_vdd;
1450N/A struct intel_connector *attached_connector;
1450N/A};
1450N/A
1450N/Astruct intel_digital_port {
1450N/A struct intel_encoder base;
1450N/A enum port port;
1450N/A u32 saved_port_bits;
1450N/A struct intel_dp dp;
1450N/A struct intel_hdmi hdmi;
1450N/A};
1450N/A
1450N/Astatic inline int
1450N/Avlv_dport_to_channel(struct intel_digital_port *dport)
1450N/A{
1450N/A switch (dport->port) {
1450N/A case PORT_B:
1450N/A return (0);
1450N/A case PORT_C:
1450N/A return (1);
1450N/A default:
1450N/A BUG();
1450N/A }
1450N/A return (0);
1450N/A}
1450N/A
1450N/Astatic inline struct drm_crtc *
1450N/Aintel_get_crtc_for_pipe(struct drm_device *dev, int pipe)
1450N/A{
1450N/A struct drm_i915_private *dev_priv = dev->dev_private;
1450N/A return dev_priv->pipe_to_crtc_mapping[pipe];
1450N/A}
1450N/A
1450N/Astatic inline struct drm_crtc *
1450N/Aintel_get_crtc_for_plane(struct drm_device *dev, int plane)
1450N/A{
1450N/A struct drm_i915_private *dev_priv = dev->dev_private;
1450N/A return dev_priv->plane_to_crtc_mapping[plane];
1450N/A}
1450N/A
1450N/Astruct intel_unpin_work {
1450N/A struct work_struct work;
1450N/A struct drm_crtc *crtc;
1450N/A struct drm_i915_gem_object *old_fb_obj;
1450N/A struct drm_i915_gem_object *pending_flip_obj;
1450N/A struct drm_pending_vblank_event *event;
1450N/A atomic_t pending;
1450N/A#define INTEL_FLIP_INACTIVE 0
1450N/A#define INTEL_FLIP_PENDING 1
1450N/A#define INTEL_FLIP_COMPLETE 2
1450N/A bool enable_stall_check;
1450N/A};
1450N/A
1450N/Astruct intel_fbc_work {
1450N/A struct work_struct work;
1450N/A struct drm_device *dev;
1450N/A struct drm_crtc *crtc;
1450N/A struct drm_framebuffer *fb;
1450N/A unsigned long interval;
1450N/A};
1450N/A
1450N/Aint intel_pch_rawclk(struct drm_device *dev);
1450N/A
1450N/Aint intel_connector_update_modes(struct drm_connector *connector,
1450N/A struct edid *edid);
1450N/Aint intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
1450N/A
1450N/Aextern void intel_attach_force_audio_property(struct drm_connector *connector);
1450N/Aextern void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
1450N/A
1450N/Aextern bool intel_pipe_has_type(struct drm_crtc *crtc, int type);
1450N/Aextern void intel_crt_init(struct drm_device *dev);
1450N/Aextern void intel_hdmi_init(struct drm_device *dev,
1450N/A int hdmi_reg, enum port port);
1450N/Aextern void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
1450N/A struct intel_connector *intel_connector);
1450N/Aextern struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
1450N/Aextern bool intel_hdmi_compute_config(struct intel_encoder *encoder,
1450N/A struct intel_crtc_config *pipe_config);
1450N/Aextern void intel_dip_infoframe_csum(struct dip_infoframe *avi_if);
1450N/Aextern bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg,
1450N/A bool is_sdvob);
1450N/Aextern void intel_dvo_init(struct drm_device *dev);
1450N/Aextern void intel_tv_init(struct drm_device *dev);
1450N/Aextern void intel_mark_busy(struct drm_device *dev);
1450N/Aextern void intel_mark_fb_busy(struct drm_i915_gem_object *obj,
1450N/A struct intel_ring_buffer *ring);
1450N/Aextern void intel_mark_idle(struct drm_device *dev);
1450N/Aextern void intel_lvds_init(struct drm_device *dev);
1450N/Aextern bool intel_is_dual_link_lvds(struct drm_device *dev);
1450N/Aextern void intel_dp_init(struct drm_device *dev, int output_reg,
1450N/A enum port port);
1450N/Aextern bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
1450N/A struct intel_connector *intel_connector);
1450N/Aextern void intel_dp_init_link_config(struct intel_dp *intel_dp);
1450N/Aextern void intel_dp_start_link_train(struct intel_dp *intel_dp);
1450N/Aextern void intel_dp_complete_link_train(struct intel_dp *intel_dp);
1450N/Aextern void intel_dp_stop_link_train(struct intel_dp *intel_dp);
1450N/Aextern void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
1450N/Aextern void intel_dp_encoder_destroy(struct drm_encoder *encoder);
1450N/Aextern void intel_dp_check_link_status(struct intel_dp *intel_dp);
1450N/Aextern bool intel_dp_compute_config(struct intel_encoder *encoder,
1450N/A struct intel_crtc_config *pipe_config);
1450N/Aextern bool intel_dpd_is_edp(struct drm_device *dev);
1450N/Aextern void ironlake_edp_backlight_on(struct intel_dp *intel_dp);
1450N/Aextern void ironlake_edp_backlight_off(struct intel_dp *intel_dp);
1450N/Aextern void ironlake_edp_panel_on(struct intel_dp *intel_dp);
1450N/Aextern void ironlake_edp_panel_off(struct intel_dp *intel_dp);
1450N/Aextern void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp);
1450N/Aextern void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
1450N/Aextern int intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane);
1450N/Aextern void intel_flush_display_plane(struct drm_i915_private *dev_priv,
1450N/A enum plane plane);
1450N/A
1450N/A/* intel_panel.c */
1450N/Aextern int intel_panel_init(struct intel_panel *panel,
1450N/A struct drm_display_mode *fixed_mode);
1450N/Aextern void intel_panel_fini(struct intel_panel *panel);
1450N/A
1450N/Aextern void intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
1450N/A struct drm_display_mode *adjusted_mode);
1450N/Aextern void intel_pch_panel_fitting(struct intel_crtc *crtc,
1450N/A struct intel_crtc_config *pipe_config,
1450N/A int fitting_mode);
1450N/Aextern void intel_gmch_panel_fitting(struct intel_crtc *crtc,
1450N/A struct intel_crtc_config *pipe_config,
1450N/A int fitting_mode);
1450N/Aextern void intel_panel_set_backlight(struct drm_device *dev,
1450N/A u32 level, u32 max);
1450N/Aextern int intel_panel_setup_backlight(struct drm_connector *connector);
1450N/Aextern void intel_panel_enable_backlight(struct drm_device *dev,
1450N/A enum pipe pipe);
1450N/Aextern void intel_panel_disable_backlight(struct drm_device *dev);
1450N/Aextern void intel_panel_destroy_backlight(struct drm_device *dev);
1450N/Aextern enum drm_connector_status intel_panel_detect(struct drm_device *dev);
1450N/A
1450N/Astruct intel_set_config {
1450N/A struct drm_encoder **save_connector_encoders;
1450N/A struct drm_crtc **save_encoder_crtcs;
1450N/A
1450N/A bool fb_changed;
1450N/A bool mode_changed;
1450N/A};
1450N/A
1450N/Aextern int intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
1450N/A int x, int y, struct drm_framebuffer *old_fb);
1450N/Aextern void intel_modeset_disable(struct drm_device *dev);
1450N/Aextern void intel_crtc_restore_mode(struct drm_crtc *crtc);
1450N/Aextern void intel_crtc_load_lut(struct drm_crtc *crtc);
1450N/Aextern void intel_crtc_update_dpms(struct drm_crtc *crtc);
1450N/Aextern void intel_encoder_destroy(struct drm_encoder *encoder);
1450N/Aextern void intel_encoder_dpms(struct intel_encoder *encoder, int mode);
1450N/Aextern void intel_connector_dpms(struct drm_connector *, int mode);
1450N/Aextern bool intel_connector_get_hw_state(struct intel_connector *connector);
1450N/Aextern void intel_modeset_check_state(struct drm_device *dev);
1450N/Aextern void intel_plane_restore(struct drm_plane *plane);
1450N/Aextern void intel_plane_disable(struct drm_plane *plane);
1450N/A
1450N/A
1450N/Astatic inline struct intel_encoder *intel_attached_encoder(struct drm_connector *connector)
1450N/A{
1450N/A return to_intel_connector(connector)->encoder;
1450N/A}
1450N/A
1450N/Astatic inline struct intel_digital_port *
1450N/Aenc_to_dig_port(struct drm_encoder *encoder)
1450N/A{
1450N/A return container_of(encoder, struct intel_digital_port, base.base);
1450N/A}
1450N/A
1450N/Astatic inline struct intel_dp *enc_to_intel_dp(struct drm_encoder *encoder)
1450N/A{
1450N/A return &enc_to_dig_port(encoder)->dp;
1450N/A}
1450N/A
1450N/Astatic inline struct intel_digital_port *
1450N/Adp_to_dig_port(struct intel_dp *intel_dp)
1450N/A{
1450N/A return container_of(intel_dp, struct intel_digital_port, dp);
1450N/A}
1450N/A
1450N/Astatic inline struct intel_digital_port *
1450N/Ahdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
1450N/A{
1450N/A return container_of(intel_hdmi, struct intel_digital_port, hdmi);
1450N/A}
1450N/A
1450N/Abool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
1450N/A struct intel_digital_port *port);
1450N/A
1450N/Aextern void intel_connector_attach_encoder(struct intel_connector *connector,
1450N/A struct intel_encoder *encoder);
1450N/Aextern struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
1450N/A
1450N/Aextern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
1450N/A struct drm_crtc *crtc);
1450N/Aint intel_get_pipe_from_crtc_id(DRM_IOCTL_ARGS);
1450N/Aextern enum transcoder
1450N/Aintel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
1450N/A enum pipe pipe);
1450N/Aextern void intel_wait_for_vblank(struct drm_device *dev, int pipe);
1450N/Aextern void intel_wait_for_pipe_off(struct drm_device *dev, int pipe);
1450N/Aextern int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
1450N/Aextern void vlv_wait_port_ready(struct drm_i915_private *dev_priv, int port);
1450N/A
1450N/Astruct intel_load_detect_pipe {
1450N/A struct drm_framebuffer *release_fb;
1450N/A bool load_detect_temp;
1450N/A int dpms_mode;
1450N/A};
1450N/Aextern bool intel_get_load_detect_pipe(struct drm_connector *connector,
1450N/A struct drm_display_mode *mode,
1450N/A struct intel_load_detect_pipe *old);
1450N/Aextern void intel_release_load_detect_pipe(struct drm_connector *connector,
1450N/A struct intel_load_detect_pipe *old);
1450N/A
1450N/Aextern void intelfb_restore(void);
1450N/Aextern void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
1450N/A u16 blue, int regno);
1450N/Aextern void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
1450N/A u16 *blue, int regno);
1450N/Aextern void intel_enable_clock_gating(struct drm_device *dev);
1450N/A
1450N/Aextern int intel_pin_and_fence_fb_obj(struct drm_device *dev,
1450N/A struct drm_i915_gem_object *obj,
1450N/A struct intel_ring_buffer *pipelined);
1450N/Aextern void intel_unpin_fb_obj(struct drm_i915_gem_object *obj);
1450N/A
1450N/Aextern int intel_framebuffer_init(struct drm_device *dev,
1450N/A struct intel_framebuffer *ifb,
1450N/A struct drm_mode_fb_cmd2 *mode_cmd,
1450N/A struct drm_i915_gem_object *obj);
1450N/Aextern int intel_fbdev_init(struct drm_device *dev);
1450N/Aextern void intel_fbdev_initial_config(struct drm_device *dev);
1450N/Aextern void intel_fbdev_fini(struct drm_device *dev);
1450N/Aextern void intel_fbdev_set_suspend(struct drm_device *dev, int state);
1450N/Aextern void intel_prepare_page_flip(struct drm_device *dev, int plane);
1450N/Aextern void intel_finish_page_flip(struct drm_device *dev, int pipe);
1450N/Aextern void intel_finish_page_flip_plane(struct drm_device *dev, int plane);
1450N/A
1450N/Aextern void intel_setup_overlay(struct drm_device *dev);
1450N/Aextern void intel_cleanup_overlay(struct drm_device *dev);
1450N/Aextern int intel_overlay_switch_off(struct intel_overlay *overlay);
1450N/Aextern int intel_overlay_put_image(DRM_IOCTL_ARGS);
1450N/Aextern int intel_overlay_attrs(DRM_IOCTL_ARGS);
1450N/A
1450N/Aextern void intel_fb_output_poll_changed(struct drm_device *dev);
1450N/Aextern void intel_fb_restore_mode(struct drm_device *dev);
1450N/A
1450N/Aextern void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,
1450N/A bool state);
1450N/A#define assert_pipe_enabled(d, p) assert_pipe(d, p, true)
1450N/A#define assert_pipe_disabled(d, p) assert_pipe(d, p, false)
1450N/A
1450N/Aextern void intel_init_clock_gating(struct drm_device *dev);
1450N/Aextern void intel_suspend_hw(struct drm_device *dev);
1450N/Aextern void intel_write_eld(struct drm_encoder *encoder,
1450N/A struct drm_display_mode *mode);
1450N/Aextern void intel_prepare_ddi(struct drm_device *dev);
1450N/Aextern void hsw_fdi_link_train(struct drm_crtc *crtc);
1450N/Aextern void intel_ddi_init(struct drm_device *dev, enum port port);
1450N/A
1450N/A/* For use by IVB LP watermark workaround in intel_sprite.c */
1450N/Aextern void intel_update_watermarks(struct drm_device *dev);
1450N/Aextern void intel_update_sprite_watermarks(struct drm_device *dev, int pipe,
1450N/A uint32_t sprite_width,
1450N/A int pixel_size, bool enable);
1450N/A
1450N/Aextern unsigned long intel_gen4_compute_page_offset(int *x, int *y,
1450N/A unsigned int tiling_mode,
1450N/A unsigned int bpp,
1450N/A unsigned int pitch);
1450N/A
1450N/Aextern int intel_sprite_set_colorkey(DRM_IOCTL_ARGS);
1450N/Aextern int intel_sprite_get_colorkey(DRM_IOCTL_ARGS);
1450N/A
1450N/A
1450N/A/* Power-related functions, located in intel_pm.c */
1450N/Aextern void intel_init_pm(struct drm_device *dev);
1450N/A/* FBC */
1450N/Aextern bool intel_fbc_enabled(struct drm_device *dev);
1450N/Aextern void intel_enable_fbc(struct drm_crtc *crtc, unsigned long interval);
1450N/Aextern void intel_update_fbc(struct drm_device *dev);
1450N/A/* IPS */
1450N/Aextern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
1450N/Aextern void intel_gpu_ips_teardown(void);
1450N/A
1450N/A/* Power well */
1450N/Aextern int i915_init_power_well(struct drm_device *dev);
1450N/Aextern void i915_remove_power_well(struct drm_device *dev);
1450N/A
1450N/Aextern bool intel_display_power_enabled(struct drm_device *dev,
1450N/A enum intel_display_power_domain domain);
1450N/Aextern void intel_init_power_well(struct drm_device *dev);
1450N/Aextern void intel_set_power_well(struct drm_device *dev, bool enable);
1450N/Aextern void intel_enable_gt_powersave(struct drm_device *dev);
1450N/Aextern void intel_disable_gt_powersave(struct drm_device *dev);
1450N/Aextern void gen6_gt_check_fifodbg(struct drm_i915_private *dev_priv);
1450N/Aextern void ironlake_teardown_rc6(struct drm_device *dev);
1450N/A
1450N/Aextern bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
1450N/A enum pipe *pipe);
1450N/Aextern int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv);
1450N/Aextern void intel_ddi_pll_init(struct drm_device *dev);
1450N/Aextern void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc);
1450N/Aextern void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
1450N/A enum transcoder cpu_transcoder);
1450N/Aextern void intel_ddi_enable_pipe_clock(struct intel_crtc *intel_crtc);
1450N/Aextern void intel_ddi_disable_pipe_clock(struct intel_crtc *intel_crtc);
1450N/Aextern void intel_ddi_setup_hw_pll_state(struct drm_device *dev);
1450N/Aextern bool intel_ddi_pll_mode_set(struct drm_crtc *crtc);
1450N/Aextern void intel_ddi_put_crtc_pll(struct drm_crtc *crtc);
1450N/Aextern void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
1450N/Aextern void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder);
1450N/Aextern bool
1450N/Aintel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
1450N/Aextern void intel_ddi_fdi_disable(struct drm_crtc *crtc);
1450N/A
1450N/Aextern void intel_display_handle_reset(struct drm_device *dev);
1450N/Aextern bool intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
1450N/A enum pipe pipe,
1450N/A bool enable);
1450N/Aextern bool intel_set_pch_fifo_underrun_reporting(struct drm_device *dev,
1450N/A enum transcoder pch_transcoder,
1450N/A bool enable);
1450N/A
1450N/A#endif /* __INTEL_DRV_H__ */