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

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

Merge "msm: ipa3: Driver changes to support ADPL over ODL functionality"

parents b9c4158d 8e9d7486
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -194,6 +194,8 @@ const char *ipa_clients_strings[IPA_CLIENT_MAX] = {
	__stringify(IPA_CLIENT_Q6_QBAP_STATUS_CONS),
	__stringify(RESERVERD_PROD_80),
	__stringify(IPA_CLIENT_MHI_DPL_CONS),
	__stringify(RESERVERD_PROD_82),
	__stringify(IPA_CLIENT_ODL_DPL_CONS),
};

/**
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ obj-$(CONFIG_IPA3) += ipat.o
ipat-y := ipa.o ipa_debugfs.o ipa_hdr.o ipa_flt.o ipa_rt.o ipa_dp.o ipa_client.o \
	ipa_utils.o ipa_nat.o ipa_intf.o teth_bridge.o ipa_interrupts.o \
	ipa_uc.o ipa_uc_wdi.o ipa_dma.o ipa_uc_mhi.o ipa_mhi.o ipa_uc_ntn.o \
	ipa_hw_stats.o ipa_pm.o ipa_wdi3_i.o
	ipa_hw_stats.o ipa_pm.o ipa_wdi3_i.o ipa_odl.o

ipat-$(CONFIG_IPA_EMULATION) += ipa_dt_replacement.o

+11 −1
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@

#define CREATE_TRACE_POINTS
#include "ipa_trace.h"
#include "ipa_odl.h"

/*
 * The following for adding code (ie. for EMULATION) not found on x86.
@@ -5510,6 +5511,16 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
	IPADBG("ipa cdev added successful. major:%d minor:%d\n",
			MAJOR(ipa3_ctx->cdev.dev_num),
			MINOR(ipa3_ctx->cdev.dev_num));

	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_1) {
		result = ipa_odl_init();
		if (result) {
			IPADBG("Error: ODL init fialed\n");
			result = -ENODEV;
			goto fail_cdev_add;
		}
	}

	/*
	 * for IPA 4.0 offline charge is not needed and we need to prevent
	 * power collapse until IPA uC is loaded.
@@ -5519,7 +5530,6 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
	if (ipa3_ctx->ipa_hw_type != IPA_HW_v4_0)
		ipa3_proxy_clk_unvote();
	return 0;

fail_cdev_add:
fail_gsi_pre_fw_load_init:
	ipa3_dma_shutdown();
+26 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include "ipa_i.h"
#include "../ipa_rm_i.h"
#include "ipahal/ipahal_nat.h"
#include "ipa_odl.h"

#define IPA_MAX_ENTRY_STRING_LEN 500
#define IPA_MAX_MSG_LEN 4096
@@ -1137,6 +1138,27 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf,
	return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, cnt);
}

static ssize_t ipa3_read_odlstats(struct file *file, char __user *ubuf,
		size_t count, loff_t *ppos)
{
	int nbytes;
	int cnt = 0;

	nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN,
			"ODL received pkt =%u\n"
			"ODL processed pkt to DIAG=%u\n"
			"ODL dropped pkt =%u\n"
			"ODL packet in queue  =%u\n",
			ipa3_odl_ctx->stats.odl_rx_pkt,
			ipa3_odl_ctx->stats.odl_tx_diag_pkt,
			ipa3_odl_ctx->stats.odl_drop_pkt,
			ipa3_odl_ctx->stats.numer_in_queue);

	cnt += nbytes;

	return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, cnt);
}

static ssize_t ipa3_read_wstats(struct file *file, char __user *ubuf,
		size_t count, loff_t *ppos)
{
@@ -2181,6 +2203,10 @@ static const struct ipa3_debugfs_file debugfs_files[] = {
		"wstats", IPA_READ_ONLY_MODE, NULL, {
			.read = ipa3_read_wstats,
		}
	}, {
		"odlstats", IPA_READ_ONLY_MODE, NULL, {
			.read = ipa3_read_odlstats,
		}
	}, {
		"wdi", IPA_READ_ONLY_MODE, NULL, {
			.read = ipa3_read_wdi,
+35 −0
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@
#define IPA_ODU_RX_BUFF_SZ 2048
#define IPA_ODU_RX_POOL_SZ 64

#define IPA_ODL_RX_BUFF_SZ (16 * 1024)

#define IPA_GSI_MAX_CH_LOW_WEIGHT 15
#define IPA_GSI_EVT_RING_INT_MODT (16) /* 0.5ms under 32KHz clock */
#define IPA_GSI_EVT_RING_INT_MODC (20)
@@ -2861,6 +2863,17 @@ static int ipa3_odu_rx_pyld_hdlr(struct sk_buff *rx_skb,
	return 0;
}

static int ipa3_odl_dpl_rx_pyld_hdlr(struct sk_buff *rx_skb,
	struct ipa3_sys_context *sys)
{
	if (WARN(!sys->ep->client_notify, "sys->ep->client_notify is NULL\n"))
		dev_kfree_skb_any(rx_skb);
	else
		sys->ep->client_notify(sys->ep->priv, IPA_RECEIVE,
			(unsigned long)(rx_skb));

	return 0;
}
static void ipa3_free_rx_wrapper(struct ipa3_rx_pkt_wrapper *rk_pkt)
{
	kmem_cache_free(ipa3_ctx->rx_pkt_wrapper_cache, rk_pkt);
@@ -3051,6 +3064,26 @@ static int ipa3_assign_policy(struct ipa_sys_connect_params *in,
				in->client);

			sys->policy = IPA_POLICY_NOINTR_MODE;
		}  else if (in->client == IPA_CLIENT_ODL_DPL_CONS) {
			IPADBG("assigning policy to ODL client:%d\n",
				in->client);
			sys->ep->status.status_en = true;
			sys->policy = IPA_POLICY_INTR_POLL_MODE;
			INIT_WORK(&sys->work, ipa3_wq_handle_rx);
			INIT_DELAYED_WORK(&sys->switch_to_intr_work,
				ipa3_switch_to_intr_rx_work_func);
			INIT_DELAYED_WORK(&sys->replenish_rx_work,
				ipa3_replenish_rx_work_func);
			atomic_set(&sys->curr_polling_state, 0);
			sys->rx_buff_sz =
				IPA_GENERIC_RX_BUFF_SZ(IPA_ODL_RX_BUFF_SZ);
			sys->pyld_hdlr = ipa3_odl_dpl_rx_pyld_hdlr;
			sys->get_skb = ipa3_get_skb_ipa_rx;
			sys->free_skb = ipa3_free_skb_rx;
			sys->free_rx_wrapper = ipa3_recycle_rx_wrapper;
			sys->repl_hdlr = ipa3_replenish_rx_cache_recycle;
			sys->rx_pool_sz = in->desc_fifo_sz /
					IPA_FIFO_ELEMENT_SIZE - 1;
		} else {
			WARN(1, "Need to install a RX pipe hdlr\n");
			return -EINVAL;
@@ -3520,8 +3553,10 @@ static void ipa_gsi_irq_rx_notify_cb(struct gsi_chan_xfer_notify *notify)
	IPADBG_LOW("event %d notified\n", notify->evt_id);

	sys = (struct ipa3_sys_context *)notify->chan_user_data;
	spin_lock_bh(&sys->spinlock);
	rx_pkt_expected = list_first_entry(&sys->head_desc_list,
					   struct ipa3_rx_pkt_wrapper, link);
	spin_unlock_bh(&sys->spinlock);
	rx_pkt_rcvd = (struct ipa3_rx_pkt_wrapper *)notify->xfer_user_data;

	if (rx_pkt_expected != rx_pkt_rcvd) {
Loading