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

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

Merge "diag: Enable Diag on Sensors Processor"

parents 548e7c28 b911e9d0
Loading
Loading
Loading
Loading
+56 −46
Original line number Diff line number Diff line
@@ -752,6 +752,9 @@ void extract_dci_ctrl_pkt(unsigned char *buf, int len, int token)
		case WCNSS_DATA:
			peripheral_mask = DIAG_CON_WCNSS;
			break;
		case SENSORS_DATA:
			peripheral_mask = DIAG_CON_SENSORS;
			break;
		default:
			pr_err("diag: In %s, unknown peripheral, peripheral: %d\n",
				__func__, *(uint8_t *)temp);
@@ -2240,26 +2243,26 @@ static int diag_dci_probe(struct platform_device *pdev)
	int err = 0;
	int index;

	if (pdev->id == SMD_APPS_MODEM) {
	switch (pdev->id) {
	case SMD_APPS_MODEM:
		index = MODEM_DATA;
		err = smd_named_open_on_edge("DIAG_2",
			SMD_APPS_MODEM,
			&driver->smd_dci[index].ch,
			&driver->smd_dci[index],
			diag_smd_notify);
		driver->smd_dci[index].ch_save =
			driver->smd_dci[index].ch;
		if (err)
			pr_err("diag: In %s, cannot open DCI Modem port, Id = %d, err: %d\n",
				__func__, pdev->id, err);
		else
			diag_smd_buffer_init(&driver->smd_dci[index]);
	}

	if (pdev->id == SMD_APPS_QDSP) {
		break;
	case SMD_APPS_QDSP:
		index = LPASS_DATA;
		break;
	case SMD_APPS_WCNSS:
		index = WCNSS_DATA;
		break;
	case SMD_APPS_DSPS:
		index = SENSORS_DATA;
		break;
	default:
		pr_debug("diag: In %s Received probe for invalid index %d",
			__func__, pdev->id);
		return 0;
	}
	err = smd_named_open_on_edge("DIAG_2",
					     SMD_APPS_QDSP,
				     pdev->id,
				     &driver->smd_dci[index].ch,
				     &driver->smd_dci[index],
				     diag_smd_notify);
@@ -2269,7 +2272,6 @@ static int diag_dci_probe(struct platform_device *pdev)
			__func__, pdev->id, err);
	else
		diag_smd_buffer_init(&driver->smd_dci[index]);
	}

	return err;
}
@@ -2279,8 +2281,24 @@ static int diag_dci_cmd_probe(struct platform_device *pdev)
	int err = 0;
	int index;

	if (pdev->id == SMD_APPS_MODEM) {
	switch (pdev->id) {
	case SMD_APPS_MODEM:
		index = MODEM_DATA;
		break;
	case SMD_APPS_QDSP:
		index = LPASS_DATA;
		break;
	case SMD_APPS_WCNSS:
		index = WCNSS_DATA;
		break;
	case SMD_APPS_DSPS:
		index = SENSORS_DATA;
		break;
	default:
		pr_debug("diag: In %s Received probe for invalid index %d",
			__func__, pdev->id);
		return 0;
	}
	err = smd_named_open_on_edge("DIAG_2_CMD",
			pdev->id,
			&driver->smd_dci_cmd[index].ch,
@@ -2293,7 +2311,6 @@ static int diag_dci_cmd_probe(struct platform_device *pdev)
				__func__, pdev->id, err);
	else
		diag_smd_buffer_init(&driver->smd_dci_cmd[index]);
	}

	return err;
}
@@ -2872,26 +2889,19 @@ int diag_dci_deinit_client(struct diag_dci_client_tbl *entry)
int diag_dci_write_proc(int peripheral, int pkt_type, char *buf, int len)
{
	struct diag_smd_info *smd_info = NULL;
	int i;
	int err = 0;

	if (!buf || (peripheral < 0 || peripheral > NUM_SMD_DCI_CHANNELS)
								|| len < 0) {
		|| !driver->rcvd_feature_mask[peripheral] || len < 0) {
		pr_err("diag: In %s, invalid data 0x%p, peripheral: %d, len: %d\n",
				__func__, buf, peripheral, len);
		return -EINVAL;
	}

	if (pkt_type == DIAG_DATA_TYPE) {
		for (i = 0; i < NUM_SMD_DCI_CMD_CHANNELS; i++)
			if (peripheral == i)
				smd_info = &driver->smd_dci_cmd[peripheral];
		/*
		 * This peripheral doesn't support separate channel for
		 * command response.
		 */
		if (!smd_info)
			smd_info = &driver->smd_dci[peripheral];
		smd_info = driver->separate_cmdrsp[peripheral] ?
			&driver->smd_dci_cmd[peripheral] :
			&driver->smd_dci[peripheral];
	} else if (pkt_type == DIAG_CNTL_TYPE) {
		smd_info = &driver->smd_cntl[peripheral];
	} else {
+133 −1
Original line number Diff line number Diff line
@@ -46,13 +46,23 @@ static ssize_t diag_dbgfs_read_status(struct file *file, char __user *ubuf,
		"modem ch: 0x%p\n"
		"lpass ch: 0x%p\n"
		"riva ch: 0x%p\n"
		"sensors ch: 0x%p\n"
		"modem dci ch: 0x%p\n"
		"lpass dci ch: 0x%p\n"
		"riva dci ch: 0x%p\n"
		"sensors dci ch: 0x%p\n"
		"modem cntl_ch: 0x%p\n"
		"lpass cntl_ch: 0x%p\n"
		"riva cntl_ch: 0x%p\n"
		"sensors cntl_ch: 0x%p\n"
		"modem cmd ch: 0x%p\n"
		"adsp cmd ch: 0x%p\n"
		"riva cmd ch: 0x%p\n"
		"sensors cmd ch: 0x%p\n"
		"modem dci cmd ch: 0x%p\n"
		"lpass dci cmd ch: 0x%p\n"
		"riva dci cmd ch: 0x%p\n"
		"sensors dci cmd ch: 0x%p\n"
		"CPU Tools id: %d\n"
		"Apps only: %d\n"
		"Apps master: %d\n"
@@ -63,69 +73,120 @@ static ssize_t diag_dbgfs_read_status(struct file *file, char __user *ubuf,
		"Modem separate cmdrsp: %d\n"
		"LPASS separate cmdrsp: %d\n"
		"RIVA separate cmdrsp: %d\n"
		"SENSORS separate cmdrsp: %d\n"
		"Modem in_busy_1: %d\n"
		"Modem in_busy_2: %d\n"
		"LPASS in_busy_1: %d\n"
		"LPASS in_busy_2: %d\n"
		"RIVA in_busy_1: %d\n"
		"RIVA in_busy_2: %d\n"
		"SENSORS in_busy_1: %d\n"
		"SENSORS in_busy_2: %d\n"
		"DCI Modem in_busy_1: %d\n"
		"DCI LPASS in_busy_1: %d\n"
		"DCI WCNSS in_busy_1: %d\n"
		"DCI SENSORS in_busy_1: %d\n"
		"Modem CMD in_busy_1: %d\n"
		"Modem CMD in_busy_2: %d\n"
		"DCI CMD Modem in_busy_1: %d\n"
		"DCI CMD LPASS in_busy_1: %d\n"
		"DCI CMD WCNSS in_busy_1: %d\n"
		"DCI CMD SENSORS in_busy_1: %d\n"
		"ADSP CMD in_busy_1: %d\n"
		"ADSP CMD in_busy_2: %d\n"
		"RIVA CMD in_busy_1: %d\n"
		"RIVA CMD in_busy_2: %d\n"
		"SENSORS CMD in_busy_1: %d\n"
		"SENSORS CMD in_busy_2: %d\n"
		"Modem supports STM: %d\n"
		"LPASS supports STM: %d\n"
		"RIVA supports STM: %d\n"
		"SENSORS supports STM: %d\n"
		"Modem STM state: %d\n"
		"LPASS STM state: %d\n"
		"RIVA STM state: %d\n"
		"SENSORS STM state: %d\n"
		"APPS STM state: %d\n"
		"Modem STM requested state: %d\n"
		"LPASS STM requested state: %d\n"
		"RIVA STM requested state: %d\n"
		"SENSORS STM requested state: %d\n"
		"APPS STM requested state: %d\n"
		"supports apps hdlc encoding: %d\n"
		"Modem hdlc encoding: %d\n"
		"Lpass hdlc encoding: %d\n"
		"RIVA hdlc encoding: %d\n"
		"SENSORS hdlc encoding: %d\n"
		"Modem CMD hdlc encoding: %d\n"
		"ADSP CMD hdlc encoding: %d\n"
		"RIVA CMD hdlc encoding: %d\n"
		"SENSORS CMD hdlc encoding: %d\n"
		"Modem DATA in_buf_1_size: %d\n"
		"Modem DATA in_buf_2_size: %d\n"
		"ADSP DATA in_buf_1_size: %d\n"
		"ADSP DATA in_buf_2_size: %d\n"
		"RIVA DATA in_buf_1_size: %d\n"
		"RIVA DATA in_buf_2_size: %d\n"
		"SENSORS DATA in_buf_1_size: %d\n"
		"SENSORS DATA in_buf_2_size: %d\n"
		"Modem DATA in_buf_1_raw_size: %d\n"
		"Modem DATA in_buf_2_raw_size: %d\n"
		"ADSP DATA in_buf_1_raw_size: %d\n"
		"ADSP DATA in_buf_2_raw_size: %d\n"
		"RIVA DATA in_buf_1_raw_size: %d\n"
		"RIVA DATA in_buf_2_raw_size: %d\n"
		"SENSORS DATA in_buf_1_raw_size: %d\n"
		"SENSORS DATA in_buf_2_raw_size: %d\n"
		"Modem CMD in_buf_1_size: %d\n"
		"Modem CMD in_buf_1_raw_size: %d\n"
		"ADSP CMD in_buf_1_size: %d\n"
		"ADSP CMD in_buf_1_raw_size: %d\n"
		"RIVA CMD in_buf_1_size: %d\n"
		"RIVA CMD in_buf_1_raw_size: %d\n"
		"SENSORS CMD in_buf_1_size: %d\n"
		"SENSORS CMD in_buf_1_raw_size: %d\n"
		"Modem CNTL in_buf_1_size: %d\n"
		"ADSP CNTL in_buf_1_size: %d\n"
		"RIVA CNTL in_buf_1_size: %d\n"
		"SENSORS CNTL in_buf_1_size: %d\n"
		"Modem DCI in_buf_1_size: %d\n"
		"Modem DCI CMD in_buf_1_size: %d\n"
		"LPASS DCI in_buf_1_size: %d\n"
		"LPASS DCI CMD in_buf_1_size: %d\n"
		"WCNSS DCI in_buf_1_size: %d\n"
		"WCNSS DCI CMD in_buf_1_size: %d\n"
		"SENSORS DCI in_buf_1_size: %d\n"
		"SENSORS DCI CMD in_buf_1_size: %d\n"
		"Received Feature mask from Modem: %d\n"
		"Received Feature mask from LPASS: %d\n"
		"Received Feature mask from WCNSS: %d\n"
		"Received Feature mask from SENSORS: %d\n"
		"Mask Centralization Support on Modem: %d\n"
		"Mask Centralization Support on LPASS: %d\n"
		"Mask Centralization Support on WCNSS: %d\n"
		"Mask Centralization Support on SENSORS: %d\n"
		"logging_mode: %d\n"
		"rsp_in_busy: %d\n",
		driver->smd_data[MODEM_DATA].ch,
		driver->smd_data[LPASS_DATA].ch,
		driver->smd_data[WCNSS_DATA].ch,
		driver->smd_data[SENSORS_DATA].ch,
		driver->smd_dci[MODEM_DATA].ch,
		driver->smd_dci[LPASS_DATA].ch,
		driver->smd_dci[WCNSS_DATA].ch,
		driver->smd_dci[SENSORS_DATA].ch,
		driver->smd_cntl[MODEM_DATA].ch,
		driver->smd_cntl[LPASS_DATA].ch,
		driver->smd_cntl[WCNSS_DATA].ch,
		driver->smd_cntl[SENSORS_DATA].ch,
		driver->smd_cmd[MODEM_DATA].ch,
		driver->smd_cmd[LPASS_DATA].ch,
		driver->smd_cmd[WCNSS_DATA].ch,
		driver->smd_cmd[SENSORS_DATA].ch,
		driver->smd_dci_cmd[MODEM_DATA].ch,
		driver->smd_dci_cmd[LPASS_DATA].ch,
		driver->smd_dci_cmd[WCNSS_DATA].ch,
		driver->smd_dci_cmd[SENSORS_DATA].ch,
		chk_config_get_id(),
		chk_apps_only(),
		chk_apps_master(),
@@ -136,57 +197,98 @@ static ssize_t diag_dbgfs_read_status(struct file *file, char __user *ubuf,
		driver->separate_cmdrsp[MODEM_DATA],
		driver->separate_cmdrsp[LPASS_DATA],
		driver->separate_cmdrsp[WCNSS_DATA],
		driver->separate_cmdrsp[SENSORS_DATA],
		driver->smd_data[MODEM_DATA].in_busy_1,
		driver->smd_data[MODEM_DATA].in_busy_2,
		driver->smd_data[LPASS_DATA].in_busy_1,
		driver->smd_data[LPASS_DATA].in_busy_2,
		driver->smd_data[WCNSS_DATA].in_busy_1,
		driver->smd_data[WCNSS_DATA].in_busy_2,
		driver->smd_data[SENSORS_DATA].in_busy_1,
		driver->smd_data[SENSORS_DATA].in_busy_2,
		driver->smd_dci[MODEM_DATA].in_busy_1,
		driver->smd_dci[LPASS_DATA].in_busy_1,
		driver->smd_dci[WCNSS_DATA].in_busy_1,
		driver->smd_dci[SENSORS_DATA].in_busy_1,
		driver->smd_cmd[MODEM_DATA].in_busy_1,
		driver->smd_cmd[MODEM_DATA].in_busy_2,
		driver->smd_cmd[LPASS_DATA].in_busy_1,
		driver->smd_cmd[LPASS_DATA].in_busy_2,
		driver->smd_cmd[WCNSS_DATA].in_busy_1,
		driver->smd_cmd[WCNSS_DATA].in_busy_2,
		driver->smd_cmd[SENSORS_DATA].in_busy_1,
		driver->smd_cmd[SENSORS_DATA].in_busy_2,
		driver->smd_dci_cmd[MODEM_DATA].in_busy_1,
		driver->smd_dci_cmd[LPASS_DATA].in_busy_1,
		driver->smd_dci_cmd[WCNSS_DATA].in_busy_1,
		driver->smd_dci_cmd[SENSORS_DATA].in_busy_1,
		driver->peripheral_supports_stm[MODEM_DATA],
		driver->peripheral_supports_stm[LPASS_DATA],
		driver->peripheral_supports_stm[WCNSS_DATA],
		driver->peripheral_supports_stm[SENSORS_DATA],
		driver->stm_state[MODEM_DATA],
		driver->stm_state[LPASS_DATA],
		driver->stm_state[WCNSS_DATA],
		driver->stm_state[SENSORS_DATA],
		driver->stm_state[APPS_DATA],
		driver->stm_state_requested[MODEM_DATA],
		driver->stm_state_requested[LPASS_DATA],
		driver->stm_state_requested[WCNSS_DATA],
		driver->stm_state_requested[SENSORS_DATA],
		driver->stm_state_requested[APPS_DATA],
		driver->supports_apps_hdlc_encoding,
		driver->smd_data[MODEM_DATA].encode_hdlc,
		driver->smd_data[LPASS_DATA].encode_hdlc,
		driver->smd_data[WCNSS_DATA].encode_hdlc,
		driver->smd_data[SENSORS_DATA].encode_hdlc,
		driver->smd_cmd[MODEM_DATA].encode_hdlc,
		driver->smd_cmd[LPASS_DATA].encode_hdlc,
		driver->smd_cmd[WCNSS_DATA].encode_hdlc,
		driver->smd_cmd[SENSORS_DATA].encode_hdlc,
		(unsigned int)driver->smd_data[MODEM_DATA].buf_in_1_size,
		(unsigned int)driver->smd_data[MODEM_DATA].buf_in_2_size,
		(unsigned int)driver->smd_data[LPASS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_data[LPASS_DATA].buf_in_2_size,
		(unsigned int)driver->smd_data[WCNSS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_data[WCNSS_DATA].buf_in_2_size,
		(unsigned int)driver->smd_data[SENSORS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_data[SENSORS_DATA].buf_in_2_size,
		(unsigned int)driver->smd_data[MODEM_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_data[MODEM_DATA].buf_in_2_raw_size,
		(unsigned int)driver->smd_data[LPASS_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_data[LPASS_DATA].buf_in_2_raw_size,
		(unsigned int)driver->smd_data[WCNSS_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_data[WCNSS_DATA].buf_in_2_raw_size,
		(unsigned int)driver->smd_data[SENSORS_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_data[SENSORS_DATA].buf_in_2_raw_size,
		(unsigned int)driver->smd_cmd[MODEM_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cmd[MODEM_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_cmd[LPASS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cmd[LPASS_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_cmd[WCNSS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cmd[WCNSS_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_cmd[SENSORS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cmd[SENSORS_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_cntl[MODEM_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cntl[LPASS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cntl[WCNSS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cntl[SENSORS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci[MODEM_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci_cmd[MODEM_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci[LPASS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci_cmd[LPASS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci[WCNSS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci_cmd[WCNSS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci[SENSORS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci_cmd[SENSORS_DATA].buf_in_1_size,
		driver->rcvd_feature_mask[MODEM_DATA],
		driver->rcvd_feature_mask[LPASS_DATA],
		driver->rcvd_feature_mask[WCNSS_DATA],
		driver->rcvd_feature_mask[SENSORS_DATA],
		driver->mask_centralization[MODEM_DATA],
		driver->mask_centralization[LPASS_DATA],
		driver->mask_centralization[WCNSS_DATA],
		driver->mask_centralization[SENSORS_DATA],
		driver->logging_mode,
		driver->rsp_buf_busy);

@@ -354,17 +456,27 @@ static ssize_t diag_dbgfs_read_workpending(struct file *file,
		"Modem data diag_read_smd_work: %d\n"
		"LPASS data diag_read_smd_work: %d\n"
		"RIVA data diag_read_smd_work: %d\n"
		"SENSORS data diag_read_smd_work: %d\n"
		"Modem cntl diag_read_smd_work: %d\n"
		"LPASS cntl diag_read_smd_work: %d\n"
		"RIVA cntl diag_read_smd_work: %d\n"
		"SENSORS cntl diag_read_smd_work: %d\n"
		"Modem dci diag_read_smd_work: %d\n"
		"LPASS dci diag_read_smd_work: %d\n"
		"WCNSS dci diag_read_smd_work: %d\n"
		"SENSORS dci diag_read_smd_work: %d\n"
		"Modem data diag_notify_update_smd_work: %d\n"
		"LPASS data diag_notify_update_smd_work: %d\n"
		"RIVA data diag_notify_update_smd_work: %d\n"
		"SENSORS data diag_notify_update_smd_work: %d\n"
		"Modem cntl diag_notify_update_smd_work: %d\n"
		"LPASS cntl diag_notify_update_smd_work: %d\n"
		"RIVA cntl diag_notify_update_smd_work: %d\n"
		"Modem dci diag_notify_update_smd_work: %d\n",
		"SENSORS cntl diag_notify_update_smd_work: %d\n"
		"Modem dci diag_notify_update_smd_work: %d\n"
		"LPASS dci diag_notify_update_smd_work: %d\n"
		"WCNSS dci diag_notify_update_smd_work: %d\n"
		"SENSORS dci diag_notify_update_smd_work: %d\n",
		work_pending(&(driver->diag_drain_work)),
		work_pending(&(driver->smd_data[MODEM_DATA].
							diag_read_smd_work)),
@@ -372,27 +484,47 @@ static ssize_t diag_dbgfs_read_workpending(struct file *file,
							diag_read_smd_work)),
		work_pending(&(driver->smd_data[WCNSS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_data[SENSORS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_cntl[MODEM_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_cntl[LPASS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_cntl[WCNSS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_cntl[SENSORS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_dci[MODEM_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_dci[LPASS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_dci[WCNSS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_dci[SENSORS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_data[MODEM_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_data[LPASS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_data[WCNSS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_data[SENSORS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_cntl[MODEM_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_cntl[LPASS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_cntl[WCNSS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_cntl[SENSORS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_dci[MODEM_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_dci[LPASS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_dci[WCNSS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_dci[SENSORS_DATA].
						diag_notify_update_smd_work)));

#ifdef CONFIG_DIAG_OVER_USB
+17 −10
Original line number Diff line number Diff line
@@ -43,10 +43,12 @@
#define MODEM_DATA		0
#define LPASS_DATA		1
#define WCNSS_DATA		2
#define APPS_DATA		3
#define HSIC_DATA		4
#define HSIC_2_DATA		5
#define SMUX_DATA		10
#define SENSORS_DATA    3
#define LAST_PERIPHERAL SENSORS_DATA
#define APPS_DATA		(LAST_PERIPHERAL + 1)
#define HSIC_DATA		(LAST_PERIPHERAL + 2)
#define HSIC_2_DATA		(LAST_PERIPHERAL + 3)
#define SMUX_DATA		(LAST_PERIPHERAL + 8)
#define APPS_PROC		1

#define USER_SPACE_DATA 8192
@@ -61,13 +63,14 @@
#define DIAG_CON_MPSS (0x0002)	/* Bit mask for MPSS */
#define DIAG_CON_LPASS (0x0004)	/* Bit mask for LPASS */
#define DIAG_CON_WCNSS (0x0008)	/* Bit mask for WCNSS */
#define DIAG_CON_SENSORS (0x0016)

#define NUM_STM_PROCESSORS	4

#define DIAG_STM_MODEM	0x01
#define DIAG_STM_LPASS	0x02
#define DIAG_STM_WCNSS	0x04
#define DIAG_STM_APPS	0x08
#define DIAG_STM_SENSORS 0x16

#define DIAG_CMD_VERSION	0
#define DIAG_CMD_DOWNLOAD	0x3A
@@ -119,12 +122,16 @@
#define MODE_REALTIME 1
#define MODE_NONREALTIME 0

#define NUM_SMD_DATA_CHANNELS 3
#define NUM_SMD_DATA_CHANNELS 4
#define NUM_SMD_CONTROL_CHANNELS NUM_SMD_DATA_CHANNELS
#define NUM_SMD_DCI_CHANNELS 2
#define NUM_SMD_CMD_CHANNELS 1
#define NUM_SMD_DCI_CMD_CHANNELS 1

#define NUM_SMD_DCI_CHANNELS 4
#define NUM_SMD_CMD_CHANNELS 4
#define NUM_SMD_DCI_CMD_CHANNELS 4
/*
 * Number of stm processors includes all the peripherals and
 * apps.Added 1 below to indicate apps
 */
#define NUM_STM_PROCESSORS	(NUM_SMD_CONTROL_CHANNELS + 1)
/*
 * Indicates number of peripherals that can support DCI and Apps
 * processor. This doesn't mean that a peripheral has the
+95 −50
Original line number Diff line number Diff line
@@ -906,7 +906,7 @@ int diag_device_write(void *buf, int len, int data_type, int ctxt)
		} else
			return -EINVAL;
	} else if (driver->logging_mode == NO_LOGGING_MODE) {
		if ((data_type >= MODEM_DATA) && (data_type <= WCNSS_DATA)) {
		if ((data_type >= MODEM_DATA) && (data_type <= SENSORS_DATA)) {
			driver->smd_data[data_type].in_busy_1 = 0;
			driver->smd_data[data_type].in_busy_2 = 0;
			queue_work(driver->smd_data[data_type].wq,
@@ -940,7 +940,7 @@ int diag_device_write(void *buf, int len, int data_type, int ctxt)
						POOL_TYPE_USB_APPS,
						buf, len, ctxt);
		} else if ((data_type >= MODEM_DATA) &&
		    (data_type <= WCNSS_DATA)) {
		    (data_type <= SENSORS_DATA)) {
			err = diag_write_to_usb(driver->legacy_ch,
						POOL_TYPE_USB_PERIPHERALS,
						buf, len, ctxt);
@@ -1093,7 +1093,7 @@ int diag_send_data(struct diag_master_table entry, unsigned char *buf,
void diag_process_stm_mask(uint8_t cmd, uint8_t data_mask, int data_type)
{
	int status = 0;
	if (data_type >= MODEM_DATA && data_type <= WCNSS_DATA) {
	if (data_type >= MODEM_DATA && data_type <= SENSORS_DATA) {
		if (driver->peripheral_supports_stm[data_type]) {
			status = diag_send_stm_state(
				&driver->smd_cntl[data_type], cmd);
@@ -1145,6 +1145,10 @@ int diag_process_stm_cmd(unsigned char *buf, unsigned char *dest_buf)
		if (mask & DIAG_STM_WCNSS)
			diag_process_stm_mask(cmd, DIAG_STM_WCNSS, WCNSS_DATA);

		if (mask & DIAG_STM_SENSORS)
			diag_process_stm_mask(cmd, DIAG_STM_SENSORS,
						SENSORS_DATA);

		if (mask & DIAG_STM_APPS)
			diag_process_stm_mask(cmd, DIAG_STM_APPS, APPS_DATA);
	}
@@ -1153,16 +1157,35 @@ int diag_process_stm_cmd(unsigned char *buf, unsigned char *dest_buf)
		dest_buf[i] = *(buf + i);

	/* Set mask denoting which peripherals support STM */
	for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++)
		if (driver->peripheral_supports_stm[i])
			rsp_supported |= 1 << i;
	if (driver->peripheral_supports_stm[MODEM_DATA])
		rsp_supported |= DIAG_STM_MODEM;

	if (driver->peripheral_supports_stm[LPASS_DATA])
		rsp_supported |= DIAG_STM_LPASS;

	if (driver->peripheral_supports_stm[WCNSS_DATA])
		rsp_supported |= DIAG_STM_WCNSS;

	if (driver->peripheral_supports_stm[SENSORS_DATA])
		rsp_supported |= DIAG_STM_SENSORS;

	rsp_supported |= DIAG_STM_APPS;

	/* Set mask denoting STM state/status for each peripheral/APSS */
	for (i = 0; i < NUM_STM_PROCESSORS; i++)
		if (driver->stm_state[i])
			rsp_smd_status |= 1 << i;
	if (driver->stm_state[MODEM_DATA])
		rsp_smd_status |= DIAG_STM_MODEM;

	if (driver->stm_state[LPASS_DATA])
		rsp_smd_status |= DIAG_STM_LPASS;

	if (driver->stm_state[WCNSS_DATA])
		rsp_smd_status |= DIAG_STM_WCNSS;

	if (driver->stm_state[SENSORS_DATA])
		rsp_smd_status |= DIAG_STM_SENSORS;

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

	dest_buf[STM_RSP_SUPPORTED_INDEX] = rsp_supported;
	dest_buf[STM_RSP_SMD_STATUS_INDEX] = rsp_smd_status;
@@ -1829,20 +1852,30 @@ static int diag_smd_probe(struct platform_device *pdev)
	int index = -1;
	const char *channel_name = NULL;

	if (pdev->id == SMD_APPS_MODEM) {
	switch (pdev->id) {
	case SMD_APPS_MODEM:
		index = MODEM_DATA;
		channel_name = "DIAG";
	}
	else if (pdev->id == SMD_APPS_QDSP) {
		break;
	case SMD_APPS_QDSP:
		index = LPASS_DATA;
		channel_name = "DIAG";
	}
	else if (pdev->id == SMD_APPS_WCNSS) {
		break;
	case SMD_APPS_WCNSS:
		index = WCNSS_DATA;
		channel_name = "APPS_RIVA_DATA";
		break;
	case SMD_APPS_DSPS:
		index = SENSORS_DATA;
		channel_name = "DIAG";
		break;
	default:
		pr_debug("diag: In %s Received probe for invalid index %d",
			__func__, pdev->id);
		return 0;

	}

	if (index != -1) {
	r = smd_named_open_on_edge(channel_name,
				pdev->id,
				&driver->smd_data[index].ch,
@@ -1850,7 +1883,6 @@ static int diag_smd_probe(struct platform_device *pdev)
				diag_smd_notify);
	driver->smd_data[index].ch_save = driver->smd_data[index].ch;
	diag_smd_buffer_init(&driver->smd_data[index]);
	}

	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
@@ -1869,21 +1901,33 @@ static int diag_smd_cmd_probe(struct platform_device *pdev)
	if (!driver->supports_separate_cmdrsp)
		return 0;

	if (pdev->id == SMD_APPS_MODEM) {
	switch (pdev->id) {
	case SMD_APPS_MODEM:
		index = MODEM_DATA;
		channel_name = "DIAG_CMD";
	}
		break;
	case SMD_APPS_QDSP:
		index = LPASS_DATA;
		break;
	case SMD_APPS_WCNSS:
		index = WCNSS_DATA;
		break;
	case SMD_APPS_DSPS:
		index = SENSORS_DATA;
		break;
	default:
		pr_debug("diag: In %s Received probe for invalid index %d",
			__func__, pdev->id);
		return 0;

	if (index != -1) {
	}
	channel_name = "DIAG_CMD";
	r = smd_named_open_on_edge(channel_name,
			pdev->id,
			&driver->smd_cmd[index].ch,
			&driver->smd_cmd[index],
			diag_smd_notify);
		driver->smd_cmd[index].ch_save =
			driver->smd_cmd[index].ch;
	driver->smd_cmd[index].ch_save = driver->smd_cmd[index].ch;
	diag_smd_buffer_init(&driver->smd_cmd[index]);
	}

	pr_debug("diag: In %s, open SMD CMD port, Id = %d, r = %d\n",
		__func__, pdev->id, r);
@@ -1928,16 +1972,13 @@ static struct platform_driver diag_smd_lite_driver = {
	},
};

static struct platform_driver
		smd_lite_data_cmd_drivers[NUM_SMD_CMD_CHANNELS] = {
	{
		/* Modem data */
static struct platform_driver smd_lite_data_cmd_drivers = {

	.probe = diag_smd_cmd_probe,
	.driver = {
		.name = "DIAG_CMD",
		.owner = THIS_MODULE,
		.pm   = &diag_smd_dev_pm_ops,
		},
	}
};

@@ -2059,6 +2100,9 @@ int diag_smd_constructor(struct diag_smd_info *smd_info, int peripheral,
	case WCNSS_DATA:
		smd_info->peripheral_mask = DIAG_CON_WCNSS;
		break;
	case SENSORS_DATA:
		smd_info->peripheral_mask = DIAG_CON_SENSORS;
		break;
	default:
		pr_err("diag: In %s, unknown peripheral, peripheral: %d\n",
			__func__, peripheral);
@@ -2083,6 +2127,10 @@ int diag_smd_constructor(struct diag_smd_info *smd_info, int peripheral,
			smd_info->wq = create_singlethread_workqueue(
						"diag_wcnss_data_read_wq");
			break;
		case SENSORS_DATA:
			smd_info->wq = create_singlethread_workqueue(
						"diag_sensors_data_read_wq");
			break;
		default:
			smd_info->wq = NULL;
			break;
@@ -2345,10 +2393,8 @@ int diagfwd_init(void)
	platform_driver_register(&msm_smd_ch1_driver);
	platform_driver_register(&diag_smd_lite_driver);

	if (driver->supports_separate_cmdrsp) {
		for (i = 0; i < NUM_SMD_CMD_CHANNELS; i++)
			platform_driver_register(&smd_lite_data_cmd_drivers[i]);
	}
	if (driver->supports_separate_cmdrsp)
		platform_driver_register(&smd_lite_data_cmd_drivers);

	return 0;
err:
@@ -2393,11 +2439,10 @@ void diagfwd_exit(void)
	platform_driver_unregister(&diag_smd_lite_driver);

	if (driver->supports_separate_cmdrsp) {
		for (i = 0; i < NUM_SMD_CMD_CHANNELS; i++) {
		for (i = 0; i < NUM_SMD_CMD_CHANNELS; i++)
			diag_smd_destructor(&driver->smd_cmd[i]);
		platform_driver_unregister(
				&smd_lite_data_cmd_drivers[i]);
		}
			&smd_lite_data_cmd_drivers);
	}

	kfree(driver->encoded_rsp_buf);
+11 −6
Original line number Diff line number Diff line
@@ -885,19 +885,24 @@ static int diag_smd_cntl_probe(struct platform_device *pdev)

	/* open control ports only on 8960 & newer targets */
	if (chk_apps_only()) {
		if (pdev->id == SMD_APPS_MODEM) {
		switch (pdev->id) {
		case SMD_APPS_MODEM:
			index = MODEM_DATA;
			channel_name = "DIAG_CNTL";
		}
		else if (pdev->id == SMD_APPS_QDSP) {
			break;
		case SMD_APPS_QDSP:
			index = LPASS_DATA;
			channel_name = "DIAG_CNTL";
		}
		else if (pdev->id == SMD_APPS_WCNSS) {
			break;
		case SMD_APPS_WCNSS:
			index = WCNSS_DATA;
			channel_name = "APPS_RIVA_CTRL";
			break;
		case SMD_APPS_DSPS:
			index = SENSORS_DATA;
			channel_name = "DIAG_CNTL";
			break;
		}

		if (index != -1) {
			r = smd_named_open_on_edge(channel_name,
				pdev->id,