All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/imx: imx-tve: Do not set the regulator voltage
@ 2017-02-08 12:47 ` Fabio Estevam
  0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2017-02-08 12:47 UTC (permalink / raw)
  To: p.zabel; +Cc: l.stach, dri-devel, Fabio Estevam, # 4 . 8+

Commit deb65870b5d9d ("drm/imx: imx-tve: check the value returned by
regulator_set_voltage()") exposes the following probe issue:

63ff0000.tve supply dac not found, using dummy regulator
imx-drm display-subsystem: failed to bind 63ff0000.tve (ops imx_tve_ops): -22

When the 'dac-supply' is not passed in the device tree a dummy regulator is
used and setting its voltage is not allowed.

To fix this issue, do not set the dac-supply voltage inside the driver
and let its voltage be specified in the device tree.

Print a warning if the the 'dac-supply' voltage has a value different
from 2.75V.

Fixes: deb65870b5d9d ("drm/imx: imx-tve: check the value returned by regulator_set_voltage()")
Cc: <stable@vger.kernel.org> # 4.8+
Suggested-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes since v1:
- Fix the warning message. When a 'dac-supply' node is not passed we cannot
print the regulator_get_voltage() value.

 drivers/gpu/drm/imx/imx-tve.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index 8f8aa4a..4826bb7 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -98,6 +98,8 @@
 /* TVE_TST_MODE_REG */
 #define TVE_TVDAC_TEST_MODE_MASK	(0x7 << 0)
 
+#define IMX_TVE_DAC_VOLTAGE	2750000
+
 enum {
 	TVE_MODE_TVOUT,
 	TVE_MODE_VGA,
@@ -616,9 +618,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
 
 	tve->dac_reg = devm_regulator_get(dev, "dac");
 	if (!IS_ERR(tve->dac_reg)) {
-		ret = regulator_set_voltage(tve->dac_reg, 2750000, 2750000);
-		if (ret)
-			return ret;
+		if (regulator_get_voltage(tve->dac_reg) != IMX_TVE_DAC_VOLTAGE)
+			dev_warn(dev, "dac voltage is not %d uV\n", IMX_TVE_DAC_VOLTAGE);
 		ret = regulator_enable(tve->dac_reg);
 		if (ret)
 			return ret;
-- 
2.7.4


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

* [PATCH v2] drm/imx: imx-tve: Do not set the regulator voltage
@ 2017-02-08 12:47 ` Fabio Estevam
  0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2017-02-08 12:47 UTC (permalink / raw)
  To: p.zabel; +Cc: l.stach, dri-devel, Fabio Estevam, # 4 . 8+

Commit deb65870b5d9d ("drm/imx: imx-tve: check the value returned by
regulator_set_voltage()") exposes the following probe issue:

63ff0000.tve supply dac not found, using dummy regulator
imx-drm display-subsystem: failed to bind 63ff0000.tve (ops imx_tve_ops): -22

When the 'dac-supply' is not passed in the device tree a dummy regulator is
used and setting its voltage is not allowed.

To fix this issue, do not set the dac-supply voltage inside the driver
and let its voltage be specified in the device tree.

Print a warning if the the 'dac-supply' voltage has a value different
from 2.75V.

Fixes: deb65870b5d9d ("drm/imx: imx-tve: check the value returned by regulator_set_voltage()")
Cc: <stable@vger.kernel.org> # 4.8+
Suggested-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes since v1:
- Fix the warning message. When a 'dac-supply' node is not passed we cannot
print the regulator_get_voltage() value.

 drivers/gpu/drm/imx/imx-tve.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index 8f8aa4a..4826bb7 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -98,6 +98,8 @@
 /* TVE_TST_MODE_REG */
 #define TVE_TVDAC_TEST_MODE_MASK	(0x7 << 0)
 
+#define IMX_TVE_DAC_VOLTAGE	2750000
+
 enum {
 	TVE_MODE_TVOUT,
 	TVE_MODE_VGA,
@@ -616,9 +618,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
 
 	tve->dac_reg = devm_regulator_get(dev, "dac");
 	if (!IS_ERR(tve->dac_reg)) {
-		ret = regulator_set_voltage(tve->dac_reg, 2750000, 2750000);
-		if (ret)
-			return ret;
+		if (regulator_get_voltage(tve->dac_reg) != IMX_TVE_DAC_VOLTAGE)
+			dev_warn(dev, "dac voltage is not %d uV\n", IMX_TVE_DAC_VOLTAGE);
 		ret = regulator_enable(tve->dac_reg);
 		if (ret)
 			return ret;
-- 
2.7.4

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

* Re: [PATCH v2] drm/imx: imx-tve: Do not set the regulator voltage
  2017-02-08 12:47 ` Fabio Estevam
@ 2017-02-09 11:10   ` Philipp Zabel
  -1 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2017-02-09 11:10 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: l.stach, dri-devel, # 4 . 8+

On Wed, 2017-02-08 at 10:47 -0200, Fabio Estevam wrote:
> Commit deb65870b5d9d ("drm/imx: imx-tve: check the value returned by
> regulator_set_voltage()") exposes the following probe issue:
> 
> 63ff0000.tve supply dac not found, using dummy regulator
> imx-drm display-subsystem: failed to bind 63ff0000.tve (ops imx_tve_ops): -22
> 
> When the 'dac-supply' is not passed in the device tree a dummy regulator is
> used and setting its voltage is not allowed.
> 
> To fix this issue, do not set the dac-supply voltage inside the driver
> and let its voltage be specified in the device tree.
> 
> Print a warning if the the 'dac-supply' voltage has a value different
> from 2.75V.
> 
> Fixes: deb65870b5d9d ("drm/imx: imx-tve: check the value returned by regulator_set_voltage()")
> Cc: <stable@vger.kernel.org> # 4.8+
> Suggested-by: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Thanks, I've applied this instead of the devm_regulator_get_optional
patch.

regards
Philipp


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

* Re: [PATCH v2] drm/imx: imx-tve: Do not set the regulator voltage
@ 2017-02-09 11:10   ` Philipp Zabel
  0 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2017-02-09 11:10 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: # 4 . 8+, dri-devel

On Wed, 2017-02-08 at 10:47 -0200, Fabio Estevam wrote:
> Commit deb65870b5d9d ("drm/imx: imx-tve: check the value returned by
> regulator_set_voltage()") exposes the following probe issue:
> 
> 63ff0000.tve supply dac not found, using dummy regulator
> imx-drm display-subsystem: failed to bind 63ff0000.tve (ops imx_tve_ops): -22
> 
> When the 'dac-supply' is not passed in the device tree a dummy regulator is
> used and setting its voltage is not allowed.
> 
> To fix this issue, do not set the dac-supply voltage inside the driver
> and let its voltage be specified in the device tree.
> 
> Print a warning if the the 'dac-supply' voltage has a value different
> from 2.75V.
> 
> Fixes: deb65870b5d9d ("drm/imx: imx-tve: check the value returned by regulator_set_voltage()")
> Cc: <stable@vger.kernel.org> # 4.8+
> Suggested-by: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Thanks, I've applied this instead of the devm_regulator_get_optional
patch.

regards
Philipp

_______________________________________________
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:[~2017-02-09 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08 12:47 [PATCH v2] drm/imx: imx-tve: Do not set the regulator voltage Fabio Estevam
2017-02-08 12:47 ` Fabio Estevam
2017-02-09 11:10 ` Philipp Zabel
2017-02-09 11:10   ` Philipp Zabel

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.