Re: [PATCH v2 2/6] firmware: ti_sci: Partial-IO support

From: Markus Schneider-Pargmann
Date: Wed Jul 31 2024 - 08:37:19 EST


On Tue, Jul 30, 2024 at 10:07:22AM GMT, Nishanth Menon wrote:
> On 15:01-20240730, Markus Schneider-Pargmann wrote:
> > > > +
> > > > + return NOTIFY_DONE;
> > > > +}
> > > > +
> > > > /* Description for K2G */
> > > > static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = {
> > > > .default_host_id = 2,
> > > > @@ -3398,6 +3485,35 @@ static int ti_sci_probe(struct platform_device *pdev)
> > > > goto out;
> > > > }
> > > >
> > > > + if (of_property_read_bool(dev->of_node, "ti,partial-io-wakeup-sources")) {
> > >
> > > You should probably check on TISCI_MSG_QUERY_FW_CAPS[1] if
> > > Partial IO on low power mode is supported as well? if there is a
> > > mismatch, report so?
> >
> > I actually have another series in my queue that introduces this check. I
> > just implemented this check for Partial-IO yesterday in the patch that
> > introduces fw capabilities. If you like I can switch these series
> > around.
>
> Yes, please introduce it part of the series.
>
> >
> > >
> > > > + info->nr_wakeup_sources =
> > > > + of_count_phandle_with_args(dev->of_node,
> > > > + "ti,partial-io-wakeup-sources",
> > > > + NULL);
> > > > + info->wakeup_source_nodes =
> > > > + devm_kzalloc(dev, sizeof(*info->wakeup_source_nodes),
> > > > + GFP_KERNEL);
> > > > +
> > > > + for (i = 0; i != info->nr_wakeup_sources; ++i) {
> > > > + struct device_node *devnode =
> > > > + of_parse_phandle(dev->of_node,
> > > > + "ti,partial-io-wakeup-sources",
> > > > + i);
> > > > + info->wakeup_source_nodes[i] = devnode;
> > >
> > > Curious: Don't we need to maintain reference counting for the devnode
> > > if CONFIG_OF_DYNAMIC?
> >
> > In case you mean I missed of_node_put(), yes, I did, thank you. I added
> > it in a ti_sci_remove().
>
> And unless I am mistaken, of_node_get as required as you are
> retaining the reference of the node till shutdown / remove is invoked.

The function documentation says the refcount is already incremented:

* Return: The device_node pointer with refcount incremented. Use
* of_node_put() on it when done.

Best
Markus

>
> --
> Regards,
> Nishanth Menon
> Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D