All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org,
	Archit Taneja <architt@codeaurora.org>,
	Andrzej Hajda <a.hajda@samsung.com>, Chen-Yu Tsai <wens@csie.org>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	Krzysztof Witos <kwitos@cadence.com>,
	Rafal Ciepiela <rafalc@cadence.com>
Subject: Re: [PATCH v2 2/9] phy: Add configuration interface
Date: Wed, 14 Nov 2018 11:51:52 +0100	[thread overview]
Message-ID: <20181114105152.sgk454t34hmzstkn@flea> (raw)
In-Reply-To: <3a9a28df-8139-1036-a884-0de64aa07df1@ti.com>

[-- Attachment #1: Type: text/plain, Size: 3705 bytes --]

Hi Kishon

On Mon, Nov 12, 2018 at 03:32:25PM +0530, Kishon Vijay Abraham I wrote:
> On 06/11/18 8:24 PM, Maxime Ripard wrote:
> > The phy framework is only allowing to configure the power state of the PHY
> > using the init and power_on hooks, and their power_off and exit
> > counterparts.
> > 
> > While it works for most, simple, PHYs supported so far, some more advanced
> > PHYs need some configuration depending on runtime parameters. These PHYs
> > have been supported by a number of means already, often by using ad-hoc
> > drivers in their consumer drivers.
> > 
> > That doesn't work too well however, when a consumer device needs to deal
> > with multiple PHYs, or when multiple consumers need to deal with the same
> > PHY (a DSI driver and a CSI driver for example).
> > 
> > So we'll add a new interface, through two funtions, phy_validate and
> > phy_configure. The first one will allow to check that a current
> > configuration, for a given mode, is applicable. It will also allow the PHY
> > driver to tune the settings given as parameters as it sees fit.
> > 
> > phy_configure will actually apply that configuration in the phy itself.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
> > ---
> >  drivers/phy/phy-core.c  | 61 ++++++++++++++++++++++++++++++++++++++++++-
> >  include/linux/phy/phy.h | 58 ++++++++++++++++++++++++++++++++++++++++-
> >  2 files changed, 119 insertions(+)
> > 
> > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> > index 35fd38c5a4a1..7bd3ed65c708 100644
> > --- a/drivers/phy/phy-core.c
> > +++ b/drivers/phy/phy-core.c
> > @@ -408,6 +408,67 @@ int phy_calibrate(struct phy *phy)
> >  EXPORT_SYMBOL_GPL(phy_calibrate);
> >  
> >  /**
> > + * phy_configure() - Changes the phy parameters
> > + * @phy: the phy returned by phy_get()
> > + * @opts: New configuration to apply
> > + *
> > + * Used to change the PHY parameters. phy_init() must have been called
> > + * on the phy. The configuration will be applied on the current phy
> > + * mode, that can be changed using phy_set_mode().
> > + *
> > + * Returns: 0 if successful, an negative error code otherwise
> > + */
> > +int phy_configure(struct phy *phy, union phy_configure_opts *opts)
> > +{
> > +	int ret;
> > +
> > +	if (!phy)
> > +		return -EINVAL;
> > +
> > +	if (!phy->ops->configure)
> > +		return -EOPNOTSUPP;
> > +
> > +	mutex_lock(&phy->mutex);
> > +	ret = phy->ops->configure(phy, opts);
> > +	mutex_unlock(&phy->mutex);
> > +
> > +	return ret;
> > +}
> 
> EXPORT_SYMBOL_GPL is missing here and below.

Consider it done.

> > +
> > +/**
> > + * phy_validate() - Checks the phy parameters
> > + * @phy: the phy returned by phy_get()
> > + * @mode: phy_mode the configuration is applicable to.
> > + * @opts: Configuration to check
> > + *
> > + * Used to check that the current set of parameters can be handled by
> > + * the phy. Implementations are free to tune the parameters passed as
> > + * arguments if needed by some implementation detail or
> > + * constraints. It will not change any actual configuration of the
> > + * PHY, so calling it as many times as deemed fit will have no side
> > + * effect.
> > + *
> > + * Returns: 0 if successful, an negative error code otherwise
> > + */
> > +int phy_validate(struct phy *phy, enum phy_mode mode,
> > +		  union phy_configure_opts *opts)
> 
> We are planning to switch to mode/submode combination [1], so this might have
> to change.

Yes, I'm aware of that. If needed, it shouldn't be too hard to rework.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: maxime.ripard@bootlin.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/9] phy: Add configuration interface
Date: Wed, 14 Nov 2018 11:51:52 +0100	[thread overview]
Message-ID: <20181114105152.sgk454t34hmzstkn@flea> (raw)
In-Reply-To: <3a9a28df-8139-1036-a884-0de64aa07df1@ti.com>

