lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c95faaf1-57e4-4387-89c1-be6befc79416@linaro.org>
Date: Tue, 18 Nov 2025 10:13:28 +0100
From: neil.armstrong@...aro.org
To: Peter Griffin <peter.griffin@...aro.org>, Vinod Koul <vkoul@...nel.org>,
 Kishon Vijay Abraham I <kishon@...nel.org>,
 André Draszik <andre.draszik@...aro.org>,
 Tudor Ambarus <tudor.ambarus@...aro.org>,
 Alim Akhtar <alim.akhtar@...sung.com>, Krzysztof Kozlowski <krzk@...nel.org>
Cc: linux-phy@...ts.infradead.org, linux-kernel@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, linux-samsung-soc@...r.kernel.org,
 kernel-team@...roid.com, William Mcvicker <willmcvicker@...gle.com>,
 Manivannan Sadhasivam <mani@...nel.org>
Subject: Re: [PATCH v5 1/2] phy: add new phy_notify_state() api

On 11/12/25 17:27, Peter Griffin wrote:
> Add a new phy_notify_state() api that notifies and configures a phy for a
> given state transition.
> 
> This is intended to be used by phy drivers which need to do some runtime
> configuration of parameters that can't be handled by phy_calibrate() or
> phy_power_{on|off}().
> 
> The first usage of this API is in the Samsung UFS phy that needs to issue
> some register writes when entering and exiting the hibernate link state.
> 
> Signed-off-by: Peter Griffin <peter.griffin@...aro.org>
> ---
> Changes in v5
> - Fix typo phy_notify_phystate to phy_notify_state (Russell)
> 
> Changes in v4
>   - Add missing 'used' word (Vinod)
> ---
>   drivers/phy/phy-core.c  | 25 +++++++++++++++++++++++++
>   include/linux/phy/phy.h | 19 +++++++++++++++++++
>   2 files changed, 44 insertions(+)
> 
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 04a5a34e7a950ae94fae915673c25d476fc071c1..60be8af984bf06649ef00e695d0ed4ced597cdb9 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -520,6 +520,31 @@ int phy_notify_disconnect(struct phy *phy, int port)
>   }
>   EXPORT_SYMBOL_GPL(phy_notify_disconnect);
>   
> +/**
> + * phy_notify_state() - phy state notification
> + * @phy: the PHY returned by phy_get()
> + * @state: the PHY state
> + *
> + * Notify the PHY of a state transition. Used to notify and
> + * configure the PHY accordingly.
> + *
> + * Returns: %0 if successful, a negative error code otherwise
> + */
> +int phy_notify_state(struct phy *phy, union phy_notify state)
> +{
> +	int ret;
> +
> +	if (!phy || !phy->ops->notify_phystate)
> +		return 0;
> +
> +	mutex_lock(&phy->mutex);
> +	ret = phy->ops->notify_phystate(phy, state);
> +	mutex_unlock(&phy->mutex);
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(phy_notify_state);
> +
>   /**
>    * phy_configure() - Changes the phy parameters
>    * @phy: the phy returned by phy_get()
> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> index 13add0c2c40721fe9ca3f0350d13c035cd25af45..2af0d01ebb39f27dfb34ccb5140771beef8288d5 100644
> --- a/include/linux/phy/phy.h
> +++ b/include/linux/phy/phy.h
> @@ -53,6 +53,15 @@ enum phy_media {
>   	PHY_MEDIA_DAC,
>   };
>   
> +enum phy_ufs_state {
> +	PHY_UFS_HIBERN8_ENTER,
> +	PHY_UFS_HIBERN8_EXIT,
> +};
> +
> +union phy_notify {
> +	enum phy_ufs_state ufs_state;
> +};
> +
>   /**
>    * union phy_configure_opts - Opaque generic phy configuration
>    *
> @@ -83,6 +92,7 @@ union phy_configure_opts {
>    * @set_speed: set the speed of the phy (optional)
>    * @reset: resetting the phy
>    * @calibrate: calibrate the phy
> + * @notify_phystate: notify and configure the phy for a particular state
>    * @release: ops to be performed while the consumer relinquishes the PHY
>    * @owner: the module owner containing the ops
>    */
> @@ -132,6 +142,7 @@ struct phy_ops {
>   	int	(*connect)(struct phy *phy, int port);
>   	int	(*disconnect)(struct phy *phy, int port);
>   
> +	int	(*notify_phystate)(struct phy *phy, union phy_notify state);
>   	void	(*release)(struct phy *phy);
>   	struct module *owner;
>   };
> @@ -255,6 +266,7 @@ int phy_reset(struct phy *phy);
>   int phy_calibrate(struct phy *phy);
>   int phy_notify_connect(struct phy *phy, int port);
>   int phy_notify_disconnect(struct phy *phy, int port);
> +int phy_notify_state(struct phy *phy, union phy_notify state);
>   static inline int phy_get_bus_width(struct phy *phy)
>   {
>   	return phy->attrs.bus_width;
> @@ -412,6 +424,13 @@ static inline int phy_notify_disconnect(struct phy *phy, int index)
>   	return -ENOSYS;
>   }
>   
> +static inline int phy_notify_state(struct phy *phy, union phy_notify state)
> +{
> +	if (!phy)
> +		return 0;
> +	return -ENOSYS;
> +}
> +
>   static inline int phy_configure(struct phy *phy,
>   				union phy_configure_opts *opts)
>   {
> 

LGTM !

Reviewed-by: Neil Armstrong <neil.armstrong@...aro.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