msm: msm_bus: Integrate external APIs

Add functionality to clean up commit list of BCM after a new request
comes through. Removes BCMs that have an updated BW request of zero
AB and IB for both ACTIVE and DUAL contexts.Integrate command db APIs
which fetches BCM specific address offsets and aux data including width,
clock domain, unit size from a preset data blob. Data is then used to
generate TCS and AMC command sets sent to RPMH. Integrate RPMH APIs used
to communicate with BCM Hardware. Register for apps_rsc mailbox and sends
commands over the mailbox framework through RPMH helper functions.
Commands are sent in three batches for each update request
and consists of active, awake and sleep sets.

Change-Id: I795f4dbd52d066715fd97e2618576425af72f5e8
Signed-off-by: David Dai <daidavid1@codeaurora.org>
diff --git a/drivers/soc/qcom/msm_bus/msm_bus_arb_rpmh.c b/drivers/soc/qcom/msm_bus/msm_bus_arb_rpmh.c
index 9c86403..8cd2fd6 100644
--- a/drivers/soc/qcom/msm_bus/msm_bus_arb_rpmh.c
+++ b/drivers/soc/qcom/msm_bus/msm_bus_arb_rpmh.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -510,7 +510,7 @@
 
 		bcm_dev->lnode_list[lnode_idx].lnode_ab[ctx] =
 			msm_bus_div64(cur_dev->node_info->agg_params.buswidth,
-					cur_dev->node_bw[ctx].max_ab *
+					cur_dev->node_bw[ctx].sum_ab *
 					(uint64_t)bcm_dev->bcmdev->width);
 
 		for (i = 0; i < bcm_dev->num_lnodes; i++) {
@@ -556,9 +556,6 @@
 	if (!bcm_dev->node_info->is_bcm_dev)
 		goto exit_bcm_remove_handoff_req;
 
-	bcm_dev->bcmdev->init_ab = 0;
-	bcm_dev->bcmdev->init_ib = 0;
-
 	for (i = 0; i < bcm_dev->num_lnodes; i++) {
 		max_ib = max(max_ib,
 				bcm_dev->lnode_list[i].lnode_ib[0]);
@@ -893,8 +890,6 @@
 		curr = 0;
 	}
 
-	MSM_BUS_DBG("%s: Unregistering client %p", __func__, client);
-
 	for (i = 0; i < pdata->usecase->num_paths; i++) {
 		src = client->pdata->usecase[curr].vectors[i].src;
 		dest = client->pdata->usecase[curr].vectors[i].dst;
@@ -1110,6 +1105,8 @@
 		} else {
 			slp_clk = req_clk;
 			slp_bw = req_bw;
+			req_clk = 0;
+			req_bw = 0;
 		}
 
 		ret = update_path(src_dev, dest, req_clk, req_bw, slp_clk,
@@ -1371,6 +1368,7 @@
 	commit_data();
 	msm_bus_dbg_remove_client(cl);
 	kfree(cl);
+	MSM_BUS_DBG("%s: Unregistered client", __func__);
 exit_unregister_client:
 	rt_mutex_unlock(&msm_bus_adhoc_lock);
 }