Commit Graph

2377 Commits

Author SHA1 Message Date
Linux Build Service Account ccd59794df Merge "Merge upstream tag 'v3.10.49' into msm-3.10" 2014-08-24 10:53:27 -07:00
Siddartha Mohanadoss 31d7344dd3 hwmon: qpnp-adc-voltage: Add measurement interval mode
Support clients to issue measurement interval mode on a given
channel. VADC_USR can only support one measurement interval
mode request. When any client issues a single VADC request,
the channel on which measurement interval mode is being
requested will be put on hold, the single ADC conversion
request handled and the channel for the measurement interval
will resume. The measurement interval mode request allows
clients to set thresholds and recieve notification once a
threshold is crossed.

Change-Id: If99f4ab43ec1cd9b838ace7fb358bf3e426e48fd
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2014-08-20 21:04:09 -07:00
Ian Maund 6440f462f9 Merge upstream tag 'v3.10.49' into msm-3.10
* commit 'v3.10.49': (529 commits)
  Linux 3.10.49
  ACPI / battery: Retry to get battery information if failed during probing
  x86, ioremap: Speed up check for RAM pages
  Score: Modify the Makefile of Score, remove -mlong-calls for compiling
  Score: The commit is for compiling successfully.
  Score: Implement the function csum_ipv6_magic
  score: normalize global variables exported by vmlinux.lds
  rtmutex: Plug slow unlock race
  rtmutex: Handle deadlock detection smarter
  rtmutex: Detect changes in the pi lock chain
  rtmutex: Fix deadlock detector for real
  ring-buffer: Check if buffer exists before polling
  drm/radeon: stop poisoning the GART TLB
  drm/radeon: fix typo in golden register setup on evergreen
  ext4: disable synchronous transaction batching if max_batch_time==0
  ext4: clarify error count warning messages
  ext4: fix unjournalled bg descriptor while initializing inode bitmap
  dm io: fix a race condition in the wake up code for sync_io
  Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code
  clk: spear3xx: Use proper control register offset
  ...

In addition to bringing in upstream commits, this merge also makes minor
changes to mainitain compatibility with upstream:

The definition of list_next_entry in qcrypto.c and ipa_dp.c has been
removed, as upstream has moved the definition to list.h. The implementation
of list_next_entry was identical between the two.

irq.c, for both arm and arm64 architecture, has had its calls to
__irq_set_affinity_locked updated to reflect changes to the API upstream.

Finally, as we have removed the sleep_length member variable of the
tick_sched struct, all changes made by upstream commit ec804bd do not
apply to our tree and have been removed from this merge. Only
kernel/time/tick-sched.c is impacted.

Change-Id: I63b7e0c1354812921c94804e1f3b33d1ad6ee3f1
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2014-08-20 13:23:09 -07:00
Linux Build Service Account a41cba90d2 Merge "hwmon: qpnp-current: Fix parameter configuration for IADC" 2014-08-08 12:02:21 -07:00
Ke Liu 6c8adbd421 hwmon: boost_dynamic_controller: correct votes to RPM according to VPH
Currently, votes according to VPH to RPM is wrong. We should vote RPM
according to below rules. If the VPH is larger than ceiling threshold,
we should vote 0 for boot regulstor to RPM.  If the VPH is less than
floor threshold, we should vote 1 for boot regulstor to RPM. Hence
update the driver accordingly.

Change-Id: I29d7d769bd1c438791864321522701b5b7659449
Signed-off-by: Ke Liu <keliu@codeaurora.org>
2014-07-31 17:03:28 -07:00
Guenter Roeck 69d15f41f7 hwmon: (smsc47m192) Fix temperature limit and vrm write operations
commit 043572d5444116b9d9ad8ae763cf069e7accbc30 upstream.

Temperature limit clamps are applied after converting the temperature
from milli-degrees C to degrees C, so either the clamp limit needs
to be specified in degrees C, not milli-degrees C, or clamping must
happen before converting to degrees C. Use the latter method to avoid
overflows.

vrm is an u8, so the written value needs to be limited to [0, 255].

Cc: Axel Lin <axel.lin@ingics.com>
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-07-31 12:53:51 -07:00
Linux Build Service Account 39bd7cc924 Merge "hwmon: qpnp-voltage: Log the fab-id and die-temp" 2014-07-31 06:00:36 -07:00
Linux Build Service Account e125177eea Merge "hwmon: boost_dynamic_controller: Add boost regulator dynamic control driver" 2014-07-30 16:51:36 -07:00
Anirudh Ghayal 1403237eb0 hwmon: qpnp-voltage: Log the fab-id and die-temp
Logging these adds more debugging info for die-temp
based VADC compensation.

Change-Id: I5236167f14ef59b17131d46376bba86f7ab11ef3
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2014-07-29 00:01:41 -07:00
Ke Liu 28b5245340 hwmon: boost_dynamic_controller: Add boost regulator dynamic control driver
Add support to change boost regulator mode according to VPH power
dynamically.

Change-Id: I572cc1c396bcff2d4143831cef568bae42982efa
Signed-off-by: Ke Liu <keliu@codeaurora.org>
2014-07-28 10:05:24 -07:00
Guenter Roeck 0979b71696 hwmon: (adt7470) Fix writes to temperature limit registers
commit de12d6f4b10b21854441f5242dcb29ea96181e58 upstream.

Temperature limit registers are signed. Limits therefore need
to be clamped to (-128, 127) degrees C and not to (0, 255)
degrees C.

Without this fix, writing a limit of 128 degrees C sets the
actual limit to -128 degrees C.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-28 08:00:03 -07:00
Axel Lin 4c6d5fb84f hwmon: (da9052) Don't use dash in the name attribute
commit ee14b644daaa58afe1e91bb9ebd9cf1b18d1f5fa upstream.

Dashes are not allowed in hwmon name attributes.
Use "da9052" instead of "da9052-hwmon".

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-28 08:00:03 -07:00
Axel Lin 48050b8a69 hwmon: (da9055) Don't use dash in the name attribute
commit 6b00f440dd678d786389a7100a2e03fe44478431 upstream.

Dashes are not allowed in hwmon name attributes.
Use "da9055" instead of "da9055-hwmon".

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-28 08:00:03 -07:00
Dipen Parmar d31e4aee0f hwmon: qpnp-current: Fix parameter configuration for IADC
Removing redundant parameters which are not applicable
on the IADC peripheral.

Fix the issue with "fast_avg_setup" and "decimation"
parameters to configure correctly as per channel
configuration.

Change-Id: Idfe823effc6255b57e31f37621971aab29f08020
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-07-25 11:51:04 +05:30
Chunmei Cai c6fff61bda power: qpnp-charger: double check BAT_THERM voltage in BTC_HOT irq
BTC_HOT interrupt might be triggered by glitches on BAT_THERM pin and
causes charging stopped unexpected.

Using VADC to sample the voltage on BAT_THERM pin when BTC_TEMP_OK
interrupt triggered and BAT_TEMP_STATUS is HOT. If HOT_THD is set
to 35% of the VREF_BAT_THM, and the voltage sampled on BATT_THERM
is higher than HOT_THD, override BTC VCP_DET comparator and toggle
HOT_THD setting to 25% to take charging back immediately.

CRs-Fixed: 685765
Change-Id: I83b3d2b8eb430be20418ba0b58c0eb8d7b8f22ec
Signed-off-by: Chunmei Cai <ccai@codeaurora.org>
2014-07-23 13:27:16 +08:00
Axel Lin 906a2fc009 hwmon: (adm1021) Fix cache problem when writing temperature limits
commit c024044d4da2c9c3b32933b4235df1e409293b84 upstream.

The module test script for the adm1021 driver exposes a cache problem
when writing temperature limits. temp_min and temp_max are expected
to be stored in milli-degrees C but are stored in degrees C.

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:58:01 -07:00
Axel Lin c1bf93008b hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div
commit 1035a9e3e9c76b64a860a774f5b867d28d34acc2 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:58:00 -07:00
Guenter Roeck 787c2837b3 hwmon: (adm1031) Fix writes to limit registers
commit 145e74a4e5022225adb84f4e5d4fff7938475c35 upstream.

Upper limit for write operations to temperature limit registers
was clamped to a fractional value. However, limit registers do
not support fractional values. As a result, upper limits of 127.5
degrees C or higher resulted in a rounded limit of 128 degrees C.
Since limit registers are signed, this was stored as -128 degrees C.
Clamp limits to (-55, +127) degrees C to solve the problem.

Value on writes to auto_temp[12]_min and auto_temp[12]_max were not
clamped at all, but masked. As a result, out-of-range writes resulted
in a more or less arbitrary limit. Clamp those attributes to (0, 127)
degrees C for more predictable results.

Cc: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17 15:58:00 -07:00
Axel Lin aec3d33f12 hwmon: (amc6821) Fix permissions for temp2_input
commit df86754b746e9a0ff6f863f690b1c01d408e3cdc 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:58:00 -07:00
Fabio Baltieri 172a9e9a5f hwmon: (ina2xx) Cast to s16 on shunt and current regs
commit c0214f98943b1fe43f7be61b7782b0c8f0836f28 upstream.

All devices supported by ina2xx are bidirectional and report the
measured shunt voltage and power values as a signed 16 bit, but the
current driver implementation caches all registers as u16, leading
to an incorrect sign extension when reporting to userspace in
ina2xx_get_value().

This patch fixes the problem by casting the signed registers to s16.
Tested on an INA219.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 11:14:01 -07:00
Dipen Parmar 86cc63b4a8 hwmon: qpnp-voltage: Correct the offset calculation
For PM8916 temperature coefficient calculation required
to use offset value independent of temperature.

Change-Id: I918ac21882dd29de85af8973f403baa651b346ec
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-07-02 19:04:43 +05:30
Dipen Parmar b12ac34a9d hwmon: qpnp-adc-voltage: Add temperature compensation for PM8916 v2.0
Add VBAT and OCV temperature compensation for PM8916
v2.0 for TSMC and GF parts.

The temperature compensation is required on top of
gain/offset calibration to compensate for variations
due to chip revision, manufacturer and temperature.

Change-Id: I1e773a229f5a28780bffaf70979992fe4ed25e42
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-06-25 11:19:41 +05:30
Dipen Parmar 0c9d0df0a3 hwmon: qpnp-adc-voltage: Add temperature compensation
Add VBAT and OCV temperature compensation for PM8916
v1.1 and v2.0. The temperature compensation is required
on top of gain/offset calibration to compensate for
variations due to chip revision, manufacturer and
temperature.

Change-Id: I0a9b65d8e4f7ce88c554558355518740dceb91fb
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-06-13 10:40:25 +05:30
Jean Delvare 13a3538413 hwmon: (ntc_thermistor) Fix OF device ID mapping
commit ead82d6792ef5c600d535bca6ec50a4da14ff7c7 upstream.

The mapping from OF device IDs to platform device IDs is wrong.
TYPE_NCPXXWB473 is 0, TYPE_NCPXXWL333 is 1, so
ntc_thermistor_id[TYPE_NCPXXWB473] is { "ncp15wb473", TYPE_NCPXXWB473 }
while
ntc_thermistor_id[TYPE_NCPXXWL333] is { "ncp18wb473", TYPE_NCPXXWB473 }.

So the name is wrong for all but the "ntc,ncp15wb473" entry, and the
type is wrong for the "ntc,ncp15wl333" entry.

So map the entries by index, it is neither elegant nor robust but at
least it is correct.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 9e8269de hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-11 12:03:22 -07:00
Jean Delvare afe687819d hwmon: (ntc_thermistor) Fix dependencies
commit 59cf4243e557aa64ab2ef51280454aa1f3828e14 upstream.

In commit 9e8269de, support was added for ntc_thermistor devices being
declared in the device tree and implemented on top of IIO. With that
change, a dependency was added to the ntc_thermistor driver:

	depends on (!OF && !IIO) || (OF && IIO)

This construct has the drawback that the driver can no longer be
selected when OF is set and IIO isn't, nor when IIO is set and OF is
not. This is a regression for the original users of the driver.

