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

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

Merge "diag: Proper Update of the PD packet buffer status and length"

parents b42a5cc3 930498cd
Loading
Loading
Loading
Loading
+44 −18
Original line number Diff line number Diff line
@@ -500,15 +500,29 @@ static void diagfwd_data_read_untag_done(struct diagfwd_info *fwd_info,
			temp_buf_main += (buf_len + 4);
			processed += buf_len;
		}
		if (peripheral == PERIPHERAL_LPASS &&
			fwd_info->type == TYPE_DATA && len_upd_2) {

		if (flag_buf_1) {
			fwd_info->cpd_len_1 = len_cpd;
			if (fwd_info->type == TYPE_DATA)
				fwd_info->upd_len_1_a = len_upd_1;
			if (peripheral == PERIPHERAL_LPASS &&
				fwd_info->type == TYPE_DATA)
				fwd_info->upd_len_2_a = len_upd_2;
				temp_ptr_upd = fwd_info->buf_upd_2_a;
			} else {
		} else if (flag_buf_2) {
			fwd_info->cpd_len_2 = len_cpd;
			if (fwd_info->type == TYPE_DATA)
				fwd_info->upd_len_1_b = len_upd_1;
			if (peripheral == PERIPHERAL_LPASS &&
				fwd_info->type == TYPE_DATA)
				fwd_info->upd_len_2_b = len_upd_2;
				temp_ptr_upd = fwd_info->buf_upd_2_b;
		}

		if (peripheral == PERIPHERAL_LPASS &&
			fwd_info->type == TYPE_DATA && len_upd_2) {
			if (flag_buf_1)
				temp_ptr_upd = fwd_info->buf_upd_2_a;
			else
				temp_ptr_upd = fwd_info->buf_upd_2_b;
			temp_ptr_upd->ctxt &= 0x00FFFFFF;
			temp_ptr_upd->ctxt |=
				(SET_PD_CTXT(ctxt_upd_2));
@@ -522,15 +536,10 @@ static void diagfwd_data_read_untag_done(struct diagfwd_info *fwd_info,
				fwd_info->upd_len_2_b = 0;
		}
		if (fwd_info->type == TYPE_DATA && len_upd_1) {
			if (flag_buf_1) {
				fwd_info->upd_len_1_a =
					len_upd_1;
			if (flag_buf_1)
				temp_ptr_upd = fwd_info->buf_upd_1_a;
			} else {
				fwd_info->upd_len_1_b =
					len_upd_1;
			else
				temp_ptr_upd = fwd_info->buf_upd_1_b;
			}
			temp_ptr_upd->ctxt &= 0x00FFFFFF;
			temp_ptr_upd->ctxt |=
				(SET_PD_CTXT(ctxt_upd_1));
@@ -544,10 +553,6 @@ static void diagfwd_data_read_untag_done(struct diagfwd_info *fwd_info,
				fwd_info->upd_len_1_b = 0;
		}
		if (len_cpd) {
			if (flag_buf_1)
				fwd_info->cpd_len_1 = len_cpd;
			else
				fwd_info->cpd_len_2 = len_cpd;
			temp_ptr_cpd->ctxt &= 0x00FFFFFF;
			temp_ptr_cpd->ctxt |=
				(SET_PD_CTXT(ctxt_cpd));
@@ -1332,12 +1337,33 @@ void diagfwd_write_done(uint8_t peripheral, uint8_t type, int ctxt)

	if (ctxt == 1 && fwd_info->buf_1) {
		/* Buffer 1 for core PD is freed */
		atomic_set(&fwd_info->buf_1->in_busy, 0);
		fwd_info->cpd_len_1 = 0;

		if (peripheral == PERIPHERAL_LPASS) {
			if (!fwd_info->upd_len_1_a &&
				!fwd_info->upd_len_2_a)
				atomic_set(&fwd_info->buf_1->in_busy, 0);
		} else if (peripheral == PERIPHERAL_MODEM) {
			if (!fwd_info->upd_len_1_a)
				atomic_set(&fwd_info->buf_1->in_busy, 0);
		} else {
			atomic_set(&fwd_info->buf_1->in_busy, 0);
		}
	} else if (ctxt == 2 && fwd_info->buf_2) {
		/* Buffer 2 for core PD is freed */
		atomic_set(&fwd_info->buf_2->in_busy, 0);
		fwd_info->cpd_len_2 = 0;

		if (peripheral == PERIPHERAL_LPASS) {
			if (!fwd_info->upd_len_1_b &&
				!fwd_info->upd_len_2_b)
				atomic_set(&fwd_info->buf_2->in_busy, 0);
		} else if (peripheral == PERIPHERAL_MODEM) {
			if (!fwd_info->upd_len_1_b)
				atomic_set(&fwd_info->buf_2->in_busy, 0);
		} else {
			atomic_set(&fwd_info->buf_2->in_busy, 0);
		}

	} else if (ctxt == 3 && fwd_info->buf_upd_1_a) {
		/* Buffer 1 for user pd 1  is freed */
		atomic_set(&fwd_info->buf_upd_1_a->in_busy, 0);