linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: linux-sunxi@googlegroups.com, Chen-Yu Tsai <wens@csie.org>,
	Rob Herring <robh+dt@kernel.org>, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>,
	Mark Rutland <mark.rutland@arm.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH v5 5/6] drm: sun4i: Add support for enabling DDC I2C bus to sun8i_dw_hdmi glue
Date: Thu, 23 May 2019 14:27:01 +0200	[thread overview]
Message-ID: <20190523122701.qeuthkrczdzngzod@flea> (raw)
In-Reply-To: <20190521121519.k343dgv3cgpewjl2@core.my.home>


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

On Tue, May 21, 2019 at 02:15:19PM +0200, Ondřej Jirman wrote:
> Hi Maxime,
>
> On Tue, May 21, 2019 at 01:46:11PM +0200, Maxime Ripard wrote:
> > Hi,
> >
> > On Tue, May 21, 2019 at 01:50:08AM +0200, megous@megous.com wrote:
> > > From: Ondrej Jirman <megous@megous.com>
> > >
> > > Orange Pi 3 board requires enabling a voltage shifting circuit via GPIO
> > > for the DDC bus to be usable.
> > >
> > > Add support for hdmi-connector node's optional ddc-en-gpios property to
> > > support this use case.
> > >
> > > Signed-off-by: Ondrej Jirman <megous@megous.com>
> > > ---
> > >  drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 55 +++++++++++++++++++++++++--
> > >  drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h |  3 ++
> > >  2 files changed, 55 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
> > > index 39d8509d96a0..59b81ba02d96 100644
> > > --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
> > > +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
> > > @@ -98,6 +98,30 @@ static u32 sun8i_dw_hdmi_find_possible_crtcs(struct drm_device *drm,
> > >  	return crtcs;
> > >  }
> > >
> > > +static int sun8i_dw_hdmi_find_connector_pdev(struct device *dev,
> > > +					     struct platform_device **pdev_out)
> > > +{
> > > +	struct platform_device *pdev;
> > > +	struct device_node *remote;
> > > +
> > > +	remote = of_graph_get_remote_node(dev->of_node, 1, -1);
> > > +	if (!remote)
> > > +		return -ENODEV;
> > > +
> > > +	if (!of_device_is_compatible(remote, "hdmi-connector")) {
> > > +		of_node_put(remote);
> > > +		return -ENODEV;
> > > +	}
> > > +
> > > +	pdev = of_find_device_by_node(remote);
> > > +	of_node_put(remote);
> > > +	if (!pdev)
> > > +		return -ENODEV;
> > > +
> > > +	*pdev_out = pdev;
> > > +	return 0;
> > > +}
> > > +
> > >  static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
> > >  			      void *data)
> > >  {
> > > @@ -151,16 +175,29 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
> > >  		return PTR_ERR(hdmi->regulator);
> > >  	}
> > >
> > > +	ret = sun8i_dw_hdmi_find_connector_pdev(dev, &hdmi->connector_pdev);
> > > +	if (!ret) {
> > > +		hdmi->ddc_en = gpiod_get_optional(&hdmi->connector_pdev->dev,
> > > +						  "ddc-en", GPIOD_OUT_HIGH);
> > > +		if (IS_ERR(hdmi->ddc_en)) {
> > > +			platform_device_put(hdmi->connector_pdev);
> > > +			dev_err(dev, "Couldn't get ddc-en gpio\n");
> > > +			return PTR_ERR(hdmi->ddc_en);
> > > +		}
> > > +	}
> > > +
> > >  	ret = regulator_enable(hdmi->regulator);
> > >  	if (ret) {
> > >  		dev_err(dev, "Failed to enable regulator\n");
> > > -		return ret;
> > > +		goto err_unref_ddc_en;
> > >  	}
> > >
> > > +	gpiod_set_value(hdmi->ddc_en, 1);
> > > +
> >
> > Do you really need this to be done all the time? I'm guessing you
> > would only need this when running .get_modes, right?
>
> I don't think it hurts anything. Enabled voltage shifting circuit doesn't
> draw any current, unless DDC is actually transmitting data. On most boards
> I'd imagine this circuit is always on anyway (Orange Pi 3 schematic even has
> an option to tie this signal to VCC-IO instead of GPIO).

Ok, it works for me then

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: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-05-23 12:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20 23:50 [PATCH v5 0/6] Add support for Orange Pi 3 megous
2019-05-20 23:50 ` [PATCH v5 1/6] net: stmmac: sun8i: add support for Allwinner H6 EMAC megous
2019-05-20 23:50 ` [PATCH v5 2/6] net: stmmac: sun8i: force select external PHY when no internal one megous
2019-05-21  9:27   ` Sergei Shtylyov
2019-05-21  9:56     ` Ondřej Jirman
2019-05-20 23:50 ` [PATCH v5 3/6] arm64: dts: allwinner: orange-pi-3: Enable ethernet megous
2019-05-20 23:50 ` [PATCH v5 4/6] dt-bindings: display: hdmi-connector: Support DDC bus enable megous
2019-05-24 21:55   ` Rob Herring
2019-05-20 23:50 ` [PATCH v5 5/6] drm: sun4i: Add support for enabling DDC I2C bus to sun8i_dw_hdmi glue megous
2019-05-21 11:46   ` Maxime Ripard
2019-05-21 12:15     ` Ondřej Jirman
2019-05-23 12:27       ` Maxime Ripard [this message]
2019-05-20 23:50 ` [PATCH v5 6/6] arm64: dts: allwinner: orange-pi-3: Enable HDMI output megous

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=20190523122701.qeuthkrczdzngzod@flea \
    --to=maxime.ripard@bootlin.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@st.com \
    --cc=daniel@ffwll.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=joabreu@synopsys.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mark.rutland@arm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=robh+dt@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).