As the new code depends on IIO and is useless without OF, include it
only if both are enabled, and set the dependencies accordingly. This
is clearer, more simple and more correct.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 9e8269de hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-11 12:03:22 -07:00
Josef Gajdusek 7cf41c8172 hwmon: (emc1403) Support full range of known chip revision numbers
commit 3a18e1398fc2dc9c32bbdc50664da3a77959a8d1 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 13:25:31 -07:00
Josef Gajdusek a026e5ef61 hwmon: (emc1403) fix inverted store_hyst()
commit 17c048fc4bd95efea208a1920f169547d8588f1f 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 13:25:31 -07:00
Venkatesh Yadav Abbarapu 0f45ef107f hwmon: qpnp-adc Add support for fsm9900 target
Add support for thermistor design and mapping
table used on fsm9900 target.

Change-Id: I1c22e6a55ddb5dfcb75b69ec6f807f8c2d6b2eb8
Acked-by: Jim Granitzki <jamesg@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
2014-05-28 18:15:04 +05:30
Jie Cheng 387fd20c2c thermal: qpnp-adc-tm: add new scale function for skuh battery thermistor
The skuh is using the different battery thermistor and mapping table from
the default. A new scale function is needed to use this mapping table in
the thermal adc driver.

Change-Id: I63fb02244b55b51d967b85a90cc700ef1764d20d
Signed-off-by: Jie Cheng <rockiec@codeaurora.org>
2014-05-21 15:57:01 +08:00
Zhenhua Huang dc04bdbe7b hwmon: qpnp-adc: add battery thermistor mapping table for skuh
Tcold = 0 DegC and Thot = 58 DegC are used for 8916 SKUH device.
Update battery thermistor mapping table for it.

Change-Id: I37a76022d7488734924d5fe213bc86dbf0fcea07
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
2014-05-20 04:57:40 -07:00
Linux Build Service Account 92bd85b349 Merge "hwmon: qpnp-adc-voltage: Fix break statement in compensation API" 2014-05-17 00:07:07 -07:00
Dipen Parmar bc4b0965bd hwmon: qpnp-adc-voltage: Fix break statement in compensation API
Fix missing break statements in OCV and VBAT compensation
APIs for PM8026 v2.2 to avoid SOC and VBAT errors.

Change-Id: Idd2352c2cd9dad3b80a71f36a2947254792557bc
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-05-16 10:29:17 +05:30
Dipen Parmar d90e1aba36 hwmon: qpnp-adc-voltage: Update default scaling API
Update default scaling API to support absolute and
ratiometric calibration both to convert raw adc data
to voltages.

Change-Id: I45a109d77c388564c0063d1de926813a4a929c48
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-05-15 18:07:38 +05:30
Linux Build Service Account fcd3a7f739 Merge "hwmon: qpnp-adc-voltage: Add suspend_noirq support for VADC" 2014-05-09 01:05:40 -07:00
Dipen Parmar 2f2dcbf43c hwmon: qpnp-adc-voltage: Add suspend_noirq support for VADC
With wakeup_source APIs in VADC driver if the client
driver suspend call requests adc conversion then
suspend process will be aborted even if the wakeup
event released by VADC driver.

Add suspend_noirq support to allow the client
driver to read adc during their suspend call
and remove wakeup_source APIs.

Change-Id: I338463975de0eafd9c9e21e5f0ce8a0508ceeac2
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-05-08 17:37:17 +05:30
Linux Build Service Account 9276eaeda2 Merge "hwmon: qpnp-current-monitor: Add SMPS current monitoring driver" 2014-05-08 04:32:06 -07:00
Ashay Jaiswal 81d1aaf67f hwmon: qpnp-current-monitor: Add SMPS current monitoring driver
QPNP PMIC SMPS current monitoring driver provides sysfs interface to
user-space clients for configuring current threshold of the regulator.
It also notifies user-space client whenever load current crosses the
configured threshold limit.

Change-Id: Ic4e7210e262bddd3e1aae6f0ebda35fb54931737
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2014-05-07 12:21:29 +05:30
Linux Build Service Account 16296e0178 Merge "Merge upstream linux-stable v3.10.36 into msm-3.10" 2014-05-05 15:09:00 -07:00
Ashay Jaiswal c55724f021 hwmon: qpnp-adc: add PM8916 1.0/1.1/2.0 temperature compensation
Add temperature compensation coefficients for PM8916 VADC to improve
accuracy.

Change-Id: I578185c5c1d852b3f8bb02bb68ce460828369a5b
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2014-04-29 19:14:17 +05:30
Ian Maund 356fb13538 Merge upstream linux-stable v3.10.36 into msm-3.10
* commit 'v3.10.36': (494 commits)
  Linux 3.10.36
  netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages
  mm: close PageTail race
  net: mvneta: rename MVNETA_GMAC2_PSC_ENABLE to MVNETA_GMAC2_PCS_ENABLE
  x86: fix boot on uniprocessor systems
  Input: cypress_ps2 - don't report as a button pads
  Input: synaptics - add manual min/max quirk for ThinkPad X240
  Input: synaptics - add manual min/max quirk
  Input: mousedev - fix race when creating mixed device
  ext4: atomically set inode->i_flags in ext4_set_inode_flags()
  Linux 3.10.35
  sched/autogroup: Fix race with task_groups list
  e100: Fix "disabling already-disabled device" warning
  xhci: Fix resume issues on Renesas chips in Samsung laptops
  Input: wacom - make sure touch_max is set for touch devices
  KVM: VMX: fix use after free of vmx->loaded_vmcs
  KVM: x86: handle invalid root_hpa everywhere
  KVM: MMU: handle invalid root_hpa at __direct_map
  Input: elantech - improve clickpad detection
  ARM: highbank: avoid L2 cache smc calls when PL310 is not present
  ...

Change-Id: Ib68f565291702c53df09e914e637930c5d3e5310
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2014-04-23 16:23:49 -07:00
Linux Build Service Account afb845a8dd Merge "hwmon: qpnp-adc-current: Update fix for IADC RSENSE trim error" 2014-03-28 06:31:59 -07:00
Linux Build Service Account b198cb9af1 Merge "Merge upstream linux-stable v3.10.28 into msm-3.10" 2014-03-26 23:36:07 -07:00
Dipen Parmar 210f50eb25 hwmon: qpnp-adc-current: Update fix for IADC RSENSE trim error
For PM8026 some parts are reporting incorrect RSENSE trim value.
This fix updates the existing RSENSE trim error workaround to
cover them.

