1450N/A * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 1450N/A * Copyright (c) 2006-2010, 2013, Intel Corporation 1450N/A * Copyright (c) 2006 Dave Airlie <airlied@linux.ie> 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 * 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 * 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 1450N/A * DEALINGS IN THE SOFTWARE. 1450N/A * Eric Anholt <eric@anholt.net> 1450N/A * Dave Airlie <airlied@linux.ie> 1450N/A * Jesse Barnes <jesse.barnes@intel.com> 1450N/A * Chris Wilson <chris@chris-wilson.co.uk> 1450N/A/* adjusted_mode has been preset to be the panel's fixed mode */ 1450N/A /* Native modes don't need fitting */ 1450N/A /* Scale but preserve the aspect ratio */ 1450N/A /* keep the hsync and hblank widths constant */ 1450N/A /* keep the vsync and vblank widths constant */ 1450N/A * Floating point operation is not supported. So the FACTOR 1450N/A * is defined, which can avoid the floating point computation 1450N/A * when calculating the panel ratio. 1450N/A /* Native modes don't need fitting */ 1450N/A * For centered modes, we have to calculate border widths & 1450N/A * heights and modify the values programmed into the CRTC. 1450N/A /* Scale but preserve the aspect ratio */ 1450N/A /* 965+ is easy, it does everything in hw */ 1450N/A * For earlier chips we have to calculate the scaling 1450N/A * ratio by hand and program it into the 1450N/A /* Aspects match, Let hw scale both directions */ 1450N/A * Full scaling, even if it changes the aspect ratio. 1450N/A * Fortunately this is all done for us in hw. 1450N/A /* 965+ wants fuzzy fitting */ 1450N/A /* FIXME: handle multiple panels by failing gracefully */ 1450N/A /* Make sure pre-965 set dither correctly for 18bpp panels. */ 1450N/A /* Restore the CTL value if it lost, e.g. GPU reset */ 1450N/A /* we're screwed, but keep behaviour backwards compatible */ 1450N/A/* set backlight brightness to level in range [0..max] */ 1450N/A /* we are screwed, bail out */ 1450N/A /* scale to hardware, but be careful to not overflow */ 1450N/A// if (dev_priv->backlight.device) 1450N/A// dev_priv->backlight.device->props.brightness = level; 1450N/A * Do not disable backlight on the vgaswitcheroo path. When switching 1450N/A * away from i915, the other client may depend on i915 to handle the 1450N/A * backlight. This will leave the backlight on unnecessarily when 1450N/A * another client is not activated. 1450N/A// if (dev_priv->backlight.device) 1450N/A// dev_priv->backlight.device->props.brightness = 1450N/A// dev_priv->backlight.level; 1450N/A /* Note that this can also get called through dpms changes. And 1450N/A * we don't track the backlight dpms state, hence check whether 1450N/A * we have to do anything first. */ 1450N/A /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1. 1450N/A * BLC_PWM_CPU_CTL may be cleared to zero automatically when these 1450N/A /* Assume that the BIOS does not lie through the OpRegion... */