Merge "regulator: cpr3-regulator: add support for custom aging allowed register"
This commit is contained in:
commit
3099c2e54c
5 changed files with 75 additions and 7 deletions
|
@ -35,13 +35,15 @@ Platform independent properties:
|
|||
- reg
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: Addresses and sizes for the memory of the CPR3 controller
|
||||
and the first fuse row
|
||||
Definition: Addresses and sizes for the memory of the CPR3 controller,
|
||||
the first fuse row, and optionally a register used to check
|
||||
if aging measurements are possible.
|
||||
|
||||
- reg-names
|
||||
Usage: required
|
||||
Value type: <stringlist>
|
||||
Definition: Address names. Must be "cpr_ctrl" and "fuse_base". Must be
|
||||
Definition: Address names. Must include "cpr_ctrl" and "fuse_base".
|
||||
"aging_allowed" may also be specified. The strings must be
|
||||
specified in the same order as the corresponding addresses
|
||||
are specified in the reg property.
|
||||
|
||||
|
@ -183,6 +185,17 @@ Platform independent properties:
|
|||
This is the voltage that vdd-supply must be set to when
|
||||
performing an aging measurement.
|
||||
|
||||
- qcom,cpr-aging-allowed-reg-mask
|
||||
Usage: required if "aging_allowed" register is specified
|
||||
Value type: <u32>
|
||||
Definition: Bitmask used to mask off the "aging_allowed" register.
|
||||
|
||||
- qcom,cpr-aging-allowed-reg-value
|
||||
Usage: required if "aging_allowed" register is specified
|
||||
Value type: <u32>
|
||||
Definition: Value required in the masked off "aging_allowed" register
|
||||
bits in order for a CPR aging measurement to be possible.
|
||||
|
||||
- qcom,cpr-panic-reg-addr-list
|
||||
Usage: optional
|
||||
Value type: <prop-encoded-array>
|
||||
|
|
|
@ -242,8 +242,8 @@ static const int msmcobalt_v2_mmss_fuse_ref_volt[MSM8996_MMSS_FUSE_CORNERS] = {
|
|||
|
||||
#define MSMCOBALT_MMSS_CPR_SENSOR_COUNT 35
|
||||
|
||||
#define MSMCOBALT_MMSS_AGING_SENSOR_ID 17
|
||||
#define MSMCOBALT_MMSS_AGING_BYPASS_MASK0 0
|
||||
#define MSMCOBALT_MMSS_AGING_SENSOR_ID 29
|
||||
#define MSMCOBALT_MMSS_AGING_BYPASS_MASK0 (GENMASK(23, 0))
|
||||
|
||||
#define MSMCOBALT_MMSS_MAX_TEMP_POINTS 3
|
||||
#define MSMCOBALT_MMSS_TEMP_SENSOR_ID_START 12
|
||||
|
|
|
@ -3523,7 +3523,7 @@ cleanup:
|
|||
|
||||
if (ctrl->ctrl_type == CPR_CTRL_TYPE_CPR4) {
|
||||
rc2 = cpr3_ctrl_clear_cpr4_config(ctrl);
|
||||
if (rc) {
|
||||
if (rc2) {
|
||||
cpr3_err(ctrl, "failed to clear CPR4 configuration,rc=%d\n",
|
||||
rc2);
|
||||
rc = rc2;
|
||||
|
@ -3725,6 +3725,17 @@ static int cpr3_regulator_aging_adjust(struct cpr3_controller *ctrl)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify that the aging possible register (if specified) has an
|
||||
* acceptable value.
|
||||
*/
|
||||
if (ctrl->aging_possible_reg) {
|
||||
reg = readl_relaxed(ctrl->aging_possible_reg);
|
||||
reg &= ctrl->aging_possible_mask;
|
||||
if (reg != ctrl->aging_possible_val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
restore_current_corner = kcalloc(vreg_count,
|
||||
sizeof(*restore_current_corner), GFP_KERNEL);
|
||||
restore_vreg_enabled = kcalloc(vreg_count,
|
||||
|
@ -3798,7 +3809,7 @@ static int cpr3_regulator_aging_adjust(struct cpr3_controller *ctrl)
|
|||
max_aging_volt = max(max_aging_volt, aging_volt);
|
||||
} else {
|
||||
cpr3_err(ctrl, "CPR aging measurement failed after %d tries, rc=%d\n",
|
||||
rc, CPR3_AGING_RETRY_COUNT);
|
||||
j, rc);
|
||||
ctrl->aging_failed = true;
|
||||
ctrl->aging_required = false;
|
||||
goto cleanup;
|
||||
|
@ -5992,6 +6003,21 @@ int cpr3_regulator_register(struct platform_device *pdev,
|
|||
}
|
||||
ctrl->cpr_ctrl_base = devm_ioremap(dev, res->start, resource_size(res));
|
||||
|
||||
if (ctrl->aging_possible_mask) {
|
||||
/*
|
||||
* Aging possible register address is required if an aging
|
||||
* possible mask has been specified.
|
||||
*/
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
||||
"aging_allowed");
|
||||
if (!res || !res->start) {
|
||||
cpr3_err(ctrl, "CPR aging allowed address is missing\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
ctrl->aging_possible_reg = devm_ioremap(dev, res->start,
|
||||
resource_size(res));
|
||||
}
|
||||
|
||||
if (ctrl->ctrl_type != CPR_CTRL_TYPE_CPRH) {
|
||||
ctrl->irq = platform_get_irq_byname(pdev, "cpr");
|
||||
if (ctrl->irq < 0) {
|
||||
|
|
|
@ -532,6 +532,9 @@ struct cpr3_panic_regs_info {
|
|||
* that this CPR3 controller manages.
|
||||
* @cpr_ctrl_base: Virtual address of the CPR3 controller base register
|
||||
* @fuse_base: Virtual address of fuse row 0
|
||||
* @aging_possible_reg: Virtual address of an optional platform-specific
|
||||
* register that must be ready to determine if it is
|
||||
* possible to perform an aging measurement.
|
||||
* @list: list head used in a global cpr3-regulator list so that
|
||||
* cpr3-regulator structs can be found easily in RAM dumps
|
||||
* @thread: Array of CPR3 threads managed by the CPR3 controller
|
||||
|
@ -671,6 +674,11 @@ struct cpr3_panic_regs_info {
|
|||
* @aging_sensor: Array of CPR3 aging sensors which are used to perform
|
||||
* aging measurements at a runtime.
|
||||
* @aging_sensor_count: Number of elements in the aging_sensor array
|
||||
* @aging_possible_mask: Optional bitmask used to mask off the
|
||||
* aging_possible_reg register.
|
||||
* @aging_possible_val: Optional value that the masked aging_possible_reg
|
||||
* register must have in order for a CPR aging measurement
|
||||
* to be possible.
|
||||
* @step_quot_fixed: Fixed step quotient value used for target quotient
|
||||
* adjustment if use_dynamic_step_quot is not set.
|
||||
* This parameter is only relevant for CPR4 controllers
|
||||
|
@ -721,6 +729,7 @@ struct cpr3_controller {
|
|||
int ctrl_id;
|
||||
void __iomem *cpr_ctrl_base;
|
||||
void __iomem *fuse_base;
|
||||
void __iomem *aging_possible_reg;
|
||||
struct list_head list;
|
||||
struct cpr3_thread *thread;
|
||||
int thread_count;
|
||||
|
@ -784,6 +793,8 @@ struct cpr3_controller {
|
|||
bool aging_failed;
|
||||
struct cpr3_aging_sensor_info *aging_sensor;
|
||||
int aging_sensor_count;
|
||||
u32 aging_possible_mask;
|
||||
u32 aging_possible_val;
|
||||
|
||||
u32 step_quot_fixed;
|
||||
u32 initial_temp_band;
|
||||
|
|
|
@ -1169,6 +1169,24 @@ int cpr3_parse_common_ctrl_data(struct cpr3_controller *ctrl)
|
|||
of_property_read_u32(ctrl->dev->of_node, "qcom,cpr-aging-ref-voltage",
|
||||
&ctrl->aging_ref_volt);
|
||||
|
||||
/* Aging possible bitmask is optional */
|
||||
ctrl->aging_possible_mask = 0;
|
||||
of_property_read_u32(ctrl->dev->of_node,
|
||||
"qcom,cpr-aging-allowed-reg-mask",
|
||||
&ctrl->aging_possible_mask);
|
||||
|
||||
if (ctrl->aging_possible_mask) {
|
||||
/*
|
||||
* Aging possible register value required if bitmask is
|
||||
* specified
|
||||
*/
|
||||
rc = cpr3_parse_ctrl_u32(ctrl,
|
||||
"qcom,cpr-aging-allowed-reg-value",
|
||||
&ctrl->aging_possible_val, 0, UINT_MAX);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (of_find_property(ctrl->dev->of_node, "clock-names", NULL)) {
|
||||
ctrl->core_clk = devm_clk_get(ctrl->dev, "core_clk");
|
||||
if (IS_ERR(ctrl->core_clk)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue