From: "Friday Yang (杨阳)" <Friday.Yang@mediatek.com>
To: "robh@kernel.org" <robh@kernel.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"Yong Wu (吴勇)" <Yong.Wu@mediatek.com>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"krzk@kernel.org" <krzk@kernel.org>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: Re: [PATCH v5 2/2] memory: mtk-smi: mt8188: Add SMI reset and clamp for MT8188
Date: Wed, 19 Mar 2025 03:06:50 +0000 [thread overview]
Message-ID: <18146544c3563868e84621708d53825f31849079.camel@mediatek.com> (raw)
In-Reply-To: <6008832c-e175-4b02-90a6-f790dacd1d09@kernel.org>
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
prev parent reply other threads:[~2025-03-19 3:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 12:23 [PATCH v5 0/2] Add SMI reset and clamp for MediaTek MT8188 SoC Friday Yang
2025-03-11 12:23 ` [PATCH v5 1/2] dt-bindings: memory: mediatek: Add SMI reset and clamp for MT8188 Friday Yang
2025-03-11 20:07 ` Rob Herring (Arm)
2025-03-12 10:35 ` AngeloGioacchino Del Regno
2025-03-11 12:23 ` [PATCH v5 2/2] memory: mtk-smi: mt8188: " Friday Yang
2025-03-12 10:35 ` AngeloGioacchino Del Regno
2025-03-12 12:02 ` Krzysztof Kozlowski
2025-03-19 3:06 ` Friday Yang (杨阳) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18146544c3563868e84621708d53825f31849079.camel@mediatek.com \
--to=friday.yang@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=Yong.Wu@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox