Re: [Resend][PATCH v2 2/3] drm/panel: add s6e63j0x03 LCD panel driver

2015-01-16 Thread Thierry Reding
On Tue, Jan 06, 2015 at 12:28:22AM +0900, Inki Dae wrote:
[...]
  Original Message 
 Subject: [PATCH v2 2/3] drm/panel: add s6e63j0x03 LCD panel driver
 Date: Tue, 09 Dec 2014 18:29:05 +0900
 From: Hyungwon Hwang human.hw...@samsung.com
 To: dri-de...@lists.freedesktop.org
 CC: airl...@linux.ie, devicet...@vger.kernel.org, robh...@kernel.org,
 pawel.m...@arm.com, mark.rutl...@arm.com, ijc+devicet...@hellion.org.uk,
 ga...@codeaurora.org, linux-samsung-soc@vger.kernel.org,
 kyungmin.p...@samsung.com, inki@samsung.com, a.ha...@samsung.com,
 kgene@samsung.com, thierry.red...@gmail.com, Hyungwon Hwang
 human.hw...@samsung.com
 
 From: Inki Dae inki@samsung.com
 
 This patch adds MIPI-DSI based S6E63J0X03 AMOLED LCD panel driver
 which uses mipi_dsi bus to communicate with panel. The panel has
 320×320 resolution in 1.63-inch physical panel. This panel is used in
 Samsung Galaxy Gear 2.
 
 Signed-off-by: Inki Dae inki@samsung.com
 Signed-off-by: Hyungwon Hwang human.hw...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 Changes for v2:
 - Change the gamma table to 2-dimensional array
 - Change the way to make index for brightness
 - Make command functions to an array so that it can be called simply
 - Change command id for reading device ID
 - Change the way to handle the error condition
 - Remove power variable, and use the same name variable in bl_dev
 - Add the state FB_BLANK_NORMAL to represent the state which the panel
 is working but blanked
 - Miscellaneous changes to increase the readability and follow the
   coding-style standard
 
  drivers/gpu/drm/panel/Kconfig|   6 +
  drivers/gpu/drm/panel/Makefile   |   1 +
  drivers/gpu/drm/panel/panel-s6e63j0x03.c | 549
 +++
  3 files changed, 556 insertions(+)
  create mode 100644 drivers/gpu/drm/panel/panel-s6e63j0x03.c

I thought I had mentioned this before, but this is missing device tree
binding documentation.

Thierry


pgpvxq7glonOX.pgp
Description: PGP signature


[Resend][PATCH v2 2/3] drm/panel: add s6e63j0x03 LCD panel driver

2015-01-05 Thread Inki Dae

Just resend it with Thierry's request.

Thanks,
Inki Dae

 Original Message 
Subject: [PATCH v2 2/3] drm/panel: add s6e63j0x03 LCD panel driver
Date: Tue, 09 Dec 2014 18:29:05 +0900
From: Hyungwon Hwang human.hw...@samsung.com
To: dri-de...@lists.freedesktop.org
CC: airl...@linux.ie, devicet...@vger.kernel.org, robh...@kernel.org,
pawel.m...@arm.com, mark.rutl...@arm.com, ijc+devicet...@hellion.org.uk,
ga...@codeaurora.org, linux-samsung-soc@vger.kernel.org,
kyungmin.p...@samsung.com, inki@samsung.com, a.ha...@samsung.com,
kgene@samsung.com, thierry.red...@gmail.com, Hyungwon Hwang
human.hw...@samsung.com

From: Inki Dae inki@samsung.com

This patch adds MIPI-DSI based S6E63J0X03 AMOLED LCD panel driver
which uses mipi_dsi bus to communicate with panel. The panel has
320×320 resolution in 1.63-inch physical panel. This panel is used in
Samsung Galaxy Gear 2.

Signed-off-by: Inki Dae inki@samsung.com
Signed-off-by: Hyungwon Hwang human.hw...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
---
Changes for v2:
- Change the gamma table to 2-dimensional array
- Change the way to make index for brightness
- Make command functions to an array so that it can be called simply
- Change command id for reading device ID
- Change the way to handle the error condition
- Remove power variable, and use the same name variable in bl_dev
- Add the state FB_BLANK_NORMAL to represent the state which the panel
is working but blanked
- Miscellaneous changes to increase the readability and follow the
  coding-style standard

 drivers/gpu/drm/panel/Kconfig|   6 +
 drivers/gpu/drm/panel/Makefile   |   1 +
 drivers/gpu/drm/panel/panel-s6e63j0x03.c | 549
+++
 3 files changed, 556 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-s6e63j0x03.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index bee9f72..bc133e2 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -27,4 +27,10 @@ config DRM_PANEL_S6E8AA0
select DRM_MIPI_DSI
select VIDEOMODE_HELPERS

+config DRM_PANEL_S6E63J0X03
+   tristate S6E63J0X03 DSI video mode panel
+   depends on OF
+   select DRM_MIPI_DSI
+   select VIDEOMODE_HELPERS
+
 endmenu
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 8b92921..7f36dc2 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,3 +1,4 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o
 obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o
+obj-$(CONFIG_DRM_PANEL_S6E63J0X03) += panel-s6e63j0x03.o
diff --git a/drivers/gpu/drm/panel/panel-s6e63j0x03.c
b/drivers/gpu/drm/panel/panel-s6e63j0x03.c
new file mode 100644
index 000..28e4a51
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-s6e63j0x03.c
@@ -0,0 +1,549 @@
+/*
+ * MIPI-DSI based S6E63J0X03 AMOLED lcd 1.63 inch panel driver.
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd
+ *
+ * Inki Dae, inki@samsung.com
+ *
+ * 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 drm/drmP.h
+#include drm/drm_mipi_dsi.h
+#include drm/drm_panel.h
+
+#include linux/of_gpio.h
+#include linux/gpio.h
+#include linux/regulator/consumer.h
+#include linux/backlight.h
+
+#include video/mipi_display.h
+#include video/of_videomode.h
+#include video/videomode.h
+
+#define READ_ID1   0xDA
+#define READ_ID2   0xDB
+#define READ_ID3   0xDC
+
+#define MCS_LEVEL2_KEY 0xf0
+#define MCS_MTP_KEY0xf1
+#define MCS_MTP_SET3   0xd4
+
+#define MIN_BRIGHTNESS 0
+#define MAX_BRIGHTNESS 100
+#define DEFAULT_BRIGHTNESS 80
+
+#define GAMMA_LEVEL_NUM30
+#define NUM_GAMMA_STEPS9
+#define GAMMA_CMD_CNT  28
+
+struct s6e63j0x03 {
+   struct device *dev;
+   struct drm_panel panel;
+   struct backlight_device *bl_dev;
+
+   struct regulator_bulk_data supplies[2];
+   struct gpio_desc *reset_gpio;
+   u32 power_on_delay;
+   u32 power_off_delay;
+   u32 reset_delay;
+   u32 init_delay;
+   bool flip_horizontal;
+   bool flip_vertical;
+   struct videomode vm;
+   unsigned int width_mm;
+   unsigned int height_mm;
+};
+
+static const unsigned char gamma_tbl[NUM_GAMMA_STEPS][GAMMA_CMD_CNT] = {
+   {   /* Gamma 10 */
+   MCS_MTP_SET3,
+   0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x52, 0x6b, 0x6f, 0x26,
+   0x28, 0x2d, 0x28, 0x26, 0x27, 0x33, 0x34, 0x32, 0x36, 0x36,
+   0x35, 0x00, 0xab, 0x00, 0xae, 0x00, 0xbf
+   },
+   {   /* gamma 30 */
+   MCS_MTP_SET3,
+   0x00, 0x00, 0x00, 0x70, 0x7f, 0x7f, 0x4e, 0x64, 0x69,