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

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

Merge "diag: Add MDM SSR support"

parents 60638232 aa4c891d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -65,4 +65,5 @@ int diag_mux_close_peripheral(int proc, uint8_t peripheral);
int diag_mux_open_all(struct diag_logger_t *logger);
int diag_mux_close_all(void);
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
@@ -195,16 +195,21 @@ 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;
}

void diag_remote_dev_close(int 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
@@ -19,11 +19,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)
{
@@ -42,7 +41,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)
@@ -66,7 +67,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)
@@ -97,9 +98,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;
@@ -113,7 +114,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] ||
@@ -171,7 +175,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)