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

Commit c0be1dd3 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Add diag support for NPU"

parents 7592e1aa 509ce72a
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@
#define DIAG_CON_SENSORS	(0x0010)	/* Bit mask for Sensors */
#define DIAG_CON_WDSP		(0x0020)	/* Bit mask for WDSP */
#define DIAG_CON_CDSP		(0x0040)	/* Bit mask for CDSP */
#define DIAG_CON_NPU		(0x0080)	/* Bit mask for NPU */

#define DIAG_CON_UPD_WLAN		(0x1000) /*Bit mask for WLAN PD*/
#define DIAG_CON_UPD_AUDIO		(0x2000) /*Bit mask for AUDIO PD*/
@@ -82,7 +83,7 @@
#define DIAG_CON_ALL		(DIAG_CON_APSS | DIAG_CON_MPSS \
				| DIAG_CON_LPASS | DIAG_CON_WCNSS \
				| DIAG_CON_SENSORS | DIAG_CON_WDSP \
				| DIAG_CON_CDSP)
				| DIAG_CON_CDSP | DIAG_CON_NPU)
#define DIAG_CON_UPD_ALL	(DIAG_CON_UPD_WLAN \
				| DIAG_CON_UPD_AUDIO \
				| DIAG_CON_UPD_SENSORS)
@@ -93,6 +94,7 @@
#define DIAG_STM_APPS	0x08
#define DIAG_STM_SENSORS 0x10
#define DIAG_STM_CDSP 0x20
#define DIAG_STM_NPU 0x40

#define INVALID_PID		-1
#define DIAG_CMD_FOUND		1
@@ -220,7 +222,8 @@
#define PERIPHERAL_SENSORS	3
#define PERIPHERAL_WDSP		4
#define PERIPHERAL_CDSP		5
#define NUM_PERIPHERALS		6
#define PERIPHERAL_NPU		6
#define NUM_PERIPHERALS		7
#define APPS_DATA		(NUM_PERIPHERALS)

#define UPD_WLAN		7
@@ -517,6 +520,7 @@ struct diag_query_pid_t {
struct diag_con_all_param_t {
	uint32_t diag_con_all;
	uint32_t num_peripherals;
	uint32_t upd_map_supported;
};

struct diag_md_session_t {
+8 −0
Original line number Diff line number Diff line
@@ -411,6 +411,8 @@ static uint32_t diag_translate_kernel_to_user_mask(uint32_t peripheral_mask)
		ret |= DIAG_CON_WDSP;
	if (peripheral_mask & MD_PERIPHERAL_MASK(PERIPHERAL_CDSP))
		ret |= DIAG_CON_CDSP;
	if (peripheral_mask & MD_PERIPHERAL_MASK(PERIPHERAL_NPU))
		ret |= DIAG_CON_NPU;
	if (peripheral_mask & MD_PERIPHERAL_MASK(UPD_WLAN))
		ret |= DIAG_CON_UPD_WLAN;
	if (peripheral_mask & MD_PERIPHERAL_MASK(UPD_AUDIO))
@@ -1753,6 +1755,8 @@ static uint32_t diag_translate_mask(uint32_t peripheral_mask)
		ret |= (1 << PERIPHERAL_WDSP);
	if (peripheral_mask & DIAG_CON_CDSP)
		ret |= (1 << PERIPHERAL_CDSP);
	if (peripheral_mask & DIAG_CON_NPU)
		ret |= (1 << PERIPHERAL_NPU);
	if (peripheral_mask & DIAG_CON_UPD_WLAN)
		ret |= (1 << UPD_WLAN);
	if (peripheral_mask & DIAG_CON_UPD_AUDIO)
@@ -2431,6 +2435,8 @@ int diag_query_pd(char *process_name)
		return PERIPHERAL_SENSORS;
	if (diag_query_pd_name(process_name, "cdsp/root_pd"))
		return PERIPHERAL_CDSP;
	if (diag_query_pd_name(process_name, "npu/root_pd"))
		return PERIPHERAL_NPU;
	if (diag_query_pd_name(process_name, "wlan_pd"))
		return UPD_WLAN;
	if (diag_query_pd_name(process_name, "audio_pd"))
@@ -2852,6 +2858,7 @@ long diagchar_compat_ioctl(struct file *filp,
	case DIAG_IOCTL_QUERY_CON_ALL:
		con_param.diag_con_all = DIAG_CON_ALL;
		con_param.num_peripherals = NUM_PERIPHERALS;
		con_param.upd_map_supported = 1;
		if (copy_to_user((void __user *)ioarg, &con_param,
				sizeof(struct diag_con_all_param_t)))
			result = -EFAULT;
@@ -3011,6 +3018,7 @@ long diagchar_ioctl(struct file *filp,
	case DIAG_IOCTL_QUERY_CON_ALL:
		con_param.diag_con_all = DIAG_CON_ALL;
		con_param.num_peripherals = NUM_PERIPHERALS;
		con_param.upd_map_supported = 1;
		if (copy_to_user((void __user *)ioarg, &con_param,
				sizeof(struct diag_con_all_param_t)))
			result = -EFAULT;
+9 −0
Original line number Diff line number Diff line
@@ -634,6 +634,9 @@ int diag_process_stm_cmd(unsigned char *buf, int len, unsigned char *dest_buf)
		if (mask & DIAG_STM_CDSP)
			diag_process_stm_mask(cmd, DIAG_STM_CDSP,
						PERIPHERAL_CDSP);
		if (mask & DIAG_STM_NPU)
			diag_process_stm_mask(cmd, DIAG_STM_NPU,
						PERIPHERAL_NPU);

		if (mask & DIAG_STM_APPS)
			diag_process_stm_mask(cmd, DIAG_STM_APPS, APPS_DATA);
@@ -658,6 +661,9 @@ int diag_process_stm_cmd(unsigned char *buf, int len, unsigned char *dest_buf)
	if (driver->feature[PERIPHERAL_CDSP].stm_support)
		rsp_supported |= DIAG_STM_CDSP;

	if (driver->feature[PERIPHERAL_NPU].stm_support)
		rsp_supported |= DIAG_STM_NPU;

	rsp_supported |= DIAG_STM_APPS;

	/* Set mask denoting STM state/status for each peripheral/APSS */
@@ -676,6 +682,9 @@ int diag_process_stm_cmd(unsigned char *buf, int len, unsigned char *dest_buf)
	if (driver->stm_state[PERIPHERAL_CDSP])
		rsp_status |= DIAG_STM_CDSP;

	if (driver->stm_state[PERIPHERAL_NPU])
		rsp_status |= DIAG_STM_NPU;

	if (driver->stm_state[APPS_DATA])
		rsp_status |= DIAG_STM_APPS;

+4 −2
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@
	((x == PERIPHERAL_WCNSS) ? DIAG_CON_WCNSS :		\
	((x == PERIPHERAL_SENSORS) ? DIAG_CON_SENSORS : \
	((x == PERIPHERAL_WDSP) ? DIAG_CON_WDSP : \
	((x == PERIPHERAL_CDSP) ? DIAG_CON_CDSP : 0))))))	\
	((x == PERIPHERAL_CDSP) ? DIAG_CON_CDSP : \
	((x == PERIPHERAL_NPU) ? DIAG_CON_NPU : 0)))))))	\

