devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/3] dt-bindings: describe dw_hdmi supplies
@ 2015-06-05 17:05 Heiko Stübner
  2015-06-05 17:06 ` [PATCH v4 2/3] drm/rockchip: implement dw_hdmi supplies for the Rockchip implementation Heiko Stübner
  2015-06-05 17:07 ` [PATCH v4 3/3] ARM: dts: rockchip: add hdmi analog power supplies to rk3288 boards Heiko Stübner
  0 siblings, 2 replies; 4+ messages in thread
From: Heiko Stübner @ 2015-06-05 17:05 UTC (permalink / raw)
  To: Thierry Reding, Mark Yao
  Cc: Mark Rutland, devicetree, Russell King - ARM Linux, Pawel Moll,
	Ian Campbell, dri-devel, linux-rockchip, Rob Herring,
	linux-arm-kernel

The Designware HDMI block has two supplies for 1.0 and 1.8V. Not all IP
implementations expose or want to use these, so they remain optional.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
---
changes since v3:
- split generic dt-bindings and rockchip implementation
- add Ack from Philipp Zabel
changes since v2:
- rename supplies to the names found in the hdmi IP databook

 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
index a905c14..ba42d89 100644
--- a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
+++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
@@ -22,6 +22,10 @@ Optional properties
 - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
 - clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
 
+Optional supplies:
+- vp-supply: 1.0V power supply
+- vph-supply: 1.8V power supply
+
 Example:
 	hdmi: hdmi@0120000 {
 		compatible = "fsl,imx6q-hdmi";
-- 
2.1.4


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4 2/3] drm/rockchip: implement dw_hdmi supplies for the Rockchip implementation
  2015-06-05 17:05 [PATCH v4 1/3] dt-bindings: describe dw_hdmi supplies Heiko Stübner
@ 2015-06-05 17:06 ` Heiko Stübner
  2015-06-08 14:49   ` Thierry Reding
  2015-06-05 17:07 ` [PATCH v4 3/3] ARM: dts: rockchip: add hdmi analog power supplies to rk3288 boards Heiko Stübner
  1 sibling, 1 reply; 4+ messages in thread
From: Heiko Stübner @ 2015-06-05 17:06 UTC (permalink / raw)
  To: Thierry Reding, Mark Yao
  Cc: Mark Rutland, devicetree, Russell King - ARM Linux, Pawel Moll,
	Ian Campbell, dri-devel, linux-rockchip, Rob Herring,
	linux-arm-kernel

The Rockchip implementation of the IP exposes the supplies outside and
expects them to be supplied by a pmic. So implement regulator handling
for them.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
---
changes since v3:
- split generic dt-bindings and rockchip implementation
- add Ack from Philipp Zabel
changes since v2:
- rename supplies to the names found in the hdmi IP databook
changes since v1:
- follow suggestion from Russell King to keep regulator handling local
  to the rockchip implementation for the time being and only generalize
  when a real second implementation needs regulator handling

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 32 ++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 80d6fc8..9c003fa 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -11,6 +11,7 @@
 #include <linux/platform_device.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 #include <drm/drm_of.h>
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
@@ -28,6 +29,9 @@ struct rockchip_hdmi {
 	struct device *dev;
 	struct regmap *regmap;
 	struct drm_encoder encoder;
+	struct regulator_bulk_data supplies[2];
+	int nsupplies;
+	bool supplies_enabled;
 };
 
 #define to_rockchip_hdmi(x)	container_of(x, struct rockchip_hdmi, x)
@@ -179,6 +183,12 @@ static struct drm_encoder_funcs dw_hdmi_rockchip_encoder_funcs = {
 
 static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
 {
+	struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
+
+	if (hdmi->nsupplies > 0 && hdmi->supplies_enabled) {
+		regulator_bulk_disable(hdmi->nsupplies, hdmi->supplies);
+		hdmi->supplies_enabled = false;
+	}
 }
 
 static bool
@@ -199,7 +209,16 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder)
 {
 	struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
 	u32 val;
-	int mux;
+	int mux, ret;
+
+	if (hdmi->nsupplies > 0 && !hdmi->supplies_enabled) {
+		ret = regulator_bulk_enable(hdmi->nsupplies, hdmi->supplies);
+		if (ret) {
+			dev_err(hdmi->dev, "could not enable hdmi analog supplies\n");
+			return;
+		}
+		hdmi->supplies_enabled = true;
+	}
 
 	mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
 	if (mux)
@@ -275,6 +294,17 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 	if (!iores)
 		return -ENXIO;
 
+	hdmi->supplies[0].supply = "vp";
+	hdmi->supplies[1].supply = "vph";
+	hdmi->nsupplies = 2;
+
+	ret = devm_regulator_bulk_get(hdmi->dev,
+				      hdmi->nsupplies, hdmi->supplies);
+	if (ret == -EPROBE_DEFER)
+		return ret;
+	if (ret)
+		hdmi->nsupplies = 0;
+
 	platform_set_drvdata(pdev, hdmi);
 
 	encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
-- 
2.1.4


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4 3/3] ARM: dts: rockchip: add hdmi analog power supplies to rk3288 boards
  2015-06-05 17:05 [PATCH v4 1/3] dt-bindings: describe dw_hdmi supplies Heiko Stübner
  2015-06-05 17:06 ` [PATCH v4 2/3] drm/rockchip: implement dw_hdmi supplies for the Rockchip implementation Heiko Stübner
