Re: [PATCH v5 2/2] memory: mtk-smi: mt8188: Add SMI reset and clamp for MT8188

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2025-03-12 at 13:02 +0100, Krzysztof Kozlowski wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> On 11/03/2025 13:23, Friday Yang wrote:
> >  static int mtk_smi_device_link_common(struct device *dev, struct
> > device **com_dev)
> >  {
> >       struct platform_device *smi_com_pdev;
> > @@ -528,6 +598,53 @@ static int mtk_smi_dts_clk_init(struct device
> > *dev, struct mtk_smi *smi,
> >       return ret;
> >  }
> > 
> > +static int mtk_smi_larb_parse_clamp_optional(struct mtk_smi_larb
> > *larb)
> > +{
> > +     struct device *dev = larb->dev;
> > +     const struct mtk_smi_larb_gen *larb_gen = larb->larb_gen;
> > +     u32 larb_id;
> > +     int ret;
> > +
> > +     /**
> 
> Not a kerneldoc
> 

OK, I will fix it like this:
/*
 * Only SMI LARBs ...
 */

> > +      * Only SMI LARBs in camera, image and IPE subsys need to
> > +      * apply clamp and reset operations, others can be skipped.
> > +      */
> > +     ret = of_property_read_u32(dev->of_node, "mediatek,larb-id",
> > &larb_id);
> 
> 
> ...
> 
> 
> >  static const struct mtk_smi_common_plat mtk_smi_common_mt8192 = {
> >       .type     = MTK_SMI_GEN2,
> >       .has_gals = true,
> > @@ -729,6 +862,7 @@ static const struct of_device_id
> > mtk_smi_common_of_ids[] = {
> >       {.compatible = "mediatek,mt8186-smi-common", .data =
> > &mtk_smi_common_mt8186},
> >       {.compatible = "mediatek,mt8188-smi-common-vdo", .data =
> > &mtk_smi_common_mt8188_vdo},
> >       {.compatible = "mediatek,mt8188-smi-common-vpp", .data =
> > &mtk_smi_common_mt8188_vpp},
> > +     {.compatible = "mediatek,mt8188-smi-sub-common", .data =
> > &mtk_smi_sub_common_mt8188},
> >       {.compatible = "mediatek,mt8192-smi-common", .data =
> > &mtk_smi_common_mt8192},
> >       {.compatible = "mediatek,mt8195-smi-common-vdo", .data =
> > &mtk_smi_common_mt8195_vdo},
> >       {.compatible = "mediatek,mt8195-smi-common-vpp", .data =
> > &mtk_smi_common_mt8195_vpp},
> > @@ -787,7 +921,10 @@ static int mtk_smi_common_probe(struct
> > platform_device *pdev)
> >                       return ret;
> >       }
> > 
> > -     pm_runtime_enable(dev);
> > +     ret = devm_pm_runtime_enable(dev);
> > +     if (ret)
> > +             return ret;
> > +
> >       platform_set_drvdata(pdev, common);
> >       return 0;
> >  }
> > @@ -798,7 +935,6 @@ static void mtk_smi_common_remove(struct
> > platform_device *pdev)
> > 
> >       if (common->plat->type == MTK_SMI_GEN2_SUB_COMM)
> >               device_link_remove(&pdev->dev, common-
> > >smi_common_dev);
> > -     pm_runtime_disable(&pdev->dev);
> 
> Does not look related to this patch. Is it some sort of cleanup to
> devm?

This 'devm' modification aims to remove 'pm_runtime_disable' and
'err_pm_disable', which would make the code more efficient. 
If I insist on using 'pm_runtime_enable', I would need to add another
'goto err_pm_disable', which is not an ideal solution. Just as below,

	ret = mtk_smi_larb_parse_clamp_optional(larb);
	if (ret)
		goto err_link_remove;

	ret = mtk_smi_larb_parse_reset_optional(larb);
	if (ret)
		goto err_link_remove;

	pm_runtime_enable(dev);
	platform_set_drvdata(pdev, larb);
	ret = component_add(dev, &mtk_smi_larb_component_ops);
	if (ret)
		goto err_pm_disable;

	return 0;

err_pm_disable:
	pm_runtime_disable(dev);
err_link_remove:
	device_link_remove(dev, larb->smi_common_dev);
	return ret;

Therefore, I prefer to use 'devm_pm_runtime_enable' here. Please let me
know if you have any concerns, thanks!

> 
> Best regards,
> Krzysztof




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux