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

Commit 88ba33c7 authored by Arun KS's avatar Arun KS
Browse files

esoc: Add err_fatal signal status to clink_ops



Auto_boot esoc devices can boot and crash before
esoc driver comes up. But there is no way for the
user space code to know that it has crashed by looking
at status line alone. Hence, create a new ioctl entry
to export status of err_fatal line to user space.

Change-Id: Ie7d6115c749d4c63f06aefca29ba457d38eccc7f
Signed-off-by: default avatarArun KS <arunks@codeaurora.org>
parent 6bf850d5
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -480,7 +480,7 @@ static irqreturn_t mdm_pblrdy_change(int irq, void *dev_id)
	return IRQ_HANDLED;
}

static int mdm_get_status(u32 *status, struct esoc_clink *esoc)
static void mdm_get_status(u32 *status, struct esoc_clink *esoc)
{
	struct mdm_ctrl *mdm = get_esoc_clink_data(esoc);

@@ -488,7 +488,16 @@ static int mdm_get_status(u32 *status, struct esoc_clink *esoc)
		*status = 0;
	else
		*status = 1;
	return 0;
}

static void mdm_get_err_fatal(u32 *status, struct esoc_clink *esoc)
{
	struct mdm_ctrl *mdm = get_esoc_clink_data(esoc);

	if (gpio_get_value(MDM_GPIO(mdm, MDM2AP_ERRFATAL)) == 0)
		*status = 0;
	else
		*status = 1;
}

static void mdm_configure_debug(struct mdm_ctrl *mdm)
@@ -964,6 +973,7 @@ static int mdm9x55_setup_hw(struct mdm_ctrl *mdm,
static struct esoc_clink_ops mdm_cops = {
	.cmd_exe = mdm_cmd_exe,
	.get_status = mdm_get_status,
	.get_err_fatal = mdm_get_err_fatal,
	.notify = mdm_notify,
};

+3 −1
Original line number Diff line number Diff line
@@ -83,11 +83,13 @@ struct esoc_clink {
 * struct esoc_clink_ops: Operations to control external soc
 * @cmd_exe: Execute control command
 * @get_status: Get current status, or response to previous command
 * @get_err_fatal: Get status of err fatal signal
 * @notify_esoc: notify external soc of events
 */
struct esoc_clink_ops {
	int (*cmd_exe)(enum esoc_cmd cmd, struct esoc_clink *dev);
	int (*get_status)(u32 *status, struct esoc_clink *dev);
	void (*get_status)(u32 *status, struct esoc_clink *dev);
	void (*get_err_fatal)(u32 *status, struct esoc_clink *dev);
	void (*notify)(enum esoc_notify notify, struct esoc_clink *dev);
};

+5 −3
Original line number Diff line number Diff line
@@ -224,9 +224,11 @@ static long esoc_dev_ioctl(struct file *file, unsigned int cmd,
		clink_ops->notify(esoc_cmd, esoc_clink);
		break;
	case ESOC_GET_STATUS:
		err = clink_ops->get_status(&status, esoc_clink);
		if (err)
			return err;
		clink_ops->get_status(&status, esoc_clink);
		put_user(status, (unsigned int __user *)uarg);
		break;
	case ESOC_GET_ERR_FATAL:
		clink_ops->get_err_fatal(&status, esoc_clink);
		put_user(status, (unsigned int __user *)uarg);
		break;
	case ESOC_WAIT_FOR_CRASH:
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#define ESOC_WAIT_FOR_REQ	_IOR(ESOC_CODE, 2, unsigned int)
#define ESOC_NOTIFY		_IOW(ESOC_CODE, 3, unsigned int)
#define ESOC_GET_STATUS		_IOR(ESOC_CODE, 4, unsigned int)
#define ESOC_GET_ERR_FATAL	_IOR(ESOC_CODE, 5, unsigned int)
#define ESOC_WAIT_FOR_CRASH	_IOR(ESOC_CODE, 6, unsigned int)
#define ESOC_REG_REQ_ENG	_IO(ESOC_CODE, 7)
#define ESOC_REG_CMD_ENG	_IO(ESOC_CODE, 8)