Junyi Zhao | 09765f3 | 2024-01-13 11:46:40 +0800 | [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 <config.h> |
| 8 | #include <command.h> |
| 9 | #include <asm/amlogic/arch/mailbox.h> |
| 10 | #include "amlogic/leds_state.h" |
| 11 | |
| 12 | int32_t do_leds_state(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| 13 | { |
| 14 | uint32_t data[12]; |
| 15 | uint32_t rev_data, i, ret; |
| 16 | |
| 17 | if (argc < 2) |
| 18 | return CMD_RET_USAGE; |
| 19 | for (i = 1; i < argc; i++) |
| 20 | data[i-1] = (u32)simple_strtoul(argv[i], NULL, 10); |
| 21 | ret = scpi_send_data(AOCPU_REE_CHANNEL, 0xF7, data, 4*(argc-1), &rev_data, 0); |
| 22 | if (ret != 0) { |
| 23 | printf("communication failed\n"); |
| 24 | return -EINVAL; |
| 25 | } |
| 26 | |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | #define BLINK "" |
| 31 | |
| 32 | U_BOOT_CMD( |
| 33 | leds_state, 12, 1, do_leds_state, |
| 34 | "manage amlogic LEDs", |
| 35 | "<led_label> on|off|toggle" BLINK "\tChange LED state\n" |
| 36 | "led [<led_label>\tGet LED state\n" |
| 37 | "led list\t\tshow a list of LEDs\n" |
| 38 | ); |