blob: 9b378ce7ed599a35a3e5dc98ef0f64df3a576d40 [file] [log] [blame]
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* SoC-specific function headers.
*
* Copyright (C) 2023 Google LLC
*/
#ifndef __MOBILE_SOC_H__
#define __MOBILE_SOC_H__
#include "gxp-internal.h"
#include "gxp-pm.h"
/**
* gxp_soc_init() - Initialization function for SoC-dependent code.
* @gxp: The GXP device to be initialized.
*
* This function is used to initialize SoC-dependent functions and data structure.
* gxp->soc_data should be allocated here.
*/
int gxp_soc_init(struct gxp_dev *gxp);
/**
* gxp_soc_exit() - Cleans up resources allocated in gxp_soc_init().
* @gxp: The GXP device to be initialized.
*/
void gxp_soc_exit(struct gxp_dev *gxp);
/**
* gxp_soc_pm_init() - Initializes the pm requests.
* @gxp: The GXP device which is the container of target pm.
*
* The function should be called only once after allocation.
*/
void gxp_soc_pm_init(struct gxp_dev *gxp);
/**
* gxp_soc_pm_exit() - Finalizess the pm requests.
* @gxp: The GXP device which is the container of target pm.
*
* The function should be called only once before destroy.
*/
void gxp_soc_pm_exit(struct gxp_dev *gxp);
/**
* gxp_soc_pm_set_request() - Updates the pm requests.
* @gxp: The GXP device which is the container of target pm.
* @value: A 64-bit encoded value.
*/
void gxp_soc_pm_set_request(struct gxp_dev *gxp, u64 value);
/**
* gxp_soc_pm_get_request() - Retrieves the pm requests.
* @gxp: The GXP device which is the container of target pm.
*/
u64 gxp_soc_pm_get_request(struct gxp_dev *gxp);
/**
* gxp_soc_pm_reset() - Resets the pm requests.
* @gxp: The GXP device which is the container of target pm.
*
* This functions resets the pm status as just initialized.
*/
void gxp_soc_pm_reset(struct gxp_dev *gxp);
/* The set function of pm rate. */
int gxp_soc_pm_set_rate(unsigned int id, unsigned long rate);
/* The get function of pm rate. */
unsigned long gxp_soc_pm_get_rate(unsigned int id, unsigned long dbg_val);
/**
* gxp_soc_set_pm_arg_from_state() - Set gxp_req_pm_qos_work according to the given state.
* @work: The work object to be set.
* @state: The target state to be set to.
*/
void gxp_soc_set_pm_arg_from_state(struct gxp_req_pm_qos_work *work,
enum aur_memory_power_state state);
/**
* gxp_soc_activate_context() - Assigns cores to PASIDs.
* @gxp: The GXP device to check the run mode.
* @gdomain: The IOMMU domain that contains PASID.
* @core_list: The physical cores to be assigned.
*/
void gxp_soc_activate_context(struct gxp_dev *gxp, struct gcip_iommu_domain *gdomain,
uint core_list);
/**
* gxp_soc_deactivate_context() - Unassigns cores to PASIDs.
* @gxp: The GXP device to check the run mode.
* @gdomain: The IOMMU domain that contains PASID.
* @core_list: The physical cores to be assigned.
*/
void gxp_soc_deactivate_context(struct gxp_dev *gxp, struct gcip_iommu_domain *gdomain,
uint core_list);
/**
* gxp_soc_set_iremap_context() - Set context for MCU accesses through remap region.
* @gxp: The GXP device to set context for.
*/
void gxp_soc_set_iremap_context(struct gxp_dev *gxp);
/**
* gxp_soc_lpm_init() - Initialize and prepare TOP PSM
* @gxp: The GXP device to set TOP PSM for.
*/
void gxp_soc_lpm_init(struct gxp_dev *gxp);
/**
* gxp_soc_lpm_destroy() - Deinit TOP PSM
* @gxp: The GXP device to set TOP PSM for.
*/
void gxp_soc_lpm_destroy(struct gxp_dev *gxp);
#endif /* __MOBILE_SOC_H__ */