21 Dec, 2018

1 commit

  • [ Upstream commit 70bb27b79adf63ea39e37371d09c823c7a8f93ce ]

    Commit 8c0e64ac4075 ("thermal: armada: get rid of the ->is_valid()
    pointer") removed the unnecessary indirection through a function
    pointer, but in doing so, also removed the negation operator too:

    - if (priv->data->is_valid && !priv->data->is_valid(priv)) {
    + if (armada_is_valid(priv)) {

    which results in:

    armada_thermal f06f808c.thermal: Temperature sensor reading not valid
    armada_thermal f2400078.thermal: Temperature sensor reading not valid
    armada_thermal f4400078.thermal: Temperature sensor reading not valid

    at boot, or whenever the "temp" sysfs file is read. Replace the
    negation operator.

    Fixes: 8c0e64ac4075 ("thermal: armada: get rid of the ->is_valid() pointer")
    Signed-off-by: Russell King
    Signed-off-by: Eduardo Valentin
    Signed-off-by: Sasha Levin

    Russell King
     

02 Aug, 2018

1 commit


28 Jul, 2018

12 commits

  • The implementation of armada_is_valid() is very simple and is the same
    across all the versions of the IP since the ->is_valid_bit has been
    introduced. Simplify the structure by getting rid of the function
    pointer and calling directly the function.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Sensor selection when using multiple sensors already checks for the
    sensor validity. Move it to the legacy ->get_temp() hook, where it is
    still needed.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • When using new bindings with multiple sensors, sensor validity is
    checked twice because sensor selection also checks for the validity.

    Remove the redundant call from the IP initialization helper and move it
    to the legacy probe section where it is still needed.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • MVEBU thermal IP supports multiple channels. Each channel may have
    several sensors but for now each channel is wired to only one thermal
    sensor. The first channel always points to the so called internal
    sensor, within the thermal IP. There is usually one more channel (with
    one sensor each time) per CPU. The code has been written to support
    possible evolutions of the ap806 IP that would embed more CPUs and thus
    more channels to select. Each channel should be referenced in the device
    tree as an independent thermal zone.

    Add the possibility to read each of these sensors through sysfs by
    registering all the sensors (translated in "thermal_zone"). Also add a
    mutex on these accesses to avoid read conflicts (only one channel/sensor
    may be selected and read at a time).

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Current use of thermal_zone_device_register() triggers a warning at boot
    and should be replaced by devm_thermal_zone_of_sensor_register(). This
    allows better handling of multiple thermal zones for later multi-sensors
    support.

    Also change the driver data to embed a new structure to make the
    difference between legacy data (which needs to be cleaned) and
    syscon-related data.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Until recently, only one register was referenced in MVEBU thermal IP
    node. Recent changes added a second entry pointing to another
    register right next to it. We cannot know for sure that we will not
    have to access other registers. That will be actually the case when
    overheat interrupt feature will come, where it will be needed to access
    DFX registers in the same area.

    This approach is not scalable so instead of adding consinuously memory
    areas in the DT (and change the DT bindings, while keeping backward
    compatibility), move the thermal node into a wider syscon from which it
    will be possible to also configure the thermal interrupt.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Configure the sample frequency and number of averaged samples.

    This is needed for two reasons:
    1/ To be bootloader independent.
    2/ To prepare the introduction of multi-sensors support by preventing
    inconsistencies when reading temperatures that could be a mean of
    samples took from different sensors.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Until now, Armada 380 and CP110 could share the same ->init() function
    because their use was identical.

    Prepare the support of multi-sensors support and overheat interrupt
    feature by separating the initialization paths before they actually
    diverge.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Calling a hook ->init_sensor() while what is initialized is the IP
    itself and not the sensors is misleading. Rename the hook ->init() to
    avoid any confusion in later work bringing multi-sensors support.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • On older versions of this thermal IP, TSEN referred as the internal
    sensor in the thermal IP while EXT_TSEN referred as sensors outside of
    this IP, ie in the CPUs most of the time. The bit names in the
    specifications do not follow this rule anymore, so remove these comments
    that are misleading.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Prepare the migration to use regmaps by first simplifying the
    initialization functions: avoid unnecessary write/read cycles on
    configuration registers.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Thermal zone names must follow certain rules imposed by the framework.
    They are limited in length and shall not have any hyphen '-'.

    This is done in a separate function for future use in another location.

    Signed-off-by: Miquel Raynal
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     

02 Jan, 2018

10 commits

  • After registration to the thermal core, sysfs will make one entry
    per instance of the driver in /sys/class/thermal_zoneX and
    /sys/class/hwmon/hwmonX, X being the index of the instance, all of them
    having the type/name "armada_thermal".

    Until now there was only one thermal zone per SoC but SoCs like Armada
    A7K and Armada A8K have respectively two and three thermal zones (one
    per AP and one per CP) and this number is subject to grow in the future.

    Use dev_name() instead of the "armada_thermal" string to get a
    meaningful name and be able to identify the thermal zones from
    userspace.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Tested-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • The thermal core will check for sensors validity right after the
    initialization callback has returned. As the initialization routine make
    a reset, the sensors are not ready immediately and the core spawns an
    error in the dmesg. Avoid this annoying situation by polling on the
    validity bit before exiting from these routines. This also avoid the use
    of blind sleeps.

    Suggested-by: David Sniatkiwicz
    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Errata #132698 highlights an error in the default value of Tc trim.
    Set this parameter to b'011.

    Suggested-by: David Sniatkiwicz
    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Update Armada thermal driver Kconfig entry as well as the driver's
    MODULE_DESCRIPTION content, now that 64-bit SoCs are also supported,
    eg. Armada 7K and Armada 8K.

    Use the generic term "Marvell EBU Armada SoCs" instead of listing all
    the supported SoCs everywhere (excepted in the Kconfig description,
    where it is useful to have a list).

    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • The CP110 component is integrated in the Armada 8k and 7k lines of
    processors.

    Signed-off-by: Baruch Siach
    [: renamed the register pointers as
    well as some definitions related to the new register names and
    simplified the init sequence for Armada 380]
    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Tested-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Baruch Siach
     
  • The AP806 component is integrated in the Armada 8K and 7K lines of
    processors.

    The thermal sensor sample field on the status register is a signed
    value. Extend armada_get_temp() and the driver structure to handle
    signed values.

    Signed-off-by: Baruch Siach
    [: Changes when applying over the
    previous patches, including the register names changes, also switched
    the coefficients values to s64 instead of unsigned long to deal with
    negative values and used do_div instead of the traditionnal '/']
    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Tested-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Baruch Siach
     
  • Three 32-bit registers are used to drive the thermal IP: control0,
    control1 and status. The two control registers share the same name both
    in the documentation and in the code, while the latter is referred as
    "sensor" in the code. Rename this pointer to be called "status" in order
    to be aligned with the documentation.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Bindings were incomplete for a long time by only exposing one of the two
    available control registers. To ease the migration to the full bindings
    (already in use for the Armada 375 SoC), rename the pointers for
    clarification. This way, it will only be needed to add another pointer
    to access the other control register when the time comes.

    This avoids dangerous situations where the offset 0 of the control
    area can be either one register or the other depending on the bindings
    used. After this change, device trees of other SoCs could be migrated to
    the "full" bindings if they may benefit from features from the
    unaccessible register, without any change in the driver.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Tested-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • All Armada SoCs use one bit to declare if the sensor values are valid.
    This bit moves across the versions of the IP.

    The method until then was to do both a shift and compare with an useless
    flag of "0x1". It is clearer and quicker to directly save the value that
    must be ANDed instead of the bit position and do a single bitwise AND
    operation.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Miquel Raynal
     
  • Use msleep for long (> 10ms) delays, instead of the busy waiting mdelay.
    All delays are called from the probe routine, where scheduling is
    allowed.

    Signed-off-by: Baruch Siach
    Signed-off-by: Miquel Raynal
    Reviewed-by: Gregory CLEMENT
    Signed-off-by: Eduardo Valentin

    Baruch Siach
     

01 Nov, 2017

1 commit


31 Oct, 2015

1 commit


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
     

09 May, 2015

1 commit


18 Dec, 2014

1 commit

  • Pull thermal management update from Zhang Rui:
    "Summary:

    - of-thermal extension to allow drivers to register and use its
    functionality in a better way, without exploiting thermal core.
    From Lukasz Majewski.

    - Fix a bug in intel_soc_dts_thermal driver which calls a sleep
    function in interrupt handler. From Maurice Petallo.

    - add a thermal UAPI header file for exporting the thermal generic
    netlink information to user-space. From Florian Fainelli.

    - First round of refactoring in Exynos driver. Bartlomiej and Lukasz
    are attempting to make it lean and easier to understand.

    - New thermal driver for Rockchip (rk3288), with support for DT
    thermal. From Caesar Wang.

    - New thermal driver for Nvidia, Tegra124 SOCTHERM driver, with
    support for DT thermal. From Mikko Perttunen.

    - New cooling device, based on common clock framework. From Eduardo
    Valentin.

    - a couple of small fixes in thermal core framework. From Srinivas
    Pandruvada, Javi Merino, Luis Henriques.

    - Dropping Armada A375-Z1 SoC thermal support as the chip is not in
    the market, armada folks decided to drop its support.

    - a couple of small fixes and cleanups in int340x thermal driver"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (58 commits)
    thermal: provide an UAPI header file
    Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call
    thermal/powerclamp: add id for braswell cpu
    thermal: Intel SoC DTS: Don't do thermal zone update inside spin_lock
    Thermal: fix platform_no_drv_owner.cocci warnings
    Thermal/int340x: avoid unnecessary pointer casting
    thermal: int3403: Delete a check before thermal_zone_device_unregister()
    thermal/int3400: export uuids
    thermal: of: Extend current of-thermal.c code to allow setting emulated temp
    thermal: of: Extend of-thermal to export table of trip points
    thermal: of: Rename struct __thermal_trip to struct thermal_trip
    thermal: of: Extend of-thermal.c to provide check if trip point is valid
    thermal: of: Extend of-thermal.c to provide number of trip points
    thermal: Fix error path in thermal_init()
    thermal: lock the thermal zone when switching governors
    thermal: core: ignore invalid trip temperature
    thermal: armada: Remove support for A375-Z1 SoC
    thermal: rockchip: add driver for thermal
    dt-bindings: document Rockchip thermal
    thermal: exynos: remove exynos_tmu_data.h include
    ...

    Linus Torvalds
     

25 Nov, 2014

1 commit


20 Oct, 2014

1 commit


15 May, 2014

7 commits

  • Now that a generic infrastructure is in place, it's possible to support
    the Armada 380 SoC thermal sensor. This sensor is similar to the one
    available in the already supported SoCs, with its specific temperature formula
    and specific sensor initialization.

    Acked-by: Jason Cooper
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Zhang Rui

    Ezequiel Garcia
     
  • Now that a generic infrastructure is in place, it's possible to support
    the new Armada 375 SoC thermal sensor. This sensor is similar to the one
    available in the already supported SoCs, with its specific temperature formula
    and specific sensor initialization.

    In addition, we also add support for the Z1 SoC stepping, which needs
    an initialization-quirk to work properly.

    Acked-by: Jason Cooper
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Zhang Rui

    Ezequiel Garcia
     
  • In order to support inverted-formula thermal sensor readout, this commit
    introduces an 'inverted' field in the SoC-specific structure which
    allows to specify an inversion of the temperature formula.

    Acked-by: Jason Cooper
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Zhang Rui

    Ezequiel Garcia
     
  • In order to perform SoC-specific quirks on platforms that need them,
    this commit adds a new parameter to the init_sensor() function.
    This will be used to support early silicons of the Armada 375 SoC,
    to workaround some hardware issues.

    Acked-by: Jason Cooper
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Zhang Rui

    Ezequiel Garcia
     
  • In order to support similar SoC where the sensor value and valid
    bit can have different shifts and/or mask, we add such fields to the
    per-variant structure, instead of having the values hardcoded.

    Acked-by: Jason Cooper
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Zhang Rui

    Ezequiel Garcia
     
  • In order to support other similar SoC, with different sensor
    coefficients, this commit adds the coeficients to the per-variant
    structure, instead of having the formula hardcoded.

    Acked-by: Jason Cooper
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Zhang Rui

    Ezequiel Garcia
     
  • As preparation work to add a generic infrastructure to support
    different SoC variants, the armada_thermal_ops will be used
    to host the SoC-specific fields, such as formula values and
    register shifts.

    For this reason, the name armada_thermal_ops is no longer suitable,
    and this commit replaces it with armada_thermal_data.

    Acked-by: Jason Cooper
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Zhang Rui

    Ezequiel Garcia
     

28 May, 2013

2 commits