@ 2015-06-05 17:07 ` Heiko Stübner
  1 sibling, 0 replies; 4+ messages in thread
From: Heiko Stübner @ 2015-06-05 17:07 UTC (permalink / raw)
  To: linux-rockchip
  Cc: Mark Rutland, devicetree, Russell King - ARM Linux, Pawel Moll,
	Ian Campbell, dri-devel, Rob Herring, linux-arm-kernel

Add the recently added hdmi power supplies to evb and firefly boards.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
changes since v3:
- add entries for popmetal board

 arch/arm/boot/dts/rk3288-evb.dtsi     | 2 ++
 arch/arm/boot/dts/rk3288-firefly.dtsi | 2 ++
 arch/arm/boot/dts/rk3288-popmetal.dts | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi b/arch/arm/boot/dts/rk3288-evb.dtsi
index 844a6fb..a57fbe3 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -172,6 +172,8 @@
 };
 
 &hdmi {
 	ddc-i2c-bus = <&i2c5>;
+	vp-supply = <&vdd10_lcd>;
+	vph-supply = <&vcc18_lcd>;
 	status = "okay";
 };
diff --git a/arch/arm/boot/dts/rk3288-firefly.dtsi b/arch/arm/boot/dts/rk3288-firefly.dtsi
index 0b42372..68068d9 100644
--- a/arch/arm/boot/dts/rk3288-firefly.dtsi
+++ b/arch/arm/boot/dts/rk3288-firefly.dtsi
@@ -196,6 +196,8 @@
 };
 
 &hdmi {
 	ddc-i2c-bus = <&i2c5>;
+	vp-supply = <&vdd10_lcd>;
+	vph-supply = <&vcc18_lcd>;
 	status = "okay";
 };
diff --git a/arch/arm/boot/dts/rk3288-popmetal.dts b/arch/arm/boot/dts/rk3288-popmetal.dts
index d582811..98f4d77 100644
--- a/arch/arm/boot/dts/rk3288-popmetal.dts
+++ b/arch/arm/boot/dts/rk3288-popmetal.dts
@@ -141,6 +141,8 @@
 
 &hdmi {
 	ddc-i2c-bus = <&i2c5>;
+	vp-supply = <&vdd10_lcd>;
+	vph-supply = <&vcc18_lcd>;
 	status = "okay";
 };
 
-- 
2.1.4


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v4 2/3] drm/rockchip: implement dw_hdmi supplies for the Rockchip implementation
  2015-06-05 17:06 ` [PATCH v4 2/3] drm/rockchip: implement dw_hdmi supplies for the Rockchip implementation Heiko Stübner
@ 2015-06-08 14:49   ` Thierry Reding
  0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2015-06-08 14:49 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Mark Rutland, devicetree, Russell King - ARM Linux, Pawel Moll,
	Ian Campbell, dri-devel, linux-rockchip, Rob Herring,
	linux-arm-kernel


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

On Fri, Jun 05, 2015 at 07:06:38PM +0200, Heiko Stübner wrote:
> The Rockchip implementation of the IP exposes the supplies outside and
> expects them to be supplied by a pmic. So implement regulator handling
> for them.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> changes since v3:
> - split generic dt-bindings and rockchip implementation
> - add Ack from Philipp Zabel
> changes since v2:
> - rename supplies to the names found in the hdmi IP databook
> changes since v1:
> - follow suggestion from Russell King to keep regulator handling local
>   to the rockchip implementation for the time being and only generalize
>   when a real second implementation needs regulator handling
> 
>  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 32 ++++++++++++++++++++++++++++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> index 80d6fc8..9c003fa 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> @@ -11,6 +11,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/mfd/syscon.h>
>  #include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
>  #include <drm/drm_of.h>
>  #include <drm/drmP.h>
>  #include <drm/drm_crtc_helper.h>
> @@ -28,6 +29,9 @@ struct rockchip_hdmi {
>  	struct device *dev;
>  	struct regmap *regmap;
>  	struct drm_encoder encoder;
> +	struct regulator_bulk_data supplies[2];
> +	int nsupplies;

unsigned int, please. Also I personally prefer the num_ prefix and it's
slightly more common in DRM code (even in the Rockchip driver).

> +	bool supplies_enabled;
>  };
>  
>  #define to_rockchip_hdmi(x)	container_of(x, struct rockchip_hdmi, x)
> @@ -179,6 +183,12 @@ static struct drm_encoder_funcs dw_hdmi_rockchip_encoder_funcs = {
>  
>  static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
>  {
> +	struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
> +
> +	if (hdmi->nsupplies > 0 && hdmi->supplies_enabled) {
> +		regulator_bulk_disable(hdmi->nsupplies, hdmi->supplies);
> +		hdmi->supplies_enabled = false;
> +	}
>  }
>  
>  static bool
> @@ -199,7 +209,16 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder)
>  {
>  	struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
>  	u32 val;
> -	int mux;
> +	int mux, ret;
> +
> +	if (hdmi->nsupplies > 0 && !hdmi->supplies_enabled) {
> +		ret = regulator_bulk_enable(hdmi->nsupplies, hdmi->supplies);
> +		if (ret) {
> +			dev_err(hdmi->dev, "could not enable hdmi analog supplies\n");

"HDMI" please. And perhaps you want to add the error code to the message
as well?

> +			return;
> +		}
> +		hdmi->supplies_enabled = true;
> +	}
>  
>  	mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
>  	if (mux)
> @@ -275,6 +294,17 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
>  	if (!iores)
>  		return -ENXIO;
>  
> +	hdmi->supplies[0].supply = "vp";
> +	hdmi->supplies[1].supply = "vph";
> +	hdmi->nsupplies = 2;
> +
> +	ret = devm_regulator_bulk_get(hdmi->dev,
> +				      hdmi->nsupplies, hdmi->supplies);

I think it'd be slightly more idiomatic to put hdmi->nsupplies on the
first line.

Thierry

[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-08 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-05 17:05 [PATCH v4 1/3] dt-bindings: describe dw_hdmi supplies Heiko Stübner
2015-06-05 17:06 ` [PATCH v4 2/3] drm/rockchip: implement dw_hdmi supplies for the Rockchip implementation Heiko Stübner
2015-06-08 14:49   ` Thierry Reding
2015-06-05 17:07 ` [PATCH v4 3/3] ARM: dts: rockchip: add hdmi analog power supplies to rk3288 boards Heiko Stübner

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).