* [PATCH v3] drm/bridge: lvds-codec: Add support for regulator
@ 2020-09-22 10:55 Laurent Pinchart
2020-09-22 11:01 ` Biju Das
2020-10-16 21:04 ` Sam Ravnborg
0 siblings, 2 replies; 4+ messages in thread
From: Laurent Pinchart @ 2020-09-22 10:55 UTC (permalink / raw)
To: dri-devel; +Cc: linux-renesas-soc, Biju Das, Andrzej Hajda, Neil Armstrong
From: Biju Das <biju.das.jz@bp.renesas.com>
Add the support for enabling optional regulator that may be used as VCC
source.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Replaced 'error' variable with 'ret']
[Renamed regulator from 'vcc' to 'power']
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
Changes since v2:
- Use the correct regulator name
---
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 f19d9f7a5db2..f52ccffc1bd1 100644
--- a/drivers/gpu/drm/bridge/lvds-codec.c
+++ b/drivers/gpu/drm/bridge/lvds-codec.c
@@ -10,13 +10,16 @@
#include <linux/of_device.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
#include <drm/drm_bridge.h>
#include <drm/drm_panel.h>
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 ret;
lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL);
if (!lvds_codec)
return -ENOMEM;
+ lvds_codec->dev = &pdev->dev;
lvds_codec->connector_type = (uintptr_t)of_device_get_match_data(dev);
+
+ lvds_codec->vcc = devm_regulator_get(lvds_codec->dev, "power");
+ if (IS_ERR(lvds_codec->vcc)) {
+ ret = PTR_ERR(lvds_codec->vcc);
+ if (ret != -EPROBE_DEFER)
+ dev_err(lvds_codec->dev,
+ "Unable to get \"vcc\" supply: %d\n", ret);
+ return ret;
+ }
+
lvds_codec->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown",
GPIOD_OUT_HIGH);
if (IS_ERR(lvds_codec->powerdown_gpio))
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH v3] drm/bridge: lvds-codec: Add support for regulator
2020-09-22 10:55 [PATCH v3] drm/bridge: lvds-codec: Add support for regulator Laurent Pinchart
@ 2020-09-22 11:01 ` Biju Das
2020-10-16 21:04 ` Sam Ravnborg
1 sibling, 0 replies; 4+ messages in thread
From: Biju Das @ 2020-09-22 11:01 UTC (permalink / raw)
To: Laurent Pinchart, dri-devel
Cc: linux-renesas-soc, Andrzej Hajda, Neil Armstrong
Hi Laurent,
Thanks for the patch.
> Subject: [PATCH v3] drm/bridge: lvds-codec: Add support for regulator
>
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> Add the support for enabling optional regulator that may be used as VCC
> source.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> [Replaced 'error' variable with 'ret']
> [Renamed regulator from 'vcc' to 'power']
> Signed-off-by: Laurent Pinchart
> <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Cheers,
Biju
> ---
> Changes since v2:
>
> - Use the correct regulator name
> ---
> 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 f19d9f7a5db2..f52ccffc1bd1 100644
> --- a/drivers/gpu/drm/bridge/lvds-codec.c
> +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> @@ -10,13 +10,16 @@
> #include <linux/of_device.h>
> #include <linux/of_graph.h>
> #include <linux/platform_device.h>
> +#include <linux/regulator/consumer.h>
>
> #include <drm/drm_bridge.h>
> #include <drm/drm_panel.h>
>
> 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 ret;
>
> lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL);
> if (!lvds_codec)
> return -ENOMEM;
>
> +lvds_codec->dev = &pdev->dev;
> lvds_codec->connector_type =
> (uintptr_t)of_device_get_match_data(dev);
> +
> +lvds_codec->vcc = devm_regulator_get(lvds_codec->dev, "power");
> +if (IS_ERR(lvds_codec->vcc)) {
> +ret = PTR_ERR(lvds_codec->vcc);
> +if (ret != -EPROBE_DEFER)
> +dev_err(lvds_codec->dev,
> +"Unable to get \"vcc\" supply: %d\n", ret);
> +return ret;
> +}
> +
> lvds_codec->powerdown_gpio = devm_gpiod_get_optional(dev,
> "powerdown",
>
> GPIOD_OUT_HIGH);
> if (IS_ERR(lvds_codec->powerdown_gpio))
> --
> Regards,
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] drm/bridge: lvds-codec: Add support for regulator
2020-09-22 10:55 [PATCH v3] drm/bridge: lvds-codec: Add support for regulator Laurent Pinchart
2020-09-22 11:01 ` Biju Das
@ 2020-10-16 21:04 ` Sam Ravnborg
2020-10-17 16:08 ` Biju Das
1 sibling, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2020-10-16 21:04 UTC (permalink / raw)
To: Laurent Pinchart
Cc: dri-devel, linux-renesas-soc, Biju Das, Neil Armstrong, Andrzej Hajda
Hi Biju, Laurent
On Tue, Sep 22, 2020 at 01:55:26PM +0300, Laurent Pinchart wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> Add the support for enabling optional regulator that may be used as VCC
> source.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> [Replaced 'error' variable with 'ret']
> [Renamed regulator from 'vcc' to 'power']
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Applied to drm-misc-next.
Biju, could you make a follow-up patch that introduces dev_err_probe()
where appropriate? I did not fix up the code but this was a good
candidate.
Sam
> ---
> Changes since v2:
>
> - Use the correct regulator name
> ---
> 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 f19d9f7a5db2..f52ccffc1bd1 100644
> --- a/drivers/gpu/drm/bridge/lvds-codec.c
> +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> @@ -10,13 +10,16 @@
> #include <linux/of_device.h>
> #include <linux/of_graph.h>
> #include <linux/platform_device.h>
> +#include <linux/regulator/consumer.h>
>
> #include <drm/drm_bridge.h>
> #include <drm/drm_panel.h>
>
> 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 ret;
>
> lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL);
> if (!lvds_codec)
> return -ENOMEM;
>
> + lvds_codec->dev = &pdev->dev;
> lvds_codec->connector_type = (uintptr_t)of_device_get_match_data(dev);
> +
> + lvds_codec->vcc = devm_regulator_get(lvds_codec->dev, "power");
> + if (IS_ERR(lvds_codec->vcc)) {
> + ret = PTR_ERR(lvds_codec->vcc);
> + if (ret != -EPROBE_DEFER)
> + dev_err(lvds_codec->dev,
> + "Unable to get \"vcc\" supply: %d\n", ret);
> + return ret;
> + }
> +
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v3] drm/bridge: lvds-codec: Add support for regulator
2020-10-16 21:04 ` Sam Ravnborg
@ 2020-10-17 16:08 ` Biju Das
0 siblings, 0 replies; 4+ messages in thread
From: Biju Das @ 2020-10-17 16:08 UTC (permalink / raw)
To: Sam Ravnborg, Laurent Pinchart
Cc: dri-devel, linux-renesas-soc, Neil Armstrong, Andrzej Hajda
Hi Sam,
> Subject: Re: [PATCH v3] drm/bridge: lvds-codec: Add support for regulator
>
> Hi Biju, Laurent
>
> On Tue, Sep 22, 2020 at 01:55:26PM +0300, Laurent Pinchart wrote:
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > Add the support for enabling optional regulator that may be used as
> > VCC source.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > [Replaced 'error' variable with 'ret'] [Renamed regulator from 'vcc'
> > to 'power']
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
>
> Applied to drm-misc-next.
> Biju, could you make a follow-up patch that introduces dev_err_probe()
> where appropriate? I did not fix up the code but this was a good candidate.
Ok, sure will do.
Thanks,
Biju
>
> Sam
>
> > ---
> > Changes since v2:
> >
> > - Use the correct regulator name
> > ---
> > 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 f19d9f7a5db2..f52ccffc1bd1 100644
> > --- a/drivers/gpu/drm/bridge/lvds-codec.c
> > +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> > @@ -10,13 +10,16 @@
> > #include <linux/of_device.h>
> > #include <linux/of_graph.h>
> > #include <linux/platform_device.h>
> > +#include <linux/regulator/consumer.h>
> >
> > #include <drm/drm_bridge.h>
> > #include <drm/drm_panel.h>
> >
> > 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 ret;
> >
> > lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL);
> > if (!lvds_codec)
> > return -ENOMEM;
> >
> > + lvds_codec->dev = &pdev->dev;
> > lvds_codec->connector_type =
> > (uintptr_t)of_device_get_match_data(dev);
> > +
> > + lvds_codec->vcc = devm_regulator_get(lvds_codec->dev, "power");
> > + if (IS_ERR(lvds_codec->vcc)) {
> > + ret = PTR_ERR(lvds_codec->vcc);
> > + if (ret != -EPROBE_DEFER)
> > + dev_err(lvds_codec->dev,
> > + "Unable to get \"vcc\" supply: %d\n", ret);
> > + return ret;
> > + }
> > +
> > 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-17 16:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 10:55 [PATCH v3] drm/bridge: lvds-codec: Add support for regulator Laurent Pinchart
2020-09-22 11:01 ` Biju Das
2020-10-16 21:04 ` Sam Ravnborg
2020-10-17 16:08 ` Biju Das
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).