Lines Matching refs:dev
32 __FBSDID("$FreeBSD: releng/11.0/sys/dev/drm2/i915/intel_panel.c 296548 2016-03-08 20:33:02Z dumbbell $");
36 #include <dev/drm2/drmP.h>
37 #include <dev/drm2/i915/intel_drv.h>
60 intel_pch_panel_fitting(struct drm_device *dev,
65 struct drm_i915_private *dev_priv = dev->dev_private;
123 static int is_backlight_combination_mode(struct drm_device *dev)
125 struct drm_i915_private *dev_priv = dev->dev_private;
127 if (INTEL_INFO(dev)->gen >= 4)
130 if (IS_GEN2(dev))
136 static u32 i915_read_blc_pwm_ctl(struct drm_device *dev)
138 struct drm_i915_private *dev_priv = dev->dev_private;
143 if (HAS_PCH_SPLIT(dev_priv->dev)) {
155 if (INTEL_INFO(dev)->gen >= 4)
161 if (INTEL_INFO(dev)->gen >= 4)
170 static u32 _intel_panel_get_max_backlight(struct drm_device *dev)
174 max = i915_read_blc_pwm_ctl(dev);
176 if (HAS_PCH_SPLIT(dev)) {
179 if (INTEL_INFO(dev)->gen < 4)
184 if (is_backlight_combination_mode(dev))
191 u32 intel_panel_get_max_backlight(struct drm_device *dev)
195 max = _intel_panel_get_max_backlight(dev);
216 static u32 intel_panel_compute_brightness(struct drm_device *dev, u32 val)
218 struct drm_i915_private *dev_priv = dev->dev_private;
225 return intel_panel_get_max_backlight(dev) - val;
230 static u32 intel_panel_get_backlight(struct drm_device *dev)
232 struct drm_i915_private *dev_priv = dev->dev_private;
235 if (HAS_PCH_SPLIT(dev)) {
239 if (INTEL_INFO(dev)->gen < 4)
242 if (is_backlight_combination_mode(dev)) {
245 pci_read_config_byte(dev->dev, PCI_LBPC, &lbpc);
250 val = intel_panel_compute_brightness(dev, val);
255 static void intel_pch_panel_set_backlight(struct drm_device *dev, u32 level)
257 struct drm_i915_private *dev_priv = dev->dev_private;
262 static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level)
264 struct drm_i915_private *dev_priv = dev->dev_private;
268 level = intel_panel_compute_brightness(dev, level);
270 if (HAS_PCH_SPLIT(dev))
271 return intel_pch_panel_set_backlight(dev, level);
273 if (is_backlight_combination_mode(dev)) {
274 u32 max = intel_panel_get_max_backlight(dev);
279 pci_write_config_byte(dev->dev, PCI_LBPC, lbpc);
283 if (INTEL_INFO(dev)->gen < 4)
289 void intel_panel_set_backlight(struct drm_device *dev, u32 level)
291 struct drm_i915_private *dev_priv = dev->dev_private;
295 intel_panel_actually_set_backlight(dev, level);
298 void intel_panel_disable_backlight(struct drm_device *dev)
300 struct drm_i915_private *dev_priv = dev->dev_private;
303 intel_panel_actually_set_backlight(dev, 0);
305 if (INTEL_INFO(dev)->gen >= 4) {
308 reg = HAS_PCH_SPLIT(dev) ? BLC_PWM_CPU_CTL2 : BLC_PWM_CTL2;
312 if (HAS_PCH_SPLIT(dev)) {
320 void intel_panel_enable_backlight(struct drm_device *dev,
323 struct drm_i915_private *dev_priv = dev->dev_private;
326 dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
328 if (INTEL_INFO(dev)->gen >= 4) {
331 reg = HAS_PCH_SPLIT(dev) ? BLC_PWM_CPU_CTL2 : BLC_PWM_CTL2;
354 if (HAS_PCH_SPLIT(dev)) {
368 intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
371 static void intel_panel_init_backlight(struct drm_device *dev)
373 struct drm_i915_private *dev_priv = dev->dev_private;
375 dev_priv->backlight_level = intel_panel_get_backlight(dev);
380 intel_panel_detect(struct drm_device *dev)
382 struct drm_i915_private *dev_priv = dev->dev_private;
404 struct drm_device *dev = bl_get_data(bd);
405 intel_panel_set_backlight(dev, bd->props.brightness);
411 struct drm_device *dev = bl_get_data(bd);
412 struct drm_i915_private *dev_priv = dev->dev_private;
423 struct drm_device *dev = connector->dev;
424 struct drm_i915_private *dev_priv = dev->dev_private;
427 intel_panel_init_backlight(dev);
434 props.max_brightness = _intel_panel_get_max_backlight(dev);
441 &connector->kdev, dev,
450 dev_priv->backlight->props.brightness = intel_panel_get_backlight(dev);
454 void intel_panel_destroy_backlight(struct drm_device *dev)
456 struct drm_i915_private *dev_priv = dev->dev_private;
465 intel_panel_init_backlight(connector->dev);
469 void intel_panel_destroy_backlight(struct drm_device *dev)
489 drm_mode_destroy(intel_connector->base.dev, panel->fixed_mode);