Change-Id: I80689e5da9294bee0afb9a83da2da787c4a1d6e7
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-03-27 10:12:17 +05:30
Ian Maund f1b32d4e47 Merge upstream linux-stable v3.10.28 into msm-3.10
The following commits have been reverted from this merge, as they are
known to introduce new bugs and are currently incompatible with our
audio implementation. Investigation of these commits is ongoing, and
they are expected to be brought in at a later time:

86e6de7 ALSA: compress: fix drain calls blocking other compress functions (v6)
16442d4 ALSA: compress: fix drain calls blocking other compress functions

This merge commit also includes a change in block, necessary for
compilation. Upstream has modified elevator_init_fn to prevent race
conditions, requring updates to row_init_queue and test_init_queue.

* commit 'v3.10.28': (1964 commits)
  Linux 3.10.28
  ARM: 7938/1: OMAP4/highbank: Flush L2 cache before disabling
  drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
  serial: amba-pl011: use port lock to guard control register access
  mm: Make {,set}page_address() static inline if WANT_PAGE_VIRTUAL
  md/raid5: Fix possible confusion when multiple write errors occur.
  md/raid10: fix two bugs in handling of known-bad-blocks.
  md/raid10: fix bug when raid10 recovery fails to recover a block.
  md: fix problem when adding device to read-only array with bitmap.
  drm/i915: fix DDI PLLs HW state readout code
  nilfs2: fix segctor bug that causes file system corruption
  thp: fix copy_page_rep GPF by testing is_huge_zero_pmd once only
  ftrace/x86: Load ftrace_ops in parameter not the variable holding it
  SELinux: Fix possible NULL pointer dereference in selinux_inode_permission()
  writeback: Fix data corruption on NFS
  hwmon: (coretemp) Fix truncated name of alarm attributes
  vfs: In d_path don't call d_dname on a mount point
  staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()
  staging: comedi: addi_apci_1032: fix subdevice type/flags bug
  mm/memory-failure.c: recheck PageHuge() after hugetlb page migrate successfully
  GFS2: Increase i_writecount during gfs2_setattr_chown
  perf/x86/amd/ibs: Fix waking up from S3 for AMD family 10h
  perf scripting perl: Fix build error on Fedora 12
  ARM: 7815/1: kexec: offline non panic CPUs on Kdump panic
  Linux 3.10.27
  sched: Guarantee new group-entities always have weight
  sched: Fix hrtimer_cancel()/rq->lock deadlock
  sched: Fix cfs_bandwidth misuse of hrtimer_expires_remaining
  sched: Fix race on toggling cfs_bandwidth_used
  x86, fpu, amd: Clear exceptions in AMD FXSAVE workaround
  netfilter: nf_nat: fix access to uninitialized buffer in IRC NAT helper
  SCSI: sd: Reduce buffer size for vpd request
  intel_pstate: Add X86_FEATURE_APERFMPERF to cpu match parameters.
  mac80211: move "bufferable MMPDU" check to fix AP mode scan
  ACPI / Battery: Add a _BIX quirk for NEC LZ750/LS
  ACPI / TPM: fix memory leak when walking ACPI namespace
  mfd: rtsx_pcr: Disable interrupts before cancelling delayed works
  clk: exynos5250: fix sysmmu_mfc{l,r} gate clocks
  clk: samsung: exynos5250: Add CLK_IGNORE_UNUSED flag for the sysreg clock
  clk: samsung: exynos4: Correct SRC_MFC register
  clk: clk-divider: fix divisor > 255 bug
  ahci: add PCI ID for Marvell 88SE9170 SATA controller
  parisc: Ensure full cache coherency for kmap/kunmap
  drm/nouveau/bios: make jump conditional
  ARM: shmobile: mackerel: Fix coherent DMA mask
  ARM: shmobile: armadillo: Fix coherent DMA mask
  ARM: shmobile: kzm9g: Fix coherent DMA mask
  ARM: dts: exynos5250: Fix MDMA0 clock number
  ARM: fix "bad mode in ... handler" message for undefined instructions
  ARM: fix footbridge clockevent device
  net: Loosen constraints for recalculating checksum in skb_segment()
  bridge: use spin_lock_bh() in br_multicast_set_hash_max
  netpoll: Fix missing TXQ unlock and and OOPS.
  net: llc: fix use after free in llc_ui_recvmsg
  virtio-net: fix refill races during restore
  virtio_net: don't leak memory or block when too many frags
  virtio-net: make all RX paths handle errors consistently
  virtio_net: fix error handling for mergeable buffers
  vlan: Fix header ops passthru when doing TX VLAN offload.
  net: rose: restore old recvmsg behavior
  rds: prevent dereference of a NULL device
  ipv6: always set the new created dst's from in ip6_rt_copy
  net: fec: fix potential use after free
  hamradio/yam: fix info leak in ioctl
  drivers/net/hamradio: Integer overflow in hdlcdrv_ioctl()
  net: inet_diag: zero out uninitialized idiag_{src,dst} fields
  ip_gre: fix msg_name parsing for recvfrom/recvmsg
  net: unix: allow bind to fail on mutex lock
  ipv6: fix illegal mac_header comparison on 32bit
  netvsc: don't flush peers notifying work during setting mtu
  tg3: Initialize REG_BASE_ADDR at PCI config offset 120 to 0
  net: unix: allow set_peek_off to fail
  net: drop_monitor: fix the value of maxattr
  ipv6: don't count addrconf generated routes against gc limit
  packet: fix send path when running with proto == 0
  virtio: delete napi structures from netdev before releasing memory
  macvtap: signal truncated packets
  tun: update file current position
  macvtap: update file current position
  macvtap: Do not double-count received packets
  rds: prevent BUG_ON triggered on congestion update to loopback
  net: do not pretend FRAGLIST support
  IPv6: Fixed support for blackhole and prohibit routes
  HID: Revert "Revert "HID: Fix logitech-dj: missing Unifying device issue""
  gpio-rcar: R-Car GPIO IRQ share interrupt
  clocksource: em_sti: Set cpu_possible_mask to fix SMP broadcast
  irqchip: renesas-irqc: Fix irqc_probe error handling
  Linux 3.10.26
  sh: add EXPORT_SYMBOL(min_low_pfn) and EXPORT_SYMBOL(max_low_pfn) to sh_ksyms_32.c
  ext4: fix bigalloc regression
  arm64: Use Normal NonCacheable memory for writecombine
  arm64: Do not flush the D-cache for anonymous pages
  arm64: Avoid cache flushing in flush_dcache_page()
  ARM: KVM: arch_timers: zero CNTVOFF upon return to host
  ARM: hyp: initialize CNTVOFF to zero
  clocksource: arch_timer: use virtual counters
  arm64: Remove unused cpu_name ascii in arch/arm64/mm/proc.S
  arm64: dts: Reserve the memory used for secondary CPU release address
  arm64: check for number of arguments in syscall_get/set_arguments()
  arm64: fix possible invalid FPSIMD initialization state
  ...

