Re: [PATCH 2/3] drm/panel: Add Ilitek ILI9322 driver

2017-12-21 Thread Linus Walleij
On Thu, Dec 21, 2017 at 5:15 PM, Thierry Reding
 wrote:

> Daniel just reminded me on IRC that you have commit rights to drm-misc,
> so once you've fixed up the bulk of the checkpatch warnings (nevermind
> those "prefer the BIT macro" checks), feel free to push this yourself
> with my:
>
> Acked-by: Thierry Reding 

OK thanks man I fix.

I will resend the patch with your ACK anyways, because
I have no clue how to get the right mailing list message ID into a
patch I just generate from my own tree.

Yours,
Linus Walleij
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm/panel: Add Ilitek ILI9322 driver

2017-12-21 Thread Linus Walleij
On Thu, Dec 21, 2017 at 3:15 PM, Thierry Reding
 wrote:

> checkpatch.pl gives me these:
>
> -:30: WARNING: please write a paragraph that describes the config 
> symbol fully
> #30: FILE: drivers/gpu/drm/panel/Kconfig:31:
> +config DRM_PANEL_ILITEK_IL9322

I don't understand this because there is a blurb. I have had this
false positive before.

> -:54: WARNING: added, moved or deleted file(s), does MAINTAINERS need 
> updating?
> #54:
> new file mode 100644

Skipping as agreed.

> -:130: CHECK: Prefer using the BIT macro
> #130: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:72:
> +#define ILI9322_ENTRY_PAL  (1 << 2)
>
> -:134: CHECK: Prefer using the BIT macro
> #134: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:76:
> +#define ILI9322_ENTRY_SERIAL_RGB_ALIGNED (1 << 4)

These are bananas because checkpatch doesn't understand
context. They are actually bitfields with the first bit set.

> -:196: CHECK: spaces preferred around that '|' (ctx:VxV)
> #196: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:138:
> +#define ILI9322_IF_CTRL_SYNC_DISABLED  (BIT(2)|BIT(3))

I didn't get this warning, wonder why. Fixed it anyways.

> -:551: WARNING: msleep < 20ms can sleep for up to 20ms; see 
> Documentation/timers/timers-howto.txt
> #551: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:493:
> +   msleep(10);

It's fine if it takes 20 or 90 ms so I chose to just ignore it. It's not on
any critical path.

Yours,
Linus Walleij
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm/panel: Add Ilitek ILI9322 driver

2017-12-21 Thread Thierry Reding
On Thu, Dec 21, 2017 at 03:15:56PM +0100, Thierry Reding wrote:
> On Fri, Dec 01, 2017 at 05:16:58PM +0100, Linus Walleij wrote:
> > This adds support for the Ilitek ILI9322 QVGA (320x240)
> > TFT panel driver.
> > 
> > This panel driver supports serial or parallel RGB or
> > YUV input and also ITU-T BT.656 input streams.
> > 
> > The controller is combined with a physical panel and
> > configured through the device tree.
> > 
> > Cc: David Lechner 
> > Cc: Stefano Babic 
> > Cc: Ben Dooks 
> > Signed-off-by: Linus Walleij 
> > ---
> > ChangeLog v1->v2:
> > - Dropped all DT parsing code in favor of open-coding the
> >   display config on a per-system basis based on system-specific
> >   compatible strings, after feedback from the DT maintainers.
> > - Define a set of configs for the D-Link DIR-685 router.
> > - Tested on the D-Link DIR-685.
> > ---
> >  drivers/gpu/drm/panel/Kconfig|   8 +
> >  drivers/gpu/drm/panel/Makefile   |   1 +
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 962 
> > +++
> >  3 files changed, 971 insertions(+)
> >  create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> 
> checkpatch.pl gives me these:
> 
>   -:30: WARNING: please write a paragraph that describes the config 
> symbol fully
>   #30: FILE: drivers/gpu/drm/panel/Kconfig:31:
>   +config DRM_PANEL_ILITEK_IL9322
> 
>   -:54: WARNING: added, moved or deleted file(s), does MAINTAINERS need 
> updating?
>   #54:
>   new file mode 100644
> 
>   -:130: CHECK: Prefer using the BIT macro
>   #130: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:72:
>   +#define ILI9322_ENTRY_PAL  (1 << 2)
> 
>   -:134: CHECK: Prefer using the BIT macro
>   #134: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:76:
>   +#define ILI9322_ENTRY_SERIAL_RGB_ALIGNED (1 << 4)
> 
>   -:196: CHECK: spaces preferred around that '|' (ctx:VxV)
>   #196: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:138:
>   +#define ILI9322_IF_CTRL_SYNC_DISABLED  (BIT(2)|BIT(3))
>  ^
> 
>   -:551: WARNING: msleep < 20ms can sleep for up to 20ms; see 
> Documentation/timers/timers-howto.txt
>   #551: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:493:
>   +   msleep(10);
> 
>   total: 0 errors, 3 warnings, 3 checks, 983 lines checked
> 
> I'd like to see at least the warnings fixed. You can probably skip the
> entry in MAINTAINERS, though. I don't mind fixing these up while
> applying, but I don't know what to put in Kconfig. If you can send out
> a short paragraph for me to include I'll add it when I apply.

Daniel just reminded me on IRC that you have commit rights to drm-misc,
so once you've fixed up the bulk of the checkpatch warnings (nevermind
those "prefer the BIT macro" checks), feel free to push this yourself
with my:

Acked-by: Thierry Reding 


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm/panel: Add Ilitek ILI9322 driver

2017-12-21 Thread Thierry Reding
On Fri, Dec 01, 2017 at 05:16:58PM +0100, Linus Walleij wrote:
> This adds support for the Ilitek ILI9322 QVGA (320x240)
> TFT panel driver.
> 
> This panel driver supports serial or parallel RGB or
> YUV input and also ITU-T BT.656 input streams.
> 
> The controller is combined with a physical panel and
> configured through the device tree.
> 
> Cc: David Lechner 
> Cc: Stefano Babic 
> Cc: Ben Dooks 
> Signed-off-by: Linus Walleij 
> ---
> ChangeLog v1->v2:
> - Dropped all DT parsing code in favor of open-coding the
>   display config on a per-system basis based on system-specific
>   compatible strings, after feedback from the DT maintainers.
> - Define a set of configs for the D-Link DIR-685 router.
> - Tested on the D-Link DIR-685.
> ---
>  drivers/gpu/drm/panel/Kconfig|   8 +
>  drivers/gpu/drm/panel/Makefile   |   1 +
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 962 
> +++
>  3 files changed, 971 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9322.c

checkpatch.pl gives me these:

-:30: WARNING: please write a paragraph that describes the config 
symbol fully
#30: FILE: drivers/gpu/drm/panel/Kconfig:31:
+config DRM_PANEL_ILITEK_IL9322

-:54: WARNING: added, moved or deleted file(s), does MAINTAINERS need 
updating?
#54:
new file mode 100644

-:130: CHECK: Prefer using the BIT macro
#130: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:72:
+#define ILI9322_ENTRY_PAL  (1 << 2)

-:134: CHECK: Prefer using the BIT macro
#134: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:76:
+#define ILI9322_ENTRY_SERIAL_RGB_ALIGNED (1 << 4)

-:196: CHECK: spaces preferred around that '|' (ctx:VxV)
#196: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:138:
+#define ILI9322_IF_CTRL_SYNC_DISABLED  (BIT(2)|BIT(3))
   ^

-:551: WARNING: msleep < 20ms can sleep for up to 20ms; see 
Documentation/timers/timers-howto.txt
#551: FILE: drivers/gpu/drm/panel/panel-ilitek-ili9322.c:493:
+   msleep(10);

total: 0 errors, 3 warnings, 3 checks, 983 lines checked

I'd like to see at least the warnings fixed. You can probably skip the
entry in MAINTAINERS, though. I don't mind fixing these up while
applying, but I don't know what to put in Kconfig. If you can send out
a short paragraph for me to include I'll add it when I apply.

Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/3] drm/panel: Add Ilitek ILI9322 driver

2017-12-01 Thread Linus Walleij
This adds support for the Ilitek ILI9322 QVGA (320x240)
TFT panel driver.

This panel driver supports serial or parallel RGB or
YUV input and also ITU-T BT.656 input streams.

The controller is combined with a physical panel and
configured through the device tree.

Cc: David Lechner 
Cc: Stefano Babic 
Cc: Ben Dooks 
Signed-off-by: Linus Walleij 
---
ChangeLog v1->v2:
- Dropped all DT parsing code in favor of open-coding the
  display config on a per-system basis based on system-specific
  compatible strings, after feedback from the DT maintainers.
- Define a set of configs for the D-Link DIR-685 router.
- Tested on the D-Link DIR-685.
---
 drivers/gpu/drm/panel/Kconfig|   8 +
 drivers/gpu/drm/panel/Makefile   |   1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 962 +++
 3 files changed, 971 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9322.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 726f3fb3312d..6ba4031f3919 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -28,6 +28,14 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_ILITEK_IL9322
+   tristate "Ilitek ILI9322 320x240 QVGA panels"
+   depends on OF && SPI
+   select REGMAP
+   help
+ Say Y here if you want to enable support for Ilitek IL9322
+ QVGA (320x240) RGB, YUV and ITU-T BT.656 panels.
+
 config DRM_PANEL_INNOLUX_P079ZCA
tristate "Innolux P079ZCA panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 2c4e1a93e05f..6d251ebc568c 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
 obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
 obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
new file mode 100644
index ..e494de73b759
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
@@ -0,0 +1,962 @@
+/*
+ * Ilitek ILI9322 TFT LCD drm_panel driver.
+ *
+ * This panel can be configured to support:
+ * - 8-bit serial RGB interface
+ * - 24-bit parallel RGB interface
+ * - 8-bit ITU-R BT.601 interface
+ * - 8-bit ITU-R BT.656 interface
+ * - Up to 320RGBx240 dots resolution TFT LCD displays
+ * - Scaling, brightness and contrast
+ *
+ * The scaling means that the display accepts a 640x480 or 720x480
+ * input and rescales it to fit to the 320x240 display. So what we
+ * present to the system is something else than what comes out on the
+ * actual display.
+ *
+ * Copyright (C) 2017 Linus Walleij 
+ * Derived from drivers/drm/gpu/panel/panel-samsung-ld9040.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define ILI9322_CHIP_ID0x00
+#define ILI9322_CHIP_ID_MAGIC  0x96
+
+/*
+ * Voltage on the communication interface, from 0.7 (0x00)
+ * to 1.32 (0x1f) times the VREG1OUT voltage in 2% increments.
+ * 1.00 (0x0f) is the default.
+ */
+#define ILI9322_VCOM_AMP   0x01
+
+/*
+ * High voltage on the communication signals, from 0.37 (0x00) to
+ * 1.0 (0x3f) times the VREGOUT1 voltage in 1% increments.
+ * 0.83 (0x2e) is the default.
+ */
+#define ILI9322_VCOM_HIGH  0x02
+
+/*
+ * VREG1 voltage regulator from 3.6V (0x00) to 6.0V (0x18) in 0.1V
+ * increments. 5.4V (0x12) is the default. This is the reference
+ * voltage for the VCOM levels and the greyscale level.
+ */
+#define ILI9322_VREG1_VOLTAGE  0x03
+
+/* Describes the incoming signal */
+#define ILI9322_ENTRY  0x06
+/* 0 = right-to-left, 1 = left-to-right (default), horizontal flip */
+#define ILI9322_ENTRY_HDIR BIT(0)
+/* 0 = down-to-up, 1 = up-to-down (default), vertical flip  */
+#define ILI9322_ENTRY_VDIR BIT(1)
+/* NTSC, PAL or autodetect */
+#define ILI9322_ENTRY_NTSC (0 << 2)
+#define ILI9322_ENTRY_PAL  (1 << 2)
+#define ILI9322_ENTRY_AUTODETECT   (3 << 2)
+/* Input format */
+#define ILI9322_ENTRY_SERIAL_RGB_THROUGH (0 << 4)
+#define ILI9322_ENTRY_SERIAL_RGB_ALIGNED (1 <<