24 Nov, 2015

1 commit

  • The IMX6Q/IMX6DL SoC's have a 2-bit temperature grade stored in OTP which
    is valid for all IMX6 SoC's (despite the fact that the IMXSDLRM and
    IMXSXRM do not document this - this has been proven via tests as well as
    verified by Freescale FAE).

    Instead of assuming a fixed 85C for passive cooling threshold and 105C for
    critical use the thermal grade for these configurations.

    We will set the critical to maxT - 5C and passive to maxT - 10C.

    Cc: Anson Huang
    Cc: Fabio Estevam
    Acked-by: Shawn Guo
    Acked-by: Jon Nettleton
    Signed-off-by: Tim Harvey
    ----
    v3:
    - rebase against linux-soc-thermal.git
    - added ack's from Shawn and Jon
    v2:
    - remove check for IMX6Q and update comments: The OTP values have been tested
    on IMX6SOLO, IMX6DUALLITE, and IMX6SX and Freescale FAE has shared data with
    me that the OTP settings are the same and that the reference manuals will
    reflect this in their next updates.
    - set critical to max - 5C
    - set passive to max - 10C
    - display max temp in info
    - do not allow passive to be set above critical
    Signed-off-by: Eduardo Valentin

    Tim Harvey
     

31 Oct, 2015

2 commits

  • We recently changed this from unsigned long to int so it introduced an
    underflow bug.

    Fixes: 17e8351a7739 ('thermal: consistently use int for temperatures')
    Signed-off-by: Dan Carpenter
    Signed-off-by: Eduardo Valentin

    Dan Carpenter
     
  • The irq handler should be registered after the tempmon
    module has been initialized in a known state and the
    thermal_zone and cpu_cooling device have been registered
    successfully. Otherwise, if the irq is triggled earlier
    before thermal probe has been finished, it may lead to
    'NULL' pointer kernel panic.

    Signed-off-by: Bai Ping
    Signed-off-by: Eduardo Valentin

    Bai Ping
     

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
     

05 May, 2015

1 commit

  • Currently you can specify the weight of the cooling device in the device
    tree but that information is not populated to the
    thermal_bind_params where the fair share governor expects it to
    be. The of thermal zone device doesn't have a thermal_bind_params
    structure and arguably it's better to pass the weight inside the
    thermal_instance as it is specific to the bind of a cooling device to a
    thermal zone parameter.

    Core thermal code is fixed to populate the weight in the instance from
    the thermal_bind_params, so platform code that was passing the weight
    inside the thermal_bind_params continue to work seamlessly.

    While we are at it, create a default value for the weight parameter for
    those thermal zones that currently don't define it and remove the
    hardcoded default in of-thermal.

    Cc: Zhang Rui
    Cc: "Rafael J. Wysocki"
    Cc: Len Brown
    Cc: Peter Feuerer
    Cc: Darren Hart
    Cc: Eduardo Valentin
    Cc: Kukjin Kim
    Cc: Durgadoss R
    Signed-off-by: Kapileshwar Singh
    Signed-off-by: Eduardo Valentin

    Kapileshwar Singh
     

06 Jan, 2015

1 commit

  • Thermal sensor's clk is from pll3_usb_otg, per hardware
    design requirement, need to make sure pll3_usb_otg is disabled
    before STOP mode is entered, otherwise, all PFDs under it may
    enter incorrect state, this patch disables pll3_usb_otg before
    suspend and enables it after resume.

    Signed-off-by: Anson Huang
    Signed-off-by: Eduardo Valentin

    Anson Huang
     

21 Dec, 2014

1 commit


15 Dec, 2014

