11 Dec, 2015

1 commit

  • 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
    Reported-by: Aparna Balasubramanian
    Reported-by: Elvita Lobo
    Reported-by: Yan Liu
    Signed-off-by: Nishanth Menon
    Signed-off-by: Guenter Roeck

    Nishanth Menon
     

03 Aug, 2015

1 commit

  • 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
    Acked-by: Geert Uytterhoeven
    Reviewed-by: Jean Delvare
    Reviewed-by: Lukasz Majewski
    Reviewed-by: Darren Hart
    Reviewed-by: Heiko Stuebner
    Reviewed-by: Peter Feuerer
    Cc: Punit Agrawal
    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: linux-pm@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Jean Delvare
    Cc: Peter Feuerer
    Cc: Heiko Stuebner
    Cc: Lukasz Majewski
    Cc: Stephen Warren
    Cc: Thierry Reding
    Cc: linux-acpi@vger.kernel.org
    Cc: platform-driver-x86@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-omap@vger.kernel.org
    Cc: linux-samsung-soc@vger.kernel.org
    Cc: Guenter Roeck
    Cc: Rafael J. Wysocki
    Cc: Maxime Ripard
    Cc: Darren Hart
    Cc: lm-sensors@lm-sensors.org
    Signed-off-by: Zhang Rui

    Sascha Hauer
     

04 Feb, 2015

1 commit

  • 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
    [groeck: Declare tmp102_dev_pm_ops as static variable]
    Signed-off-by: Guenter Roeck

    Grygorii Strashko
     

20 Nov, 2014

1 commit

  • 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
    Cc: devicetree@vger.kernel.org
    Cc: Grant Likely
    Cc: Guenter Roeck
    Cc: Jean Delvare
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-pm@vger.kernel.org
    Cc: linux-tegra@vger.kernel.org
    Cc: lm-sensors@lm-sensors.org
    Cc: Rob Herring
    Cc: Stephen Warren
    Cc: Thierry Reding
    Cc: Zhang Rui
    Acked-by: Guenter Roeck
    Tested-by: Mikko Perttunen
    Reviewed-by: Mikko Perttunen
    Reviewed-by: Alexandre Courbot
    Reviewed-by: Lukasz Majewski
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     

22 May, 2014

2 commits


04 Dec, 2013

1 commit

  • 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
    Cc: lm-sensors@lm-sensors.org
    Cc: linux-kernel@vger.kernel.org
    Acked-by: Guenter Roeck
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     

08 Apr, 2013

1 commit


26 Jan, 2013

1 commit

  • 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
    Acked-by: George Joseph
    Acked-by: Jean Delvare

    Guenter Roeck
     

29 Nov, 2012

3 commits

  • CONFIG_HOTPLUG is going away as an option so __devexit is no
    longer needed.

    Signed-off-by: Bill Pemberton
    Cc: Hans de Goede
    Cc: Jean Delvare
    Cc: Alistair John Strachan
    Cc: Fenghua Yu
    Cc: Juerg Haefliger
    Cc: Andreas Herrmann
    Cc: Clemens Ladisch
    Cc: Rudolf Marek
    Cc: Jim Cromie
    Cc: "Mark M. Hoffman"
    Cc: Roger Lucas
    Acked-by: Guenter Roeck
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devinit is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Hans de Goede
    Cc: Jean Delvare
    Cc: Alistair John Strachan
    Cc: Fenghua Yu
    Cc: Juerg Haefliger
    Cc: Andreas Herrmann
    Cc: Clemens Ladisch
    Cc: Rudolf Marek
    Cc: Jim Cromie
    Cc: "Mark M. Hoffman"
    Cc: Roger Lucas
    Acked-by: Guenter Roeck
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Hans de Goede
    Cc: Jean Delvare
    Cc: Alistair John Strachan
    Cc: Fenghua Yu
    Cc: Juerg Haefliger
    Cc: Andreas Herrmann
    Cc: Clemens Ladisch
    Cc: Rudolf Marek
    Cc: Jim Cromie
    Cc: "Mark M. Hoffman"
    Cc: Roger Lucas
    Acked-by: Guenter Roeck
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     

10 Oct, 2012

1 commit


22 Jul, 2012

1 commit


19 Mar, 2012

1 commit

  • 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
    Cc: Corentin Labbe
    Cc: Dirk Eibach
    Cc: "Mark M. Hoffman"
    Cc: Steve Glendinning
    Cc: Riku Voipio
    Cc: Guillaume Ligneul
    Cc: David George
    Cc: "Hans J. Koch"
    Cc: Marc Hulsman
    Cc: Rudolf Marek
    Signed-off-by: Guenter Roeck

    Axel Lin
     

06 Jan, 2012

1 commit


04 Nov, 2011

1 commit

  • 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
    Acked-by: Jonathan Cameron
    Acked-by: Guenter Roeck
    Cc: Dirk Eibach
    Cc: "Mark M. Hoffman"
    Cc: Guillaume Ligneul

    Jean Delvare
     

31 Mar, 2011

1 commit


03 Jun, 2010

1 commit

  • 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
    Acked-by: Mark Brown
    Acked-by: Greg Kroah-Hartman
    Acked-by: Richard Purdie
    Acked-by: Dmitry Torokhov
    Signed-off-by: Jean Delvare

    Wolfram Sang
     

28 May, 2010

4 commits

  • 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
    Cc: Steven King

    Jean Delvare
     
  • 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
    Cc: Steven King

    Jean Delvare
     
  • 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
    Cc: Steven King

    Jean Delvare
     
  • 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
    Signed-off-by: Jean Delvare

    Steven King