RE: [PATCH v2 2/3] drm/bridge: lvds-codec: Add support for regulator

2020-08-12 Thread Biju Das
Hi Laurent,

Thanks for the feedback.

> Subject: Re: [PATCH v2 2/3] drm/bridge: lvds-codec: Add support for
> regulator
>
> Hi Biju,
>
> Thank you for the patch.
>
> On Mon, Aug 10, 2020 at 04:22:18PM +0100, Biju Das wrote:
> > Add the support for enabling optional regulator that may be used as
> > VCC source.
> >
> > Signed-off-by: Biju Das 
> > ---
> > New Patch Ref: Ref:https://patchwork.kernel.org/patch/11705819/
> > ---
> >  drivers/gpu/drm/bridge/lvds-codec.c | 29
> > +
> >  1 file changed, 29 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/lvds-codec.c
> > b/drivers/gpu/drm/bridge/lvds-codec.c
> > index 24fb1befdfa2..5858a29aafe6 100644
> > --- a/drivers/gpu/drm/bridge/lvds-codec.c
> > +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> > @@ -10,13 +10,16 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #include 
> >  #include 
> >
> >  struct lvds_codec {
> > +struct device *dev;
> >  struct drm_bridge bridge;
> >  struct drm_bridge *panel_bridge;
> > +struct regulator *vcc;
> >  struct gpio_desc *powerdown_gpio;
> >  u32 connector_type;
> >  };
> > @@ -38,6 +41,14 @@ static int lvds_codec_attach(struct drm_bridge
> > *bridge,  static void lvds_codec_enable(struct drm_bridge *bridge)  {
> >  struct lvds_codec *lvds_codec = to_lvds_codec(bridge);
> > +int ret;
> > +
> > +ret = regulator_enable(lvds_codec->vcc);
> > +if (ret) {
> > +dev_err(lvds_codec->dev,
> > +"Failed to enable regulator \"vcc\": %d\n", ret);
> > +return;
> > +}
> >
> >  if (lvds_codec->powerdown_gpio)
> >  gpiod_set_value_cansleep(lvds_codec->powerdown_gpio,
> 0); @@ -46,9
> > +57,15 @@ static void lvds_codec_enable(struct drm_bridge *bridge)
> > static void lvds_codec_disable(struct drm_bridge *bridge)  {
> >  struct lvds_codec *lvds_codec = to_lvds_codec(bridge);
> > +int ret;
> >
> >  if (lvds_codec->powerdown_gpio)
> >  gpiod_set_value_cansleep(lvds_codec->powerdown_gpio,
> 1);
> > +
> > +ret = regulator_disable(lvds_codec->vcc);
> > +if (ret)
> > +dev_err(lvds_codec->dev,
> > +"Failed to disable regulator \"vcc\": %d\n", ret);
> >  }
> >
> >  static const struct drm_bridge_funcs funcs = { @@ -63,12 +80,24 @@
> > static int lvds_codec_probe(struct platform_device *pdev)
> >  struct device_node *panel_node;
> >  struct drm_panel *panel;
> >  struct lvds_codec *lvds_codec;
> > +int error;
>
> The driver tends to use "ret" for error status variables. If you're fine with 
> this
> change there's no need to resubmit the patch, I can fix when applying.

Yes, I am ok with that.

Cheers,
Biju


> Reviewed-by: Laurent Pinchart 
>


Renesas Electronics Europe GmbH, Geschaeftsfuehrer/President: Carsten Jauch, 
Sitz der Gesellschaft/Registered office: Duesseldorf, Arcadiastrasse 10, 40472 
Duesseldorf, Germany, Handelsregister/Commercial Register: Duesseldorf, HRB 
3708 USt-IDNr./Tax identification no.: DE 119353406 WEEE-Reg.-Nr./WEEE reg. 
no.: DE 14978647
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/3] drm/bridge: lvds-codec: Add support for regulator

2020-08-11 Thread Laurent Pinchart
Hi Biju,

Thank you for the patch.

On Mon, Aug 10, 2020 at 04:22:18PM +0100, Biju Das wrote:
> Add the support for enabling optional regulator that may be used as VCC
> source.
> 
> Signed-off-by: Biju Das 
> ---
> New Patch Ref: Ref:https://patchwork.kernel.org/patch/11705819/
> ---
>  drivers/gpu/drm/bridge/lvds-codec.c | 29 +
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/lvds-codec.c 
> b/drivers/gpu/drm/bridge/lvds-codec.c
> index 24fb1befdfa2..5858a29aafe6 100644
> --- a/drivers/gpu/drm/bridge/lvds-codec.c
> +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> @@ -10,13 +10,16 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
>  
>  struct lvds_codec {
> + struct device *dev;
>   struct drm_bridge bridge;
>   struct drm_bridge *panel_bridge;
> + struct regulator *vcc;
>   struct gpio_desc *powerdown_gpio;
>   u32 connector_type;
>  };
> @@ -38,6 +41,14 @@ static int lvds_codec_attach(struct drm_bridge *bridge,
>  static void lvds_codec_enable(struct drm_bridge *bridge)
>  {
>   struct lvds_codec *lvds_codec = to_lvds_codec(bridge);
> + int ret;
> +
> + ret = regulator_enable(lvds_codec->vcc);
> + if (ret) {
> + dev_err(lvds_codec->dev,
> + "Failed to enable regulator \"vcc\": %d\n", ret);
> + return;
> + }
>  
>   if (lvds_codec->powerdown_gpio)
>   gpiod_set_value_cansleep(lvds_codec->powerdown_gpio, 0);
> @@ -46,9 +57,15 @@ static void lvds_codec_enable(struct drm_bridge *bridge)
>  static void lvds_codec_disable(struct drm_bridge *bridge)
>  {
>   struct lvds_codec *lvds_codec = to_lvds_codec(bridge);
> + int ret;
>  
>   if (lvds_codec->powerdown_gpio)
>   gpiod_set_value_cansleep(lvds_codec->powerdown_gpio, 1);
> +
> + ret = regulator_disable(lvds_codec->vcc);
> + if (ret)
> + dev_err(lvds_codec->dev,
> + "Failed to disable regulator \"vcc\": %d\n", ret);
>  }
>  
>  static const struct drm_bridge_funcs funcs = {
> @@ -63,12 +80,24 @@ static int lvds_codec_probe(struct platform_device *pdev)
>   struct device_node *panel_node;
>   struct drm_panel *panel;
>   struct lvds_codec *lvds_codec;
> + int error;

The driver tends to use "ret" for error status variables. If you're fine
with this change there's no need to resubmit the patch, I can fix when
applying.

Reviewed-by: Laurent Pinchart 

>  
>   lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL);
>   if (!lvds_codec)
>   return -ENOMEM;
>  
> + lvds_codec->dev = >dev;
>   lvds_codec->connector_type = (uintptr_t)of_device_get_match_data(dev);
> +
> + lvds_codec->vcc = devm_regulator_get(lvds_codec->dev, "vcc");
> + if (IS_ERR(lvds_codec->vcc)) {
> + error = PTR_ERR(lvds_codec->vcc);
> + if (error != -EPROBE_DEFER)
> + dev_err(lvds_codec->dev,
> + "Unable to get \"vcc\" supply: %d\n", error);
> + return error;
> + }
> +
>   lvds_codec->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown",
>GPIOD_OUT_HIGH);
>   if (IS_ERR(lvds_codec->powerdown_gpio)) {

-- 
Regards,

Laurent Pinchart
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 2/3] drm/bridge: lvds-codec: Add support for regulator

2020-08-11 Thread Biju Das
Add the support for enabling optional regulator that may be used as VCC
source.

Signed-off-by: Biju Das 
---
New Patch Ref: Ref:https://patchwork.kernel.org/patch/11705819/
---
 drivers/gpu/drm/bridge/lvds-codec.c | 29 +
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/bridge/lvds-codec.c 
b/drivers/gpu/drm/bridge/lvds-codec.c
index 24fb1befdfa2..5858a29aafe6 100644
--- a/drivers/gpu/drm/bridge/lvds-codec.c
+++ b/drivers/gpu/drm/bridge/lvds-codec.c
@@ -10,13 +10,16 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 
 struct lvds_codec {
+   struct device *dev;
struct drm_bridge bridge;
struct drm_bridge *panel_bridge;
+   struct regulator *vcc;
struct gpio_desc *powerdown_gpio;
u32 connector_type;
 };
@@ -38,6 +41,14 @@ static int lvds_codec_attach(struct drm_bridge *bridge,
 static void lvds_codec_enable(struct drm_bridge *bridge)
 {
struct lvds_codec *lvds_codec = to_lvds_codec(bridge);
+   int ret;
+
+   ret = regulator_enable(lvds_codec->vcc);
+   if (ret) {
+   dev_err(lvds_codec->dev,
+   "Failed to enable regulator \"vcc\": %d\n", ret);
+   return;
+   }
 
if (lvds_codec->powerdown_gpio)
gpiod_set_value_cansleep(lvds_codec->powerdown_gpio, 0);
@@ -46,9 +57,15 @@ static void lvds_codec_enable(struct drm_bridge *bridge)
 static void lvds_codec_disable(struct drm_bridge *bridge)
 {
struct lvds_codec *lvds_codec = to_lvds_codec(bridge);
+   int ret;
 
if (lvds_codec->powerdown_gpio)
gpiod_set_value_cansleep(lvds_codec->powerdown_gpio, 1);
+
+   ret = regulator_disable(lvds_codec->vcc);
+   if (ret)
+   dev_err(lvds_codec->dev,
+   "Failed to disable regulator \"vcc\": %d\n", ret);
 }
 
 static const struct drm_bridge_funcs funcs = {
@@ -63,12 +80,24 @@ static int lvds_codec_probe(struct platform_device *pdev)
struct device_node *panel_node;
struct drm_panel *panel;
struct lvds_codec *lvds_codec;
+   int error;
 
lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL);
if (!lvds_codec)
return -ENOMEM;
 
+   lvds_codec->dev = >dev;
lvds_codec->connector_type = (uintptr_t)of_device_get_match_data(dev);
+
+   lvds_codec->vcc = devm_regulator_get(lvds_codec->dev, "vcc");
+   if (IS_ERR(lvds_codec->vcc)) {
+   error = PTR_ERR(lvds_codec->vcc);
+   if (error != -EPROBE_DEFER)
+   dev_err(lvds_codec->dev,
+   "Unable to get \"vcc\" supply: %d\n", error);
+   return error;
+   }
+
lvds_codec->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown",
 GPIOD_OUT_HIGH);
if (IS_ERR(lvds_codec->powerdown_gpio)) {
-- 
2.17.1

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