mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
msm: kgsl: Add Battery Current Limiting support for A6xx
Battery Current Limiting (BCL) prevents voltage droops and peak currents on battery packs preventing under voltage lockout and over current. Change-Id: Ie6c3753bbe21a801b9c6ee1ac9aec03c0de156b7 Signed-off-by: Mohammed Mirza Mandayappurath Manzoor <mmandaya@codeaurora.org>
This commit is contained in:
parent
6c24075f63
commit
b66758eeb9
4 changed files with 40 additions and 0 deletions
|
|
@ -109,6 +109,8 @@
|
|||
#define ADRENO_DEPRECATED BIT(19)
|
||||
/* The target supports ringbuffer level APRIV */
|
||||
#define ADRENO_APRIV BIT(20)
|
||||
/* The GMU supports Battery Current Limiting */
|
||||
#define ADRENO_BCL BIT(21)
|
||||
/*
|
||||
* Adreno GPU quirks - control bits for various workarounds
|
||||
*/
|
||||
|
|
@ -528,6 +530,8 @@ struct adreno_device {
|
|||
bool throttling_enabled;
|
||||
/** @sptp_pc_enabled: True if SPTP power collapse is enabled on a5xx */
|
||||
bool sptp_pc_enabled;
|
||||
/** @bcl_enabled: True if BCL is enabled */
|
||||
bool bcl_enabled;
|
||||
struct kgsl_memdesc *profile_buffer;
|
||||
unsigned int profile_index;
|
||||
struct kgsl_memdesc *pwrup_reglist;
|
||||
|
|
|
|||
|
|
@ -2627,6 +2627,9 @@ static int a6xx_gmu_probe(struct kgsl_device *device,
|
|||
else
|
||||
gmu->idle_level = GPU_HW_ACTIVE;
|
||||
|
||||
if (ADRENO_FEATURE(adreno_dev, ADRENO_BCL))
|
||||
adreno_dev->bcl_enabled = true;
|
||||
|
||||
a6xx_gmu_acd_probe(device, gmu, pdev->dev.of_node);
|
||||
|
||||
set_bit(GMU_ENABLED, &device->gmu_core.flags);
|
||||
|
|
|
|||
|
|
@ -635,6 +635,18 @@ static int a6xx_hfi_verify_fw_version(struct adreno_device *adreno_dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int a6xx_hfi_send_bcl_feature_ctrl(struct adreno_device *adreno_dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!adreno_dev->bcl_enabled)
|
||||
return 0;
|
||||
|
||||
ret = a6xx_hfi_send_feature_ctrl(adreno_dev, HFI_FEATURE_BCL, 1, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int a6xx_hfi_send_lm_feature_ctrl(struct adreno_device *adreno_dev)
|
||||
{
|
||||
struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
|
||||
|
|
@ -739,6 +751,10 @@ int a6xx_hfi_start(struct adreno_device *adreno_dev)
|
|||
if (result)
|
||||
goto err;
|
||||
|
||||
result = a6xx_hfi_send_bcl_feature_ctrl(adreno_dev);
|
||||
if (result)
|
||||
goto err;
|
||||
|
||||
result = a6xx_hfi_send_core_fw_start(adreno_dev);
|
||||
if (result)
|
||||
goto err;
|
||||
|
|
|
|||
|
|
@ -264,6 +264,21 @@ static int _acd_store(struct adreno_device *adreno_dev, bool val)
|
|||
return gmu_core_dev_acd_set(KGSL_DEVICE(adreno_dev), val);
|
||||
}
|
||||
|
||||
static bool _bcl_show(struct adreno_device *adreno_dev)
|
||||
{
|
||||
return adreno_dev->bcl_enabled;
|
||||
}
|
||||
|
||||
static int _bcl_store(struct adreno_device *adreno_dev, bool val)
|
||||
{
|
||||
if (!ADRENO_FEATURE(adreno_dev, ADRENO_BCL) ||
|
||||
adreno_dev->bcl_enabled == val)
|
||||
return 0;
|
||||
|
||||
return adreno_power_cycle_bool(adreno_dev, &adreno_dev->bcl_enabled,
|
||||
val);
|
||||
}
|
||||
|
||||
static ssize_t _sysfs_store_u32(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
|
|
@ -376,6 +391,7 @@ static ADRENO_SYSFS_BOOL(throttling);
|
|||
static ADRENO_SYSFS_BOOL(ifpc);
|
||||
static ADRENO_SYSFS_RO_U32(ifpc_count);
|
||||
static ADRENO_SYSFS_BOOL(acd);
|
||||
static ADRENO_SYSFS_BOOL(bcl);
|
||||
|
||||
|
||||
static const struct attribute *_attr_list[] = {
|
||||
|
|
@ -399,6 +415,7 @@ static const struct attribute *_attr_list[] = {
|
|||
&adreno_attr_ifpc_count.attr.attr,
|
||||
&adreno_attr_preempt_count.attr.attr,
|
||||
&adreno_attr_acd.attr.attr,
|
||||
&adreno_attr_bcl.attr.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue