}
EXPORT_SYMBOL_GPL(regulator_get_exclusive);
- /* Locks held by regulator_put() */
+/**
+ * regulator_get_optional - obtain optional access to a regulator.
+ * @dev: device for regulator "consumer"
+ * @id: Supply name or regulator ID.
+ *
+ * Returns a struct regulator corresponding to the regulator producer,
+ * or IS_ERR() condition containing errno. Other consumers will be
+ * unable to obtain this reference is held and the use count for the
+ * regulator will be initialised to reflect the current state of the
+ * regulator.
+ *
+ * This is intended for use by consumers for devices which can have
+ * some supplies unconnected in normal use, such as some MMC devices.
+ * It can allow the regulator core to provide stub supplies for other
+ * supplies requested using normal regulator_get() calls without
+ * disrupting the operation of drivers that can handle absent
+ * supplies.
+ *
+ * Use of supply names configured via regulator_set_device_supply() is
+ * strongly encouraged. It is recommended that the supply name used
+ * should match the name used for the supply and/or the relevant
+ * device pins in the datasheet.
+ */
+struct regulator *regulator_get_optional(struct device *dev, const char *id)
+{
+ return _regulator_get(dev, id, 0);
+}
+EXPORT_SYMBOL_GPL(regulator_get_optional);
+
+ /* regulator_list_mutex lock held by regulator_put() */
static void _regulator_put(struct regulator *regulator)
{
struct regulator_dev *rdev;
if (data->heaps[i].size == 0)
continue;
- if (data->heaps[i].base == 0) {
+ if (data->heaps[i].id==ION_CMA_HEAP_ID) {
+ struct device *dev = (struct device*)data->heaps[i].priv;
+ int ret = dma_declare_contiguous(dev,
+ data->heaps[i].size,
+ data->heaps[i].base,
+ MEMBLOCK_ALLOC_ANYWHERE);
+ if (ret) {
+ pr_err("%s: dma_declare_contiguous failed %d\n",
+ __func__, ret);
+ continue;
+ };
+ data->heaps[i].base = PFN_PHYS(dev_get_cma_area(dev)->base_pfn);
+ } else if (data->heaps[i].base == 0) {
phys_addr_t paddr;
+
paddr = memblock_alloc_base(data->heaps[i].size,
data->heaps[i].align,
MEMBLOCK_ALLOC_ANYWHERE);