0004-drm-bridge-ps8640-Print-an-error-if-VDO-control-fail.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 4897262a71cbf55d726d9174f5f646897dc13704 Mon Sep 17 00:00:00 2001
  2. From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
  3. Date: Wed, 26 Aug 2020 10:15:25 +0200
  4. Subject: [PATCH 4/5] drm/bridge: ps8640: Print an error if VDO control fails
  5. Print an error message inside ps8640_bridge_vdo_control() function when
  6. it fails so we can simplify a bit the callers, they will only need to
  7. check the error code.
  8. Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
  9. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
  10. ---
  11. drivers/gpu/drm/bridge/parade-ps8640.c | 13 ++++++-------
  12. 1 file changed, 6 insertions(+), 7 deletions(-)
  13. diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c
  14. index ce3e8b2da8c9..9f7b7a9c53c5 100644
  15. --- a/drivers/gpu/drm/bridge/parade-ps8640.c
  16. +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
  17. @@ -82,8 +82,11 @@ static int ps8640_bridge_vdo_control(struct ps8640 *ps_bridge,
  18. ret = i2c_smbus_write_i2c_block_data(client, PAGE3_SET_ADD,
  19. sizeof(vdo_ctrl_buf),
  20. vdo_ctrl_buf);
  21. - if (ret < 0)
  22. + if (ret < 0) {
  23. + DRM_ERROR("failed to %sable VDO: %d\n",
  24. + ctrl == ENABLE ? "en" : "dis", ret);
  25. return ret;
  26. + }
  27. return 0;
  28. }
  29. @@ -150,10 +153,8 @@ static void ps8640_pre_enable(struct drm_bridge *bridge)
  30. }
  31. ret = ps8640_bridge_vdo_control(ps_bridge, ENABLE);
  32. - if (ret) {
  33. - DRM_ERROR("failed to enable VDO: %d\n", ret);
  34. + if (ret)
  35. goto err_regulators_disable;
  36. - }
  37. /* Switch access edp panel's edid through i2c */
  38. ret = i2c_smbus_write_byte_data(client, PAGE2_I2C_BYPASS,
  39. @@ -175,9 +176,7 @@ static void ps8640_post_disable(struct drm_bridge *bridge)
  40. struct ps8640 *ps_bridge = bridge_to_ps8640(bridge);
  41. int ret;
  42. - ret = ps8640_bridge_vdo_control(ps_bridge, DISABLE);
  43. - if (ret < 0)
  44. - DRM_ERROR("failed to disable VDO: %d\n", ret);
  45. + ps8640_bridge_vdo_control(ps_bridge, DISABLE);
  46. gpiod_set_value(ps_bridge->gpio_reset, 1);
  47. gpiod_set_value(ps_bridge->gpio_powerdown, 1);
  48. --
  49. 2.25.1