[U-Boot] [PATCH 7/8 v2] TMU: Add u-boot command to read current temp

Simon Glass sjg at chromium.org
Wed Nov 7 22:48:29 CET 2012


Hi Hatim,

On Wed, Nov 7, 2012 at 5:08 AM, Hatim Ali <hatim.rv at samsung.com> wrote:
> From: Alim Akhtar <alim.akhtar at samsung.com>
>
> Adds a new u-boot command to read current temprature from tmu driver.
>
> Signed-off-by: Alim Akhtar <alim.akhtar at samsung.com>
> Acked-by: Simon Glass <sjg at chromium.org>

Sorry I missed this before, but I think you are supposed to update the
README and add to include/command_h.

Regards,
Simon

> ---
> Changes since v1:
>         - Include new generic tmu header file
>         - Made printf()s consistent
>         - Added Acked-by: Simon Glass
>
>  common/Makefile  |    1 +
>  common/cmd_tmu.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 52 insertions(+), 0 deletions(-)
>  create mode 100644 common/cmd_tmu.c
>
> diff --git a/common/Makefile b/common/Makefile
> index dca2f53..b56ffa2 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -159,6 +159,7 @@ COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o
>  COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o
>  COBJS-$(CONFIG_CMD_TIME) += cmd_time.o
>  COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_test.o
> +COBJS-$(CONFIG_CMD_TMU) += cmd_tmu.o
>  COBJS-$(CONFIG_CMD_TPM) += cmd_tpm.o
>  COBJS-$(CONFIG_CMD_TSI148) += cmd_tsi148.o
>  COBJS-$(CONFIG_CMD_UBI) += cmd_ubi.o
> diff --git a/common/cmd_tmu.c b/common/cmd_tmu.c
> new file mode 100644
> index 0000000..7fbf845
> --- /dev/null
> +++ b/common/cmd_tmu.c
> @@ -0,0 +1,51 @@
> +/*
> + * Copyright (C) 2012 Samsung Electronics
> + * Alim Akhtar <alim.akhtar at samsung.com>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#include <common.h>
> +#include <command.h>
> +#include <tmu.h>
> +
> +int do_tmu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> +{
> +       int cur_temp;
> +
> +       if (argc < 2)
> +               return CMD_RET_USAGE;
> +
> +       if (strcmp(argv[1], "curtemp") == 0) {
> +               if (tmu_monitor(&cur_temp) == -1)
> +                       printf("TMU is in unknown state, temperature is invalid \n");
> +               else
> +                       printf("Current temperature: %u degrees Celsius \n", cur_temp);
> +       } else {
> +               return CMD_RET_USAGE;
> +       }
> +
> +       return 0;
> +}
> +
> +U_BOOT_CMD(
> +       tmu, 2, 1, do_tmu,
> +       "Thermal Management Unit\n",
> +       "curtemp - show current CPU temperature in degrees Celsius\n"
> +);
> --
> 1.7.2.3
>


More information about the U-Boot mailing list