1 commit

  • Pull driver core update from Greg KH:
    "Here's the set of driver core patches for 3.19-rc1.

    They are dominated by the removal of the .owner field in platform
    drivers. They touch a lot of files, but they are "simple" changes,
    just removing a line in a structure.

    Other than that, a few minor driver core and debugfs changes. There
    are some ath9k patches coming in through this tree that have been
    acked by the wireless maintainers as they relied on the debugfs
    changes.

    Everything has been in linux-next for a while"

    * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
    Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
    fs: debugfs: add forward declaration for struct device type
    firmware class: Deletion of an unnecessary check before the function call "vunmap"
    firmware loader: fix hung task warning dump
    devcoredump: provide a one-way disable function
    device: Add dev__once variants
    ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
    ath: use seq_file api for ath9k debugfs files
    debugfs: add helper function to create device related seq_file
    drivers/base: cacheinfo: remove noisy error boot message
    Revert "core: platform: add warning if driver has no owner"
    drivers: base: support cpu cache information interface to userspace via sysfs
    drivers: base: add cpu_device_create to support per-cpu devices
    topology: replace custom attribute macros with standard DEVICE_ATTR*
    cpumask: factor out show_cpumap into separate helper function
    driver core: Fix unbalanced device reference in drivers_probe
    driver core: fix race with userland in device_add()
    sysfs/kernfs: make read requests on pre-alloc files use the buffer.
    sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
    fs: sysfs: return EGBIG on write if offset is larger than file size
    ...

    Linus Torvalds
     

12 Dec, 2014

1 commit

  • During imx_thermal probe we have the following log:

    [ 1.514819] imx_thermal 2000000.aips-bus:tempmon: failed to register cpufreq cooling device: -517
    [ 1.515064] platform 2000000.aips-bus:tempmon: Driver imx_thermal requests probe deferral

    Avoid printing the error message in the EPROBE_DEFER case.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Eduardo Valentin

    Fabio Estevam
     

09 Dec, 2014

2 commits

  • cpufreq_cooling_register() expects mask of all the CPUs where frequency
    constraint is applicable.

    This platform has more than one CPU to which these constraints will apply and so
    passing mask of only CPU0 wouldn't be sufficient. Also, this platform has a
    single cluster of CPUs and the constraint applies to all CPUs.

    If CPU0 is hoplugged out then we may face strange BUGs as cpu_cooling framework
    isn't aware of any siblings sharing clock line.

    Fix it by passing cpu_present_mask to cpufreq_cooling_register().

    Cc: Shawn Guo
    Signed-off-by: Viresh Kumar
    Signed-off-by: Eduardo Valentin

    Viresh Kumar
     
  • In this patch, the cpu_cooling code checks for the usability of cpufreq
    layer before proceeding with the CPU cooling device registration. The
    main reason is: CPU cooling device is not usable if cpufreq cannot
    switch frequencies.

    Similar checks are spread in thermal drivers. Thus, the advantage now
    is to have the check in a single place: cpu cooling device registration.
    For this reason, this patch also updates the existing drivers that
    depend on CPU cooling to simply propagate the error code of the cpu
    cooling registration call. Therefore, in case cpufreq is not ready, the
    thermal drivers will still return -EPROBE_DEFER, in an attempt to try
    again when cpufreq layer gets ready.

    Cc: devicetree@vger.kernel.org
    Cc: Grant Likely
    Cc: Kukjin Kim
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-pm@vger.kernel.org
    Cc: linux-samsung-soc@vger.kernel.org
    Cc: Naveen Krishna Chatradhi
    Cc: Rob Herring
    Cc: Zhang Rui
    Acked-by: Viresh Kumar
    Signed-off-by: Viresh Kumar
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     

10 Nov, 2014

1 commit

  • imx_get_temp might be called before the sensor clock is prepared
    thus resulting in a timeout of the first attempt to read temp:
    thermal thermal_zone0: failed to read out thermal zone 0
    Happened to me on a Utilite Standard with IMX6 Dual SoC.

    Reason is that in imx_thermal_probe thermal_zone_device_register
    is called before the sensor clock is prepared.
    thermal_zone_device_register however calls
    thermal_zone_device_update which eventually calls imx_get_temp.

    Fix this by preparing the clock before calling
    thermal_zone_device_register.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Eduardo Valentin

    Heiner Kallweit
     

08 Nov, 2014

1 commit


04 Nov, 2014

1 commit


20 Oct, 2014

1 commit


09 Aug, 2014

