Re: [PATCH v8 22/23] drm/mediatek: Power on devices in OVL adaptor when atomic enable

Shawn Sung (宋孝謙)
2023-10-18T04:55:46Z

Hi CK,

On Wed, 2023-10-18 at 02:02 +0000, CK Hu (胡俊光) wrote:
> Hi, Hsiao-chien:
>
> On Mon, 2023-10-16 at 18:40 +0800, Hsiao Chien Sung wrote:
> > Different from OVL, OVL adaptor is a pseudo device so we didn't
> > define it in the device tree, consequently,
> > pm_runtime_resume_and_get()
> > called by .atomic_enable() powers on no device in OVL adaptor and
> > leads to power outage in the corresponding IOMMU.
> >
... snip ...
> > +int mtk_ovl_adaptor_power_on(struct device *dev)
> > +{
> > + int i, ret;
> > + struct mtk_disp_ovl_adaptor *ovl_adaptor =
> > dev_get_drvdata(dev);
> > +
> > + for (i = 0; i < OVL_ADAPTOR_ID_MAX; i++) {
> > + if (!ovl_adaptor->ovl_adaptor_comp[i] ||
> > + !comp_matches[i].funcs->power_on)
> > + continue;
>
> To simplify the code, you could call mtk_ddp_comp_power_on() for all
> sub device, and drop power_on()/power_off() of mdp_rdma.
>
> Regards,
> CK
>

Since ovl_adaptor_comp is a `struct device`, we can't reuse
mtk_ddp_comp_power_on() here. Had submited a new version (v9) and wrap
the power off procedure as a static inline function to reuse it.

Regards,
Shawn