Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86db91df authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: subsystem_restart: Send sysmon event notifications to all subsystems"

parents 3eb661d7 9932c302
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ struct modem_data {
	struct q6v5_data *q6;
	struct subsys_device *subsys;
	struct subsys_desc subsys_desc;
	void *adsp_state_notifier;
	void *ramdump_dev;
	bool crash_shutdown;
	bool ignore_errors;
+0 −51
Original line number Diff line number Diff line
@@ -25,9 +25,7 @@
#include <linux/of_gpio.h>
#include <linux/clk/msm-clk.h>
#include <linux/msm-bus-board.h>
#include <soc/qcom/sysmon.h>
#include <soc/qcom/subsystem_restart.h>
#include <soc/qcom/subsystem_notif.h>
#include <soc/qcom/ramdump.h>

#include <soc/qcom/smem.h>
@@ -49,8 +47,6 @@ struct lpass_data {
	struct subsys_desc subsys_desc;
	void *ramdump_dev;
	struct work_struct work;
	void *wcnss_notif_hdle;
	void *modem_notif_hdle;
	int crash_shutdown;
};

@@ -204,36 +200,6 @@ static struct pil_reset_ops pil_lpass_ops_trusted = {
	.shutdown = pil_lpass_shutdown_trusted,
};

static int wcnss_notifier_cb(struct notifier_block *this, unsigned long code,
								void *ss_handle)
{
	int ret;
	pr_debug("%s: W-Notify: event %lu\n", __func__, code);
	ret = sysmon_send_event(SYSMON_SS_LPASS, "wcnss", code);
	if (ret < 0)
		pr_err("%s: sysmon_send_event error %d", __func__, ret);
	return NOTIFY_DONE;
}

static struct notifier_block wnb = {
	.notifier_call = wcnss_notifier_cb,
};

static int modem_notifier_cb(struct notifier_block *this, unsigned long code,
								void *ss_handle)
{
	int ret;
	pr_debug("%s: M-Notify: event %lu\n", __func__, code);
	ret = sysmon_send_event(SYSMON_SS_LPASS, "modem", code);
	if (ret < 0)
		pr_err("%s: sysmon_send_event error %d", __func__, ret);
	return NOTIFY_DONE;
}

static struct notifier_block mnb = {
	.notifier_call = modem_notifier_cb,
};

static void adsp_log_failure_reason(void)
{
	char *reason;
@@ -449,17 +415,6 @@ static int pil_lpass_driver_probe(struct platform_device *pdev)
		goto err_subsys;
	}

	drv->wcnss_notif_hdle = subsys_notif_register_notifier("wcnss", &wnb);
	if (IS_ERR(drv->wcnss_notif_hdle)) {
		ret = PTR_ERR(drv->wcnss_notif_hdle);
		goto err_notif_wcnss;
	}

	drv->modem_notif_hdle = subsys_notif_register_notifier("modem", &mnb);
	if (IS_ERR(drv->modem_notif_hdle)) {
		ret = PTR_ERR(drv->modem_notif_hdle);
		goto err_notif_modem;
	}
	lpass_status = kobject_create_and_add("audio_voice_service",
						kernel_kobj);
	if (!lpass_status) {
@@ -479,10 +434,6 @@ static int pil_lpass_driver_probe(struct platform_device *pdev)
err_kobj:
	kobject_put(lpass_status);
err_create_kobj:
	subsys_notif_unregister_notifier(drv->modem_notif_hdle, &mnb);
err_notif_modem:
	subsys_notif_unregister_notifier(drv->wcnss_notif_hdle, &wnb);
err_notif_wcnss:
	subsys_unregister(drv->subsys);
err_subsys:
	destroy_ramdump_device(drv->ramdump_dev);
@@ -494,8 +445,6 @@ err_ramdump:
static int pil_lpass_driver_exit(struct platform_device *pdev)
{
	struct lpass_data *drv = platform_get_drvdata(pdev);
	subsys_notif_unregister_notifier(drv->wcnss_notif_hdle, &wnb);
	subsys_notif_unregister_notifier(drv->modem_notif_hdle, &mnb);
	subsys_unregister(drv->subsys);
	destroy_ramdump_device(drv->ramdump_dev);
	pil_desc_release(&drv->q6->desc);
+0 −28
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
#include <linux/dma-mapping.h>
#include <linux/of_gpio.h>
#include <linux/clk/msm-clk.h>
#include <soc/qcom/sysmon.h>
#include <soc/qcom/subsystem_restart.h>
#include <soc/qcom/ramdump.h>
#include <soc/qcom/smem.h>
@@ -169,20 +168,6 @@ static int modem_ramdump(int enable, const struct subsys_desc *subsys)
	return ret;
}

static int adsp_state_notifier_fn(struct notifier_block *this,
				unsigned long code, void *ss_handle)
{
	int ret;
	ret = sysmon_send_event(SYSMON_SS_MODEM, "adsp", code);
	if (ret < 0)
		pr_err("%s: sysmon_send_event failed (%d).", __func__, ret);
	return NOTIFY_DONE;
}

static struct notifier_block adsp_state_notifier_block = {
	.notifier_call = adsp_state_notifier_fn,
};

static irqreturn_t modem_wdog_bite_intr_handler(int irq, void *dev_id)
{
	struct modem_data *drv = subsys_to_drv(dev_id);
@@ -224,19 +209,8 @@ static int pil_subsys_init(struct modem_data *drv,
		goto err_ramdump;
	}

	drv->adsp_state_notifier = subsys_notif_register_notifier("adsp",
						&adsp_state_notifier_block);
	if (IS_ERR(drv->adsp_state_notifier)) {
		ret = PTR_ERR(drv->adsp_state_notifier);
		dev_err(&pdev->dev, "%s: Registration with the SSR notification driver failed (%d)",
			__func__, ret);
		goto err_irq;
	}

	return 0;

err_irq:
	destroy_ramdump_device(drv->ramdump_dev);
err_ramdump:
	subsys_unregister(drv->subsys);
err_subsys:
@@ -361,8 +335,6 @@ static int pil_mss_driver_exit(struct platform_device *pdev)
{
	struct modem_data *drv = platform_get_drvdata(pdev);

	subsys_notif_unregister_notifier(drv->adsp_state_notifier,
						&adsp_state_notifier_block);
	subsys_unregister(drv->subsys);
	destroy_ramdump_device(drv->ramdump_dev);
	pil_desc_release(&drv->q6->desc);
+12 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include <soc/qcom/subsystem_restart.h>
#include <soc/qcom/subsystem_notif.h>
#include <soc/qcom/socinfo.h>
#include <soc/qcom/sysmon.h>

#include <asm/current.h>

@@ -385,12 +386,23 @@ static void notify_each_subsys_device(struct subsys_device **list,
		unsigned count,
		enum subsys_notif_type notif, void *data)
{
	struct subsys_device *subsys;

	while (count--) {
		struct subsys_device *dev = *list++;
		struct notif_data notif_data;

		if (!dev)
			continue;

		mutex_lock(&subsys_list_lock);
		list_for_each_entry(subsys, &subsys_list, list)
			if (dev != subsys)
				sysmon_send_event(subsys->desc->name,
						dev->desc->name,
						notif);
		mutex_unlock(&subsys_list_lock);

		notif_data.crashed = subsys_get_crash_status(dev);
		notif_data.enable_ramdump = enable_ramdumps;

+30 −6
Original line number Diff line number Diff line
@@ -60,6 +60,20 @@ static const char *notif_name[SUBSYS_NOTIF_TYPE_COUNT] = {
	[SUBSYS_AFTER_POWERUP]   = "after_powerup",
};

struct enum_name_map {
	int id;
	const char name[50];
};

static struct enum_name_map map[SYSMON_NUM_SS] = {
	{SYSMON_SS_WCNSS, "wcnss"},
	{SYSMON_SS_MODEM, "modem"},
	{SYSMON_SS_LPASS, "adsp"},
	{SYSMON_SS_Q6FW, "modem_fw"},
	{SYSMON_SS_EXT_MODEM, "external_modem"},
	{SYSMON_SS_DSPS, "dsps"},
};

static int sysmon_send_smd(struct sysmon_subsys *ss, const char *tx_buf,
			   size_t len)
{
@@ -130,19 +144,29 @@ static int sysmon_send_msg(struct sysmon_subsys *ss, const char *tx_buf,
 *
 * If CONFIG_MSM_SYSMON_COMM is not defined, always return success (0).
 */
int sysmon_send_event(enum subsys_id dest_ss, const char *event_ss,
int sysmon_send_event(const char *dest_ss, const char *event_ss,
		      enum subsys_notif_type notif)
{
	struct sysmon_subsys *ss = &subsys[dest_ss];

	char tx_buf[TX_BUF_SIZE];
	int ret;
	int ret, i;
	struct sysmon_subsys *ss = NULL;

	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 ||
	    notif < 0 || notif >= SUBSYS_NOTIF_TYPE_COUNT ||
	    event_ss == NULL)
	if (notif < 0 || notif >= SUBSYS_NOTIF_TYPE_COUNT || event_ss == NULL ||
						notif_name[notif] == NULL)
		return -EINVAL;

	snprintf(tx_buf, ARRAY_SIZE(tx_buf), "ssr:%s:%s", event_ss,
Loading