diff options
author | JJ Lee <leejj@google.com> | 2022-04-26 22:43:42 +0800 |
---|---|---|
committer | JJ Lee <leejj@google.com> | 2022-09-06 06:59:00 +0000 |
commit | f85c0d4d19fa57b7c12795df89458ae5538343ae (patch) | |
tree | 63bf74d44e1310b8e12662f2b4cfbe45222666a2 | |
parent | e5a57dd46821cc1b945aa9986ba5be882c5ded00 (diff) | |
download | aoc-f85c0d4d19fa57b7c12795df89458ae5538343ae.tar.gz |
aoc: support to dump MIF votes from all cores
Bug: 223674292
Change-Id: Ic219d810c2b82c9fa406586ff18e4c96dca5920c
Signed-off-by: JJ Lee <leejj@google.com>
-rw-r--r-- | aoc_control_dev.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/aoc_control_dev.c b/aoc_control_dev.c index cecaa6f..bd7d126 100644 --- a/aoc_control_dev.c +++ b/aoc_control_dev.c @@ -35,6 +35,7 @@ struct stats_prvdata { struct aoc_stat *discovered_stats; int total_stats; long service_timeout; + u8 memory_vote_core_id; }; /* Driver methods */ @@ -175,7 +176,7 @@ static ssize_t memory_exception_show(struct device *dev, static DEVICE_ATTR_RO(memory_exception); -static ssize_t memory_votes_show(struct device *dev, +static ssize_t memory_votes_stats(struct device *dev, struct device_attribute *attr, char *buf) { struct stats_prvdata *prvdata = dev_get_drvdata(dev); @@ -185,6 +186,11 @@ static ssize_t memory_votes_show(struct device *dev, u32 i; u32 bytes_written; int ret; + const char* core_names[] = {"A32", "FF1", "HF0", "HF1"}; + + if (prvdata->memory_vote_core_id < 1 || + prvdata->memory_vote_core_id > 4) + return -EINVAL; AocCmdHdrSet(&get_count_cmd.parent, CMD_GET_MEMORY_VOTES_DATA_COUNT_ID, sizeof(get_count_cmd)); @@ -199,11 +205,13 @@ static ssize_t memory_votes_show(struct device *dev, bytes_written = 0; + bytes_written += scnprintf(buf + bytes_written, PAGE_SIZE - bytes_written, + "\nCore %s:\n", core_names[prvdata->memory_vote_core_id - 1]); for (i = 0; i < total_count; i++) { - AocCmdHdrSet(&get_data_cmd.parent, CMD_GET_MEMORY_VOTES_DATA_ID, sizeof(get_data_cmd)); get_data_cmd.app_id = i; get_data_cmd.valid = false; + get_data_cmd.core_id = prvdata->memory_vote_core_id; ret = read_attribute(prvdata, &get_data_cmd, sizeof(get_data_cmd), &get_data_cmd, sizeof(get_data_cmd)); @@ -213,7 +221,7 @@ static ssize_t memory_votes_show(struct device *dev, if (get_data_cmd.valid) { bytes_written += scnprintf(buf + bytes_written, PAGE_SIZE - bytes_written, - "App %hhu, votes Curr/Tot/ON %5u / %5u / %5u Last %10llu us, Dur %10llu us\n", + "App %2hhu, votes Curr/Tot/ON %5u / %5u / %5u Last %10llu us, Dur %10llu us\n", get_data_cmd.app_id, get_data_cmd.votes, get_data_cmd.total_votes, @@ -226,7 +234,18 @@ static ssize_t memory_votes_show(struct device *dev, return bytes_written; } -static DEVICE_ATTR_RO(memory_votes); +#define DECLARE_MEMORY_VOTES(memory_votes_name, id) \ + static ssize_t memory_votes_name##_show( \ + struct device *dev, struct device_attribute *attr, char *buf) \ + { \ + struct stats_prvdata *prvdata = dev_get_drvdata(dev); \ + prvdata->memory_vote_core_id = id; \ + return memory_votes_stats(dev, attr, buf); \ + } \ + static DEVICE_ATTR_RO(memory_votes_name) + +DECLARE_MEMORY_VOTES(memory_votes_a32, 1); +DECLARE_MEMORY_VOTES(memory_votes_ff1, 2); /* Driver methods */ @@ -501,7 +520,8 @@ static struct attribute *aoc_stats_attrs[] = { &dev_attr_logging_wakeup.attr, &dev_attr_hotword_wakeup.attr, &dev_attr_memory_exception.attr, - &dev_attr_memory_votes.attr, + &dev_attr_memory_votes_a32.attr, + &dev_attr_memory_votes_ff1.attr, &dev_attr_udfps_set_clock_source.attr, &dev_attr_udfps_get_osc_freq.attr, &dev_attr_udfps_get_disp_freq.attr, @@ -612,6 +632,7 @@ static int aoc_control_probe(struct aoc_service_dev *sd) prvdata->service = sd; prvdata->service_timeout = msecs_to_jiffies(STAT_READ_TIMEOUT); mutex_init(&prvdata->lock); + prvdata->memory_vote_core_id = 1; INIT_WORK(&prvdata->discovery_work, discovery_workitem); dev_set_drvdata(dev, prvdata); |