Add thermal config to avoid compilation errors see when calling thermal
api's from VADC. Update Kconfig support for VADC.
Change-Id: Ie23a600aaa019386f34b501c8413c9eeaaba0da1
Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org>
Add VBAT and OCV temperature compensation for PM8909
v1.1 SMIC 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: I1aa33dc57736c0ea6f4d50af3b9a58260f139790
Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org>
Tcold = -20 DegC and Thot = 60 DegC are used for 8909 SKUE device.
Update battery thermistor mapping table for it.
Change-Id: Id07a66fc343c8375dd6e8ae466ff6c0e700f58cc
Signed-off-by: Chunmei Cai <ccai@codeaurora.org>
Add VBAT and OCV temperature compensation for PM8909
v1.0 SMIC 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: Ic0f110ed53dba314196af31c16c1fd58d20f7f1d
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
Tcold = 0 DegC and Thot = 50 DegC are used for 8909 SKUC device.
Update battery thermistor mapping table for it.
Change-Id: Ib519fe67c4ad69d2727000fae1e4f1bd181c2355
Signed-off-by: Chunmei Cai <ccai@codeaurora.org>
In VADC driver with recalibration parameter enabled and
MPP2 or MPP4 current sink configuration some ratiometric
channels report the adc code higher than maximum permitted
value.
VADC driver checks the adc code against the permitted
maximum value and overwrites adc code to permitted maximum
value if it is higher and this results into incorrect adc
readings.
Fix this problem by avoiding the adc code check when
recalibration parameter enabled.
Change-Id: Ic1bcc8b4e52cddc013cf1654c229c22fd348159e
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
Fix using the correct types when performing integer
arithmetic.
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Change-Id: I712a22d3f550efac1d059e1dd3ae933a3de84acd
The gain and offset is used during final calculation.
These are called during single conversion request or
recurring channel measurement, each of these requests
hold the same lock and can cause a lockup.
Change-Id: I61afe01eae609cdc465721721e19c66da9aeb1e6
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Update generic command to perform a spi_sync() request
once. The library will handle request to perform a
command request and obtain the result of the requests
separately.
Change-Id: Iea69df0b93699aba6799123d60c07ef93f1ac8c4
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Tcold = 0 DegC and Thot = 45 DegC are used for 8916 SKUT1 device.
Update battery thermistor mapping table for it.
Change-Id: I53a27c73973bb94d998485b2037d54ff833b54bd
Signed-off-by: Gustavo Solaira <gustavos@codeaurora.org>
Incorrect 625mV channel reads results into sudden
BMS SOC jumps and device shutdown.
Fix the problem by resetting the status variable
on each ADC channel read.
Change-Id: I12afcb32cb684c830ed14a444a1aec49aa18f846
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
Enable interval mode before starting measurement interval
request and disable interval mode during single conversion
request. Add additional checks for high and low threshold
interrupt routine to check the mode is in recurring
measurement mode before threshold notification.
Change-Id: I8d1a92c801d2a8ad7b61305c146718aecaca9888
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Add separate VADC reverse scaling function to consider
the channel properties that include the pre-div scaling
for the reverse calibration on VADC channels to support
recurring channel measurement mode.
Change-Id: Ifd863c3c3fd0c3c7f93b80fac8cf186f10c69e38
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
MPP2 and MPP4 current sink configuration results in
incorrect ADC readings due to common ground problem
on PM8916.
Fix the issue by using recalibration method if
calibration value found deviated from permitted value.
Change-Id: I1a4065478c00a9819673e1396651d25cb88f527f
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
Add checks for potential out of bound array overflow
for scale_type index used for reverse scaling.
Change-Id: I73a28505b7f7145790f3e2ad0e9f1781d54a3019
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Remove support for ADS ADC that is not used since
the EPM uses the PSoC for getting power measurements.
Update the generic command to use 64 bytes intead of
65 bytes. The generic command is used by the userspace
client to send commands to communicate with the PSoC
and returns the collected buffered samples for requested
power measurements.
Change-Id: I0f2eddd7421888adfeb1c7152e82c96128b7f299
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
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>
* 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>
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>
Logging these adds more debugging info for die-temp
based VADC compensation.
Change-Id: I5236167f14ef59b17131d46376bba86f7ab11ef3
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
Add support to change boost regulator mode according to VPH power
dynamically.
Change-Id: I572cc1c396bcff2d4143831cef568bae42982efa
Signed-off-by: Ke Liu <keliu@codeaurora.org>
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>
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>
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>
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>
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>
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>
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>
For PM8916 temperature coefficient calculation required
to use offset value independent of temperature.
Change-Id: I918ac21882dd29de85af8973f403baa651b346ec
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>