Message ID | 1355223289-15685-8-git-send-email-hatim.rv@samsung.com |
---|---|
State | Changes Requested |
Delegated to: | Minkyu Kang |
Headers | show |
Dear Hatim Ali, In message <1355223289-15685-8-git-send-email-hatim.rv@samsung.com> you wrote: > From: Alim Akhtar <alim.akhtar@samsung.com> > > Adds a new u-boot command to read current temprature from tmu driver. > > Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com> > Acked-by: Simon Glass <sjg@chromium.org> Do we really need a new command here? We already have dtt, which basicly does the same. It makes no sense to add new commands for each new device, all doing basicly trhe same, just in an incompatible way. Best regards, Wolfgang Denk
Hi, On Tue, Dec 11, 2012 at 4:30 AM, Wolfgang Denk <wd@denx.de> wrote: > Dear Hatim Ali, > > In message <1355223289-15685-8-git-send-email-hatim.rv@samsung.com> you wrote: >> From: Alim Akhtar <alim.akhtar@samsung.com> >> >> Adds a new u-boot command to read current temprature from tmu driver. >> >> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com> >> Acked-by: Simon Glass <sjg@chromium.org> > > Do we really need a new command here? > > We already have dtt, which basicly does the same. > > It makes no sense to add new commands for each new device, all doing > basicly trhe same, just in an incompatible way. This patch feature does not use i2c as the temperature measurement is inside the SOC. I wonder whether cmd_dtt.c could be extended so that it only does the i2c stuff if CONFIG_SYS_DTT_BUS_NUM is defined. Then you could use dtt_get_temp() to get the termperature as now. Regards, Simon > > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de > The explanation requiring the fewest assumptions is the most likely > to be correct. -- William of Occam > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot
Dear Simon Glass, In message <CAPnjgZ18daUnwQtAxtPOU43EGLA7=tN0EFUtbBzKNTDY8DA-sQ@mail.gmail.com> you wrote: > > > Do we really need a new command here? > > > > We already have dtt, which basicly does the same. > > > > It makes no sense to add new commands for each new device, all doing > > basicly trhe same, just in an incompatible way. > > This patch feature does not use i2c as the temperature measurement is > inside the SOC. I wonder whether cmd_dtt.c could be extended so that > it only does the i2c stuff if CONFIG_SYS_DTT_BUS_NUM is defined. Then > you could use dtt_get_temp() to get the termperature as now. Dtt should actually be completely agnostic of the underlying method to access the devices it operates on. If such generalization is needed now, then yes, it should be added. Best regards, Wolfgang Denk
diff --git a/README b/README index 0e4083c..d3e7ea3 100644 --- a/README +++ b/README @@ -3877,6 +3877,7 @@ icache - enable or disable instruction cache dcache - enable or disable data cache reset - Perform RESET of the CPU echo - echo args to console +tmu - measurement values by Thermal Management Unit version - print monitor version help - print online help ? - alias for 'help' diff --git a/common/Makefile b/common/Makefile index ded6318..93dc65a 100644 --- a/common/Makefile +++ b/common/Makefile @@ -155,6 +155,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..836e457 --- /dev/null +++ b/common/cmd_tmu.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * Alim Akhtar <alim.akhtar@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 invalid\n"); + else + printf("Current temperature: %u 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" +);