Change-Id: Ia0e5d71b536ab49ec3a1179d59238c05bdd03106
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2014-03-24 14:28:34 -07:00
Dipen Parmar 4c3c5b31f4 hwmon: qpnp-adc: Add smb batt_therm reverse scaling
Add reverse scaling function for smb batt_therm.

Change-Id: Ic81078b9738ee5ee60f505316dd9dbebea8c58fc
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-03-24 17:47:39 +05:30
Siddartha Mohanadoss 0c910d0e7a hwmon: qpnp-adc-current: Fix specifying batfet status
For the condition when PM8941 is true use the BATFET status
that is passed to the calibration api. Ignore the BATFET
status for all other PMIC versions.

For PM8941 when BATFET is open, the reads on channel 0 for
Internal RSENSE are redirected in HW to channel 0x5:
 EXTRSNS_OFFSET. Recalibrate based on this channel.

Change-Id: Ib0d477c5fb4537379b31faf1676d5956317b06a7
CRs-Fixed: 629758
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2014-03-17 22:42:15 -07:00
Siddartha Mohanadoss d9e1a21bb1 hwmon: qpnp-adc-current: Fix offset channel selection
On PM8941 depending on the status of the BATFET
the reads on channel 0 for Internal RSENSE go to
channel 5 therefore the offset is performed on that
channel. This is applicable to only to PM8941 and
not on PM8026 and PM8110. Therefore apply the check
for offset channel selection based on the BATFET
status on PM8941 only.

Change-Id: I146b244c2b562664b85e804694f8d4b2aac3fa86
CRs-Fixed: 629758
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2014-03-12 19:27:56 -07:00
Guenter Roeck 755ac7af96 hwmon: (max1668) Fix writing the minimum temperature
commit 500a91571f0a5d0d3242d83802ea2fd1faccc66e 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-06 21:30:11 -08:00
Siddartha Mohanadoss b5311d7a6b hwmon: qpnp-adc-voltage: Show ADC code in hex format
Update the raw code shown for VADC while printing the buffer
in hex format instead of decimal format to maintain the
format that is in the register.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Change-Id: I57f39e1d32925a51ca2bc6e848cc897caf565c6c
2014-03-05 18:54:32 -08:00
Siddartha Mohanadoss ea8cd32a7c thermal: qpnp-adc-tm: Add reverse scaling
Add reverse scaling to convert voltage in uV using absolute
calibration to raw ADC code written to set high/low threshold
for a specified BTM channel.

Change-Id: Ic56465df5ab60100cffe4303ff983480b71c0c95
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2014-03-05 18:43:08 -08:00
Dipen Parmar b72f7f8ba1 qpnp-adc: current: Add check for rsense and calib data
Add check for rsense and calib data to avoid division by
zero errors.

CRs-fixed: 619889
Change-Id: Icf282341107905b382eb3fa34d73cf11665ca647
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-03-04 10:38:01 +05:30
Doug Anderson 600b64afd7 hwmon: (ntc_thermistor) Avoid math overflow
commit d3d89c468ceebbcf9423d1a3d66c5bf91f569570 upstream.

The ntc thermistor code was doing math whose temporary result might
have overflowed 32-bits.  We need some casts in there to make it safe.

In one example I found:
- pullup_uV: 1800000
- result of iio_read_channel_raw: 3226
- 1800000 * 3226 => 0x15a1cbc80

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-22 12:41:27 -08:00
Siddartha Mohanadoss 75e0057492 hwmon: qpnp-adc-voltage: Modify temperature compensation
Apply temperature compensation to minimum(die_temp, 60degC)
for vbatt compensation. For OCV temperature compensation
apply the compensation based on the die_temp for the
corresponding PMIC. The temperature compensation is
required on top of gain/offset calibration to compensate
for variations due to chip revision, manufacturer and
temperature.

Change-Id: I0826993ddebe7dae2f033d995fa1266f9509002c
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2014-02-14 13:54:38 -08:00
Siddartha Mohanadoss 256b803104 hwmon: qpnp-adc-voltage: Add temperature compensation
Add VBAT and OCV temperature compensation for PM8026v2.2.
The temperature compensation is required on top of
gain/offset calibration to compensate for variations
due to chip revision, manufacturer and temperature.

Change-Id: I7c62340a74a118d6f80e4e6bba51c2d07c4a57c6
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2014-02-10 17:14:29 -08:00
Phil Pokorny 1d136c9b1e hwmon: (k10temp) Add support for Kaveri CPUs
commit d303b1b5fbb688282bbf72a534b9dfed7af9fe4f upstream.

Add new PCI ID to support new model "Kaveri" family.

Signed-off-by: Philip Pokorny <ppokorny@penguincomputing.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-06 11:08:14 -08:00
Siddartha Mohanadoss b69ed0a419 hwmon: qpnp-adc-current: Add temperature compensation
Add temperature compensation for IADC PM8026v2.2.
It shares the same temperature compensation parameters
as PM8026v2.1. The temperature compensation is required
on top of gain/offset calibration to compensate for
variations due to chip revision, manufacturer and
temperature.

Change-Id: Ic39ba249d8d28c36bf59d650dcc2c2a3889ee55b
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2014-01-28 19:53:38 -08:00
Siddartha Mohanadoss 1c5e71137d hwmon: qpnp-adc-current: Fix IADC RSENSE trim error
This is a workaround for a RSENSE trim issue that may
affect some of the parts. The RSENSE might be trimmed to a
incorrect value resulting in an incorrect current value.
The workaround will check if the trim values stored in the
registers are valid and if not use a default RSENSE value.

CRs-Fixed: 606553
Change-Id: I8d77a2c6c28e57f2e537d1c5b65d0e08d5fabd90
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2014-01-28 19:32:01 -08:00
Jean Delvare 02cb5b6b8b hwmon: (coretemp) Fix truncated name of alarm attributes
commit 3f9aec7610b39521c7c69d754de7265f6994c194 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-25 08:27:11 -08:00
Linux Build Service Account d59ca464e6 Merge "hwmon: epm_adc: Add debug logs" 2013-12-26 18:48:05 -08:00
Linux Build Service Account ba446430bd Merge "hwmon: epm_adc: Add configurable global GPIO enable" 2013-12-26 18:48:05 -08:00
Siddartha Mohanadoss 147337d89b hwmon: epm_adc: Add debug logs
Add Version and firmware debug logs during initialization.

Change-Id: I3ded6b8a141a1b20b155309df5cac42fd76b9471
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-12-26 14:41:41 -08:00
Siddartha Mohanadoss a5b117f24f hwmon: epm_adc: Add configurable global GPIO enable
Embedded power monitor (EPM) PSoC is powered through a GPIO.
Add a property to pass the GPIO to the driver since this
the global enable for the EPM varies from target to target.

Change-Id: I731302f9ab33c216f5794721a4d36ee20fb261ec
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-12-26 14:41:41 -08:00
Wu Fenglin 00b02e95f4 hwmon: qpnp-adc: add battery thermistor mapping table for skug
Since the new values of parameters including Rs1=30.3K,
Rs2=12.8K, Tcold=-15DegC and Thot=55DegC are used for
skug device, we add a new table accordingly.

Change-Id: I89d86274c5c198f904766d818cb2a7882c462496
Signed-off-by: Wu Fenglin <fenglinw@codeaurora.org>
2013-12-26 11:52:44 +08:00
Jean Delvare a903818b46 hwmon: (w83l768ng) Fix fan speed control range
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>
2013-12-20 07:45:08 -08:00
Brian Carnes d6eb2d04bb hwmon: (w83l786ng) Fix fan speed control mode setting and reporting
commit cf7559bc053471f32373d71d04a9aa19e0b48d59 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:45:07 -08:00
José Miguel Gonçalves d4fa5279d7 hwmon: HIH-6130: Support I2C bus drivers without I2C_FUNC_SMBUS_QUICK
commit efabcc2123f0ed47870033b8d6fc73b50d76d635 upstream.

Some I2C bus drivers do not allow zero-length data transfers which are
required to start a measurement with the HIH6130/1 sensor. Nevertheless,
we can overcome this limitation by writing a zero dummy byte. This byte
is ignored by the sensor and was verified to be working with the OMAP
I2C bus driver in a BeagleBone board.

Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt>
[Guenter Roeck: Simplified complexity of write_length initialization]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20 07:45:07 -08:00
Dan Carpenter 223cc81c8c hwmon: Prevent some divide by zeros in FAN_TO_REG()
commit 3806b45ba4655147a011df03242cc197ab986c43 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20 07:45:07 -08:00
Dipen Parmar add0879f00 hwmon: qpnp-adc: Add check for wrong calib data
Add check when adc calibration data are similar
for both reference channels and return error to
avoid division by zero errors.

Change-Id: Id884eb79f606fb7361fc47a96e7a6f009a113869
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2013-12-18 18:02:30 +05:30
Xiaozhe Shi df7598c474 hwmon: qpnp-adc-current: log the compensation coefficients
The compensation coefficients are used to execute performance tests.
Provide this information in the debug logs of the IADC driver.

Change-Id: I59df9501d8edf652c6cf0999a17cc820115b07cc
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-12-03 13:45:48 -08:00
Guenter Roeck 598f412c2f hwmon: (lm90) Fix max6696 alarm handling
commit e41fae2b1ed8c78283d73651cd65be0228c0dd1c 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 11:11:50 -08:00
Linux Build Service Account a5b0c890bc Merge "hwmon: qpnp-adc-current: Fix potential race condition" 2013-11-25 13:51:57 -08:00
Siddartha Mohanadoss 83759a96fd hwmon: qpnp-adc-current: Fix potential race condition
There should be no synchronous Voltage and Current readings
initiated on IADC_USR when a single VADC_USR conversion is
in progress. If a synchronous Voltage and Current read
occures while a VADC_USR is in progress it results in an
invalid state for that single conversion on the VADC_USR.
There is a potential race condition where the above scenario
can occur that is due to an IADC conversion occuring before
the VADC_IADC USR sync conversion is complete and ends up
using the mode select as a VADC_IADC sync request.
Therefore use a single lock for both IADC and
synchronous VADC_IADC request.

Change-Id: Idb451b813bc5f08b7239d371fc0f8fa5e17429b1
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-11-25 09:42:29 -08:00
Linux Build Service Account 62dd845652 Merge "hwmon: epm_adc: Add 16 bit buffering and generic support" 2013-11-22 21:10:50 -08:00
Siddartha Mohanadoss 71faee8b90 hwmon: epm_adc: Add 16 bit buffering and generic support
Add support to return 16bit results for averaging buffering
command. This allows additional channels to be measured.
The generic command allows clients to send requests that
are supported by the PSoC. In addition fix the marker
gpio numbers between the marker 1 and marker 2 that are
flipped.

Change-Id: I2bf87ceb8fa9fa633ab6d082b12f66c77a374d34
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-11-22 11:24:13 -08:00
Ian Maund f06163e6d0 msm: reap unused kernel files
This change removes source files from the kernel tree that
were not being used during make. The list of used files
was generated using an annotated make log and was then
compared with new files added since the public release of
kernel version 3.10.00. New files which were added but
not used have been removed from the tree.

A diff was also run to determine the list of files that had
been modified since the release of kernel version 3.10.00.
These files were then scrubbed based on the current kernel
configuration, removing invalid and unused conditionals.

Some files which support planned functionality or are
useful in debugging have been excluded from this reap.

