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

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

Merge "diag: Add MDM SSR support"

parents 42ab3fc2 711f3b76
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -78,4 +78,5 @@ int diag_mux_close_all(void);
int diag_pcie_register_ops(int proc, int ctx, struct diag_mux_ops *ops);
int diag_usb_register_ops(int proc, int ctx, struct diag_mux_ops *ops);
int diag_mux_switch_logging(int proc, int *new_mode, int *peripheral_mask);
void diag_notify_md_client(uint8_t proc, uint8_t peripheral, int data);
#endif
+7 −2
Original line number Diff line number Diff line
@@ -168,10 +168,12 @@ int diag_remote_dev_open(int id)
	if (id < 0 || id >= NUM_REMOTE_DEV)
		return -EINVAL;
	bridge_info[id].inited = 1;
	if (bridge_info[id].type == DIAG_DATA_TYPE)
	if (bridge_info[id].type == DIAG_DATA_TYPE) {
		diag_notify_md_client(BRIDGE_TO_MUX(id), 0, DIAG_STATUS_OPEN);
		return diag_mux_queue_read(BRIDGE_TO_MUX(id));
	else if (bridge_info[id].type == DIAG_DCI_TYPE)
	} else if (bridge_info[id].type == DIAG_DCI_TYPE) {
		return diag_dci_send_handshake_pkt(bridge_info[id].id);
	}

	return 0;
}
@@ -184,6 +186,9 @@ void diag_remote_dev_close(int id)

	diag_mux_close_device(BRIDGE_TO_MUX(id));

	if (bridge_info[id].type == DIAG_DATA_TYPE)
		diag_notify_md_client(BRIDGE_TO_MUX(id), 0, DIAG_STATUS_CLOSED);

}

int diag_remote_dev_read_done(int id, unsigned char *buf, int len)
+12 −8
Original line number Diff line number Diff line
@@ -27,11 +27,10 @@
#include "diag_mux.h"

#define FEATURE_SUPPORTED(x)	((feature_mask << (i * 8)) & (1 << x))

#define DIAG_GET_MD_DEVICE_SIG_MASK(proc) (0x100000 * (1 << proc))
/* tracks which peripheral is undergoing SSR */
static uint16_t reg_dirty[NUM_PERIPHERALS];
static uint8_t diag_id = DIAG_ID_APPS;
static void diag_notify_md_client(uint8_t peripheral, int data);

static void diag_mask_update_work_fn(struct work_struct *work)
{
@@ -50,7 +49,9 @@ void diag_cntl_channel_open(struct diagfwd_info *p_info)
		return;
	driver->mask_update |= PERIPHERAL_MASK(p_info->peripheral);
	queue_work(driver->cntl_wq, &driver->mask_update_work);
	diag_notify_md_client(p_info->peripheral, DIAG_STATUS_OPEN);
	diag_notify_md_client(DIAG_LOCAL_PROC, p_info->peripheral,
				DIAG_STATUS_OPEN);

}

void diag_cntl_channel_close(struct diagfwd_info *p_info)
@@ -74,7 +75,7 @@ void diag_cntl_channel_close(struct diagfwd_info *p_info)
	driver->stm_state[peripheral] = DISABLE_STM;
	driver->stm_state_requested[peripheral] = DISABLE_STM;
	reg_dirty[peripheral] = 0;
	diag_notify_md_client(peripheral, DIAG_STATUS_CLOSED);
	diag_notify_md_client(DIAG_LOCAL_PROC, peripheral, DIAG_STATUS_CLOSED);
}

static void diag_stm_update_work_fn(struct work_struct *work)
@@ -105,9 +106,9 @@ static void diag_stm_update_work_fn(struct work_struct *work)
	}
}

void diag_notify_md_client(uint8_t peripheral, int data)
void diag_notify_md_client(uint8_t proc, uint8_t peripheral, int data)
{
	int stat = 0, proc = DIAG_LOCAL_PROC;
	int stat = 0;
	struct siginfo info;
	struct pid *pid_struct;
	struct task_struct *result;
@@ -121,7 +122,10 @@ void diag_notify_md_client(uint8_t peripheral, int data)
	mutex_lock(&driver->md_session_lock);
	memset(&info, 0, sizeof(struct siginfo));
	info.si_code = SI_QUEUE;
	info.si_int = (PERIPHERAL_MASK(peripheral) | data);
	info.si_int = (DIAG_GET_MD_DEVICE_SIG_MASK(proc) | data);
	if (proc == DIAG_LOCAL_PROC)
		info.si_int = info.si_int |
				(PERIPHERAL_MASK(peripheral) | data);
	info.si_signo = SIGCONT;

	if (!driver->md_session_map[proc][peripheral] ||
@@ -179,7 +183,7 @@ static void process_pd_status(uint8_t *buf, uint32_t len,
	pd_msg = (struct diag_ctrl_msg_pd_status *)buf;
	pd = pd_msg->pd_id;
	status = (pd_msg->status == 0) ? DIAG_STATUS_OPEN : DIAG_STATUS_CLOSED;
	diag_notify_md_client(peripheral, status);
	diag_notify_md_client(DIAG_LOCAL_PROC, peripheral, status);
}

static void enable_stm_feature(uint8_t peripheral)