/*
*/
/*
* Copyright (c) 2006-2010, 2013, Intel Corporation
* Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
*
* 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>
* Dave Airlie <airlied@linux.ie>
* Jesse Barnes <jesse.barnes@intel.com>
* Chris Wilson <chris@chris-wilson.co.uk>
*/
#include "intel_drv.h"
void
struct drm_display_mode *adjusted_mode)
{
}
/* adjusted_mode has been preset to be the panel's fixed mode */
void
struct intel_crtc_config *pipe_config,
int fitting_mode)
{
/* Native modes don't need fitting */
goto done;
switch (fitting_mode) {
case DRM_MODE_SCALE_CENTER:
break;
case DRM_MODE_SCALE_ASPECT:
/* Scale but preserve the aspect ratio */
{
if (width & 1)
width++;
y = 0;
if (height & 1)
height++;
x = 0;
} else {
x = y = 0;
}
}
break;
x = y = 0;
break;
default:
return;
}
done:
}
static void
int width)
{
/* keep the hsync and hblank widths constant */
}
static void
int height)
{
/* keep the vsync and vblank widths constant */
}
{
/*
* Floating point operation is not supported. So the FACTOR
* is defined, which can avoid the floating point computation
* when calculating the panel ratio.
*/
}
struct intel_crtc_config *pipe_config,
int fitting_mode)
{
/* Native modes don't need fitting */
goto out;
pipe_config->timings_set = true;
switch (fitting_mode) {
case DRM_MODE_SCALE_CENTER:
/*
* For centered modes, we have to calculate border widths &
* heights and modify the values programmed into the CRTC.
*/
break;
case DRM_MODE_SCALE_ASPECT:
/* Scale but preserve the aspect ratio */
/* 965+ is easy, it does everything in hw */
if (scaled_width > scaled_height)
pfit_control |= PFIT_ENABLE |
else if (scaled_width < scaled_height)
pfit_control |= PFIT_ENABLE |
} else {
/*
* For earlier chips we have to calculate the scaling
* ratio by hand and program it into the
* PFIT_PGM_RATIO register
*/
pfit_control |= (PFIT_ENABLE |
}
pfit_control |= (PFIT_ENABLE |
}
} else {
/* Aspects match, Let hw scale both directions */
pfit_control |= (PFIT_ENABLE |
}
}
break;
/*
* Full scaling, even if it changes the aspect ratio.
* Fortunately this is all done for us in hw.
*/
else
pfit_control |= (VERT_AUTO_SCALE |
}
break;
default:
return;
}
/* 965+ wants fuzzy fitting */
/* FIXME: handle multiple panels by failing gracefully */
out:
if ((pfit_control & PFIT_ENABLE) == 0) {
pfit_control = 0;
pfit_pgm_ratios = 0;
}
/* Make sure pre-965 set dither correctly for 18bpp panels. */
}
{
return 0;
}
{
/* Restore the CTL value if it lost, e.g. GPU reset */
} else if (val == 0) {
}
} else {
} else if (val == 0) {
}
}
return val;
}
{
if (HAS_PCH_SPLIT(dev)) {
max >>= 16;
} else {
max >>= 17;
else
max >>= 16;
max *= 0xff;
}
return max;
}
static int i915_panel_invert_brightness;
{
if (i915_panel_invert_brightness < 0)
return val;
if (i915_panel_invert_brightness > 0 ||
if (max)
}
return val;
}
{
unsigned long flags;
if (HAS_PCH_SPLIT(dev)) {
} else {
val >>= 1;
if (is_backlight_combination_mode(dev)){
}
}
return val;
}
{
}
{
if (HAS_PCH_SPLIT(dev)) {
return;
}
if (is_backlight_combination_mode(dev)){
/* we're screwed, but keep behaviour backwards compatible */
if (!max)
max = 1;
}
level <<= 1;
}
/* set backlight brightness to level in range [0..max] */
{
unsigned long flags;
if (!freq) {
/* we are screwed, bail out */
goto out;
}
/* scale to hardware, but be careful to not overflow */
else
// if (dev_priv->backlight.device)
// dev_priv->backlight.device->props.brightness = level;
out:
}
{
unsigned long flags;
/*
* Do not disable backlight on the vgaswitcheroo path. When switching
* away from i915, the other client may depend on i915 to handle the
* backlight. This will leave the backlight on unnecessarily when
* another client is not activated.
*/
DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n");
return;
}
if (HAS_PCH_SPLIT(dev)) {
tmp &= ~BLM_PCH_PWM_ENABLE;
}
}
}
{
unsigned long flags;
// if (dev_priv->backlight.device)
// dev_priv->backlight.device->props.brightness =
// dev_priv->backlight.level;
}
/* Note that this can also get called through dpms changes. And
* we don't track the backlight dpms state, hence check whether
* we have to do anything first. */
if (tmp & BLM_PWM_ENABLE)
goto set_level;
tmp &= ~BLM_PIPE_SELECT_IVB;
else
tmp &= ~BLM_PIPE_SELECT;
if (cpu_transcoder == TRANSCODER_EDP)
else
tmp &= ~BLM_PWM_ENABLE;
if (HAS_PCH_SPLIT(dev) &&
}
}
/* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1.
* BLC_PWM_CPU_CTL may be cleared to zero automatically when these
* registers are set.
*/
}
{
}
enum drm_connector_status
{
#if 0
/* Assume that the BIOS does not lie through the OpRegion... */
return regs[0] & 0x1 ?
}
switch (i915_panel_ignore_lid) {
case -2:
return connector_status_connected;
case -1:
return connector_status_disconnected;
default:
return connector_status_unknown;
}
#endif
return connector_status_unknown;
}
{
return 0;
}
{
return intel_panel_get_backlight(dev);
}
};
{
unsigned long flags;
return -ENODEV;
if (props.max_brightness == 0) {
DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n");
return -ENODEV;
}
backlight_device_register("intel_backlight",
&intel_panel_bl_ops, &props);
DRM_ERROR("Failed to register backlight: %ld\n",
return -ENODEV;
}
return 0;
}
{
}
}
#else
{
return 0;
}
{
return;
}
#endif
struct drm_display_mode *fixed_mode)
{
return 0;
}
{
if (panel->fixed_mode)
}