Skip to contentSkip to conversation

drm/panel: drmP.h removal and DRM_DEV*

PATCH In review Sam Ravnborg 6 participants 31 messages Jan 31, 2019 – Feb 4, 2019

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover drm/panel: drmP.h removal and DRM_DEV*

Hi Thierry et al.

While reviewing a number of new panel drivers there was a certain pattern in the feedback:
- the now deprecated drmP.h file was used
- dev_err() and friends was used

This patch-set address the above items in the panel drivers in drm/panel/
The hope is that new panel drivers will no longer inherit bad patterns from the existing drivers.

The use of DRM_DEV* is not accepted by everyone, so this conversion was split up in smaller bits.
If some drivers do not want to use DRM_DEV* then just drop the relevant patch.

All patches are build tested on x86/arm.

The DRM_DEV* patches depends on the drmP.h removal.

One extra patch sneaked in "panel-innolux: drop unused variable" This is a fix for an unused variable and was added to flush my panel patches.

Note: Waiting for key storage (for gpg key) before I start the process getting commit rights, so I rely on someone else (Thierry?) to commit this.

Patches are made on top of drm-misc-next as of a few days ago.

Comments welcome!

Sam

Sam Ravnborg (19):
drm/panel: drop drmP.h usage drm/panel: panel-innolux: drop unused variable drm/panel: samsung: use DRM_DEV* drm/panel: arm-versatile: use DRM_DEV* drm/panel: truly: use DRM_DEV* drm/panel: sitronix: use DRM_DEV* drm/panel: ilitek: use DRM_DEV* drm/panel: innolux: use DRM_DEV* drm/panel: jdi: use DRM_DEV* drm/panel: lg: use DRM_DEV*
drm/panel: lvds: use DRM_DEV* drm/panel: olimex: use DRM_DEV* drm/panel: orisetech: use DRM_DEV* drm/panel: panasonic: use DRM_DEV* drm/panel: raspberrypi: use DRM_DEV* drm/panel: raydium: use DRM_DEV* drm/panel: seiko: use DRM_DEV* drm/panel: sharp: use DRM_DEV* drm/panel: simple: use DRM_DEV*

 drivers/gpu/drm/panel/panel-arm-versatile.c        | 21 +++--
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c       | 97 ++++++++++++----------
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c      | 14 ++--
 drivers/gpu/drm/panel/panel-innolux-p079zca.c      | 17 ++--
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c     | 66 ++++++++-------
 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c |  4 +-
 drivers/gpu/drm/panel/panel-lg-lg4573.c            | 25 +++---
 drivers/gpu/drm/panel/panel-lvds.c                 | 39 +++++----
 drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c | 28 ++++---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   | 15 ++--
 .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   | 19 +++--
 .../gpu/drm/panel/panel-raspberrypi-touchscreen.c  | 25 +++---
 drivers/gpu/drm/panel/panel-raydium-rm68200.c      | 11 ++-
 drivers/gpu/drm/panel/panel-samsung-ld9040.c       | 18 ++--
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c      | 21 +++--
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c   | 15 ++--
 drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c      | 32 ++++---
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c        | 18 ++--
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c    | 66 ++++++++++-----
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c    | 27 +++---
 drivers/gpu/drm/panel/panel-simple.c               | 22 +++--
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c     | 16 ++--
 drivers/gpu/drm/panel/panel-truly-nt35597.c        | 10 ++-
 23 files changed, 375 insertions(+), 251 deletions(-)
#1 lore raw

PATCH 1/19 drm/panel: drop drmP.h usage

Use of drmP.h is discouraged and yet we see new panel drivers utilising drmP.h.
Remove usage of drmP.h from current panel drivers to set a good example for new drivers.

While touching list of include files sort them.

Build tested on arm/x86.

Cc Linus Walleij <[email protected]>
Cc Stefan Mavrodiev <[email protected]>
Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-arm-versatile.c           | 3 ++-
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c          | 4 +++-
 drivers/gpu/drm/panel/panel-innolux-p079zca.c         | 4 +++-
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c        | 2 +-
 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c    | 4 +++-
 drivers/gpu/drm/panel/panel-lg-lg4573.c               | 5 ++++-
 drivers/gpu/drm/panel/panel-lvds.c                    | 1 -
 drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c    | 2 +-
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c      | 7 ++++++-
 drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c  | 3 ++-
 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 3 +--
 drivers/gpu/drm/panel/panel-raydium-rm68200.c         | 5 ++++-
 drivers/gpu/drm/panel/panel-samsung-ld9040.c          | 6 +++++-
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c         | 6 +++++-
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c      | 7 ++++++-
 drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c         | 6 +++++-
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c           | 4 +++-
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c       | 3 ++-
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c       | 3 ++-
 drivers/gpu/drm/panel/panel-simple.c                  | 3 ++-
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c        | 6 +++++-
 drivers/gpu/drm/panel/panel-truly-nt35597.c           | 8 ++++++--
 22 files changed, 71 insertions(+), 24 deletions(-)
drivers/gpu/drm/panel/panel-arm-versatile.c +2 -1
index b428c4678106..0ed8ee4673eb 100644
@@ -25,13 +25,14 @@
  * Epson QCIF display.
  *
  */
-#include <drm/drmP.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
 
 #include <linux/bitops.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/mfd/syscon.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
drivers/gpu/drm/panel/panel-ilitek-ili9322.c +3 -1
index bd38bf4f1ba6..1ee8b2ccf718 100644
@@ -22,8 +22,10 @@
  * published by the Free Software Foundation.
  */
 
-#include <drm/drmP.h>
+#include <drm/drm_connector.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <linux/of_device.h>
 #include <linux/bitops.h>
drivers/gpu/drm/panel/panel-innolux-p079zca.c +3 -1
index 8e5724b63f1f..6c3da2cbacd9 100644
@@ -8,16 +8,18 @@
  */
 
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +1 -1
index 99caa7835e7b..fecdda0b99a5 100644
@@ -22,12 +22,12 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c +3 -1
index 2a25a914d09e..f61211a69dbe 100644
@@ -4,15 +4,17 @@
  */
 
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
drivers/gpu/drm/panel/panel-lg-lg4573.c +4 -1
index 6989238b276a..e63fba2761f4 100644
@@ -15,10 +15,13 @@
  * published by the Free Software Foundation.
 */
 
-#include <drm/drmP.h>
+#include <drm/drm_device.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
 
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
 
drivers/gpu/drm/panel/panel-lvds.c +0 -1
index 3f6550e6b6a4..833aeb47065b 100644
@@ -16,7 +16,6 @@
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_panel.h>
 
drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c +1 -1
index 5e8d4523e9ed..c8704be9caa3 100644
@@ -15,9 +15,9 @@
 #include <linux/of.h>
 #include <linux/regulator/consumer.h>
 
+#include <drm/drm_device.h>
 #include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
-#include <drm/drmP.h>
 
 #include <video/videomode.h>
 #include <video/display_timing.h>
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +6 -1
index 87fa316e1d7b..5bacf3f2da05 100644
@@ -6,12 +6,17 @@
  *          Yannick Fertre <[email protected]>
  */
 
-#include <drm/drmP.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
+
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
 #include <linux/regulator/consumer.h>
+
 #include <video/mipi_display.h>
 
 #define OTM8009A_BACKLIGHT_DEFAULT	240
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +2 -1
index cb4dfb98be0f..c7037942c7f3 100644
@@ -19,12 +19,13 @@
  */
 
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +1 -2
index 2c9c9722734f..28c0620dfe0f 100644
@@ -53,9 +53,8 @@
 #include <linux/of_graph.h>
 #include <linux/pm.h>
 
-#include <drm/drm_panel.h>
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 
drivers/gpu/drm/panel/panel-raydium-rm68200.c +4 -1
index 77593533abcd..e05e3f950855 100644
@@ -7,14 +7,17 @@
  */
 
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
 #include <linux/regulator/consumer.h>
 
 #include <video/mipi_display.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 /*** Manufacturer Command Set ***/
 #define MCS_CMD_MODE_SW		0xFE /* CMD Mode Switch */
drivers/gpu/drm/panel/panel-samsung-ld9040.c +5 -1
index 3cf4cf6a6942..7d27b79d0b2a 100644
@@ -11,10 +11,14 @@
  * published by the Free Software Foundation.
 */
 
-#include <drm/drmP.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/of.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
 
drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c +5 -1
index 797bbc7a264e..813afee82ec9 100644
@@ -11,11 +11,15 @@
  * published by the Free Software Foundation.
  */
 
-#include <drm/drmP.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
+
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/regulator/consumer.h>
 
drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c +6 -1
index aeb32aa58899..f1c8000e0386 100644
@@ -11,12 +11,17 @@
  * published by the Free Software Foundation.
  */
 
-#include <drm/drmP.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
+
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
 #include <linux/regulator/consumer.h>
+
 #include <video/mipi_display.h>
 
 #define MCS_LEVEL2_KEY		0xf0
drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c +5 -1
index 6ad827b93ae1..b252d23f386f 100644
@@ -15,11 +15,15 @@
  * published by the Free Software Foundation.
 */
 
-#include <drm/drmP.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/of.h>
 #include <linux/regulator/consumer.h>
 
 #include <video/mipi_display.h>
drivers/gpu/drm/panel/panel-seiko-43wvf1g.c +3 -1
index 2d99e28ff117..c1348a687447 100644
@@ -7,12 +7,14 @@
  */
 
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
 #include <drm/drm_panel.h>
 
 #include <video/display_timing.h>
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +2 -1
index 02fc0f5423d4..2ed11d86c10e 100644
@@ -7,13 +7,14 @@
  */
 
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +2 -1
index e5cae0050f52..e8e2277e934d 100644
@@ -19,13 +19,14 @@
  */
 
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 
drivers/gpu/drm/panel/panel-simple.c +2 -1
index 9e8218f6a3f2..406b1d7aef31 100644
@@ -22,14 +22,15 @@
  */
 
 #include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 
drivers/gpu/drm/panel/panel-sitronix-st7789v.c +5 -1
index 74284e5afc5d..76bd6e7a1a60 100644
@@ -6,11 +6,15 @@
  * 2 as published by the Free Software Foundation.
  */
 
+#include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
 
-#include <drm/drmP.h>
+#include <drm/drm_device.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
 
 #include <video/mipi_display.h>
drivers/gpu/drm/panel/panel-truly-nt35597.c +6 -2
index fc2a66c53db4..6317b6b35341 100644
@@ -3,11 +3,15 @@
  * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  */
 
-#include <drm/drmP.h>
-#include <drm/drm_panel.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
+#include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
+#include <linux/backlight.h>
+#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/of_graph.h>
 #include <linux/pinctrl/consumer.h>
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 2/19 drm/panel: panel-innolux: drop unused variable

In reply to Sam Ravnborg

The num_supplies variable is not used, delete it. Build tested.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-innolux-p079zca.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/panel/panel-innolux-p079zca.c +0 -1
index 6c3da2cbacd9..c8d0da3116dd 100644
@@ -57,7 +57,6 @@ struct innolux_panel {
 
 	struct backlight_device *backlight;
 	struct regulator_bulk_data *supplies;
-	unsigned int num_supplies;
 	struct gpio_desc *enable_gpio;
 
 	bool prepared;
Signature · 1 line
2.12.0
#3 lore raw

PATCH 3/19 drm/panel: samsung: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-samsung-ld9040.c     | 12 +++++------
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c    | 15 +++++++-------
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c |  8 ++++----
 drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c    | 26 +++++++++++++-----------
 4 files changed, 32 insertions(+), 29 deletions(-)
drivers/gpu/drm/panel/panel-samsung-ld9040.c +6 -6
index 7d27b79d0b2a..fec639c19d74 100644
@@ -149,7 +149,7 @@ static void ld9040_dcs_write(struct ld9040 *ctx, const u8 *data, size_t len)
 	if (ctx->error < 0 || len == 0)
 		return;
 
-	dev_dbg(ctx->dev, "writing dcs seq: %*ph\n", (int)len, data);
+	DRM_DEV_DEBUG(ctx->dev, "writing dcs seq: %*ph\n", (int)len, data);
 	ret = ld9040_spi_write_word(ctx, *data);
 
 	while (!ret && --len) {
@@ -158,8 +158,8 @@ static void ld9040_dcs_write(struct ld9040 *ctx, const u8 *data, size_t len)
 	}
 
 	if (ret) {
-		dev_err(ctx->dev, "error %d writing dcs seq: %*ph\n", ret,
-			(int)len, data);
+		DRM_DEV_ERROR(ctx->dev, "error %d writing dcs seq: %*ph\n",
+			      ret, (int)len, data);
 		ctx->error = ret;
 	}
 
@@ -342,15 +342,15 @@ static int ld9040_probe(struct spi_device *spi)
 
 	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ctx->reset_gpio)) {
-		dev_err(dev, "cannot get reset-gpios %ld\n",
-			PTR_ERR(ctx->reset_gpio));
+		DRM_DEV_ERROR(dev, "cannot get reset-gpios %ld\n",
+			      PTR_ERR(ctx->reset_gpio));
 		return PTR_ERR(ctx->reset_gpio);
 	}
 
 	spi->bits_per_word = 9;
 	ret = spi_setup(spi);
 	if (ret < 0) {
-		dev_err(dev, "spi setup failed.\n");
+		DRM_DEV_ERROR(dev, "spi setup failed.\n");
 		return ret;
 	}
 
drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c +8 -7
index 813afee82ec9..e2f2ee252409 100644
@@ -458,7 +458,8 @@ static int s6e3ha2_set_brightness(struct backlight_device *bl_dev)
 
 	if (brightness < S6E3HA2_MIN_BRIGHTNESS ||
 		brightness > bl_dev->props.max_brightness) {
-		dev_err(ctx->dev, "Invalid brightness: %u\n", brightness);
+		DRM_DEV_ERROR(ctx->dev, "Invalid brightness: %u\n",
+			      brightness);
 		return -EINVAL;
 	}
 
@@ -706,28 +707,28 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi)
 	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),
 				      ctx->supplies);
 	if (ret < 0) {
-		dev_err(dev, "failed to get regulators: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to get regulators: %d\n", ret);
 		return ret;
 	}
 
 	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ctx->reset_gpio)) {
-		dev_err(dev, "cannot get reset-gpios %ld\n",
-			PTR_ERR(ctx->reset_gpio));
+		DRM_DEV_ERROR(dev, "cannot get reset-gpios %ld\n",
+			      PTR_ERR(ctx->reset_gpio));
 		return PTR_ERR(ctx->reset_gpio);
 	}
 
 	ctx->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
 	if (IS_ERR(ctx->enable_gpio)) {
-		dev_err(dev, "cannot get enable-gpios %ld\n",
-			PTR_ERR(ctx->enable_gpio));
+		DRM_DEV_ERROR(dev, "cannot get enable-gpios %ld\n",
+			      PTR_ERR(ctx->enable_gpio));
 		return PTR_ERR(ctx->enable_gpio);
 	}
 
 	ctx->bl_dev = backlight_device_register("s6e3ha2", dev, ctx,
 						&s6e3ha2_bl_ops, NULL);
 	if (IS_ERR(ctx->bl_dev)) {
-		dev_err(dev, "failed to register backlight device\n");
+		DRM_DEV_ERROR(dev, "failed to register backlight device\n");
 		return PTR_ERR(ctx->bl_dev);
 	}
 
drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c +4 -4
index f1c8000e0386..dd50f4089923 100644
@@ -458,14 +458,14 @@ static int s6e63j0x03_probe(struct mipi_dsi_device *dsi)
 	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),
 				      ctx->supplies);
 	if (ret < 0) {
-		dev_err(dev, "failed to get regulators: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to get regulators: %d\n", ret);
 		return ret;
 	}
 
 	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ctx->reset_gpio)) {
-		dev_err(dev, "cannot get reset-gpio: %ld\n",
-				PTR_ERR(ctx->reset_gpio));
+		DRM_DEV_ERROR(dev, "cannot get reset-gpio: %ld\n",
+			      PTR_ERR(ctx->reset_gpio));
 		return PTR_ERR(ctx->reset_gpio);
 	}
 
@@ -476,7 +476,7 @@ static int s6e63j0x03_probe(struct mipi_dsi_device *dsi)
 	ctx->bl_dev = backlight_device_register("s6e63j0x03", dev, ctx,
 						&s6e63j0x03_bl_ops, NULL);
 	if (IS_ERR(ctx->bl_dev)) {
-		dev_err(dev, "failed to register backlight device\n");
+		DRM_DEV_ERROR(dev, "failed to register backlight device\n");
 		return PTR_ERR(ctx->bl_dev);
 	}
 
drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c +14 -12
index b252d23f386f..e3e0766c3a17 100644
@@ -147,8 +147,8 @@ static void s6e8aa0_dcs_write(struct s6e8aa0 *ctx, const void *data, size_t len)
 
 	ret = mipi_dsi_dcs_write_buffer(dsi, data, len);
 	if (ret < 0) {
-		dev_err(ctx->dev, "error %zd writing dcs seq: %*ph\n", ret,
-			(int)len, data);
+		DRM_DEV_ERROR(ctx->dev, "error %zd writing dcs seq: %*ph\n",
+			      ret, (int)len, data);
 		ctx->error = ret;
 	}
 }
@@ -163,7 +163,8 @@ static int s6e8aa0_dcs_read(struct s6e8aa0 *ctx, u8 cmd, void *data, size_t len)
 
 	ret = mipi_dsi_dcs_read(dsi, cmd, data, len);
 	if (ret < 0) {
-		dev_err(ctx->dev, "error %d reading dcs seq(%#x)\n", ret, cmd);
+		DRM_DEV_ERROR(ctx->dev, "error %d reading dcs seq(%#x)\n",
+			      ret, cmd);
 		ctx->error = ret;
 	}
 
@@ -814,9 +815,9 @@ static void s6e8aa0_set_maximum_return_packet_size(struct s6e8aa0 *ctx,
 
 	ret = mipi_dsi_set_maximum_return_packet_size(dsi, size);
 	if (ret < 0) {
-		dev_err(ctx->dev,
-			"error %d setting maximum return packet size to %d\n",
-			ret, size);
+		DRM_DEV_ERROR(ctx->dev,
+			      "error %d setting maximum return packet size to %d\n",
+			      ret, size);
 		ctx->error = ret;
 	}
 }
@@ -825,22 +826,23 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
 {
 	u8 id[3];
 	int ret, i;
+	struct device *dev = ctx->dev;
 
 	ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
 	if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) {
-		dev_err(ctx->dev, "read id failed\n");
+		DRM_DEV_ERROR(dev, "read id failed\n");
 		ctx->error = -EIO;
 		return;
 	}
 
-	dev_info(ctx->dev, "ID: 0x%2x, 0x%2x, 0x%2x\n", id[0], id[1], id[2]);
+	DRM_DEV_INFO(dev, "ID: 0x%2x, 0x%2x, 0x%2x\n", id[0], id[1], id[2]);
 
 	for (i = 0; i < ARRAY_SIZE(s6e8aa0_variants); ++i) {
 		if (id[1] == s6e8aa0_variants[i].version)
 			break;
 	}
 	if (i >= ARRAY_SIZE(s6e8aa0_variants)) {
-		dev_err(ctx->dev, "unsupported display version %d\n", id[1]);
+		DRM_DEV_ERROR(dev, "unsupported display version %d\n", id[1]);
 		ctx->error = -EINVAL;
 		return;
 	}
@@ -1007,14 +1009,14 @@ static int s6e8aa0_probe(struct mipi_dsi_device *dsi)
 	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),
 				      ctx->supplies);
 	if (ret < 0) {
-		dev_err(dev, "failed to get regulators: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to get regulators: %d\n", ret);
 		return ret;
 	}
 
 	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ctx->reset_gpio)) {
-		dev_err(dev, "cannot get reset-gpios %ld\n",
-			PTR_ERR(ctx->reset_gpio));
+		DRM_DEV_ERROR(dev, "cannot get reset-gpios %ld\n",
+			      PTR_ERR(ctx->reset_gpio));
 		return PTR_ERR(ctx->reset_gpio);
 	}
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH 4/19 drm/panel: arm-versatile: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Stefan Mavrodiev <[email protected]>
---
 drivers/gpu/drm/panel/panel-arm-versatile.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/panel/panel-arm-versatile.c +10 -8
index 0ed8ee4673eb..d7139b7aff7d 100644
@@ -27,6 +27,7 @@
  */
 #include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <linux/bitops.h>
 #include <linux/init.h>
@@ -233,7 +234,7 @@ static int versatile_panel_disable(struct drm_panel *panel)
 
 	/* If we're on an IB2 daughterboard, turn off display */
 	if (vpanel->ib2_map) {
-		dev_dbg(vpanel->dev, "disable IB2 display\n");
+		DRM_DEV_DEBUG(vpanel->dev, "disable IB2 display\n");
 		regmap_update_bits(vpanel->ib2_map,
 				   IB2_CTRL,
 				   IB2_CTRL_LCD_MASK,
@@ -249,7 +250,7 @@ static int versatile_panel_enable(struct drm_panel *panel)
 
 	/* If we're on an IB2 daughterboard, turn on display */
 	if (vpanel->ib2_map) {
-		dev_dbg(vpanel->dev, "enable IB2 display\n");
+		DRM_DEV_DEBUG(vpanel->dev, "enable IB2 display\n");
 		regmap_update_bits(vpanel->ib2_map,
 				   IB2_CTRL,
 				   IB2_CTRL_LCD_MASK,
@@ -300,12 +301,12 @@ static int versatile_panel_probe(struct platform_device *pdev)
 
 	parent = dev->parent;
 	if (!parent) {
-		dev_err(dev, "no parent for versatile panel\n");
+		DRM_DEV_ERROR(dev, "no parent for versatile panel\n");
 		return -ENODEV;
 	}
 	map = syscon_node_to_regmap(parent->of_node);
 	if (IS_ERR(map)) {
-		dev_err(dev, "no regmap for versatile panel parent\n");
+		DRM_DEV_ERROR(dev, "no regmap for versatile panel parent\n");
 		return PTR_ERR(map);
 	}
 
@@ -315,7 +316,7 @@ static int versatile_panel_probe(struct platform_device *pdev)
 
 	ret = regmap_read(map, SYS_CLCD, &val);
 	if (ret) {
-		dev_err(dev, "cannot access syscon regs\n");
+		DRM_DEV_ERROR(dev, "cannot access syscon regs\n");
 		return ret;
 	}
 
@@ -333,11 +334,11 @@ static int versatile_panel_probe(struct platform_device *pdev)
 
 	/* No panel detected or VGA, let's leave this show */
 	if (i == ARRAY_SIZE(versatile_panels)) {
-		dev_info(dev, "no panel detected\n");
+		DRM_DEV_INFO(dev, "no panel detected\n");
 		return -ENODEV;
 	}
 
-	dev_info(dev, "detected: %s\n", vpanel->panel_type->name);
+	DRM_DEV_INFO(dev, "detected: %s\n", vpanel->panel_type->name);
 	vpanel->dev = dev;
 	vpanel->map = map;
 
@@ -348,7 +349,8 @@ static int versatile_panel_probe(struct platform_device *pdev)
 		if (IS_ERR(vpanel->ib2_map))
 			vpanel->ib2_map = NULL;
 		else
-			dev_info(dev, "panel mounted on IB2 daughterboard\n");
+			DRM_DEV_INFO(dev,
+				     "panel mounted on IB2 daughterboard\n");
 	}
 
 	drm_panel_init(&vpanel->panel);
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH 5/19 drm/panel: truly: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Stefan Mavrodiev <[email protected]>
---
 drivers/gpu/drm/panel/panel-truly-nt35597.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-truly-nt35597.c +1 -1
index 6317b6b35341..162e8002c114 100644
@@ -581,7 +581,7 @@ static int truly_nt35597_probe(struct mipi_dsi_device *dsi)
 	ctx->config = of_device_get_match_data(dev);
 
 	if (!ctx->config) {
-		dev_err(dev, "missing device configuration\n");
+		DRM_DEV_ERROR(dev, "missing device configuration\n");
 		return -ENODEV;
 	}
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

PATCH 6/19 drm/panel: sitronix: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/panel/panel-sitronix-st7789v.c +6 -4
index 76bd6e7a1a60..f649fe5cc364 100644
@@ -16,6 +16,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
@@ -180,9 +181,10 @@ static int st7789v_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
-			default_mode.hdisplay, default_mode.vdisplay,
-			default_mode.vrefresh);
+		DRM_DEV_ERROR(panel->drm->dev,
+			      "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -393,7 +395,7 @@ static int st7789v_probe(struct spi_device *spi)
 
 	ctx->reset = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ctx->reset)) {
-		dev_err(&spi->dev, "Couldn't get our reset line\n");
+		DRM_DEV_ERROR(&spi->dev, "Couldn't get our reset line\n");
 		return PTR_ERR(ctx->reset);
 	}
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

PATCH 7/19 drm/panel: ilitek: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c  | 93 +++++++++++++++------------
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 14 ++--
 2 files changed, 60 insertions(+), 47 deletions(-)
drivers/gpu/drm/panel/panel-ilitek-ili9322.c +52 -41
index 1ee8b2ccf718..e5e60347d3cf 100644
@@ -302,7 +302,7 @@ static int ili9322_regmap_spi_write(void *context, const void *data,
 	memcpy(buf, data, 2);
 	buf[0] &= ~0x80;
 
-	dev_dbg(dev, "WRITE: %02x %02x\n", buf[0], buf[1]);
+	DRM_DEV_DEBUG(dev, "WRITE: %02x %02x\n", buf[0], buf[1]);
 	return spi_write_then_read(spi, buf, 2, NULL, 0);
 }
 
@@ -315,8 +315,8 @@ static int ili9322_regmap_spi_read(void *context, const void *reg,
 
 	/* Set bit 7 to 1 to read */
 	memcpy(buf, reg, 1);
-	dev_dbg(dev, "READ: %02x reg size = %zu, val size = %zu\n",
-		buf[0], reg_size, val_size);
+	DRM_DEV_DEBUG(dev, "READ: %02x reg size = %zu, val size = %zu\n",
+		      buf[0], reg_size, val_size);
 	buf[0] |= 0x80;
 
 	return spi_write_then_read(spi, buf, 1, val, 1);
@@ -362,7 +362,7 @@ static int ili9322_init(struct drm_panel *panel, struct ili9322 *ili)
 	ret = regmap_write(ili->regmap, ILI9322_GLOBAL_RESET,
 			   ILI9322_GLOBAL_RESET_ASSERT);
 	if (ret) {
-		dev_err(ili->dev, "can't issue GRESET (%d)\n", ret);
+		DRM_DEV_ERROR(ili->dev, "can't issue GRESET (%d)\n", ret);
 		return ret;
 	}
 
@@ -371,7 +371,8 @@ static int ili9322_init(struct drm_panel *panel, struct ili9322 *ili)
 		ret = regmap_write(ili->regmap, ILI9322_VREG1_VOLTAGE,
 				   ili->vreg1out);
 		if (ret) {
-			dev_err(ili->dev, "can't set up VREG1OUT (%d)\n", ret);
+			DRM_DEV_ERROR(ili->dev,
+				      "can't set up VREG1OUT (%d)\n", ret);
 			return ret;
 		}
 	}
@@ -380,8 +381,9 @@ static int ili9322_init(struct drm_panel *panel, struct ili9322 *ili)
 		ret = regmap_write(ili->regmap, ILI9322_VCOM_AMP,
 				   ili->vcom_amplitude);
 		if (ret) {
-			dev_err(ili->dev,
-				"can't set up VCOM amplitude (%d)\n", ret);
+			DRM_DEV_ERROR(ili->dev,
+				      "can't set up VCOM amplitude (%d)\n",
+				      ret);
 			return ret;
 		}
 	};
