Age | Commit message (Collapse) | Author | Files | Lines |
|
Many hwmon drivers don't use the id information provided by the old
i2c probe function, and the remainder can easily be adapted to the new
form ("probe_new") by calling i2c_match_id explicitly.
This avoids scanning the identifier tables during probes.
Drivers which didn't use the id are converted as-is; drivers which did
are modified as follows:
* if the information in i2c_client is sufficient, that's used instead
(client->name);
* anything else is handled by calling i2c_match_id() with the same
level of error-handling (if any) as before.
A few drivers aren't included in this patch because they have a
different set of maintainers. They will be covered by other patches.
Signed-off-by: Stephen Kitt <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
|
|
Based on 3 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [kishon] [vijay] [abraham]
[i] [kishon]@[ti] [com] this program is distributed in the hope that
it will be useful but without any warranty without even the implied
warranty of merchantability or fitness for a particular purpose see
the gnu general public license for more details
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [graeme] [gregory]
[gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
[kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
[hk] [hemahk]@[ti] [com] this program is distributed in the hope
that it will be useful but without any warranty without even the
implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-or-later
has been chosen to replace the boilerplate/reference in 1105 file(s).
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Allison Randal <[email protected]>
Reviewed-by: Richard Fontana <[email protected]>
Reviewed-by: Kate Stewart <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
|
If CONFIG_OF is not enabled, the following build warning is observed.
drivers/hwmon/tmp102.c:324:34: warning:
‘tmp102_of_match’ defined but not used
Mark it as __maybe_unused to fix the problem.
Signed-off-by: Guenter Roeck <[email protected]>
|
|
The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.
The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.
@r@
initializer list elements;
identifier i;
@@
-u32 i[] = {
- elements,
- 0
-};
@s@
identifier r.i,j,ty;
@@
-struct hwmon_channel_info j = {
- .type = ty,
- .config = i,
-};
@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@
shorter :=
make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
make_ident
(String.concat ","
(List.map (fun x -> Printf.sprintf "\n\t\t\t %s" x)
(Str.split (Str.regexp " , ") elements)))
@@
identifier s.j,t.shorter;
identifier t.elems;
@@
- &j
+ HWMON_CHANNEL_INFO(shorter,elems)
This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.
Signed-off-by: Guenter Roeck <[email protected]>
|
|
Replace S_<PERMS> with octal values.
The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/hwmon/.
This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.
Signed-off-by: Guenter Roeck <[email protected]>
|
|
Split regmap_config.use_single_rw into use_single_read and
use_single_write. This change enables drivers of devices which only
support bulk operations in one direction to use the regmap_bulk_*()
functions for both directions and have their bulk operation split into
single operations only when necessary.
Update all struct regmap_config instances where use_single_rw==true to
instead set both use_single_read and use_single_write. No attempt was
made to evaluate whether it is possible to set only one of
use_single_read or use_single_write.
Signed-off-by: David Frey <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
|
|
Commit 3d8f7a89a197 ("hwmon: (tmp102) Improve handling of initial read
delay") reduced the initial temperature read delay and made it dependent
on the chip's shutdown mode. If the chip was not in shutdown mode at probe,
the read delay no longer applies.
This ignores the fact that the chip initialization changes the temperature
sensor resolution, and that the temperature register values change when
the resolution is changed. As a result, the reported temperature is twice
as high as the real temperature until the first temperature conversion
after the configuration change is complete. This can result in unexpected
behavior and, worst case, in a system shutdown. To fix the problem,
let's just always wait for a conversion to complete before reporting
a temperature.
Fixes: 3d8f7a89a197 ("hwmon: (tmp102) Improve handling of initial read delay")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=197167
Reported-by: Ralf Goebel <[email protected]>
Cc: Ralf Goebel <[email protected]>
Reviewed-by: Jean Delvare <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
Simplify code and reduce code size by using the new hwmon
registration API.
Signed-off-by: Guenter Roeck <[email protected]>
|
|
Use devm_add_action_or_reset() instead of devm_add_action(), and
check its return code.
Signed-off-by: Guenter Roeck <[email protected]>
|
|
By converting the driver to regmap, we can use regmap to cache non-volatile
registers. Stop caching the temperature register; while potentially reading
it more often can result in reading it more often than necessary, this is
offset by the gain due to not re-reading the limit registers.
A positive side effect of this change is that limit registers can now be
read and updated before the first temperature conversion is complete.
Acked-by: Nishanth Menon <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
So far the chip was forced into polarity 0, even if it was preconfigured
differently. Do not touch the polarity when configuring the chip.
Also, the configuration register was read beack to check if the
configuration 'sticks'. Ultimately, that is similar to checking if the
chip is a tmp102 in the first place. Checking if a write into the
configuration register was successful is really not the way to do it,
and quite risky if the chip is not a tmp102, so drop that check.
Instead, verify if the configuration register has unexpected bits set
before writing into it.
Acked-by: Nishanth Menon <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
If the chip was in shutdown mode when the driver was loaded, the first
conversion is ready no more than 35 milli-seconds after the chip was
taken out of shutdown. The driver delay was so far set to 333 ms (HZ / 3),
which is much higher than the maximum time needed by the chip.
Reduce the time to 35 milli-seconds.
Introduce a 'valid' flag to ensure that sensor data is actually read
even if requested less than 333 ms after the driver was loaded.
Acked-by: Nishanth Menon <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
The FSF address can change, so drop it from the driver.
Acked-by: Nishanth Menon <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
By registering a cleanup function with devm_add_action(), we can
simplify the error path in the probe function and drop the remove
function entirely.
Acked-by: Nishanth Menon <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.
Cc: Jean Delvare <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: [email protected]
Cc: [email protected]
Acked-by: Guenter Roeck <[email protected]>
Signed-off-by: Eduardo Valentin <[email protected]>
|
|
TMP102 works based on conversions done periodically. However, as per
the TMP102 data sheet[1] the first conversion is triggered immediately
after we program the configuration register. The temperature data
registers do not reflect proper data until the first conversion is
complete (in our case HZ/4).
The driver currently sets the last_update to be jiffies - HZ, just
after the configuration is complete. When TMP102 driver registers
with the thermal framework, it immediately tries to read the sensor
temperature data. This takes place even before the conversion on the
TMP102 is complete and results in an invalid temperature read.
Depending on the value read, this may cause thermal framework to
assume that a critical temperature event has occurred and attempts to
shutdown the system.
Instead of causing an invalid mid-conversion value to be read
erroneously, we mark the last_update to be in-line with the current
jiffies. This allows the tmp102_update_device function to skip update
until the required conversion time is complete. Further, we ensure to
return -EAGAIN result instead of returning spurious temperature (such
as 0C) values to the caller to prevent any wrong decisions made with
such values. NOTE: this allows the read functions not to be blocking
and allows the callers to make the decision if they would like to
block or try again later. At least the current user(thermal) seems to
handle this by retrying later.
A simpler alternative approach could be to sleep in the probe for the
duration required, but that will result in latency that is undesirable
and delay boot sequence un-necessarily.
[1] http://www.ti.com/lit/ds/symlink/tmp102.pdf
Cc: Eduardo Valentin <[email protected]>
Reported-by: Aparna Balasubramanian <[email protected]>
Reported-by: Elvita Lobo <[email protected]>
Reported-by: Yan Liu <[email protected]>
Signed-off-by: Nishanth Menon <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
The thermal code uses int, long and unsigned long for temperatures
in different places.
Using an unsigned type limits the thermal framework to positive
temperatures without need. Also several drivers currently will report
temperatures near UINT_MAX for temperatures below 0°C. This will probably
immediately shut the machine down due to overtemperature if started below
0°C.
'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
is above the melting point of all known materials.
Consistently use a plain 'int' for temperatures throughout the thermal code and
the drivers. This only changes the places in the drivers where the temperature
is passed around as pointer, when drivers internally use another type this is
not changed.
Signed-off-by: Sascha Hauer <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Jean Delvare <[email protected]>
Reviewed-by: Lukasz Majewski <[email protected]>
Reviewed-by: Darren Hart <[email protected]>
Reviewed-by: Heiko Stuebner <[email protected]>
Reviewed-by: Peter Feuerer <[email protected]>
Cc: Punit Agrawal <[email protected]>
Cc: Zhang Rui <[email protected]>
Cc: Eduardo Valentin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Jean Delvare <[email protected]>
Cc: Peter Feuerer <[email protected]>
Cc: Heiko Stuebner <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Guenter Roeck <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Darren Hart <[email protected]>
Cc: [email protected]
Signed-off-by: Zhang Rui <[email protected]>
|
|
Setting a dev_pm_ops suspend/resume pair but not a set of
hibernation functions means those pm functions will not be
called upon hibernation.
Fix this by using SIMPLE_DEV_PM_OPS, which appropriately
assigns the suspend and hibernation handlers and move
mp102_suspend/tmp102_resume under CONFIG_PM_SLEEP to avoid
build warnings.
Signed-off-by: Grygorii Strashko <[email protected]>
[groeck: Declare tmp102_dev_pm_ops as static variable]
Signed-off-by: Guenter Roeck <[email protected]>
|
|
Different drivers request API extensions in of-thermal. For this reason,
additional callbacks are required to fit the new drivers needs.
The current API implementation expects the registering sensor driver
to provide a get_temp and get_trend callbacks as function parameters.
As the amount of callbacks is growing, this patch changes the existing
implementation to use a .ops field to hold all the of thermal callbacks
to sensor drivers.
This patch also changes the existing of-thermal users to fit the new
API design. No functional change is introduced in this patch.
Cc: Alexandre Courbot <[email protected]>
Cc: [email protected]
Cc: Grant Likely <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Rob Herring <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Zhang Rui <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Tested-by: Mikko Perttunen <[email protected]>
Reviewed-by: Mikko Perttunen <[email protected]>
Reviewed-by: Alexandre Courbot <[email protected]>
Reviewed-by: Lukasz Majewski <[email protected]>
Signed-off-by: Eduardo Valentin <[email protected]>
|
|
Simplify code, reduce code size, and attach sysfs attributes to hwmon device.
Reviewed-by: Jean Delvare <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
The pointer to client->dev is used several times in the probe function.
Simplify code by introducing a separate variable for it.
Reviewed-by: Jean Delvare <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
This patch adds to tmp102 temperature sensor the possibility
to expose itself as thermal zone device, registered on the
thermal framework.
The thermal zone is built only if a device tree node
describing a thermal zone for this sensor is present
inside the tmp102 DT node. Otherwise, the driver behavior
will be the same.
Note: This patch has also been reviewed by Jean D. He has
requested to perform a wider inspection of possible
users of thermal and hwmon interaction API. On the other
hand, the change on this patch is acceptable on first
step of overall code change.
Cc: Jean Delvare <[email protected]>
Cc: [email protected]
Cc: [email protected]
Acked-by: Guenter Roeck <[email protected]>
Signed-off-by: Eduardo Valentin <[email protected]>
|
|
Cc: Corentin Labbe <[email protected]>
Cc: Mark M. Hoffman <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Juerg Haefliger <[email protected]>
Cc: Andreas Herrmann <[email protected]>
Cc: Rudolf Marek <[email protected]>
Cc: Jim Cromie <[email protected]>
Cc: Roger Lucas <[email protected]>
Cc: Marc Hulsman <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
SENSORS_LIMIT and the generic clamp_val have the same functionality,
and clamp_val is more efficient.
This patch reduces text size by 9052 bytes and bss size by 11624 bytes
for x86_64 builds.
Signed-off-by: Guenter Roeck <[email protected]>
Acked-by: George Joseph <[email protected]>
Acked-by: Jean Delvare <[email protected]>
|
|
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.
Signed-off-by: Bill Pemberton <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: Alistair John Strachan <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Juerg Haefliger <[email protected]>
Cc: Andreas Herrmann <[email protected]>
Cc: Clemens Ladisch <[email protected]>
Cc: Rudolf Marek <[email protected]>
Cc: Jim Cromie <[email protected]>
Cc: "Mark M. Hoffman" <[email protected]>
Cc: Roger Lucas <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
|
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.
Signed-off-by: Bill Pemberton <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: Alistair John Strachan <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Juerg Haefliger <[email protected]>
Cc: Andreas Herrmann <[email protected]>
Cc: Clemens Ladisch <[email protected]>
Cc: Rudolf Marek <[email protected]>
Cc: Jim Cromie <[email protected]>
Cc: "Mark M. Hoffman" <[email protected]>
Cc: Roger Lucas <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
|
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.
Signed-off-by: Bill Pemberton <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: Alistair John Strachan <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Juerg Haefliger <[email protected]>
Cc: Andreas Herrmann <[email protected]>
Cc: Clemens Ladisch <[email protected]>
Cc: Rudolf Marek <[email protected]>
Cc: Jim Cromie <[email protected]>
Cc: "Mark M. Hoffman" <[email protected]>
Cc: Roger Lucas <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
|
Many hwmon drivers use jiffies but omit the inclusion of the header
file. Fix that, and also fix one driver which was including the header
file but didn't need it.
Signed-off-by: Jean Delvare <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Acked-by: Luca Tettamanti <[email protected]>
Cc: Marc Hulsman <[email protected]>
Cc: Rudolf Marek <[email protected]>
|
|
Convert to use devm_ functions to reduce code size and simplify the code.
Signed-off-by: Guenter Roeck <[email protected]>
Acked-by: Jean Delvare <[email protected]>
|
|
This patch converts the drivers in drivers/hwmon/* to use the
module_i2c_driver() macro which makes the code smaller and a bit simpler.
Signed-off-by: Axel Lin <[email protected]>
Cc: Corentin Labbe <[email protected]>
Cc: Dirk Eibach <[email protected]>
Cc: "Mark M. Hoffman" <[email protected]>
Cc: Steve Glendinning <[email protected]>
Cc: Riku Voipio <[email protected]>
Cc: Guillaume Ligneul <[email protected]>
Cc: David George <[email protected]>
Cc: "Hans J. Koch" <[email protected]>
Cc: Marc Hulsman <[email protected]>
Cc: Rudolf Marek <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
replaced strict_strtol with kstrtol and
replaced strict_strtuol with kstrtuol
This satisfies checkpatch -f
Compile tested only: no warnings or errors given
Signed-off-by: Frans Meulenbroeks <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
|
|
Make use of the new i2c_smbus_{read,write}_word_swapped functions.
This makes the driver code more compact and readable. It also ensures
proper error handling.
Signed-off-by: Jean Delvare <[email protected]>
Acked-by: Jonathan Cameron <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Cc: Dirk Eibach <[email protected]>
Cc: "Mark M. Hoffman" <[email protected]>
Cc: Guillaume Ligneul <[email protected]>
|
|
Fixes generated by 'codespell' and manually reviewed.
Signed-off-by: Lucas De Marchi <[email protected]>
|
|
I2C drivers can use the clientdata-pointer to point to private data. As I2C
devices are not really unregistered, but merely detached from their driver, it
used to be the drivers obligation to clear this pointer during remove() or a
failed probe(). As a couple of drivers forgot to do this, it was agreed that it
was cleaner if the i2c-core does this clearance when appropriate, as there is
no guarantee for the lifetime of the clientdata-pointer after remove() anyhow.
This feature was added to the core with commit
e4a7b9b04de15f6b63da5ccdd373ffa3057a3681 to fix the faulty drivers.
As there is no need anymore to clear the clientdata-pointer, remove all current
occurrences in the drivers to simplify the code and prevent confusion.
Signed-off-by: Wolfram Sang <[email protected]>
Acked-by: Mark Brown <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Acked-by: Richard Purdie <[email protected]>
Acked-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Jean Delvare <[email protected]>
|
|
Only stop the chip at driver exit if it was stopped when driver was
loaded. Leave it running otherwise.
Also restore the device configuration if probe failed, to not leave
the system in a dangling state.
Signed-off-by: Jean Delvare <[email protected]>
Cc: Steven King <[email protected]>
|
|
Suspend and resume functions shouldn't overwrite the configuration
register. They should only alter the one bit they have to touch.
Also don't assume that register reads and writes always succeed.
Handle errors properly, shall they happen.
Signed-off-by: Jean Delvare <[email protected]>
Cc: Steven King <[email protected]>
|
|
Fixes from my driver review:
http://lists.lm-sensors.org/pipermail/lm-sensors/2010-March/028051.html
Only the small changes are in there, more important changes will come
later separately as time permits.
* Drop the remnants of the now gone detect function
* The TMP102 has no known compatible chip
* Include the right header files
* Clarify why byte swapping of register values is needed
* Strip resolution info bit from temperature register value
* Set cache lifetime to 1/3 second
* Don't arbitrarily reject limit values; clamp as needed
* Make limit writing unconditional
* Don't check for transaction types the driver doesn't use
* Properly check for error when setting configuration
* Report error on failed probe
* Make the driver load automatically where needed
* Various other minor fixes
Signed-off-by: Jean Delvare <[email protected]>
Cc: Steven King <[email protected]>
|
|
Driver for the TI TMP102.
The TI TMP102 is similar to the LM75. It differs from the LM75 by
having a 16-bit conf register and the temp registers have a minimum
resolution of 12 bits; the extended conf register can select 13-bit
resolution (which this driver does) and also change the update rate
(which this driver currently doesn't use).
[JD: Fix tmp102_exit tag, must be __exit, not __init.]
Signed-off-by: Steven King <[email protected]>
Signed-off-by: Jean Delvare <[email protected]>
|