Re: [PATCH v14 5/6] drm/loongson: add drm driver for loongson display controller

2022-04-01 Thread kernel test robot
Hi Sui,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on robh/for-next linus/master v5.17 next-20220401]
[cannot apply to mripard/sunxi/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/intel-lab-lkp/linux/commits/Sui-Jingfeng/drm-loongson-add-drm-driver-for-loongson-display-controller/20220402-003557
base:   git://anongit.freedesktop.org/drm/drm drm-next
config: sparc-randconfig-r012-20220402 
(https://download.01.org/0day-ci/archive/20220402/202204021321.5sydupbx-...@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/b52cc469ed1a99a0803faef886f81607b1f7f5c0
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Sui-Jingfeng/drm-loongson-add-drm-driver-for-loongson-display-controller/20220402-003557
git checkout b52cc469ed1a99a0803faef886f81607b1f7f5c0
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross 
O=build_dir ARCH=sparc SHELL=/bin/bash drivers/gpu/drm/loongson/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/loongson/lsdc_i2c.c: In function 'ls7a_gpio_i2c_set':
>> drivers/gpu/drm/loongson/lsdc_i2c.c:37:23: error: implicit declaration of 
>> function 'readb' [-Werror=implicit-function-declaration]
  37 | val = readb(li2c->dir_reg);
 |   ^
>> drivers/gpu/drm/loongson/lsdc_i2c.c:39:17: error: implicit declaration of 
>> function 'writeb' [-Werror=implicit-function-declaration]
  39 | writeb(val, li2c->dir_reg);
 | ^~
   cc1: some warnings being treated as errors


vim +/readb +37 drivers/gpu/drm/loongson/lsdc_i2c.c

19  
20  /*
21   * ls7a_gpio_i2c_set - set the state of a gpio pin, either high or low.
22   * @mask: gpio pin mask indicate which pin to set
23   */
24  static void ls7a_gpio_i2c_set(struct lsdc_i2c * const li2c, int mask, 
int state)
25  {
26  unsigned long flags;
27  u8 val;
28  
29  spin_lock_irqsave(&li2c->reglock, flags);
30  
31  if (state) {
32  /*
33   * The high state is achieved by setting the direction 
as
34   * input, because the GPIO is open drained with external
35   * pull up resistance.
36   */
  > 37  val = readb(li2c->dir_reg);
38  val |= mask;
  > 39  writeb(val, li2c->dir_reg);
40  } else {
41  /* First, set this pin as output */
42  val = readb(li2c->dir_reg);
43  val &= ~mask;
44  writeb(val, li2c->dir_reg);
45  
46  /* Then, set the state to it */
47  val = readb(li2c->dat_reg);
48  val &= ~mask;
49  writeb(val, li2c->dat_reg);
50  }
51  
52  spin_unlock_irqrestore(&li2c->reglock, flags);
53  }
54  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


[PATCH v14 5/6] drm/loongson: add drm driver for loongson display controller

2022-04-01 Thread Sui Jingfeng
There is a display controller in loongson's LS2K1000 SoC and LS7A1000
bridge chip, the display controller is a PCI device. It have two display
pipes but with only one hardware cursor. Each way has a DVO interface
which provide RGB888 signals, vertical & horizontal synchronisations,
data enable and the pixel clock.

Each CRTC is able to drive a 1920x1080@60Hz monitor, the maxmium
resolution is 2048x2048. Loongson display controllers are simple which
require scanout buffers to be physically contiguous.

For LS7A1000 bridge chip, the DC is equipped with a dedicated video RAM
which is typically 64MB or more. In this case, VRAM helper based driver
is intended to be used even through the DC can scanout form system memory.

While LS2K1000 is a SoC which is a typically UMA device, only system
memory is available. Therefore CMA helper based driver is intended to be
used. It is possible to use VRAM helper based driver on LS2K1000 by
carving out part of system memory as VRAM though.

For LS7A1000, there are 4 dedicated GPIOs whose control registers is
located at the DC register space, They are used to emulate two way i2c.
One for DVO0, another for DVO1. LS2K1000 and LS2K0500 SoC don't have such
GPIO hardwared, they grab i2c adapter from other module, either general
purpose GPIO emulated i2c or hardware i2c adapter.

+--++---+
| DDR4 ||  +---+|
+--+|  | PCIe Root complex |   LS7A1000 |
   || MC0   |  +--++-+++|
  +--+  HT 3.0  | || || |
  | LS3A4000 |<>| +---++---+  +--++--++-+   +--+
  |   CPU|<>| | GC1000 |  | LSDC |<-->| DDR3 MC |<->| VRAM |
  +--+  | ++  +-+--+-++-+   +--+
   || MC1   +---|--|+
+--+|  |
| DDR4 |  +---+   DVO0  |  |  DVO1   +--+
+--+   VGA <--|ADV7125|<+  +>|TFP410|--> DVI/HDMI
  +---+  +--+

The above picture give a simple usage of LS7A1000, note that the encoder
is not necessary adv7125 or tfp410, other candicates can be ch7034b,
sil9022, ite66121 and lt8618 etc.

By design, the code was written in a NOT fully DT dependent way.

v2: Fixup warnings reported by kernel test robot

v3: Fix more grammar mistakes in Kconfig reported by Randy Dunlap and give
more details about lsdc.

v4:
   1) Add dts required and explain why device tree is required.
   2) Give more description about lsdc and VRAM helper based driver.
   3) Fix warnings reported by kernel test robot.
   4) Introduce stride_alignment member into struct lsdc_chip_desc, the
  stride alignment is 256 bytes for ls7a1000, ls2k1000 and ls2k0500.

