Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Purkait, Soham" <soham.purkait@intel.com>
To: Karthik Poosa <karthik.poosa@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <rodrigo.vivi@intel.com>, <anshuman.gupta@intel.com>,
	<badal.nilawar@intel.com>, <raag.jadav@intel.com>,
	<riana.tauro@intel.com>, <sk.anirban@intel.com>,
	<mallesh.koujalagi@intel.com>,
	<ravi.kishore.koppuravuri@intel.com>
Subject: Re: [PATCH v6 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable
Date: Tue, 1 Dec 2026 19:08:19 +0530	[thread overview]
Message-ID: <6503f6f7-7cdf-4e65-bb4b-838a9ec6595d@intel.com> (raw)
In-Reply-To: <20261130185050.36979-6-karthik.poosa@intel.com>


On 01-12-2026 00:20, Karthik Poosa wrote:
> Expose pwm[1-3]_enable to control the fan operating mode through
> the hwmon interface.
>
> Mode 0 forces the fan to run at full speed.
> Mode 1 enables user fan-table control.
> Mode 2 restores firmware-controlled fan management.
>
> pwm[1-3] writes now require pwm[1-3]_enable to be 1 first. Since fans
> start in mode 2 after probe, a pwm[1-3] write without selecting manual
> mode is rejected with -EINVAL.
>
> Document pwm[1-3]_enable in the Xe hwmon ABI.
>
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> ---
>
> v2:
>   - Use xe helpers for dmesg logs.
>   - Update kernel version in Xe hwmon documentation.
>   - Correct level of some dmesg logs.
>
> v3:
>   - Each pwm_enable mode now sets its own state; drop the redundant
>     post-switch pwm_enable_mode/is_full_speed update. (Badal)
>   - Fix misindented dead assignment in the stock-table branch.
>   - Make error handling consistent across pwm_enable modes. (Badal)
>   - Document the pwm[1-3] manual-mode write precondition in the ABI. (Badal)
>   - Use xe_pcode_write() instead of the timeout variant api as it is not
>     needed.
>
> v4:
>   - Rebase on reworked pwm[1-3] patch.
>   - Clamp min PWM to 100% when activating the user table, since fan
>     table speed is in percent.
>   - Drop redundant channel range check in pwm write.
>   - Use tab indentation and update Date and KernelVersion to November
>     2026 and 7.5 in the pwm[1-3]_enable ABI entry.
>
> v5:
>   - Address review comments from sashiko.
>   - Avoid returning pwm[1-3]_enable as XE_FAN_PWM_MANUAL_USER_TABLE, when
>     setting to full speed mode. (sashiko)
>   - Set default pwm[1-3]_enable to XE_FAN_PWM_AUTO_STOCK_TABLE after
>     probe. (sashiko)
>   - Make pwm[1-3]_enable visible only if stock fan table has valid point
>     count.
>   - Add flag XE_FAN_PWM_UNINITIALIZED.
>   - Fall back to the stock table if firmware does not accept a table.
>
> v6:
> - Remove is_full_speed as it is redundant with pwm_enable_mode now.
> - Rename xe_hwmon_get_stock_table_pwm() to xe_hwmon_get_active_table_pwm().
> - Avoid overwriting user table cache for full speed.
> - Align pwm_enable mode kernel-doc with the ABI wording. (Soham)
> - Add debug logs before -EINVAL returns. (Soham)
> - Note the pwm[1-3] write precondition in the commit message. (Soham)
>
>   .../ABI/testing/sysfs-driver-intel-xe-hwmon   |  19 ++
>   drivers/gpu/drm/xe/xe_hwmon.c                 | 229 +++++++++++++++---
>   2 files changed, 214 insertions(+), 34 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
> index 34c50f13f0b4..dbf2c6d01376 100644
> --- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
> +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
> @@ -354,4 +354,23 @@ Contact:	intel-xe@lists.freedesktop.org
>   Description:	RW. Target fan PWM duty value in the range 0..255, where 255
>   		is 100% fan speed.
>   
> +		Writing requires the corresponding pwm[1-3]_enable to be set to
> +		1 (manual user-table mode) first; otherwise the write is
> +		rejected with -EINVAL.
> +
> +		Only supported for particular Intel Xe graphics platforms.
> +
> +What:		/sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/pwm[1-3]_enable
> +Date:		December 2026
> +KernelVersion:	7.5
> +Contact:	intel-xe@lists.freedesktop.org
> +Description:	RW. Fan control mode selector.
> +
> +		Use value 0 to run fans at full speed. Use value 1 to enable
> +		user table control and value 2 to use firmware default behavior.
> +
> +		The user fan curve is kept across modes 0 and 2, and re-applied
> +		when switching back to 1. Without a user curve, mode 1 starts
> +		from the firmware stock curve.
> +
>   		Only supported for particular Intel Xe graphics platforms.
> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index 9932003e12b6..1ef9c12b7110 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> @@ -139,6 +139,20 @@ struct xe_hwmon_energy_info {
>   	long accum_energy;
>   };
>   
> +/**
> + * enum xe_fan_pwm_enable_mode - fan PWM enable modes
> + */
> +enum xe_fan_pwm_enable_mode {
> +	/** @XE_FAN_PWM_FULL_SPEED: run the fan at full speed */
> +	XE_FAN_PWM_FULL_SPEED = 0,
> +	/** @XE_FAN_PWM_MANUAL_USER_TABLE: user table control */
> +	XE_FAN_PWM_MANUAL_USER_TABLE = 1,
> +	/** @XE_FAN_PWM_AUTO_STOCK_TABLE: firmware default behavior using the stock table */
> +	XE_FAN_PWM_AUTO_STOCK_TABLE = 2,
> +	/** @XE_FAN_PWM_UNINITIALIZED: fan control mode is not established */
> +	XE_FAN_PWM_UNINITIALIZED = 0xff,
> +};
> +
>   /**
>    * enum fan_table_type - fan table types tracked per fan
>    */
> @@ -190,6 +204,8 @@ struct xe_hwmon_fan_info {
>   	} fan_table[FAN_TABLE_MAX];
>   	/** @max_rps: maximum fan RPS */
>   	u32 max_rps;
> +	/** @pwm_enable_mode: current xe_fan_pwm_enable_mode */
> +	u8 pwm_enable_mode;
>   };
>   
>   /**
> @@ -926,7 +942,9 @@ static const struct hwmon_channel_info * const hwmon_info[] = {
>   	HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, HWMON_E_INPUT | HWMON_E_LABEL),
>   	HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_MAX, HWMON_F_INPUT | HWMON_F_MAX,
>   			   HWMON_F_INPUT | HWMON_F_MAX),
> -	HWMON_CHANNEL_INFO(pwm, HWMON_PWM_INPUT, HWMON_PWM_INPUT, HWMON_PWM_INPUT),
> +	HWMON_CHANNEL_INFO(pwm, HWMON_PWM_INPUT | HWMON_PWM_ENABLE,
> +			   HWMON_PWM_INPUT | HWMON_PWM_ENABLE,
> +			   HWMON_PWM_INPUT | HWMON_PWM_ENABLE),
>   	NULL
>   };
>   
> @@ -1175,6 +1193,7 @@ static int xe_hwmon_get_fan_point_count(struct xe_hwmon *hwmon, u8 fan, u32 *poi
>   {
>   	int ret;
>   
> +	*point_count = 0;
>   	ret = xe_hwmon_pcode_read_fan_control(hwmon,
>   					      (table_type == USER_FAN_TABLE) ?
>   					      FSC_READ_USER_FAN_CONTROL_POINTS :
> @@ -1198,8 +1217,9 @@ static int xe_hwmon_get_fan_point_count(struct xe_hwmon *hwmon, u8 fan, u32 *poi
>   }
>   
>   /*
> - * Set the fan to automatic mode by clearing the user fan table.
> - * This will make the firmware run the stock fan table.
> + * Set the fan to automatic mode by clearing the firmware user fan table.
> + * This will make the firmware run the stock fan table. The cached user table is
> + * kept so that manual mode can re-apply it.
>    */
>   static int xe_hwmon_fan_set_auto(struct xe_hwmon *hwmon, u8 fan)
>   {
> @@ -1210,9 +1230,86 @@ static int xe_hwmon_fan_set_auto(struct xe_hwmon *hwmon, u8 fan)
>   			     PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS, fan),
>   			     0);
>   	if (ret)
> -		return ret;
> +		goto fail;
> +
> +	fi->pwm_enable_mode = XE_FAN_PWM_AUTO_STOCK_TABLE;
> +	return 0;
> +
> +fail:
> +	fi->pwm_enable_mode = XE_FAN_PWM_UNINITIALIZED;
> +	return ret;
> +}
> +
> +static int xe_hwmon_activate_user_fan_table(struct xe_hwmon *hwmon, u8 fan,
> +					    bool is_full_speed, enum fan_table_type table_source)
> +{
> +	struct xe_pcode_write writes[MAX_FAN_CONTROL_POINTS + 1];
> +	struct xe_hwmon_fan_info *fi = &hwmon->fi[fan];
> +	struct fan_table *source_table;
> +	u32 expected_count, point_count;
> +	int ret, write_ret, verify_ret;
> +	u32 point;
> +
> +	source_table = &fi->fan_table[table_source];
> +
> +	xe_dbg(hwmon->xe, "activating fan %d user table from %s table\n", fan,
> +	       (table_source == USER_FAN_TABLE) ? "user" : "stock");
> +
> +	point_count = source_table->point_count;
> +	if (!point_count || point_count > MAX_FAN_CONTROL_POINTS) {
> +		xe_err(hwmon->xe,
> +		       "fan %d %s table point count %d is invalid, cannot activate user table\n",
> +		       fan, (table_source == USER_FAN_TABLE) ? "user" : "stock", point_count);
> +		return -EINVAL;
> +	}
> +	expected_count = point_count;
> +
> +	for (point = 0; point < point_count; point++) {
> +		u8 temp = source_table->fcp[point].temp;
> +		u8 speed = is_full_speed ? 100 : min_t(u8, source_table->fcp[point].speed, 100);
> +
> +		writes[point].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_FAN_TABLE, fan);
> +		writes[point].data = FIELD_PREP(FAN_CONTROL_POINT_TEMP_MASK, temp) |
> +					FIELD_PREP(FAN_CONTROL_POINT_SPEED_MASK, speed);
> +	}
> +
> +	writes[point_count].mbox = PCODE_MBOX(FAN_SPEED_CONTROL, FSC_WRITE_NUM_FAN_CONTROL_POINTS,
> +					      fan);
> +	writes[point_count].data = point_count;
> +	write_ret = xe_pcode_write_batch(xe_device_get_root_tile(hwmon->xe), writes,
> +					 point_count + 1);
> +	if (write_ret)
> +		xe_dbg(hwmon->xe, "failed to write fan %d user table, ret=%d\n", fan, write_ret);
> +
> +	verify_ret = xe_hwmon_get_fan_point_count(hwmon, fan, &point_count, USER_FAN_TABLE);
> +	if (write_ret || verify_ret || point_count != expected_count) {
> +		int failure_ret = write_ret ?: verify_ret ?: -EIO;
> +
> +		if (verify_ret || point_count != expected_count)
> +			xe_err(hwmon->xe,
> +			       "fan %d user table count mismatch: ret=%d, expected=%u, got=%u\n",
> +			       fan, verify_ret, expected_count, point_count);
> +		/* Firmware may have accepted only part of the table; fall back to stock. */
> +		ret = xe_hwmon_fan_set_auto(hwmon, fan);
> +		if (ret)
> +			xe_err(hwmon->xe, "failed to restore fan %d to stock mode, ret=%d\n", fan,
> +			       ret);
> +		return failure_ret;
> +	}
> +
> +	/* Full speed only overrides firmware; the cache keeps the manual curve. */
> +	if (table_source == STOCK_FAN_TABLE) {
> +		for (point = 0; point < point_count; point++) {
> +			fi->fan_table[USER_FAN_TABLE].fcp[point].temp =
> +				source_table->fcp[point].temp;
> +			fi->fan_table[USER_FAN_TABLE].fcp[point].speed =
> +				min_t(u8, source_table->fcp[point].speed, 100);
> +		}
> +		fi->fan_table[USER_FAN_TABLE].point_count = point_count;
> +	}
>   
> -	fi->fan_table[USER_FAN_TABLE].point_count = 0;
> +	fi->pwm_enable_mode = is_full_speed ? XE_FAN_PWM_FULL_SPEED :
> +					    XE_FAN_PWM_MANUAL_USER_TABLE;
>   
>   	return 0;
>   }
> @@ -1228,6 +1325,11 @@ static int xe_hwmon_set_user_fan_pwm(struct xe_hwmon *hwmon, u8 fan, u8 pwm)
>   	u32 point_count = 0;
>   	u8 speed;
>   
> +	if (fi->pwm_enable_mode != XE_FAN_PWM_MANUAL_USER_TABLE) {
> +		xe_dbg(hwmon->xe, "fan %d manual mode is not active, cannot set pwm\n", fan);
> +		return -EINVAL;
> +	}
> +
>   	/* Fan table speed are in percent. */
>   	speed = DIV_ROUND_CLOSEST(pwm * 100, U8_MAX);
>   	speed = min_t(u32, speed, 100);
> @@ -1256,15 +1358,14 @@ static int xe_hwmon_set_user_fan_pwm(struct xe_hwmon *hwmon, u8 fan, u8 pwm)
>   	if (write_ret || verify_ret || point_count != MIN_FAN_CONTROL_POINTS) {
>   		int failure_ret = write_ret ?: verify_ret ?: -EIO;
>   
> -		/* Firmware may have accepted only part of the user table. */
> -		fi->fan_table[USER_FAN_TABLE].point_count = 0;
>   		if (verify_ret || point_count != MIN_FAN_CONTROL_POINTS)
>   			xe_err(hwmon->xe,
>   			       "fan %d PWM table count verification failed: ret=%d, count=%u\n",
>   			       fan, verify_ret, point_count);
> +		/* Firmware may have accepted only part of the table; fall back to stock. */
>   		ret = xe_hwmon_fan_set_auto(hwmon, fan);
>   		if (ret)
> -			xe_err(hwmon->xe, "failed to restore fan %d to auto mode  ret=%d\n",
> +			xe_err(hwmon->xe, "failed to restore fan %d to auto mode ret=%d\n",
>   			       fan, ret);
>   		return failure_ret;
>   	}
> @@ -1351,6 +1452,8 @@ static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon)
>   		memcpy(fi->fan_table[STOCK_FAN_TABLE].fcp, stock_fcp,
>   		       stock_fcp_count * sizeof(stock_fcp[0]));
>   		fi->fan_table[STOCK_FAN_TABLE].point_count = stock_fcp_count;
> +		if (fi->pwm_enable_mode == XE_FAN_PWM_UNINITIALIZED)
> +			fi->pwm_enable_mode = XE_FAN_PWM_AUTO_STOCK_TABLE;
>   	}
>   	return ret;
>   }
> @@ -1912,6 +2015,7 @@ xe_hwmon_pwm_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel)
>   
>   	switch (attr) {
>   	case hwmon_pwm_input:
> +	case hwmon_pwm_enable:
>   		return 0644;
>   	default:
>   		return 0;
> @@ -1971,25 +2075,43 @@ xe_hwmon_fan_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
>   	}
>   }
>   
> +static enum fan_table_type xe_hwmon_get_active_fan_table(struct xe_hwmon *hwmon, u8 fan)
> +{
> +	return (hwmon->fi[fan].pwm_enable_mode == XE_FAN_PWM_AUTO_STOCK_TABLE) ? STOCK_FAN_TABLE :
> +			USER_FAN_TABLE;
> +}
> +
>   /**
> - * xe_hwmon_get_stock_table_pwm - Calculate PWM from the stock fan curve
> + * xe_hwmon_get_active_table_pwm - Calculate PWM from the active fan curve
>    * @hwmon: hwmon instance, with hwmon_lock held and runtime PM active
>    * @channel: fan channel
>    * @val: calculated PWM percentage
>    *
> - * Read package temperature and linearly interpolate the stock table. Temperatures
> - * outside the table range use the speed at the nearest endpoint.
> + * Read package temperature and linearly interpolate the fan table selected by
> + * pwm_enable. Temperatures outside the table range use the nearest endpoint.
>    *
>    * Return: 0 on success, or a negative error code.
>    */
> -static int xe_hwmon_get_stock_table_pwm(struct xe_hwmon *hwmon, int channel, long *val)
> +static int xe_hwmon_get_active_table_pwm(struct xe_hwmon *hwmon, int channel, long *val)
>   {
> -	const struct fan_table *table = &hwmon->fi[channel].fan_table[STOCK_FAN_TABLE];
> +	const struct fan_table *table;
>   	long temperature, pwm;
>   	int point, ret;
>   
>   	lockdep_assert_held(&hwmon->hwmon_lock);
>   
> +	switch (hwmon->fi[channel].pwm_enable_mode) {
> +	case XE_FAN_PWM_UNINITIALIZED:
> +		return -ENODATA;
> +	case XE_FAN_PWM_FULL_SPEED:
> +		*val = 100;
> +		return 0;
> +	default:
> +		break;
> +	}
> +
> +	table = &hwmon->fi[channel].fan_table[xe_hwmon_get_active_fan_table(hwmon, channel)];
> +
>   	if (!table->point_count)
>   		return -ENODATA;
>   
> @@ -2017,7 +2139,7 @@ static int xe_hwmon_get_stock_table_pwm(struct xe_hwmon *hwmon, int channel, lon
>   	}
>   
>   	*val = pwm;
> -	xe_dbg(hwmon->xe, "fan %d stock table active PWM value: %ld\n", channel, pwm);
> +	xe_dbg(hwmon->xe, "fan %d: pwm value from active table cache: %ld\n", channel, pwm);
>   	return 0;
>   }
>   
> @@ -2067,7 +2189,7 @@ static int xe_hwmon_get_pwm_from_pmt(struct xe_hwmon *hwmon, int channel, long *
>   		return -EOPNOTSUPP;
>   	}
>   
> -	xe_dbg(hwmon->xe, "fan %d PMT active PWM value: %u\n", channel, pwm);
> +	xe_dbg(hwmon->xe, "fan %d: active pwm from PMT: %u\n", channel, pwm);
>   
>   	*val = pwm;
>   	return 0;
> @@ -2086,25 +2208,22 @@ xe_hwmon_pwm_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
>   
>   	switch (attr) {
>   	case hwmon_pwm_input:
> -		/* If the user fan table is not populated, get active stock pwm */
> -		if (!fi->fan_table[USER_FAN_TABLE].point_count) {
> -			xe_dbg(hwmon->xe, "user fan table not active for fan %d\n", channel);
> -			switch (hwmon->xe->info.platform) {
> -			case XE_BATTLEMAGE:
> -				ret = xe_hwmon_get_pwm_from_pmt(hwmon, channel, &pwm);
> -				break;
> -			default:
> -				ret = xe_hwmon_get_stock_table_pwm(hwmon, channel, &pwm);
> -				break;
> -			}
> -			if (ret)
> -				goto unlock;
> -		} else {
> -			/*
> -			 * pwmN writes set every user-table point to the same speed,
> -			 * so the first point gives the cached manual PWM percentage.
> -			 */
> -			pwm = fi->fan_table[USER_FAN_TABLE].fcp[0].speed;
> +		switch (hwmon->xe->info.platform) {
> +		case XE_BATTLEMAGE:
> +			ret = xe_hwmon_get_pwm_from_pmt(hwmon, channel, &pwm);
> +			break;
> +		default:
> +			ret = xe_hwmon_get_active_table_pwm(hwmon, channel, &pwm);
> +			break;
> +		}
> +		if (ret == -ENODATA) {
> +			xe_dbg(hwmon->xe, "fan %d control mode not established\n", channel);
> +			goto unlock;
> +		}
> +		if (ret) {
> +			xe_err(hwmon->xe, "failed to get active pwm for fan %d, ret=%d\n",
> +			       channel, ret);
> +			goto unlock;
>   		}
>   		if (pwm < 0 || pwm > 100) {
>   			xe_err(hwmon->xe, "invalid PWM value %ld read for fan %d\n", pwm, channel);
> @@ -2115,6 +2234,13 @@ xe_hwmon_pwm_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
>   		*val = DIV_ROUND_CLOSEST(pwm * U8_MAX, 100);
>   		xe_dbg(hwmon->xe, "pwm read for fan %d: %ld\n", channel, *val);
>   		break;
> +	case hwmon_pwm_enable:
> +		if (fi->pwm_enable_mode == XE_FAN_PWM_UNINITIALIZED) {
> +			ret = -ENODATA;
> +			break;
> +		}
> +		*val = fi->pwm_enable_mode;
> +		break;
>   	default:
>   		ret = -EOPNOTSUPP;
>   		break;
> @@ -2128,8 +2254,11 @@ xe_hwmon_pwm_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
>   static int
>   xe_hwmon_pwm_write(struct xe_hwmon *hwmon, u32 attr, int channel, long val)
>   {
> +	struct xe_hwmon_fan_info *fi;
>   	int ret = 0;
>   
> +	fi = &hwmon->fi[channel];
> +
>   	mutex_lock(&hwmon->hwmon_lock);
>   
>   	switch (attr) {
> @@ -2141,6 +2270,33 @@ xe_hwmon_pwm_write(struct xe_hwmon *hwmon, u32 attr, int channel, long val)
>   		}
>   		ret = xe_hwmon_set_user_fan_pwm(hwmon, channel, (u8)val);
>   		break;
> +	case hwmon_pwm_enable:
> +		if (val == XE_FAN_PWM_FULL_SPEED || val == XE_FAN_PWM_MANUAL_USER_TABLE) {
> +			bool full_speed = val == XE_FAN_PWM_FULL_SPEED;
> +			/* Without a user curve, start from the clamped stock table. */
> +			enum fan_table_type source = fi->fan_table[USER_FAN_TABLE].point_count ?
> +				USER_FAN_TABLE : STOCK_FAN_TABLE;
> +
> +			ret = xe_hwmon_activate_user_fan_table(hwmon, channel, full_speed, source);
> +			if (ret)
> +				xe_warn(hwmon->xe, "failed to set fan %d pwm_enable %ld, ret=%d\n",
> +					channel, val, ret);
> +		} else if (val == XE_FAN_PWM_AUTO_STOCK_TABLE) {
> +			ret = xe_hwmon_fan_set_auto(hwmon, channel);
> +			if (ret) {
> +				xe_warn(hwmon->xe,
> +					"failed to switch fan %d to automatic stock control, ret=%d\n",
> +					channel, ret);
> +				break;
> +			}
> +			xe_dbg(hwmon->xe,
> +			       "automatic control enabled for fan %d using stock table\n",
> +			       channel);
> +		} else {
> +			xe_dbg(hwmon->xe, "invalid pwm%d_enable value %ld\n", channel + 1, val);
> +			ret = -EINVAL;
> +		}
> +		break;
>   	default:
>   		ret = -EOPNOTSUPP;
>   		break;
> @@ -2354,6 +2510,7 @@ int xe_hwmon_register(struct xe_device *xe)
>   {
>   	struct device *dev = xe->drm.dev;
>   	struct xe_hwmon *hwmon;
> +	int fan;
>   	int ret;
>   
>   	/* hwmon is available only for dGfx */
> @@ -2368,6 +2525,10 @@ int xe_hwmon_register(struct xe_device *xe)
>   	if (!hwmon)
>   		return -ENOMEM;
>   
> +	/* Zero is XE_FAN_PWM_FULL_SPEED; stay unset until the stock table is read. */
> +	for (fan = 0; fan < FAN_MAX; fan++)
> +		hwmon->fi[fan].pwm_enable_mode = XE_FAN_PWM_UNINITIALIZED;
> +
>   	ret = devm_mutex_init(dev, &hwmon->hwmon_lock);
>   	if (ret)
>   		return ret;

LGTM:

Reviewed-by: Soham Purkait <soham.purkait@intel.com>


  reply	other threads:[~2026-12-01 13:39 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 18:50 [PATCH v6 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
2026-11-30 18:50 ` [PATCH v6 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
2026-11-30 19:04   ` sashiko-bot
2026-12-01  5:10     ` Poosa, Karthik
2026-12-01  8:09   ` Purkait, Soham
2026-11-30 18:50 ` [PATCH v6 02/10] drm/xe/hwmon: Expose fanN_max Karthik Poosa
2026-12-01  8:10   ` Purkait, Soham
2026-11-30 18:50 ` [PATCH v6 03/10] drm/xe/pcode: Add ordered write batch helper Karthik Poosa
2026-11-30 20:59   ` Rodrigo Vivi
2026-11-30 18:50 ` [PATCH v6 04/10] drm/xe/hwmon: Expose pwm[1-3] Karthik Poosa
2026-12-01 13:04   ` Purkait, Soham
2026-11-30 18:50 ` [PATCH v6 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable Karthik Poosa
2026-12-01 13:38   ` Purkait, Soham [this message]
2026-11-30 18:50 ` [PATCH v6 06/10] drm/xe/hwmon: Enable fan curve control support Karthik Poosa
2026-11-30 21:00   ` Rodrigo Vivi
2026-12-01 12:06     ` Purkait, Soham
2026-11-30 18:50 ` [PATCH v6 07/10] drm/xe/hwmon: Restore fan user tables after resume Karthik Poosa
2026-11-30 21:03   ` Rodrigo Vivi
2026-12-01  4:55   ` Nilawar, Badal
2026-12-01  5:13     ` Poosa, Karthik
2026-11-30 18:50 ` [PATCH v6 08/10] drm/xe/hwmon: Refresh fan data after late binding Karthik Poosa
2026-12-01  5:32   ` Nilawar, Badal
2026-12-01 16:41     ` Poosa, Karthik
2026-11-30 18:50 ` [PATCH v6 09/10] drm/xe: Expose tjmax_fan_control_enable device sysfs Karthik Poosa
2026-12-01 16:14   ` Purkait, Soham
2026-12-01 17:31     ` Poosa, Karthik
2026-11-30 18:50 ` [PATCH v6 10/10] drm/xe/hwmon: Add kernel-doc for fan control Karthik Poosa
2026-11-30 21:04   ` Rodrigo Vivi
2026-12-01  8:13   ` Purkait, Soham
2026-11-30 20:52 ` ✓ CI.KUnit: success for drm/xe/hwmon: Add fan control support (rev3) Patchwork
2026-11-30 21:32 ` ✓ Xe.CI.BAT: " Patchwork
2026-12-01  9:17 ` ✗ Xe.CI.FULL: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6503f6f7-7cdf-4e65-bb4b-838a9ec6595d@intel.com \
    --to=soham.purkait@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=ravi.kishore.koppuravuri@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sk.anirban@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox