From b7e0a5bea3f2a40a829924f14685178d75aeb45b Mon Sep 17 00:00:00 2001 From: Ryan Lattrel Date: Thu, 11 Oct 2018 16:11:50 -0500 Subject: [PATCH] muc_uart: add muc fw to boot mode Add the muc fw version to the boot mode parameters. Version is passed in as module parameter. Change-Id: I4c040ba22c756e67ab174a909f9b86e523d332a9 Signed-off-by: Ryan Lattrel Reviewed-on: https://gerrit.mot.com/1254562 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Kenneth Kessler Submit-Approved: Jira Key --- drivers/mmi_muc_uart/muc_protocol.h | 1 + drivers/mmi_muc_uart/muc_uart.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/mmi_muc_uart/muc_protocol.h b/drivers/mmi_muc_uart/muc_protocol.h index 101093245d37..055351d9977e 100644 --- a/drivers/mmi_muc_uart/muc_protocol.h +++ b/drivers/mmi_muc_uart/muc_protocol.h @@ -42,6 +42,7 @@ struct boot_mode_t { uint32_t hwid; /* androidboot.hwrev */ uint8_t ap_guid[16]; /* ro.mot.build.guid */ uint8_t ap_fw_ver_str[256]; /* ro.build.fingerprint */ + uint32_t muc_fw_vers; /* ro.mot.build.version.mod.nuttx */ } __packed; enum { VBUS_IN = 0, VBUS_IN_SPLIT, VBUS_OUT, DC_IN }; diff --git a/drivers/mmi_muc_uart/muc_uart.c b/drivers/mmi_muc_uart/muc_uart.c index a59329cf8d9f..2e7a82b93457 100644 --- a/drivers/mmi_muc_uart/muc_uart.c +++ b/drivers/mmi_muc_uart/muc_uart.c @@ -155,6 +155,10 @@ static char *param_vers = ""; module_param(param_vers, charp, S_IRUSR); MODULE_PARM_DESC(param_vers, "ro.build.fingerprint"); +static char *param_mucfw = ""; +module_param(param_mucfw, charp, S_IRUSR); +MODULE_PARM_DESC(param_mucfw, "ro.mot.build.version.mod.nuttx"); + #if MUC_UART_SEND_SLEEP_ON_IDLE static inline void reset_idle_timer(struct mod_muc_data_t *mm_data) { @@ -545,6 +549,8 @@ destroy_msg: static int muc_uart_send_bootmode(struct mod_muc_data_t *mm_data) { struct boot_mode_t bootmode; + uint32_t mucfw_major; + uint32_t mucfw_minor; memset(&bootmode, 0x00, sizeof(struct boot_mode_t)); @@ -557,6 +563,16 @@ static int muc_uart_send_bootmode(struct mod_muc_data_t *mm_data) param_vers, sizeof(bootmode.ap_fw_ver_str)); + /* Format mucfw vers from "MAJOR.MINOR_DESCRIPTION" + * to uint32_t in format MAJOR<<16|MINOR + */ + if (sscanf(param_mucfw, "%d.%d%*s", &mucfw_major, &mucfw_minor) != 2) { + mucfw_major = 0; + mucfw_minor = 0; + } + + bootmode.muc_fw_vers = (mucfw_major << 16) | mucfw_minor; + if (strncmp(bi_bootmode(), "mot-factory", strlen("mot-factory")) == 0) { bootmode.boot_mode = FACTORY; } else if (strncmp(bi_bootmode(), "qcom", strlen("qcom")) == 0) { @@ -576,6 +592,8 @@ static int muc_uart_send_bootmode(struct mod_muc_data_t *mm_data) sizeof(bootmode.ap_guid), bootmode.ap_guid); MUC_DBG("(%zd) sending AP vers %s\n", sizeof(bootmode.ap_fw_ver_str), bootmode.ap_fw_ver_str); + MUC_DBG("sending MUC fw vers 0x%08x\n", + bootmode.muc_fw_vers); return muc_uart_queue_send(mm_data, BOOT_MODE, @@ -1480,6 +1498,7 @@ int muc_uart_init(void) { MUC_LOG("guid: %s\n", param_guid); MUC_LOG("vers: %s\n", param_vers); + MUC_LOG("mucfw: %s\n", param_mucfw); return platform_driver_register(&muc_uart_driver); }