All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@csie.org>
To: David Airlie <airlied@linux.ie>
Cc: Chen-Yu Tsai <wens@csie.org>, Rob Herring <robh@kernel.org>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Mark Rutland <mark.rutland@arm.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	linux-sunxi <linux-sunxi@googlegroups.com>
Subject: Re: [linux-sunxi] Re: [PATCH v3 1/2] drm/bridge: dumb-vga-dac: Support a VDD regulator supply
Date: Tue, 15 Nov 2016 10:59:49 +0800	[thread overview]
Message-ID: <CAGb2v67LR4KEb0tfGkT8+TqTauNyCMq1n6mRdXsa6TUJV0xncA@mail.gmail.com> (raw)
In-Reply-To: <CAGb2v64tTacSAG1vvO28h8MN9JC9w+OzSrP+j2eTzqAiQKgaSA@mail.gmail.com>

Hi,

On Wed, Nov 2, 2016 at 9:33 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> On Mon, Oct 31, 2016 at 2:28 PM, Rob Herring <robh@kernel.org> wrote:
>> On Sat, Oct 29, 2016 at 07:06:10PM +0800, Chen-Yu Tsai wrote:
>>> Some dumb VGA DACs are active components which require external power.
>>> Add support for specifying a regulator as its power supply.
>>>
>>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>>> ---
>>>  .../bindings/display/bridge/dumb-vga-dac.txt       |  2 ++
>>
>> For the binding,
>>
>> Acked-by: Rob Herring <robh@kernel.org>

Any comments on this patch from the DRM people?

ChenYu

>>
>> One code comment below...
>>
>>>  drivers/gpu/drm/bridge/dumb-vga-dac.c              | 35 ++++++++++++++++++++++
>>>  2 files changed, 37 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt b/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
>>> index 003bc246a270..164cbb15f04c 100644
>>> --- a/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
>>> +++ b/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
>>> @@ -16,6 +16,8 @@ graph bindings specified in Documentation/devicetree/bindings/graph.txt.
>>>  - Video port 0 for RGB input
>>>  - Video port 1 for VGA output
>>>
>>> +Optional properties:
>>> +- vdd-supply: Power supply for DAC
>>>
>>>  Example
>>>  -------
>>> diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c
>>> index afec232185a7..59781e031220 100644
>>> --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
>>> +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
>>> @@ -12,6 +12,7 @@
>>>
>>>  #include <linux/module.h>
>>>  #include <linux/of_graph.h>
>>> +#include <linux/regulator/consumer.h>
>>>
>>>  #include <drm/drmP.h>
>>>  #include <drm/drm_atomic_helper.h>
>>> @@ -23,6 +24,7 @@ struct dumb_vga {
>>>       struct drm_connector    connector;
>>>
>>>       struct i2c_adapter      *ddc;
>>> +     struct regulator        *vdd;
>>>  };
>>>
>>>  static inline struct dumb_vga *
>>> @@ -124,8 +126,33 @@ static int dumb_vga_attach(struct drm_bridge *bridge)
>>>       return 0;
>>>  }
>>>
>>> +static void dumb_vga_enable(struct drm_bridge *bridge)
>>> +{
>>> +     struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge);
>>> +     int ret;
>>> +
>>> +     if (!IS_ERR(vga->vdd)) {
>>
>> if (IS_ERR())
>>         return;
>>
>> ...will save some intentation.
>
> I thought about that, though if someone were to add more stuff to
> this, such as an enable GPIO, they might have to rework it. A standalone
> block of code would be easier to work with. I'm OK either way though.
>
> ChenYu
>
>>
>>> +             ret = regulator_enable(vga->vdd);
>>> +
>>> +             if (ret) {
>>> +                     DRM_ERROR("Failed to enable vdd regulator: %d\n", ret);
>>> +                     return;
>>> +             }
>>> +     }
>>> +}
>>> +
>>> +static void dumb_vga_disable(struct drm_bridge *bridge)
>>> +{
>>> +     struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge);
>>> +
>>> +     if (!IS_ERR(vga->vdd))
>>> +             regulator_disable(vga->vdd);
>>> +}
>>> +
>>>  static const struct drm_bridge_funcs dumb_vga_bridge_funcs = {
>>>       .attach         = dumb_vga_attach,
>>> +     .enable         = dumb_vga_enable,
>>> +     .disable        = dumb_vga_disable,
>>>  };
>>>
>>>  static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev)
>>> @@ -169,6 +196,14 @@ static int dumb_vga_probe(struct platform_device *pdev)
>>>               return -ENOMEM;
>>>       platform_set_drvdata(pdev, vga);
>>>
>>> +     vga->vdd = devm_regulator_get_optional(&pdev->dev, "vdd");
>>> +     if (IS_ERR(vga->vdd)) {
>>> +             ret = PTR_ERR(vga->vdd);
>>> +             if (ret == -EPROBE_DEFER)
>>> +                     return -EPROBE_DEFER;
>>> +             dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret);
>>> +     }
>>> +
>>>       vga->ddc = dumb_vga_retrieve_ddc(&pdev->dev);
>>>       if (IS_ERR(vga->ddc)) {
>>>               if (PTR_ERR(vga->ddc) == -ENODEV) {
>>> --
>>> 2.9.3
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
To: David Airlie <airlied-cv59FeDIM0c@public.gmane.org>
Cc: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	dri-devel
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	linux-arm-kernel
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	linux-kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-sunxi <linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Re: [PATCH v3 1/2] drm/bridge: dumb-vga-dac: Support a VDD regulator supply
Date: Tue, 15 Nov 2016 10:59:49 +0800	[thread overview]
Message-ID: <CAGb2v67LR4KEb0tfGkT8+TqTauNyCMq1n6mRdXsa6TUJV0xncA@mail.gmail.com> (raw)
In-Reply-To: <CAGb2v64tTacSAG1vvO28h8MN9JC9w+OzSrP+j2eTzqAiQKgaSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi,

On Wed, Nov 2, 2016 at 9:33 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> On Mon, Oct 31, 2016 at 2:28 PM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>> On Sat, Oct 29, 2016 at 07:06:10PM +0800, Chen-Yu Tsai wrote:
>>> Some dumb VGA DACs are active components which require external power.
>>> Add support for specifying a regulator as its power supply.
>>>
>>> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>>> ---
>>>  .../bindings/display/bridge/dumb-vga-dac.txt       |  2 ++
>>
>> For the binding,
>>
>> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Any comments on this patch from the DRM people?

ChenYu

>>
>> One code comment below...
>>
>>>  drivers/gpu/drm/bridge/dumb-vga-dac.c              | 35 ++++++++++++++++++++++
>>>  2 files changed, 37 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt b/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
>>> index 003bc246a270..164cbb15f04c 100644
>>> --- a/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
>>> +++ b/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
>>> @@ -16,6 +16,8 @@ graph bindings specified in Documentation/devicetree/bindings/graph.txt.
>>>  - Video port 0 for RGB input
>>>  - Video port 1 for VGA output
>>>
>>> +Optional properties:
>>> +- vdd-supply: Power supply for DAC
>>>
>>>  Example
>>>  -------
>>> diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c
>>> index afec232185a7..59781e031220 100644
>>> --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
>>> +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
>>> @@ -12,6 +12,7 @@
>>>
>>>  #include <linux/module.h>
>>>  #include <linux/of_graph.h>
>>> +#include <linux/regulator/consumer.h>
>>>
>>>  #include <drm/drmP.h>
>>>  #include <drm/drm_atomic_helper.h>
>>> @@ -23,6 +24,7 @@ struct dumb_vga {
>>>       struct drm_connector    connector;
>>>
>>>       struct i2c_adapter      *ddc;
>>> +     struct regulator        *vdd;
>>>  };
>>>
>>>  static inline struct dumb_vga *
>>> @@ -124,8 +126,33 @@ static int dumb_vga_attach(struct drm_bridge *bridge)
>>>       return 0;
>>>  }
>>>
>>> +static void dumb_vga_enable(struct drm_bridge *bridge)
>>> +{
>>> +     struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge);
>>> +     int ret;
>>> +
>>> +     if (!IS_ERR(vga->vdd)) {
>>
>> if (IS_ERR())
>>         return;
>>
>> ...will save some intentation.
>
> I thought about that, though if someone were to add more stuff to
> this, such as an enable GPIO, they might have to rework it. A standalone
> block of code would be easier to work with. I'm OK either way though.
>
> ChenYu
>
>>
>>> +             ret = regulator_enable(vga->vdd);
>>> +
>>> +             if (ret) {
>>> +                     DRM_ERROR("Failed to enable vdd regulator: %d\n", ret);
>>> +                     return;
>>> +             }
>>> +     }
>>> +}
>>> +
>>> +static void dumb_vga_disable(struct drm_bridge *bridge)
>>> +{
>>> +     struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge);
>>> +
>>> +     if (!IS_ERR(vga->vdd))
>>> +             regulator_disable(vga->vdd);
>>> +}
>>> +
>>>  static const struct drm_bridge_funcs dumb_vga_bridge_funcs = {
>>>       .attach         = dumb_vga_attach,
>>> +     .enable         = dumb_vga_enable,
>>> +     .disable        = dumb_vga_disable,
>>>  };
>>>
>>>  static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev)
>>> @@ -169,6 +196,14 @@ static int dumb_vga_probe(struct platform_device *pdev)
>>>               return -ENOMEM;
>>>       platform_set_drvdata(pdev, vga);
>>>
>>> +     vga->vdd = devm_regulator_get_optional(&pdev->dev, "vdd");
>>> +     if (IS_ERR(vga->vdd)) {
>>> +             ret = PTR_ERR(vga->vdd);
>>> +             if (ret == -EPROBE_DEFER)
>>> +                     return -EPROBE_DEFER;
>>> +             dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret);
>>> +     }
>>> +
>>>       vga->ddc = dumb_vga_retrieve_ddc(&pdev->dev);
>>>       if (IS_ERR(vga->ddc)) {
>>>               if (PTR_ERR(vga->ddc) == -ENODEV) {
>>> --
>>> 2.9.3
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: wens@csie.org (Chen-Yu Tsai)
To: linux-arm-kernel@lists.infradead.org
Subject: [linux-sunxi] Re: [PATCH v3 1/2] drm/bridge: dumb-vga-dac: Support a VDD regulator supply
Date: Tue, 15 Nov 2016 10:59:49 +0800	[thread overview]
Message-ID: <CAGb2v67LR4KEb0tfGkT8+TqTauNyCMq1n6mRdXsa6TUJV0xncA@mail.gmail.com> (raw)
In-Reply-To: <CAGb2v64tTacSAG1vvO28h8MN9JC9w+OzSrP+j2eTzqAiQKgaSA@mail.gmail.com>

Hi,

On Wed, Nov 2, 2016 at 9:33 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> On Mon, Oct 31, 2016 at 2:28 PM, Rob Herring <robh@kernel.org> wrote:
>> On Sat, Oct 29, 2016 at 07:06:10PM +0800, Chen-Yu Tsai wrote:
>>> Some dumb VGA DACs are active components which require external power.
>>> Add support for specifying a regulator as its power supply.
>>>
>>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>>> ---
>>>  .../bindings/display/bridge/dumb-vga-dac.txt       |  2 ++
>>
>> For the binding,
>>
>> Acked-by: Rob Herring <robh@kernel.org>

Any comments on this patch from the DRM people?

ChenYu

>>
>> One code comment below...
>>
>>>  drivers/gpu/drm/bridge/dumb-vga-dac.c              | 35 ++++++++++++++++++++++
>>>  2 files changed, 37 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt b/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
>>> index 003bc246a270..164cbb15f04c 100644
>>> --- a/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
>>> +++ b/Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
>>> @@ -16,6 +16,8 @@ graph bindings specified in Documentation/devicetree/bindings/graph.txt.
>>>  - Video port 0 for RGB input
>>>  - Video port 1 for VGA output
>>>
>>> +Optional properties:
>>> +- vdd-supply: Power supply for DAC
>>>
>>>  Example
>>>  -------
>>> diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c
>>> index afec232185a7..59781e031220 100644
>>> --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
>>> +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
>>> @@ -12,6 +12,7 @@
>>>
>>>  #include <linux/module.h>
>>>  #include <linux/of_graph.h>
>>> +#include <linux/regulator/consumer.h>
>>>
>>>  #include <drm/drmP.h>
>>>  #include <drm/drm_atomic_helper.h>
>>> @@ -23,6 +24,7 @@ struct dumb_vga {
>>>       struct drm_connector    connector;
>>>
>>>       struct i2c_adapter      *ddc;
>>> +     struct regulator        *vdd;
>>>  };
>>>
>>>  static inline struct dumb_vga *
>>> @@ -124,8 +126,33 @@ static int dumb_vga_attach(struct drm_bridge *bridge)
>>>       return 0;
>>>  }
>>>
>>> +static void dumb_vga_enable(struct drm_bridge *bridge)
>>> +{
>>> +     struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge);
>>> +     int ret;
>>> +
>>> +     if (!IS_ERR(vga->vdd)) {
>>
>> if (IS_ERR())
>>         return;
>>
>> ...will save some intentation.
>
> I thought about that, though if someone were to add more stuff to
> this, such as an enable GPIO, they might have to rework it. A standalone
> block of code would be easier to work with. I'm OK either way though.
>
> ChenYu
>
>>
>>> +             ret = regulator_enable(vga->vdd);
>>> +
>>> +             if (ret) {
>>> +                     DRM_ERROR("Failed to enable vdd regulator: %d\n", ret);
>>> +                     return;
>>> +             }
>>> +     }
>>> +}
>>> +
>>> +static void dumb_vga_disable(struct drm_bridge *bridge)
>>> +{
>>> +     struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge);
>>> +
>>> +     if (!IS_ERR(vga->vdd))
>>> +             regulator_disable(vga->vdd);
>>> +}
>>> +
>>>  static const struct drm_bridge_funcs dumb_vga_bridge_funcs = {
>>>       .attach         = dumb_vga_attach,
>>> +     .enable         = dumb_vga_enable,
>>> +     .disable        = dumb_vga_disable,
>>>  };
>>>
>>>  static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev)
>>> @@ -169,6 +196,14 @@ static int dumb_vga_probe(struct platform_device *pdev)
>>>               return -ENOMEM;
>>>       platform_set_drvdata(pdev, vga);
>>>
>>> +     vga->vdd = devm_regulator_get_optional(&pdev->dev, "vdd");
>>> +     if (IS_ERR(vga->vdd)) {
>>> +             ret = PTR_ERR(vga->vdd);
>>> +             if (ret == -EPROBE_DEFER)
>>> +                     return -EPROBE_DEFER;
>>> +             dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret);
>>> +     }
>>> +
>>>       vga->ddc = dumb_vga_retrieve_ddc(&pdev->dev);
>>>       if (IS_ERR(vga->ddc)) {
>>>               if (PTR_ERR(vga->ddc) == -ENODEV) {
>>> --
>>> 2.9.3
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

  reply	other threads:[~2016-11-15  3:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-29 11:06 [PATCH v3 0/2] ARM: dts: sun6i: hummingbird-a31: Enable display output through VGA bridge Chen-Yu Tsai
2016-10-29 11:06 ` Chen-Yu Tsai
2016-10-29 11:06 ` [PATCH v3 1/2] drm/bridge: dumb-vga-dac: Support a VDD regulator supply Chen-Yu Tsai
2016-10-29 11:06   ` Chen-Yu Tsai
2016-10-31  6:28   ` Rob Herring
2016-10-31  6:28     ` Rob Herring
2016-10-31  6:28     ` Rob Herring
2016-11-02  1:33     ` [linux-sunxi] " Chen-Yu Tsai
2016-11-02  1:33       ` Chen-Yu Tsai
2016-11-02  1:33       ` Chen-Yu Tsai
2016-11-15  2:59       ` Chen-Yu Tsai [this message]
2016-11-15  2:59         ` [linux-sunxi] " Chen-Yu Tsai
2016-11-15  2:59         ` Chen-Yu Tsai
2016-11-16  8:17         ` [linux-sunxi] " Archit Taneja
2016-11-16  8:17           ` Archit Taneja
2016-11-16  8:17           ` Archit Taneja
2016-10-29 11:06 ` [PATCH v3 2/2] ARM: dts: sun6i: hummingbird-a31: Enable display output through VGA bridge Chen-Yu Tsai
2016-10-29 11:06   ` Chen-Yu Tsai
2016-10-29 11:06   ` Chen-Yu Tsai

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=CAGb2v67LR4KEb0tfGkT8+TqTauNyCMq1n6mRdXsa6TUJV0xncA@mail.gmail.com \
    --to=wens@csie.org \
    --cc=airlied@linux.ie \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=robh@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.