@@ -390,7 +392,8 @@ static int ili9322_init(struct drm_panel *panel, struct ili9322 *ili)
 		ret = regmap_write(ili->regmap, ILI9322_VCOM_HIGH,
 				   ili->vcom_high);
 		if (ret) {
-			dev_err(ili->dev, "can't set up VCOM high (%d)\n", ret);
+			DRM_DEV_ERROR(ili->dev,
+				      "can't set up VCOM high (%d)\n", ret);
 			return ret;
 		}
 	};
@@ -400,9 +403,9 @@ static int ili9322_init(struct drm_panel *panel, struct ili9322 *ili)
 		ret = regmap_write(ili->regmap, ILI9322_GAMMA_1 + i,
 				   ili->gamma[i]);
 		if (ret) {
-			dev_err(ili->dev,
-				"can't write gamma V%d to 0x%02x (%d)\n",
-				i + 1, ILI9322_GAMMA_1 + i, ret);
+			DRM_DEV_ERROR(ili->dev,
+				      "can't write gamma V%d to 0x%02x (%d)\n",
+				      i + 1, ILI9322_GAMMA_1 + i, ret);
 			return ret;
 		}
 	}
@@ -434,7 +437,8 @@ static int ili9322_init(struct drm_panel *panel, struct ili9322 *ili)
 		reg |= ILI9322_POL_VSYNC;
 	ret = regmap_write(ili->regmap, ILI9322_POL, reg);
 	if (ret) {
-		dev_err(ili->dev, "can't write POL register (%d)\n", ret);
+		DRM_DEV_ERROR(ili->dev,
+			      "can't write POL register (%d)\n", ret);
 		return ret;
 	}
 
@@ -446,7 +450,8 @@ static int ili9322_init(struct drm_panel *panel, struct ili9322 *ili)
 	reg |= ILI9322_IF_CTRL_LINE_INVERSION;
 	ret = regmap_write(ili->regmap, ILI9322_IF_CTRL, reg);
 	if (ret) {
-		dev_err(ili->dev, "can't write IF CTRL register (%d)\n", ret);
+		DRM_DEV_ERROR(ili->dev,
+			      "can't write IF CTRL register (%d)\n", ret);
 		return ret;
 	}
 
@@ -460,14 +465,14 @@ static int ili9322_init(struct drm_panel *panel, struct ili9322 *ili)
 	reg |= ILI9322_ENTRY_AUTODETECT;
 	ret = regmap_write(ili->regmap, ILI9322_ENTRY, reg);
 	if (ret) {
-		dev_err(ili->dev, "can't write ENTRY reg (%d)\n", ret);
+		DRM_DEV_ERROR(ili->dev, "can't write ENTRY reg (%d)\n", ret);
 		return ret;
 	}
-	dev_info(ili->dev, "display is in %s mode, syncmode %02x\n",
-		 ili9322_inputs[ili->input],
+	DRM_DEV_INFO(ili->dev, "display is in %s mode, syncmode %02x\n",
+		     ili9322_inputs[ili->input],
 		 ili->conf->syncmode);
 
-	dev_info(ili->dev, "initialized display\n");
+	DRM_DEV_INFO(ili->dev, "initialized display\n");
 
 	return 0;
 }
@@ -484,7 +489,7 @@ static int ili9322_power_on(struct ili9322 *ili)
 
 	ret = regulator_bulk_enable(ARRAY_SIZE(ili->supplies), ili->supplies);
 	if (ret < 0) {
-		dev_err(ili->dev, "unable to enable regulators\n");
+		DRM_DEV_ERROR(ili->dev, "unable to enable regulators\n");
 		return ret;
 	}
 	msleep(20);
@@ -510,7 +515,7 @@ static int ili9322_disable(struct drm_panel *panel)
 	ret = regmap_write(ili->regmap, ILI9322_POW_CTRL,
 			   ILI9322_POW_CTRL_STANDBY);
 	if (ret) {
-		dev_err(ili->dev, "unable to go to standby mode\n");
+		DRM_DEV_ERROR(ili->dev, "unable to go to standby mode\n");
 		return ret;
 	}
 
@@ -548,7 +553,7 @@ static int ili9322_enable(struct drm_panel *panel)
 	ret = regmap_write(ili->regmap, ILI9322_POW_CTRL,
 			   ILI9322_POW_CTRL_DEFAULT);
 	if (ret) {
-		dev_err(ili->dev, "unable to enable panel\n");
+		DRM_DEV_ERROR(ili->dev, "unable to enable panel\n");
 		return ret;
 	}
 
@@ -756,7 +761,7 @@ static int ili9322_probe(struct spi_device *spi)
 	 */
 	ili->conf = of_device_get_match_data(dev);
 	if (!ili->conf) {
-		dev_err(dev, "missing device configuration\n");
+		DRM_DEV_ERROR(dev, "missing device configuration\n");
 		return -ENODEV;
 	}
 
@@ -766,20 +771,21 @@ static int ili9322_probe(struct spi_device *spi)
 		ili->vreg1out = U8_MAX;
 	} else {
 		if (val < 3600) {
-			dev_err(dev, "too low VREG1OUT\n");
+			DRM_DEV_ERROR(dev, "too low VREG1OUT\n");
 			return -EINVAL;
 		}
 		if (val > 6000) {
-			dev_err(dev, "too high VREG1OUT\n");
+			DRM_DEV_ERROR(dev, "too high VREG1OUT\n");
 			return -EINVAL;
 		}
 		if ((val % 100) != 0) {
-			dev_err(dev, "VREG1OUT is no even 100 microvolt\n");
+			DRM_DEV_ERROR(dev,
+				      "VREG1OUT is no even 100 microvolt\n");
 			return -EINVAL;
 		}
 		val -= 3600;
 		val /= 100;
-		dev_dbg(dev, "VREG1OUT = 0x%02x\n", val);
+		DRM_DEV_DEBUG(dev, "VREG1OUT = 0x%02x\n", val);
 		ili->vreg1out = val;
 	}
 
@@ -789,15 +795,15 @@ static int ili9322_probe(struct spi_device *spi)
 		ili->vcom_high = U8_MAX;
 	} else {
 		if (val < 37) {
-			dev_err(dev, "too low VCOM high\n");
+			DRM_DEV_ERROR(dev, "too low VCOM high\n");
 			return -EINVAL;
 		}
 		if (val > 100) {
-			dev_err(dev, "too high VCOM high\n");
+			DRM_DEV_ERROR(dev, "too high VCOM high\n");
 			return -EINVAL;
 		}
 		val -= 37;
-		dev_dbg(dev, "VCOM high = 0x%02x\n", val);
+		DRM_DEV_DEBUG(dev, "VCOM high = 0x%02x\n", val);
 		ili->vcom_high = val;
 	}
 
@@ -807,34 +813,38 @@ static int ili9322_probe(struct spi_device *spi)
 		ili->vcom_high = U8_MAX;
 	} else {
 		if (val < 70) {
-			dev_err(dev, "too low VCOM amplitude\n");
+			DRM_DEV_ERROR(dev, "too low VCOM amplitude\n");
 			return -EINVAL;
 		}
 		if (val > 132) {
-			dev_err(dev, "too high VCOM amplitude\n");
+			DRM_DEV_ERROR(dev, "too high VCOM amplitude\n");
 			return -EINVAL;
 		}
 		val -= 70;
 		val >>= 1; /* Increments of 2% */
-		dev_dbg(dev, "VCOM amplitude = 0x%02x\n", val);
+		DRM_DEV_DEBUG(dev, "VCOM amplitude = 0x%02x\n", val);
 		ili->vcom_amplitude = val;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(ili->gamma); i++) {
 		val = ili->conf->gamma_corr_neg[i];
 		if (val > 15) {
-			dev_err(dev, "negative gamma %u > 15, capping\n", val);
+			DRM_DEV_ERROR(dev,
+				      "negative gamma %u > 15, capping\n",
+				      val);
 			val = 15;
 		}
 		gamma = val << 4;
 		val = ili->conf->gamma_corr_pos[i];
 		if (val > 15) {
-			dev_err(dev, "positive gamma %u > 15, capping\n", val);
+			DRM_DEV_ERROR(dev,
+				      "positive gamma %u > 15, capping\n",
+				      val);
 			val = 15;
 		}
 		gamma |= val;
 		ili->gamma[i] = gamma;
-		dev_dbg(dev, "gamma V%d: 0x%02x\n", i + 1, gamma);
+		DRM_DEV_DEBUG(dev, "gamma V%d: 0x%02x\n", i + 1, gamma);
 	}
 
 	ili->supplies[0].supply = "vcc"; /* 2.7-3.6 V */
