31 May, 2019

1 commit

  • 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
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

16 Apr, 2019

2 commits

  • 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

    Guenter Roeck
     
  • 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

    Guenter Roeck
     

19 Feb, 2019

1 commit

  • Replace S_ 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

    Guenter Roeck
     

07 Sep, 2018

1 commit

  • 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
    Signed-off-by: Mark Brown

    David Frey
     

24 Oct, 2017

1 commit

  • 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
    Cc: Ralf Goebel
    Reviewed-by: Jean Delvare
    Signed-off-by: Guenter Roeck

    Guenter Roeck
     

02 Apr, 2017

1 commit

  • 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:.

    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
    Signed-off-by: Guenter Roeck

    Javier Martinez Canillas
     

09 Sep, 2016

1 commit


01 Aug, 2016

1 commit


13 Jul, 2016

3 commits

  • 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
    Signed-off-by: Guenter Roeck

    Guenter Roeck
     
  • 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
    Signed-off-by: Guenter Roeck

    Guenter Roeck
     
  • 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
    Signed-off-by: Guenter Roeck

    Guenter Roeck
     

28 Jun, 2016

2 commits


17 May, 2016

1 commit


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