FILE
intel_display_params.c
File preview with syntax highlighting.
linux-6.19.14/drivers/gpu/drm/i915/display/intel_display_params.c
1// SPDX-License-Identifier: MIT 2/* 3 * Copyright © 2023 Intel Corporation 4 */ 5 6#include <linux/moduleparam.h> 7#include <linux/slab.h> 8#include <linux/string_choices.h> 9 10#include <drm/drm_print.h> 11 12#include "intel_display_params.h" 13 14#define intel_display_param_named(name, T, perm, desc) \ 15 module_param_named(name, intel_display_modparams.name, T, perm); \ 16 MODULE_PARM_DESC(name, desc) 17#define intel_display_param_named_unsafe(name, T, perm, desc) \ 18 module_param_named_unsafe(name, intel_display_modparams.name, T, perm); \ 19 MODULE_PARM_DESC(name, desc) 20 21static struct intel_display_params intel_display_modparams __read_mostly = { 22#define MEMBER(T, member, value, ...) .member = (value), 23 INTEL_DISPLAY_PARAMS_FOR_EACH(MEMBER) 24#undef MEMBER 25}; 26/* 27 * Note: As a rule, keep module parameter sysfs permissions read-only 28 * 0400. Runtime changes are only supported through i915 debugfs. 29 * 30 * For any exceptions requiring write access and runtime changes through module 31 * parameter sysfs, prevent debugfs file creation by setting the parameter's 32 * debugfs mode to 0. 33 */ 34 35intel_display_param_named_unsafe(dmc_firmware_path, charp, 0400, 36 "DMC firmware path to use instead of the default one. " 37 "Use /dev/null to disable DMC and runtime PM."); 38 39intel_display_param_named_unsafe(vbt_firmware, charp, 0400, 40 "Load VBT from specified file under /lib/firmware"); 41 42intel_display_param_named_unsafe(lvds_channel_mode, int, 0400, 43 "Specify LVDS channel mode " 44 "(0=probe BIOS [default], 1=single-channel, 2=dual-channel)"); 45 46intel_display_param_named_unsafe(panel_use_ssc, int, 0400, 47 "Use Spread Spectrum Clock with panels [LVDS/eDP] " 48 "(default: auto from VBT)"); 49 50intel_display_param_named_unsafe(vbt_sdvo_panel_type, int, 0400, 51 "Override/Ignore selection of SDVO panel mode in the VBT " 52 "(-2=ignore, -1=auto [default], index in VBT BIOS table)"); 53 54intel_display_param_named_unsafe(enable_dc, int, 0400, 55 "Enable power-saving display C-states. " 56 "(-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; " 57 "3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO)"); 58 59intel_display_param_named_unsafe(enable_dpt, bool, 0400, 60 "Enable display page table (DPT) (default: true)"); 61 62intel_display_param_named_unsafe(enable_dsb, bool, 0400, 63 "Enable display state buffer (DSB) (default: true)"); 64 65intel_display_param_named_unsafe(enable_flipq, bool, 0400, 66 "Enable DMC flip queue (default: false)"); 67 68intel_display_param_named_unsafe(enable_sagv, bool, 0400, 69 "Enable system agent voltage/frequency scaling (SAGV) (default: true)"); 70 71intel_display_param_named_unsafe(disable_power_well, int, 0400, 72 "Disable display power wells when possible " 73 "(-1=auto [default], 0=power wells always on, 1=power wells disabled when possible)"); 74 75intel_display_param_named_unsafe(enable_ips, bool, 0400, "Enable IPS (default: true)"); 76 77intel_display_param_named_unsafe(invert_brightness, int, 0400, 78 "Invert backlight brightness " 79 "(-1 force normal, 0 machine defaults, 1 force inversion), please " 80 "report PCI device ID, subsystem vendor and subsystem device ID " 81 "to dri-devel@lists.freedesktop.org, if your machine needs it. " 82 "It will then be included in an upcoming module version."); 83 84/* WA to get away with the default setting in VBT for early platforms.Will be removed */ 85intel_display_param_named_unsafe(edp_vswing, int, 0400, 86 "Ignore/Override vswing pre-emph table selection from VBT " 87 "(0=use value from vbt [default], 1=low power swing(200mV)," 88 "2=default swing(400mV))"); 89 90intel_display_param_named(enable_dpcd_backlight, int, 0400, 91 "Enable support for DPCD backlight control" 92 "(-1=use per-VBT LFP backlight type setting [default], 0=disabled, 1=enable, 2=force VESA interface, 3=force Intel interface)"); 93 94intel_display_param_named_unsafe(load_detect_test, bool, 0400, 95 "Force-enable the VGA load detect code for testing (default:false). " 96 "For developers only."); 97 98intel_display_param_named_unsafe(force_reset_modeset_test, bool, 0400, 99 "Force a modeset during gpu reset for testing (default:false). " 100 "For developers only."); 101 102intel_display_param_named(disable_display, bool, 0400, 103 "Disable display (default: false)"); 104 105intel_display_param_named(verbose_state_checks, bool, 0400, 106 "Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions."); 107 108intel_display_param_named_unsafe(nuclear_pageflip, bool, 0400, 109 "Force enable atomic functionality on platforms that don't have full support yet."); 110 111intel_display_param_named_unsafe(enable_dp_mst, bool, 0400, 112 "Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true)"); 113 114intel_display_param_named_unsafe(enable_fbc, int, 0400, 115 "Enable frame buffer compression for power savings " 116 "(default: -1 (use per-chip default))"); 117 118intel_display_param_named_unsafe(enable_psr, int, 0400, 119 "Enable PSR " 120 "(0=disabled, 1=enable up to PSR1, 2=enable up to PSR2) " 121 "Default: -1 (use per-chip default)"); 122 123intel_display_param_named_unsafe(enable_panel_replay, int, 0400, 124 "Enable Panel Replay (0=disabled, 1=enabled). Default: -1 (use per-chip default)"); 125 126intel_display_param_named(psr_safest_params, bool, 0400, 127 "Replace PSR VBT parameters by the safest and not optimal ones. This " 128 "is helpful to detect if PSR issues are related to bad values set in " 129 " VBT. (0=use VBT parameters, 1=use safest parameters)" 130 "Default: 0"); 131 132intel_display_param_named_unsafe(enable_psr2_sel_fetch, bool, 0400, 133 "Enable PSR2 and Panel Replay selective fetch " 134 "(0=disabled, 1=enabled) " 135 "Default: 1"); 136 137intel_display_param_named_unsafe(enable_dmc_wl, int, 0400, 138 "Enable DMC wakelock " 139 "(-1=use per-chip default, 0=disabled, 1=enabled, 2=match any register, 3=always locked) " 140 "Default: -1"); 141 142__maybe_unused 143static void _param_print_bool(struct drm_printer *p, const char *driver_name, 144 const char *name, bool val) 145{ 146 drm_printf(p, "%s.%s=%s\n", driver_name, name, str_yes_no(val)); 147} 148 149__maybe_unused 150static void _param_print_int(struct drm_printer *p, const char *driver_name, 151 const char *name, int val) 152{ 153 drm_printf(p, "%s.%s=%d\n", driver_name, name, val); 154} 155 156__maybe_unused 157static void _param_print_uint(struct drm_printer *p, const char *driver_name, 158 const char *name, unsigned int val) 159{ 160 drm_printf(p, "%s.%s=%u\n", driver_name, name, val); 161} 162 163__maybe_unused 164static void _param_print_ulong(struct drm_printer *p, const char *driver_name, 165 const char *name, unsigned long val) 166{ 167 drm_printf(p, "%s.%s=%lu\n", driver_name, name, val); 168} 169 170__maybe_unused 171static void _param_print_charp(struct drm_printer *p, const char *driver_name, 172 const char *name, const char *val) 173{ 174 drm_printf(p, "%s.%s=%s\n", driver_name, name, val); 175} 176 177#define _param_print(p, driver_name, name, val) \ 178 _Generic(val, \ 179 bool : _param_print_bool, \ 180 int : _param_print_int, \ 181 unsigned int : _param_print_uint, \ 182 unsigned long : _param_print_ulong, \ 183 char * : _param_print_charp)(p, driver_name, name, val) 184 185/** 186 * intel_display_params_dump - dump intel display modparams 187 * @params: display params 188 * @driver_name: driver name to use for printing 189 * @p: the &drm_printer 190 * 191 * Pretty printer for i915 modparams. 192 */ 193void intel_display_params_dump(const struct intel_display_params *params, 194 const char *driver_name, struct drm_printer *p) 195{ 196#define PRINT(T, x, ...) _param_print(p, driver_name, #x, params->x); 197 INTEL_DISPLAY_PARAMS_FOR_EACH(PRINT); 198#undef PRINT 199} 200 201__maybe_unused static void _param_dup_charp(char **valp) 202{ 203 *valp = kstrdup(*valp ? *valp : "", GFP_ATOMIC); 204} 205 206__maybe_unused static void _param_nop(void *valp) 207{ 208} 209 210#define _param_dup(valp) \ 211 _Generic(valp, \ 212 char ** : _param_dup_charp, \ 213 default : _param_nop) \ 214 (valp) 215 216void intel_display_params_copy(struct intel_display_params *dest) 217{ 218 *dest = intel_display_modparams; 219#define DUP(T, x, ...) _param_dup(&dest->x); 220 INTEL_DISPLAY_PARAMS_FOR_EACH(DUP); 221#undef DUP 222} 223 224__maybe_unused static void _param_free_charp(char **valp) 225{ 226 kfree(*valp); 227 *valp = NULL; 228} 229 230#define _param_free(valp) \ 231 _Generic(valp, \ 232 char ** : _param_free_charp, \ 233 default : _param_nop) \ 234 (valp) 235 236/* free the allocated members, *not* the passed in params itself */ 237void intel_display_params_free(struct intel_display_params *params) 238{ 239#define FREE(T, x, ...) _param_free(¶ms->x); 240 INTEL_DISPLAY_PARAMS_FOR_EACH(FREE); 241#undef FREE 242}
~/
Read-only file preview.