Commit 6cc42fbe authored by Jani Nikula's avatar Jani Nikula

drm/i915/backlight: extract backlight code to a separate file

In a long overdue refactoring, split out backlight code to new
intel_backlight.[ch]. Simple code movement, leave renames for follow-up
work. No functional changes.

Cc: Lyude Paul <lyude@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/97d310848f03061473b9b2328e2c5c4dcf263cfa.1629888677.git.jani.nikula@intel.com
parent d3252e1a
...@@ -249,6 +249,7 @@ i915-y += \ ...@@ -249,6 +249,7 @@ i915-y += \
display/g4x_dp.o \ display/g4x_dp.o \
display/g4x_hdmi.o \ display/g4x_hdmi.o \
display/icl_dsi.o \ display/icl_dsi.o \
display/intel_backlight.o \
display/intel_crt.o \ display/intel_crt.o \
display/intel_ddi.o \ display/intel_ddi.o \
display/intel_ddi_buf_trans.o \ display/intel_ddi_buf_trans.o \
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "g4x_dp.h" #include "g4x_dp.h"
#include "intel_audio.h" #include "intel_audio.h"
#include "intel_backlight.h"
#include "intel_connector.h" #include "intel_connector.h"
#include "intel_de.h" #include "intel_de.h"
#include "intel_display_types.h" #include "intel_display_types.h"
...@@ -16,7 +17,6 @@ ...@@ -16,7 +17,6 @@
#include "intel_fifo_underrun.h" #include "intel_fifo_underrun.h"
#include "intel_hdmi.h" #include "intel_hdmi.h"
#include "intel_hotplug.h" #include "intel_hotplug.h"
#include "intel_panel.h"
#include "intel_pps.h" #include "intel_pps.h"
#include "intel_sideband.h" #include "intel_sideband.h"
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <drm/drm_mipi_dsi.h> #include <drm/drm_mipi_dsi.h>
#include "intel_atomic.h" #include "intel_atomic.h"
#include "intel_backlight.h"
#include "intel_combo_phy.h" #include "intel_combo_phy.h"
#include "intel_connector.h" #include "intel_connector.h"
#include "intel_crtc.h" #include "intel_crtc.h"
......
This diff is collapsed.
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2021 Intel Corporation
*/
#ifndef __INTEL_BACKLIGHT_H__
#define __INTEL_BACKLIGHT_H__
#include <linux/types.h>
struct drm_connector;
struct drm_connector_state;
struct intel_atomic_state;
struct intel_connector;
struct intel_crtc_state;
struct intel_encoder;
struct intel_panel;
enum pipe;
void intel_panel_init_backlight_funcs(struct intel_panel *panel);
void intel_panel_destroy_backlight(struct intel_panel *panel);
void intel_panel_set_backlight_acpi(const struct drm_connector_state *conn_state,
u32 level, u32 max);
int intel_panel_setup_backlight(struct drm_connector *connector,
enum pipe pipe);
void intel_panel_enable_backlight(const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state);
void intel_panel_update_backlight(struct intel_atomic_state *state,
struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state);
void intel_panel_disable_backlight(const struct drm_connector_state *old_conn_state);
void intel_panel_set_pwm_level(const struct drm_connector_state *conn_state, u32 level);
u32 intel_panel_invert_pwm_level(struct intel_connector *connector, u32 level);
u32 intel_panel_backlight_level_to_pwm(struct intel_connector *connector, u32 level);
u32 intel_panel_backlight_level_from_pwm(struct intel_connector *connector, u32 val);
#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
int intel_backlight_device_register(struct intel_connector *connector);
void intel_backlight_device_unregister(struct intel_connector *connector);
#else /* CONFIG_BACKLIGHT_CLASS_DEVICE */
static inline int intel_backlight_device_register(struct intel_connector *connector)
{
return 0;
}
static inline void intel_backlight_device_unregister(struct intel_connector *connector)
{
}
#endif /* CONFIG_BACKLIGHT_CLASS_DEVICE */
#endif /* __INTEL_BACKLIGHT_H__ */
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_edid.h> #include <drm/drm_edid.h>
#include "display/intel_panel.h"
#include "i915_drv.h" #include "i915_drv.h"
#include "intel_backlight.h"
#include "intel_connector.h" #include "intel_connector.h"
#include "intel_display_debugfs.h" #include "intel_display_debugfs.h"
#include "intel_display_types.h" #include "intel_display_types.h"
#include "intel_hdcp.h" #include "intel_hdcp.h"
#include "intel_panel.h"
int intel_connector_init(struct intel_connector *connector) int intel_connector_init(struct intel_connector *connector)
{ {
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "i915_drv.h" #include "i915_drv.h"
#include "intel_audio.h" #include "intel_audio.h"
#include "intel_backlight.h"
#include "intel_combo_phy.h" #include "intel_combo_phy.h"
#include "intel_connector.h" #include "intel_connector.h"
#include "intel_crtc.h" #include "intel_crtc.h"
...@@ -48,7 +49,6 @@ ...@@ -48,7 +49,6 @@
#include "intel_hdmi.h" #include "intel_hdmi.h"
#include "intel_hotplug.h" #include "intel_hotplug.h"
#include "intel_lspcon.h" #include "intel_lspcon.h"
#include "intel_panel.h"
#include "intel_pps.h" #include "intel_pps.h"
#include "intel_psr.h" #include "intel_psr.h"
#include "intel_snps_phy.h" #include "intel_snps_phy.h"
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "i915_drv.h" #include "i915_drv.h"
#include "intel_atomic.h" #include "intel_atomic.h"
#include "intel_audio.h" #include "intel_audio.h"
#include "intel_backlight.h"
#include "intel_connector.h" #include "intel_connector.h"
#include "intel_ddi.h" #include "intel_ddi.h"
#include "intel_de.h" #include "intel_de.h"
......
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
* for some reason. * for some reason.
*/ */
#include "intel_backlight.h"
#include "intel_display_types.h" #include "intel_display_types.h"
#include "intel_dp_aux_backlight.h" #include "intel_dp_aux_backlight.h"
#include "intel_panel.h"
/* TODO: /* TODO:
* Implement HDR, right now we just implement the bare minimum to bring us back into SDR mode so we * Implement HDR, right now we just implement the bare minimum to bring us back into SDR mode so we
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "i915_drv.h" #include "i915_drv.h"
#include "intel_atomic.h" #include "intel_atomic.h"
#include "intel_backlight.h"
#include "intel_connector.h" #include "intel_connector.h"
#include "intel_de.h" #include "intel_de.h"
#include "intel_display_types.h" #include "intel_display_types.h"
......
...@@ -30,10 +30,9 @@ ...@@ -30,10 +30,9 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include <acpi/video.h> #include <acpi/video.h>
#include "display/intel_panel.h"
#include "i915_drv.h" #include "i915_drv.h"
#include "intel_acpi.h" #include "intel_acpi.h"
#include "intel_backlight.h"
#include "intel_display_types.h" #include "intel_display_types.h"
#include "intel_opregion.h" #include "intel_opregion.h"
......
This diff is collapsed.
...@@ -8,15 +8,13 @@ ...@@ -8,15 +8,13 @@
#include <linux/types.h> #include <linux/types.h>
#include "intel_display.h" enum drm_connector_status;
struct drm_connector; struct drm_connector;
struct drm_connector_state; struct drm_connector_state;
struct drm_display_mode; struct drm_display_mode;
struct drm_i915_private;
struct intel_connector; struct intel_connector;
struct intel_crtc;
struct intel_crtc_state; struct intel_crtc_state;
struct intel_encoder;
struct intel_panel; struct intel_panel;
int intel_panel_init(struct intel_panel *panel, int intel_panel_init(struct intel_panel *panel,
...@@ -32,17 +30,6 @@ int intel_pch_panel_fitting(struct intel_crtc_state *crtc_state, ...@@ -32,17 +30,6 @@ int intel_pch_panel_fitting(struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state); const struct drm_connector_state *conn_state);
int intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state, int intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state); const struct drm_connector_state *conn_state);
void intel_panel_set_backlight_acpi(const struct drm_connector_state *conn_state,
u32 level, u32 max);
int intel_panel_setup_backlight(struct drm_connector *connector,
enum pipe pipe);
void intel_panel_enable_backlight(const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state);
void intel_panel_update_backlight(struct intel_atomic_state *state,
struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state);
void intel_panel_disable_backlight(const struct drm_connector_state *old_conn_state);
struct drm_display_mode * struct drm_display_mode *
intel_panel_edid_downclock_mode(struct intel_connector *connector, intel_panel_edid_downclock_mode(struct intel_connector *connector,
const struct drm_display_mode *fixed_mode); const struct drm_display_mode *fixed_mode);
...@@ -50,22 +37,5 @@ struct drm_display_mode * ...@@ -50,22 +37,5 @@ struct drm_display_mode *
intel_panel_edid_fixed_mode(struct intel_connector *connector); intel_panel_edid_fixed_mode(struct intel_connector *connector);
struct drm_display_mode * struct drm_display_mode *
intel_panel_vbt_fixed_mode(struct intel_connector *connector); intel_panel_vbt_fixed_mode(struct intel_connector *connector);
void intel_panel_set_pwm_level(const struct drm_connector_state *conn_state, u32 level);
u32 intel_panel_invert_pwm_level(struct intel_connector *connector, u32 level);
u32 intel_panel_backlight_level_to_pwm(struct intel_connector *connector, u32 level);
u32 intel_panel_backlight_level_from_pwm(struct intel_connector *connector, u32 val);
#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
int intel_backlight_device_register(struct intel_connector *connector);
void intel_backlight_device_unregister(struct intel_connector *connector);
#else /* CONFIG_BACKLIGHT_CLASS_DEVICE */
static inline int intel_backlight_device_register(struct intel_connector *connector)
{
return 0;
}
static inline void intel_backlight_device_unregister(struct intel_connector *connector)
{
}
#endif /* CONFIG_BACKLIGHT_CLASS_DEVICE */
#endif /* __INTEL_PANEL_H__ */ #endif /* __INTEL_PANEL_H__ */
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "i915_drv.h" #include "i915_drv.h"
#include "intel_atomic.h" #include "intel_atomic.h"
#include "intel_backlight.h"
#include "intel_connector.h" #include "intel_connector.h"
#include "intel_crtc.h" #include "intel_crtc.h"
#include "intel_de.h" #include "intel_de.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment