[PATCH v12 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

2016-03-16 Thread kbuild test robot
Hi Jitao,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.5 next-20160316]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Jitao-Shi/Documentation-bridge-Add-documentation-for-ps8640-DT-properties/20160316-213031
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: x86_64-allmodconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': 
unknown attribute
   drivers/gpu/drm/bridge/parade-ps8640.c:114:30: sparse: invalid initializer
   drivers/gpu/drm/bridge/parade-ps8640.c:430:24: sparse: undefined identifier 
'of_find_mipi_dsi_host_by_node'
   drivers/gpu/drm/bridge/parade-ps8640.c:114:37: warning: excess elements in 
scalar initializer
static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
^
   drivers/gpu/drm/bridge/parade-ps8640.c:114:37: note: (near initialization 
for 'hw_chip_id')
   drivers/gpu/drm/bridge/parade-ps8640.c:114:43: warning: excess elements in 
scalar initializer
static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
  ^
   drivers/gpu/drm/bridge/parade-ps8640.c:114:43: note: (near initialization 
for 'hw_chip_id')
   drivers/gpu/drm/bridge/parade-ps8640.c:114:49: warning: excess elements in 
scalar initializer
static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
^
   drivers/gpu/drm/bridge/parade-ps8640.c:114:49: note: (near initialization 
for 'hw_chip_id')
   drivers/gpu/drm/bridge/parade-ps8640.c: In function 'ps8640_bridge_attach':
   drivers/gpu/drm/bridge/parade-ps8640.c:430:10: error: implicit declaration 
of function 'of_find_mipi_dsi_host_by_node' 
[-Werror=implicit-function-declaration]
  host = of_find_mipi_dsi_host_by_node(dsi_node);
 ^
   drivers/gpu/drm/bridge/parade-ps8640.c:430:8: warning: assignment makes 
pointer from integer without a cast [-Wint-conversion]
  host = of_find_mipi_dsi_host_by_node(dsi_node);
   ^
   drivers/gpu/drm/bridge/parade-ps8640.c: In function 'ps8640_check_chip_id':
>> drivers/gpu/drm/bridge/parade-ps8640.c:717:21: warning: passing argument 2 
>> of 'memcmp' makes pointer from integer without a cast [-Wint-conversion]
 return memcmp(buf, hw_chip_id, sizeof(buf));
^
   In file included from include/linux/bitmap.h:8:0,
from include/linux/cpumask.h:11,
from arch/x86/include/asm/cpumask.h:4,
from arch/x86/include/asm/msr.h:10,
from arch/x86/include/asm/processor.h:20,
from arch/x86/include/asm/thread_info.h:52,
from include/linux/thread_info.h:54,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/firmware.h:6,
from drivers/gpu/drm/bridge/parade-ps8640.c:16:
   include/linux/string.h:112:12: note: expected 'const void *' but argument is 
of type 'u8 {aka const unsigned char}'
extern int memcmp(const void *,const void *,__kernel_size_t);
   ^
   cc1: some warnings being treated as errors

sparse warnings: (new ones prefixed by >>)

   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': 
unknown attribute
>> drivers/gpu/drm/bridge/parade-ps8640.c:114:30: sparse: invalid initializer
   drivers/gpu/drm/bridge/parade-ps8640.c:430:24: sparse: undefined identifier 
'of_find_mipi_dsi_host_by_node'
   drivers/gpu/drm/bridge/parade-ps8640.c:114:37: warning: excess elements in 
scalar initializer
static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
^
   drivers/gpu/drm/bridge/parade-ps8640.c:114:37: note: (near initialization 
for 'hw_chip_id')
   drivers/gpu/drm/bridge/parade-ps8640.c:114:43: warning: excess elements in 
scalar initializer
static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
  ^
   drivers/gpu/drm/bridge/parade-ps8640.c:114:43: note: (near initialization 
for 'hw_chip_id')
   drivers/gpu/drm/bridge/parade-ps8640.c:114:49: warning: excess elements in 
scalar initializer
static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
^
   drivers/gpu/drm/bridge/parade-ps8640.c:114:49: note: (near initialization 
for 'hw_chip_id')
   drivers/gpu/drm/bridge/parade-ps8640.c: In function 'ps8640_bridge_attach':
   drivers/gpu/drm/bridge/parade-ps8640.c:430:

[PATCH v12 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

2016-03-16 Thread kbuild test robot
Hi Jitao,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.5 next-20160316]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Jitao-Shi/Documentation-bridge-Add-documentation-for-ps8640-DT-properties/20160316-213031
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-allmodconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/bridge/parade-ps8640.c:114:37: warning: excess elements in 
>> scalar initializer
static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
^
   drivers/gpu/drm/bridge/parade-ps8640.c:114:37: note: (near initialization 
for 'hw_chip_id')
   drivers/gpu/drm/bridge/parade-ps8640.c:114:43: warning: excess elements in 
scalar initializer
static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
  ^
   drivers/gpu/drm/bridge/parade-ps8640.c:114:43: note: (near initialization 
for 'hw_chip_id')
   drivers/gpu/drm/bridge/parade-ps8640.c:114:49: warning: excess elements in 
scalar initializer
static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
^
   drivers/gpu/drm/bridge/parade-ps8640.c:114:49: note: (near initialization 
for 'hw_chip_id')
   drivers/gpu/drm/bridge/parade-ps8640.c: In function 'ps8640_bridge_attach':
   drivers/gpu/drm/bridge/parade-ps8640.c:430:10: error: implicit declaration 
of function 'of_find_mipi_dsi_host_by_node' 
[-Werror=implicit-function-declaration]
  host = of_find_mipi_dsi_host_by_node(dsi_node);
 ^
   drivers/gpu/drm/bridge/parade-ps8640.c:430:8: warning: assignment makes 
pointer from integer without a cast [-Wint-conversion]
  host = of_find_mipi_dsi_host_by_node(dsi_node);
   ^
   drivers/gpu/drm/bridge/parade-ps8640.c: In function 'ps8640_check_chip_id':
>> drivers/gpu/drm/bridge/parade-ps8640.c:717:21: warning: passing argument 2 
>> of '__builtin_memcmp' makes pointer from integer without a cast 
>> [-Wint-conversion]
 return memcmp(buf, hw_chip_id, sizeof(buf));
^
   In file included from arch/x86/include/asm/string.h:2:0,
from include/linux/string.h:18,
from arch/x86/include/asm/page_32.h:34,
from arch/x86/include/asm/page.h:13,
from arch/x86/include/asm/thread_info.h:11,
from include/linux/thread_info.h:54,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/firmware.h:6,
from drivers/gpu/drm/bridge/parade-ps8640.c:16:
   arch/x86/include/asm/string_32.h:202:16: note: expected 'const void *' but 
argument is of type 'u8 {aka const unsigned char}'
#define memcmp __builtin_memcmp
   ^
>> include/linux/string.h:112:12: note: in expansion of macro 'memcmp'
extern int memcmp(const void *,const void *,__kernel_size_t);
   ^
   cc1: some warnings being treated as errors

vim +114 drivers/gpu/drm/bridge/parade-ps8640.c

98  struct mipi_dsi_device dsi;
99  struct i2c_client *page[8];
   100  struct i2c_client *ddc_i2c;
   101  struct regulator_bulk_data supplies[2];
   102  struct drm_panel *panel;
   103  struct gpio_desc *gpio_rst_n;
   104  struct gpio_desc *gpio_slp_n;
   105  struct gpio_desc *gpio_mode_sel_n;
   106  bool enabled;
   107  
   108  /* firmware file info */
   109  bool in_fw_update;
   110  struct ps8640_info info;
   111  };
   112  
   113  static const u8 enc_ctrl_code[6] = {0xaa, 0x55, 0x50, 0x41, 0x52, 0x44};
 > 114  static const u8 hw_chip_id = {0x00, 0x0a, 0x00, 0x30};
   115  
   116  static int ps8640_read(struct i2c_client *client, u8 reg, u8 *data,
   117 u16 data_len)
   118  {
   119  int ret;
   120  struct i2c_msg msgs[] = {
   121  {
   122   .addr = client->addr,

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
-- next part --
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 53508 bytes
Desc: not available
URL: 



[PATCH v12 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

2016-03-16 Thread Jitao Shi
This patch adds drm_bridge driver for parade DSI to eDP bridge chip.

Signed-off-by: Jitao Shi 
---
Changes since v11:
 - Remove depends on I2C, add DRM depends
 - Reuse ps8640_write_bytes() in ps8640_write_byte()
 - Use timer check for polling like the routines in 
 - Fix no drm_connector_unregister/drm_connector_cleanup when 
ps8640_bridge_attach fail
 - Check the ps8640 hardware id in ps8640_validate_firmware
 - Remove fw_version check
 - Move ps8640_validate_firmware before ps8640_enter_bl
 - Add ddc_i2c unregister when probe fail and ps8640_remove

The following patches are needed to support dsi host through none dsi bus:
https://patchwork.kernel.org/patch/8289181/ ("drm/dsi: check for CONFIG_OF when 
defining")
https://patchwork.kernel.org/patch/8289051/ ("drm/dsi: Use 
mipi_dsi_device_register_full for DSI device")
https://patchwork.kernel.org/patch/8289081/ ("drm/dsi: Try to match non-DT DSI 
devices")
https://patchwork.kernel.org/patch/8289121/ ("drm/dsi: Add routine to 
unregister a DSI device")
https://patchwork.kernel.org/patch/8289091/ ("drm/dsi: Get DSI host by DT 
device node")
---
 drivers/gpu/drm/bridge/Kconfig |   12 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/parade-ps8640.c | 1073 
 3 files changed, 1086 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/parade-ps8640.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 27e2022..be6084e 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -40,4 +40,16 @@ config DRM_PARADE_PS8622
---help---
  Parade eDP-LVDS bridge chip driver.

+config DRM_PARADE_PS8640
+   tristate "Parade PS8640 MIPI DSI to eDP Converter"
+   depends on DRM
+   depends on OF
+   select DRM_KMS_HELPER
+   select DRM_MIPI_DSI
+   select DRM_PANEL
+   ---help---
+ Choose this option if you have PS8640 for display
+ The PS8640 is a high-performance and low-power
+ MIPI DSI to eDP converter
+
 endmenu
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index f13c33d..fbe38dc 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o
 obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
+obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o
diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c 
b/drivers/gpu/drm/bridge/parade-ps8640.c
new file mode 100644
index 000..d7700e2
--- /dev/null
+++ b/drivers/gpu/drm/bridge/parade-ps8640.c
@@ -0,0 +1,1073 @@
+/*
+ * Copyright (c) 2014 MediaTek Inc.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define PAGE2_SPI_CFG3 0x82
+#define I2C_TO_SPI_RESET   0x20
+#define PAGE2_ROMADD_BYTE1 0x8e
+#define PAGE2_ROMADD_BYTE2 0x8f
+#define PAGE2_SWSPI_WDATA  0x90
+#define PAGE2_SWSPI_RDATA  0x91
+#define PAGE2_SWSPI_LEN0x92
+#define PAGE2_SWSPI_CTL0x93
+#define TRIGGER_NO_READBACK0x05
+#define TRIGGER_READBACK   0x01
+#define PAGE2_SPI_STATUS   0x9e
+#define PAGE2_GPIO_L   0xa6
+#define PAGE2_GPIO_H   0xa7
+#define PS_GPIO9   BIT(1)
+#define PAGE2_IROM_CTRL0xb0
+#define IROM_ENABLE0xc0
+#define IROM_DISABLE   0x80
+#define PAGE2_SW_REST  0xbc
+#define SPI_SW_RESET   BIT(7)
+#define MPU_SW_RESET   BIT(6)
+#define PAGE2_ENCTLSPI_WR  0xda
+#define PAGE2_I2C_BYPASS   0xea
+#define I2C_BYPASS_EN  0xd0
+#define PAGE3_SET_ADD  0xfe
+#define PAGE3_SET_VAL  0xff
+#define VDO_CTL_ADD0x13
+#define VDO_DIS0x18
+#define VDO_EN 0x1c
+#define PAGE4_REV_L0xf0
+#define PAGE4_REV_H0xf1
+#define PAGE4_CHIP_L   0xf2
+#define PAGE4_CHIP_H   0xf3
+
+/* Firmware */
+#define SPI_MAX_RETRY_CNT  8
+#define PS_FW_NAME "ps864x_fw.bin"
+
+#define FW_CHIP_ID_OFFSET  0
+#define FW_VERSION_OFFSET  2
+#define EDID_I2C_ADDR  0x50
+
+#define WRITE_STATUS_REG_CMD   0x01
+#define READ_STATUS_REG_CMD0x05
+#define BUSY   BIT(0)
+#