-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a169ee
commit 983eb70
Showing
172 changed files
with
7,065 additions
and
1,510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Fire_HD10_9th_Gen-7.3.2.3-20220418 | ||
# Fire_HD10_9th_Gen-7.3.2.4-20220825 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
src/device/amazon/kernel/driver/Documentation/amazon_logger.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
Amazon Logger driver | ||
|
||
1. Overview: | ||
|
||
This driver is metrics logging driver for Amazon device. Metrics are | ||
the "events" log recorded by device software. It includes user space metrics logging | ||
and kernel space metrics logging. This driver supports kernel space's logging only. | ||
It is based on Linux trace ring_buffer to takes following benefits: | ||
-let ring_buffer to manage the buffer. | ||
-ring_buffer allows multiple producers writing at same time on different cpus. | ||
|
||
_________________ | ||
| | | ||
| logd | | ||
|_______________| | ||
_______________|________________ | ||
| | | ||
----------------------------------------------------------------------- | ||
| | | ||
| | | ||
_______|______ ________|_____ | ||
| ring_buffer | | ring_buffer | | ||
|______________| |_____________| | ||
| /dev/metrics | | /dev/vitals | | ||
|______________| |_____________| | ||
|
||
|
||
2. Interfaces for kernel: | ||
|
||
Following three kernel API are exported for other kernel components: | ||
|
||
1)int log_to_metrics(enum android_log_priority priority, | ||
const char *domain, char *logmsg); | ||
|
||
2)int log_counter_to_vitals(enum android_log_priority priority, | ||
const char *domain, const char *program, | ||
const char *source, const char *key, | ||
long counter_value, const char *unit, | ||
const char *metadata, vitals_type type); | ||
|
||
3)int log_timer_to_vitals(enum android_log_priority priority, | ||
const char *domain, const char *program, | ||
const char *source, const char *key, | ||
long timer_value, const char *unit, vitals_type type); | ||
|
||
General arguments description: | ||
program: Vital record category name | ||
source: Vital name | ||
discrete_value, dv: a discrete value, typically used as key | ||
counter_value, cv: counter value | ||
timer_value, tv: timer value | ||
unit: unit for the vital | ||
type: type of vitals, currently 3 types are supported: | ||
a. VITALS_NORMAL: regular vitals with no special processing | ||
b. VITALS_FGTRACKING: vitals for which foreground tracking is required. | ||
These vitals will be tracked in 2 separate buckets: total occurrence | ||
and occurrence in foreground. | ||
c. VITALS_TIME_BUCKET: vitals for state transition which needs to be broken | ||
down to different time buckets. This simplifies client side processing | ||
as only info required is new_state, transition time (in time since boot), | ||
and initial state (client should report during boot/initialization), and client | ||
side does not need to keep timers to track time spent in buckets. | ||
Return value: | ||
0 on success, error code for failure. | ||
|
||
Example code: | ||
|
||
#include<linux/metricslog.h> | ||
#include<linux/string.h> | ||
|
||
#define METRICS_STR_LEN 128 | ||
int amazon_log_example(void) | ||
{ | ||
char metrics_log[METRICS_STR_LEN]; | ||
int ret = -1; | ||
struct timespec now; | ||
|
||
memset(metrics_log, 0, METRICS_STR_LEN); | ||
snprintf(metrics_log, METRICS_STR_LEN, "TEST:METRIC:VALUE_A=%d;CT;1,VALUE_B=%d;CT;1:NR", | ||
1, 0); | ||
ret = log_to_metrics(ANDROID_LOG_INFO, "metric_test", metrics_log); | ||
if (ret) | ||
pr_err("fails in log_to_metrics %d", ret); | ||
|
||
now = current_kernel_time(); | ||
memset(metrics_log, 0, METRICS_STR_LEN); | ||
|
||
snprintf(metrics_log, METRICS_STR_LEN, "Kerenl:TEST:VALUE_A=%d;CT;1,VALUE_B=%d;CT;1:NR", | ||
ret = log_timer_to_vitals(ANDROID_LOG_INFO, "Kernel timer", "TEST", | ||
"time_in_test", "Test", now.tv_sec, "s", VITALS_TIME_BUCKET); | ||
if (ret) | ||
pr_err("fails in log_timer_to_vitals %d", ret); | ||
|
||
ret = log_counter_to_vitals(ANDROID_LOG_INFO, "Kernel vitals", "TEST", | ||
"VITALS", "test_value", (u32)1, "count", "s", VITALS_NORMAL); | ||
if (ret) | ||
pr_err("fails in log_counter_to_vitals %d", ret); | ||
|
||
return ret; | ||
} | ||
|
||
3. Interfaces for userspace: | ||
|
||
Two device nodes /dev/metrics and /dev/vitals will be created. Both of them support | ||
open(),poll()/select() and read() system calls. Currently they are read-only mode, | ||
therefore they do not support write(). For read(), it supports blocking and nonblocking mode. | ||
In blocking mode, the read() will be blocked until a new log is available. | ||
In nonblocking(O_NONBLOCK) mode, the read() will return immediately if no data is available. | ||
For each read(), only one log entry is consumed and returned to user land. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
idme driver | ||
|
||
1. Overview: | ||
|
||
idme driver is used to show the information of idme in /proc directory and | ||
also provide interfaces to access specific item in idme, such as board type, | ||
bootmode, dev flags. | ||
|
||
2. Interfaces for kernel: | ||
|
||
Following kernel APIs are exported for other kernel components: | ||
|
||
const char *idme_get_item(char *idme_item); | ||
-This function is used to get the specific idme item value, | ||
such as: board_id, boot_mode, dev_flags etc. | ||
-Return the value on success, NULL on failure. | ||
|
||
unsigned int idme_get_board_type(void); | ||
-This function is used to get the board type in board_id, | ||
-Return the board type on success, 0 on failure. | ||
|
||
unsigned int idme_get_board_rev(void); | ||
-This function is used to get the board revision in board_id, | ||
-Return the board revision on success, 0 on failure. | ||
|
||
unsigned int idme_get_bootmode(void); | ||
-This function is used to get boot mode in idme, | ||
-Return the boot_mode on success, 0 on failure. | ||
|
||
u64 idme_get_dev_flags_value(void); | ||
-This function is used to get dev_flags in idme | ||
-Return the dev_flags value on success, 0 on failure. | ||
|
||
bool board_has_wan(void); | ||
-This function is used to check whether this board supported WAN. | ||
-Return true if having WAN, else return false. | ||
|
||
3. Interfaces for userspace: | ||
Directory /proc/idme will be added. It will show the value of idme items. For example: | ||
|
||
/proc/idme # ls | ||
DKB bootcount dev_flags mac_addr product_name region t_unlock_code usr_flags | ||
KB bootmode device_type_id mac_sec productid sensorcal tp_cg_color wifi_mfg | ||
alscal bt_mac_addr fos_flags manufacturing productid2 serial unlock_code | ||
board_id bt_mfg front_cam_otp postmode rear_cam_otp t_unlock_cert unlock_version |
50 changes: 50 additions & 0 deletions
50
src/device/amazon/kernel/driver/Documentation/sign_of_life.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
sign_of_life driver | ||
|
||
1. Overview: | ||
|
||
sign_of_life driver provides the "life cycle reason" of Amazon device to | ||
userland application via /proc/life_cycle_reason. "life of reason" means why | ||
device got powered off or rebooted or booted. For example, device may | ||
get shutdown by thermal service due to an overheated CPU. During next booting, | ||
the sign_of_life driver will find out the thermal shutdown reason and provides | ||
the reason to the /proc interface. Then userland application will read | ||
the /proc/life_cycle_reason and reports this abnormal event to device health | ||
servers. | ||
|
||
2. Interfaces for kernel: | ||
|
||
Following four kernel APIs are exported for other kernel components: | ||
|
||
int life_cycle_set_boot_reason(life_cycle_reason_t boot_reason); | ||
-This function will set the boot reason which causing device booting, | ||
such as: kernel panics, normal reboot, power key turn on device etc. | ||
-Return 0 on success, -1 on failure. | ||
|
||
int life_cycle_set_shutdown_reason(life_cycle_reason_t shutdown_reason); | ||
-This function will set the shutdown reason which causing device shutdown. | ||
such as: normal software shutdown, sudden power loss off and long press | ||
powerkey off etc. | ||
-Return 0 on success, -1 on failure. | ||
|
||
|
||
int life_cycle_set_thermal_shutdown_reason(life_cycle_reason_t thermal_shutdown_reason); | ||
-This function will set the Thermal Shutdown reason which causing device | ||
shutdown, such as: overheated cpus, overheated wifi, overheated PCB, overheated | ||
PMIC etc. | ||
-Return 0 on success, -1 on failure. | ||
|
||
|
||
int life_cycle_set_special_mode(life_cycle_reason_t life_cycle_special_mode); | ||
-This function will set the special mode which causing device life cycle change, | ||
such as: OTA mode, factory reset mode, low battery mode etc. | ||
-Return 0 on success, -1 on failure. | ||
|
||
3. Interfaces for userspace: | ||
A /proc/life_of_reason will be added. It will provides driver version, life cycle | ||
reason and life cycle type(normal or abnormal). For example, if device was rebooted | ||
due to a kernel panic, the output from /proc interface will be as following: | ||
|
||
cat /proc/life_cycle_reason | ||
lc_version:2.0 | ||
lc_reason:Warm Boot By Kernel Panic | ||
lc_type:LCR_abnormal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
menu "Amzn" | ||
|
||
config AMZN | ||
bool "Amazon Common Drivers" | ||
default N | ||
---help--- | ||
Enable support for various drivers needed on the Amazon Fire OS platform | ||
|
||
if AMZN | ||
|
||
config AMZN_SIGN_OF_LIFE | ||
bool "Amazon Sign of Life" | ||
help | ||
enable the life cycle metrics to log device boot and shutdown information | ||
|
||
config AMZN_SIGN_OF_LIFE_RTC | ||
bool "Amazon Sign of Life platform implementation" | ||
help | ||
enable the life cycle metrics to log device boot and shutdown information on specific Platform | ||
|
||
config AMZN_POWEROFF_LOG | ||
bool "Long press key power off log" | ||
default N | ||
help | ||
enable Long press key power off log | ||
|
||
config AMZN_METRICS_LOG | ||
bool "Amazon Metrics logger driver" | ||
select RING_BUFFER | ||
default n | ||
---help--- | ||
Enable Amazon Metrics/Vitals logger driver | ||
|
||
config AMZN_METRICS_LOG_TEST | ||
tristate "Amazon Metrics logger driver test module" | ||
depends on AMZN_METRICS_LOG | ||
default n | ||
---help--- | ||
Enable Amazon Metrics/Vitals logger test module | ||
|
||
config AMZN_INPUT_KEYCOMBO | ||
tristate "Amazon key combo" | ||
depends on INPUT | ||
select INPUT_KEYCOMBO | ||
help | ||
Say Y here if you want to panic kernel / power off when some keys are pressed; | ||
|
||
To compile this driver as a module, choose M here: the | ||
module will be called amzn_keycombo. | ||
|
||
config AMZN_IDME | ||
bool "IDME support" | ||
depends on PROC_FS | ||
help | ||
Select Y here to enable IDME support to read the data | ||
via userspace (i.e. /proc/idme/* entries) | ||
|
||
config AMZN_DRV_TEST | ||
tristate "Amazon common BSP driver test module" | ||
depends on AMZN_METRICS_LOG && AMZN_SIGN_OF_LIFE && AMZN_IDME | ||
default n | ||
---help--- | ||
Enable Amazon Common BSP test module | ||
|
||
endif # if AMZN | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# | ||
# Copyright (C) 2020 Amazon Inc. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 2 as | ||
# published by the Free Software Foundation. | ||
# | ||
# 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 http://www.gnu.org/licenses/gpl-2.0.html for more details. | ||
# | ||
|
||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
cur_dir := $(patsubst %/,%,$(dir $(mkfile_path))) | ||
|
||
$(shell mkdir -p $(CURDIR)/include/linux) | ||
$(shell cp $(cur_dir)/include/amzn_*.h $(CURDIR)/include/linux/) | ||
|
||
obj-$(CONFIG_AMZN_SIGN_OF_LIFE) += amzn_sign_of_life.o | ||
obj-$(CONFIG_AMZN_SIGN_OF_LIFE_RTC) += amzn_sign_of_life_rtc_impl.o | ||
obj-$(CONFIG_AMZN_METRICS_LOG) += amzn_logger.o | ||
obj-$(CONFIG_AMZN_METRICS_LOG_TEST) += amzn_logger_test.o | ||
obj-$(CONFIG_AMZN_INPUT_KEYCOMBO) += amzn_keycombo.o | ||
obj-$(CONFIG_AMZN_IDME) += amzn_idme.o | ||
obj-$(CONFIG_AMZN_DRV_TEST) += amzn_drv_test.o |
Oops, something went wrong.