mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
muc_uart: add attr for muc fw vers
Record the muc fw vers when it is sent from the muc and provide access to it from an attribute. Change-Id: Ibbee1cf8c7c6ef7a6d936e8d08ff198d0d963d75 Signed-off-by: Ryan Lattrel <ryanl@motorola.com> Reviewed-on: https://gerrit.mot.com/1303136 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Kenneth Kessler <kennykessler@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
8a1036ebec
commit
6595eeab48
1 changed files with 24 additions and 0 deletions
|
|
@ -85,6 +85,9 @@ void *muc_ipc_log;
|
|||
/* How many times to try to send a message before giving up */
|
||||
#define MUC_UART_RETRY_COUNT 100
|
||||
|
||||
/* Max number of chars we will copy from the fw vers sent by the muc */
|
||||
#define MUC_FW_VERS_MAX_SIZE 32
|
||||
|
||||
struct write_data {
|
||||
struct list_head list;
|
||||
uint16_t cmd;
|
||||
|
|
@ -138,6 +141,7 @@ struct mod_muc_data_t {
|
|||
struct power_supply *dc_psy;
|
||||
atomic_t sleep_req_pending;
|
||||
struct notifier_block ps_nb;
|
||||
char muc_fw_vers[MUC_FW_VERS_MAX_SIZE];
|
||||
};
|
||||
|
||||
/* How long until we move on without an ack */
|
||||
|
|
@ -218,11 +222,26 @@ static ssize_t mod_attached_show(struct device *dev,
|
|||
return snprintf(buf, 4, "%u\n", gpio_state);
|
||||
}
|
||||
|
||||
static ssize_t muc_fw_vers_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct mod_muc_data_t *mm_data = platform_get_drvdata(pdev);
|
||||
|
||||
if (mm_data && mm_data->muc_fw_vers[0] != '\0')
|
||||
return snprintf(buf, strlen(mm_data->muc_fw_vers) + 1,
|
||||
"%s", mm_data->muc_fw_vers);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* /sys/devices/soc:mod_uart/mod_attached */
|
||||
DEVICE_ATTR_RO(mod_attached);
|
||||
DEVICE_ATTR_RO(muc_fw_vers);
|
||||
|
||||
static struct attribute *muc_uart_attrs[] = {
|
||||
&dev_attr_mod_attached.attr,
|
||||
&dev_attr_muc_fw_vers.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -1138,6 +1157,11 @@ static void muc_uart_handle_message(struct mod_muc_data_t *mm_data,
|
|||
MUC_LOG("muc_fw_ver: %.*s\n",
|
||||
(int)payload_len,
|
||||
(char *)payload);
|
||||
memset(mm_data->muc_fw_vers, 0, MUC_FW_VERS_MAX_SIZE);
|
||||
/* Last value of muc_fw_vers should be null char */
|
||||
memcpy(mm_data->muc_fw_vers, payload,
|
||||
payload_len < (MUC_FW_VERS_MAX_SIZE - 1) ?
|
||||
payload_len : (MUC_FW_VERS_MAX_SIZE - 1));
|
||||
} else
|
||||
muc_uart_send(mm_data, MUC_FW_VERSION|MSG_NACK_MASK, NULL, 0);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue