How to share ISO cell among multiple devices
Overview
This document describes the basic usage of power ISO(isolation) cell and how to share an ISO cell among multiple devices.
Typical device power-on and power-off flow
ISO cells on chip
ISO Cell name | Shareable | Sharer |
|---|---|---|
video_iso | YES | Video Codec, ISP, Stereo, Dewarp, TSP |
npu_iso | NO | None |
ca55core3_iso | NO | None |
ca55core2_iso | NO | None |
ca55core1_iso | NO | None |
ca55core0_iso | NO | None |
Sharing ISO cell
For the purpose of sharing the video_iso cell among Video Codec, ISP, Stereo, Dewarp and TSP, we implement the driver named "sunplus,sp7350-regulator-iso" of ISO on the basis of Linux regulator subsystem(It includes a reference count).
The ISO cell node in DTS is as follows:
gdc_video_isp_iso: gdc_video_isp_iso@f880125c {
compatible = "sunplus,sp7350-regulator-iso";
reg = <0x00 0xf880125c 0x00 0x4>;
regulator-name = "sp7350-iso";
sunplus,iso-selector = <SP7350_ISO_VIDEO>;
};sunplus,iso-selector selects the ISO cell from the following list:
ISO Cell name | Macro |
|---|---|
video_iso | SP7350_ISO_VIDEO |
npu_iso | SP7350_ISO_NPU |
ca55core3_iso | SP7350_ISO_CORE3 |
ca55core2_iso | SP7350_ISO_CORE2 |
ca55core1_iso | SP7350_ISO_CORE1 |
ca55core0_iso | SP7350_ISO_CORE0 |
The sharer node in DTS is as follows:
&sample_device {
power-supply = <&gdc_video_isp_0v8>;
iso-supply = <&gdc_video_isp_iso>;
};
The basic flow in sharer driver is as follows:
int probe(struct platform_device *pdev) {
struct regulator *power_supply = devm_regulator_get(&pdev->dev, "power");
struct regulator *power_iso = devm_regulator_get(&pdev->dev, "iso");
struct reset_control *rst = devm_reset_control_get_shared(&pdev->dev, NULL);
struct clk *clock = devm_clk_get(&pdev->dev, NULL);
regulator_enable(power_supply);
regulator_enable(power_iso);//This code actually disables ISO cell
reset_control_deassert(rst);
clk_prepare_enable(clock);
...
return 0;
}
int remove(struct platform_device *pdev) {
clk_disable_unprepare(clock);
reset_control_assert(rst);
regulator_disable(power_iso);//This code actually enables ISO cell
regulator_disable(power_supply);
...
return 0;
}