cregit-Linux how code gets into the kernel

Release 4.7 drivers/gpu/drm/i915/intel_panel.c

/*
 * Copyright © 2006-2010 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
 * 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>
 */


#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/moduleparam.h>
#include <linux/pwm.h>
#include "intel_drv.h"


#define CRC_PMIC_PWM_PERIOD_NS	21333


void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode, struct drm_display_mode *adjusted_mode) { drm_mode_copy(adjusted_mode, fixed_mode); drm_mode_set_crtcinfo(adjusted_mode, 0); }

Contributors

PersonTokensPropCommitsCommitProp
chris wilsonchris wilson1860.00%133.33%
imre deakimre deak723.33%133.33%
ville syrjalaville syrjala516.67%133.33%
Total30100.00%3100.00%

/** * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID * @dev: drm device * @fixed_mode : panel native mode * @connector: LVDS/eDP connector * * Return downclock_avail * Find the reduced downclock for LVDS/eDP in EDID. */
struct drm_display_mode * intel_find_panel_downclock(struct drm_device *dev, struct drm_display_mode *fixed_mode, struct drm_connector *connector) { struct drm_display_mode *scan, *tmp_mode; int temp_downclock; temp_downclock = fixed_mode->clock; tmp_mode = NULL; list_for_each_entry(scan, &connector->probed_modes, head) { /* * If one mode has the same resolution with the fixed_panel * mode while they have the different refresh rate, it means * that the reduced downclock is found. In such * case we can set the different FPx0/1 to dynamically select * between low and high frequency. */ if (scan->hdisplay == fixed_mode->hdisplay && scan->hsync_start == fixed_mode->hsync_start && scan->hsync_end == fixed_mode->hsync_end && scan->htotal == fixed_mode->htotal && scan->vdisplay == fixed_mode->vdisplay && scan->vsync_start == fixed_mode->vsync_start && scan->vsync_end == fixed_mode->vsync_end && scan->vtotal == fixed_mode->vtotal) { if (scan->clock < temp_downclock) { /* * The downclock is already found. But we * expect to find the lower downclock. */ temp_downclock = scan->clock; tmp_mode = scan; } } } if (temp_downclock < fixed_mode->clock) return drm_mode_duplicate(dev, tmp_mode); else return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula163100.00%1100.00%
Total163100.00%1100.00%

/* adjusted_mode has been preset to be the panel's fixed mode */
void intel_pch_panel_fitting(struct intel_crtc *intel_crtc, struct intel_crtc_state *pipe_config, int fitting_mode) { const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; int x = 0, y = 0, width = 0, height = 0; /* Native modes don't need fitting */ if (adjusted_mode->crtc_hdisplay == pipe_config->pipe_src_w && adjusted_mode->crtc_vdisplay == pipe_config->pipe_src_h) goto done; switch (fitting_mode) { case DRM_MODE_SCALE_CENTER: width = pipe_config->pipe_src_w; height = pipe_config->pipe_src_h; x = (adjusted_mode->crtc_hdisplay - width + 1)/2; y = (adjusted_mode->crtc_vdisplay - height + 1)/2; break; case DRM_MODE_SCALE_ASPECT: /* Scale but preserve the aspect ratio */ { u32 scaled_width = adjusted_mode->crtc_hdisplay * pipe_config->pipe_src_h; u32 scaled_height = pipe_config->pipe_src_w * adjusted_mode->crtc_vdisplay; if (scaled_width > scaled_height) { /* pillar */ width = scaled_height / pipe_config->pipe_src_h; if (width & 1) width++; x = (adjusted_mode->crtc_hdisplay - width + 1) / 2; y = 0; height = adjusted_mode->crtc_vdisplay; } else if (scaled_width < scaled_height) { /* letter */ height = scaled_width / pipe_config->pipe_src_w; if (height & 1) height++; y = (adjusted_mode->crtc_vdisplay - height + 1) / 2; x = 0; width = adjusted_mode->crtc_hdisplay; } else { x = y = 0; width = adjusted_mode->crtc_hdisplay; height = adjusted_mode->crtc_vdisplay; } } break; case DRM_MODE_SCALE_FULLSCREEN: x = y = 0; width = adjusted_mode->crtc_hdisplay; height = adjusted_mode->crtc_vdisplay; break; default: WARN(1, "bad panel fit mode: %d\n", fitting_mode); return; } done: pipe_config->pch_pfit.pos = (x << 16) | y; pipe_config->pch_pfit.size = (width << 16) | height; pipe_config->pch_pfit.enabled = pipe_config->pch_pfit.size != 0; }

Contributors

PersonTokensPropCommitsCommitProp
chris wilsonchris wilson25172.13%220.00%
ville syrjalaville syrjala4512.93%330.00%
jesse barnesjesse barnes318.91%220.00%
adam jacksonadam jackson185.17%110.00%
ander conselvan de oliveiraander conselvan de oliveira30.86%220.00%
Total348100.00%10100.00%


static void centre_horizontally(struct drm_display_mode *adjusted_mode, int width) { u32 border, sync_pos, blank_width, sync_width; /* keep the hsync and hblank widths constant */ sync_width = adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start; blank_width = adjusted_mode->crtc_hblank_end - adjusted_mode->crtc_hblank_start; sync_pos = (blank_width - sync_width + 1) / 2; border = (adjusted_mode->crtc_hdisplay - width + 1) / 2; border += border & 1; /* make the border even */ adjusted_mode->crtc_hdisplay = width; adjusted_mode->crtc_hblank_start = width + border; adjusted_mode->crtc_hblank_end = adjusted_mode->crtc_hblank_start + blank_width; adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hblank_start + sync_pos; adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + sync_width; }

Contributors

PersonTokensPropCommitsCommitProp
jesse barnesjesse barnes10687.60%133.33%
ville syrjalaville syrjala1512.40%266.67%
Total121100.00%3100.00%


static void centre_vertically(struct drm_display_mode *adjusted_mode, int height) { u32 border, sync_pos, blank_width, sync_width; /* keep the vsync and vblank widths constant */ sync_width = adjusted_mode->crtc_vsync_end - adjusted_mode->crtc_vsync_start; blank_width = adjusted_mode->crtc_vblank_end - adjusted_mode->crtc_vblank_start; sync_pos = (blank_width - sync_width + 1) / 2; border = (adjusted_mode->crtc_vdisplay - height + 1) / 2; adjusted_mode->crtc_vdisplay = height; adjusted_mode->crtc_vblank_start = height + border; adjusted_mode->crtc_vblank_end = adjusted_mode->crtc_vblank_start + blank_width; adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vblank_start + sync_pos; adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + sync_width; }

Contributors

PersonTokensPropCommitsCommitProp
jesse barnesjesse barnes9986.84%133.33%
ville syrjalaville syrjala1513.16%266.67%
Total114100.00%3100.00%


static inline u32 panel_fitter_scaling(u32 source, u32 target) { /* * Floating point operation is not supported. So the FACTOR * is defined, which can avoid the floating point computation * when calculating the panel ratio. */ #define ACCURACY 12 #define FACTOR (1 << ACCURACY) u32 ratio = source * FACTOR / target; return (FACTOR * ratio + FACTOR/2) / FACTOR; }

Contributors

PersonTokensPropCommitsCommitProp
jesse barnesjesse barnes44100.00%1100.00%
Total44100.00%1100.00%


static void i965_scale_aspect(struct intel_crtc_state *pipe_config, u32 *pfit_control) { const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; u32 scaled_width = adjusted_mode->crtc_hdisplay * pipe_config->pipe_src_h; u32 scaled_height = pipe_config->pipe_src_w * adjusted_mode->crtc_vdisplay; /* 965+ is easy, it does everything in hw */ if (scaled_width > scaled_height) *pfit_control |= PFIT_ENABLE | PFIT_SCALING_PILLAR; else if (scaled_width < scaled_height) *pfit_control |= PFIT_ENABLE | PFIT_SCALING_LETTER; else if (adjusted_mode->crtc_hdisplay != pipe_config->pipe_src_w) *pfit_control |= PFIT_ENABLE | PFIT_SCALING_AUTO; }

Contributors

PersonTokensPropCommitsCommitProp
jesse barnesjesse barnes7376.04%114.29%
daniel vetterdaniel vetter1010.42%114.29%
ville syrjalaville syrjala1010.42%342.86%
ander conselvan de oliveiraander conselvan de oliveira33.12%228.57%
Total96100.00%7100.00%


static void i9xx_scale_aspect(struct intel_crtc_state *pipe_config, u32 *pfit_control, u32 *pfit_pgm_ratios, u32 *border) { struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; u32 scaled_width = adjusted_mode->crtc_hdisplay * pipe_config->pipe_src_h; u32 scaled_height = pipe_config->pipe_src_w * adjusted_mode->crtc_vdisplay; u32 bits; /* * For earlier chips we have to calculate the scaling * ratio by hand and program it into the * PFIT_PGM_RATIO register */ if (scaled_width > scaled_height) { /* pillar */ centre_horizontally(adjusted_mode, scaled_height / pipe_config->pipe_src_h); *border = LVDS_BORDER_ENABLE; if (pipe_config->pipe_src_h != adjusted_mode->crtc_vdisplay) { bits = panel_fitter_scaling(pipe_config->pipe_src_h, adjusted_mode->crtc_vdisplay); *pfit_pgm_ratios |= (bits << PFIT_HORIZ_SCALE_SHIFT | bits << PFIT_VERT_SCALE_SHIFT); *pfit_control |= (PFIT_ENABLE | VERT_INTERP_BILINEAR | HORIZ_INTERP_BILINEAR); } } else if (scaled_width < scaled_height) { /* letter */ centre_vertically(adjusted_mode, scaled_width / pipe_config->pipe_src_w); *border = LVDS_BORDER_ENABLE; if (pipe_config->pipe_src_w != adjusted_mode->crtc_hdisplay) { bits = panel_fitter_scaling(pipe_config->pipe_src_w, adjusted_mode->crtc_hdisplay); *pfit_pgm_ratios |= (bits << PFIT_HORIZ_SCALE_SHIFT | bits << PFIT_VERT_SCALE_SHIFT); *pfit_control |= (PFIT_ENABLE | VERT_INTERP_BILINEAR | HORIZ_INTERP_BILINEAR); } } else { /* Aspects match, Let hw scale both directions */ *pfit_control |= (PFIT_ENABLE | VERT_AUTO_SCALE | HORIZ_AUTO_SCALE | VERT_INTERP_BILINEAR | HORIZ_INTERP_BILINEAR); } }

Contributors

PersonTokensPropCommitsCommitProp
jesse barnesjesse barnes15969.43%116.67%
daniel vetterdaniel vetter4519.65%116.67%
ville syrjalaville syrjala229.61%233.33%
ander conselvan de oliveiraander conselvan de oliveira31.31%233.33%
Total229100.00%6100.00%


void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, struct intel_crtc_state *pipe_config, int fitting_mode) { struct drm_device *dev = intel_crtc->base.dev; u32 pfit_control = 0, pfit_pgm_ratios = 0, border = 0; struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; /* Native modes don't need fitting */ if (adjusted_mode->crtc_hdisplay == pipe_config->pipe_src_w && adjusted_mode->crtc_vdisplay == pipe_config->pipe_src_h) goto out; 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. */ centre_horizontally(adjusted_mode, pipe_config->pipe_src_w); centre_vertically(adjusted_mode, pipe_config->pipe_src_h); border = LVDS_BORDER_ENABLE; break; case DRM_MODE_SCALE_ASPECT: /* Scale but preserve the aspect ratio */ if (INTEL_INFO(dev)->gen >= 4) i965_scale_aspect(pipe_config, &pfit_control); else i9xx_scale_aspect(pipe_config, &pfit_control, &pfit_pgm_ratios, &border); break; case DRM_MODE_SCALE_FULLSCREEN: /* * Full scaling, even if it changes the aspect ratio. * Fortunately this is all done for us in hw. */ if (pipe_config->pipe_src_h != adjusted_mode->crtc_vdisplay || pipe_config->pipe_src_w != adjusted_mode->crtc_hdisplay) { pfit_control |= PFIT_ENABLE; if (INTEL_INFO(dev)->gen >= 4) pfit_control |= PFIT_SCALING_AUTO; else pfit_control |= (VERT_AUTO_SCALE | VERT_INTERP_BILINEAR | HORIZ_AUTO_SCALE | HORIZ_INTERP_BILINEAR); } break; default: WARN(1, "bad panel fit mode: %d\n", fitting_mode); return; } /* 965+ wants fuzzy fitting */ /* FIXME: handle multiple panels by failing gracefully */ if (INTEL_INFO(dev)->gen >= 4) pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) | PFIT_FILTER_FUZZY); out: if ((pfit_control & PFIT_ENABLE) == 0) { pfit_control = 0; pfit_pgm_ratios = 0; } /* Make sure pre-965 set dither correctly for 18bpp panels. */ if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18) pfit_control |= PANEL_8TO6_DITHER_ENABLE; pipe_config->gmch_pfit.control = pfit_control; pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios; pipe_config->gmch_pfit.lvds_border_bits = border; }