v5:
   1) Using writel and readl replace writeq and readq, to fix kernel test
  robot report build error on other archtecture.
   2) Set default fb format to XRGB at crtc reset time.

v6:
   1) Explain why we are not switch to drm dridge subsystem on ls2k1000.
   2) Explain why tiny drm driver is not suitable for us.
   3) Give a short description of the trival dirty update implement based
  on CMA helper.

v7:
   1) Remove select I2C_GPIO and I2C_LS2X in Kconfig, it is not ready now
   2) Licensing issues are fixed suggested by Krzysztof Kozlowski.
   3) Remove lsdc_pixpll_print(), part of it move to debugfs.
   4) Set prefer_shadow to true if vram based driver is in using.
   5) Replace double blank lines with single line in all files.
   6) Verbose cmd line parameter is replaced with drm_dbg()
   7) All warnnings reported by ./scripts/checkpatch.pl --strict are fixed
   8) Get edid from dtb support is removed as suggested by Maxime Ripard
   9) Fix typos and various improvement

v8:
   1) Drop damage update implement and its command line.
   2) Drop DRM_LSDC_VRAM_DRIVER config option as suggested by Maxime.
   3) Deduce DC's identification from its compatible property.
   4) Drop the board specific dts patch.
   5) Add documention about the display controller device node.

v9:
   1) Fix the warnings reported by checkpatch script and fix typos

v10:
   1) Pass `make dt_binding_check` validation
   2) Fix warnings reported by kernel test robot

v11:
   1) Convert the driver to use drm bridge and of graph framework.
   2) Dump register value support through debugfs.
   3) Select DRM_TTM and DRM_TTM_HELPER in Kconfig which fix linkage
  problem when built it into the kernel.
   4) Non 64 pixel(256 bytes aligned) horiziontal resolutons got
  supported by hacking, default is disabled, enable it by using
  'loongson.relax_alignment=1' on kernel cmd line.
   5) Various improvement as required by Maxime.

v12:
   1) Add gammma support, it is broken because hardware engineer
  does not implement this correctly. Using 'loongson.gamma=1' on
  the