[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d1c67441-85d6-42d7-9ace-c4884f767dc8@linaro.org>
Date: Wed, 23 Jul 2025 09:52:31 +0200
From: neil.armstrong@...aro.org
To: Vinod Koul <vkoul@...nel.org>, Manivannan Sadhasivam <mani@...nel.org>
Cc: Peter Griffin <peter.griffin@...aro.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>, 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>
Subject: Re: [PATCH v2 1/2] phy: add new phy_notify_pmstate() api
On 23/07/2025 09:07, Vinod Koul wrote:
> On 22-07-25, 22:04, Manivannan Sadhasivam wrote:
>> On Thu, Jul 03, 2025 at 02:03:22PM GMT, Peter Griffin wrote:
>>> Add a new phy_notify_pmstate() api that notifies and configures a phy for a
>>> given PM link state transition.
>>>
>>> This is intended to be by phy drivers which need to do some runtime
>>> configuration of parameters during the transition 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>
>>> ---
>>> drivers/phy/phy-core.c | 25 +++++++++++++++++++++++++
>>> include/linux/phy/phy.h | 25 +++++++++++++++++++++++++
>>> 2 files changed, 50 insertions(+)
>>>
>>> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
>>> index 04a5a34e7a950ae94fae915673c25d476fc071c1..0b29bc2c709890d7fc27d1480a35cda6a826fd30 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_pmstate() - phy link state notification
>>
>> 'pmstate' doesn't correspond to 'link state'. So how about,
>> phy_notify_link_state()?
>>
>> s/phy/PHY (here and below)
>>
>>> + * @phy: the phy returned by phy_get()
>>> + * @state: the link state
>>> + *
>>> + * Notify the phy of some PM link state transition. Used to notify and
>>
>> Link state change is common for the PHY. So remove 'PM'.
>
> Is it really link or phy state?
It seems to be a link state, and I think adding a way to force
a link state to a phy, which is basically the role of a phy,
more coherent.
Neil
>
>>
>>> + * configure the phy accordingly.
>>> + *
>>> + * Returns: %0 if successful, a negative error code otherwise
>>> + */
>>> +int phy_notify_pmstate(struct phy *phy, enum phy_linkstate state)
>>
>> I think you need to use 'int state' and let drivers pass their own link state
>> values. You cannot have generic link states across all peripherals.
>
> I would avoid that, people start overloading this if we let it keep
> open! I would like to avoid the api -(ab)use
>
Powered by blists - more mailing lists