Change-Id: Ia44a224d3cea7bc78dd45e8a8279860d35d4b008
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2013-11-21 17:45:28 -08:00
Xiaozhe Shi ee8fec3522 hwmon: qpnp-adc-current: fix current compensation direction
Currently the current compensation in the IADC driver is using the wrong
polarity. The compensation function is treating the current with the
battery being the source (i.e. discharging is positive and charging is
negative), but the IADC's IBAT readings treat the battery as a sink
(i.e. charging is positive and discharging is negative).

Fix this by reversing the sign of the iadc current readings before doing
compensation.

Change-Id: I1413ce491b1f430b6a78bfc480174321c512e289
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-11-12 14:55:49 -08:00
Xiaozhe Shi 6c5843508e hwmon: qpnp-adc: add PM8110 2.0 temperature compensation info
Add in support for PM8110 2.0 temperature compensation. Also, fix a few
bugs in the ADC compensation algorithm where 25C was treated as 2.5C.

Change-Id: Iafa3ceca2b5938432116ecc905dd54b2da7c4b0b
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-11-12 14:55:43 -08:00
Siddartha Mohanadoss b8e1e4f4de hwmon: qpnp-adc-common: Reduce kernel error prints
Update the revid check to use pr_debug instead of
pr_err to reduce potential errors to get printed.
This is an optional property as far is IADC is concerned
to apply temperature compensation for the supported chips.

Change-Id: I77036fb9f0eb640e43216762461ba036b2aa0caf
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-10-24 15:51:06 -07:00
Henrik Rydberg 8c27969472 hwmon: (applesmc) Always read until end of data
commit 25f2bd7f5add608c1d1405938f39c96927b275ca 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-18 07:45:44 -07:00
Siddartha Mohanadoss acec6c4e3c hwmon: qpnp-adc: Add smb batt_therm mapping table
The batt_therm connected to SMB THERM uses a
100K pull-up. This channel can also be read through
PMA8084 VADC. Add resistive divider table that
converts voltage to temperature in decidegC for the
corresponding battery thermistor.

Change-Id: I7af1c6b74a14d292c7cff37f5e9673980df67912
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-10-11 11:14:46 -07:00
Siddartha Mohanadoss e17597ed0d hwmon: qpnp-adc-current: Add temperature compensation
Add temperature compensation parameters for PM8026 2.1.
Compensate the vbatt voltage for temperature variance above
25degC. Add similar compensation for current compensation.

Also update using the revid api's to check for PMIC revision
instead of using peripheral revision registers. Using
revid PMIC api's makes it easy to follow on what PMIC versions
are the temperature compensation being applied to. Depending
on VADC/IADC revision registers alone may not suffice since
there is no correlation between the individual peripheral
revision and the PMIC number. You could have the same
VADC revision on different PMIC's and to avoid such a scenario
use the PMIC revid.

Change-Id: I90adb1130b2e2461f762df774ddcd018e806cf78
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-10-08 16:01:02 -07:00
Henrik Rydberg 332769e13b hwmon: (applesmc) Check key count before proceeding
commit 5f4513864304672e6ea9eac60583eeac32e679f2 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:13:12 -07:00
Wei Hu c2fcdfd1a9 hwmon: (k10temp) Add support for Fam16h (Kabini)
commit 30b146d1cb5e7560192057098eb705118bd5511f upstream.

The temperature reporting interface stays the same, so we just
add the PCI-ID to the list.

Verified on AMD Olive Hill.

Signed-off-by: Wei Hu <wei@aristanetworks.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-07 22:09:59 -07:00
Siddartha Mohanadoss 7f4e53a430 hwmon: qpnp-adc-current: Fix temperature compensation overflow
Fix the temperature compensation overflow that can occur when
using external rsense. Also fix the corresponding units for
coefficient on PM8941 3.1.

Change-Id: I9b27b54c606482fa42928f79460c3ae7ceb693b3
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-05 14:54:34 -07:00
Siddartha Mohanadoss d15a5f973b hwmon: qpnp-adc: Fix panic in ADC workqueue
During warm/soft reset it is seen during qpnp-adc-tm
driver interrupt registration there are pending
interrupts.

Register the ADC interrupt handler after initializing
the workqueue to handle potential cases where interrupt
is pending when an interrupt is requested and causes
panic because the workqueue is called when its not
initialized yet.

Change-Id: Iba88ab3c9f71dc94579ab85980f8cfd726f3c5c1
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-05 14:52:37 -07:00
Siddartha Mohanadoss 6299618686 hwmon: qpnp-adc-scale: Fix batt_therm mapping table
Mapping table for batt_therm used for converting voltage
to temperature is incorrect after 65degC. Fix the voltage
to temperature mapping for values after 65degC.

Change-Id: Ib8534a2be3b66f61b4edbe8f283cfee9f873af81
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-04 17:29:16 -07:00
Siddartha Mohanadoss a3d5f9ee18 hwmon: qpnp-adc-current: Fix current resolution units
Existing units returned for IADC current is in mA when
using external rsense. Fix it to return the units in uA
to keep it consistent with current read from internal rsense.

Change-Id: Ia9792ea4d894500829011db5510363b4e6e14616
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-04 17:28:42 -07:00
Siddartha Mohanadoss 3906a96b21 hwmon: qpnp-adc-voltage: Add temperature compensation
The VADC does not meet VBAT and OCV accuracy spec with just
gain and offset calibration. Additional compensation is required
on top of gain/offset calibrated reading to compensate for
variations based on chip revision, manufacturer and tempreature.

Change-Id: I9e08987ac39ac8de8e880b96bee4f8bc76a88e46
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-04 17:20:06 -07:00
Siddartha Mohanadoss 4ec9647cd2 hwmon: qpnp-adc-current: Add temperature compensation
The IADC does not meet accuracy spec with just gain
and offset calibration. Additional compensation is
required on top of gain/offset calibration to compensate
for variations due to chip revision, manufacturer and
temperature.

Change-Id: If69ec412b05746e49e98fff761a70cd987bd6f7e
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-04 17:20:05 -07:00
Siddartha Mohanadoss ca4e012922 hwmon: qpnp-adc-current: Fix error path
Invalid jump to cleanup before the hwmon device
is registered. Cleanup the error path to avoid
panic if a failure occurs before hwmon device
register occurs.

