public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: alexandre.belloni@bootlin.com,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	david.nystrom@est.tech, linux-i3c@lists.infradead.org
Subject: Re: [PATCH V2 1/3] i3c: master: Add i3c_master_do_daa_ext() for post-hibernation address recovery
Date: Mon, 19 Jan 2026 11:31:56 -0500	[thread overview]
Message-ID: <aW5cfJ2ros8FBEX+@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260119100212.29607-2-adrian.hunter@intel.com>

On Mon, Jan 19, 2026 at 12:02:10PM +0200, Adrian Hunter wrote:
> After system hibernation, I3C Dynamic Addresses may be reassigned at boot
> and no longer match the values recorded before suspend. Introduce
> i3c_master_do_daa_ext() to handle this situation.
>
> The restore procedure is straightforward: issue a Reset Dynamic Address
> Assignment (RSTDAA), then run the standard DAA sequence. The existing DAA
> logic already supports detecting and updating devices whose dynamic
> addresses differ from previously known values.
>
> Refactor the DAA path by introducing a shared helper used by both the
> normal i3c_master_do_daa() path and the new extended restore function,
> and correct the kernel-doc in the process.
>
> Export i3c_master_do_daa_ext() so that master drivers can invoke it from
> their PM restore callbacks.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
...
> -int i3c_master_do_daa(struct i3c_master_controller *master)
> +int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool restore)

is 'rstdaa' better than 'restore'? 'rstdaa' indicate what this API did
actually.

Frank
>  {
> +	int rstret = 0;
>  	int ret;
>
>  	ret = i3c_master_rpm_get(master);
> @@ -1758,7 +1760,15 @@ int i3c_master_do_daa(struct i3c_master_controller *master)
>  		return ret;
>
>  	i3c_bus_maintenance_lock(&master->bus);
> +
> +	if (restore) {
> +		rstret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
> +		if (rstret == I3C_ERROR_M2)
> +			rstret = 0;
> +	}
> +
>  	ret = master->ops->do_daa(master);
> +
>  	i3c_bus_maintenance_unlock(&master->bus);
>
>  	if (ret)
> @@ -1769,7 +1779,24 @@ int i3c_master_do_daa(struct i3c_master_controller *master)
>  	i3c_bus_normaluse_unlock(&master->bus);
>  out:
>  	i3c_master_rpm_put(master);
> -	return ret;
> +
> +	return rstret ?: ret;
> +}
> +EXPORT_SYMBOL_GPL(i3c_master_do_daa_ext);
> +
> +/**
> + * i3c_master_do_daa() - do a DAA (Dynamic Address Assignment)
> + * @master: master doing the DAA
> + *
> + * This function instantiates I3C device objects and adds them to the
> + * I3C device list. All device information is automatically retrieved using
> + * standard CCC commands.
> + *
> + * Return: a 0 in case of success, an negative error code otherwise.
> + */
> +int i3c_master_do_daa(struct i3c_master_controller *master)
> +{
> +	return i3c_master_do_daa_ext(master, false);
>  }
>  EXPORT_SYMBOL_GPL(i3c_master_do_daa);
>
> diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
> index c1ec597f655c..5d0d5359a03e 100644
> --- a/include/linux/i3c/master.h
> +++ b/include/linux/i3c/master.h
> @@ -598,6 +598,7 @@ int i3c_master_get_free_addr(struct i3c_master_controller *master,
>  int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
>  				  u8 addr);
>  int i3c_master_do_daa(struct i3c_master_controller *master);
> +int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool restore);
>  struct i3c_dma *i3c_master_dma_map_single(struct device *dev, void *ptr,
>  					  size_t len, bool force_bounce,
>  					  enum dma_data_direction dir);
> --
> 2.51.0
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2026-01-19 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19 10:02 [PATCH V2 0/3] i3c: mipi-i3c-hci-pci: Add System Suspend support Adrian Hunter
2026-01-19 10:02 ` [PATCH V2 1/3] i3c: master: Add i3c_master_do_daa_ext() for post-hibernation address recovery Adrian Hunter
2026-01-19 16:31   ` Frank Li [this message]
2026-01-19 10:02 ` [PATCH V2 2/3] i3c: mipi-i3c-hci: Add optional System Suspend support Adrian Hunter
2026-01-19 16:32   ` Frank Li
2026-01-19 10:02 ` [PATCH V2 3/3] i3c: mipi-i3c-hci-pci: Add " Adrian Hunter
2026-01-19 16:33   ` Frank Li

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=aW5cfJ2ros8FBEX+@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=david.nystrom@est.tech \
    --cc=linux-i3c@lists.infradead.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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