summaryrefslogtreecommitdiffstats
path: root/tools/thermal
Commit message (Collapse)AuthorAgeFilesLines
* tools/thermal: tmon: use pkg-config also for CFLAGSOlaf Hering2015-10-101-0/+3
| | | | | | | | The header <panel.h> might be in /usr/include/ncursesw, which is not part of the standard include path. This fixes compile on openSUSE. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: fixed the 'make install' commandAnand Moon2015-05-091-8/+0
| | | | | | | | | | | | | | | | To install tmon we issue "make install" which produces bellow error. root@odroidxu3:/usr/src/odroidxu3-4.y-testing/tools/thermal/tmon# make install mkdir -p /usr/bin install -m 755 -p "tmon" "/usr/bin/tmon" mkdir -p / install -m 644 -p "" "/" install: cannot stat ‘’: No such file or directory make: [install] Error 1 (ignored) Signed-off-by: Anand Moon <linux.amoon@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: silence 'set but not used' warningsBrian Norris2015-02-281-0/+3
| | | | | | | | | | | | | | | | | | | | | gcc complains about the 'cols' variable being unused. This is unavoidable, given the ncurses getmaxyx() macro-based API, which wants to assign to a variable directly, even when we're not going to use it. Warning: gcc -O1 -Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -fstack-protector -D VERSION=\"1.0\" -c -o tui.o tui.c tui.c: In function ‘show_dialogue’: tui.c:288:12: warning: variable ‘cols’ set but not used [-Wunused-but-set-variable] int rows, cols; ^ So, add a hack to get rid of that warning. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: use pkg-config to determine library dependenciesBrian Norris2015-02-281-1/+10
| | | | | | | | | | | | | | | | | | | | | | | Some distros (e.g., Arch Linux) don't package the tinfo library separately from ncurses, so don't unconditionally include it. Instead, use pkg-config. The $(STATIC) ugliness is to handle the reported build case from commit 6b533269fb25 ("tools/thermal: tmon: fix compilation errors when building statically"), where a developer wants to be able to build with: make LDFLAGS=-static which requires an additional pkg-config flag. Finally, support a lowest common denominator fallback (-lpanel -lncurses) for build systems that don't have pkg-config entries for ncurses. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: support cross-compilingBrian Norris2015-02-281-2/+2
| | | | | | | | | | | | We might want to prepare CFLAGS outside of this Makefile, so don't overwrite its initial value. Then, support $(CROSS_COMPILE), so we can use a cross-compile toolchain. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: add .gitignoreBrian Norris2015-02-281-0/+1
| | | | | | | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: fixup tui windowing calculationsBrian Norris2015-02-281-5/+16
| | | | | | | | | | | | | | | | | The number of rows in the dialog vary according to the number of cooling devices. However, some of the windowing computations were assuming a fixed number of rows. This computation is OK when we have between 4 and 9 cooling devices (and they wrap to the next column), but with fewer devices, we end up printing off the end of the window. This unifies the row computation into a single function and uses that throughout the TUI code. This also accounts for increasing the number of rows when there are more than 9 total cooling devices. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: tui: don't hard-code dialog window size assumptionsBrian Norris2015-02-281-4/+5
| | | | | | | | | We can use the ncurses API to get the number of rows. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: add min/max macrosBrian Norris2015-02-281-0/+12
| | | | | | | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: add --target-temp parameterBrian Norris2015-02-282-2/+14
| | | | | | | | | | | | | | | | | If we launch in daemon mode (--daemon), we don't have the ncurses UI, but we might want to set the target temperature still. For example, someone might stick the following in their boot script: tmon --control intel_powerclamp --target-temp 90 --log --daemon This would turn on CPU idle injection when we're around 90 degrees celsius, and would log temperature and throttling info to /var/tmp/tmon.log. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* calloc/xcalloc: Fix argument orderArjun Sreedharan2014-12-091-3/+3
| | | | | | | | | | | | | The calloc() and xcalloc() functions takes @nmemb first and then @size. Fix all w/ pattern "calloc\s*(\s*sizeof". Signed-off-by: Arjun Sreedharan <arjun024@gmail.com> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Ingo Molnar <mingo@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1417866043-1877-1-git-send-email-arjun024@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
* tmon: set umask to a reasonable valueNeil Horman2014-07-011-1/+1
| | | | | | | | | | | Currently, the tmon umask value is set to 0, which means whatever the permission mask in the shell are when starting tmon in daemon mode are what the permissions of any created files will be. We should likely set something more explicit, so lets go with the usual 022 Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tmon: Check log file for common secuirty issuesNeil Horman2014-07-011-0/+24
| | | | | | | | | | | The tmon logging system blindly opens its log file on a static path, making it very easy for someone to redirect that log information to inappropriate places or overwrite other users data. Do some easy checking to make sure we're not logging to a symlink or a file owned by another user. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* tools/thermal: tmon: fix compilation errors when building staticallyJavi Merino2014-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tmon fails to build statically with the following error: $ make LDFLAGS=-static gcc -O1 -Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -fstack-protector -D VERSION=\"1.0\" -static tmon.o tui.o sysfs.o pid.o -o tmon -lm -lpanel -lncursesw -lpthread tmon.o: In function `tmon_sig_handler': tmon.c:(.text+0x21): undefined reference to `stdscr' tmon.o: In function `tmon_cleanup': tmon.c:(.text+0xb9): undefined reference to `stdscr' tmon.c:(.text+0x11e): undefined reference to `stdscr' tmon.c:(.text+0x123): undefined reference to `keypad' tmon.c:(.text+0x12d): undefined reference to `nocbreak' tmon.o: In function `main': tmon.c:(.text+0x785): undefined reference to `stdscr' tmon.c:(.text+0x78a): undefined reference to `nodelay' tui.o: In function `setup_windows': tui.c:(.text+0x131): undefined reference to `stdscr' tui.c:(.text+0x176): undefined reference to `stdscr' tui.c:(.text+0x19f): undefined reference to `stdscr' tui.c:(.text+0x1cc): undefined reference to `stdscr' tui.c:(.text+0x1ff): undefined reference to `stdscr' tui.o:tui.c:(.text+0x229): more undefined references to `stdscr' follow tui.o: In function `show_cooling_device': [...] stdscr() and friends are in libtinfo (part of ncurses) so add it to the libraries that are linked in when compiling tmon to fix it. Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Javi Merino <javi.merino@arm.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
* tools/thermal: Introduce tmon, a tool for thermal subsystemJacob Pan2013-11-078-0/+2160
Increasingly, Linux is running on thermally constrained devices. The simple thermal relationship between processor and fan has become past for modern computers. As hardware vendors cope with the thermal constraints on their products, more sensors are added, new cooling capabilities are introduced. The complexity of the thermal relationship can grow exponentially among cooling devices, zones, sensors, and trip points. They can also change dynamically. To expose such relationship to the userspace, Linux generic thermal layer introduced sysfs entry at /sys/class/thermal with a matrix of symbolic links, trip point bindings, and device instances. To traverse such matrix by hand is not a trivial task. Testing is also difficult in that thermal conditions are often exception cases that hard to reach in normal operations. TMON is conceived as a tool to help visualize, tune, and test the complex thermal subsystem. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>