stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jean Delvare <khali@linux-fr.org>,
	Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 3.4 43/43] hwmon: (w83l768ng) Fix fan speed control range
Date: Mon,  6 Jan 2014 14:40:00 -0800	[thread overview]
Message-ID: <20140106223943.487291092@linuxfoundation.org> (raw)
In-Reply-To: <20140106223942.259651490@linuxfoundation.org>

3.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jean Delvare <khali@linux-fr.org>

commit 33a7ab91d509fa33b4bcd3ce0038cc80298050da upstream.

The W83L786NG stores the fan speed on 4 bits while the sysfs interface
uses a 0-255 range. Thus the driver should scale the user input down
to map it to the device range, and scale up the value read from the
device before presenting it to the user. The reserved register nibble
should be left unchanged.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hwmon/w83l786ng.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/drivers/hwmon/w83l786ng.c
+++ b/drivers/hwmon/w83l786ng.c
@@ -481,9 +481,11 @@ store_pwm(struct device *dev, struct dev
 	if (err)
 		return err;
 	val = SENSORS_LIMIT(val, 0, 255);
+	val = DIV_ROUND_CLOSEST(val, 0x11);
 
 	mutex_lock(&data->update_lock);
-	data->pwm[nr] = val;
+	data->pwm[nr] = val * 0x11;
+	val |= w83l786ng_read_value(client, W83L786NG_REG_PWM[nr]) & 0xf0;
 	w83l786ng_write_value(client, W83L786NG_REG_PWM[nr], val);
 	mutex_unlock(&data->update_lock);
 	return count;
@@ -782,8 +784,9 @@ static struct w83l786ng_data *w83l786ng_
 			    ? 0 : 1;
 			data->pwm_enable[i] =
 			    ((pwmcfg >> W83L786NG_PWM_ENABLE_SHIFT[i]) & 3) + 1;
-			data->pwm[i] = w83l786ng_read_value(client,
-			    W83L786NG_REG_PWM[i]);
+			data->pwm[i] =
+			    (w83l786ng_read_value(client, W83L786NG_REG_PWM[i])
+			     & 0x0f) * 0x11;
 		}
 
 



  parent reply	other threads:[~2014-01-06 22:40 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 22:39 [PATCH 3.4 00/43] 3.4.76-stable review Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 01/43] USB: serial: fix race in generic write Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 02/43] ceph: cleanup aborted requests when re-sending requests Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 03/43] ceph: wake up safe waiters when unregistering request Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 04/43] powerpc: kvm: fix rare but potential deadlock scene Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 05/43] TTY: pmac_zilog, check existence of ports in pmz_console_init() Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 06/43] ASoC: wm8904: fix DSP mode B configuration Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 07/43] ALSA: Add SNDRV_PCM_STATE_PAUSED case in wait_for_avail function Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 09/43] selinux: fix broken peer recv check Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 10/43] selinux: selinux_setprocattr()->ptrace_parent() needs rcu_read_lock() Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 11/43] ftrace: Initialize the ftrace profiler for each possible cpu Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 12/43] intel_idle: initial IVB support Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 13/43] intel_idle: enable IVB Xeon support Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 14/43] ext4: fix use-after-free in ext4_mb_new_blocks Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 16/43] sched/rt: Fix rqs cpupri leak while enqueue/dequeue child RT entities Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 18/43] net_dma: mark broken Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 19/43] drm/radeon: fix asic gfx values for scrapper asics Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 20/43] drm/radeon: 0x9649 is SUMO2 not SUMO Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 21/43] ceph: Avoid data inconsistency due to d-cache aliasing in readpage() Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 22/43] tg3: Expand 4g_overflow_test workaround to skb fragments of any size Greg Kroah-Hartman
2014-01-06 22:58   ` Eric Dumazet
2014-01-06 23:05     ` Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 23/43] dm9601: fix reception of full size ethernet frames on dm9620/dm9621a Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 24/43] dm9601: work around tx fifo sync issue on dm962x Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 25/43] ath9k: Fix interrupt handling for the AR9002 family Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 26/43] ath9k_htc: properly set MAC address and BSSID mask Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 27/43] powerpc: Fix bad stack check in exception entry Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 28/43] powerpc: Align p_end Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 29/43] cpupower: Fix segfault due to incorrect getopt_long arugments Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 30/43] libata: add ATA_HORKAGE_BROKEN_FPDMA_AA quirk for Seagate Momentus SpinPoint M8 Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 31/43] radiotap: fix bitmap-end-finding buffer overrun Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 32/43] rtlwifi: pci: Fix oops on driver unload Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 33/43] mm/hugetlb: check for pte NULL pointer in __page_check_address() Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 34/43] Input: allocate absinfo data when setting ABS capability Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 35/43] GFS2: dont hold s_umount over blkdev_put Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 36/43] GFS2: Fix incorrect invalidation for DIO/buffered I/O Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 37/43] jbd2: dont BUG but return ENOSPC if a handle runs out of space Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 38/43] gpio: msm: Fix irq mask/unmask by writing bits instead of numbers Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 39/43] sched: Avoid throttle_cfs_rq() racing with period_timer stopping Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 40/43] sh: always link in helper functions extracted from libgcc Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 41/43] selinux: look for IPsec labels on both inbound and outbound packets Greg Kroah-Hartman
2014-01-06 22:39 ` [PATCH 3.4 42/43] selinux: process labeled IPsec TCP SYN-ACK packets properly in selinux_ip_postroute() Greg Kroah-Hartman
2014-01-06 22:40 ` Greg Kroah-Hartman [this message]
2014-01-07  5:01 ` [PATCH 3.4 00/43] 3.4.76-stable review Guenter Roeck
2014-01-07 15:22   ` Greg Kroah-Hartman
2014-01-07 19:09 ` Shuah Khan

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=20140106223943.487291092@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).