@@ -859,32 +869,32 @@ static int ili9322_probe(struct spi_device *spi)
 
 	ili->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ili->reset_gpio)) {
-		dev_err(dev, "failed to get RESET GPIO\n");
+		DRM_DEV_ERROR(dev, "failed to get RESET GPIO\n");
 		return PTR_ERR(ili->reset_gpio);
 	}
 
 	spi->bits_per_word = 8;
 	ret = spi_setup(spi);
 	if (ret < 0) {
-		dev_err(dev, "spi setup failed.\n");
+		DRM_DEV_ERROR(dev, "spi setup failed.\n");
 		return ret;
 	}
 	regmap_config = &ili9322_regmap_config;
 	ili->regmap = devm_regmap_init(dev, &ili9322_regmap_bus, dev,
 				       regmap_config);
 	if (IS_ERR(ili->regmap)) {
-		dev_err(dev, "failed to allocate register map\n");
+		DRM_DEV_ERROR(dev, "failed to allocate register map\n");
 		return PTR_ERR(ili->regmap);
 	}
 
 	ret = regmap_read(ili->regmap, ILI9322_CHIP_ID, &val);
 	if (ret) {
-		dev_err(dev, "can't get chip ID (%d)\n", ret);
+		DRM_DEV_ERROR(dev, "can't get chip ID (%d)\n", ret);
 		return ret;
 	}
 	if (val != ILI9322_CHIP_ID_MAGIC) {
-		dev_err(dev, "chip ID 0x%0x2, expected 0x%02x\n", val,
-			ILI9322_CHIP_ID_MAGIC);
+		DRM_DEV_ERROR(dev, "chip ID 0x%0x2, expected 0x%02x\n", val,
+			      ILI9322_CHIP_ID_MAGIC);
 		return -ENODEV;
 	}
 
@@ -892,7 +902,8 @@ static int ili9322_probe(struct spi_device *spi)
 	if (ili->conf->input == ILI9322_INPUT_UNKNOWN) {
 		ret = regmap_read(ili->regmap, ILI9322_ENTRY, &val);
 		if (ret) {
-			dev_err(dev, "can't get entry setting (%d)\n", ret);
+			DRM_DEV_ERROR(dev,
+				      "can't get entry setting (%d)\n", ret);
 			return ret;
 		}
 		/* Input enum corresponds to HW setting */
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +8 -6
index 3ad4a46c4e94..f72059578c74 100644
@@ -18,6 +18,7 @@
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
@@ -395,10 +396,11 @@ static int ili9881c_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &bananapi_default_mode);
 	if (!mode) {
-		dev_err(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n",
-			bananapi_default_mode.hdisplay,
-			bananapi_default_mode.vdisplay,
-			bananapi_default_mode.vrefresh);
+		DRM_DEV_ERROR(&ctx->dsi->dev,
+			      "failed to add mode %ux%ux@%u\n",
+			      bananapi_default_mode.hdisplay,
+			      bananapi_default_mode.vdisplay,
+			      bananapi_default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -439,13 +441,13 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
 
 	ctx->power = devm_regulator_get(&dsi->dev, "power");
 	if (IS_ERR(ctx->power)) {
-		dev_err(&dsi->dev, "Couldn't get our power regulator\n");
+		DRM_DEV_ERROR(&dsi->dev, "Couldn't get our power regulator\n");
 		return PTR_ERR(ctx->power);
 	}
 
 	ctx->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ctx->reset)) {
-		dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
+		DRM_DEV_ERROR(&dsi->dev, "Couldn't get our reset GPIO\n");
 		return PTR_ERR(ctx->reset);
 	}
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

PATCH 8/19 drm/panel: innolux: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-innolux-p079zca.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/panel/panel-innolux-p079zca.c +7 -5
index c8d0da3116dd..cf18594d1954 100644
@@ -154,8 +154,9 @@ static int innolux_panel_prepare(struct drm_panel *panel)
 			err = mipi_dsi_generic_write(innolux->link, cmd->data,
 						     cmd->len);
 			if (err < 0) {
-				dev_err(panel->dev,
-					"failed to write command %u\n", i);
+				DRM_DEV_ERROR(panel->dev,
+					      "failed to write command %u\n",
+					      i);
 				goto poweroff;
 			}
 
@@ -166,8 +167,9 @@ static int innolux_panel_prepare(struct drm_panel *panel)
 			 */
 			err = mipi_dsi_dcs_nop(innolux->link);
 			if (err < 0) {
-				dev_err(panel->dev,
-					"failed to send DCS nop: %d\n", err);
+				DRM_DEV_ERROR(panel->dev,
+					      "failed to send DCS nop: %d\n",
+					      err);
 				goto poweroff;
 			}
 		}
@@ -482,7 +484,7 @@ static int innolux_panel_add(struct mipi_dsi_device *dsi,
 						       GPIOD_OUT_HIGH);
 	if (IS_ERR(innolux->enable_gpio)) {
 		err = PTR_ERR(innolux->enable_gpio);
-		dev_dbg(dev, "failed to get enable gpio: %d\n", err);
+		DRM_DEV_DEBUG(dev, "failed to get enable gpio: %d\n", err);
 		innolux->enable_gpio = NULL;
 	}
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

PATCH 9/19 drm/panel: jdi: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 64 ++++++++++++++------------
 1 file changed, 34 insertions(+), 30 deletions(-)
drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +34 -30
index fecdda0b99a5..6e172b5d7dff 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
@@ -77,19 +78,19 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_dcs_set_pixel_format(dsi, MIPI_DCS_PIXEL_FMT_24BIT << 4);
 	if (ret < 0) {
-		dev_err(dev, "failed to set pixel format: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set pixel format: %d\n", ret);
 		return ret;
 	}
 
 	ret = mipi_dsi_dcs_set_column_address(dsi, 0, jdi->mode->hdisplay - 1);
 	if (ret < 0) {
-		dev_err(dev, "failed to set column address: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set column address: %d\n", ret);
 		return ret;
 	}
 
 	ret = mipi_dsi_dcs_set_page_address(dsi, 0, jdi->mode->vdisplay - 1);
 	if (ret < 0) {
-		dev_err(dev, "failed to set page address: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set page address: %d\n", ret);
 		return ret;
 	}
 
@@ -102,7 +103,8 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 	ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY,
 				 (u8[]){ 0x24 }, 1);
 	if (ret < 0) {
-		dev_err(dev, "failed to write control display: %d\n", ret);
+		DRM_DEV_ERROR(dev,
+			      "failed to write control display: %d\n", ret);
 		return ret;
 	}
 
@@ -110,13 +112,13 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 	ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_POWER_SAVE,
 				 (u8[]){ 0x00 }, 1);
 	if (ret < 0) {
-		dev_err(dev, "failed to set cabc off: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set cabc off: %d\n", ret);
 		return ret;
 	}
 
 	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
 	if (ret < 0) {
-		dev_err(dev, "failed to set exit sleep mode: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set exit sleep mode: %d\n", ret);
 		return ret;
 	}
 
@@ -124,7 +126,7 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_generic_write(dsi, (u8[]){0xB0, 0x00}, 2);
 	if (ret < 0) {
-		dev_err(dev, "failed to set mcap: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set mcap: %d\n", ret);
 		return ret;
 	}
 
@@ -134,8 +136,9 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 	ret = mipi_dsi_generic_write(dsi, (u8[])
 				     {0xB3, 0x26, 0x08, 0x00, 0x20, 0x00}, 6);
 	if (ret < 0) {
-		dev_err(dev, "failed to set display interface setting: %d\n"
-			, ret);
+		DRM_DEV_ERROR(dev,
+			      "failed to set display interface setting: %d\n",
+			      ret);
 		return ret;
 	}
 
@@ -143,8 +146,9 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_generic_write(dsi, (u8[]){0xB0, 0x03}, 2);
 	if (ret < 0) {
-		dev_err(dev, "failed to set default values for mcap: %d\n"
-			, ret);
+		DRM_DEV_ERROR(dev,
+			      "failed to set default values for mcap: %d\n",
+			      ret);
 		return ret;
 	}
 
@@ -161,7 +165,7 @@ static int jdi_panel_on(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_dcs_set_display_on(dsi);
 	if (ret < 0)
-		dev_err(dev, "failed to set display on: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set display on: %d\n", ret);
 
 	return ret;
 }
@@ -176,11 +180,11 @@ static void jdi_panel_off(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_dcs_set_display_off(dsi);
 	if (ret < 0)
-		dev_err(dev, "failed to set display off: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set display off: %d\n", ret);
 
 	ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
 	if (ret < 0)
-		dev_err(dev, "failed to enter sleep mode: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to enter sleep mode: %d\n", ret);
 
 	msleep(100);
 }
@@ -212,7 +216,7 @@ static int jdi_panel_unprepare(struct drm_panel *panel)
 
 	ret = regulator_bulk_disable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
 	if (ret < 0)
-		dev_err(dev, "regulator disable failed, %d\n", ret);
+		DRM_DEV_ERROR(dev, "regulator disable failed, %d\n", ret);
 
 	gpiod_set_value(jdi->enable_gpio, 0);
 
@@ -236,7 +240,7 @@ static int jdi_panel_prepare(struct drm_panel *panel)
 
 	ret = regulator_bulk_enable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
 	if (ret < 0) {
-		dev_err(dev, "regulator enable failed, %d\n", ret);
+		DRM_DEV_ERROR(dev, "regulator enable failed, %d\n", ret);
 		return ret;
 	}
 
@@ -253,13 +257,13 @@ static int jdi_panel_prepare(struct drm_panel *panel)
 
 	ret = jdi_panel_init(jdi);
 	if (ret < 0) {
-		dev_err(dev, "failed to init panel: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to init panel: %d\n", ret);
 		goto poweroff;
 	}
 
 	ret = jdi_panel_on(jdi);
 	if (ret < 0) {
-		dev_err(dev, "failed to set panel on: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set panel on: %d\n", ret);
 		goto poweroff;
 	}
 
@@ -270,7 +274,7 @@ static int jdi_panel_prepare(struct drm_panel *panel)
 poweroff:
 	ret = regulator_bulk_disable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
 	if (ret < 0)
-		dev_err(dev, "regulator disable failed, %d\n", ret);
+		DRM_DEV_ERROR(dev, "regulator disable failed, %d\n", ret);
 
 	gpiod_set_value(jdi->enable_gpio, 0);
 
@@ -317,9 +321,9 @@ static int jdi_panel_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(dev, "failed to add mode %ux%ux@%u\n",
-			default_mode.hdisplay, default_mode.vdisplay,
-			default_mode.vrefresh);
+		DRM_DEV_ERROR(dev, "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -414,35 +418,35 @@ static int jdi_panel_add(struct jdi_panel *jdi)
 	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(jdi->supplies),
 				      jdi->supplies);
 	if (ret < 0) {
-		dev_err(dev, "failed to init regulator, ret=%d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to init regulator, ret=%d\n", ret);
 		return ret;
 	}
 
 	jdi->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
 	if (IS_ERR(jdi->enable_gpio)) {
 		ret = PTR_ERR(jdi->enable_gpio);
-		dev_err(dev, "cannot get enable-gpio %d\n", ret);
+		DRM_DEV_ERROR(dev, "cannot get enable-gpio %d\n", ret);
 		return ret;
 	}
 
 	jdi->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(jdi->reset_gpio)) {
 		ret = PTR_ERR(jdi->reset_gpio);
-		dev_err(dev, "cannot get reset-gpios %d\n", ret);
+		DRM_DEV_ERROR(dev, "cannot get reset-gpios %d\n", ret);
 		return ret;
 	}
 
 	jdi->dcdc_en_gpio = devm_gpiod_get(dev, "dcdc-en", GPIOD_OUT_LOW);
 	if (IS_ERR(jdi->dcdc_en_gpio)) {
 		ret = PTR_ERR(jdi->dcdc_en_gpio);
-		dev_err(dev, "cannot get dcdc-en-gpio %d\n", ret);
+		DRM_DEV_ERROR(dev, "cannot get dcdc-en-gpio %d\n", ret);
 		return ret;
 	}
 
 	jdi->backlight = drm_panel_create_dsi_backlight(jdi->dsi);
 	if (IS_ERR(jdi->backlight)) {
 		ret = PTR_ERR(jdi->backlight);
-		dev_err(dev, "failed to register backlight %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to register backlight %d\n", ret);
 		return ret;
 	}
 
@@ -493,12 +497,12 @@ static int jdi_panel_remove(struct mipi_dsi_device *dsi)
 
 	ret = jdi_panel_disable(&jdi->base);
 	if (ret < 0)
-		dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
+		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", ret);
 
 	ret = mipi_dsi_detach(dsi);
 	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n",
-			ret);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to detach from DSI host: %d\n", ret);
 
 	jdi_panel_del(jdi);
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

PATCH 10/19 drm/panel: lg: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-lg-lg4573.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/panel/panel-lg-lg4573.c +11 -9
index e63fba2761f4..9bbf6dde6b7d 100644
@@ -18,6 +18,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
@@ -48,7 +49,7 @@ static int lg4573_spi_write_u16(struct lg4573 *ctx, u16 data)
 	u16 temp = cpu_to_be16(data);
 	struct spi_message msg;
 
-	dev_dbg(ctx->panel.dev, "writing data: %x\n", data);
+	DRM_DEV_DEBUG(ctx->panel.dev, "writing data: %x\n", data);
 	xfer.tx_buf = &temp;
 	spi_message_init(&msg);
 	spi_message_add_tail(&xfer, &msg);
@@ -115,7 +116,7 @@ static int lg4573_display_mode_settings(struct lg4573 *ctx)
 		0x7206, 0x720C, 0x7200, 0x7200,
 	};
 
-	dev_dbg(ctx->panel.dev, "transfer display mode settings\n");
+	DRM_DEV_DEBUG(ctx->panel.dev, "transfer display mode settings\n");
 	return lg4573_spi_write_u16_array(ctx, display_mode_settings,
 					  ARRAY_SIZE(display_mode_settings));
 }
@@ -131,7 +132,7 @@ static int lg4573_power_settings(struct lg4573 *ctx)
 		0x7263,
 	};
 
-	dev_dbg(ctx->panel.dev, "transfer power settings\n");
+	DRM_DEV_DEBUG(ctx->panel.dev, "transfer power settings\n");
 	return lg4573_spi_write_u16_array(ctx, power_settings,
 					  ARRAY_SIZE(power_settings));
 }
@@ -156,7 +157,7 @@ static int lg4573_gamma_settings(struct lg4573 *ctx)
 		0x7201, 0x7220, 0x7200, 0x7203,
 	};
 
-	dev_dbg(ctx->panel.dev, "transfer gamma settings\n");
+	DRM_DEV_DEBUG(ctx->panel.dev, "transfer gamma settings\n");
 	return lg4573_spi_write_u16_array(ctx, gamma_settings,
 					  ARRAY_SIZE(gamma_settings));
 }
@@ -165,7 +166,7 @@ static int lg4573_init(struct lg4573 *ctx)
 {
 	int ret;
 
-	dev_dbg(ctx->panel.dev, "initializing LCD\n");
+	DRM_DEV_DEBUG(ctx->panel.dev, "initializing LCD\n");
 
 	ret = lg4573_display_mode_settings(ctx);
 	if (ret)
@@ -219,9 +220,10 @@ static int lg4573_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
-			default_mode.hdisplay, default_mode.vdisplay,
-			default_mode.vrefresh);
+		DRM_DEV_ERROR(panel->drm->dev,
+			      "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -258,7 +260,7 @@ static int lg4573_probe(struct spi_device *spi)
 
 	ret = spi_setup(spi);
 	if (ret < 0) {
-		dev_err(&spi->dev, "SPI setup failed: %d\n", ret);
+		DRM_DEV_ERROR(&spi->dev, "SPI setup failed: %d\n", ret);
 		return ret;
 	}
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

PATCH 11/19 drm/panel: lvds: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-lvds.c | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)
drivers/gpu/drm/panel/panel-lvds.c +22 -16
index 833aeb47065b..2aa0555f78ac 100644
@@ -18,6 +18,7 @@
 
 #include <drm/drm_crtc.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/display_timing.h>
 #include <video/of_display_timing.h>
@@ -81,8 +82,8 @@ static int panel_lvds_prepare(struct drm_panel *panel)
 
 		err = regulator_enable(lvds->supply);
 		if (err < 0) {
-			dev_err(lvds->dev, "failed to enable supply: %d\n",
-				err);
+			DRM_DEV_ERROR(lvds->dev,
+				      "failed to enable supply: %d\n", err);
 			return err;
 		}
 	}
@@ -154,14 +155,16 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
 
 	ret = of_property_read_u32(np, "width-mm", &lvds->width);
 	if (ret < 0) {
-		dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
-			np, "width-mm");
+		DRM_DEV_ERROR(lvds->dev,
+			      "%pOF: invalid or missing %s DT property\n",
+			      np, "width-mm");
 		return -ENODEV;
 	}
 	ret = of_property_read_u32(np, "height-mm", &lvds->height);
 	if (ret < 0) {
-		dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
-			np, "height-mm");
+		DRM_DEV_ERROR(lvds->dev,
+			      "%pOF: invalid or missing %s DT property\n",
+			      np, "height-mm");
 		return -ENODEV;
 	}
 
@@ -169,8 +172,9 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
 
 	ret = of_property_read_string(np, "data-mapping", &mapping);
 	if (ret < 0) {
-		dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
-			np, "data-mapping");
+		DRM_DEV_ERROR(lvds->dev,
+			      "%pOF: invalid or missing %s DT property\n",
+			      np, "data-mapping");
 		return -ENODEV;
 	}
 
@@ -181,8 +185,9 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
 	} else if (!strcmp(mapping, "vesa-24")) {
 		lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
 	} else {
-		dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
-			np, "data-mapping");
+		DRM_DEV_ERROR(lvds->dev,
+			      "%pOF: invalid or missing %s DT property\n",
+			      np, "data-mapping");
 		return -EINVAL;
 	}
 
@@ -213,8 +218,9 @@ static int panel_lvds_probe(struct platform_device *pdev)
 
 		if (ret != -ENODEV) {
 			if (ret != -EPROBE_DEFER)
-				dev_err(lvds->dev, "failed to request regulator: %d\n",
-					ret);
+				DRM_DEV_ERROR(lvds->dev,
+					      "failed to request regulator: %d\n",
+					      ret);
 			return ret;
 		}
 
@@ -226,8 +232,8 @@ static int panel_lvds_probe(struct platform_device *pdev)
 						     GPIOD_OUT_LOW);
 	if (IS_ERR(lvds->enable_gpio)) {
 		ret = PTR_ERR(lvds->enable_gpio);
-		dev_err(lvds->dev, "failed to request %s GPIO: %d\n",
-			"enable", ret);
+		DRM_DEV_ERROR(lvds->dev, "failed to request %s GPIO: %d\n",
+			      "enable", ret);
 		return ret;
 	}
 
@@ -235,8 +241,8 @@ static int panel_lvds_probe(struct platform_device *pdev)
 						     GPIOD_OUT_HIGH);
 	if (IS_ERR(lvds->reset_gpio)) {
 		ret = PTR_ERR(lvds->reset_gpio);
-		dev_err(lvds->dev, "failed to request %s GPIO: %d\n",
-			"reset", ret);
+		DRM_DEV_ERROR(lvds->dev, "failed to request %s GPIO: %d\n",
+			      "reset", ret);
 		return ret;
 	}
 
Signature · 1 line
2.12.0
#12 lore raw

PATCH 12/19 drm/panel: olimex: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Stefan Mavrodiev <[email protected]>
Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c | 26 +++++++++++++---------
 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c +15 -11
index c8704be9caa3..efb223b35594 100644
@@ -18,6 +18,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/videomode.h>
 #include <video/display_timing.h>
@@ -157,10 +158,11 @@ static int lcd_olinuxino_get_modes(struct drm_panel *panel)
 
 		mode = drm_mode_create(drm);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
-				lcd_mode->hactive,
-				lcd_mode->vactive,
-				lcd_mode->refresh);
+			DRM_DEV_ERROR(drm->dev,
+				      "failed to add mode %ux%u@%u\n",
+				      lcd_mode->hactive,
+				      lcd_mode->vactive,
+				      lcd_mode->refresh);
 				continue;
 		}
 
@@ -242,7 +244,8 @@ static int lcd_olinuxino_probe(struct i2c_client *client,
 						    (u8 *)&lcd->eeprom + i);
 		mutex_unlock(&lcd->mutex);
 		if (ret < 0) {
-			dev_err(dev, "error reading from device at %02x\n", i);
+			DRM_DEV_ERROR(dev,
+				      "error reading from device at %02x\n", i);
 			return ret;
 		}
 	}
@@ -250,20 +253,21 @@ static int lcd_olinuxino_probe(struct i2c_client *client,
 	/* Check configuration checksum */
 	checksum = ~crc32(~0, (u8 *)&lcd->eeprom, 252);
 	if (checksum != lcd->eeprom.checksum) {
-		dev_err(dev, "configuration checksum does not match!\n");
+		DRM_DEV_ERROR(dev,
+			      "configuration checksum does not match!\n");
 		return -EINVAL;
 	}
 
 	/* Check magic header */
 	if (lcd->eeprom.header != LCD_OLINUXINO_HEADER_MAGIC) {
-		dev_err(dev, "magic header does not match\n");
+		DRM_DEV_ERROR(dev, "magic header does not match\n");
 		return -EINVAL;
 	}
 
-	dev_info(dev, "Detected %s, Rev. %s, Serial: %08x\n",
-		 lcd->eeprom.info.name,
-		 lcd->eeprom.revision,
-		 lcd->eeprom.serial);
+	DRM_DEV_INFO(dev, "Detected %s, Rev. %s, Serial: %08x\n",
+		     lcd->eeprom.info.name,
+		     lcd->eeprom.revision,
+		     lcd->eeprom.serial);
 
 	/*
 	 * The eeprom can hold up to 4 modes.
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

PATCH 13/19 drm/panel: orisetech: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +4 -4
index 5bacf3f2da05..e7920ae018bd 100644
@@ -431,14 +431,14 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
 
 	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ctx->reset_gpio)) {
-		dev_err(dev, "cannot get reset-gpio\n");
+		DRM_DEV_ERROR(dev, "cannot get reset-gpio\n");
 		return PTR_ERR(ctx->reset_gpio);
 	}
 
 	ctx->supply = devm_regulator_get(dev, "power");
 	if (IS_ERR(ctx->supply)) {
 		ret = PTR_ERR(ctx->supply);
-		dev_err(dev, "failed to request regulator: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to request regulator: %d\n", ret);
 		return ret;
 	}
 
@@ -461,7 +461,7 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
 						     NULL);
 	if (IS_ERR(ctx->bl_dev)) {
 		ret = PTR_ERR(ctx->bl_dev);
-		dev_err(dev, "failed to register backlight: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to register backlight: %d\n", ret);
 		return ret;
 	}
 
@@ -474,7 +474,7 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret < 0) {
-		dev_err(dev, "mipi_dsi_attach failed. Is host ready?\n");
+		DRM_DEV_ERROR(dev, "mipi_dsi_attach failed. Is host ready?\n");
 		drm_panel_remove(&ctx->panel);
 		backlight_device_unregister(ctx->bl_dev);
 		return ret;
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#14 lore raw

PATCH 14/19 drm/panel: panasonic: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +10 -6
index c7037942c7f3..738270439285 100644
@@ -28,6 +28,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
@@ -132,7 +133,7 @@ static int wuxga_nt_panel_prepare(struct drm_panel *panel)
 
 	ret = wuxga_nt_panel_on(wuxga_nt);
 	if (ret < 0) {
-		dev_err(panel->dev, "failed to set panel on: %d\n", ret);
+		DRM_DEV_ERROR(panel->dev, "failed to set panel on: %d\n", ret);
 		goto poweroff;
 	}
 
@@ -183,9 +184,10 @@ static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
-				default_mode.hdisplay, default_mode.vdisplay,
-				default_mode.vrefresh);
+		DRM_DEV_ERROR(panel->drm->dev,
+			      "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -294,11 +296,13 @@ static int wuxga_nt_panel_remove(struct mipi_dsi_device *dsi)
 
 	ret = wuxga_nt_panel_disable(&wuxga_nt->base);
 	if (ret < 0)
-		dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to disable panel: %d\n", ret);
 
 	ret = mipi_dsi_detach(dsi);
 	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to detach from DSI host: %d\n", ret);
 
 	wuxga_nt_panel_del(wuxga_nt);
 
Signature · 1 line
2.12.0
#15 lore raw

PATCH 15/19 drm/panel: raspberrypi: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 .../gpu/drm/panel/panel-raspberrypi-touchscreen.c  | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +14 -8
index 28c0620dfe0f..c9013faff9ed 100644
@@ -57,6 +57,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #define RPI_DSI_DRIVER_NAME "rpi-ts-dsi"
 
@@ -232,7 +233,7 @@ static void rpi_touchscreen_i2c_write(struct rpi_touchscreen *ts,
 
 	ret = i2c_smbus_write_byte_data(ts->i2c, reg, val);
 	if (ret)
-		dev_err(&ts->dsi->dev, "I2C write failed: %d\n", ret);
+		DRM_DEV_ERROR(&ts->dsi->dev, "I2C write failed: %d\n", ret);
 }
 
 static int rpi_touchscreen_write(struct rpi_touchscreen *ts, u16 reg, u32 val)
@@ -324,8 +325,9 @@ static int rpi_touchscreen_get_modes(struct drm_panel *panel)
 
 		mode = drm_mode_duplicate(drm, m);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
-				m->hdisplay, m->vdisplay, m->vrefresh);
+			DRM_DEV_ERROR(drm->dev,
+				      "failed to add mode %ux%u@%u\n",
+				      m->hdisplay, m->vdisplay, m->vrefresh);
 			continue;
 		}
 
@@ -381,7 +383,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c,
 
 	ver = rpi_touchscreen_i2c_read(ts, REG_ID);
 	if (ver < 0) {
-		dev_err(dev, "Atmel I2C read failed: %d\n", ver);
+		DRM_DEV_ERROR(dev, "Atmel I2C read failed: %d\n", ver);
 		return -ENODEV;
 	}
 
@@ -390,7 +392,9 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c,
 	case 0xc3: /* ver 2 */
 		break;
 	default:
-		dev_err(dev, "Unknown Atmel firmware revision: 0x%02x\n", ver);
+		DRM_DEV_ERROR(dev,
+			      "Unknown Atmel firmware revision: 0x%02x\n",
+			       ver);
 		return -ENODEV;
 	}
 
@@ -412,8 +416,9 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c,
 
 	ts->dsi = mipi_dsi_device_register_full(host, &info);
 	if (IS_ERR(ts->dsi)) {
-		dev_err(dev, "DSI device registration failed: %ld\n",
-			PTR_ERR(ts->dsi));
+		DRM_DEV_ERROR(dev,
+			      "DSI device registration failed: %ld\n",
+			      PTR_ERR(ts->dsi));
 		return PTR_ERR(ts->dsi);
 	}
 
@@ -457,7 +462,8 @@ static int rpi_touchscreen_dsi_probe(struct mipi_dsi_device *dsi)
 	ret = mipi_dsi_attach(dsi);
 
 	if (ret)
-		dev_err(&dsi->dev, "failed to attach dsi to host: %d\n", ret);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to attach dsi to host: %d\n", ret);
 
 	return ret;
 }
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#16 lore raw

PATCH 16/19 drm/panel: raydium: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-raydium-rm68200.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/panel/panel-raydium-rm68200.c +3 -3
index e05e3f950855..bbf3f51c8a3a 100644
@@ -379,14 +379,14 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)
 	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ctx->reset_gpio)) {
 		ret = PTR_ERR(ctx->reset_gpio);
-		dev_err(dev, "cannot get reset GPIO: %d\n", ret);
+		DRM_DEV_ERROR(dev, "cannot get reset GPIO: %d\n", ret);
 		return ret;
 	}
 
 	ctx->supply = devm_regulator_get(dev, "power");
 	if (IS_ERR(ctx->supply)) {
 		ret = PTR_ERR(ctx->supply);
-		dev_err(dev, "cannot get regulator: %d\n", ret);
+		DRM_DEV_ERROR(dev, "cannot get regulator: %d\n", ret);
 		return ret;
 	}
 
@@ -411,7 +411,7 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret < 0) {
-		dev_err(dev, "mipi_dsi_attach() failed: %d\n", ret);
+		DRM_DEV_ERROR(dev, "mipi_dsi_attach() failed: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
 		return ret;
 	}
Signature · 1 line
2.12.0
#17 lore raw

PATCH 17/19 drm/panel: seiko: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-seiko-43wvf1g.c +8 -6
index c1348a687447..26da26d38241 100644
@@ -16,6 +16,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_device.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/display_timing.h>
 #include <video/videomode.h>
@@ -73,8 +74,8 @@ static int seiko_panel_get_fixed_modes(struct seiko_panel *panel)
 		videomode_from_timing(dt, &vm);
 		mode = drm_mode_create(drm);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u\n",
-				dt->hactive.typ, dt->vactive.typ);
+			DRM_DEV_ERROR(drm->dev, "failed to add mode %ux%u\n",
+				      dt->hactive.typ, dt->vactive.typ);
 			continue;
 		}
 
@@ -94,8 +95,9 @@ static int seiko_panel_get_fixed_modes(struct seiko_panel *panel)
 
 		mode = drm_mode_duplicate(drm, m);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
-				m->hdisplay, m->vdisplay, m->vrefresh);
+			DRM_DEV_ERROR(drm->dev,
+				      "failed to add mode %ux%u@%u\n",
+				      m->hdisplay, m->vdisplay, m->vrefresh);
 			continue;
 		}
 
@@ -168,7 +170,7 @@ static int seiko_panel_prepare(struct drm_panel *panel)
 
 	err = regulator_enable(p->dvdd);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to enable dvdd: %d\n", err);
+		DRM_DEV_ERROR(panel->dev, "failed to enable dvdd: %d\n", err);
 		return err;
 	}
 
@@ -177,7 +179,7 @@ static int seiko_panel_prepare(struct drm_panel *panel)
 
 	err = regulator_enable(p->avdd);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to enable avdd: %d\n", err);
+		DRM_DEV_ERROR(panel->dev, "failed to enable avdd: %d\n", err);
 		goto disable_dvdd;
 	}
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#18 lore raw

PATCH 18/19 drm/panel: sharp: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 63 ++++++++++++++++---------
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 24 ++++++----
 2 files changed, 55 insertions(+), 32 deletions(-)
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +41 -22
index 2ed11d86c10e..98788750084c 100644
@@ -17,6 +17,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
@@ -58,14 +59,16 @@ static int sharp_panel_write(struct sharp_panel *sharp, u16 offset, u8 value)
 
 	err = mipi_dsi_generic_write(dsi, payload, sizeof(payload));
 	if (err < 0) {
-		dev_err(&dsi->dev, "failed to write %02x to %04x: %zd\n",
-			value, offset, err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to write %02x to %04x: %zd\n",
+			      value, offset, err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_nop(dsi);
 	if (err < 0) {
-		dev_err(&dsi->dev, "failed to send DCS nop: %zd\n", err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to send DCS nop: %zd\n", err);
 		return err;
 	}
 
@@ -84,8 +87,9 @@ static __maybe_unused int sharp_panel_read(struct sharp_panel *sharp,
 	err = mipi_dsi_generic_read(sharp->link1, &offset, sizeof(offset),
 				    value, sizeof(*value));
 	if (err < 0)
-		dev_err(&sharp->link1->dev, "failed to read from %04x: %zd\n",
-			offset, err);
+		DRM_DEV_ERROR(&sharp->link1->dev,
+			      "failed to read from %04x: %zd\n",
+			      offset, err);
 
 	return err;
 }
@@ -116,11 +120,13 @@ static int sharp_panel_unprepare(struct drm_panel *panel)
 
 	err = mipi_dsi_dcs_set_display_off(sharp->link1);
 	if (err < 0)
-		dev_err(panel->dev, "failed to set display off: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set display off: %d\n", err);
 
 	err = mipi_dsi_dcs_enter_sleep_mode(sharp->link1);
 	if (err < 0)
-		dev_err(panel->dev, "failed to enter sleep mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to enter sleep mode: %d\n", err);
 
 	msleep(120);
 
@@ -139,26 +145,30 @@ static int sharp_setup_symmetrical_split(struct mipi_dsi_device *left,
 
 	err = mipi_dsi_dcs_set_column_address(left, 0, mode->hdisplay / 2 - 1);
 	if (err < 0) {
-		dev_err(&left->dev, "failed to set column address: %d\n", err);
+		DRM_DEV_ERROR(&left->dev,
+			      "failed to set column address: %d\n", err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_set_page_address(left, 0, mode->vdisplay - 1);
 	if (err < 0) {
-		dev_err(&left->dev, "failed to set page address: %d\n", err);
+		DRM_DEV_ERROR(&left->dev,
+			      "failed to set page address: %d\n", err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_set_column_address(right, mode->hdisplay / 2,
 					      mode->hdisplay - 1);
 	if (err < 0) {
-		dev_err(&right->dev, "failed to set column address: %d\n", err);
+		DRM_DEV_ERROR(&right->dev,
+			      "failed to set column address: %d\n", err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_set_page_address(right, 0, mode->vdisplay - 1);
 	if (err < 0) {
-		dev_err(&right->dev, "failed to set page address: %d\n", err);
+		DRM_DEV_ERROR(&right->dev,
+			      "failed to set page address: %d\n", err);
 		return err;
 	}
 
@@ -188,7 +198,8 @@ static int sharp_panel_prepare(struct drm_panel *panel)
 
 	err = mipi_dsi_dcs_exit_sleep_mode(sharp->link1);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to exit sleep mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to exit sleep mode: %d\n", err);
 		goto poweroff;
 	}
 
@@ -204,20 +215,23 @@ static int sharp_panel_prepare(struct drm_panel *panel)
 	/* set left-right mode */
 	err = sharp_panel_write(sharp, 0x1000, 0x2a);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set left-right mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set left-right mode: %d\n", err);
 		goto poweroff;
 	}
 
 	/* enable command mode */
 	err = sharp_panel_write(sharp, 0x1001, 0x01);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to enable command mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to enable command mode: %d\n", err);
 		goto poweroff;
 	}
 
 	err = mipi_dsi_dcs_set_pixel_format(sharp->link1, format);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set pixel format: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set pixel format: %d\n", err);
 		goto poweroff;
 	}
 
@@ -231,14 +245,16 @@ static int sharp_panel_prepare(struct drm_panel *panel)
 	err = sharp_setup_symmetrical_split(sharp->link1, sharp->link2,
 					    sharp->mode);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set up symmetrical split: %d\n",
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set up symmetrical split: %d\n",
 			err);
 		goto poweroff;
 	}
 
 	err = mipi_dsi_dcs_set_display_on(sharp->link1);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set display on: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set display on: %d\n", err);
 		goto poweroff;
 	}
 
@@ -287,9 +303,10 @@ static int sharp_panel_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
-			default_mode.hdisplay, default_mode.vdisplay,
-			default_mode.vrefresh);
+		DRM_DEV_ERROR(panel->drm->dev,
+			      "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -413,11 +430,13 @@ static int sharp_panel_remove(struct mipi_dsi_device *dsi)
 
 	err = sharp_panel_disable(&sharp->base);
 	if (err < 0)
-		dev_err(&dsi->dev, "failed to disable panel: %d\n", err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to disable panel: %d\n", err);
 
 	err = mipi_dsi_detach(dsi);
 	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to detach from DSI host: %d\n", err);
 
 	sharp_panel_del(sharp);
 
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +14 -10
index e8e2277e934d..c34bb2a16f0e 100644
@@ -29,6 +29,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
@@ -135,7 +136,8 @@ static int sharp_nt_panel_unprepare(struct drm_panel *panel)
 
 	ret = sharp_nt_panel_off(sharp_nt);
 	if (ret < 0) {
-		dev_err(panel->dev, "failed to set panel off: %d\n", ret);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set panel off: %d\n", ret);
 		return ret;
 	}
 
@@ -173,13 +175,13 @@ static int sharp_nt_panel_prepare(struct drm_panel *panel)
 
 	ret = sharp_nt_panel_init(sharp_nt);
 	if (ret < 0) {
-		dev_err(panel->dev, "failed to init panel: %d\n", ret);
+		DRM_DEV_ERROR(panel->dev, "failed to init panel: %d\n", ret);
 		goto poweroff;
 	}
 
 	ret = sharp_nt_panel_on(sharp_nt);
 	if (ret < 0) {
-		dev_err(panel->dev, "failed to set panel on: %d\n", ret);
+		DRM_DEV_ERROR(panel->dev, "failed to set panel on: %d\n", ret);
 		goto poweroff;
 	}
 
@@ -227,9 +229,10 @@ static int sharp_nt_panel_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
-				default_mode.hdisplay, default_mode.vdisplay,
-				default_mode.vrefresh);
+		DRM_DEV_ERROR(panel->drm->dev,
+			      "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -263,8 +266,8 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
 
 	sharp_nt->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(sharp_nt->reset_gpio)) {
-		dev_err(dev, "cannot get reset-gpios %ld\n",
-			PTR_ERR(sharp_nt->reset_gpio));
+		DRM_DEV_ERROR(dev, "cannot get reset-gpios %ld\n",
+			      PTR_ERR(sharp_nt->reset_gpio));
 		sharp_nt->reset_gpio = NULL;
 	} else {
 		gpiod_set_value(sharp_nt->reset_gpio, 0);
@@ -322,11 +325,12 @@ static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi)
 
 	ret = sharp_nt_panel_disable(&sharp_nt->base);
 	if (ret < 0)
-		dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
+		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", ret);
 
 	ret = mipi_dsi_detach(dsi);
 	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to detach from DSI host: %d\n", ret);
 
 	sharp_nt_panel_del(sharp_nt);
 
Signature · 1 line
2.12.0
#19 lore raw

PATCH 19/19 drm/panel: simple: use DRM_DEV*

In reply to Sam Ravnborg

Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/panel/panel-simple.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/gpu/drm/panel/panel-simple.c +12 -7
index 406b1d7aef31..a5d98a19f138 100644
@@ -33,6 +33,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/display_timing.h>
 #include <video/videomode.h>
@@ -103,6 +104,7 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
 {
 	struct drm_connector *connector = panel->base.connector;
 	struct drm_device *drm = panel->base.drm;
+	struct device *dev = drm->dev;
 	struct drm_display_mode *mode;
 	unsigned int i, num = 0;
 
@@ -116,8 +118,8 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
 		videomode_from_timing(dt, &vm);
 		mode = drm_mode_create(drm);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u\n",
-				dt->hactive.typ, dt->vactive.typ);
+			DRM_DEV_ERROR(dev, "failed to add mode %ux%u\n",
+				      dt->hactive.typ, dt->vactive.typ);
 			continue;
 		}
 
@@ -137,8 +139,8 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
 
 		mode = drm_mode_duplicate(drm, m);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
-				m->hdisplay, m->vdisplay, m->vrefresh);
+			DRM_DEV_ERROR(dev, "failed to add mode %ux%u@%u\n",
+				      m->hdisplay, m->vdisplay, m->vrefresh);
 			continue;
 		}
 
@@ -215,7 +217,8 @@ static int panel_simple_prepare(struct drm_panel *panel)
 
 	err = regulator_enable(p->supply);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to enable supply: %d\n", err);
+		DRM_DEV_ERROR(panel->dev, "failed to enable supply: %d\n",
+			      err);
 		return err;
 	}
 
@@ -325,7 +328,8 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
 	if (IS_ERR(panel->enable_gpio)) {
 		err = PTR_ERR(panel->enable_gpio);
 		if (err != -EPROBE_DEFER)
-			dev_err(dev, "failed to request GPIO: %d\n", err);
+			DRM_DEV_ERROR(dev, "failed to request GPIO: %d\n",
+				      err);
 		return err;
 	}
 
@@ -3048,7 +3052,8 @@ static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
 
 	err = mipi_dsi_detach(dsi);
 	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to detach from DSI host: %d\n", err);
 
 	return panel_simple_remove(&dsi->dev);
 }
Signature · 1 line
2.12.0
#20 lore raw
In reply to Sam Ravnborg

Hi all.

Quoted 20 lines · Sam Ravnborg

Hi Thierry et al.

While reviewing a number of new panel drivers there was a certain pattern in the feedback:
- the now deprecated drmP.h file was used
- dev_err() and friends was used

This patch-set address the above items in the panel drivers in drm/panel/
The hope is that new panel drivers will no longer inherit bad patterns from the existing drivers.

The use of DRM_DEV* is not accepted by everyone, so this conversion was split up in smaller bits.
If some drivers do not want to use DRM_DEV* then just drop the relevant patch.

All patches are build tested on x86/arm.

The DRM_DEV* patches depends on the drmP.h removal.

Quoted 7 lines

One extra patch sneaked in "panel-innolux: drop unused variable" This is a fix for an unused variable and was added to flush my panel patches.

Note: Waiting for key storage (for gpg key) before I start the process getting commit rights, so I rely on someone else (Thierry?) to commit this.

Patches are made on top of drm-misc-next as of a few days ago.

Just for the record, all patches are checkpatched - OK.
A lot of the DRM_DEV_ERROR() etc lines had to be linewrapped to avoid the maximum linelength.

The conversion was done manually, no fancy coincielle script behind. That's something to look into for future changes.

Sam

#21 lore raw
In reply to Sam Ravnborg
Quoted 23 lines · Sam Ravnborg

Hi Thierry et al.

While reviewing a number of new panel drivers there was a certain pattern in the feedback:
- the now deprecated drmP.h file was used
- dev_err() and friends was used

This patch-set address the above items in the panel drivers in drm/panel/
The hope is that new panel drivers will no longer inherit bad patterns from the existing drivers.

The use of DRM_DEV* is not accepted by everyone, so this conversion was split up in smaller bits.
If some drivers do not want to use DRM_DEV* then just drop the relevant patch.

All patches are build tested on x86/arm.

The DRM_DEV* patches depends on the drmP.h removal.

One extra patch sneaked in "panel-innolux: drop unused variable" This is a fix for an unused variable and was added to flush my panel patches.

Quoted 6 lines

Note: Waiting for key storage (for gpg key) before I start the process getting commit rights, so I rely on someone else (Thierry?) to commit this.

Patches are made on top of drm-misc-next as of a few days ago.

Comments welcome!

Hey Sam,
Thanks for the patchset, this will make dmesg grepping easier! One comment, and you're going to hate me for it: Why use DRM_DEV* instead of DRM_*?

When I introduced DRM_DEV, it was to cover the case where there are multiple instances of the same driver (ie: dual-channel mipi, multiple crtcs, etc). I suppose that _could_ happen in the panel space, but it seems more unlikely than not.

It's quite possible I'm overthinking this, but just something I figured I would point out. Either way, I think this is an improvement over dev_*.

Sean

Quoted 48 lines

Sam

Sam Ravnborg (19):
drm/panel: drop drmP.h usage drm/panel: panel-innolux: drop unused variable drm/panel: samsung: use DRM_DEV* drm/panel: arm-versatile: use DRM_DEV* drm/panel: truly: use DRM_DEV* drm/panel: sitronix: use DRM_DEV* drm/panel: ilitek: use DRM_DEV* drm/panel: innolux: use DRM_DEV* drm/panel: jdi: use DRM_DEV* drm/panel: lg: use DRM_DEV*
drm/panel: lvds: use DRM_DEV* drm/panel: olimex: use DRM_DEV* drm/panel: orisetech: use DRM_DEV* drm/panel: panasonic: use DRM_DEV* drm/panel: raspberrypi: use DRM_DEV* drm/panel: raydium: use DRM_DEV* drm/panel: seiko: use DRM_DEV* drm/panel: sharp: use DRM_DEV* drm/panel: simple: use DRM_DEV*

 drivers/gpu/drm/panel/panel-arm-versatile.c        | 21 +++--
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c       | 97 ++++++++++++----------
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c      | 14 ++--
 drivers/gpu/drm/panel/panel-innolux-p079zca.c      | 17 ++--
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c     | 66 ++++++++-------
 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c |  4 +-
 drivers/gpu/drm/panel/panel-lg-lg4573.c            | 25 +++---
 drivers/gpu/drm/panel/panel-lvds.c                 | 39 +++++----
 drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c | 28 ++++---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   | 15 ++--
 .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   | 19 +++--
 .../gpu/drm/panel/panel-raspberrypi-touchscreen.c  | 25 +++---
 drivers/gpu/drm/panel/panel-raydium-rm68200.c      | 11 ++-
 drivers/gpu/drm/panel/panel-samsung-ld9040.c       | 18 ++--
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c      | 21 +++--
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c   | 15 ++--
 drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c      | 32 ++++---
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c        | 18 ++--
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c    | 66 ++++++++++-----
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c    | 27 +++---
 drivers/gpu/drm/panel/panel-simple.c               | 22 +++--
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c     | 16 ++--
 drivers/gpu/drm/panel/panel-truly-nt35597.c        | 10 ++-
 23 files changed, 375 insertions(+), 251 deletions(-)
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
#22 lore raw

Hi Sean.

Quoted 8 lines

Hey Sam,
Thanks for the patchset, this will make dmesg grepping easier! One comment, and you're going to hate me for it: Why use DRM_DEV* instead of DRM_*?

When I introduced DRM_DEV, it was to cover the case where there are multiple instances of the same driver (ie: dual-channel mipi, multiple crtcs, etc). I suppose that _could_ happen in the panel space, but it seems more unlikely than not.

The rationale for using DRM_DEV* are solely that if a struct device * is avalible, then we can use this to provide more information about the origin of the logging.

I have not testet it - but from browsing the code I could not see that DRM_ERROR and friends picked up the module name.
If DRM_ERROR is the right choice I will redo the patches - no problem.

But if we loose the module name then the DRM_DEV* variants are preferable IMO.

Note: I missed DRM_DEV_WARN(), so I left one dev_warn() in the code.

Sam

#23 lore raw
Quoted 11 lines · Sam Ravnborg

Hi Sean.

Quoted 8 lines

Hey Sam,
Thanks for the patchset, this will make dmesg grepping easier! One comment, and you're going to hate me for it: Why use DRM_DEV* instead of DRM_*?

When I introduced DRM_DEV, it was to cover the case where there are multiple instances of the same driver (ie: dual-channel mipi, multiple crtcs, etc). I suppose that _could_ happen in the panel space, but it seems more unlikely than not.

Quoted 8 lines

The rationale for using DRM_DEV* are solely that if a struct device * is avalible, then we can use this to provide more information about the origin of the logging.

I have not testet it - but from browsing the code I could not see that DRM_ERROR and friends picked up the module name.
If DRM_ERROR is the right choice I will redo the patches - no problem.

But if we loose the module name then the DRM_DEV* variants are preferable IMO.

I personally like the DRM_DEV_* variants better because of the additional information that they provide. That can be useful when grepping logs etc.

I'm slightly on the fence about this patch. The unwritten, and admittedly fuzzy, rules that I've been using so far are that dev_*() are used or messages that have to do with the panel device itself, whereas DRM_* variants are used for things that are actually related to DRM. So typically this would mean that roughly everything in ->probe() or ->remove() would be dev_*(), while the rest would be DRM_DEV_*().

The reason for this is that during most of ->probe() there's not really any connection to DRM. In many cases the DRM device doesn't even exist yet. Consider component/master setups where some display component will wait for the panel to be registered before binding the master. So I find it confusing to have the DRM style messages when there's actually no DRM going on yet.

That said, I understand that this might not be an immediately obvious rule and it might not be followed rigorously, which both quite possibly contribute to the perception that the messages are all inconsistent. It always made sense to me, but if everyone else thinks that it's totally nuts, I'm sure I can find a way to get over it.

Thierry

#24 lore raw

Hi Thierry.

Quoted 11 lines

I personally like the DRM_DEV_* variants better because of the additional information that they provide. That can be useful when grepping logs etc.

I'm slightly on the fence about this patch. The unwritten, and admittedly fuzzy, rules that I've been using so far are that dev_*() are used or messages that have to do with the panel device itself, whereas DRM_* variants are used for things that are actually related to DRM. So typically this would mean that roughly everything in ->probe() or ->remove() would be dev_*(), while the rest would be DRM_DEV_*().

For a rookie like me it is much simpler if one can use the same logging primitives all over or at least the rules when to use what is simple. It is simple to say that everything that exists below drivers/gpu/drm/ relates to drm.

Suggested set of rules to follow:
- If in drm core, use DRM_XXX where XXX represent the core functionality
- If in a driver use DRM_DEV* if a struct device is available
- If in a driver and no struct device, use plain DRM_ERROR/INFO

If there is a need to distingush before/after one has a drm_device, the best way would be to have a set of logging primitives that take a drm_device. So we could extend the rule set:
- If in a driver use DRM_DRM* if a struct drm_device is available (This rule would take precedence over a struct device)

DRM_DRM*, or DRM_DDEV* or ... But you get the idea.

But this is not where we are today.

Shall I redo the patch-set so we go back to dev_*() in probe() / remove()?

Sam

#25 lore raw
Quoted 19 lines · Sam Ravnborg

Hi Thierry.

Quoted 11 lines

I personally like the DRM_DEV_* variants better because of the additional information that they provide. That can be useful when grepping logs etc.

I'm slightly on the fence about this patch. The unwritten, and admittedly fuzzy, rules that I've been using so far are that dev_*() are used or messages that have to do with the panel device itself, whereas DRM_* variants are used for things that are actually related to DRM. So typically this would mean that roughly everything in ->probe() or ->remove() would be dev_*(), while the rest would be DRM_DEV_*().

For a rookie like me it is much simpler if one can use the same logging primitives all over or at least the rules when to use what is simple. It is simple to say that everything that exists below drivers/gpu/drm/ relates to drm.

Quoted 4 lines

Suggested set of rules to follow:
- If in drm core, use DRM_XXX where XXX represent the core functionality
- If in a driver use DRM_DEV* if a struct device is available
- If in a driver and no struct device, use plain DRM_ERROR/INFO