Contributors

PersonTokensPropCommitsCommitProp
daniel vetterdaniel vetter18559.49%433.33%
jesse barnesjesse barnes11336.33%325.00%
ville syrjalaville syrjala103.22%325.00%
ander conselvan de oliveiraander conselvan de oliveira30.96%216.67%
Total311100.00%12100.00%


enum drm_connector_status intel_panel_detect(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; /* Assume that the BIOS does not lie through the OpRegion... */ if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) { return *dev_priv->opregion.lid_state & 0x1 ? connector_status_connected : connector_status_disconnected; } switch (i915.panel_ignore_lid) { case -2: return connector_status_connected; case -1: return connector_status_disconnected; default: return connector_status_unknown; } }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula7598.68%150.00%
dan williamsdan williams11.32%150.00%
Total76100.00%2100.00%

/** * scale - scale values from one range to another * * @source_val: value in range [@source_min..@source_max] * * Return @source_val in range [@source_min..@source_max] scaled to range * [@target_min..@target_max]. */
static uint32_t scale(uint32_t source_val, uint32_t source_min, uint32_t source_max, uint32_t target_min, uint32_t target_max) { uint64_t target_val; WARN_ON(source_min > source_max); WARN_ON(target_min > target_max); /* defensive */ source_val = clamp(source_val, source_min, source_max); /* avoid overflows */ target_val = DIV_ROUND_CLOSEST_ULL((uint64_t)(source_val - source_min) * (target_max - target_min), source_max - source_min); target_val += target_min; return target_val; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula8097.56%150.00%
u. artie eoffu. artie eoff22.44%150.00%
Total82100.00%2100.00%

/* Scale user_level in range [0..user_max] to [hw_min..hw_max]. */
static inline u32 scale_user_to_hw(struct intel_connector *connector, u32 user_level, u32 user_max) { struct intel_panel *panel = &connector->panel; return scale(user_level, 0, user_max, panel->backlight.min, panel->backlight.max); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula50100.00%1100.00%
Total50100.00%1100.00%

/* Scale user_level in range [0..user_max] to [0..hw_max], clamping the result * to [hw_min..hw_max]. */
static inline u32 clamp_user_to_hw(struct intel_connector *connector, u32 user_level, u32 user_max) { struct intel_panel *panel = &connector->panel; u32 hw_level; hw_level = scale(user_level, 0, user_max, 0, panel->backlight.max); hw_level = clamp(hw_level, panel->backlight.min, panel->backlight.max); return hw_level; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula72100.00%1100.00%
Total72100.00%1100.00%

/* Scale hw_level in range [hw_min..hw_max] to [0..user_max]. */
static inline u32 scale_hw_to_user(struct intel_connector *connector, u32 hw_level, u32 user_max) { struct intel_panel *panel = &connector->panel; return scale(hw_level, panel->backlight.min, panel->backlight.max, 0, user_max); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula50100.00%1100.00%
Total50100.00%1100.00%


static u32 intel_panel_compute_brightness(struct intel_connector *connector, u32 val) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; WARN_ON(panel->backlight.max == 0); if (i915.invert_brightness < 0) return val; if (i915.invert_brightness > 0 || dev_priv->quirks & QUIRK_INVERT_BRIGHTNESS) { return panel->backlight.max - val; } return val; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula4955.68%562.50%
carsten emdecarsten emde3843.18%225.00%
jesse barnesjesse barnes11.14%112.50%
Total88100.00%8100.00%


static u32 lpt_get_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); return I915_READ(BLC_PWM_PCH_CTL2) & BACKLIGHT_DUTY_CYCLE_MASK; }

Contributors

PersonTokensPropCommitsCommitProp
daniel vetterdaniel vetter2060.61%125.00%
takashi iwaitakashi iwai721.21%125.00%
jani nikulajani nikula618.18%250.00%
Total33100.00%4100.00%


static u32 pch_get_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); return I915_READ(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula1957.58%250.00%
chris wilsonchris wilson1339.39%125.00%
stephane marchesinstephane marchesin13.03%125.00%
Total33100.00%4100.00%


static u32 i9xx_get_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 val; val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; if (INTEL_INFO(dev_priv)->gen < 4) val >>= 1; if (panel->backlight.combination_mode) { u8 lbpc; pci_read_config_byte(dev_priv->dev->pdev, LBPC, &lbpc); val *= lbpc; } return val; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula4850.00%337.50%
takashi iwaitakashi iwai2323.96%112.50%
chris wilsonchris wilson1818.75%112.50%
keith packardkeith packard55.21%112.50%
carsten emdecarsten emde11.04%112.50%
joonas lahtinenjoonas lahtinen11.04%112.50%
Total96100.00%8100.00%


static u32 _vlv_get_backlight(struct drm_i915_private *dev_priv, enum pipe pipe) { if (WARN_ON(pipe != PIPE_A && pipe != PIPE_B)) return 0; return I915_READ(VLV_BLC_PWM_CTL(pipe)) & BACKLIGHT_DUTY_CYCLE_MASK; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula2661.90%266.67%
ville syrjalaville syrjala1638.10%133.33%
Total42100.00%3100.00%


static u32 vlv_get_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); enum pipe pipe = intel_get_pipe_from_connector(connector); return _vlv_get_backlight(dev_priv, pipe); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula3992.86%250.00%
carsten emdecarsten emde24.76%125.00%
jesse barnesjesse barnes12.38%125.00%
Total42100.00%4100.00%


static u32 bxt_get_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; return I915_READ(BXT_BLC_PWM_DUTY(panel->backlight.controller)); }

Contributors

PersonTokensPropCommitsCommitProp
vandana kannanvandana kannan2654.17%133.33%
sunil kamathsunil kamath1735.42%133.33%
jani nikulajani nikula510.42%133.33%
Total48100.00%3100.00%


static u32 pwm_get_backlight(struct intel_connector *connector) { struct intel_panel *panel = &connector->panel; int duty_ns; duty_ns = pwm_get_duty_cycle(panel->backlight.pwm); return DIV_ROUND_UP(duty_ns * 100, CRC_PMIC_PWM_PERIOD_NS); }

Contributors

PersonTokensPropCommitsCommitProp
shobhit kumarshobhit kumar45100.00%1100.00%
Total45100.00%1100.00%


static u32 intel_panel_get_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 val = 0; mutex_lock(&dev_priv->backlight_lock); if (panel->backlight.enabled) { val = panel->backlight.get(connector); val = intel_panel_compute_brightness(connector, val); } mutex_unlock(&dev_priv->backlight_lock); DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val); return val; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula5759.38%550.00%
ville syrjalaville syrjala2222.92%110.00%
chris wilsonchris wilson1111.46%110.00%
carsten emdecarsten emde33.12%110.00%
daniel vetterdaniel vetter22.08%110.00%
jesse barnesjesse barnes11.04%110.00%
Total96100.00%10100.00%


