1494N/A * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 1494N/A * Copyright (c) 2006-2010, 2013, Intel Corporation 1494N/A * Copyright (c) 2006 Dave Airlie <airlied@linux.ie> 1494N/A * Permission is hereby granted, free of charge, to any person obtaining a 1494N/A * copy of this software and associated documentation files (the "Software"), 1494N/A * to deal in the Software without restriction, including without limitation 1494N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1494N/A * and/or sell copies of the Software, and to permit persons to whom the 1494N/A * Software is furnished to do so, subject to the following conditions: 1494N/A * The above copyright notice and this permission notice (including the next 1494N/A * paragraph) shall be included in all copies or substantial portions of the 1494N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1494N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1494N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1494N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1494N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1494N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 1494N/A * DEALINGS IN THE SOFTWARE. 1494N/A * Eric Anholt <eric@anholt.net> 1494N/A * Dave Airlie <airlied@linux.ie> 1494N/A * Jesse Barnes <jesse.barnes@intel.com> 1494N/A * Chris Wilson <chris@chris-wilson.co.uk> 1494N/A/* adjusted_mode has been preset to be the panel's fixed mode */ 1494N/A /* Native modes don't need fitting */ 1494N/A /* Scale but preserve the aspect ratio */ 1494N/A /* keep the hsync and hblank widths constant */ 1494N/A /* keep the vsync and vblank widths constant */ 1494N/A * Floating point operation is not supported. So the FACTOR 1494N/A * is defined, which can avoid the floating point computation 1494N/A * when calculating the panel ratio. 1494N/A /* Native modes don't need fitting */ 1494N/A * For centered modes, we have to calculate border widths & 1494N/A * heights and modify the values programmed into the CRTC. 1494N/A /* Scale but preserve the aspect ratio */ 1494N/A /* 965+ is easy, it does everything in hw */ 1494N/A * For earlier chips we have to calculate the scaling 1494N/A * ratio by hand and program it into the 1494N/A /* Aspects match, Let hw scale both directions */ 1494N/A * Full scaling, even if it changes the aspect ratio. 1494N/A * Fortunately this is all done for us in hw. 1494N/A /* 965+ wants fuzzy fitting */ 1494N/A /* FIXME: handle multiple panels by failing gracefully */ 1494N/A /* Make sure pre-965 set dither correctly for 18bpp panels. */ 1494N/A /* Restore the CTL value if it lost, e.g. GPU reset */ 1494N/A /* we're screwed, but keep behaviour backwards compatible */ 1494N/A/* set backlight brightness to level in range [0..max] */ 1494N/A /* we are screwed, bail out */ 1494N/A /* scale to hardware, but be careful to not overflow */ 1494N/A// if (dev_priv->backlight.device) 1494N/A// dev_priv->backlight.device->props.brightness = level; 1494N/A * Do not disable backlight on the vgaswitcheroo path. When switching 1494N/A * away from i915, the other client may depend on i915 to handle the 1494N/A * backlight. This will leave the backlight on unnecessarily when 1494N/A * another client is not activated. 1494N/A// if (dev_priv->backlight.device) 1494N/A// dev_priv->backlight.device->props.brightness = 1494N/A// dev_priv->backlight.level; 1494N/A /* Note that this can also get called through dpms changes. And 1494N/A * we don't track the backlight dpms state, hence check whether 1494N/A * we have to do anything first. */ 1494N/A /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1. 1494N/A * BLC_PWM_CPU_CTL may be cleared to zero automatically when these 1494N/A /* Assume that the BIOS does not lie through the OpRegion... */