Core and drivers are already pretty conflated:

http://patchwork.freedesktop.org/patch/msgid/[email protected]

---

Side note, I'd like to switch i915 to dev based debugs, but I absolutely hate the idea of changing:

	DRM_DEBUG_KMS("...")

to:

	DRM_DEV_DEBUG_KMS(dev_priv->drm.dev, "...")

I think the dev based macros are way too long, and would serve *most* (though not all) drivers better by having struct drm_device * rather than struct device * as the first param. In the above, just the boilerplate consumes half the line.

Basically I'd like to see drm_ prefixed analogues to all the dev_ based logging functions, e.g. drm_dbg that takes drm_device. But it's so much churn that I'm contemplating just making i915 specific wrappers instead. :(

BR,
Jani.

Quoted 18 lines

If there is a need to distingush before/after one has a drm_device, the best way would be to have a set of logging primitives that take a drm_device. So we could extend the rule set:
- If in a driver use DRM_DRM* if a struct drm_device is available (This rule would take precedence over a struct device)

DRM_DRM*, or DRM_DDEV* or ... But you get the idea.

But this is not where we are today.

Shall I redo the patch-set so we go back to dev_*() in probe() / remove()?

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#26 lore raw
Quoted 42 lines · Jani Nikula
Quoted 17 lines · Sam Ravnborg

Hi Thierry.

Quoted 10 lines

I personally like the DRM_DEV_* variants better because of the additional information that they provide. That can be useful when grepping logs etc.

I'm slightly on the fence about this patch. The unwritten, and admittedly fuzzy, rules that I've been using so far are that dev_*() are used or messages that have to do with the panel device itself, whereas DRM_* variants are used for things that are actually related to DRM. So typically this would mean that roughly everything in ->probe() or ->remove() would be dev_*(), while the rest would be DRM_DEV_*().

For a rookie like me it is much simpler if one can use the same logging primitives all over or at least the rules when to use what is simple. It is simple to say that everything that exists below drivers/gpu/drm/ relates to drm.

Quoted 4 lines

Suggested set of rules to follow:
- If in drm core, use DRM_XXX where XXX represent the core functionality
- If in a driver use DRM_DEV* if a struct device is available
- If in a driver and no struct device, use plain DRM_ERROR/INFO

Core and drivers are already pretty conflated:

http://patchwork.freedesktop.org/patch/msgid/[email protected]

---

Side note, I'd like to switch i915 to dev based debugs, but I absolutely hate the idea of changing:

	DRM_DEBUG_KMS("...")

to:

	DRM_DEV_DEBUG_KMS(dev_priv->drm.dev, "...")

I think the dev based macros are way too long, and would serve *most* (though not all) drivers better by having struct drm_device * rather than struct device * as the first param. In the above, just the boilerplate consumes half the line.

Quoted 4 lines

Basically I'd like to see drm_ prefixed analogues to all the dev_ based logging functions, e.g. drm_dbg that takes drm_device. But it's so much churn that I'm contemplating just making i915 specific wrappers instead. :(

Does it means I am the only one who is not convinced to use all these DRM_DEV helpers.

For me classic dev_(err|...) looks fine, if we really want to emphasize that logs comes from DRM dev_* allows format modification, sth like this:

#define dev_fmt(fmt) "DRM: %s:%d: " fmt, __func__, __LINE__

but it is still something I do not see very helpful.

In general I think we have too many alternatives/flavours and developers do not know what to choose, current usage of all these DRM_* shows it clearly.

Regards

Andrzej

Quoted 24 lines

BR,
Jani.

Quoted 17 lines

If there is a need to distingush before/after one has a drm_device, the best way would be to have a set of logging primitives that take a drm_device. So we could extend the rule set:
- If in a driver use DRM_DRM* if a struct drm_device is available (This rule would take precedence over a struct device)

DRM_DRM*, or DRM_DDEV* or ... But you get the idea.

But this is not where we are today.

Shall I redo the patch-set so we go back to dev_*() in probe() / remove()?

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#27 lore raw
Quoted 52 lines · Andrzej Hajda
Quoted 42 lines · Jani Nikula
Quoted 17 lines · Sam Ravnborg

Hi Thierry.

Quoted 10 lines

I personally like the DRM_DEV_* variants better because of the additional information that they provide. That can be useful when grepping logs etc.

I'm slightly on the fence about this patch. The unwritten, and admittedly fuzzy, rules that I've been using so far are that dev_*() are used or messages that have to do with the panel device itself, whereas DRM_* variants are used for things that are actually related to DRM. So typically this would mean that roughly everything in ->probe() or ->remove() would be dev_*(), while the rest would be DRM_DEV_*().

For a rookie like me it is much simpler if one can use the same logging primitives all over or at least the rules when to use what is simple. It is simple to say that everything that exists below drivers/gpu/drm/ relates to drm.

Quoted 4 lines

Suggested set of rules to follow:
- If in drm core, use DRM_XXX where XXX represent the core functionality
- If in a driver use DRM_DEV* if a struct device is available
- If in a driver and no struct device, use plain DRM_ERROR/INFO

Core and drivers are already pretty conflated:

http://patchwork.freedesktop.org/patch/msgid/[email protected]

---

Side note, I'd like to switch i915 to dev based debugs, but I absolutely hate the idea of changing:

	DRM_DEBUG_KMS("...")

to:

	DRM_DEV_DEBUG_KMS(dev_priv->drm.dev, "...")

I think the dev based macros are way too long, and would serve *most* (though not all) drivers better by having struct drm_device * rather than struct device * as the first param. In the above, just the boilerplate consumes half the line.

Quoted 4 lines

Basically I'd like to see drm_ prefixed analogues to all the dev_ based logging functions, e.g. drm_dbg that takes drm_device. But it's so much churn that I'm contemplating just making i915 specific wrappers instead. :(

Does it means I am the only one who is not convinced to use all these DRM_DEV helpers.

Quoted 6 lines

For me classic dev_(err|...) looks fine, if we really want to emphasize that logs comes from DRM dev_* allows format modification, sth like this:

#define dev_fmt(fmt) "DRM: %s:%d: " fmt, __func__, __LINE__

but it is still something I do not see very helpful.

dev_dbg has all the fancy dynamic debug stuff, but no way to filter by category the way drm.debug bitmask allows.

BR,
Jani.

Quoted 39 lines

In general I think we have too many alternatives/flavours and developers do not know what to choose, current usage of all these DRM_* shows it clearly.

Regards

Andrzej

Quoted 24 lines

BR,
Jani.

Quoted 17 lines

If there is a need to distingush before/after one has a drm_device, the best way would be to have a set of logging primitives that take a drm_device. So we could extend the rule set:
- If in a driver use DRM_DRM* if a struct drm_device is available (This rule would take precedence over a struct device)

DRM_DRM*, or DRM_DDEV* or ... But you get the idea.

But this is not where we are today.

Shall I redo the patch-set so we go back to dev_*() in probe() / remove()?

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#28 lore raw
In reply to Thierry Reding

Hi Thierry.

Quoted 1 line

I'm slightly on the fence about this patch.

Please ignore patch 3-19, there is no consensus on the logging changes. We do not want to apply these and then have to redo parts/all of it later.

But the first two patches has not seen any feedback yet:

[PATCH v1 01/19] drm/panel: drop drmP.h usage
[PATCH v1 02/19] drm/panel: panel-innolux: drop unused variable

Please consider these, or maybe wait a little to see if someone find time to review.

I can resend the patches if this is preferred.

Sam

#29 lore raw
Quoted 10 lines · Sam Ravnborg

Hi Thierry.

Quoted 1 line

I'm slightly on the fence about this patch.

Please ignore patch 3-19, there is no consensus on the logging changes. We do not want to apply these and then have to redo parts/all of it later.

But the first two patches has not seen any feedback yet:

Quoted 7 lines

[PATCH v1 01/19] drm/panel: drop drmP.h usage
[PATCH v1 02/19] drm/panel: panel-innolux: drop unused variable

Please consider these, or maybe wait a little to see if someone find time to review.

I can resend the patches if this is preferred.

My preference would also convert all the DRM_DEV_<level> uses to drm_dev_<level> eventually.

Also, the macros themselves could change to use a
more consistent mechanism.

This would make the drm logging mechanisms more like other logging mechanisms used in the kernel.

Something like:
---
Subject: [PATCH] drm: Improve and standardize logging functions

Use a more typical logging style.

Add and use drm_printk and drm_dev_printk functions that include the test for KERN_ERR use where '*ERROR*' is added to logging output.

Remove the slightly unusual _DRM_PRINTK macro and use the new drm_printk function instead.

---
 drivers/gpu/drm/drm_print.c | 67 +++++++++++++++++++++++++++++----------------
 include/drm/drm_print.h     | 51 ++++++++++++++++++++--------------
 2 files changed, 74 insertions(+), 44 deletions(-)
drivers/gpu/drm/drm_print.c +44 -23
index 0e7fc3e7dfb4..4e3ae7b5cce1 100644
@@ -174,22 +174,59 @@ void drm_printf(struct drm_printer *p, const char *f, ...)
 }
 EXPORT_SYMBOL(drm_printf);
 
-void drm_dev_printk(const struct device *dev, const char *level,
-		    const char *format, ...)
+void drm_printk(const char *format, ...)
 {
 	struct va_format vaf;
 	va_list args;
+	char lvl[PRINTK_MAX_SINGLE_HEADER_LEN + 1] = KERN_DEFAULT;
+	int level = printk_get_level(format);
+	size_t size = printk_skip_level(format) - format;
+
+	if (size) {
+		memcpy(lvl, format, size);
+		lvl[size] = '\0';
+	}
 
 	va_start(args, format);
-	vaf.fmt = format;
+	vaf.fmt = format + size;
+	vaf.va = &args;
+
+	printk("%s" "[" DRM_NAME ":%ps] %s%pV",
+	       lvl, __builtin_return_address(0),
+	       level == LOGLEVEL_ERR ? "*ERROR* " : "",
+	       &vaf);
+
+	va_end(args);
+}
+EXPORT_SYMBOL(drm_printk);
+
+void drm_dev_printk(const struct device *dev, const char *format, ...)
+{
+	struct va_format vaf;
+	va_list args;
+	char lvl[PRINTK_MAX_SINGLE_HEADER_LEN + 1] = KERN_DEFAULT;
+	int level = printk_get_level(format);
+	size_t size = printk_skip_level(format) - format;
+
+	if (size) {
+		memcpy(lvl, format, size);
+		lvl[size] = '\0';
+	}
+
+	va_start(args, format);
+	vaf.fmt = format + size;
 	vaf.va = &args;
 
 	if (dev)
-		dev_printk(level, dev, "[" DRM_NAME ":%ps] %pV",
-			   __builtin_return_address(0), &vaf);
+		dev_printk(lvl, dev, "[" DRM_NAME ":%ps] %s%pV",
+			   __builtin_return_address(0),
+			   level == LOGLEVEL_ERR ? "*ERROR* " : "",
+			   &vaf);
 	else
-		printk("%s" "[" DRM_NAME ":%ps] %pV",
-		       level, __builtin_return_address(0), &vaf);
+		printk("%s" "[" DRM_NAME ":%ps] %s%pV",
+		       lvl, __builtin_return_address(0),
+		       level == LOGLEVEL_ERR ? "*ERROR* " : "",
+		       &vaf);
 
 	va_end(args);
 }
@@ -237,19 +274,3 @@ void drm_dbg(unsigned int category, const char *format, ...)
 	va_end(args);
 }
 EXPORT_SYMBOL(drm_dbg);
-
-void drm_err(const char *format, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	va_start(args, format);
-	vaf.fmt = format;
-	vaf.va = &args;
-
-	printk(KERN_ERR "[" DRM_NAME ":%ps] *ERROR* %pV",
-	       __builtin_return_address(0), &vaf);
-
-	va_end(args);
-}
-EXPORT_SYMBOL(drm_err);
include/drm/drm_print.h +30 -21

81 lines not on this page · raw message

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#30 lore raw

Hi Joe.

Quoted 10 lines

My preference would also convert all the DRM_DEV_<level> uses to drm_dev_<level> eventually.

Also, the macros themselves could change to use a
more consistent mechanism.

This would make the drm logging mechanisms more like other logging mechanisms used in the kernel.

Something like:

I like your patch, but do not have the time to follow-up on it. It is for now saved and I will re-visit it when I have a bit more time on my hands.

Thanks,

Sam