23 Feb, 2017

4 commits


12 Jan, 2017

6 commits

  • commit e9572fdd13e299cfba03abbfd2786c84ac055249 upstream.

    Since commit commit eb1c8f4325d5 ("hwmon: (lm90) Convert to use new hwmon
    registration API") the temp1_max_alarm and temp1_crit_alarm attributes are
    mapped to the same alarm bit. Fix the typo.

    Fixes: eb1c8f4325d5 ("hwmon: (lm90) Convert to use new hwmon registration API")
    Signed-off-by: Micehael Walle
    Signed-off-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Michael Walle
     
  • commit 4fccd4a1e8944033bcd7693ea4e8fb478cd2059a upstream.

    Fix overflows seen when writing into fan speed limit attributes.
    Also fix crash due to division by zero, seen when certain very
    large values (such as 2147483648, or 0x80000000) are written
    into fan speed limit attributes.

    Fixes: 594fbe713bf60 ("Add support for GMT G762/G763 PWM fan controllers")
    Cc: Arnaud Ebalard
    Reviewed-by: Jean Delvare
    Signed-off-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     
  • commit c0d04e9112ad59d73f23f3b0f6726c5e798dfcbf upstream.

    Fix overflows seen when writing voltage and temperature limit attributes.

    The value passed to DIV_ROUND_CLOSEST() needs to be clamped, and the
    value parameter passed to nct7802_write_fan_min() is an unsigned long.

    Also, writing values larger than 2700000 into a fan limit attribute results
    in writing 0 into the chip's limit registers. The exact behavior when
    writing this value is unspecified. For consistency, report a limit of
    1350000 if the chip register reads 0. This may be wrong, and the chip
    behavior should be verified with the actual chip, but it is better than
    reporting a value of 0 (which, when written, results in writing a value
    of 0x1fff into the chip register).

    Fixes: 3434f3783580 ("hwmon: Driver for Nuvoton NCT7802Y")
    Reviewed-by: Jean Delvare
    Signed-off-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     
  • commit e36ce99ee0815d7919a7b589bfb66f3de50b6bc7 upstream.

    Module test reports:

    temp1_max: Suspected overflow: [160000 vs. 0]
    temp1_min: Suspected overflow: [160000 vs. 0]

    This is seen because the values passed when writing temperature limits
    are unbound.

    Reviewed-by: Jean Delvare
    Fixes: 6099469805c2 ("hwmon: Support for Dallas Semiconductor DS620")
    Signed-off-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     
  • commit 4538bfbf2d9f1fc48c07ac0cc0ee58716fe7fe96 upstream.

    Converts the unsigned temperature values from the i2c read
    to be sign extended as defined in the datasheet so that
    negative temperatures are properly read.

    Fixes: 28e6274d8fa67 ("hwmon: (amc6821) Avoid forward declaration")
    Signed-off-by: Jared Bents
    Signed-off-by: Matt Weber
    [groeck: Dropped unnecessary continuation line]
    Signed-off-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Jared Bents
     
  • commit 13edb767aa609b6efb7c0c2b57fbd72a6ded0eed upstream.

    If the driver is built as a module, autoload won't work because the module
    alias information is not filled. So user-space can't match the registered
    device with the corresponding module.

    Export the module alias information using the MODULE_DEVICE_TABLE() macro.

    Before this patch:

    $ modinfo drivers/hwmon/scpi-hwmon.ko | grep alias
    $

    After this patch:

    $ modinfo drivers/hwmon/scpi-hwmon.ko | grep alias
    alias: of:N*T*Carm,scpi-sensorsC*
    alias: of:N*T*Carm,scpi-sensors

    Signed-off-by: Javier Martinez Canillas
    Fixes: ea98b29a05e9c ("hwmon: Support sensors exported via ARM SCP interface")
    Signed-off-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Javier Martinez Canillas
     

24 Oct, 2016

1 commit

  • If dev_kcalloc fails to allocate hw_dev->groups then the current
    exit path is a direct return, causing a leak of resources such
    as hwdev and ida is not removed. Fix this by exiting via the
    free_hwmon exit path that performs the necessary resource cleanup.

    Signed-off-by: Colin Ian King
    Signed-off-by: Guenter Roeck

    Colin Ian King
     

18 Oct, 2016

2 commits

  • We should only dereference "data" after we check if it is an error
    pointer.

    Fixes: 54187ff9d766 ('hwmon: (max31790) Convert to use new hwmon registration API')
    Signed-off-by: Dan Carpenter
    Signed-off-by: Guenter Roeck

    Dan Carpenter
     
  • Unlike the temperature thresholds the temperature data is a 9-bit signed
    value. This allows and additional 0.5 degrees of precision on the
    reading but makes handling negative values slightly harder. In order to
    have sign-extension applied correctly the 9-bit value is stored in the
    upper bits of a signed 16-bit value. When presenting this in sysfs the
    value is shifted and scaled appropriately.

    Signed-off-by: Chris Packham
    Signed-off-by: Guenter Roeck

    Chris Packham
     

05 Oct, 2016

1 commit

  • …t/groeck/linux-staging

    Pull hwmon updates from Guenter Roeck:

    - New hwmon registration API, including ports of several drivers to the
    new API

    - New hwmon driver for APM X-Gene SoC

    - Added support for UCD90160, DPS-460, DPS-800, and SGD009 PMBUs chips

    - Various cleanups, minor improvements, and fixes in several drivers

    * tag 'hwmon-for-linus-v4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (54 commits)
    hwmon: (nct6775) Add support for multiple virtual temperature sources
    hwmon: (adt7470) No need for additional synchronization on kthread_stop()
    hwmon: (lm95241) Update module description to include LM95231
    hwmon: (lm95245) Select REGMAP_I2C
    hwmon: (ibmpowernv) Fix label for cores numbers not threads
    hwmon: (adt7470) Allow faster removal
    hwmon: (adt7470) Add write support to alarm_mask
    hwmon: (xgene) access mailbox as RAM
    hwmon: (lm95245) Use new hwmon registration API
    hwmon: (lm95241) Convert to use new hwmon registration API
    hwmon: (jc42) Convert to use new hwmon registration API
    hwmon: (max31790) Convert to use new hwmon registration API
    hwmon: (nct7904) Convert to use new hwmon registration API
    hwmon: (ltc4245) Convert to use new hwmon registration API
    hwmon: (tmp421) Convert to use new hwmon registration API
    hwmon: (tmp102) Convert to use new hwmon registration API
    hwmon: (lm90) Convert to use new hwmon registration API
    hwmon: (lm75) Convert to use new hwmon registration API
    hwmon: (xgene) Fix crash when alarm occurs before driver probe
    hwmon: (iio_hwmon) defer probe when no channel is found
    ...

    Linus Torvalds
     

19 Sep, 2016

2 commits

  • For virtual temperatures, the actual temperature values are written
    by software, presumably by the BIOS. This functionality is (as of
    right now) supported on NCT6791D, NCT6792D, and NCT6793D. On those chips,
    the temperatures are written into registers 0xea..0xef on page 0.
    This is known to be used on some Asus motherboards, where the actual
    temperature source can be configured in the BIOS.

    Report the 'virtual' temperatures for all monotoring sources to address
    this situation.

    Example for the resulting output (as seen with the 'sensors' command):

    nct6791-isa-0290
    Adapter: ISA adapter
    ...
    Virtual_TEMP: +31.0°C
    PECI Agent 0: +38.5°C
    Virtual_TEMP: +32.0°C
    ...

    Signed-off-by: Guenter Roeck

    Guenter Roeck
     
  • The kthread_stop() waits for the thread to exit. There is no need for an
    additional synchronization needed to join on the kthread.

    The completion was added by 89fac11cb3e7 ("adt7470: make automatic fan
    control really work").

    Signed-off-by: Daniel Wagner
    Cc: Darrick J. Wong
    Cc: Jean Delvare
    Cc: Guenter Roeck
    Signed-off-by: Guenter Roeck

    Daniel Wagner
     

13 Sep, 2016

3 commits


11 Sep, 2016

2 commits

  • adt7470_remove will wait for the update thread to complete before
    returning. This had a worst-case time of up to the user-configurable
    auto_update_interval.

    Replace msleep_interruptible with set_current_state and schedule_timeout
    so that kthread_stop will interrupt the sleep.

    Signed-off-by: Joshua Scott
    Signed-off-by: Guenter Roeck

    Joshua Scott
     
  • Add write support for the alarm_mask. A base of 0 is provided so that
    either hex or decimal can be used. The hex format when reading alarm_mask
    is unchanged.

    Signed-off-by: Joshua Scott
    Signed-off-by: Guenter Roeck

    Joshua Scott
     

10 Sep, 2016

1 commit

  • The newly added hwmon driver fails to build in an allmodconfig
    kernel:

    ERROR: "memblock_is_memory" [drivers/hwmon/xgene-hwmon.ko] undefined!

    According to comments in the code, the mailbox is a shared memory region,
    not a set of MMIO registers, so we should use memremap() for mapping it
    instead of ioremap or acpi_os_ioremap, and pointer dereferences instead
    of readl/writel.

    The driver already uses plain kernel pointers, so it's a bit unusual
    to work with functions that operate on __iomem pointers, and this
    fixes that part too.

    I'm using READ_ONCE/WRITE_ONCE here to keep the existing behavior
    regarding the ordering of the accesses from the CPU, but note that
    there are no barriers (also unchanged from before).

    I'm also keeping the endianness behavior, though I'm unsure whether
    the message data was supposed to be in LE32 format in the first
    place, it's possible this was meant to be interpreted as a byte
    stream instead.

    Signed-off-by: Arnd Bergmann
    Acked-by: Hoan Tran
    Tested-by: Hoan Tran
    Signed-off-by: Guenter Roeck

    Arnd Bergmann
     

09 Sep, 2016

18 commits