#define PERIPHERAL_STRING(x)					\
	((x == PERIPHERAL_MODEM) ? "MODEM" :			\
@@ -36,7 +37,8 @@
	((x == PERIPHERAL_WCNSS) ? "WCNSS" :			\
	((x == PERIPHERAL_SENSORS) ? "SENSORS" :		\
	((x == PERIPHERAL_WDSP) ? "WDSP" :			\
	((x == PERIPHERAL_CDSP) ? "CDSP" : "UNKNOWN"))))))	\
	((x == PERIPHERAL_CDSP) ? "CDSP" :			\
	((x == PERIPHERAL_NPU) ? "NPU" : "UNKNOWN")))))))	\

struct diagfwd_buf_t {
	unsigned char *data;
+45 −0
Original line number Diff line number Diff line
@@ -93,6 +93,15 @@ struct diag_rpmsg_info rpmsg_data[NUM_PERIPHERALS] = {
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	},
	{
		.peripheral = PERIPHERAL_NPU,
		.type = TYPE_DATA,
		.edge = "npu",
		.name = "DIAG_DATA",
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	}
};

@@ -150,6 +159,15 @@ struct diag_rpmsg_info rpmsg_cntl[NUM_PERIPHERALS] = {
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	},
	{
		.peripheral = PERIPHERAL_NPU,
		.type = TYPE_CNTL,
		.edge = "npu",
		.name = "DIAG_CTRL",
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	}
};

@@ -207,6 +225,15 @@ struct diag_rpmsg_info rpmsg_dci[NUM_PERIPHERALS] = {
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	},
	{
		.peripheral = PERIPHERAL_NPU,
		.type = TYPE_DCI,
		.edge = "npu",
		.name = "DIAG_DCI_DATA",
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	}
};

@@ -264,6 +291,15 @@ struct diag_rpmsg_info rpmsg_cmd[NUM_PERIPHERALS] = {
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	},
	{
		.peripheral = PERIPHERAL_NPU,
		.type = TYPE_CMD,
		.edge = "npu",
		.name = "DIAG_CMD",
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	}
};

@@ -321,6 +357,15 @@ struct diag_rpmsg_info rpmsg_dci_cmd[NUM_PERIPHERALS] = {
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	},
	{
		.peripheral = PERIPHERAL_NPU,
		.type = TYPE_DCI_CMD,
		.edge = "npu",
		.name = "DIAG_DCI_CMD",
		.buf1 = NULL,
		.buf2 = NULL,
		.hdl = NULL
	}
};

Loading