static void lpt_set_backlight(struct intel_connector *connector, u32 level) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); u32 val = I915_READ(BLC_PWM_PCH_CTL2) & ~BACKLIGHT_DUTY_CYCLE_MASK; I915_WRITE(BLC_PWM_PCH_CTL2, val | level); }

Contributors

PersonTokensPropCommitsCommitProp
daniel vetterdaniel vetter2756.25%114.29%
chris wilsonchris wilson1122.92%114.29%
jani nikulajani nikula714.58%342.86%
takashi iwaitakashi iwai24.17%114.29%
jesse barnesjesse barnes12.08%114.29%
Total48100.00%7100.00%


static void pch_set_backlight(struct intel_connector *connector, u32 level) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); u32 tmp; tmp = I915_READ(BLC_PWM_CPU_CTL) & ~BACKLIGHT_DUTY_CYCLE_MASK; I915_WRITE(BLC_PWM_CPU_CTL, tmp | level); }

Contributors

PersonTokensPropCommitsCommitProp
chris wilsonchris wilson2958.00%133.33%
jani nikulajani nikula2142.00%266.67%
Total50100.00%3100.00%


static void i9xx_set_backlight(struct intel_connector *connector, u32 level) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 tmp, mask; WARN_ON(panel->backlight.max == 0); if (panel->backlight.combination_mode) { u8 lbpc; lbpc = level * 0xfe / panel->backlight.max + 1; level /= lbpc; pci_write_config_byte(dev_priv->dev->pdev, LBPC, lbpc); } if (IS_GEN4(dev_priv)) { mask = BACKLIGHT_DUTY_CYCLE_MASK; } else { level <<= 1; mask = BACKLIGHT_DUTY_CYCLE_MASK_PNV; } tmp = I915_READ(BLC_PWM_CTL) & ~mask; I915_WRITE(BLC_PWM_CTL, tmp | level); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula8459.57%545.45%
takashi iwaitakashi iwai3121.99%218.18%
chris wilsonchris wilson139.22%19.09%
jesse barnesjesse barnes128.51%218.18%
joonas lahtinenjoonas lahtinen10.71%19.09%
Total141100.00%11100.00%


static void vlv_set_backlight(struct intel_connector *connector, u32 level) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); enum pipe pipe = intel_get_pipe_from_connector(connector); u32 tmp; if (WARN_ON(pipe != PIPE_A && pipe != PIPE_B)) return; tmp = I915_READ(VLV_BLC_PWM_CTL(pipe)) & ~BACKLIGHT_DUTY_CYCLE_MASK; I915_WRITE(VLV_BLC_PWM_CTL(pipe), tmp | level); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula4759.49%250.00%
chris wilsonchris wilson1822.78%125.00%
ville syrjalaville syrjala1417.72%125.00%
Total79100.00%4100.00%


static void bxt_set_backlight(struct intel_connector *connector, u32 level) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; I915_WRITE(BXT_BLC_PWM_DUTY(panel->backlight.controller), level); }

Contributors

PersonTokensPropCommitsCommitProp
vandana kannanvandana kannan2955.77%133.33%
sunil kamathsunil kamath1834.62%133.33%
jani nikulajani nikula59.62%133.33%
Total52100.00%3100.00%


static void pwm_set_backlight(struct intel_connector *connector, u32 level) { struct intel_panel *panel = &connector->panel; int duty_ns = DIV_ROUND_UP(level * CRC_PMIC_PWM_PERIOD_NS, 100); pwm_config(panel->backlight.pwm, duty_ns, CRC_PMIC_PWM_PERIOD_NS); }

Contributors

PersonTokensPropCommitsCommitProp
shobhit kumarshobhit kumar49100.00%1100.00%
Total49100.00%1100.00%


static void intel_panel_actually_set_backlight(struct intel_connector *connector, u32 level) { struct intel_panel *panel = &connector->panel; DRM_DEBUG_DRIVER("set backlight PWM = %d\n", level); level = intel_panel_compute_brightness(connector, level); panel->backlight.set(connector, level); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula51100.00%3100.00%
Total51100.00%3100.00%

/* set backlight brightness to level in range [0..max], scaling wrt hw min */
static void intel_panel_set_backlight(struct intel_connector *connector, u32 user_level, u32 user_max) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 hw_level; if (!panel->backlight.present) return; mutex_lock(&dev_priv->backlight_lock); WARN_ON(panel->backlight.max == 0); hw_level = scale_user_to_hw(connector, user_level, user_max); panel->backlight.level = hw_level; if (panel->backlight.enabled) intel_panel_actually_set_backlight(connector, hw_level); mutex_unlock(&dev_priv->backlight_lock); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula11398.26%375.00%
daniel vetterdaniel vetter21.74%125.00%
Total115100.00%4100.00%

/* set backlight brightness to level in range [0..max], assuming hw min is * respected. */
void intel_panel_set_backlight_acpi(struct intel_connector *connector, u32 user_level, u32 user_max) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; enum pipe pipe = intel_get_pipe_from_connector(connector); u32 hw_level; /* * INVALID_PIPE may occur during driver init because * connection_mutex isn't held across the entire backlight * setup + modeset readout, and the BIOS can issue the * requests at any time. */ if (!panel->backlight.present || pipe == INVALID_PIPE) return; mutex_lock(&dev_priv->backlight_lock); WARN_ON(panel->backlight.max == 0); hw_level = clamp_user_to_hw(connector, user_level, user_max); panel->backlight.level = hw_level; if (panel->backlight.device) panel->backlight.device->props.brightness = scale_hw_to_user(connector, panel->backlight.level, panel->backlight.device->props.max_brightness); if (panel->backlight.enabled) intel_panel_actually_set_backlight(connector, hw_level); mutex_unlock(&dev_priv->backlight_lock); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula10663.47%956.25%
jesse barnesjesse barnes2615.57%16.25%
chris wilsonchris wilson158.98%16.25%
ville syrjalaville syrjala84.79%212.50%
takashi iwaitakashi iwai74.19%16.25%
aaron luaaron lu31.80%16.25%
daniel vetterdaniel vetter21.20%16.25%
Total167100.00%16100.00%


static void lpt_disable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); u32 tmp; intel_panel_actually_set_backlight(connector, 0); /* * Although we don't support or enable CPU PWM with LPT/SPT based * systems, it may have been enabled prior to loading the * driver. Disable to avoid warnings on LCPLL disable. * * This needs rework if we need to add support for CPU PWM on PCH split * platforms. */ tmp = I915_READ(BLC_PWM_CPU_CTL2); if (tmp & BLM_PWM_ENABLE) { DRM_DEBUG_KMS("cpu backlight was enabled, disabling\n"); I915_WRITE(BLC_PWM_CPU_CTL2, tmp & ~BLM_PWM_ENABLE); } tmp = I915_READ(BLC_PWM_PCH_CTL1); I915_WRITE(BLC_PWM_PCH_CTL1, tmp & ~BLM_PCH_PWM_ENABLE); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula83100.00%3100.00%
Total83100.00%3100.00%


static void pch_disable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); u32 tmp; intel_panel_actually_set_backlight(connector, 0); tmp = I915_READ(BLC_PWM_CPU_CTL2); I915_WRITE(BLC_PWM_CPU_CTL2, tmp & ~BLM_PWM_ENABLE); tmp = I915_READ(BLC_PWM_PCH_CTL1); I915_WRITE(BLC_PWM_PCH_CTL1, tmp & ~BLM_PCH_PWM_ENABLE); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula4666.67%562.50%
jesse barnesjesse barnes1014.49%112.50%
takashi iwaitakashi iwai811.59%112.50%
chris wilsonchris wilson57.25%112.50%
Total69100.00%8100.00%


static void i9xx_disable_backlight(struct intel_connector *connector) { intel_panel_actually_set_backlight(connector, 0); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula18100.00%1100.00%
Total18100.00%1100.00%


static void i965_disable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); u32 tmp; intel_panel_actually_set_backlight(connector, 0); tmp = I915_READ(BLC_PWM_CTL2); I915_WRITE(BLC_PWM_CTL2, tmp & ~BLM_PWM_ENABLE); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula3873.08%360.00%
daniel vetterdaniel vetter1223.08%120.00%
jesse barnesjesse barnes23.85%120.00%
Total52100.00%5100.00%


static void vlv_disable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); enum pipe pipe = intel_get_pipe_from_connector(connector); u32 tmp; if (WARN_ON(pipe != PIPE_A && pipe != PIPE_B)) return; intel_panel_actually_set_backlight(connector, 0); tmp = I915_READ(VLV_BLC_PWM_CTL2(pipe)); I915_WRITE(VLV_BLC_PWM_CTL2(pipe), tmp & ~BLM_PWM_ENABLE); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula5567.90%457.14%
ville syrjalaville syrjala1417.28%114.29%
paulo zanonipaulo zanoni1113.58%114.29%
chris wilsonchris wilson11.23%114.29%
Total81100.00%7100.00%


static void bxt_disable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 tmp, val; intel_panel_actually_set_backlight(connector, 0); tmp = I915_READ(BXT_BLC_PWM_CTL(panel->backlight.controller)); I915_WRITE(BXT_BLC_PWM_CTL(panel->backlight.controller), tmp & ~BXT_BLC_PWM_ENABLE); if (panel->backlight.controller == 1) { val = I915_READ(UTIL_PIN_CTL); val &= ~UTIL_PIN_ENABLE; I915_WRITE(UTIL_PIN_CTL, val); } }

Contributors

PersonTokensPropCommitsCommitProp
sunil kamathsunil kamath5954.13%133.33%
vandana kannanvandana kannan4541.28%133.33%
jani nikulajani nikula54.59%133.33%
Total109100.00%3100.00%


static void pwm_disable_backlight(struct intel_connector *connector) { struct intel_panel *panel = &connector->panel; /* Disable the backlight */ pwm_config(panel->backlight.pwm, 0, CRC_PMIC_PWM_PERIOD_NS); usleep_range(2000, 3000); pwm_disable(panel->backlight.pwm); }

Contributors

PersonTokensPropCommitsCommitProp
shobhit kumarshobhit kumar51100.00%1100.00%
Total51100.00%1100.00%


void intel_panel_disable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; if (!panel->backlight.present) return; /* * Do not disable backlight on the vga_switcheroo 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->dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) { DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n"); return; } mutex_lock(&dev_priv->backlight_lock); if (panel->backlight.device) panel->backlight.device->props.power = FB_BLANK_POWERDOWN; panel->backlight.enabled = false; panel->backlight.disable(connector); mutex_unlock(&dev_priv->backlight_lock); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula7867.24%850.00%
jesse barnesjesse barnes1311.21%16.25%
chris wilsonchris wilson119.48%212.50%
ville syrjalaville syrjala65.17%16.25%
daniel vetterdaniel vetter54.31%212.50%
damien lespiaudamien lespiau21.72%16.25%
lukas wunnerlukas wunner10.86%16.25%
Total116100.00%16100.00%


static void lpt_enable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 pch_ctl1, pch_ctl2; pch_ctl1 = I915_READ(BLC_PWM_PCH_CTL1); if (pch_ctl1 & BLM_PCH_PWM_ENABLE) { DRM_DEBUG_KMS("pch backlight already enabled\n"); pch_ctl1 &= ~BLM_PCH_PWM_ENABLE; I915_WRITE(BLC_PWM_PCH_CTL1, pch_ctl1); } pch_ctl2 = panel->backlight.max << 16; I915_WRITE(BLC_PWM_PCH_CTL2, pch_ctl2); pch_ctl1 = 0; if (panel->backlight.active_low_pwm) pch_ctl1 |= BLM_PCH_POLARITY; /* After LPT, override is the default. */ if (HAS_PCH_LPT(dev_priv)) pch_ctl1 |= BLM_PCH_OVERRIDE_ENABLE; I915_WRITE(BLC_PWM_PCH_CTL1, pch_ctl1); POSTING_READ(BLC_PWM_PCH_CTL1); I915_WRITE(BLC_PWM_PCH_CTL1, pch_ctl1 | BLM_PCH_PWM_ENABLE); /* This won't stick until the above enable. */ intel_panel_actually_set_backlight(connector, panel->backlight.level); }

Contributors

PersonTokensPropCommitsCommitProp
daniel vetterdaniel vetter11274.67%222.22%
jani nikulajani nikula1711.33%555.56%
ben widawskyben widawsky117.33%111.11%
paulo zanonipaulo zanoni106.67%111.11%
Total150100.00%9100.00%


static void pch_enable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; enum pipe pipe = intel_get_pipe_from_connector(connector); enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, pipe); u32 cpu_ctl2, pch_ctl1, pch_ctl2; cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2); if (cpu_ctl2 & BLM_PWM_ENABLE) { DRM_DEBUG_KMS("cpu backlight already enabled\n"); cpu_ctl2 &= ~BLM_PWM_ENABLE; I915_WRITE(BLC_PWM_CPU_CTL2, cpu_ctl2); } pch_ctl1 = I915_READ(BLC_PWM_PCH_CTL1); if (pch_ctl1 & BLM_PCH_PWM_ENABLE) { DRM_DEBUG_KMS("pch backlight already enabled\n"); pch_ctl1 &= ~BLM_PCH_PWM_ENABLE; I915_WRITE(BLC_PWM_PCH_CTL1, pch_ctl1); } if (cpu_transcoder == TRANSCODER_EDP) cpu_ctl2 = BLM_TRANSCODER_EDP; else cpu_ctl2 = BLM_PIPE(cpu_transcoder); I915_WRITE(BLC_PWM_CPU_CTL2, cpu_ctl2); POSTING_READ(BLC_PWM_CPU_CTL2); I915_WRITE(BLC_PWM_CPU_CTL2, cpu_ctl2 | BLM_PWM_ENABLE); /* This won't stick until the above enable. */ intel_panel_actually_set_backlight(connector, panel->backlight.level); pch_ctl2 = panel->backlight.max << 16; I915_WRITE(BLC_PWM_PCH_CTL2, pch_ctl2); pch_ctl1 = 0; if (panel->backlight.active_low_pwm) pch_ctl1 |= BLM_PCH_POLARITY; I915_WRITE(BLC_PWM_PCH_CTL1, pch_ctl1); POSTING_READ(BLC_PWM_PCH_CTL1); I915_WRITE(BLC_PWM_PCH_CTL1, pch_ctl1 | BLM_PCH_PWM_ENABLE); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula17676.19%550.00%
daniel vetterdaniel vetter3716.02%110.00%
paulo zanonipaulo zanoni104.33%110.00%
jesse barnesjesse barnes52.16%110.00%
ben widawskyben widawsky20.87%110.00%
scot doylescot doyle10.43%110.00%
Total231100.00%10100.00%


