|
| 1 | +/* |
| 2 | + * Copyright (C) Photon Vision. |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.photonvision.common.hardware.metrics.cmds; |
| 19 | + |
| 20 | +import org.photonvision.common.configuration.HardwareConfig; |
| 21 | + |
| 22 | +public class RK3588Cmds extends LinuxCmds { |
| 23 | + /** Applies pi-specific commands, ignoring any input configuration */ |
| 24 | + public void initCmds(HardwareConfig config) { |
| 25 | + super.initCmds(config); |
| 26 | + |
| 27 | + // CPU Temperature |
| 28 | + /* The RK3588 chip has 7 thermal zones that can be accessed via: |
| 29 | + * /sys/class/thermal/thermal_zoneX/temp |
| 30 | + * where X is an interger from 0 to 6. |
| 31 | + * |
| 32 | + * || Zone || Location || Comments || |
| 33 | + * | 0 | soc | soc thermal (near the center of the chip) | |
| 34 | + * | 1 | bigcore0 | CPU Big Core A76_0/1 (CPU4 and CPU5) | |
| 35 | + * | 2 | bigcore1 | CPU Big Core A76_2/3 (CPU6 and CPU7) | |
| 36 | + * | 3 | littlecore | CPU Small Core A55_0/1/2/3 (CPU0, CPU1, CPU2, and CPU3) | |
| 37 | + * | 4 | center | also called PD_CENTER | |
| 38 | + * | 5 | gpu | GPU | |
| 39 | + * | 6 | npu | NPU | |
| 40 | + * |
| 41 | + * Sources: |
| 42 | + * - http://forum.armsom.org/t/topic/51/3 |
| 43 | + * - https://lore.kernel.org/lkml/7276280.TLKafQO6qx@archbook/ |
| 44 | + */ |
| 45 | + cpuTemperatureCommand = |
| 46 | + "cat /sys/class/thermal/thermal_zone1/temp | awk '{printf \"%.1f\", $1/1000}'"; |
| 47 | + } |
| 48 | +} |
0 commit comments