Commit Graph

1844 Commits

Author SHA1 Message Date
Artem Borisov d7992e6feb Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1
All bluetooth-related changes were omitted because of our ancient incompatible bt stack.

Change-Id: I96440b7be9342a9c1adc9476066272b827776e64
2017-12-27 17:13:15 +03:00
Siddartha Mohanadoss be59a66ad1 hwmon: epm_adc: Fix potential dereference
Update epm_adc_psoc_show_in() to fix potential
dereference to adc_code used to store the
PSOC code data.

Change-Id: I7b68f50f89fd38f0ac32f1793720e1af3ef43022
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-10-29 23:12:34 +08:00
Axel Lin 30bbd3940f hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div
commit 1035a9e3e9 upstream.

Writing to fanX_div does not clear the cache. As a result, reading
from fanX_div may return the old value for up to two seconds
after writing a new value.

This patch ensures the fan_div cache is updated in set_fan_div().

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17 15:39:50 -07:00
Axel Lin 5cc80fb26b hwmon: (amc6821) Fix permissions for temp2_input
commit df86754b74 upstream.

temp2_input should not be writable, fix it.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17 15:39:50 -07:00
Josef Gajdusek 786f95ca60 hwmon: (emc1403) Support full range of known chip revision numbers
commit 3a18e1398f upstream.

The datasheet for EMC1413/EMC1414, which is fully compatible to
EMC1403/1404 and uses the same chip identification, references revision
numbers 0x01, 0x03, and 0x04. Accept the full range of revision numbers
from 0x01 to 0x04 to make sure none are missed.

