/* Copyright (c) 2012, Code Aurora Forum. 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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __ARCH_ARM_MACH_MSM_LPM_RESOURCES_H
#define __ARCH_ARM_MACH_MSM_LPM_RESOURCES_H

#include "pm.h"

enum {
	MSM_LPM_PXO_OFF = 0,
	MSM_LPM_PXO_ON = 1,
};

enum {
	MSM_LPM_L2_CACHE_HSFS_OPEN = 0,
	MSM_LPM_L2_CACHE_GDHS = 1,
	MSM_LPM_L2_CACHE_RETENTION = 2,
	MSM_LPM_L2_CACHE_ACTIVE = 3,
};

struct msm_rpmrs_limits {
	uint32_t pxo;
	uint32_t l2_cache;
	uint32_t vdd_mem_upper_bound;
	uint32_t vdd_mem_lower_bound;
	uint32_t vdd_dig_upper_bound;
	uint32_t vdd_dig_lower_bound;

	uint32_t latency_us[NR_CPUS];
	uint32_t power[NR_CPUS];
};

struct msm_rpmrs_level {
	enum msm_pm_sleep_mode sleep_mode;
	struct msm_rpmrs_limits rs_limits;
	bool available;
	uint32_t latency_us;
	uint32_t steady_state_power;
	uint32_t energy_overhead;
	uint32_t time_overhead_us;
};

#ifdef CONFIG_MSM_RPM_SMD

/**
 * msm_lpm_level_beyond_limit() - Check if the resources in a low power level
 * is beyond the limits of the driver votes received for those resources.This
 * function is used by lpm_levels to eliminate any low power level that cannot
 * be entered.
 *
 * @limits: pointer to the resource limits of a low power level.
 *
 * returns true if the resource limits are beyond driver resource votes.
 * false otherwise.
 */
bool msm_lpm_level_beyond_limit(struct msm_rpmrs_limits *limits);

/**
 * msm_lpmrs_enter_sleep() - Enter sleep flushes the sleep votes of low power
 * resources to the RPM driver, also configure the MPM if needed depending
 * on the low power mode being entered. L2 low power mode is also set in
 * this function.

 * @sclk_count: wakeup counter for RPM.
 * @limits: pointer to the resource limits of the low power mode being entered.
 * @from_idle: bool to determine if this call being made as a part of
 *             idle power collapse.
 * @notify_rpm: bool that informs if this is an RPM notified power collapse.
 *
 * returns 0 on success.
 */
int msm_lpmrs_enter_sleep(uint32_t sclk_count, struct msm_rpmrs_limits *limits,
	bool from_idle, bool notify_rpm);

/**
 * msm_lpmrs_exit_sleep() - Exit sleep, reset the MPM and L2 mode.
 * @ limits: pointer to resource limits of the most recent low power mode.
 * @from_idle: bool to determine if this call being made as a part of
 *             idle power collapse.
 * @notify_rpm: bool that informs if this is an RPM notified power collapse.
 * @collapsed: bool that informs if the Krait was power collapsed.
 */
void msm_lpmrs_exit_sleep(struct msm_rpmrs_limits *limits,
	bool from_idle, bool notify_rpm, bool collapsed);
/**
 * msm_lpmrs_module_init() - Init function that parses the device tree to
 * get the low power resource attributes and registers with RPM driver for
 * callback notification.
 *
 * returns 0 on success.
 */
int __init msm_lpmrs_module_init(void);

#else
static inline bool msm_lpm_level_beyond_limit(struct msm_rpmrs_limits *limits)
{
	return true;
}

static inline int msm_lpmrs_enter_sleep(uint32_t sclk_count,
	struct msm_rpmrs_limits *limits, bool from_idle, bool notify_rpm)
{
	return 0;
}

static inline void msm_lpmrs_exit_sleep(struct msm_rpmrs_limits *limits,
	bool from_idle, bool notify_rpm, bool collapsed)
{
	return;
}

static inline int __init msm_lpmrs_module_init(void)
{
	return 0;
}
#endif /* CONFIG_MSM_RPM_SMD */

#endif
