Skip to content

Commit 068d6e9

Browse files
committed
drm/i915/dmc: change how to disable DMC firmware using module param
The distinction between the dmc_firmware_path module param being NULL and the empty string "" is problematic. It's not possible to set the parameter back to NULL via sysfs or debugfs. Remove the distinction, and consider NULL and the empty string to be the same thing, and use the platform default for them. This removes the possibility to disable DMC (and runtime PM) via i915.dmc_firmware_path="". Instead, use "/dev/null" as the magic firmware path to skip DMC firmware loading and disable runtime PM. v2: Add support for i915.dmc_firmware_path="/dev/null" (Gustavo) Cc: Gustavo Sousa <[email protected]> Cc: Lucas De Marchi <[email protected]> Reviewed-by: Gustavo Sousa <[email protected]> Acked-by: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/8695aca8a6643e36bb680bc2dcab97c637e70b00.1713519628.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <[email protected]>
1 parent 3ffccdd commit 068d6e9

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

drivers/gpu/drm/i915/display/intel_dmc.c

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ static struct intel_dmc *i915_to_dmc(struct drm_i915_private *i915)
7373
return i915->display.dmc.dmc;
7474
}
7575

76+
static const char *dmc_firmware_param(struct drm_i915_private *i915)
77+
{
78+
const char *p = i915->params.dmc_firmware_path;
79+
80+
return p && *p ? p : NULL;
81+
}
82+
83+
static bool dmc_firmware_param_disabled(struct drm_i915_private *i915)
84+
{
85+
const char *p = dmc_firmware_param(i915);
86+
87+
/* Magic path to indicate disabled */
88+
return p && !strcmp(p, "/dev/null");
89+
}
90+
7691
#define DMC_VERSION(major, minor) ((major) << 16 | (minor))
7792
#define DMC_VERSION_MAJOR(version) ((version) >> 16)
7893
#define DMC_VERSION_MINOR(version) ((version) & 0xffff)
@@ -991,7 +1006,7 @@ static void dmc_load_work_fn(struct work_struct *work)
9911006

9921007
err = request_firmware(&fw, dmc->fw_path, i915->drm.dev);
9931008

994-
if (err == -ENOENT && !i915->params.dmc_firmware_path) {
1009+
if (err == -ENOENT && !dmc_firmware_param(i915)) {
9951010
fallback_path = dmc_fallback_path(i915);
9961011
if (fallback_path) {
9971012
drm_dbg_kms(&i915->drm, "%s not found, falling back to %s\n",
@@ -1064,16 +1079,14 @@ void intel_dmc_init(struct drm_i915_private *i915)
10641079

10651080
dmc->fw_path = dmc_firmware_default(i915, &dmc->max_fw_size);
10661081

1067-
if (i915->params.dmc_firmware_path) {
1068-
if (strlen(i915->params.dmc_firmware_path) == 0) {
1069-
drm_info(&i915->drm,
1070-
"Disabling DMC firmware and runtime PM\n");
1071-
goto out;
1072-
}
1073-
1074-
dmc->fw_path = i915->params.dmc_firmware_path;
1082+
if (dmc_firmware_param_disabled(i915)) {
1083+
drm_info(&i915->drm, "Disabling DMC firmware and runtime PM\n");
1084+
goto out;
10751085
}
10761086

1087+
if (dmc_firmware_param(i915))
1088+
dmc->fw_path = dmc_firmware_param(i915);
1089+
10771090
if (!dmc->fw_path) {
10781091
drm_dbg_kms(&i915->drm,
10791092
"No known DMC firmware for platform, disabling runtime PM\n");

drivers/gpu/drm/i915/i915_params.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ i915_param_named_unsafe(huc_firmware_path, charp, 0400,
109109
"HuC firmware path to use instead of the default one");
110110

111111
i915_param_named_unsafe(dmc_firmware_path, charp, 0400,
112-
"DMC firmware path to use instead of the default one");
112+
"DMC firmware path to use instead of the default one. "
113+
"Use /dev/null to disable DMC and runtime PM.");
113114

114115
i915_param_named_unsafe(gsc_firmware_path, charp, 0400,
115116
"GSC firmware path to use instead of the default one");

0 commit comments

Comments
 (0)