All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple@vodafone.de>
To: Alex Deucher <alexdeucher@gmail.com>, dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: Re: [PATCH] drm/radeon: use 0-255 rather than 0-100 for pwm fan range
Date: Thu, 05 Feb 2015 10:49:37 +0100	[thread overview]
Message-ID: <54D33CB1.2060200@vodafone.de> (raw)
In-Reply-To: <1423088830-31671-1-git-send-email-alexander.deucher@amd.com>

Am 04.02.2015 um 23:27 schrieb Alex Deucher:
> 0-255 seems to be the preferred range for the pwm interface.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Yeah, using 100 on a 8bit pwm timer sounds rather obviously wrong.

Patch is Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/radeon/radeon_pm.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
> index 91e1bd2..9f758d3 100644
> --- a/drivers/gpu/drm/radeon/radeon_pm.c
> +++ b/drivers/gpu/drm/radeon/radeon_pm.c
> @@ -585,7 +585,7 @@ static ssize_t radeon_hwmon_set_pwm1_enable(struct device *dev,
>   	if (err)
>   		return err;
>   
> -	switch(value) {
> +	switch (value) {
>   	case 1: /* manual, percent-based */
>   		rdev->asic->dpm.fan_ctrl_set_mode(rdev, FDO_PWM_MODE_STATIC);
>   		break;
> @@ -608,7 +608,7 @@ static ssize_t radeon_hwmon_get_pwm1_max(struct device *dev,
>   					 struct device_attribute *attr,
>   					 char *buf)
>   {
> -	return sprintf(buf, "%i\n", 100); /* pwm uses percent-based fan-control */
> +	return sprintf(buf, "%i\n", 255);
>   }
>   
>   static ssize_t radeon_hwmon_set_pwm1(struct device *dev,
> @@ -623,6 +623,8 @@ static ssize_t radeon_hwmon_set_pwm1(struct device *dev,
>   	if (err)
>   		return err;
>   
> +	value = (value * 100) / 255;
> +
>   	err = rdev->asic->dpm.set_fan_speed_percent(rdev, value);
>   	if (err)
>   		return err;
> @@ -642,6 +644,8 @@ static ssize_t radeon_hwmon_get_pwm1(struct device *dev,
>   	if (err)
>   		return err;
>   
> +	speed = (speed * 255) / 100;
> +
>   	return sprintf(buf, "%i\n", speed);
>   }
>   

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-02-05  9:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 22:27 [PATCH] drm/radeon: use 0-255 rather than 0-100 for pwm fan range Alex Deucher
2015-02-05  9:49 ` Christian König [this message]
2015-04-11  9:52   ` Martin Peres
2015-04-12 23:42     ` Alex Deucher
2015-04-14 21:19       ` Martin Peres

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=54D33CB1.2060200@vodafone.de \
    --to=deathsimple@vodafone.de \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.