summaryrefslogtreecommitdiff
path: root/drivers/media/platform/starfive/v4l2_driver/stf_csi_hw_ops.c
diff options
context:
space:
mode:
authormason.huo <mason.huo@starfivetech.com>2022-06-07 10:30:18 +0300
committermason.huo <mason.huo@starfivetech.com>2022-06-07 13:33:22 +0300
commit331e04089490f60357d1a73972a5e30a49dcdbcd (patch)
treee26cb456edcd251f90a43f08cb248aff7449b236 /drivers/media/platform/starfive/v4l2_driver/stf_csi_hw_ops.c
parent80f85ca138889ca5bc2999729f3fc1dd05994ae8 (diff)
downloadlinux-331e04089490f60357d1a73972a5e30a49dcdbcd.tar.xz
regulator: stf7110: Add regulator APIs for hdmi & csi driver
The hdmi & csi driver use the legacy pmic driver APIs to power on/off related LDOs. After employed regulator framework for pmic, add the regulator APIs to control the LDOs. Signed-off-by: mason.huo <mason.huo@starfivetech.com>
Diffstat (limited to 'drivers/media/platform/starfive/v4l2_driver/stf_csi_hw_ops.c')
-rwxr-xr-xdrivers/media/platform/starfive/v4l2_driver/stf_csi_hw_ops.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/media/platform/starfive/v4l2_driver/stf_csi_hw_ops.c b/drivers/media/platform/starfive/v4l2_driver/stf_csi_hw_ops.c
index f49528acc808..a44ce26c538d 100755
--- a/drivers/media/platform/starfive/v4l2_driver/stf_csi_hw_ops.c
+++ b/drivers/media/platform/starfive/v4l2_driver/stf_csi_hw_ops.c
@@ -39,11 +39,37 @@
static int stf_csi_power_on(struct stf_csi_dev *csi_dev, u8 on)
{
void __iomem *aon_syscon;
+ int ret;
+
+ if (on) {
+ ret = regulator_enable(csi_dev->mipirx_1p8);
+ if (ret) {
+ st_err(ST_CSI, "Cannot enable mipirx_1p8 regulator\n");
+ goto err_1p8;
+ }
+
+ ret = regulator_enable(csi_dev->mipirx_0p9);
+ if (ret) {
+ st_err(ST_CSI, "Cannot enable mipirx_0p9 regulator\n");
+ goto err_0p9;
+ }
+ }
+ else
+ {
+ regulator_disable(csi_dev->mipirx_1p8);
+ regulator_disable(csi_dev->mipirx_0p9);
+ }
aon_syscon = ioremap(0x17010000, 0x4);
reg_write(aon_syscon, 0x00, 0x80000000);
return 0;
+
+err_0p9:
+ regulator_disable(csi_dev->mipirx_1p8);
+err_1p8:
+ return ret;
+
}
static int stf_csi_clk_enable(struct stf_csi_dev *csi_dev)