intel_panel.c revision 1450
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * 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, * 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 (including the next * paragraph) shall be included in all copies or substantial portions of the * 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. * Eric Anholt <eric@anholt.net> * Dave Airlie <airlied@linux.ie> * Jesse Barnes <jesse.barnes@intel.com> * Chris Wilson <chris@chris-wilson.co.uk> /* adjusted_mode has been preset to be the panel's fixed mode */ /* Native modes don't need fitting */ /* Scale but preserve the aspect ratio */ /* keep the hsync and hblank widths constant */ /* 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. /* Native modes don't need fitting */ * For centered modes, we have to calculate border widths & * heights and modify the values programmed into the CRTC. /* Scale but preserve the aspect ratio */ /* 965+ is easy, it does everything in hw */ * For earlier chips we have to calculate the scaling * ratio by hand and program it into the * PFIT_PGM_RATIO register /* Aspects match, Let hw scale both directions */ * Full scaling, even if it changes the aspect ratio. * Fortunately this is all done for us in hw. /* 965+ wants fuzzy fitting */ /* FIXME: handle multiple panels by failing gracefully */ /* Make sure pre-965 set dither correctly for 18bpp panels. */ /* Restore the CTL value if it lost, e.g. GPU reset */ /* we're screwed, but keep behaviour backwards compatible */ /* set backlight brightness to level in range [0..max] */ /* we are screwed, bail out */ /* scale to hardware, but be careful to not overflow */ // if (dev_priv->backlight.device) // dev_priv->backlight.device->props.brightness = level; * 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. // 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. */ /* 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 /* Assume that the BIOS does not lie through the OpRegion... */ DRM_ERROR(
"Failed to register backlight: %ld\n",