[U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()

Christian Gmeiner christian.gmeiner at gmail.com
Fri May 15 10:14:52 CEST 2015


2015-05-14 7:11 GMT+02:00 Tim Harvey <tharvey at gateworks.com>:
> When CONFIG_IMX6_THERMAL is defined print the CPU temperature grade info
> along with the current temperature.
>
> Before:
>  CPU:   Temperature 42 C
>
> After:
>  CPU:   Automotive temperature grade (-40C to 125C) at 42C
>  CPU:   Industiral temperature grade (-40C to 105C) at 42C
>  CPU:   Extended Commercial temperature grade (-20C to 105C) at 42C
>
> Signed-off-by: Tim Harvey <tharvey at gateworks.com>
> ---
> v2:
>  - moved display of CPU temperature grade to own patch and combined with the
>    current temperature from the thermal sensor driver
>  - add example output to description
>
> Signed-off-by: Tim Harvey <tharvey at gateworks.com>
> ---
>  arch/arm/imx-common/cpu.c | 27 +++++++++++++++++++++++----
>  1 file changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
> index 6b20482..f1b49bb 100644
> --- a/arch/arm/imx-common/cpu.c
> +++ b/arch/arm/imx-common/cpu.c
> @@ -16,6 +16,7 @@
>  #include <asm/arch/clock.h>
>  #include <asm/arch/sys_proto.h>
>  #include <asm/arch/crm_regs.h>
> +#include <imx_thermal.h>
>  #include <ipu_pixfmt.h>
>  #include <thermal.h>
>  #include <sata.h>
> @@ -146,7 +147,7 @@ int print_cpuinfo(void)
>
>  #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
>         struct udevice *thermal_dev;
> -       int cpu_tmp, ret;
> +       int cpu_tmp, minc, maxc, ret;
>  #endif
>
>         cpurev = get_cpu_rev();
> @@ -172,16 +173,34 @@ int print_cpuinfo(void)
>  #endif
>
>  #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
> +       puts("CPU:   ");
> +       if (!is_cpu_type(MXC_CPU_MX6SX)) {
> +               switch (get_cpu_temp_grade(&minc, &maxc)) {
> +               case TEMP_AUTOMOTIVE:
> +                       puts("Automotive temperature grade ");
> +                       break;
> +               case TEMP_INDUSTRIAL:
> +                       puts("Industrial temperature grade ");
> +                       break;
> +               case TEMP_EXTCOMMERCIAL:
> +                       puts("Extended Commercial temperature grade ");
> +                       break;
> +               default:
> +                       puts("Commercial temperature grade ");
> +                       break;
> +               }
> +               printf("(%dC to %dC)", minc, maxc);
> +       }

For the additions above we do not need CONFIG_IMX6_THERMAL.

>         ret = uclass_get_device(UCLASS_THERMAL, 0, &thermal_dev);
>         if (!ret) {
>                 ret = thermal_get_temp(thermal_dev, &cpu_tmp);
>
>                 if (!ret)
> -                       printf("CPU:   Temperature %d C\n", cpu_tmp);
> +                       printf(" at %dC\n", cpu_tmp);
>                 else
> -                       printf("CPU:   Temperature: invalid sensor data\n");
> +                       puts(" - invalid sensor data\n");
>         } else {
> -               printf("CPU:   Temperature: Can't find sensor device\n");
> +               puts(" - invalid sensor device\n");
>         }
>  #endif
>
> --
> 1.9.1
>

greets
--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner


More information about the U-Boot mailing list