[U-Boot] [PATCH 6/9 v6] TMU: Add TMU support in dtt command

Simon Glass sjg at chromium.org
Fri Jan 25 21:58:24 CET 2013


On Thu, Jan 24, 2013 at 4:24 AM, Akshay Saraswat <akshay.s at samsung.com> wrote:
> Add generic TMU support alongwith i2c sensors in dtt command
> to enable temperature reading in cases where TMU is present
> instead of i2c sensors.
>
> Signed-off-by: Akshay Saraswat <akshay.s at samsung.com>
> ---
> Changes since v5:
>         - Changed 'pirntf' to 'puts'.
>         - Added 'return -1' in case of erroneous tmu_state.

Acked-by: Simon Glass <sjg at chromium.org>

>
>  common/cmd_dtt.c |   22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/common/cmd_dtt.c b/common/cmd_dtt.c
> index cd94423..493f643 100644
> --- a/common/cmd_dtt.c
> +++ b/common/cmd_dtt.c
> @@ -28,6 +28,23 @@
>  #include <dtt.h>
>  #include <i2c.h>
>
> +#if defined CONFIG_TMU_CMD_DTT
> +#include <tmu.h>
> +
> +int dtt_get_temp(void)
> +{
> +       int cur_temp;
> +
> +       if (tmu_monitor(&cur_temp) == TMU_STATUS_INIT) {
> +               puts("TMU is in unknown state, temperature is invalid\n");
> +               return -1;
> +       } else {
> +               printf("Current temperature: %u degrees Celsius\n", cur_temp);
> +               return 0;
> +       }
> +}
> +
> +#else
>  static unsigned long sensor_initialized;
>
>  static void _initialize_dtt(void)
> @@ -59,9 +76,13 @@ void dtt_init(void)
>         /* switch back to original I2C bus */
>         I2C_SET_BUS(old_bus);
>  }
> +#endif
>
>  int do_dtt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
>  {
> +#if defined CONFIG_TMU_CMD_DTT
> +       return dtt_get_temp();
> +#else
>         int i;
>         unsigned char sensors[] = CONFIG_DTT_SENSORS;
>         int old_bus;
> @@ -85,6 +106,7 @@ int do_dtt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
>         I2C_SET_BUS(old_bus);
>
>         return 0;
> +#endif
>  }      /* do_dtt() */
>
>  /***************************************************/
> --
> 1.7.9.5
>


More information about the U-Boot mailing list