Hi Kishon

On Mon, Nov 12, 2018 at 03:32:25PM +0530, Kishon Vijay Abraham I wrote:
> On 06/11/18 8:24 PM, Maxime Ripard wrote:
> > The phy framework is only allowing to configure the power state of the PHY
> > using the init and power_on hooks, and their power_off and exit
> > counterparts.
> > 
> > While it works for most, simple, PHYs supported so far, some more advanced
> > PHYs need some configuration depending on runtime parameters. These PHYs
> > have been supported by a number of means already, often by using ad-hoc
> > drivers in their consumer drivers.
> > 
> > That doesn't work too well however, when a consumer device needs to deal
> > with multiple PHYs, or when multiple consumers need to deal with the same
> > PHY (a DSI driver and a CSI driver for example).
> > 
> > So we'll add a new interface, through two funtions, phy_validate and
> > phy_configure. The first one will allow to check that a current
> > configuration, for a given mode, is applicable. It will also allow the PHY
> > driver to tune the settings given as parameters as it sees fit.
> > 
> > phy_configure will actually apply that configuration in the phy itself.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
> > ---
> >  drivers/phy/phy-core.c  | 61 ++++++++++++++++++++++++++++++++++++++++++-
> >  include/linux/phy/phy.h | 58 ++++++++++++++++++++++++++++++++++++++++-
> >  2 files changed, 119 insertions(+)
> > 
> > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> > index 35fd38c5a4a1..7bd3ed65c708 100644
> > --- a/drivers/phy/phy-core.c
> > +++ b/drivers/phy/phy-core.c
> > @@ -408,6 +408,67 @@ int phy_calibrate(struct phy *phy)
> >  EXPORT_SYMBOL_GPL(phy_calibrate);
> >  
> >  /**
> > + * phy_configure() - Changes the phy parameters
> > + * @phy: the phy returned by phy_get()
> > + * @opts: New configuration to apply
> > + *
> > + * Used to change the PHY parameters. phy_init() must have been called
> > + * on the phy. The configuration will be applied on the current phy
> > + * mode, that can be changed using phy_set_mode().
> > + *
> > + * Returns: 0 if successful, an negative error code otherwise
> > + */
> > +int phy_configure(struct phy *phy, union phy_configure_opts *opts)
> > +{
> > +	int ret;
> > +
> > +	if (!phy)
> > +		return -EINVAL;
> > +
> > +	if (!phy->ops->configure)
> > +		return -EOPNOTSUPP;
> > +
> > +	mutex_lock(&phy->mutex);
> > +	ret = phy->ops->configure(phy, opts);
> > +	mutex_unlock(&phy->mutex);
> > +
> > +	return ret;
> > +}
> 
> EXPORT_SYMBOL_GPL is missing here and below.

Consider it done.

> > +
> > +/**
> > + * phy_validate() - Checks the phy parameters
> > + * @phy: the phy returned by phy_get()
> > + * @mode: phy_mode the configuration is applicable to.
> > + * @opts: Configuration to check
> > + *
> > + * Used to check that the current set of parameters can be handled by
> > + * the phy. Implementations are free to tune the parameters passed as
> > + * arguments if needed by some implementation detail or
> > + * constraints. It will not change any actual configuration of the
> > + * PHY, so calling it as many times as deemed fit will have no side
> > + * effect.
> > + *
> > + * Returns: 0 if successful, an negative error code otherwise
> > + */
> > +int phy_validate(struct phy *phy, enum phy_mode mode,
> > +		  union phy_configure_opts *opts)
> 
> We are planning to switch to mode/submode combination [1], so this might have
> to change.

Yes, I'm aware of that. If needed, it shouldn't be too hard to rework.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181114/a55e0a4a/attachment.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Krzysztof Witos <kwitos@cadence.com>,
	Rafal Ciepiela <rafalc@cadence.com>,
	Boris Brezillon <boris.brezillon@bootlin.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Chen-Yu Tsai <wens@csie.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v2 2/9] phy: Add configuration interface
Date: Wed, 14 Nov 2018 11:51:52 +0100	[thread overview]
Message-ID: <20181114105152.sgk454t34hmzstkn@flea> (raw)
In-Reply-To: <3a9a28df-8139-1036-a884-0de64aa07df1@ti.com>


[-- Attachment #1.1: Type: text/plain, Size: 3705 bytes --]

Hi Kishon

On Mon, Nov 12, 2018 at 03:32:25PM +0530, Kishon Vijay Abraham I wrote:
> On 06/11/18 8:24 PM, Maxime Ripard wrote:
> > The phy framework is only allowing to configure the power state of the PHY
> > using the init and power_on hooks, and their power_off and exit
> > counterparts.
> > 
> > While it works for most, simple, PHYs supported so far, some more advanced
> > PHYs need some configuration depending on runtime parameters. These PHYs
> > have been supported by a number of means already, often by using ad-hoc
> > drivers in their consumer drivers.
> > 
> > That doesn't work too well however, when a consumer device needs to deal
> > with multiple PHYs, or when multiple consumers need to deal with the same
> > PHY (a DSI driver and a CSI driver for example).
> > 
> > So we'll add a new interface, through two funtions, phy_validate and
> > phy_configure. The first one will allow to check that a current
> > configuration, for a given mode, is applicable. It will also allow the PHY
> > driver to tune the settings given as parameters as it sees fit.
> > 
> > phy_configure will actually apply that configuration in the phy itself.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
> > ---
> >  drivers/phy/phy-core.c  | 61 ++++++++++++++++++++++++++++++++++++++++++-
> >  include/linux/phy/phy.h | 58 ++++++++++++++++++++++++++++++++++++++++-
> >  2 files changed, 119 insertions(+)
> > 
> > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> > index 35fd38c5a4a1..7bd3ed65c708 100644
> > --- a/drivers/phy/phy-core.c
> > +++ b/drivers/phy/phy-core.c
> > @@ -408,6 +408,67 @@ int phy_calibrate(struct phy *phy)
> >  EXPORT_SYMBOL_GPL(phy_calibrate);
> >  
> >  /**
> > + * phy_configure() - Changes the phy parameters
> > + * @phy: the phy returned by phy_get()
> > + * @opts: New configuration to apply
> > + *
> > + * Used to change the PHY parameters. phy_init() must have been called
> > + * on the phy. The configuration will be applied on the current phy
> > + * mode, that can be changed using phy_set_mode().
> > + *
> > + * Returns: 0 if successful, an negative error code otherwise
> > + */
> > +int phy_configure(struct phy *phy, union phy_configure_opts *opts)
> > +{
> > +	int ret;
> > +
> > +	if (!phy)
> > +		return -EINVAL;
> > +
> > +	if (!phy->ops->configure)
> > +		return -EOPNOTSUPP;
> > +
> > +	mutex_lock(&phy->mutex);
> > +	ret = phy->ops->configure(phy, opts);
> > +	mutex_unlock(&phy->mutex);
> > +
> > +	return ret;
> > +}
> 
> EXPORT_SYMBOL_GPL is missing here and below.

Consider it done.

> > +
> > +/**
> > + * phy_validate() - Checks the phy parameters
> > + * @phy: the phy returned by phy_get()
> > + * @mode: phy_mode the configuration is applicable to.
> > + * @opts: Configuration to check
> > + *
> > + * Used to check that the current set of parameters can be handled by
> > + * the phy. Implementations are free to tune the parameters passed as
> > + * arguments if needed by some implementation detail or
> > + * constraints. It will not change any actual configuration of the
> > + * PHY, so calling it as many times as deemed fit will have no side
> > + * effect.
> > + *
> > + * Returns: 0 if successful, an negative error code otherwise
> > + */
> > +int phy_validate(struct phy *phy, enum phy_mode mode,
> > +		  union phy_configure_opts *opts)
> 
> We are planning to switch to mode/submode combination [1], so this might have
> to change.

Yes, I'm aware of that. If needed, it shouldn't be too hard to rework.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-11-14 10:51 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 14:54 [PATCH v2 0/9] phy: Add configuration interface for MIPI D-PHY devices Maxime Ripard
2018-11-06 14:54 ` Maxime Ripard
2018-11-06 14:54 ` Maxime Ripard
2018-11-06 14:54 ` [PATCH v2 1/9] phy: Add MIPI D-PHY mode Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-07 13:29   ` Sakari Ailus
2018-11-07 13:29     ` Sakari Ailus
2018-11-06 14:54 ` [PATCH v2 2/9] phy: Add configuration interface Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-12 10:02   ` Kishon Vijay Abraham I
2018-11-12 10:02     ` Kishon Vijay Abraham I
2018-11-12 10:02     ` Kishon Vijay Abraham I
2018-11-14 10:51     ` Maxime Ripard [this message]
2018-11-14 10:51       ` Maxime Ripard
2018-11-14 10:51       ` Maxime Ripard
2018-11-06 14:54 ` [PATCH v2 3/9] phy: Add MIPI D-PHY configuration options Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-19 13:58   ` Sakari Ailus
2018-11-19 13:58     ` Sakari Ailus
2018-11-19 13:58     ` Sakari Ailus
2018-11-21  9:52     ` Maxime Ripard
2018-11-21  9:52       ` Maxime Ripard
2018-11-21  9:52       ` Maxime Ripard
2018-11-06 14:54 ` [PATCH v2 4/9] phy: dphy: Add configuration helpers Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-19 13:43   ` Sakari Ailus
2018-11-19 13:43     ` Sakari Ailus
2018-11-19 13:43     ` Sakari Ailus
2018-11-21  9:33     ` Maxime Ripard
2018-11-21  9:33       ` Maxime Ripard
2018-12-04  5:58       ` Kishon Vijay Abraham I
2018-12-04  5:58         ` Kishon Vijay Abraham I
2018-12-04  5:58         ` Kishon Vijay Abraham I
2018-12-04 15:48         ` Maxime Ripard
2018-12-04 15:48           ` Maxime Ripard
2018-12-04 15:48           ` Maxime Ripard
2018-11-06 14:54 ` [PATCH v2 5/9] sun6i: dsi: Convert to generic phy handling Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-06 14:54 ` [PATCH v2 6/9] phy: Move Allwinner A31 D-PHY driver to drivers/phy/ Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-19 17:05   ` Sakari Ailus
2018-11-19 17:05     ` Sakari Ailus
2018-11-19 17:05     ` Sakari Ailus
2018-11-06 14:54 ` [PATCH v2 7/9] drm/bridge: cdns: Separate DSI and D-PHY configuration Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-06 14:54 ` [PATCH v2 8/9] phy: Add Cadence D-PHY support Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-11-12  9:51   ` Kishon Vijay Abraham I
2018-11-12  9:51     ` Kishon Vijay Abraham I
2018-11-12  9:51     ` Kishon Vijay Abraham I
2018-11-16  9:17     ` Maxime Ripard
2018-11-16  9:17       ` Maxime Ripard
2018-11-20  5:32     ` Kishon Vijay Abraham I
2018-11-20  5:32       ` Kishon Vijay Abraham I
2018-11-20  5:32       ` Kishon Vijay Abraham I
2018-11-21 10:11       ` Maxime Ripard
2018-11-21 10:11         ` Maxime Ripard
2018-11-21 10:11         ` Maxime Ripard
2018-11-21 10:29         ` Kishon Vijay Abraham I
2018-11-21 10:29           ` Kishon Vijay Abraham I
2018-11-21 10:29           ` Kishon Vijay Abraham I
2018-11-21 13:47           ` Maxime Ripard
2018-11-21 13:47             ` Maxime Ripard
2018-11-21 13:47             ` Maxime Ripard
2018-11-22  8:46             ` Kishon Vijay Abraham I
2018-11-22  8:46               ` Kishon Vijay Abraham I
2018-11-22  8:46               ` Kishon Vijay Abraham I
2018-11-19 21:24   ` Sakari Ailus
2018-11-19 21:24     ` Sakari Ailus
2018-11-21 13:21     ` Maxime Ripard
2018-11-21 13:21       ` Maxime Ripard
2018-11-06 14:54 ` [PATCH v2 9/9] drm/bridge: cdns: Convert to phy framework Maxime Ripard
2018-11-06 14:54   ` Maxime Ripard
2018-12-07  5:00 ` [PATCH v2 0/9] phy: Add configuration interface for MIPI D-PHY devices Kishon Vijay Abraham I
2018-12-07  5:00   ` Kishon Vijay Abraham I
2018-12-07  5:00   ` Kishon Vijay Abraham I
2018-12-07  9:09   ` Maxime Ripard
2018-12-07  9:09     ` Maxime Ripard
2018-12-07  9:09     ` Maxime Ripard

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=20181114105152.sgk454t34hmzstkn@flea \
    --to=maxime.ripard@bootlin.com \
    --cc=a.hajda@samsung.com \
    --cc=architt@codeaurora.org \
    --cc=boris.brezillon@bootlin.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kishon@ti.com \
    --cc=kwitos@cadence.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=rafalc@cadence.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wens@csie.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.