Signed-off-by: Josef Gajdusek <atx@atx.name>
[Guenter Roeck: Updated headline and description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-07 16:02:01 -07:00
Josef Gajdusek 73cff75c55 hwmon: (emc1403) fix inverted store_hyst()
commit 17c048fc4b upstream.

Attempts to set the hysteresis value to a temperature below the target
limit fails with "write error: Numerical result out of range" due to
an inverted comparison.

Signed-off-by: Josef Gajdusek <atx@atx.name>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
[Guenter Roeck: Updated headline and description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-07 16:02:01 -07:00
Dan Carpenter 5759171282 hwmon: Prevent some divide by zeros in FAN_TO_REG()
commit 3806b45ba4 upstream.

The "rpm * div" operations can overflow here, so this patch adds an
upper limit to rpm to prevent that.  Jean Delvare helped me with this
patch.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Roger Lucas <vt8231@hiddenengine.co.uk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-14 06:44:31 -07:00
Henrik Rydberg e4b2585a85 hwmon: (applesmc) Always read until end of data
commit 25f2bd7f5a upstream.

The crash reported and investigated in commit 5f4513 turned out to be
caused by a change to the read interface on newer (2012) SMCs.

Tests by Chris show that simply reading the data valid line is enough
for the problem to go away. Additional tests show that the newer SMCs
no longer wait for the number of requested bytes, but start sending
data right away.  Apparently the number of bytes to read is no longer
specified as before, but instead found out by reading until end of
data. Failure to read until end of data confuses the state machine,
which eventually causes the crash.

As a remedy, assuming bit0 is the read valid line, make sure there is
nothing more to read before leaving the read function.

Tested to resolve the original problem, and runtested on MBA3,1,
MBP4,1, MBP8,2, MBP10,1, MBP10,2. The patch seems to have no effect on
machines before 2012.

Tested-by: Chris Murphy <chris@cmurf.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-14 06:44:31 -07:00
Guenter Roeck 7aa8c17047 hwmon: (coretemp) Add support for Atom CE4110/4150/4170
commit 1102dcab84 upstream.

TjMax for the CE4100 series of Atom CPUs was previously reported to be
110 degrees C.

cpuinfo logs on the web show existing CPU types CE4110, CE4150, and CE4170,
reported as "model name : Intel(R) Atom(TM) CPU CE41{1|5|7}0 @ 1.{2|6}0GHz"
with model 28 (0x1c) and stepping 10 (0x0a). Add the three known variants
to the tjmax table.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-14 06:44:31 -07:00
Guenter Roeck b428b89b7e hwmon: (coretemp) Improve support for TjMax detection on Atom CPUs
commit 41e58a1f2b upstream.

Atom CPUs don't have a register to retrieve TjMax. Detection so far was
incomplete. Use the X86 model ID to improve it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-14 06:44:31 -07:00
Guenter Roeck 2a3c503897 hwmon: (coretemp) Add support for Atom D2000 and N2000 series CPU models
commit 5592906f8b upstream.

Document the Atom series D2000 and N2000 (Cedar Trail) as being supported.
List and set TjMax for those series.

Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: "R, Durgadoss" <durgadoss.r@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-14 06:44:31 -07:00
Jean Delvare b32e4b1ae1 hwmon: (coretemp) Improve support of recent Atom CPU models
commit fcc14ac1a8 upstream.

Document the new Atom series (Tunnel Creek and Medfield) as being
supported, and list TjMax for the Atom E600 series.

Also enable the Atom tjmax heuristic for these Atom CPU models.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: "R, Durgadoss" <durgadoss.r@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-14 06:44:31 -07:00
Guenter Roeck 8d36299431 hwmon: (max1668) Fix writing the minimum temperature
commit 500a91571f upstream.

When trying to set the minimum temperature, the driver was erroneously
writing the maximum temperature into the chip.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-11 16:10:01 -07:00
Jean Delvare e34cdde46b hwmon: (coretemp) Fix truncated name of alarm attributes
commit 3f9aec7610 upstream.

When the core number exceeds 9, the size of the buffer storing the
alarm attribute name is insufficient and the attribute name is
truncated. This causes libsensors to skip these attributes as the
truncated name is not recognized.

Reported-by: Andreas Hollmann <hollmann@in.tum.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-29 05:10:42 -08:00
Jean Delvare b7a9e22f44 hwmon: (w83l768ng) Fix fan speed control range
commit 33a7ab91d5 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>
2014-01-08 09:42:12 -08:00
Brian Carnes 433b0da5d2 hwmon: (w83l786ng) Fix fan speed control mode setting and reporting
commit cf7559bc05 upstream.

The wrong mask is used, which causes some fan speed control modes
(pwmX_enable) to be incorrectly reported, and some modes to be
impossible to set.

[JD: add subject and description.]

Signed-off-by: Brian Carnes <bmcarnes@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20 07:34:19 -08:00
Guenter Roeck cf359232f6 hwmon: (lm90) Fix max6696 alarm handling
commit e41fae2b1e upstream.

Bit 2 of status register 2 on MAX6696 (external diode 2 open)
sets ALERT; the bit thus has to be listed in alert_alarms.
Also display a message in the alert handler if the condition
is encountered.

Even though not all overtemperature conditions cause ALERT
to be set, we should not ignore them in the alert handler.
Display messages for all out-of-range conditions.

Reported-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-29 10:50:35 -08:00
Henrik Rydberg 1751a036be hwmon: (applesmc) Check key count before proceeding
commit 5f45138643 upstream.

After reports from Chris and Josh Boyer of a rare crash in applesmc,
Guenter pointed at the initialization problem fixed below. The patch
has not been verified to fix the crash, but should be applied
regardless.

Reported-by: <jwboyer@fedoraproject.org>
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 07:06:54 -07:00
Curt Brune b9ea0ce26c hwmon: (adt7470) Fix incorrect return code check
commit 93d783bcca upstream.

In adt7470_write_word_data(), which writes two bytes using
i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed
together when they should be OR-ed together.

The return code of i2c_smbus_write_byte_data() is zero for success.

The upshot is only the first byte was ever written to the hardware.
The 2nd byte was never written out.

I noticed that trying to set the fan speed limits was not working
correctly on my system.  Setting the fan speed limits is the only
code that uses adt7470_write_word_data().  After making the change
the limit settings work and the alarms work also.

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 22:57:06 -07:00
rock_lin 7004ffb64e Cap1106: To prevent Deadlock while switching on/off CapSensor
1.[Issue 9728761] [Flo/Deb] To prevent Deadlock while switching on/off CapSensor

Change-Id: Ia4aa17a5f8f3e67081c2ae88d02094f071d78881
Signed-off-by: rock lin <Rock_Lin@asus.com>
2013-07-15 17:58:28 +00:00
Raphanus Lo 3c474fad56 cap1106: fix initial enabled/disabled state
Change-Id: I4f11fbc18e1c7f4bc73d3622153af8df3fd636bd
Signed-off-by: Raphanus Lo <raphanus_lo@asus.com>
2013-07-10 13:07:11 -07:00
Raphanus Lo ad49c7f9fe cap1106: implement controling by state change of RMNET interface
1. If kconfig CAP_SENSOR_RMNET_CTL is checked, cap1106 will be disabled
   if and only if all of the rmnet_usb network interfaces turn off.
2. cap1106 is disabled by default now.

Bug: 9148999

Change-Id: I9e9fa65265e5972f31a607487cb86942bb6384dc
Signed-off-by: Raphanus Lo <raphanus_lo@asus.com>
2013-06-27 18:53:28 +00:00
Guenter Roeck fa8defe62c hwmon: (adm1021) Strengthen chip detection for ADM1021, LM84 and MAX1617
commit 591bfcfc33 upstream.

On a system with both MAX1617 and JC42 sensors, JC42 sensors can be misdetected
as LM84. Strengthen detection sufficiently enough to avoid this misdetection.
Also improve detection for ADM1021.

Modeled after chip detection code in sensors-detect command.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-13 09:45:01 -07:00
Wei Yongjun 0e293f0955 hwmon: fix error return code in abituguru_probe()
commit ecacb0b17c upstream.

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-24 11:14:22 -07:00
Rock Lin 4815e04a83 cap1106: fine-tune the parameter for Bodysar and add support for hardware rev_e
Fine-tune parameters from RF:
1.change the sensor gain from 8 to 4,(less sensitive).
2.change the sensor sensitivity multiplier setting from 64x to 32x,(less sensitive).

Enlarged period alleviates I2C bus transition & power-saving:
3.change the polling rate from 500 msec to 1000 msecs.

bug id :8862570 [Flo/Deb]SW Changes for PR (HW_REV_E) Support

Change-Id: Ie2d8bb4067569dc88c410e57709c538a02255b1c
Signed-off-by: rock lin <Rock_Lin@asus.com>
Signed-off-by: tryout chen <tryout_chen@asus.com>
2013-05-22 07:56:43 +00:00
tryout_chen c7b57708c1 CAP1106: Fine tune params based on BODYSAR, add APP2MDM_SAR support, code refinement.
Change-Id: Ic7499b0dc1a5005cc6dfba29d061bd4164cd4a7a
Signed-off-by: tryout_chen <tryout_chen@asus.com>
2013-05-09 16:33:36 +00:00
Iliyan Malchev 87b9b80852 hwmon: fix epm_adc.c compiler warning
Signed-off-by: Iliyan Malchev <malchev@google.com>
2013-04-18 16:08:08 -07:00
Joseph Wu 074680df48 Revert "Sensors: (1/5) Enable DSPS and revert native sensors drivers."
- 373e63c Sensors: Fix the riva initial function.
- dddc76d ALS : porting al3320a light sensor on vanilla
- df25950 Sensors: (1/5) Implement sensors' driver for mpu6500 and akm8963.

Change-Id: I349bf9efe25886a6c7513dfad6e6d30487ffd82e
Reviewed-on: http://mcrd1-5.corpnet.asus/code-review/master/68305
Tested-by: Issac Wu <issac_wu@asus.com>
Reviewed-by: Joseph Wu <Joseph_Wu@asus.com>
Tested-by: Joseph Wu <Joseph_Wu@asus.com>
Reviewed-by: Jive Hwang <jive_hwang@asus.com>
Tested-by: Jive Hwang <jive_hwang@asus.com>
2013-04-18 16:08:01 -07:00
Tsechih_Lin 8725b8abe1 ALS : porting al3320a light sensor on vanilla
Change-Id: I10e53f7560cee0c4f61bf0fdeec7c12fa6d18439
Reviewed-on: http://mcrd1-5.corpnet.asus/code-review/master/67984
Reviewed-by: Tsechih Lin <Tsechih_Lin@asus.com>
Tested-by: Tsechih Lin <Tsechih_Lin@asus.com>
2013-04-18 16:07:59 -07:00
tryout_chen 616543bf0c CAP1106: Disable channel 3.
Change-Id: I778cec01ea39cadaf32df368ab9883a7a6221da6
Reviewed-on: http://mcrd1-5.corpnet.asus/code-review/master/68263
Tested-by: Chen Tryout <tryout_chen@asus.com>
Tested-by: Ted Lin <Ted_Lin@asus.com>
Reviewed-by: Ho Yihua <yihua_ho@asus.com>
Tested-by: Ho Yihua <yihua_ho@asus.com>
2013-04-18 16:07:59 -07:00
tryout_chen e5cf56c596 CapSensor: Enable SMSC 1106 cap sensor.
Change-Id: I7dce0f2aa89ac1b2919d1ee18d37789e0ce1c0d9
Reviewed-on: http://mcrd1-5.corpnet.asus/code-review/master/68066
Reviewed-by: Eric Liu <eric_liu@asus.com>
Tested-by: Eric Liu <eric_liu@asus.com>
2013-04-18 16:07:56 -07:00
Ben Hutchings 969ff7dc54 hwmon: (sht15) Fix memory leak if regulator_enable() fails
Commit 3e78080f81 ('hwmon: (sht15) Check return value of
regulator_enable()') depends on the use of devm_kmalloc() for automatic
resource cleanup in the failure cases, which was introduced in 3.7.  In
older stable branches, explicit cleanup is needed.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-20 13:05:00 -07:00
Axel Lin dce5c33d7a hwmon: (lineage-pem) Add missing terminating entry for pem_[input|fan]_attributes
commit df069079c1 upstream.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-20 13:04:59 -07:00
Guenter Roeck fa5553789e hwmon: (pmbus/ltc2978) Fix temperature reporting
commit 8c958c703e upstream.

On LTC2978, only READ_TEMPERATURE is supported. It reports
the internal junction temperature. This register is unpaged.

On LTC3880, READ_TEMPERATURE and READ_TEMPERATURE2 are supported.
READ_TEMPERATURE is paged and reports external temperatures.
READ_TEMPERATURE2 is unpaged and reports the internal junction
temperature.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-20 13:04:59 -07:00
Devin Kim 2b64f6b785 pm8xxx-adc: add the functions to set tuning parameters
We need to tune the board specific adcmap parameters
So need functions to set specific parameters.

void pm8xxx_set_adcmap_btm_threshold(void *pts, int size)
void pm8xxx_set_adcmap_pa_therm(void *pts, int size)
void pm8xxx_set_adcmap_ntcg_104ef_104fb(void *pts, int size)

Change-Id: Ie78c11f5fb998ecc456defa3c8e3e7a3e0b9b45f
2013-03-15 17:13:28 -07:00
Siddartha Mohanadoss 73eebbf41a hwmon: pm8xxx-adc: Vote for a PMIC clock buffer.:
Incorrect PMIC_THERM/XO_THERM readings are seen when
the XO clock is disabled.

The internal PMIC therm relies on the PMIC band gap
reference which in turn is enabled when any of the
PMIC clock buffers are enabled. The XO_THERM relies
on the VREF_XO as its reference source which gets
enabled when any of the PMIC clock buffers are
switched on. Therefore vote for a clock buffer when
a PMIC_THERM/XO_THERM is requested.

CRs-Fixed: 392602
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
(cherry picked from commit f9dfe1b7b70b634422fbbbf65756aa997536bd33)

Change-Id: I09e132dbc4e635b96cd08ece245a766d68ed27b4
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>

Conflicts:

	drivers/hwmon/pm8xxx-adc.c

Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
(cherry picked from commit 8ab75c713cef66317f9507b35cc08a5d7b49ae44)

Conflicts:

	drivers/hwmon/pm8xxx-adc.c

Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
2013-03-15 17:08:44 -07:00
Duy Truong 04e554807c Update copyright to The Linux Foundation
Change-Id: Ibead64ce2e901dede2ddd1b86088b88f2350ce92
Signed-off-by: Duy Truong <dtruong@codeaurora.org>
2013-03-15 17:07:39 -07:00
Uma Maheshwari Bhiram 11e349fac2 Revert "pm8xxx-adc: add the functions to set tuning parameters"
This reverts commit b19ebbc8e9ae70752e7e03b345d8a480b9ca8afa.

Change-Id: Idf994d04e69387a4e86c28e97e3ee5be80bcbd93
Signed-off-by: Uma Maheshwari Bhiram <ubhira@codeaurora.org>
2013-03-15 17:06:22 -07:00
Guenter Roeck bc37694dba hwmon: (pmbus/ltc2978) Use detected chip ID to select supported functionality
commit f366fccd08 upstream.

We read the chip ID from the chip, use it to determine if the chip ID provided
to the driver is correct, and report it if wrong. We should also use the
correct chip ID to select supported functionality.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-14 11:29:49 -07:00
Guenter Roeck ec2bc2f65c hwmon: (pmbus/ltc2978) Fix peak attribute handling
commit dbd712c227 upstream.

Peak attributes were not initialized and cleared correctly.
Also, temp2_max is only supported on page 0 and thus does not need to be
an array.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-14 11:29:49 -07:00
Mark Brown cca30bd4c9 hwmon: (sht15) Check return value of regulator_enable()
commit 3e78080f81 upstream.

Not having power is a pretty serious error so check that we are able to
enable the supply and error out if we can't.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-03-14 11:29:49 -07:00
Siddartha Mohanadoss 213b8f5bce hwmon: qpnp-adc: Add PMIC 2.0 ADC bringup fixes
VADC/IADC peripheral is supported from PMIC 2.0 onwards.
Add version check to allow VADC/IADC reads if the
version is supported. Add probe defereal api for clients
who need to know if the ADC driver is ready. There is a
bug where the completion is not initialized. Fix it
by initializing it. Add support to disable the peripheral
after the ADC is read and enable it before starting a
conversion.

Add scaling functions to support reading the die temperature,
XO_THERM, batt_therm and batt_id. Add the ratiometric
calibration routine that uses the vref/gnd for calibration.
The ratiometric calibration is used for calibrating xo_therm,
batt_therm, batt_id.

Update the gain value used for calibration on the IADC
peripheral. PMIC 2.0 IADC peripheral uses 17.857mV instead
of 25mV for its gain calibration.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
(cherry picked from commit 5ace110e2165fba66227e18154d58b0e6cbb24b2)

Change-Id: I37b02de53ea2bed913c30261624c31a1ae57131c
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:54 -08:00
Siddartha Mohanadoss 43e2e65b8c hwmon: epm_adc: Fix incorrect SPI writes
Incorrect spi write transactions and incorrect readings
are seen. This is because of using incorrect SPI slave
address while initiating the SPI writes to the ADS ADC.
Also fix the incorrect scaling when converting the raw ADC
code to the appropriate physical result.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
(cherry picked from commit de90ed4d1f8285e4fe663a3ca52d3e377b590ef1)

Change-Id: I0280d7d014a9ba88e3b6eac02764feb8cdd55c66
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:51 -08:00
Siddartha Mohanadoss ec560a9c20 hwmon: epm_adc: Add EPM support using PSOC
Add support for communicating with the PSOC
using the supported protocol commands from
the PSOC.

The support includes communicating with the
controller to initiate and start the ADC
conversion for the selected channels. Start
and receive ADC conversion for single measurement,
buffered reads, averaging the samples and returning
the results over the set averaging period.

Other commands supported include setting/receiving
the timestamp, setting reference voltage, toggling
gpio to set triggers on set events.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
(cherry picked from commit efddea4639f2953375fb822524fcae756ae67dc0)

Change-Id: Id519a5b9033b85953f1d6229a144f9df78910900
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:51 -08:00
Yan He 219ae92960 hwmon: epm_adc: Update the physical result
The scaling function multiplies the ADC code with
a high scale factor to avoid rouding accuracy errors.
This results in a 32 bit integer not being sufficient
to store the result. Therefore use a 64 bit integer
type to process the result.

Signed-off-by: Yan He <yanhe@codeaurora.org>
(cherry picked from commit f6adab796cfd509c4c5beb9f0458e0d9fd8da6a6)

Change-Id: I94b26df3a3d0860c92fbb991e015ed0e3b185884
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:50 -08:00
Devin Kim 7024f83d08 pm8xxx-adc: add the functions to set tuning parameters
We need to tune the board specific adcmap parameters
So need functions to set specific parameters.

void pm8xxx_set_adcmap_btm_threshold(void *pts, int size)
void pm8xxx_set_adcmap_pa_therm(void *pts, int size)
void pm8xxx_set_adcmap_ntcg_104ef_104fb(void *pts, int size)

Change-Id: Ie78c11f5fb998ecc456defa3c8e3e7a3e0b9b45f
2013-03-04 12:44:20 -08:00
Siddartha Mohanadoss 6fe8f3c97a hwmon: qpnp-adc: Fix register read/writes
Fix reading/writing to the correct ADC peripheral offset
address during SPMI read/writes. While adding multiple
channels an incorrect channel index initialization causes
the ADC reads to occur only on one channel. Fix it by
initializing the channel index only once at init.

The configure api has few register read/writes done
without using the bit mask field. Fix it by reading
the register and updating only the concerned bits.
Also add more comments to the configure api to list
out the steps for each register configuration and
fix using the correct print statements on error.

Change-Id: I0ce67163c5f27021f5fb0905fe601f4b1e0ee8b8
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-02-27 18:20:01 -08:00
Siddartha Mohanadoss 6ded5b5ee9 hwmon: qpnp-adc: Add PMIC QPNP IADC driver
The QPNP IADC driver supports the user bank
peripheral of the current ADC(IADC).

IADC is a 16 bit ADC used for measuring current.
The single measurement mode is supported to read
current from upto seven channel configuration.

Clients can read the internal/external Rsense,
CSP_EX, CSN_RX along with gain and offset
calibraton channels.

Change-Id: I7e5ae3fc70878d16827d33705853a36bb0aa04f6
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-02-27 18:19:24 -08:00
Siddartha Mohanadoss 669e9398c0 hwmon: pm8xxx-adc: Remove wakelocks
The PM8xxx ADC interrupt is configured as a
wakeable interrupt. Therefore the system can suspend
and still have the end of conversion interrupt be
serviced.

Add a timeout in the wait_for_completion in case
the end of conversion event is not received. This
is to rule out any side affects if a missed interrupt
occurs.

Change-Id: Iad36ad4fb7e550e563f0bf7803d3e5e861b7aacd
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-02-27 18:18:37 -08:00
Siddartha Mohanadoss 242200f572 hwmon: qpnp-adc: Add PMIC QPNP VADC Driver
The QPNP VADC driver supports the User Bank Peripheral of
the voltage ADC(VADC).

VADC is a 15 bit ADC that measures signals through the
Main analog multiplexer (AMUX) and PREMUX. The driver
arbitrates the request to issue ADC read requests.

VADC driver includes support for the conversion sequencer.
The conversion sequencer is a HW triggered signal to start
ADC measurement on trigger events for PA ON,
camera flash and TX threshold.

The AMUX supports external pull-ups simultaneously. Clients
can select the appropriate AMUX input channel to measure the
ADC for the intended pull up configuration.

Change-Id: I8886968ccec54ad03334b113b4516d4d200e0da8
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-02-27 18:17:32 -08:00