qcom: sysmon: Replace the use of enums with strings in sysmon API
Currently, the sysmon_send_shutdown and sysmon_get_reason APIs expect an enum that identifies a subsystem. Instead, use a string with the name with which these subsystems have registered with the SSR framework. Change-Id: Ie57fe2899f585d07dc8d57bed2dbb91f079a3200 Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
This commit is contained in:
parent
760e6e62a0
commit
6e769ad179
|
@ -86,8 +86,6 @@ Optional driver parameters:
|
|||
particular target.
|
||||
- qcom,image-upgrade-supported: boolean flag to indicate if software upgrade is supported.
|
||||
- qcom,support-shutdown: boolean flag to indicate if graceful shutdown is supported.
|
||||
- qcom,sysmon-subsys-id: system monitor id for the external modem. This id is used to
|
||||
send system monitor messages to the external modem.
|
||||
- qcom,vddmin-drive-strength: drive strength in milliamps of the ap2mdm-vddmin gpio.
|
||||
The ap2mdm_vddmin gpio is controlled by the RPM processor. It is pulled low
|
||||
to indicate to the external modem that the apps processor has entered vddmin
|
||||
|
@ -140,5 +138,4 @@ Example:
|
|||
qcom,ramdump-timeout-ms = <120000>;
|
||||
qcom,vddmin-modes = "normal";
|
||||
qcom,vddmin-drive-strength = <8>;
|
||||
qcom,sysmon-subsys-id = <19>;
|
||||
};
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
qcom,vddmin-modes = "normal";
|
||||
qcom,vddmin-drive-strength = <8>;
|
||||
qcom,sfr-query;
|
||||
qcom,sysmon-subsys-id = <20>;
|
||||
qcom,support-shutdown;
|
||||
status = "disabled";
|
||||
};
|
||||
|
@ -56,7 +55,6 @@
|
|||
qcom,vddmin-modes = "normal";
|
||||
qcom,vddmin-drive-strength = <8>;
|
||||
qcom,sfr-query;
|
||||
qcom,sysmon-subsys-id = <20>;
|
||||
qcom,support-shutdown;
|
||||
status = "disabled";
|
||||
};
|
||||
|
|
|
@ -98,7 +98,6 @@ struct mdm_ctrl {
|
|||
bool debug_fail;
|
||||
unsigned int dump_timeout_ms;
|
||||
unsigned int ramdump_delay_ms;
|
||||
int sysmon_subsys_id;
|
||||
struct esoc_clink *esoc;
|
||||
bool get_restart_reason;
|
||||
unsigned long irq_mask;
|
||||
|
@ -347,7 +346,8 @@ static int mdm_cmd_exe(enum esoc_cmd cmd, struct esoc_clink *esoc)
|
|||
mdm->debug = 0;
|
||||
mdm->ready = false;
|
||||
mdm->trig_cnt = 0;
|
||||
ret = sysmon_send_shutdown(mdm->sysmon_subsys_id);
|
||||
|
||||
ret = sysmon_send_shutdown(esoc->subsys.name);
|
||||
if (ret)
|
||||
dev_err(mdm->dev, "Graceful shutdown fail, ret = %d\n",
|
||||
ret);
|
||||
|
@ -467,7 +467,7 @@ static void mdm_get_restart_reason(struct work_struct *work)
|
|||
struct device *dev = mdm->dev;
|
||||
|
||||
do {
|
||||
ret = sysmon_get_reason(mdm->sysmon_subsys_id, sfr_buf,
|
||||
ret = sysmon_get_reason(mdm->esoc->subsys.name, sfr_buf,
|
||||
sizeof(sfr_buf));
|
||||
if (!ret) {
|
||||
dev_err(dev, "mdm restart reason is %s\n", sfr_buf);
|
||||
|
@ -779,10 +779,6 @@ static int mdm_configure_ipc(struct mdm_ctrl *mdm, struct platform_device *pdev)
|
|||
goto fatal_err;
|
||||
}
|
||||
}
|
||||
ret = of_property_read_u32(node, "qcom,sysmon-subsys-id",
|
||||
&mdm->sysmon_subsys_id);
|
||||
if (ret < 0)
|
||||
dev_dbg(dev, "sysmon_subsys_id not set.\n");
|
||||
|
||||
gpio_direction_output(MDM_GPIO(mdm, AP2MDM_STATUS), 0);
|
||||
gpio_direction_output(MDM_GPIO(mdm, AP2MDM_ERRFATAL), 0);
|
||||
|
|
|
@ -187,7 +187,7 @@ out:
|
|||
/**
|
||||
* sysmon_send_shutdown() - send shutdown command to a
|
||||
* subsystem.
|
||||
* @dest_ss: ID of subsystem to send to.
|
||||
* @dest_ss: String name of the subsystem to send to.
|
||||
*
|
||||
* Returns 0 for success, -EINVAL for an invalid destination, -ENODEV if
|
||||
* the SMD transport channel is not open, -ETIMEDOUT if the destination
|
||||
|
@ -196,20 +196,27 @@ out:
|
|||
*
|
||||
* If CONFIG_MSM_SYSMON_COMM is not defined, always return success (0).
|
||||
*/
|
||||
int sysmon_send_shutdown(enum subsys_id dest_ss)
|
||||
int sysmon_send_shutdown(const char *dest_ss)
|
||||
{
|
||||
struct sysmon_subsys *ss = &subsys[dest_ss];
|
||||
struct sysmon_subsys *ss = NULL;
|
||||
const char tx_buf[] = "system:shutdown";
|
||||
const char expect[] = "system:ack";
|
||||
size_t prefix_len = ARRAY_SIZE(expect) - 1;
|
||||
int ret;
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(map); i++) {
|
||||
if (!strcmp(map[i].name, dest_ss)) {
|
||||
ss = &subsys[map[i].id];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ss == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
if (ss->dev == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
if (dest_ss < 0 || dest_ss >= SYSMON_NUM_SS)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&ss->lock);
|
||||
ret = sysmon_send_msg(ss, tx_buf, ARRAY_SIZE(tx_buf));
|
||||
if (ret)
|
||||
|
@ -224,7 +231,7 @@ out:
|
|||
|
||||
/**
|
||||
* sysmon_get_reason() - Retrieve failure reason from a subsystem.
|
||||
* @dest_ss: ID of subsystem to query
|
||||
* @dest_ss: String name of the subsystem to query
|
||||
* @buf: Caller-allocated buffer for the returned NUL-terminated reason
|
||||
* @len: Length of @buf
|
||||
*
|
||||
|
@ -235,21 +242,27 @@ out:
|
|||
*
|
||||
* If CONFIG_MSM_SYSMON_COMM is not defined, always return success (0).
|
||||
*/
|
||||
int sysmon_get_reason(enum subsys_id dest_ss, char *buf, size_t len)
|
||||
int sysmon_get_reason(const char *dest_ss, char *buf, size_t len)
|
||||
{
|
||||
struct sysmon_subsys *ss = &subsys[dest_ss];
|
||||
struct sysmon_subsys *ss = NULL;
|
||||
const char tx_buf[] = "ssr:retrieve:sfr";
|
||||
const char expect[] = "ssr:return:";
|
||||
size_t prefix_len = ARRAY_SIZE(expect) - 1;
|
||||
int ret;
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(map); i++) {
|
||||
if (!strcmp(map[i].name, dest_ss)) {
|
||||
ss = &subsys[map[i].id];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ss == NULL || buf == NULL || len == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (ss->dev == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
if (dest_ss < 0 || dest_ss >= SYSMON_NUM_SS ||
|
||||
buf == NULL || len == 0)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&ss->lock);
|
||||
ret = sysmon_send_msg(ss, tx_buf, ARRAY_SIZE(tx_buf));
|
||||
if (ret)
|
||||
|
|
|
@ -37,8 +37,8 @@ enum subsys_id {
|
|||
#ifdef CONFIG_MSM_SYSMON_COMM
|
||||
int sysmon_send_event(const char *dest_ss, const char *event_ss,
|
||||
enum subsys_notif_type notif);
|
||||
int sysmon_get_reason(enum subsys_id dest_ss, char *buf, size_t len);
|
||||
int sysmon_send_shutdown(enum subsys_id dest_ss);
|
||||
int sysmon_get_reason(const char *dest_ss, char *buf, size_t len);
|
||||
int sysmon_send_shutdown(const char *dest_ss);
|
||||
#else
|
||||
static inline int sysmon_send_event(const char *dest_ss,
|
||||
const char *event_ss,
|
||||
|
@ -46,12 +46,12 @@ static inline int sysmon_send_event(const char *dest_ss,
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int sysmon_get_reason(enum subsys_id dest_ss, char *buf,
|
||||
static inline int sysmon_get_reason(const char *dest_ss, char *buf,
|
||||
size_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int sysmon_send_shutdown(enum subsys_id dest_ss)
|
||||
static inline int sysmon_send_shutdown(const char *dest_ss)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue