All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yannick FERTRE <yannick.fertre@st.com>
To: Philippe CORNU <philippe.cornu@st.com>,
	Archit Taneja <architt@codeaurora.org>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	David Airlie <airlied@linux.ie>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Alexandre TORGUE <alexandre.torgue@st.com>
Subject: Re: [PATCH 2/2] drm/bridge: sii902x: add optional power supplies
Date: Mon, 16 Apr 2018 09:20:29 +0000	[thread overview]
Message-ID: <f0c50499-4323-5d66-7e4c-dd61a24e3f4b@st.com> (raw)
In-Reply-To: <20180410051927.8268-3-philippe.cornu@st.com>


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

Reviewed-by: yannick fertre <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

On 04/10/2018 07:19 AM, Philippe Cornu wrote:

Add the 3 optional power supplies using the exact description
found in the document named
"SiI9022A/SiI9024A HDMI Transmitter Data Sheet (August 2016)".

Signed-off-by: Philippe Cornu <philippe.cornu@st.com><mailto:philippe.cornu@st.com>
---
 drivers/gpu/drm/bridge/sii902x.c | 39 +++++++++++++++++++++++++++++++++++----
 1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 60373d7eb220..e17ba6db1ec8 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -24,6 +24,7 @@
 #include <linux/i2c.h>
 #include <linux/module.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>

 #include <drm/drmP.h>
 #include <drm/drm_atomic_helper.h>
@@ -86,6 +87,7 @@ struct sii902x {
        struct drm_bridge bridge;
        struct drm_connector connector;
        struct gpio_desc *reset_gpio;
+       struct regulator_bulk_data supplies[3];
 };

 static inline struct sii902x *bridge_to_sii902x(struct drm_bridge *bridge)
@@ -392,23 +394,43 @@ static int sii902x_probe(struct i2c_client *client,
                return PTR_ERR(sii902x->reset_gpio);
        }

+       sii902x->supplies[0].supply = "iovcc";
+       sii902x->supplies[1].supply = "avcc12";
+       sii902x->supplies[2].supply = "cvcc12";
+       ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sii902x->supplies),
+                                     sii902x->supplies);
+       if (ret) {
+               dev_err(dev, "regulator_bulk_get failed\n");
+               return ret;
+       }
+
+       ret = regulator_bulk_enable(ARRAY_SIZE(sii902x->supplies),
+                                   sii902x->supplies);
+       if (ret) {
+               dev_err(dev, "regulator_bulk_enable failed\n");
+               return ret;
+       }
+
+       usleep_range(10000, 20000);
+
        sii902x_reset(sii902x);

        ret = regmap_write(sii902x->regmap, SII902X_REG_TPI_RQB, 0x0);
        if (ret)
-               return ret;
+               goto err_disable_regulator;

        ret = regmap_bulk_read(sii902x->regmap, SII902X_REG_CHIPID(0),
                               &chipid, 4);
        if (ret) {
                dev_err(dev, "regmap_read failed %d\n", ret);
-               return ret;
+               goto err_disable_regulator;
        }

        if (chipid[0] != 0xb0) {
                dev_err(dev, "Invalid chipid: %02x (expecting 0xb0)\n",
                        chipid[0]);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto err_disable_regulator;
        }

        /* Clear all pending interrupts */
@@ -424,7 +446,7 @@ static int sii902x_probe(struct i2c_client *client,
                                                IRQF_ONESHOT, dev_name(dev),
                                                sii902x);
                if (ret)
-                       return ret;
+                       goto err_disable_regulator;
        }

        sii902x->bridge.funcs = &sii902x_bridge_funcs;
@@ -434,6 +456,12 @@ static int sii902x_probe(struct i2c_client *client,
        i2c_set_clientdata(client, sii902x);

        return 0;
+
+err_disable_regulator:
+       regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
+                              sii902x->supplies);
+
+       return ret;
 }

 static int sii902x_remove(struct i2c_client *client)
@@ -443,6 +471,9 @@ static int sii902x_remove(struct i2c_client *client)

        drm_bridge_remove(&sii902x->bridge);

+       regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
+                              sii902x->supplies);
+
        return 0;
 }




[-- Attachment #1.2: Type: text/html, Size: 4266 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-04-16  9:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10  5:19 [PATCH 0/2] drm/bridge: sii902x: add optional power supplies Philippe Cornu
2018-04-10  5:19 ` Philippe Cornu
2018-04-10  5:19 ` [PATCH 1/2] dt-bindings/display/bridge: " Philippe Cornu
2018-04-10  5:19   ` Philippe Cornu
2018-04-13 17:58   ` Rob Herring
2018-04-13 17:58     ` Rob Herring
2018-04-19  8:11   ` Laurent Pinchart
2018-04-19  8:11     ` Laurent Pinchart
2018-04-19  9:31     ` Philippe CORNU
2018-04-19  9:31       ` Philippe CORNU
2018-04-19 11:09       ` Laurent Pinchart
2018-04-19 11:09         ` Laurent Pinchart
2018-04-19 12:41         ` Philippe CORNU
2018-04-19 12:41           ` Philippe CORNU
2018-04-19 12:50           ` Laurent Pinchart
2018-04-10  5:19 ` [PATCH 2/2] drm/bridge: " Philippe Cornu
2018-04-10  5:19   ` Philippe Cornu
2018-04-16  9:20   ` Yannick FERTRE [this message]
2018-04-19  8:20   ` Laurent Pinchart
2018-04-19  8:20     ` Laurent Pinchart
2018-04-19  9:46     ` Philippe CORNU
2018-04-19  9:46       ` Philippe CORNU
2018-04-19 11:00       ` Laurent Pinchart
2018-04-19 11:00         ` Laurent Pinchart

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=f0c50499-4323-5d66-7e4c-dd61a24e3f4b@st.com \
    --to=yannick.fertre@st.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@st.com \
    --cc=architt@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=philippe.cornu@st.com \
    --cc=robh+dt@kernel.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.