Bo Lv | 72d0e90 | 2023-01-02 14:27:34 +0000 | [diff] [blame^] | 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| 2 | /* |
| 3 | * Copyright (c) 2019 Amlogic, Inc. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <command.h> |
| 8 | #include <asm/amlogic/arch/tsensor.h> |
| 9 | |
| 10 | static int do_read_temp(cmd_tbl_t *cmdtp, int flag1, int argc, char * const argv[]) |
| 11 | { |
| 12 | printf("read temp\n"); |
| 13 | return temp_read_entry(); |
| 14 | } |
| 15 | |
| 16 | static int do_temp_triming(cmd_tbl_t *cmdtp, int flag1, int argc, char * const argv[]) |
| 17 | { |
| 18 | int ret = -1; |
| 19 | int ver, temp_base; |
| 20 | |
| 21 | if (argc <3) { |
| 22 | printf("too little args for temp triming!!\n"); |
| 23 | return CMD_RET_USAGE; |
| 24 | } |
| 25 | temp_base = simple_strtoul(argv[1], NULL, 10); |
| 26 | printf("set base temperature: %d\n", temp_base); |
| 27 | ver = simple_strtoul(argv[2], NULL, 16); |
| 28 | ret = temp_trim_entry(temp_base, ver); |
| 29 | printf("temperature triming %x\n", ret); |
| 30 | return ret; |
| 31 | } |
| 32 | |
| 33 | static int do_boot_cooling(cmd_tbl_t *cmdtp, int flag1, int argc, char * const argv[]) |
| 34 | { |
| 35 | return temp_cooling_entry(); |
| 36 | } |
| 37 | |
| 38 | U_BOOT_CMD( |
| 39 | boot_cooling, 5, 0, do_boot_cooling, |
| 40 | "cpu temp-system", |
| 41 | "boot_cooling pos" |
| 42 | ); |
| 43 | |
| 44 | U_BOOT_CMD( |
| 45 | read_temp, 5, 0, do_read_temp, |
| 46 | "cpu temp-system", |
| 47 | "read_temp pos" |
| 48 | ); |
| 49 | |
| 50 | static char temp_trim_help_text[] = |
| 51 | "temp_triming x [ver]\n" |
| 52 | " - for manual trimming chip\n" |
| 53 | " - x: [decimal]the temperature of the chip surface\n" |
| 54 | " - [ver]: [decimal]only for New thermal sensor\n" |
| 55 | " BBT: OPS socket board, which can change chips\n" |
| 56 | " online: reference boards witch chip mounted\n" |
| 57 | " G12A or G12B:\n" |
| 58 | " 88 (10001000)b: BBT-SW, thermal1 thermal2, valid thermal cali data\n" |
| 59 | " 89 (10001001)b: BBT-OPS, thermal1 thermal2, valid thermal cali data\n" |
| 60 | " 8b (10001011)b: SLT, thermal1 thermal2, valid thermal cali data\n" |
| 61 | " A1:\n" |
| 62 | " 84 (10000100)b: BBT-SW, thermal1, valid thermal cali data\n" |
| 63 | " 85 (10000101)b: BBT-OPS, thermal1, valid thermal cali data\n" |
| 64 | " 87 (10000111)b: SLT, thermal1, valid thermal cali data\n"; |
| 65 | |
| 66 | U_BOOT_CMD( |
| 67 | temp_triming, 5, 1, do_temp_triming, |
| 68 | "cpu temp-system", |
| 69 | temp_trim_help_text |
| 70 | ); |
| 71 | |