int soc_change_memory_power(u64 start, u64 size, int change)
{
	int i = 0;
	int mask = default_mask;
	u64 end = start + size;
	int start_region = 0;
	int end_region = 0;

	if (change != STATE_ACTIVE && change != STATE_POWER_DOWN) {
		pr_info("requested state transition invalid\n");
		return 0;
	}
	
	for (i = 0; i < nr_mem_regions; i++) {
		if (mem_regions[i].start <= start &&
			mem_regions[i].start >=
			mem_regions[start_region].start) {
			start_region = i;
		}
		if (end <= mem_regions[i].start + mem_regions[i].size) {
			end_region = i;
			break;
		}
	}

	
	for (i = start_region; i <= end_region; i++)
		mask &= ~(0x1 << i);

	if (!switch_memory_state(mask, change, start_region, end_region))
		return size;
	else
		return 0;
}
/* The hotplug code expects the number of bytes that switched state successfully
 * as the return value, so a return value of zero indicates an error
*/
int soc_change_memory_power(u64 start, u64 size, int change)
{

	int i = 0;
	int match = 0;

	/* Find the memory region starting just below start */
	for (i = 0; i < nr_mem_regions; i++) {
		if (mem_regions[i].start <= start &&
			mem_regions[i].start >= mem_regions[match].start) {
				match = i;
		}
	}

	if (start + size > mem_regions[match].start + mem_regions[match].size) {
		pr_info("passed size exceeds size of memory bank\n");
		return 0;
	}

	if (change != STATE_ACTIVE && change != STATE_POWER_DOWN) {
		pr_info("requested state transition invalid\n");
		return 0;
	}

	if (!switch_memory_state(match, change))
		return size;
	else
		return 0;
}