linux/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c

/*
 * Copyright © 2015 Intel Corporation
 *
 * 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.
 *
 */

/*
 * Laptops with Intel GPUs which have panels that support controlling the
 * backlight through DP AUX can actually use two different interfaces: Intel's
 * proprietary DP AUX backlight interface, and the standard VESA backlight
 * interface. Unfortunately, at the time of writing this a lot of laptops will
 * advertise support for the standard VESA backlight interface when they
 * don't properly support it. However, on these systems the Intel backlight
 * interface generally does work properly. Additionally, these systems will
 * usually just indicate that they use PWM backlight controls in their VBIOS
 * for some reason.
 */

#include "i915_drv.h"
#include "intel_backlight.h"
#include "intel_display_types.h"
#include "intel_dp.h"
#include "intel_dp_aux_backlight.h"

/*
 * DP AUX registers for Intel's proprietary HDR backlight interface. We define
 * them here since we'll likely be the only driver to ever use these.
 */
#define INTEL_EDP_HDR_TCON_CAP0

#define INTEL_EDP_HDR_TCON_CAP1
#define INTEL_EDP_HDR_TCON_2084_DECODE_CAP
#define INTEL_EDP_HDR_TCON_2020_GAMUT_CAP
#define INTEL_EDP_HDR_TCON_TONE_MAPPING_CAP
#define INTEL_EDP_HDR_TCON_SEGMENTED_BACKLIGHT_CAP
#define INTEL_EDP_HDR_TCON_BRIGHTNESS_NITS_CAP
#define INTEL_EDP_HDR_TCON_OPTIMIZATION_CAP
#define INTEL_EDP_HDR_TCON_SDP_COLORIMETRY_CAP
#define INTEL_EDP_HDR_TCON_SRGB_TO_PANEL_GAMUT_CONVERSION_CAP

#define INTEL_EDP_HDR_TCON_CAP2
#define INTEL_EDP_SDR_TCON_BRIGHTNESS_AUX_CAP

#define INTEL_EDP_HDR_TCON_CAP3

#define INTEL_EDP_HDR_GETSET_CTRL_PARAMS
#define INTEL_EDP_HDR_TCON_2084_DECODE_ENABLE
#define INTEL_EDP_HDR_TCON_2020_GAMUT_ENABLE
#define INTEL_EDP_HDR_TCON_TONE_MAPPING_ENABLE
#define INTEL_EDP_HDR_TCON_SEGMENTED_BACKLIGHT_ENABLE
#define INTEL_EDP_HDR_TCON_BRIGHTNESS_AUX_ENABLE
#define INTEL_EDP_HDR_TCON_SRGB_TO_PANEL_GAMUT_ENABLE
/* Bit 6 is reserved */
#define INTEL_EDP_HDR_TCON_SDP_OVERRIDE_AUX

#define INTEL_EDP_HDR_CONTENT_LUMINANCE
#define INTEL_EDP_HDR_PANEL_LUMINANCE_OVERRIDE
#define INTEL_EDP_SDR_LUMINANCE_LEVEL
#define INTEL_EDP_BRIGHTNESS_NITS_LSB
#define INTEL_EDP_BRIGHTNESS_NITS_MSB
#define INTEL_EDP_BRIGHTNESS_DELAY_FRAMES
#define INTEL_EDP_BRIGHTNESS_PER_FRAME_STEPS

#define INTEL_EDP_BRIGHTNESS_OPTIMIZATION_0
#define INTEL_EDP_TCON_USAGE_MASK
#define INTEL_EDP_TCON_USAGE_UNKNOWN
#define INTEL_EDP_TCON_USAGE_DESKTOP
#define INTEL_EDP_TCON_USAGE_FULL_SCREEN_MEDIA
#define INTEL_EDP_TCON_USAGE_FULL_SCREEN_GAMING
#define INTEL_EDP_TCON_POWER_MASK
#define INTEL_EDP_TCON_POWER_DC
#define INTEL_EDP_TCON_POWER_AC
#define INTEL_EDP_TCON_OPTIMIZATION_STRENGTH_MASK

#define INTEL_EDP_BRIGHTNESS_OPTIMIZATION_1

enum intel_dp_aux_backlight_modparam {};

static bool is_intel_tcon_cap(const u8 tcon_cap[4])
{}

/* Intel EDP backlight callbacks */
static bool
intel_dp_aux_supports_hdr_backlight(struct intel_connector *connector)
{}

static u32
intel_dp_aux_hdr_get_backlight(struct intel_connector *connector, enum pipe pipe)
{}

static void
intel_dp_aux_hdr_set_aux_backlight(const struct drm_connector_state *conn_state, u32 level)
{}

static bool
intel_dp_in_hdr_mode(const struct drm_connector_state *conn_state)
{}

static void
intel_dp_aux_hdr_set_backlight(const struct drm_connector_state *conn_state, u32 level)
{}

static void
intel_dp_aux_write_content_luminance(struct intel_connector *connector,
				     struct hdr_output_metadata *hdr_metadata)
{}

static void
intel_dp_aux_fill_hdr_tcon_params(const struct drm_connector_state *conn_state, u8 *ctrl)
{}

static void
intel_dp_aux_hdr_enable_backlight(const struct intel_crtc_state *crtc_state,
				  const struct drm_connector_state *conn_state, u32 level)
{}

static void
intel_dp_aux_hdr_disable_backlight(const struct drm_connector_state *conn_state, u32 level)
{}

static const char *dpcd_vs_pwm_str(bool aux)
{}

static void
intel_dp_aux_write_panel_luminance_override(struct intel_connector *connector)
{}

static int
intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pipe)
{}

/* VESA backlight callbacks */
static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, enum pipe unused)
{}

static void
intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, u32 level)
{}

static void
intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state,
				   const struct drm_connector_state *conn_state, u32 level)
{}

static void intel_dp_aux_vesa_disable_backlight(const struct drm_connector_state *old_conn_state,
						u32 level)
{}

static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector, enum pipe pipe)
{}

static bool
intel_dp_aux_supports_vesa_backlight(struct intel_connector *connector)
{}

static const struct intel_panel_bl_funcs intel_dp_hdr_bl_funcs =;

static const struct intel_panel_bl_funcs intel_dp_vesa_bl_funcs =;

int intel_dp_aux_init_backlight_funcs(struct intel_connector *connector)
{}