/*
*/
/*
* Copyright 2006 Dave Airlie <airlied@linux.ie>
* Copyright (c) 2006-2007, 2013, Intel Corporation
*
* 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,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
*
* Authors:
* Eric Anholt <eric@anholt.net>
*/
#include "drmP.h"
#include "drm.h"
#include "drm_crtc.h"
#include "drm_sun_i2c.h" /* OSOL_i915 */
#include "intel_drv.h"
#include "i915_drm.h"
#include "i915_drv.h"
#include "dvo.h"
{
.name = "sil164",
.dev_ops = &sil164_ops,
},
{
.name = "ch7xxx",
.dev_ops = &ch7xxx_ops,
},
{
.name = "ch7xxx",
.dev_ops = &ch7xxx_ops,
},
{
.name = "ivch",
},
{
.name = "tfp410",
.dev_ops = &tfp410_ops,
},
{
.name = "ch7017",
.slave_addr = 0x75,
.gpio = GMBUS_PORT_DPB,
.dev_ops = &ch7017_ops,
},
{
.name = "ns2501",
.dev_ops = &ns2501_ops,
}
};
struct intel_dvo {
bool panel_wants_dither;
};
{
}
{
}
{
}
{
if (!(tmp & DVO_ENABLE))
return false;
return true;
}
struct intel_crtc_config *pipe_config)
{
if (tmp & DVO_HSYNC_ACTIVE_HIGH)
else
if (tmp & DVO_VSYNC_ACTIVE_HIGH)
else
}
{
}
{
}
{
/* dvo supports only 2 dpms states. */
if (mode != DRM_MODE_DPMS_ON)
return;
/* Only need to change hw state when actually enabled */
if (!crtc) {
return;
}
/* We call connector dpms manually below in case pipe dpms doesn't
* change due to cloning. */
if (mode == DRM_MODE_DPMS_ON) {
} else {
}
}
struct drm_display_mode *mode)
{
return MODE_NO_DBLESCAN;
/* XXX: Validate clock range */
if (intel_dvo->panel_fixed_mode) {
return MODE_PANEL;
return MODE_PANEL;
}
}
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
/* If we have timings from the BIOS for the panel, put them in
* to the adjusted mode. The CRTC will be set up for this mode,
* of the original mode.
*/
C(hdisplay);
C(hsync_start);
C(hsync_end);
C(htotal);
C(vdisplay);
C(vsync_start);
C(vsync_end);
C(vtotal);
C(clock);
#undef C
}
return true;
}
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
switch (dvo_reg) {
case DVOA:
default:
break;
case DVOB:
break;
case DVOC:
break;
}
/* Save the data order, since I don't know what it should be set to. */
if (pipe == 1)
/*I915_WRITE(DVOB_SRCDIM,
(adjusted_mode->hdisplay << DVO_SRCDIM_HORIZONTAL_SHIFT) |
(adjusted_mode->VDisplay << DVO_SRCDIM_VERTICAL_SHIFT));*/
/*I915_WRITE(DVOB, dvo_val);*/
}
/**
* Detect the output connection on our DVO device.
*
* Unimplemented.
*/
static enum drm_connector_status
{
}
{
/* We should probably have an i2c driver get_modes function for those
* devices which will have a fixed set of modes determined by the chip
* (TV-out, for example), but for now with just TMDS and LVDS,
* that's not the case.
*/
(void) intel_ddc_get_modes(connector,
return 1;
if (mode) {
return 1;
}
}
return 0;
}
{
}
};
.dpms = intel_dvo_dpms,
};
};
{
}
};
/**
* Attempts to get a fixed panel timing for LVDS (currently only the i830).
*
* Other chips with DVO LVDS will need to extend this to deal with the LVDS
* chip being on DVOB/C and having multiple pipes.
*/
static struct drm_display_mode *
{
/* If the DVO port is active, that'll be the LVDS, so we can pull out
* its timings to get how the BIOS set up the panel.
*/
if (dvo_val & DVO_ENABLE) {
if (crtc) {
if (mode) {
if (dvo_val & DVO_HSYNC_ACTIVE_HIGH)
if (dvo_val & DVO_VSYNC_ACTIVE_HIGH)
}
}
}
return mode;
}
{
int i;
if (!intel_dvo)
return;
if (!intel_connector) {
return;
}
/* Now, try to find a controller */
for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) {
int gpio;
/* Allow the I2C driver info to specify the GPIO to be used in
* special cases, but otherwise default to what's defined
* in the spec.
*/
else
/* Set up the I2C bus necessary for the chip we're probing.
* It appears that everything is on GPIOE except for panels
* on i830 laptops, which are on GPIOB (DVOA).
*/
continue;
case INTEL_DVO_CHIP_TMDS:
intel_encoder->cloneable = true;
break;
case INTEL_DVO_CHIP_LVDS:
intel_encoder->cloneable = false;
break;
}
connector->interlace_allowed = false;
connector->doublescan_allowed = false;
/* For our LVDS chipsets, we should hopefully be able
* to dig the fixed panel mode out of the BIOS data.
* However, it's in a different format from the BIOS
* data on chipsets with integrated LVDS (stored in AIM
* headers, likely), so for now, just get the current
* mode being output through DVO.
*/
intel_dvo->panel_wants_dither = true;
}
/* OSOL_i915: drm_sysfs_connector_add(connector); */
return;
}
}