static void i9xx_enable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 ctl, freq; ctl = I915_READ(BLC_PWM_CTL); if (ctl & BACKLIGHT_DUTY_CYCLE_MASK_PNV) { DRM_DEBUG_KMS("backlight already enabled\n"); I915_WRITE(BLC_PWM_CTL, 0); } freq = panel->backlight.max; if (panel->backlight.combination_mode) freq /= 0xff; ctl = freq << 17; if (panel->backlight.combination_mode) ctl |= BLM_LEGACY_MODE; if (IS_PINEVIEW(dev_priv) && panel->backlight.active_low_pwm) ctl |= BLM_POLARITY_PNV; I915_WRITE(BLC_PWM_CTL, ctl); POSTING_READ(BLC_PWM_CTL); /* XXX: combine this into above write? */ intel_panel_actually_set_backlight(connector, panel->backlight.level); /* * Needed to enable backlight on some 855gm models. BLC_HIST_CTL is * 855gm only, but checking for gen2 is safe, as 855gm is the only gen2 * that has backlight. */ if (IS_GEN2(dev_priv)) I915_WRITE(BLC_HIST_CTL, BLM_HISTOGRAM_ENABLE); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula15998.76%466.67%
daniel vetterdaniel vetter10.62%116.67%
scot doylescot doyle10.62%116.67%
Total161100.00%6100.00%


static void i965_enable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; enum pipe pipe = intel_get_pipe_from_connector(connector); u32 ctl, ctl2, freq; ctl2 = I915_READ(BLC_PWM_CTL2); if (ctl2 & BLM_PWM_ENABLE) { DRM_DEBUG_KMS("backlight already enabled\n"); ctl2 &= ~BLM_PWM_ENABLE; I915_WRITE(BLC_PWM_CTL2, ctl2); } freq = panel->backlight.max; if (panel->backlight.combination_mode) freq /= 0xff; ctl = freq << 16; I915_WRITE(BLC_PWM_CTL, ctl); ctl2 = BLM_PIPE(pipe); if (panel->backlight.combination_mode) ctl2 |= BLM_COMBINATION_MODE; if (panel->backlight.active_low_pwm) ctl2 |= BLM_POLARITY_I965; I915_WRITE(BLC_PWM_CTL2, ctl2); POSTING_READ(BLC_PWM_CTL2); I915_WRITE(BLC_PWM_CTL2, ctl2 | BLM_PWM_ENABLE); intel_panel_actually_set_backlight(connector, panel->backlight.level); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula14983.24%562.50%
jesse barnesjesse barnes2916.20%225.00%
scot doylescot doyle10.56%112.50%
Total179100.00%8100.00%


static void vlv_enable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; enum pipe pipe = intel_get_pipe_from_connector(connector); u32 ctl, ctl2; if (WARN_ON(pipe != PIPE_A && pipe != PIPE_B)) return; ctl2 = I915_READ(VLV_BLC_PWM_CTL2(pipe)); if (ctl2 & BLM_PWM_ENABLE) { DRM_DEBUG_KMS("backlight already enabled\n"); ctl2 &= ~BLM_PWM_ENABLE; I915_WRITE(VLV_BLC_PWM_CTL2(pipe), ctl2); } ctl = panel->backlight.max << 16; I915_WRITE(VLV_BLC_PWM_CTL(pipe), ctl); /* XXX: combine this into above write? */ intel_panel_actually_set_backlight(connector, panel->backlight.level); ctl2 = 0; if (panel->backlight.active_low_pwm) ctl2 |= BLM_POLARITY_I965; I915_WRITE(VLV_BLC_PWM_CTL2(pipe), ctl2); POSTING_READ(VLV_BLC_PWM_CTL2(pipe)); I915_WRITE(VLV_BLC_PWM_CTL2(pipe), ctl2 | BLM_PWM_ENABLE); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula16189.94%457.14%
ville syrjalaville syrjala147.82%114.29%
chris wilsonchris wilson31.68%114.29%
scot doylescot doyle10.56%114.29%
Total179100.00%7100.00%


static void bxt_enable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; enum pipe pipe = intel_get_pipe_from_connector(connector); u32 pwm_ctl, val; /* To use 2nd set of backlight registers, utility pin has to be * enabled with PWM mode. * The field should only be changed when the utility pin is disabled */ if (panel->backlight.controller == 1) { val = I915_READ(UTIL_PIN_CTL); if (val & UTIL_PIN_ENABLE) { DRM_DEBUG_KMS("util pin already enabled\n"); val &= ~UTIL_PIN_ENABLE; I915_WRITE(UTIL_PIN_CTL, val); } val = 0; if (panel->backlight.util_pin_active_low) val |= UTIL_PIN_POLARITY; I915_WRITE(UTIL_PIN_CTL, val | UTIL_PIN_PIPE(pipe) | UTIL_PIN_MODE_PWM | UTIL_PIN_ENABLE); } pwm_ctl = I915_READ(BXT_BLC_PWM_CTL(panel->backlight.controller)); if (pwm_ctl & BXT_BLC_PWM_ENABLE) { DRM_DEBUG_KMS("backlight already enabled\n"); pwm_ctl &= ~BXT_BLC_PWM_ENABLE; I915_WRITE(BXT_BLC_PWM_CTL(panel->backlight.controller), pwm_ctl); } I915_WRITE(BXT_BLC_PWM_FREQ(panel->backlight.controller), panel->backlight.max); intel_panel_actually_set_backlight(connector, panel->backlight.level); pwm_ctl = 0; if (panel->backlight.active_low_pwm) pwm_ctl |= BXT_BLC_PWM_POLARITY; I915_WRITE(BXT_BLC_PWM_CTL(panel->backlight.controller), pwm_ctl); POSTING_READ(BXT_BLC_PWM_CTL(panel->backlight.controller)); I915_WRITE(BXT_BLC_PWM_CTL(panel->backlight.controller), pwm_ctl | BXT_BLC_PWM_ENABLE); }

Contributors

PersonTokensPropCommitsCommitProp
sunil kamathsunil kamath13652.51%133.33%
vandana kannanvandana kannan11845.56%133.33%
jani nikulajani nikula51.93%133.33%
Total259100.00%3100.00%


static void pwm_enable_backlight(struct intel_connector *connector) { struct intel_panel *panel = &connector->panel; pwm_enable(panel->backlight.pwm); intel_panel_actually_set_backlight(connector, panel->backlight.level); }

Contributors

PersonTokensPropCommitsCommitProp
shobhit kumarshobhit kumar41100.00%1100.00%
Total41100.00%1100.00%


void intel_panel_enable_backlight(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; enum pipe pipe = intel_get_pipe_from_connector(connector); if (!panel->backlight.present) return; DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe)); mutex_lock(&dev_priv->backlight_lock); WARN_ON(panel->backlight.max == 0); if (panel->backlight.level <= panel->backlight.min) { panel->backlight.level = panel->backlight.max; if (panel->backlight.device) panel->backlight.device->props.brightness = scale_hw_to_user(connector, panel->backlight.level, panel->backlight.device->props.max_brightness); } panel->backlight.enable(connector); panel->backlight.enabled = true; if (panel->backlight.device) panel->backlight.device->props.power = FB_BLANK_UNBLANK; mutex_unlock(&dev_priv->backlight_lock); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula18092.78%666.67%
jeremiah mahlerjeremiah mahler63.09%111.11%
ville syrjalaville syrjala63.09%111.11%
daniel vetterdaniel vetter21.03%111.11%
Total194100.00%9100.00%

#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
static int intel_backlight_device_update_status(struct backlight_device *bd) { struct intel_connector *connector = bl_get_data(bd); struct intel_panel *panel = &connector->panel; struct drm_device *dev = connector->base.dev; drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); DRM_DEBUG_KMS("updating intel_backlight, brightness=%d/%d\n", bd->props.brightness, bd->props.max_brightness); intel_panel_set_backlight(connector, bd->props.brightness, bd->props.max_brightness); /* * Allow flipping bl_power as a sub-state of enabled. Sadly the * backlight class device does not make it easy to to differentiate * between callbacks for brightness and bl_power, so our backlight_power * callback needs to take this into account. */ if (panel->backlight.enabled) { if (panel->backlight.power) { bool enable = bd->props.power == FB_BLANK_UNBLANK && bd->props.brightness != 0; panel->backlight.power(connector, enable); } } else { bd->props.power = FB_BLANK_POWERDOWN; } drm_modeset_unlock(&dev->mode_config.connection_mutex); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula7948.47%550.00%
matthew garrettmatthew garrett3119.02%110.00%
jesse barnesjesse barnes3018.40%110.00%
chris wilsonchris wilson1710.43%110.00%
rob clarkrob clark42.45%110.00%
daniel vetterdaniel vetter21.23%110.00%
Total163100.00%10100.00%