Change-Id: I3477d207dc6402bed33d15723f2763ee85a1ca46
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-04 17:17:37 -07:00
Xu Kai 2983a75b71 hwmon: qpnp-adc: add battery thermistor mapping table for msm8610 qrd skuaa
Since the new values of parameters including Rs1=17.8K,
Rs2=6.1K, Tcold=-5DegC and Thot=55DegC are used for
msm8610 qrd skuaa, we add a new table accordingly.

Change-Id: I14eab97a012de62cfdddf1df920ce16ac0f3561c
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
2013-09-04 17:17:10 -07:00
Xu Kai f110b4ab2d hwmon: qpnp-adc: modify qrd battery thermistor mapping table
Change the battery thermistor voltage under the corresponding
temperature based on the values of parameters including
R0=10.0K @ 25DegC, Rs1=13.0K, Rs2=2.1K, B=3380K, Tcold=0DegC
and Thot=45DegC.

Change-Id: Icc6957946b456be4cfecc18c92cc79db85ea215e
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
2013-09-04 17:17:08 -07:00
Siddartha Mohanadoss 147a6b4301 hwmon: qpnp-current: Add configurable EOC option.
Provide a DT property qcom,iadc-poll-eoc option to
allow clients to choose between using interrupt or
polling method for end of conversion interrupt.
When the optional property is present, use polling
when an ADC conversion is requested.

Change-Id: I2c62a9f8e30f5c1200d439343f0548212977b731
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-04 17:16:38 -07:00
Siddartha Mohanadoss 5abeea8be3 hwmon: qpnp-vadc: Add EOC polling option
Add a DT property qcom,vadc-poll-eoc option to allow
clients to use either interrupt mode or polling mode
for end of conversion request. The DT property is a
optional property to specify polling. If this property is not
present default to use interrupt mode.

Change-Id: I16f3677a24200b80dc5a8535a98ec4a44158302c
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-04 17:16:36 -07:00
Xiaozhe Shi 27c40bec84 hwmon: qpnp-current: Use ideal gain for PM8026
The IADC on PM8026 has been found to have improved accuracy if the
gain compensation is removed from the conversion equation. Implement
this in the IADC driver by faking a gain read of offset + ideal gain
during calibration.

Change-Id: I85abf713e796666946674e5ae603c918cfa9ae5a
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-09-04 17:16:18 -07:00
Siddartha Mohanadoss cc6f8b40e6 hwmon: qpnp-current: Support multiple instance
Support multiple instance of the IADC device. Clients
need to register with the current ADC using the device
consumer name used to associate with the corresponding
phandle of the IADC. Clients receive the device instance
which is to be used everytime an ADC request is made.

This change involves changing the interface to issue
ADC request and the corresponding clients changes.

Change-Id: I51423395ed7282669ca7fbc7dc585e0292417e71
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-04 17:15:08 -07:00
Siddartha Mohanadoss 000325beb7 hwmon: qpnp-voltage: Support multiple device instance
Support multiple voltage ADC device instance. Clients
need to register with the voltage ADC using the device
consumer name used to associate with the corresponding
phandle of the VADC. Clients receive the device instance
which is to be used everytime an ADC request is made.

This change involves changing the interface to issue
ADC request and the corresponding clients changes.

Change-Id: If0557bc657fecd172a8cf960900ee93b4bce37f8
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-09-04 17:14:32 -07:00
Abhijeet Dharmapurikar e672d0d48a power: qpnp-bms: implement workarounds for coupling issue
On certain PMICs there is a coupling issue which causes bad calibration
values that reports a high current value even when the BATFET is open.
This coupling issue happens regardless of an internal/external rsense
configuration.

The suggested workaround is to repeatedly calibrate until we get values
that result in less than 3mA of current.

Expose the BATFET open/closed as battery's ONLINE property. It is
reasonable use of this property since PRESENT suggests a battery is
actually present in the device and ONLINE suggests if it is connected to
the system via BATFET.

The BATFET can open when a charger is present and
* the battery is fully charged
* the battery is hot/cold
(Note that if charger is disabled the buck will not operate
and we don't have coupling issue)
The fully charged notifications trickle down to BMS driver,
since battery psy supplies to "bms", use it to check if the
BATFET has opened.
The hot/cold interrupt is not yet registered to, add it so we can notify
the BMS driver if the battery goes hot or cold. Since the battery can
go hot or cold while the device is sleeping, we need to wakeup for
calibration workaround.

The BATFET can close when
* the charger is removed
* the battery recovers form hot/cold conditions when charger is present
These notifications too trickle down to the BMS driver and can be used to
check if the BATFET has closed.

Also once good calibration values are detected above use them until BATFET
closes i.e. do NOT calibrate until the BATFET closes. Update the code
that periodically calculates SOC to skip calibrations as long as BATFET
is open. On the same lines ask the iadc driver to skip auto calibrations
until BATFET closes.

CRs-Fixed: 509620
Change-Id: I89b521368304d7171d75e462cf15f2f1daa55cdc
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-09-04 17:13:46 -07:00
Abhijeet Dharmapurikar 25ca2ccfde hwmon: qpnp-current: specify batfet status while calibrating
For internal Rsense or external Rsense, when current is requested by
BMS while battery fet (BATFET) is open, IADC switches to channel 5
even though channel 0 or channel 1 was requested. This is done so that
it returns the same value as offset calibration would have returned
resulting in 0mA of current.

This is okay for external Rsense since offset calibrations are done on
channel 5 which measures across same pins as those used for current
readings.

However this results in incorrect offset values for internal Rsense
because the offset calibrations happens on channel 6 which uses
different pins than channel 5.

Update the code to specify whether a calibration is being requested
while the battery fet is open. If it is open then use channel 5 for offset
calculations even when internal Rsense is used.

Change-Id: I1b36ea1d5dd078b177d6c5a92d7c49e8402c36dc
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-09-04 17:12:54 -07:00
Abhijeet Dharmapurikar 0ed4075cb8 hwmon: qpnp-current: fix converting offset and gain to voltage
The current driver forces a value of 0uV for offset and always
lands up with 17.857mV for gain. The raw values for offset and
gain are correct however.

Update the driver to do a proper conversion of raw offset and
gain to values in microvolts.

Change-Id: I19eda7a4f0cc8ab6af0d31e01e1168d99f00bf7a
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-09-04 17:12:53 -07:00