mirror of https://gitee.com/openkylin/linux.git
Merge series "Really implement Qualcomm LAB/IBB regulators" from AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>:
Okay, the title may be a little "aggressive"? However, the qcom-labibb driver wasn't really .. doing much. The current form of this driver is only taking care of enabling or disabling the regulators, which is pretty useless if they were not pre-set from the bootloader, which sets them only if continuous splash is enabled. Moreover, some bootloaders are setting a higher voltage and/or a higher current limit compared to what's actually required by the attached hardware (which is, in 99.9% of the cases, a display) and this produces a higher power consumption, higher heat output and a risk of actually burning the display if kept up for a very long time: for example, this is true on at least some Sony Xperia MSM8998 (Yoshino platform) and especially on some Sony Xperia SDM845 (Tama platform) smartphones. In any case, the main reason why this change was necessary for us is that, during the bringup of Sony Xperia MSM8998 phones, we had an issue with the bootloader not turning on the display and not setting the lab and ibb regulators before booting the kernel, making it impossible to powerup the display. With this said, this patchset enables setting voltage, current limiting, overcurrent and short-circuit protection.. and others, on the LAB/IBB regulators. Each commit in this patch series provides as many informations as possible about what's going on and testing methodology. Changes in v2: - From Mark Brown review: - Replaced some if branches with switch statements - Moved irq get and request in probe function - Changed short conditionals to full ones - Removed useless check for ocp_irq_requested - Fixed issues with YAML documentation AngeloGioacchino Del Regno (7): regulator: qcom-labibb: Implement voltage selector ops regulator: qcom-labibb: Implement current limiting regulator: qcom-labibb: Implement pull-down, softstart, active discharge dt-bindings: regulator: qcom-labibb: Document soft start properties regulator: qcom-labibb: Implement short-circuit and over-current IRQs dt-bindings: regulator: qcom-labibb: Document SCP/OCP interrupts arm64: dts: pmi8998: Add the right interrupts for LAB/IBB SCP and OCP .../regulator/qcom-labibb-regulator.yaml | 30 +- arch/arm64/boot/dts/qcom/pmi8998.dtsi | 8 +- drivers/regulator/qcom-labibb-regulator.c | 661 +++++++++++++++++- 3 files changed, 686 insertions(+), 13 deletions(-) -- 2.29.2
This commit is contained in:
commit
f35f6d8c11
|
@ -19,6 +19,12 @@
|
|||
#define PMI8998_IBB_REG_BASE 0xdc00
|
||||
|
||||
#define REG_LABIBB_STATUS1 0x08
|
||||
|
||||
#define REG_LABIBB_VOLTAGE 0x41
|
||||
#define LABIBB_VOLTAGE_OVERRIDE_EN BIT(7)
|
||||
#define LAB_VOLTAGE_SET_MASK GENMASK(3, 0)
|
||||
#define IBB_VOLTAGE_SET_MASK GENMASK(5, 0)
|
||||
|
||||
#define REG_LABIBB_ENABLE_CTL 0x46
|
||||
#define LABIBB_STATUS1_VREG_OK_BIT BIT(7)
|
||||
#define LABIBB_CONTROL_ENABLE BIT(7)
|
||||
|
@ -51,6 +57,10 @@ static const struct regulator_ops qcom_labibb_ops = {
|
|||
.enable = regulator_enable_regmap,
|
||||
.disable = regulator_disable_regmap,
|
||||
.is_enabled = regulator_is_enabled_regmap,
|
||||
.set_voltage_sel = regulator_set_voltage_sel_regmap,
|
||||
.get_voltage_sel = regulator_get_voltage_sel_regmap,
|
||||
.list_voltage = regulator_list_voltage_linear_range,
|
||||
.map_voltage = regulator_map_voltage_linear_range,
|
||||
};
|
||||
|
||||
static const struct regulator_desc pmi8998_lab_desc = {
|
||||
|
@ -59,9 +69,18 @@ static const struct regulator_desc pmi8998_lab_desc = {
|
|||
.enable_val = LABIBB_CONTROL_ENABLE,
|
||||
.enable_time = LAB_ENABLE_TIME,
|
||||
.poll_enabled_time = LABIBB_POLL_ENABLED_TIME,
|
||||
.vsel_reg = (PMI8998_LAB_REG_BASE + REG_LABIBB_VOLTAGE),
|
||||
.vsel_mask = LAB_VOLTAGE_SET_MASK,
|
||||
.apply_reg = (PMI8998_LAB_REG_BASE + REG_LABIBB_VOLTAGE),
|
||||
.apply_bit = LABIBB_VOLTAGE_OVERRIDE_EN,
|
||||
.off_on_delay = LABIBB_OFF_ON_DELAY,
|
||||
.owner = THIS_MODULE,
|
||||
.type = REGULATOR_VOLTAGE,
|
||||
.linear_ranges = (struct linear_range[]) {
|
||||
REGULATOR_LINEAR_RANGE(4600000, 0, 15, 100000),
|
||||
},
|
||||
.n_linear_ranges = 1,
|
||||
.n_voltages = 16,
|
||||
.ops = &qcom_labibb_ops,
|
||||
};
|
||||
|
||||
|
@ -71,9 +90,18 @@ static const struct regulator_desc pmi8998_ibb_desc = {
|
|||
.enable_val = LABIBB_CONTROL_ENABLE,
|
||||
.enable_time = IBB_ENABLE_TIME,
|
||||
.poll_enabled_time = LABIBB_POLL_ENABLED_TIME,
|
||||
.vsel_reg = (PMI8998_IBB_REG_BASE + REG_LABIBB_VOLTAGE),
|
||||
.vsel_mask = IBB_VOLTAGE_SET_MASK,
|
||||
.apply_reg = (PMI8998_IBB_REG_BASE + REG_LABIBB_VOLTAGE),
|
||||
.apply_bit = LABIBB_VOLTAGE_OVERRIDE_EN,
|
||||
.off_on_delay = LABIBB_OFF_ON_DELAY,
|
||||
.owner = THIS_MODULE,
|
||||
.type = REGULATOR_VOLTAGE,
|
||||
.linear_ranges = (struct linear_range[]) {
|
||||
REGULATOR_LINEAR_RANGE(1400000, 0, 63, 100000),
|
||||
},
|
||||
.n_linear_ranges = 1,
|
||||
.n_voltages = 64,
|
||||
.ops = &qcom_labibb_ops,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue