pmem: ensure SMI correctness

Due to hardware constraints, the SMI should not be mapped
in the kernel space when not in use. Unmap the SMI from
the kernel address space when the last allocation is freed.
Vote for bus bandwidth as well while the SMI is allocated.

CRs-Fixed: 281723
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
diff --git a/include/linux/android_pmem.h b/include/linux/android_pmem.h
index 91f8f1b..c029196 100644
--- a/include/linux/android_pmem.h
+++ b/include/linux/android_pmem.h
@@ -153,6 +153,24 @@
 	unsigned buffered;
 	/* which memory type (i.e. SMI, EBI1) this PMEM device is backed by */
 	unsigned memory_type;
+	/*
+	 * function to be called when the number of allocations goes from
+	 * 0 -> 1
+	 */
+	void (*request_region)(void *);
+	/*
+	 * function to be called when the number of allocations goes from
+	 * 1 -> 0
+	 */
+	void (*release_region)(void *);
+	/*
+	 * function to be called upon pmem registration
+	 */
+	void *(*setup_region)(void);
+	/*
+	 * indicates that this region should be mapped/unmaped as needed
+	 */
+	int map_on_demand;
 };
 
 int pmem_setup(struct android_pmem_platform_data *pdata,