static int intel_backlight_device_get_brightness(struct backlight_device *bd) { struct intel_connector *connector = bl_get_data(bd); struct drm_device *dev = connector->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; u32 hw_level; int ret; intel_runtime_pm_get(dev_priv); drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); hw_level = intel_panel_get_backlight(connector); ret = scale_hw_to_user(connector, hw_level, bd->props.max_brightness); drm_modeset_unlock(&dev->mode_config.connection_mutex); intel_runtime_pm_put(dev_priv); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula7975.96%240.00%
paulo zanonipaulo zanoni1918.27%120.00%
rob clarkrob clark43.85%120.00%
daniel vetterdaniel vetter21.92%120.00%
Total104100.00%5100.00%

static const struct backlight_ops intel_backlight_device_ops = { .update_status = intel_backlight_device_update_status, .get_brightness = intel_backlight_device_get_brightness, };
static int intel_backlight_device_register(struct intel_connector *connector) { struct intel_panel *panel = &connector->panel; struct backlight_properties props; if (WARN_ON(panel->backlight.device)) return -ENODEV; if (!panel->backlight.present) return 0; WARN_ON(panel->backlight.max == 0); memset(&props, 0, sizeof(props)); props.type = BACKLIGHT_RAW; /* * Note: Everything should work even if the backlight device max * presented to the userspace is arbitrarily chosen. */ props.max_brightness = panel->backlight.max; props.brightness = scale_hw_to_user(connector, panel->backlight.level, props.max_brightness); if (panel->backlight.enabled) props.power = FB_BLANK_UNBLANK; else props.power = FB_BLANK_POWERDOWN; /* * Note: using the same name independent of the connector prevents * registration of multiple backlight devices in the driver. */ panel->backlight.device = backlight_device_register("intel_backlight", connector->base.kdev, connector, &intel_backlight_device_ops, &props); if (IS_ERR(panel->backlight.device)) { DRM_ERROR("Failed to register backlight: %ld\n", PTR_ERR(panel->backlight.device)); panel->backlight.device = NULL; return -ENODEV; } DRM_DEBUG_KMS("Connector %s backlight sysfs interface registered\n", connector->base.name); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula18989.15%375.00%
ville syrjalaville syrjala2310.85%125.00%
Total212100.00%4100.00%


static void intel_backlight_device_unregister(struct intel_connector *connector) { struct intel_panel *panel = &connector->panel; if (panel->backlight.device) { backlight_device_unregister(panel->backlight.device); panel->backlight.device = NULL; } }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula2654.17%133.33%
jesse barnesjesse barnes1735.42%133.33%
matthew garrettmatthew garrett510.42%133.33%
Total48100.00%3100.00%

#else /* CONFIG_BACKLIGHT_CLASS_DEVICE */
static int intel_backlight_device_register(struct intel_connector *connector) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula857.14%375.00%
matthew garrettmatthew garrett642.86%125.00%
Total14100.00%4100.00%


static void intel_backlight_device_unregister(struct intel_connector *connector) { }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula990.00%266.67%
matthew garrettmatthew garrett110.00%133.33%
Total10100.00%3100.00%

#endif /* CONFIG_BACKLIGHT_CLASS_DEVICE */ /* * BXT: PWM clock frequency = 19.2 MHz. */
static u32 bxt_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz) { return DIV_ROUND_CLOSEST(KHz(19200), pwm_freq_hz); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula2184.00%150.00%
ville syrjalaville syrjala416.00%150.00%
Total25100.00%2100.00%

/* * SPT: This value represents the period of the PWM stream in clock periods * multiplied by 16 (default increment) or 128 (alternate increment selected in * SCHICKEN_1 bit 0). PWM clock is 24 MHz. */
static u32 spt_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); u32 mul; if (I915_READ(SOUTH_CHICKEN1) & SPT_PWM_GRANULARITY) mul = 128; else mul = 16; return DIV_ROUND_CLOSEST(MHz(24), pwm_freq_hz * mul); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula5791.94%250.00%
ville syrjalaville syrjala58.06%250.00%
Total62100.00%4100.00%

/* * LPT: This value represents the period of the PWM stream in clock periods * multiplied by 128 (default increment) or 16 (alternate increment, selected in * LPT SOUTH_CHICKEN2 register bit 5). */
static u32 lpt_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); u32 mul, clock; if (I915_READ(SOUTH_CHICKEN2) & LPT_PWM_GRANULARITY) mul = 16; else mul = 128; if (HAS_PCH_LPT_H(dev_priv)) clock = MHz(135); /* LPT:H */ else clock = MHz(24); /* LPT:LP */ return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * mul); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula7891.76%250.00%
ville syrjalaville syrjala78.24%250.00%
Total85100.00%4100.00%

/* * ILK/SNB/IVB: This value represents the period of the PWM stream in PCH * display raw clocks multiplied by 128. */
static u32 pch_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); return DIV_ROUND_CLOSEST(KHz(dev_priv->rawclk_freq), pwm_freq_hz * 128); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula2967.44%133.33%
ville syrjalaville syrjala1432.56%266.67%
Total43100.00%3100.00%

/* * Gen2: This field determines the number of time base events (display core * clock frequency/32) in total for a complete cycle of modulated backlight * control. * * Gen3: A time base event equals the display core clock ([DevPNV] HRAW clock) * divided by 32. */
static u32 i9xx_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); int clock; if (IS_PINEVIEW(dev_priv)) clock = KHz(dev_priv->rawclk_freq); else clock = KHz(dev_priv->cdclk_freq); return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * 32); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula4871.64%120.00%
ville syrjalaville syrjala1928.36%480.00%
Total67100.00%5100.00%

/* * Gen4: This value represents the period of the PWM stream in display core * clocks ([DevCTG] HRAW clocks) multiplied by 128. * */
static u32 i965_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz) { struct drm_device *dev = connector->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; int clock; if (IS_G4X(dev_priv)) clock = KHz(dev_priv->rawclk_freq); else clock = KHz(dev_priv->cdclk_freq); return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * 128); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula4460.27%120.00%
ville syrjalaville syrjala2939.73%480.00%
Total73100.00%5100.00%

/* * VLV: This value represents the period of the PWM stream in display core * clocks ([DevCTG] 200MHz HRAW clocks) multiplied by 128 or 25MHz S0IX clocks * multiplied by 16. CHV uses a 19.2MHz S0IX clock. */
static u32 vlv_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); int mul, clock; if ((I915_READ(CBR1_VLV) & CBR_PWM_CLOCK_MUX_SELECT) == 0) { if (IS_CHERRYVIEW(dev_priv)) clock = KHz(19200); else clock = MHz(25); mul = 16; } else { clock = KHz(dev_priv->rawclk_freq); mul = 128; } return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * mul); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula6969.00%133.33%
ville syrjalaville syrjala3131.00%266.67%
Total100100.00%3100.00%