1 commit

  • i.MX6SX has some new features of thermal interrupt function,
    there are LOW, HIGH and PANIC irq for thermal sensor, so add
    platform data to separate different thermal version;

    The reset value of LOW ALARM is 0 which means the highest
    temp, so the LOW ALARM will be triggered once irq is enabled,
    so we need to correct it before enabling thermal irq;

    Enable PANIC ALARM as critical trip point, it will trigger
    system reset via SRC module once PANIC IRQ is triggered, it
    is pure hardware function, so use it instead of software
    reset by cooling device.

    Signed-off-by: Anson Huang
    Tested-by: Shawn Guo
    Signed-off-by: Eduardo Valentin

    Anson Huang
     

01 Jul, 2014

1 commit

  • On latest i.MX6 SOC with thermal calibration data of 0x5A100000,
    the critical trip temperature will be an invalid value and
    cause system auto shutdown as below log:

    thermal thermal_zone0: critical temperature reached(42 C),shutting down

    So, with universal formula for thermal sensor, only room
    temperature point is calibrated, which means the calibration
    data read from fuse only has valid data of bit [31:20], others
    are all 0, the critical trip point temperature can NOT depend
    on the hot point calibration data, here we set it to 20 C higher
    than default passive temperature.

    Signed-off-by: Anson Huang
    Acked-by: Shawn Guo
    Signed-off-by: Zhang Rui

    Anson Huang
     

08 Apr, 2014

1 commit

  • Thermal sensor used to need two calibration points which are
    in fuse map to get a slope for converting thermal sensor's raw
    data to real temperature in degree C. Due to the chip calibration
    limitation, hardware team provides an universal formula to get
    real temperature from internal thermal sensor raw data:

    Slope = 0.4297157 - (0.0015976 * 25C fuse);

    Update the formula, as there will be no hot point calibration
    data in fuse map from now on.

    Signed-off-by: Anson Huang
    Acked-by: Shawn Guo
    Signed-off-by: Zhang Rui

    Anson Huang
     

06 Jan, 2014

2 commits


03 Jan, 2014

1 commit

  • Thermal sensor needs pll3_usb_otg when measuring temperature,
    otherwise the temperature read will be incorrect, so need to
    enable this clk before sensor working, for alarm function,
    as hardware will take measurement periodically, so we should
    keep this clk always on once alarm function is enabled.

    Signed-off-by: Anson Huang
    Acked-by: Shawn Guo
    Signed-off-by: Zhang Rui

    Anson Huang
     

02 Jan, 2014

2 commits

  • Add the module device table declaration so the module can be loaded
    automatically at boot time.

    Signed-off-by: Russell King
    Acked-by: Shawn Guo
    Acked-by: Eduardo Valentin
    Signed-off-by: Zhang Rui

    Russell King
     
  • Fixes regression introduced by:

    commit 37713a1e8e4c1a1067ad4c99296f78d3c82ed9c4
    Author: Philipp Zabel
    Date: Thu Aug 1 18:33:12 2013 +0200

    thermal: imx: implement thermal alarm interrupt handling

    The commit 37713a1e8e4 makes imx thermal sensor always powered up as alarm
    function is enabled, but the suspend callback of imx thermal returns
    success only if thermal sensor is powered down, so it will always returns
    fail hence break system's suspend, this patch disables imx thermal sensor
    before suspend and re-enable it after resume.

    Signed-off-by: Anson Huang
    Acked-by: Shawn Guo
    Signed-off-by: Zhang Rui

    Anson Huang
     

15 Aug, 2013

2 commits


13 Aug, 2013

1 commit

  • This is based on the initial imx thermal work done by
    Rob Lee (Not sure if the email address is still
    valid). Since he is no longer interested in the work and I have
    rewritten a significant amount of the code, I just took the authorship
    over from him.

    It adds the imx thermal support using Temperature Monitor (TEMPMON)
    block found on some Freescale i.MX SoCs. The driver uses syscon regmap
    interface to access TEMPMON control registers and calibration data, and
    supports cpufreq as the cooling device.

    Signed-off-by: Shawn Guo
    Signed-off-by: Eduardo Valentin

    Shawn Guo