static u32 get_backlight_max_vbt(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u16 pwm_freq_hz = dev_priv->vbt.backlight.pwm_freq_hz; u32 pwm; if (!panel->backlight.hz_to_pwm) { DRM_DEBUG_KMS("backlight frequency conversion not supported\n"); return 0; } if (pwm_freq_hz) { DRM_DEBUG_KMS("VBT defined backlight frequency %u Hz\n", pwm_freq_hz); } else { pwm_freq_hz = 200; DRM_DEBUG_KMS("default backlight frequency %u Hz\n", pwm_freq_hz); } pwm = panel->backlight.hz_to_pwm(connector, pwm_freq_hz); if (!pwm) { DRM_DEBUG_KMS("backlight frequency conversion failed\n"); return 0; } return pwm; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula126100.00%4100.00%
Total126100.00%4100.00%

/* * Note: The setup hooks can't assume pipe is set! */
static u32 get_backlight_min_vbt(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; int min; WARN_ON(panel->backlight.max == 0); /* * XXX: If the vbt value is 255, it makes min equal to max, which leads * to problems. There are such machines out there. Either our * interpretation is wrong or the vbt has bogus data. Or both. Safeguard * against this by letting the minimum be at most (arbitrarily chosen) * 25% of the max. */ min = clamp_t(int, dev_priv->vbt.backlight.min_brightness, 0, 64); if (min != dev_priv->vbt.backlight.min_brightness) { DRM_DEBUG_KMS("clamping VBT min backlight %d/255 to %d/255\n", dev_priv->vbt.backlight.min_brightness, min); } /* vbt value is a coefficient in range [0..255] */ return scale(min, 0, 255, 0, panel->backlight.max); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula117100.00%3100.00%
Total117100.00%3100.00%


static int lpt_setup_backlight(struct intel_connector *connector, enum pipe unused) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 pch_ctl1, pch_ctl2, val; pch_ctl1 = I915_READ(BLC_PWM_PCH_CTL1); panel->backlight.active_low_pwm = pch_ctl1 & BLM_PCH_POLARITY; pch_ctl2 = I915_READ(BLC_PWM_PCH_CTL2); panel->backlight.max = pch_ctl2 >> 16; if (!panel->backlight.max) panel->backlight.max = get_backlight_max_vbt(connector); if (!panel->backlight.max) return -ENODEV; panel->backlight.min = get_backlight_min_vbt(connector); val = lpt_get_backlight(connector); panel->backlight.level = intel_panel_compute_brightness(connector, val); panel->backlight.enabled = (pch_ctl1 & BLM_PCH_PWM_ENABLE) && panel->backlight.level != 0; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
daniel vetterdaniel vetter12574.85%116.67%
jani nikulajani nikula3822.75%466.67%
ville syrjalaville syrjala42.40%116.67%
Total167100.00%6100.00%


static int pch_setup_backlight(struct intel_connector *connector, enum pipe unused) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 cpu_ctl2, pch_ctl1, pch_ctl2, val; pch_ctl1 = I915_READ(BLC_PWM_PCH_CTL1); panel->backlight.active_low_pwm = pch_ctl1 & BLM_PCH_POLARITY; pch_ctl2 = I915_READ(BLC_PWM_PCH_CTL2); panel->backlight.max = pch_ctl2 >> 16; if (!panel->backlight.max) panel->backlight.max = get_backlight_max_vbt(connector); if (!panel->backlight.max) return -ENODEV; panel->backlight.min = get_backlight_min_vbt(connector); val = pch_get_backlight(connector); panel->backlight.level = intel_panel_compute_brightness(connector, val); cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2); panel->backlight.enabled = (cpu_ctl2 & BLM_PWM_ENABLE) && (pch_ctl1 & BLM_PCH_PWM_ENABLE) && panel->backlight.level != 0; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula17395.05%1178.57%
ville syrjalaville syrjala42.20%17.14%
corentin charycorentin chary31.65%17.14%
matthew garrettmatthew garrett21.10%17.14%
Total182100.00%14100.00%


static int i9xx_setup_backlight(struct intel_connector *connector, enum pipe unused) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 ctl, val; ctl = I915_READ(BLC_PWM_CTL); if (IS_GEN2(dev_priv) || IS_I915GM(dev_priv) || IS_I945GM(dev_priv)) panel->backlight.combination_mode = ctl & BLM_LEGACY_MODE; if (IS_PINEVIEW(dev_priv)) panel->backlight.active_low_pwm = ctl & BLM_POLARITY_PNV; panel->backlight.max = ctl >> 17; if (!panel->backlight.max) { panel->backlight.max = get_backlight_max_vbt(connector); panel->backlight.max >>= 1; } if (!panel->backlight.max) return -ENODEV; if (panel->backlight.combination_mode) panel->backlight.max *= 0xff; panel->backlight.min = get_backlight_min_vbt(connector); val = i9xx_get_backlight(connector); panel->backlight.level = intel_panel_compute_brightness(connector, val); panel->backlight.enabled = panel->backlight.level != 0; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula20295.28%1184.62%
matthew garrettmatthew garrett62.83%17.69%
ville syrjalaville syrjala41.89%17.69%
Total212100.00%13100.00%


static int i965_setup_backlight(struct intel_connector *connector, enum pipe unused) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 ctl, ctl2, val; ctl2 = I915_READ(BLC_PWM_CTL2); panel->backlight.combination_mode = ctl2 & BLM_COMBINATION_MODE; panel->backlight.active_low_pwm = ctl2 & BLM_POLARITY_I965; ctl = I915_READ(BLC_PWM_CTL); panel->backlight.max = ctl >> 16; if (!panel->backlight.max) panel->backlight.max = get_backlight_max_vbt(connector); if (!panel->backlight.max) return -ENODEV; if (panel->backlight.combination_mode) panel->backlight.max *= 0xff; panel->backlight.min = get_backlight_min_vbt(connector); val = i9xx_get_backlight(connector); panel->backlight.level = intel_panel_compute_brightness(connector, val); panel->backlight.enabled = (ctl2 & BLM_PWM_ENABLE) && panel->backlight.level != 0; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula16987.56%880.00%
matthew garrettmatthew garrett2010.36%110.00%
ville syrjalaville syrjala42.07%110.00%
Total193100.00%10100.00%


static int vlv_setup_backlight(struct intel_connector *connector, enum pipe pipe) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 ctl, ctl2, val; if (WARN_ON(pipe != PIPE_A && pipe != PIPE_B)) return -ENODEV; ctl2 = I915_READ(VLV_BLC_PWM_CTL2(pipe)); panel->backlight.active_low_pwm = ctl2 & BLM_POLARITY_I965; ctl = I915_READ(VLV_BLC_PWM_CTL(pipe)); panel->backlight.max = ctl >> 16; if (!panel->backlight.max) panel->backlight.max = get_backlight_max_vbt(connector); if (!panel->backlight.max) return -ENODEV; panel->backlight.min = get_backlight_min_vbt(connector); val = _vlv_get_backlight(dev_priv, pipe); panel->backlight.level = intel_panel_compute_brightness(connector, val); panel->backlight.enabled = (ctl2 & BLM_PWM_ENABLE) && panel->backlight.level != 0; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula15781.77%981.82%
ville syrjalaville syrjala2412.50%19.09%
matthew garrettmatthew garrett115.73%19.09%
Total192100.00%11100.00%


static int bxt_setup_backlight(struct intel_connector *connector, enum pipe unused) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; u32 pwm_ctl, val; /* * For BXT hard coding the Backlight controller to 0. * TODO : Read the controller value from VBT and generalize */ panel->backlight.controller = 0; pwm_ctl = I915_READ(BXT_BLC_PWM_CTL(panel->backlight.controller)); /* Keeping the check if controller 1 is to be programmed. * This will come into affect once the VBT parsing * is fixed for controller selection, and controller 1 is used * for a prticular display configuration. */ if (panel->backlight.controller == 1) { val = I915_READ(UTIL_PIN_CTL); panel->backlight.util_pin_active_low = val & UTIL_PIN_POLARITY; } panel->backlight.active_low_pwm = pwm_ctl & BXT_BLC_PWM_POLARITY; panel->backlight.max = I915_READ(BXT_BLC_PWM_FREQ(panel->backlight.controller)); if (!panel->backlight.max) panel->backlight.max = get_backlight_max_vbt(connector); if (!panel->backlight.max) return -ENODEV; val = bxt_get_backlight(connector); panel->backlight.level = intel_panel_compute_brightness(connector, val); panel->backlight.enabled = (pwm_ctl & BXT_BLC_PWM_ENABLE) && panel->backlight.level != 0; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
vandana kannanvandana kannan12160.20%125.00%
sunil kamathsunil kamath5527.36%125.00%
jani nikulajani nikula2512.44%250.00%
Total201100.00%4100.00%


static int pwm_setup_backlight(struct intel_connector *connector, enum pipe pipe) { struct drm_device *dev = connector->base.dev; struct intel_panel *panel = &connector->panel; int retval; /* Get the PWM chip for backlight control */ panel->backlight.pwm = pwm_get(dev->dev, "pwm_backlight"); if (IS_ERR(panel->backlight.pwm)) { DRM_ERROR("Failed to own the pwm chip\n"); panel->backlight.pwm = NULL; return -ENODEV; } /* * FIXME: pwm_apply_args() should be removed when switching to * the atomic PWM API. */ pwm_apply_args(panel->backlight.pwm); retval = pwm_config(panel->backlight.pwm, CRC_PMIC_PWM_PERIOD_NS, CRC_PMIC_PWM_PERIOD_NS); if (retval < 0) { DRM_ERROR("Failed to configure the pwm chip\n"); pwm_put(panel->backlight.pwm); panel->backlight.pwm = NULL; return retval; } panel->backlight.min = 0; /* 0% */ panel->backlight.max = 100; /* 100% */ panel->backlight.level = DIV_ROUND_UP( pwm_get_duty_cycle(panel->backlight.pwm) * 100, CRC_PMIC_PWM_PERIOD_NS); panel->backlight.enabled = panel->backlight.level != 0; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
shobhit kumarshobhit kumar19095.00%150.00%
boris brezillonboris brezillon105.00%150.00%
Total200100.00%2100.00%


int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe) { struct drm_i915_private *dev_priv = to_i915(connector->dev); struct intel_connector *intel_connector = to_intel_connector(connector); struct intel_panel *panel = &intel_connector->panel; int ret; if (!dev_priv->vbt.backlight.present) { if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) { DRM_DEBUG_KMS("no backlight present per VBT, but present per quirk\n"); } else { DRM_DEBUG_KMS("no backlight present per VBT\n"); return 0; } } /* ensure intel_panel has been initialized first */ if (WARN_ON(!panel->backlight.setup)) return -ENODEV; /* set level and max in panel struct */ mutex_lock(&dev_priv->backlight_lock); ret = panel->backlight.setup(intel_connector, pipe); mutex_unlock(&dev_priv->backlight_lock); if (ret) { DRM_DEBUG_KMS("failed to setup backlight for connector %s\n", connector->name); return ret; } panel->backlight.present = true; DRM_DEBUG_KMS("Connector %s backlight initialized, %s, brightness %u/%u\n", connector->name, panel->backlight.enabled ? "enabled" : "disabled", panel->backlight.level, panel->backlight.max); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula15177.44%1066.67%
scot doylescot doyle199.74%16.67%
matthew garrettmatthew garrett126.15%16.67%
ville syrjalaville syrjala115.64%213.33%
daniel vetterdaniel vetter21.03%16.67%
Total195100.00%15100.00%


void intel_panel_destroy_backlight(struct drm_connector *connector) { struct intel_connector *intel_connector = to_intel_connector(connector); struct intel_panel *panel = &intel_connector->panel; /* dispose of the pwm */ if (panel->backlight.pwm) pwm_put(panel->backlight.pwm); panel->backlight.present = false; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula3053.57%250.00%
shobhit kumarshobhit kumar1832.14%125.00%
matthew garrettmatthew garrett814.29%125.00%
Total56100.00%4100.00%

/* Set up chip specific backlight functions */
static void intel_panel_init_backlight_funcs(struct intel_panel *panel) { struct intel_connector *connector = container_of(panel, struct intel_connector, panel); struct drm_i915_private *dev_priv = to_i915(connector->base.dev); if (IS_BROXTON(dev_priv)) { panel->backlight.setup = bxt_setup_backlight; panel->backlight.enable = bxt_enable_backlight; panel->backlight.disable = bxt_disable_backlight; panel->backlight.set = bxt_set_backlight; panel->backlight.get = bxt_get_backlight; panel->backlight.hz_to_pwm = bxt_hz_to_pwm; } else if (HAS_PCH_LPT(dev_priv) || HAS_PCH_SPT(dev_priv) || HAS_PCH_KBP(dev_priv)) { panel->backlight.setup = lpt_setup_backlight; panel->backlight.enable = lpt_enable_backlight; panel->backlight.disable = lpt_disable_backlight; panel->backlight.set = lpt_set_backlight; panel->backlight.get = lpt_get_backlight; if (HAS_PCH_LPT(dev_priv)) panel->backlight.hz_to_pwm = lpt_hz_to_pwm; else panel->backlight.hz_to_pwm = spt_hz_to_pwm; } else if (HAS_PCH_SPLIT(dev_priv)) { panel->backlight.setup = pch_setup_backlight; panel->backlight.enable = pch_enable_backlight; panel->backlight.disable = pch_disable_backlight; panel->backlight.set = pch_set_backlight; panel->backlight.get = pch_get_backlight; panel->backlight.hz_to_pwm = pch_hz_to_pwm; } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { if (connector->base.connector_type == DRM_MODE_CONNECTOR_DSI) { panel->backlight.setup = pwm_setup_backlight; panel->backlight.enable = pwm_enable_backlight; panel->backlight.disable = pwm_disable_backlight; panel->backlight.set = pwm_set_backlight; panel->backlight.get = pwm_get_backlight; } else { panel->backlight.setup = vlv_setup_backlight; panel->backlight.enable = vlv_enable_backlight; panel->backlight.disable = vlv_disable_backlight; panel->backlight.set = vlv_set_backlight; panel->backlight.get = vlv_get_backlight; panel->backlight.hz_to_pwm = vlv_hz_to_pwm; } } else if (IS_GEN4(dev_priv)) { panel->backlight.setup = i965_setup_backlight; panel->backlight.enable = i965_enable_backlight; panel->backlight.disable = i965_disable_backlight; panel->backlight.set = i9xx_set_backlight; panel->backlight.get = i9xx_get_backlight; panel->backlight.hz_to_pwm = i965_hz_to_pwm; } else { panel->backlight.setup = i9xx_setup_backlight; panel->backlight.enable = i9xx_enable_backlight; panel->backlight.disable = i9xx_disable_backlight; panel->backlight.set = i9xx_set_backlight; panel->backlight.get = i9xx_get_backlight; panel->backlight.hz_to_pwm = i9xx_hz_to_pwm; } }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula35977.04%956.25%
shobhit kumarshobhit kumar357.51%16.25%
vandana kannanvandana kannan347.30%16.25%
daniel vetterdaniel vetter234.94%16.25%
rodrigo vivirodrigo vivi51.07%16.25%
wayne boyerwayne boyer40.86%16.25%
satheeshakrishna msatheeshakrishna m30.64%16.25%
matthew garrettmatthew garrett30.64%16.25%
Total466100.00%16100.00%


int intel_panel_init(struct intel_panel *panel, struct drm_display_mode *fixed_mode, struct drm_display_mode *downclock_mode) { intel_panel_init_backlight_funcs(panel); panel->fixed_mode = fixed_mode; panel->downclock_mode = downclock_mode; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula2972.50%375.00%
vandana kannanvandana kannan1127.50%125.00%
Total40100.00%4100.00%


void intel_panel_fini(struct intel_panel *panel) { struct intel_connector *intel_connector = container_of(panel, struct intel_connector, panel); if (panel->fixed_mode) drm_mode_destroy(intel_connector->base.dev, panel->fixed_mode); if (panel->downclock_mode) drm_mode_destroy(intel_connector->base.dev, panel->downclock_mode); }

Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula4469.84%266.67%
vandana kannanvandana kannan1930.16%133.33%
Total63100.00%3100.00%


void intel_backlight_register(struct drm_device *dev) { struct intel_connector *connector; for_each_intel_connector(dev, connector) intel_backlight_device_register(connector); }

Contributors

PersonTokensPropCommitsCommitProp
ville syrjalaville syrjala2388.46%150.00%
jani nikulajani nikula311.54%150.00%
Total26100.00%2100.00%


void intel_backlight_unregister(struct drm_device *dev) { struct intel_connector *connector; for_each_intel_connector(dev, connector) intel_backlight_device_unregister(connector); }

Contributors

PersonTokensPropCommitsCommitProp
ville syrjalaville syrjala2388.46%150.00%
jani nikulajani nikula311.54%150.00%
Total26100.00%2100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
jani nikulajani nikula474955.39%4336.75%
jesse barnesjesse barnes7739.02%65.13%
daniel vetterdaniel vetter6167.19%86.84%
ville syrjalaville syrjala4525.27%1714.53%
chris wilsonchris wilson4395.12%65.13%
shobhit kumarshobhit kumar4365.09%10.85%
vandana kannanvandana kannan4034.70%32.56%
sunil kamathsunil kamath2853.32%10.85%
matthew garrettmatthew garrett1061.24%10.85%
takashi iwaitakashi iwai780.91%21.71%
paulo zanonipaulo zanoni500.58%21.71%
carsten emdecarsten emde470.55%21.71%
scot doylescot doyle230.27%21.71%
adam jacksonadam jackson180.21%10.85%
ben widawskyben widawsky130.15%21.71%
ander conselvan de oliveiraander conselvan de oliveira120.14%21.71%
boris brezillonboris brezillon100.12%10.85%
rob clarkrob clark80.09%10.85%
joe perchesjoe perches70.08%10.85%
imre deakimre deak70.08%10.85%
jeremiah mahlerjeremiah mahler60.07%10.85%
rodrigo vivirodrigo vivi50.06%10.85%
keith packardkeith packard50.06%10.85%
wayne boyerwayne boyer40.05%10.85%
corentin charycorentin chary30.03%10.85%
satheeshakrishna msatheeshakrishna m30.03%10.85%
javi merinojavi merino30.03%10.85%
aaron luaaron lu30.03%10.85%
damien lespiaudamien lespiau20.02%10.85%
u. artie eoffu. artie eoff20.02%10.85%
joonas lahtinenjoonas lahtinen20.02%10.85%
lukas wunnerlukas wunner10.01%10.85%
stephane marchesinstephane marchesin10.01%10.85%
dan williamsdan williams10.01%10.85%
Total8573100.00%117100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}