]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'drm-next-4.12' of git://people.freedesktop.org/~agd5f/linux into drm...
authorDave Airlie <airlied@redhat.com>
Thu, 6 Apr 2017 19:41:42 +0000 (05:41 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 6 Apr 2017 19:49:12 +0000 (05:49 +1000)
A few more things for 4.12:
- ttm and amdgpu support for non-contiguous vram CPU mappings
- lots of bug fixes and cleanups for vega10
- misc bug fixes and code cleanups

[airlied: fix do_div error on 32-bit arm, not sure it's 100% correct]

* 'drm-next-4.12' of git://people.freedesktop.org/~agd5f/linux: (58 commits)
  drm/amdgpu: use uintptr_t instead of unsigned long to store pointer
  drm/amdgpu: Avoid using signed integer to store pointer value
  drm/amdgpu:invoke new implemented AI MB func
  drm/amdgpu/vega10:timeout set to equal with VI
  drm/amdgpu:implement the reset MB func for vega10
  drm/amdgpu:fix typo for mxgpu_ai
  drm/amdgpu:no need to involv HDP in KIQ
  drm/amdgpu:add PSP block only load_type=PSP (v2)
  drm/amdgpu/smu9: update to latest driver interface
  drm/amd/amdgpu: cleanup gfx_v9_0_gpu_init()
  drm/amd/amdgpu: cleanup gfx_v9_0_rlc_reset()
  drm/amd/amdgpu: cleanup gfx_v9_0_rlc_start()
  drm/amd/amdgpu: simplify gfx_v9_0_cp_gfx_enable()
  drm/amd/amdgpu: cleanup gfx_v9_0_kiq_init_register()
  drm/amd/amdgpu: Drop gfx_v9_0_print_status()
  drm/amd/amdgpu: cleanup gfx_v9_0_set_gfx_eop_interrupt_state()
  drm/amd/amdgpu: cleanup gfx_v9_0_set_priv_reg_fault_state()
  drm/amd/amdgpu: cleanup gfx_v9_0_set_priv_inst_fault_state()
  drm/amd/amdgpu: cleanup gfx_v9_0_init_queue()
  drm/amdgpu: Move function amdgpu_has_atpx near other similar functions
  ...

100 files changed:
Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt [new file with mode: 0644]
Documentation/devicetree/bindings/display/panel/mitsubishi,aa104xd12.txt [new file with mode: 0644]
Documentation/devicetree/bindings/display/panel/mitsubishi,aa121td01.txt [new file with mode: 0644]
Documentation/devicetree/bindings/display/panel/panel-common.txt [new file with mode: 0644]
Documentation/devicetree/bindings/display/panel/panel-lvds.txt [new file with mode: 0644]
Documentation/devicetree/bindings/display/renesas,du.txt
MAINTAINERS
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/etnaviv/Kconfig
drivers/gpu/drm/etnaviv/etnaviv_drv.c
drivers/gpu/drm/etnaviv/etnaviv_gem.h
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
drivers/gpu/drm/etnaviv/etnaviv_gpu.h
drivers/gpu/drm/imx/Kconfig
drivers/gpu/drm/imx/Makefile
drivers/gpu/drm/imx/imx-drm-core.c
drivers/gpu/drm/imx/imx-drm.h
drivers/gpu/drm/imx/ipuv3-crtc.c
drivers/gpu/drm/nouveau/include/nvkm/core/msgqueue.h
drivers/gpu/drm/nouveau/include/nvkm/core/tegra.h
drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h
drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/ibus.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/mc.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/secboot.h
drivers/gpu/drm/nouveau/nouveau_platform.c
drivers/gpu/drm/nouveau/nv50_display.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/Kbuild
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gp100.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gp10b.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/engine/gr/Kbuild
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgp102.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgp107.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp100.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp102.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp107.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp10b.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c
drivers/gpu/drm/nouveau/nvkm/falcon/msgqueue.c
drivers/gpu/drm/nouveau/nvkm/falcon/msgqueue.h
drivers/gpu/drm/nouveau/nvkm/falcon/msgqueue_0137c63d.c
drivers/gpu/drm/nouveau/nvkm/falcon/msgqueue_0148cdec.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gp10b.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/ibus/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gp10b.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
drivers/gpu/drm/nouveau/nvkm/subdev/mc/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gp100.c
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gp10b.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr.h
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.h
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r367.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r367.h
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.h
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode.h
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_gr.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c
drivers/gpu/drm/panel/Kconfig
drivers/gpu/drm/panel/Makefile
drivers/gpu/drm/panel/panel-lvds.c [new file with mode: 0644]
drivers/gpu/drm/rcar-du/Kconfig
drivers/gpu/drm/rcar-du/Makefile
drivers/gpu/drm/rcar-du/rcar_du_crtc.c
drivers/gpu/drm/rcar-du/rcar_du_crtc.h
drivers/gpu/drm/rcar-du/rcar_du_drv.c
drivers/gpu/drm/rcar-du/rcar_du_drv.h
drivers/gpu/drm/rcar-du/rcar_du_encoder.c
drivers/gpu/drm/rcar-du/rcar_du_encoder.h
drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c [deleted file]
drivers/gpu/drm/rcar-du/rcar_du_hdmienc.h [deleted file]
drivers/gpu/drm/rcar-du/rcar_du_kms.c
drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.h
drivers/gpu/drm/rcar-du/rcar_du_regs.h
drivers/gpu/drm/rcar-du/rcar_du_vgacon.c [deleted file]
drivers/gpu/drm/rcar-du/rcar_du_vgacon.h [deleted file]
drivers/gpu/drm/rcar-du/rcar_du_vsp.h
drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c [new file with mode: 0644]
drivers/gpu/ipu-v3/Makefile
drivers/gpu/ipu-v3/ipu-common.c
include/drm/drm_connector.h
include/uapi/drm/etnaviv_drm.h

diff --git a/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt b/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt
new file mode 100644 (file)
index 0000000..f6b3f36
--- /dev/null
@@ -0,0 +1,75 @@
+Renesas Gen3 DWC HDMI TX Encoder
+================================
+
+The HDMI transmitter is a Synopsys DesignWare HDMI 1.4 TX controller IP
+with a companion PHY IP.
+
+These DT bindings follow the Synopsys DWC HDMI TX bindings defined in
+Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt with the
+following device-specific properties.
+
+
+Required properties:
+
+- compatible : Shall contain one or more of
+  - "renesas,r8a7795-hdmi" for R8A7795 (R-Car H3) compatible HDMI TX
+  - "renesas,rcar-gen3-hdmi" for the generic R-Car Gen3 compatible HDMI TX
+
+    When compatible with generic versions, nodes must list the SoC-specific
+    version corresponding to the platform first, followed by the
+    family-specific version.
+
+- reg: See dw_hdmi.txt.
+- interrupts: HDMI interrupt number
+- clocks: See dw_hdmi.txt.
+- clock-names: Shall contain "iahb" and "isfr" as defined in dw_hdmi.txt.
+- ports: See dw_hdmi.txt. The DWC HDMI shall have one port numbered 0
+  corresponding to the video input of the controller and one port numbered 1
+  corresponding to its HDMI output. Each port shall have a single endpoint.
+
+Optional properties:
+
+- power-domains: Shall reference the power domain that contains the DWC HDMI,
+  if any.
+
+
+Example:
+
+       hdmi0: hdmi0@fead0000 {
+               compatible = "renesas,r8a7795-dw-hdmi";
+               reg = <0 0xfead0000 0 0x10000>;
+               interrupts = <0 389 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cpg CPG_CORE R8A7795_CLK_S0D4>, <&cpg CPG_MOD 729>;
+               clock-names = "iahb", "isfr";
+               power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+               status = "disabled";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       port@0 {
+                               reg = <0>;
+                               dw_hdmi0_in: endpoint {
+                                       remote-endpoint = <&du_out_hdmi0>;
+                               };
+                       };
+                       port@1 {
+                               reg = <1>;
+                               rcar_dw_hdmi0_out: endpoint {
+                                       remote-endpoint = <&hdmi0_con>;
+                               };
+                       };
+               };
+       };
+
+       hdmi0-out {
+               compatible = "hdmi-connector";
+               label = "HDMI0 OUT";
+               type = "a";
+
+               port {
+                       hdmi0_con: endpoint {
+                               remote-endpoint = <&rcar_dw_hdmi0_out>;
+                       };
+               };
+       };
diff --git a/Documentation/devicetree/bindings/display/panel/mitsubishi,aa104xd12.txt b/Documentation/devicetree/bindings/display/panel/mitsubishi,aa104xd12.txt
new file mode 100644 (file)
index 0000000..ced0121
--- /dev/null
@@ -0,0 +1,47 @@
+Mitsubishi AA204XD12 LVDS Display Panel
+=======================================
+
+The AA104XD12 is a 10.4" XGA TFT-LCD display panel.
+
+These DT bindings follow the LVDS panel bindings defined in panel-lvds.txt
+with the following device-specific properties.
+
+
+Required properties:
+
+- compatible: Shall contain "mitsubishi,aa121td01" and "panel-lvds", in that
+  order.
+- vcc-supply: Reference to the regulator powering the panel VCC pins.
+
+
+Example
+-------
+
+panel {
+       compatible = "mitsubishi,aa104xd12", "panel-lvds";
+       vcc-supply = <&vcc_3v3>;
+
+       width-mm = <210>;
+       height-mm = <158>;
+
+       data-mapping = "jeida-24";
+
+       panel-timing {
+               /* 1024x768 @65Hz */
+               clock-frequency = <65000000>;
+               hactive = <1024>;
+               vactive = <768>;
+               hsync-len = <136>;
+               hfront-porch = <20>;
+               hback-porch = <160>;
+               vfront-porch = <3>;
+               vback-porch = <29>;
+               vsync-len = <6>;
+       };
+
+       port {
+               panel_in: endpoint {
+                       remote-endpoint = <&lvds_encoder>;
+               };
+       };
+};
diff --git a/Documentation/devicetree/bindings/display/panel/mitsubishi,aa121td01.txt b/Documentation/devicetree/bindings/display/panel/mitsubishi,aa121td01.txt
new file mode 100644 (file)
index 0000000..d6e1097
--- /dev/null
@@ -0,0 +1,47 @@
+Mitsubishi AA121TD01 LVDS Display Panel
+=======================================
+
+The AA121TD01 is a 12.1" WXGA TFT-LCD display panel.
+
+These DT bindings follow the LVDS panel bindings defined in panel-lvds.txt
+with the following device-specific properties.
+
+
+Required properties:
+
+- compatible: Shall contain "mitsubishi,aa121td01" and "panel-lvds", in that
+  order.
+- vcc-supply: Reference to the regulator powering the panel VCC pins.
+
+
+Example
+-------
+
+panel {
+       compatible = "mitsubishi,aa121td01", "panel-lvds";
+       vcc-supply = <&vcc_3v3>;
+
+       width-mm = <261>;
+       height-mm = <163>;
+
+       data-mapping = "jeida-24";
+
+       panel-timing {
+               /* 1280x800 @60Hz */
+               clock-frequency = <71000000>;
+               hactive = <1280>;
+               vactive = <800>;
+               hsync-len = <70>;
+               hfront-porch = <20>;
+               hback-porch = <70>;
+               vsync-len = <5>;
+               vfront-porch = <3>;
+               vback-porch = <15>;
+       };
+
+       port {
+               panel_in: endpoint {
+                       remote-endpoint = <&lvds_encoder>;
+               };
+       };
+};
diff --git a/Documentation/devicetree/bindings/display/panel/panel-common.txt b/Documentation/devicetree/bindings/display/panel/panel-common.txt
new file mode 100644 (file)
index 0000000..ec52c47
--- /dev/null
@@ -0,0 +1,91 @@
+Common Properties for Display Panel
+===================================
+
+This document defines device tree properties common to several classes of
+display panels. It doesn't constitue a device tree binding specification by
+itself but is meant to be referenced by device tree bindings.
+
+When referenced from panel device tree bindings the properties defined in this
+document are defined as follows. The panel device tree bindings are
+responsible for defining whether each property is required or optional.
+
+
+Descriptive Properties
+----------------------
+
+- width-mm,
+- height-mm: The width-mm and height-mm specify the width and height of the
+  physical area where images are displayed. These properties are expressed in
+  millimeters and rounded to the closest unit.
+
+- label: The label property specifies a symbolic name for the panel as a
+  string suitable for use by humans. It typically contains a name inscribed on
+  the system (e.g. as an affixed label) or specified in the system's
+  documentation (e.g. in the user's manual).
+
+  If no such name exists, and unless the property is mandatory according to
+  device tree bindings, it shall rather be omitted than constructed of
+  non-descriptive information. For instance an LCD panel in a system that
+  contains a single panel shall not be labelled "LCD" if that name is not
+  inscribed on the system or used in a descriptive fashion in system
+  documentation.
+
+
+Display Timings
+---------------
+
+- panel-timing: Most display panels are restricted to a single resolution and
+  require specific display timings. The panel-timing subnode expresses those
+  timings as specified in the timing subnode section of the display timing
+  bindings defined in
+  Documentation/devicetree/bindings/display/display-timing.txt.
+
+
+Connectivity
+------------
+
+- ports: Panels receive video data through one or multiple connections. While
+  the nature of those connections is specific to the panel type, the
+  connectivity is expressed in a standard fashion using ports as specified in
+  the device graph bindings defined in
+  Documentation/devicetree/bindings/graph.txt.
+
+- ddc-i2c-bus: Some panels expose EDID information through an I2C-compatible
+  bus such as DDC2 or E-DDC. For such panels the ddc-i2c-bus contains a
+  phandle to the system I2C controller connected to that bus.
+
+
+Control I/Os
+------------
+
+Many display panels can be controlled through pins driven by GPIOs. The nature
+and timing of those control signals are device-specific and left for panel
+device tree bindings to specify. The following GPIO specifiers can however be
+used for panels that implement compatible control signals.
+
+- enable-gpios: Specifier for a GPIO connected to the panel enable control
+  signal. The enable signal is active high and enables operation of the panel.
+  This property can also be used for panels implementing an active low power
+  down signal, which is a negated version of the enable signal. Active low
+  enable signals (or active high power down signals) can be supported by
+  inverting the GPIO specifier polarity flag.
+
+  Note that the enable signal control panel operation only and must not be
+  confused with a backlight enable signal.
+
+- reset-gpios: Specifier for a GPIO coonnected to the panel reset control
+  signal. The reset signal is active low and resets the panel internal logic
+  while active. Active high reset signals can be supported by inverting the
+  GPIO specifier polarity flag.
+
+
+Backlight
+---------
+
+Most display panels include a backlight. Some of them also include a backlight
+controller exposed through a control bus such as I2C or DSI. Others expose
+backlight control through GPIO, PWM or other signals connected to an external
+backlight controller.
+
+- backlight: For panels whose backlight is controlled by an external backlight
+  controller, this property contains a phandle that references the controller.
diff --git a/Documentation/devicetree/bindings/display/panel/panel-lvds.txt b/Documentation/devicetree/bindings/display/panel/panel-lvds.txt
new file mode 100644 (file)
index 0000000..b938269
--- /dev/null
@@ -0,0 +1,120 @@
+LVDS Display Panel
+==================
+
+LVDS is a physical layer specification defined in ANSI/TIA/EIA-644-A. Multiple
+incompatible data link layers have been used over time to transmit image data
+to LVDS panels. This bindings supports display panels compatible with the
+following specifications.
+
+[JEIDA] "Digital Interface Standards for Monitor", JEIDA-59-1999, February
+1999 (Version 1.0), Japan Electronic Industry Development Association (JEIDA)
+[LDI] "Open LVDS Display Interface", May 1999 (Version 0.95), National
+Semiconductor
+[VESA] "VESA Notebook Panel Standard", October 2007 (Version 1.0), Video
+Electronics Standards Association (VESA)
+
+Device compatible with those specifications have been marketed under the
+FPD-Link and FlatLink brands.
+
+
+Required properties:
+
+- compatible: Shall contain "panel-lvds" in addition to a mandatory
+  panel-specific compatible string defined in individual panel bindings. The
+  "panel-lvds" value shall never be used on its own.
+- width-mm: See panel-common.txt.
+- height-mm: See panel-common.txt.
+- data-mapping: The color signals mapping order, "jeida-18", "jeida-24"
+  or "vesa-24".
+
+Optional properties:
+
+- label: See panel-common.txt.
+- gpios: See panel-common.txt.
+- backlight: See panel-common.txt.
+- data-mirror: If set, reverse the bit order described in the data mappings
+  below on all data lanes, transmitting bits for slots 6 to 0 instead of
+  0 to 6.
+
+Required nodes:
+
+- panel-timing: See panel-common.txt.
+- ports: See panel-common.txt. These bindings require a single port subnode
+  corresponding to the panel LVDS input.
+
+
+LVDS data mappings are defined as follows.
+
+- "jeida-18" - 18-bit data mapping compatible with the [JEIDA], [LDI] and
+  [VESA] specifications. Data are transferred as follows on 3 LVDS lanes.
+
+Slot       0       1       2       3       4       5       6
+       ________________                         _________________
+Clock                  \_______________________/
+         ______  ______  ______  ______  ______  ______  ______
+DATA0  ><__G0__><__R5__><__R4__><__R3__><__R2__><__R1__><__R0__><
+DATA1  ><__B1__><__B0__><__G5__><__G4__><__G3__><__G2__><__G1__><
+DATA2  ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__><
+
+- "jeida-24" - 24-bit data mapping compatible with the [DSIM] and [LDI]
+  specifications. Data are transferred as follows on 4 LVDS lanes.
+
+Slot       0       1       2       3       4       5       6
+       ________________                         _________________
+Clock                  \_______________________/
+         ______  ______  ______  ______  ______  ______  ______
+DATA0  ><__G2__><__R7__><__R6__><__R5__><__R4__><__R3__><__R2__><
+DATA1  ><__B3__><__B2__><__G7__><__G6__><__G5__><__G4__><__G3__><
+DATA2  ><_CTL2_><_CTL1_><_CTL0_><__B7__><__B6__><__B5__><__B4__><
+DATA3  ><_CTL3_><__B1__><__B0__><__G1__><__G0__><__R1__><__R0__><
+
+- "vesa-24" - 24-bit data mapping compatible with the [VESA] specification.
+  Data are transferred as follows on 4 LVDS lanes.
+
+Slot       0       1       2       3       4       5       6
+       ________________                         _________________
+Clock                  \_______________________/
+         ______  ______  ______  ______  ______  ______  ______
+DATA0  ><__G0__><__R5__><__R4__><__R3__><__R2__><__R1__><__R0__><
+DATA1  ><__B1__><__B0__><__G5__><__G4__><__G3__><__G2__><__G1__><
+DATA2  ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__><
+DATA3  ><_CTL3_><__B7__><__B6__><__G7__><__G6__><__R7__><__R6__><
+
+Control signals are mapped as follows.
+
+CTL0: HSync
+CTL1: VSync
+CTL2: Data Enable
+CTL3: 0
+
+
+Example
+-------
+
+panel {
+       compatible = "mitsubishi,aa121td01", "panel-lvds";
+
+       width-mm = <261>;
+       height-mm = <163>;
+
+       data-mapping = "jeida-24";
+
+       panel-timing {
+               /* 1280x800 @60Hz */
+               clock-frequency = <71000000>;
+               hactive = <1280>;
+               vactive = <800>;
+               hsync-len = <70>;
+               hfront-porch = <20>;
+               hback-porch = <70>;
+               vsync-len = <5>;
+               vfront-porch = <3>;
+               vback-porch = <15>;
+       };
+
+       port {
+               panel_in: endpoint {
+                       remote-endpoint = <&lvds_encoder>;
+               };
+       };
+};
index 1a02f099a0ff0a3ac459c752ea8031ef8d88b9f0..c6cb96a4fa939a5672b4770ba7f8673136cb0031 100644 (file)
@@ -36,6 +36,9 @@ Required Properties:
       When supplied they must be named "dclkin.x" with "x" being the input
       clock numerical index.
 
+  - vsps: A list of phandles to the VSP nodes that handle the memory
+    interfaces for the DU channels.
+
 Required nodes:
 
 The connections to the DU output video ports are modeled using the OF graph
index fa8479e1799ab37cdf754866649979e70c1650b5..bac1a88cdd4a6a0c491b3ba43bb3cb00f9b35a97 100644 (file)
@@ -4383,6 +4383,7 @@ S:        Supported
 F:     drivers/gpu/drm/rcar-du/
 F:     drivers/gpu/drm/shmobile/
 F:     include/linux/platform_data/shmob_drm.h
+F:     Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt
 F:     Documentation/devicetree/bindings/display/renesas,du.txt
 
 DRM DRIVER FOR QXL VIRTUAL GPU
index e3008d55ec77ce48bae2172ba5192c2d0d16d170..7e993259c2e919b59cb56a1f8072a6948247a238 100644 (file)
@@ -551,7 +551,7 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
 {
        struct drm_mm_node *mm = bo->mem.mm_node;
        uint64_t size = mm->size;
-       unsigned long offset = page_offset;
+       uint64_t offset = page_offset;
 
        page_offset = do_div(offset, size);
        return (bo->mem.bus.base >> PAGE_SHIFT) + mm->start + page_offset;
index cc1731c5289c26811020968b9f5090995ce35945..71cee4e9fefbbb82eeedf2cfd327e9f6fbc8de6a 100644 (file)
@@ -5,6 +5,7 @@ config DRM_ETNAVIV
        depends on ARCH_MXC || ARCH_DOVE || (ARM && COMPILE_TEST)
        depends on MMU
        select SHMEM
+       select SYNC_FILE
        select TMPFS
        select IOMMU_API
        select IOMMU_SUPPORT
index 587e45043542b642fa519892d4ec3570b22e5e52..5255278dde5603a6f13587b1276c0cbc8adc908d 100644 (file)
@@ -111,7 +111,7 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
        return 0;
 }
 
-static void etnaviv_preclose(struct drm_device *dev, struct drm_file *file)
+static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file)
 {
        struct etnaviv_drm_private *priv = dev->dev_private;
        struct etnaviv_file_private *ctx = file->driver_priv;
@@ -488,7 +488,7 @@ static struct drm_driver etnaviv_drm_driver = {
                                DRIVER_PRIME |
                                DRIVER_RENDER,
        .open               = etnaviv_open,
-       .preclose           = etnaviv_preclose,
+       .postclose           = etnaviv_postclose,
        .gem_free_object_unlocked = etnaviv_gem_free_object,
        .gem_vm_ops         = &vm_ops,
        .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
@@ -512,7 +512,7 @@ static struct drm_driver etnaviv_drm_driver = {
        .desc               = "etnaviv DRM",
        .date               = "20151214",
        .major              = 1,
-       .minor              = 0,
+       .minor              = 1,
 };
 
 /*
index e63ff116a3b3df15e15897068d37e0f366803978..c4a091e874269fd9ac79a025f9d37f250ac95520 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/reservation.h>
 #include "etnaviv_drv.h"
 
+struct dma_fence;
 struct etnaviv_gem_ops;
 struct etnaviv_gem_object;
 
@@ -104,9 +105,10 @@ struct etnaviv_gem_submit {
        struct drm_device *dev;
        struct etnaviv_gpu *gpu;
        struct ww_acquire_ctx ticket;
-       u32 fence;
+       struct dma_fence *fence;
        unsigned int nr_bos;
        struct etnaviv_gem_submit_bo bos[0];
+       u32 flags;
 };
 
 int etnaviv_gem_wait_bo(struct etnaviv_gpu *gpu, struct drm_gem_object *obj,
index 726090d7a6acef60e2a30db90ff5a79a1cf40940..e1909429837eebc2072d00d9a9f590c6e5f87bd2 100644 (file)
@@ -14,7 +14,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/dma-fence-array.h>
 #include <linux/reservation.h>
+#include <linux/sync_file.h>
 #include "etnaviv_cmdbuf.h"
 #include "etnaviv_drv.h"
 #include "etnaviv_gpu.h"
@@ -169,8 +171,10 @@ static int submit_fence_sync(const struct etnaviv_gem_submit *submit)
        for (i = 0; i < submit->nr_bos; i++) {
                struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj;
                bool write = submit->bos[i].flags & ETNA_SUBMIT_BO_WRITE;
+               bool explicit = !(submit->flags & ETNA_SUBMIT_NO_IMPLICIT);
 
-               ret = etnaviv_gpu_fence_sync_obj(etnaviv_obj, context, write);
+               ret = etnaviv_gpu_fence_sync_obj(etnaviv_obj, context, write,
+                                                explicit);
                if (ret)
                        break;
        }
@@ -290,6 +294,7 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit)
        }
 
        ww_acquire_fini(&submit->ticket);
+       dma_fence_put(submit->fence);
        kfree(submit);
 }
 
@@ -303,6 +308,9 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
        struct etnaviv_gem_submit *submit;
        struct etnaviv_cmdbuf *cmdbuf;
        struct etnaviv_gpu *gpu;
+       struct dma_fence *in_fence = NULL;
+       struct sync_file *sync_file = NULL;
+       int out_fence_fd = -1;
        void *stream;
        int ret;
 
@@ -326,6 +334,11 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
                return -EINVAL;
        }
 
+       if (args->flags & ~ETNA_SUBMIT_FLAGS) {
+               DRM_ERROR("invalid flags: 0x%x\n", args->flags);
+               return -EINVAL;
+       }
+
        /*
         * Copy the command submission and bo array to kernel space in
         * one go, and do this outside of any locks.
@@ -365,12 +378,22 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
                goto err_submit_cmds;
        }
 
+       if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
+               out_fence_fd = get_unused_fd_flags(O_CLOEXEC);
+               if (out_fence_fd < 0) {
+                       ret = out_fence_fd;
+                       goto err_submit_cmds;
+               }
+       }
+
        submit = submit_create(dev, gpu, args->nr_bos);
        if (!submit) {
                ret = -ENOMEM;
                goto err_submit_cmds;
        }
 
+       submit->flags = args->flags;
+
        ret = submit_lookup_objects(submit, file, bos, args->nr_bos);
        if (ret)
                goto err_submit_objects;
@@ -385,6 +408,24 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
                goto err_submit_objects;
        }
 
+       if (args->flags & ETNA_SUBMIT_FENCE_FD_IN) {
+               in_fence = sync_file_get_fence(args->fence_fd);
+               if (!in_fence) {
+                       ret = -EINVAL;
+                       goto err_submit_objects;
+               }
+
+               /*
+                * Wait if the fence is from a foreign context, or if the fence
+                * array contains any fence from a foreign context.
+                */
+               if (!dma_fence_match_context(in_fence, gpu->fence_context)) {
+                       ret = dma_fence_wait(in_fence, true);
+                       if (ret)
+                               goto err_submit_objects;
+               }
+       }
+
        ret = submit_fence_sync(submit);
        if (ret)
                goto err_submit_objects;
@@ -405,7 +446,23 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
        if (ret == 0)
                cmdbuf = NULL;
 
-       args->fence = submit->fence;
+       if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
+               /*
+                * This can be improved: ideally we want to allocate the sync
+                * file before kicking off the GPU job and just attach the
+                * fence to the sync file here, eliminating the ENOMEM
+                * possibility at this stage.
+                */
+               sync_file = sync_file_create(submit->fence);
+               if (!sync_file) {
+                       ret = -ENOMEM;
+                       goto out;
+               }
+               fd_install(out_fence_fd, sync_file->file);
+       }
+
+       args->fence_fd = out_fence_fd;
+       args->fence = submit->fence->seqno;
 
 out:
        submit_unpin_objects(submit);
@@ -419,9 +476,13 @@ out:
                flush_workqueue(priv->wq);
 
 err_submit_objects:
+       if (in_fence)
+               dma_fence_put(in_fence);
        submit_cleanup(submit);
 
 err_submit_cmds:
+       if (ret && (out_fence_fd >= 0))
+               put_unused_fd(out_fence_fd);
        /* if we still own the cmdbuf */
        if (cmdbuf)
                etnaviv_cmdbuf_free(cmdbuf);
index 130d7d517a19a180ca7f2e744131aeabc554564b..bafbcb46355574244d590e295eb5c198ad20f06e 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/dma-fence.h>
 #include <linux/moduleparam.h>
 #include <linux/of_device.h>
+#include <linux/thermal.h>
 
 #include "etnaviv_cmdbuf.h"
 #include "etnaviv_dump.h"
@@ -409,6 +410,17 @@ static void etnaviv_gpu_load_clock(struct etnaviv_gpu *gpu, u32 clock)
        gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, clock);
 }
 
+static void etnaviv_gpu_update_clock(struct etnaviv_gpu *gpu)
+{
+       unsigned int fscale = 1 << (6 - gpu->freq_scale);
+       u32 clock;
+
+       clock = VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS |
+               VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(fscale);
+
+       etnaviv_gpu_load_clock(gpu, clock);
+}
+
 static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
 {
        u32 control, idle;
@@ -426,11 +438,10 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
        timeout = jiffies + msecs_to_jiffies(1000);
 
        while (time_is_after_jiffies(timeout)) {
-               control = VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS |
-                         VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(0x40);
-
                /* enable clock */
-               etnaviv_gpu_load_clock(gpu, control);
+               etnaviv_gpu_update_clock(gpu);
+
+               control = gpu_read(gpu, VIVS_HI_CLOCK_CONTROL);
 
                /* Wait for stable clock.  Vivante's code waited for 1ms */
                usleep_range(1000, 10000);
@@ -490,11 +501,7 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
        }
 
        /* We rely on the GPU running, so program the clock */
-       control = VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS |
-                 VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(0x40);
-
-       /* enable clock */
-       etnaviv_gpu_load_clock(gpu, control);
+       etnaviv_gpu_update_clock(gpu);
 
        return 0;
 }
@@ -1051,6 +1058,12 @@ static struct dma_fence *etnaviv_gpu_fence_alloc(struct etnaviv_gpu *gpu)
 {
        struct etnaviv_fence *f;
 
+       /*
+        * GPU lock must already be held, otherwise fence completion order might
+        * not match the seqno order assigned here.
+        */
+       lockdep_assert_held(&gpu->lock);
+
        f = kzalloc(sizeof(*f), GFP_KERNEL);
        if (!f)
                return NULL;
@@ -1064,7 +1077,7 @@ static struct dma_fence *etnaviv_gpu_fence_alloc(struct etnaviv_gpu *gpu)
 }
 
 int etnaviv_gpu_fence_sync_obj(struct etnaviv_gem_object *etnaviv_obj,
-       unsigned int context, bool exclusive)
+       unsigned int context, bool exclusive, bool explicit)
 {
        struct reservation_object *robj = etnaviv_obj->resv;
        struct reservation_object_list *fobj;
@@ -1077,6 +1090,9 @@ int etnaviv_gpu_fence_sync_obj(struct etnaviv_gem_object *etnaviv_obj,
                        return ret;
        }
 
+       if (explicit)
+               return 0;
+
        /*
         * If we have any shared fences, then the exclusive fence
         * should be ignored as it will already have been signalled.
@@ -1321,8 +1337,8 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
        mutex_lock(&gpu->lock);
 
        gpu->event[event].fence = fence;
-       submit->fence = fence->seqno;
-       gpu->active_fence = submit->fence;
+       submit->fence = dma_fence_get(fence);
+       gpu->active_fence = submit->fence->seqno;
 
        if (gpu->lastctx != cmdbuf->ctx) {
                gpu->mmu->need_flush = true;
@@ -1526,17 +1542,13 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
 #ifdef CONFIG_PM
 static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)
 {
-       u32 clock;
        int ret;
 
        ret = mutex_lock_killable(&gpu->lock);
        if (ret)
                return ret;
 
-       clock = VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS |
-               VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(0x40);
-
-       etnaviv_gpu_load_clock(gpu, clock);
+       etnaviv_gpu_update_clock(gpu);
        etnaviv_gpu_hw_init(gpu);
 
        gpu->switch_context = true;
@@ -1548,6 +1560,47 @@ static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)
 }
 #endif
 
+static int
+etnaviv_gpu_cooling_get_max_state(struct thermal_cooling_device *cdev,
+                                 unsigned long *state)
+{
+       *state = 6;
+
+       return 0;
+}
+
+static int
+etnaviv_gpu_cooling_get_cur_state(struct thermal_cooling_device *cdev,
+                                 unsigned long *state)
+{
+       struct etnaviv_gpu *gpu = cdev->devdata;
+
+       *state = gpu->freq_scale;
+
+       return 0;
+}
+
+static int
+etnaviv_gpu_cooling_set_cur_state(struct thermal_cooling_device *cdev,
+                                 unsigned long state)
+{
+       struct etnaviv_gpu *gpu = cdev->devdata;
+
+       mutex_lock(&gpu->lock);
+       gpu->freq_scale = state;
+       if (!pm_runtime_suspended(gpu->dev))
+               etnaviv_gpu_update_clock(gpu);
+       mutex_unlock(&gpu->lock);
+
+       return 0;
+}
+
+static struct thermal_cooling_device_ops cooling_ops = {
+       .get_max_state = etnaviv_gpu_cooling_get_max_state,
+       .get_cur_state = etnaviv_gpu_cooling_get_cur_state,
+       .set_cur_state = etnaviv_gpu_cooling_set_cur_state,
+};
+
 static int etnaviv_gpu_bind(struct device *dev, struct device *master,
        void *data)
 {
@@ -1556,13 +1609,20 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
        struct etnaviv_gpu *gpu = dev_get_drvdata(dev);
        int ret;
 
+       gpu->cooling = thermal_of_cooling_device_register(dev->of_node,
+                               (char *)dev_name(dev), gpu, &cooling_ops);
+       if (IS_ERR(gpu->cooling))
+               return PTR_ERR(gpu->cooling);
+
 #ifdef CONFIG_PM
        ret = pm_runtime_get_sync(gpu->dev);
 #else
        ret = etnaviv_gpu_clk_enable(gpu);
 #endif
-       if (ret < 0)
+       if (ret < 0) {
+               thermal_cooling_device_unregister(gpu->cooling);
                return ret;
+       }
 
        gpu->drm = drm;
        gpu->fence_context = dma_fence_context_alloc(1);
@@ -1616,6 +1676,9 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
        }
 
        gpu->drm = NULL;
+
+       thermal_cooling_device_unregister(gpu->cooling);
+       gpu->cooling = NULL;
 }
 
 static const struct component_ops gpu_ops = {
index 1c0606ea7d5e8f055818a3c23b86a6774d0c0827..9227a97404473baa373d2ce2934dcf2cf497a7b7 100644 (file)
@@ -97,6 +97,7 @@ struct etnaviv_cmdbuf;
 
 struct etnaviv_gpu {
        struct drm_device *drm;
+       struct thermal_cooling_device *cooling;
        struct device *dev;
        struct mutex lock;
        struct etnaviv_chip_identity identity;
@@ -150,6 +151,7 @@ struct etnaviv_gpu {
        u32 hangcheck_fence;
        u32 hangcheck_dma_addr;
        struct work_struct recover_work;
+       unsigned int freq_scale;
 };
 
 static inline void gpu_write(struct etnaviv_gpu *gpu, u32 reg, u32 data)
@@ -181,7 +183,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m);
 #endif
 
 int etnaviv_gpu_fence_sync_obj(struct etnaviv_gem_object *etnaviv_obj,
-       unsigned int context, bool exclusive);
+       unsigned int context, bool exclusive, bool implicit);
 
 void etnaviv_gpu_retire(struct etnaviv_gpu *gpu);
 int etnaviv_gpu_wait_fence_interruptible(struct etnaviv_gpu *gpu,
index f2c9ae822149c715bfb99a18f4a1218935cf2d8c..c9e439c82241c58569572614314cbbe484ead665 100644 (file)
@@ -31,13 +31,6 @@ config DRM_IMX_LDB
          Choose this to enable the internal LVDS Display Bridge (LDB)
          found on i.MX53 and i.MX6 processors.
 
-config DRM_IMX_IPUV3
-       tristate
-       depends on DRM_IMX
-       depends on IMX_IPUV3_CORE
-       default y if DRM_IMX=y
-       default m if DRM_IMX=m
-
 config DRM_IMX_HDMI
        tristate "Freescale i.MX DRM HDMI"
        select DRM_DW_HDMI
index f3ecd8903d973218a323680de646cff92e5aa785..16ecef33e0089bad9e4593c9f6dbabd41e01f3c7 100644 (file)
@@ -1,5 +1,5 @@
 
-imxdrm-objs := imx-drm-core.o
+imxdrm-objs := imx-drm-core.o ipuv3-crtc.o ipuv3-plane.o
 
 obj-$(CONFIG_DRM_IMX) += imxdrm.o
 
@@ -7,6 +7,5 @@ obj-$(CONFIG_DRM_IMX_PARALLEL_DISPLAY) += parallel-display.o
 obj-$(CONFIG_DRM_IMX_TVE) += imx-tve.o
 obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o
 
-imx-ipuv3-crtc-objs  := ipuv3-crtc.o ipuv3-plane.o
 obj-$(CONFIG_DRM_IMX_IPUV3)    += imx-ipuv3-crtc.o
 obj-$(CONFIG_DRM_IMX_HDMI) += dw_hdmi-imx.o
index 1888bf3920fc054c8dde448814feb7dd2020e6c7..50add2f9e250b671c0727044246634b587eeb56d 100644 (file)
@@ -422,7 +422,23 @@ static struct platform_driver imx_drm_pdrv = {
                .of_match_table = imx_drm_dt_ids,
        },
 };
-module_platform_driver(imx_drm_pdrv);
+
+static struct platform_driver * const drivers[] = {
+       &imx_drm_pdrv,
+       &ipu_drm_driver,
+};
+
+static int __init imx_drm_init(void)
+{
+       return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
+}
+module_init(imx_drm_init);
+
+static void __exit imx_drm_exit(void)
+{
+       platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
+}
+module_exit(imx_drm_exit);
 
 MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
 MODULE_DESCRIPTION("i.MX drm driver core");
index 295434b199db99319c03262c32aa381669eedb0e..f6dd64be9cd594768e1cb7d37de9df8113c8603d 100644 (file)
@@ -29,6 +29,8 @@ int imx_drm_init_drm(struct platform_device *pdev,
                int preferred_bpp);
 int imx_drm_exit_drm(void);
 
+extern struct platform_driver ipu_drm_driver;
+
 void imx_drm_mode_config_init(struct drm_device *drm);
 
 struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb);
index dab9d50ffd8c19acff327b7a67c94fdc0351c622..5456c15d962c525a4879b9b8a2b9cf63814ffc12 100644 (file)
@@ -465,16 +465,10 @@ static int ipu_drm_remove(struct platform_device *pdev)
        return 0;
 }
 
-static struct platform_driver ipu_drm_driver = {
+struct platform_driver ipu_drm_driver = {
        .driver = {
                .name = "imx-ipuv3-crtc",
        },
        .probe = ipu_drm_probe,
        .remove = ipu_drm_remove,
 };
-module_platform_driver(ipu_drm_driver);
-
-MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:imx-ipuv3-crtc");
index fac0824197f1ccff37253b673cb92f1bbca4110c..bf3e532665fbf93b91d87611c1dc0a623d73c9bf 100644 (file)
 
 #ifndef __NVKM_CORE_MSGQUEUE_H
 #define __NVKM_CORE_MSGQUEUE_H
-
-#include <core/os.h>
-
-struct nvkm_falcon;
+#include <subdev/secboot.h>
 struct nvkm_msgqueue;
-enum nvkm_secboot_falcon;
 
 /* Hopefully we will never have firmware arguments larger than that... */
 #define NVKM_MSGQUEUE_CMDLINE_SIZE 0x100
 
-int nvkm_msgqueue_new(u32, struct nvkm_falcon *, struct nvkm_msgqueue **);
+int nvkm_msgqueue_new(u32, struct nvkm_falcon *, const struct nvkm_secboot *,
+                     struct nvkm_msgqueue **);
 void nvkm_msgqueue_del(struct nvkm_msgqueue **);
 void nvkm_msgqueue_recv(struct nvkm_msgqueue *);
 int nvkm_msgqueue_reinit(struct nvkm_msgqueue *);
@@ -41,7 +38,6 @@ int nvkm_msgqueue_reinit(struct nvkm_msgqueue *);
 void nvkm_msgqueue_write_cmdline(struct nvkm_msgqueue *, void *);
 
 /* interface to ACR unit running on falcon (NVIDIA signed firmware) */
-int nvkm_msgqueue_acr_boot_falcon(struct nvkm_msgqueue *,
-                                 enum nvkm_secboot_falcon);
+int nvkm_msgqueue_acr_boot_falcons(struct nvkm_msgqueue *, unsigned long);
 
 #endif
index e5c9b6268dcca59efdaab12e5922b3a5e0ac2b2b..7c7d91cad09a94299317b2ab922acc9fce2b9222 100644 (file)
@@ -42,6 +42,10 @@ struct nvkm_device_tegra_func {
         * Whether the chip requires a reference clock
         */
        bool require_ref_clk;
+       /*
+        * Whether the chip requires the VDD regulator
+        */
+       bool require_vdd;
 };
 
 int nvkm_device_tegra_new(const struct nvkm_device_tegra_func *,
index 24efa900d8caaea2e798ee3bbb1ff2673185a817..f00527b36accfdf10d8d422dd294b6c6b414921e 100644 (file)
@@ -68,4 +68,5 @@ int gm107_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
 int gm200_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
 int gm20b_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
 int gp100_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
+int gp10b_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
 #endif
index 0a636833e0eb445dcad38f508c130e9e573bfd35..c7944b19bed80dfaa96720329ee6840a33a3f8fe 100644 (file)
@@ -44,4 +44,6 @@ int gm200_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
 int gm20b_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
 int gp100_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
 int gp102_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
+int gp107_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
+int gp10b_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
 #endif
index 891497a0fe3be2812be17e0787bb267a72ddacf7..28d513fbf44c387ff5e8a9197f461e7dcc95d9fe 100644 (file)
@@ -97,6 +97,7 @@ int gm200_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
 int gm20b_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
 int gp100_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
 int gp102_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
+int gp10b_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
 
 #include <subdev/bios.h>
 #include <subdev/bios/ramcfg.h>
index c4ecf255ff3937ae3a268636a48345a5f527a882..6e2b70bd2f411a524f985fc181f1d0aa227a3e83 100644 (file)
@@ -7,4 +7,5 @@ int gf117_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
 int gk104_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
 int gk20a_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
 int gm200_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
+int gp10b_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
 #endif
index e68ba636741bf2da0dc7dfb4cd8b9725176f6e9a..58f10890c3b6f16f5a6ccec859de646bd12c40ae 100644 (file)
@@ -29,4 +29,5 @@ int gf100_mc_new(struct nvkm_device *, int, struct nvkm_mc **);
 int gk104_mc_new(struct nvkm_device *, int, struct nvkm_mc **);
 int gk20a_mc_new(struct nvkm_device *, int, struct nvkm_mc **);
 int gp100_mc_new(struct nvkm_device *, int, struct nvkm_mc **);
+int gp10b_mc_new(struct nvkm_device *, int, struct nvkm_mc **);
 #endif
index d6a4bdb6573b41f66bacc950cd000bd348296bb2..59f3ba551681354d639b564d03dc01c2d7ec1976 100644 (file)
@@ -55,10 +55,11 @@ struct nvkm_secboot {
 #define nvkm_secboot(p) container_of((p), struct nvkm_secboot, subdev)
 
 bool nvkm_secboot_is_managed(struct nvkm_secboot *, enum nvkm_secboot_falcon);
-int nvkm_secboot_reset(struct nvkm_secboot *, enum nvkm_secboot_falcon);
+int nvkm_secboot_reset(struct nvkm_secboot *, unsigned long);
 
 int gm200_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **);
 int gm20b_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **);
 int gp102_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **);
+int gp10b_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **);
 
 #endif
index 4c4cc2260257cc1f8fb84f954ab6449d6f11c277..1ada186fab770aba7c598c2661d5fc0955218ad4 100644 (file)
@@ -53,13 +53,21 @@ static int nouveau_platform_remove(struct platform_device *pdev)
 #if IS_ENABLED(CONFIG_OF)
 static const struct nvkm_device_tegra_func gk20a_platform_data = {
        .iommu_bit = 34,
+       .require_vdd = true,
 };
 
 static const struct nvkm_device_tegra_func gm20b_platform_data = {
        .iommu_bit = 34,
+       .require_vdd = true,
        .require_ref_clk = true,
 };
 
+static const struct nvkm_device_tegra_func gp10b_platform_data = {
+       .iommu_bit = 36,
+       /* power provided by generic PM domains */
+       .require_vdd = false,
+};
+
 static const struct of_device_id nouveau_platform_match[] = {
        {
                .compatible = "nvidia,gk20a",
@@ -69,6 +77,10 @@ static const struct of_device_id nouveau_platform_match[] = {
                .compatible = "nvidia,gm20b",
                .data = &gm20b_platform_data,
        },
+       {
+               .compatible = "nvidia,gp10b",
+               .data = &gp10b_platform_data,
+       },
        { }
 };
 
index 418872b493a396221927f33ab7bd299586421607..c9910c8537ed45014e89a64320f289595d0389a3 100644 (file)
@@ -1002,7 +1002,6 @@ nv50_wndw_atomic_destroy_state(struct drm_plane *plane,
 {
        struct nv50_wndw_atom *asyw = nv50_wndw_atom(state);
        __drm_atomic_helper_plane_destroy_state(&asyw->state);
-       dma_fence_put(asyw->state.fence);
        kfree(asyw);
 }
 
@@ -1014,7 +1013,6 @@ nv50_wndw_atomic_duplicate_state(struct drm_plane *plane)
        if (!(asyw = kmalloc(sizeof(*asyw), GFP_KERNEL)))
                return NULL;
        __drm_atomic_helper_plane_duplicate_state(plane, &asyw->state);
-       asyw->state.fence = NULL;
        asyw->interval = 1;
        asyw->sema = armw->sema;
        asyw->ntfy = armw->ntfy;
@@ -2043,6 +2041,7 @@ nv50_head_atomic_check_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
        u32 vbackp  = (mode->vtotal - mode->vsync_end) * vscan / ilace;
        u32 hfrontp =  mode->hsync_start - mode->hdisplay;
        u32 vfrontp = (mode->vsync_start - mode->vdisplay) * vscan / ilace;
+       u32 blankus;
        struct nv50_head_mode *m = &asyh->mode;
 
        m->h.active = mode->htotal;
@@ -2056,9 +2055,10 @@ nv50_head_atomic_check_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
        m->v.blanks = m->v.active - vfrontp - 1;
 
        /*XXX: Safe underestimate, even "0" works */
-       m->v.blankus = (m->v.active - mode->vdisplay - 2) * m->h.active;
-       m->v.blankus *= 1000;
-       m->v.blankus /= mode->clock;
+       blankus = (m->v.active - mode->vdisplay - 2) * m->h.active;
+       blankus *= 1000;
+       blankus /= mode->clock;
+       m->v.blankus = blankus;
 
        if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
                m->v.blank2e =  m->v.active + m->v.synce + vbackp;
index 1076949b802a872ec033ba8bef4acb8f9e4c5d64..b690bc12a5b7f20d8bdf53e1ed24e0eb7fa22bcc 100644 (file)
@@ -714,7 +714,7 @@ nv4a_chipset = {
        .i2c = nv04_i2c_new,
        .imem = nv40_instmem_new,
        .mc = nv44_mc_new,
-       .mmu = nv44_mmu_new,
+       .mmu = nv04_mmu_new,
        .pci = nv40_pci_new,
        .therm = nv40_therm_new,
        .timer = nv41_timer_new,
@@ -2201,8 +2201,6 @@ nv132_chipset = {
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
        .secboot = gp102_secboot_new,
-       .sec2 = gp102_sec2_new,
-       .nvdec = gp102_nvdec_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,
        .timer = gk20a_timer_new,
@@ -2215,6 +2213,8 @@ nv132_chipset = {
        .dma = gf119_dma_new,
        .fifo = gp100_fifo_new,
        .gr = gp102_gr_new,
+       .nvdec = gp102_nvdec_new,
+       .sec2 = gp102_sec2_new,
        .sw = gf100_sw_new,
 };
 
@@ -2235,8 +2235,6 @@ nv134_chipset = {
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
        .secboot = gp102_secboot_new,
-       .sec2 = gp102_sec2_new,
-       .nvdec = gp102_nvdec_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,
        .timer = gk20a_timer_new,
@@ -2249,6 +2247,8 @@ nv134_chipset = {
        .dma = gf119_dma_new,
        .fifo = gp100_fifo_new,
        .gr = gp102_gr_new,
+       .nvdec = gp102_nvdec_new,
+       .sec2 = gp102_sec2_new,
        .sw = gf100_sw_new,
 };
 
@@ -2269,8 +2269,6 @@ nv136_chipset = {
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
        .secboot = gp102_secboot_new,
-       .sec2 = gp102_sec2_new,
-       .nvdec = gp102_nvdec_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,
        .timer = gk20a_timer_new,
@@ -2283,6 +2281,65 @@ nv136_chipset = {
        .dma = gf119_dma_new,
        .fifo = gp100_fifo_new,
        .gr = gp102_gr_new,
+       .nvdec = gp102_nvdec_new,
+       .sec2 = gp102_sec2_new,
+       .sw = gf100_sw_new,
+};
+
+static const struct nvkm_device_chip
+nv137_chipset = {
+       .name = "GP107",
+       .bar = gf100_bar_new,
+       .bios = nvkm_bios_new,
+       .bus = gf100_bus_new,
+       .devinit = gm200_devinit_new,
+       .fb = gp102_fb_new,
+       .fuse = gm107_fuse_new,
+       .gpio = gk104_gpio_new,
+       .i2c = gm200_i2c_new,
+       .ibus = gm200_ibus_new,
+       .imem = nv50_instmem_new,
+       .ltc = gp100_ltc_new,
+       .mc = gp100_mc_new,
+       .mmu = gf100_mmu_new,
+       .secboot = gp102_secboot_new,
+       .pci = gp100_pci_new,
+       .pmu = gp102_pmu_new,
+       .timer = gk20a_timer_new,
+       .top = gk104_top_new,
+       .ce[0] = gp102_ce_new,
+       .ce[1] = gp102_ce_new,
+       .ce[2] = gp102_ce_new,
+       .ce[3] = gp102_ce_new,
+       .disp = gp102_disp_new,
+       .dma = gf119_dma_new,
+       .fifo = gp100_fifo_new,
+       .gr = gp107_gr_new,
+       .nvdec = gp102_nvdec_new,
+       .sec2 = gp102_sec2_new,
+       .sw = gf100_sw_new,
+};
+
+static const struct nvkm_device_chip
+nv13b_chipset = {
+       .name = "GP10B",
+       .bar = gk20a_bar_new,
+       .bus = gf100_bus_new,
+       .fb = gp10b_fb_new,
+       .fuse = gm107_fuse_new,
+       .ibus = gp10b_ibus_new,
+       .imem = gk20a_instmem_new,
+       .ltc = gp100_ltc_new,
+       .mc = gp10b_mc_new,
+       .mmu = gf100_mmu_new,
+       .secboot = gp10b_secboot_new,
+       .pmu = gm20b_pmu_new,
+       .timer = gk20a_timer_new,
+       .top = gk104_top_new,
+       .ce[2] = gp102_ce_new,
+       .dma = gf119_dma_new,
+       .fifo = gp10b_fifo_new,
+       .gr = gp10b_gr_new,
        .sw = gf100_sw_new,
 };
 
@@ -2724,6 +2781,8 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
                case 0x132: device->chip = &nv132_chipset; break;
                case 0x134: device->chip = &nv134_chipset; break;
                case 0x136: device->chip = &nv136_chipset; break;
+               case 0x137: device->chip = &nv137_chipset; break;
+               case 0x13b: device->chip = &nv13b_chipset; break;
                default:
                        nvdev_error(device, "unknown chipset (%08x)\n", boot0);
                        goto done;
index f2bc0b7d9b9351bf5b3db61863a688c1d537b95c..6474bd2a6d0704a832438520c6766d3154711e22 100644 (file)
@@ -28,9 +28,11 @@ nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev)
 {
        int ret;
 
-       ret = regulator_enable(tdev->vdd);
-       if (ret)
-               goto err_power;
+       if (tdev->vdd) {
+               ret = regulator_enable(tdev->vdd);
+               if (ret)
+                       goto err_power;
+       }
 
        ret = clk_prepare_enable(tdev->clk);
        if (ret)
@@ -67,7 +69,8 @@ err_clk_pwr:
 err_clk_ref:
        clk_disable_unprepare(tdev->clk);
 err_clk:
-       regulator_disable(tdev->vdd);
+       if (tdev->vdd)
+               regulator_disable(tdev->vdd);
 err_power:
        return ret;
 }
@@ -75,6 +78,8 @@ err_power:
 static int
 nvkm_device_tegra_power_down(struct nvkm_device_tegra *tdev)
 {
+       int ret;
+
        reset_control_assert(tdev->rst);
        udelay(10);
 
@@ -84,7 +89,13 @@ nvkm_device_tegra_power_down(struct nvkm_device_tegra *tdev)
        clk_disable_unprepare(tdev->clk);
        udelay(10);
 
-       return regulator_disable(tdev->vdd);
+       if (tdev->vdd) {
+               ret = regulator_disable(tdev->vdd);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
 }
 
 static void
@@ -264,10 +275,12 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
        tdev->func = func;
        tdev->pdev = pdev;
 
-       tdev->vdd = devm_regulator_get(&pdev->dev, "vdd");
-       if (IS_ERR(tdev->vdd)) {
-               ret = PTR_ERR(tdev->vdd);
-               goto free;
+       if (func->require_vdd) {
+               tdev->vdd = devm_regulator_get(&pdev->dev, "vdd");
+               if (IS_ERR(tdev->vdd)) {
+                       ret = PTR_ERR(tdev->vdd);
+                       goto free;
+               }
        }
 
        tdev->rst = devm_reset_control_get(&pdev->dev, "gpu");
index 98651a43bc12fe5bec383eb88fee6b228e7f1e42..64e51838edf857733a54736b9a95aeb772d037d9 100644 (file)
@@ -14,6 +14,7 @@ nvkm-y += nvkm/engine/fifo/gm107.o
 nvkm-y += nvkm/engine/fifo/gm200.o
 nvkm-y += nvkm/engine/fifo/gm20b.o
 nvkm-y += nvkm/engine/fifo/gp100.o
+nvkm-y += nvkm/engine/fifo/gp10b.o
 
 nvkm-y += nvkm/engine/fifo/chan.o
 nvkm-y += nvkm/engine/fifo/channv50.o
index 679f3ec311e9bf2558f33ceee7e4a26ca33031f6..44bff98d672519eb8778bc879faa98fe74c4e786 100644 (file)
@@ -83,4 +83,5 @@ extern const struct nvkm_enum gk104_fifo_fault_hubclient[];
 extern const struct nvkm_enum gk104_fifo_fault_gpcclient[];
 
 extern const struct nvkm_enum gm107_fifo_fault_engine[];
+extern const struct nvkm_enum gp100_fifo_fault_engine[];
 #endif
index b2635aea9f6e3f260040974957eeadf7b072908e..41f16cf5a918c06e13338c2d38bd0120091023ce 100644 (file)
@@ -24,7 +24,7 @@
 #include "gk104.h"
 #include "changk104.h"
 
-static const struct nvkm_enum
+const struct nvkm_enum
 gp100_fifo_fault_engine[] = {
        { 0x01, "DISPLAY" },
        { 0x03, "IFB", NULL, NVKM_ENGINE_IFB },
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gp10b.c
new file mode 100644 (file)
index 0000000..4af96c3
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#include "gk104.h"
+#include "changk104.h"
+
+static const struct gk104_fifo_func
+gp10b_fifo = {
+       .fault.engine = gp100_fifo_fault_engine,
+       .fault.reason = gk104_fifo_fault_reason,
+       .fault.hubclient = gk104_fifo_fault_hubclient,
+       .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .chan = {
+               &gp100_fifo_gpfifo_oclass,
+               NULL
+       },
+};
+
+int
+gp10b_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo)
+{
+       return gk104_fifo_new_(&gp10b_fifo, device, index, 512, pfifo);
+}
index 2938ad5aca40e472d10bc101e98584fecbac3ec7..8a22558b7b5298a99bb3113805b376243e71dfbb 100644 (file)
@@ -33,6 +33,8 @@ nvkm-y += nvkm/engine/gr/gm200.o
 nvkm-y += nvkm/engine/gr/gm20b.o
 nvkm-y += nvkm/engine/gr/gp100.o
 nvkm-y += nvkm/engine/gr/gp102.o
+nvkm-y += nvkm/engine/gr/gp107.o
+nvkm-y += nvkm/engine/gr/gp10b.o
 
 nvkm-y += nvkm/engine/gr/ctxnv40.o
 nvkm-y += nvkm/engine/gr/ctxnv50.o
@@ -52,3 +54,4 @@ nvkm-y += nvkm/engine/gr/ctxgm200.o
 nvkm-y += nvkm/engine/gr/ctxgm20b.o
 nvkm-y += nvkm/engine/gr/ctxgp100.o
 nvkm-y += nvkm/engine/gr/ctxgp102.o
+nvkm-y += nvkm/engine/gr/ctxgp107.o
index 0ae032fa2909ce84bd9e751a785dc0800874adfb..017180d147cf55b9e341d29446e0d6d6c888eb47 100644 (file)
@@ -106,6 +106,9 @@ void gp100_grctx_generate_main(struct gf100_gr *, struct gf100_grctx *);
 void gp100_grctx_generate_pagepool(struct gf100_grctx *);
 
 extern const struct gf100_grctx_func gp102_grctx;
+void gp102_grctx_generate_attrib(struct gf100_grctx *);
+
+extern const struct gf100_grctx_func gp107_grctx;
 
 /* context init value lists */
 
index ee26d64af73a8d56f372df018bd95b7cde620c61..80b7ab0bee3a0dcd03494954482b99b25d93f683 100644 (file)
@@ -29,7 +29,7 @@
  * PGRAPH context implementation
  ******************************************************************************/
 
-static void
+void
 gp102_grctx_generate_attrib(struct gf100_grctx *info)
 {
        struct gf100_gr *gr = info->gr;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgp107.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgp107.c
new file mode 100644 (file)
index 0000000..8da91a0
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2017 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs <bskeggs@redhat.com>
+ */
+#include "ctxgf100.h"
+
+#include <subdev/fb.h>
+
+/*******************************************************************************
+ * PGRAPH context implementation
+ ******************************************************************************/
+
+const struct gf100_grctx_func
+gp107_grctx = {
+       .main = gp100_grctx_generate_main,
+       .unkn = gk104_grctx_generate_unkn,
+       .bundle = gm107_grctx_generate_bundle,
+       .bundle_size = 0x3000,
+       .bundle_min_gpm_fifo_depth = 0x180,
+       .bundle_token_limit = 0x300,
+       .pagepool = gp100_grctx_generate_pagepool,
+       .pagepool_size = 0x20000,
+       .attrib = gp102_grctx_generate_attrib,
+       .attrib_nr_max = 0x15de,
+       .attrib_nr = 0x540,
+       .alpha_nr_max = 0xc00,
+       .alpha_nr = 0x800,
+};
index a4410ef19db53f1ab783862171447ca2e38d0489..99689f4de502d66b174825afc922a2fc3d397401 100644 (file)
@@ -1463,25 +1463,27 @@ gf100_gr_init_ctxctl_ext(struct gf100_gr *gr)
        struct nvkm_subdev *subdev = &gr->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        struct nvkm_secboot *sb = device->secboot;
-       int ret = 0;
+       u32 secboot_mask = 0;
 
        /* load fuc microcode */
        nvkm_mc_unk260(device, 0);
 
        /* securely-managed falcons must be reset using secure boot */
        if (nvkm_secboot_is_managed(sb, NVKM_SECBOOT_FALCON_FECS))
-               ret = nvkm_secboot_reset(sb, NVKM_SECBOOT_FALCON_FECS);
+               secboot_mask |= BIT(NVKM_SECBOOT_FALCON_FECS);
        else
                gf100_gr_init_fw(gr->fecs, &gr->fuc409c, &gr->fuc409d);
-       if (ret)
-               return ret;
 
        if (nvkm_secboot_is_managed(sb, NVKM_SECBOOT_FALCON_GPCCS))
-               ret = nvkm_secboot_reset(sb, NVKM_SECBOOT_FALCON_GPCCS);
+               secboot_mask |= BIT(NVKM_SECBOOT_FALCON_GPCCS);
        else
                gf100_gr_init_fw(gr->gpccs, &gr->fuc41ac, &gr->fuc41ad);
-       if (ret)
-               return ret;
+
+       if (secboot_mask != 0) {
+               int ret = nvkm_secboot_reset(sb, secboot_mask);
+               if (ret)
+                       return ret;
+       }
 
        nvkm_mc_unk260(device, 1);
 
index 1d2101af2a87b64c33e1baa7d764fb22e07b6456..a36e45a4a635ce033995fbcfc1d538f713f6d6d0 100644 (file)
@@ -125,6 +125,7 @@ struct gf100_gr_func {
        void (*init_rop_active_fbps)(struct gf100_gr *);
        void (*init_ppc_exceptions)(struct gf100_gr *);
        void (*init_swdx_pes_mask)(struct gf100_gr *);
+       void (*init_num_active_ltcs)(struct gf100_gr *);
        void (*set_hww_esr_report_mask)(struct gf100_gr *);
        const struct gf100_gr_pack *mmio;
        struct {
@@ -301,4 +302,8 @@ extern const struct gf100_gr_init gm107_gr_init_cbm_0[];
 void gm107_gr_init_bios(struct gf100_gr *);
 
 void gm200_gr_init_gpc_mmu(struct gf100_gr *);
+
+void gp100_gr_init_num_active_ltcs(struct gf100_gr *gr);
+
+void gp102_gr_init_swdx_pes_mask(struct gf100_gr *);
 #endif
index 94ed7debb714e2f5cf936a7fcd4a7629bcb6c0b7..867a5f7cc5bce3ee447ac8bc78f5b051d7626748 100644 (file)
@@ -40,6 +40,15 @@ gp100_gr_init_rop_active_fbps(struct gf100_gr *gr)
        nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */
 }
 
+void
+gp100_gr_init_num_active_ltcs(struct gf100_gr *gr)
+{
+       struct nvkm_device *device = gr->base.engine.subdev.device;
+
+       nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800));
+       nvkm_wr32(device, GPC_BCAST(0x033c), nvkm_rd32(device, 0x100804));
+}
+
 int
 gp100_gr_init(struct gf100_gr *gr)
 {
@@ -81,8 +90,7 @@ gp100_gr_init(struct gf100_gr *gr)
        }
 
        nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918);
-       nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800));
-       nvkm_wr32(device, GPC_BCAST(0x033c), nvkm_rd32(device, 0x100804));
+       gr->func->init_num_active_ltcs(gr);
 
        gr->func->init_rop_active_fbps(gr);
        if (gr->func->init_swdx_pes_mask)
@@ -154,6 +162,7 @@ gp100_gr = {
        .init_gpc_mmu = gm200_gr_init_gpc_mmu,
        .init_rop_active_fbps = gp100_gr_init_rop_active_fbps,
        .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
+       .init_num_active_ltcs = gp100_gr_init_num_active_ltcs,
        .rops = gm200_gr_rops,
        .ppc_nr = 2,
        .grctx = &gp100_grctx,
index 1d5117a16299da5a87e93da0c5a18f8767c7ffbd..61e3a0b0855950bf6f2970b9828f079b21693d14 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <nvif/class.h>
 
-static void
+void
 gp102_gr_init_swdx_pes_mask(struct gf100_gr *gr)
 {
        struct nvkm_device *device = gr->base.engine.subdev.device;
@@ -47,6 +47,7 @@ gp102_gr = {
        .init_rop_active_fbps = gp100_gr_init_rop_active_fbps,
        .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
        .init_swdx_pes_mask = gp102_gr_init_swdx_pes_mask,
+       .init_num_active_ltcs = gp100_gr_init_num_active_ltcs,
        .rops = gm200_gr_rops,
        .ppc_nr = 3,
        .grctx = &gp102_grctx,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gp107.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gp107.c
new file mode 100644 (file)
index 0000000..f727232
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2017 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs <bskeggs@redhat.com>
+ */
+#include "gf100.h"
+#include "ctxgf100.h"
+
+#include <nvif/class.h>
+
+static const struct gf100_gr_func
+gp107_gr = {
+       .init = gp100_gr_init,
+       .init_gpc_mmu = gm200_gr_init_gpc_mmu,
+       .init_rop_active_fbps = gp100_gr_init_rop_active_fbps,
+       .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
+       .init_swdx_pes_mask = gp102_gr_init_swdx_pes_mask,
+       .init_num_active_ltcs = gp100_gr_init_num_active_ltcs,
+       .rops = gm200_gr_rops,
+       .ppc_nr = 1,
+       .grctx = &gp107_grctx,
+       .sclass = {
+               { -1, -1, FERMI_TWOD_A },
+               { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
+               { -1, -1, PASCAL_B, &gf100_fermi },
+               { -1, -1, PASCAL_COMPUTE_B },
+               {}
+       }
+};
+
+int
+gp107_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
+{
+       return gm200_gr_new_(&gp107_gr, device, index, pgr);
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gp10b.c
new file mode 100644 (file)
index 0000000..5f3d161
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "gf100.h"
+#include "ctxgf100.h"
+
+#include <nvif/class.h>
+
+static void
+gp10b_gr_init_num_active_ltcs(struct gf100_gr *gr)
+{
+       struct nvkm_device *device = gr->base.engine.subdev.device;
+
+       nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800));
+}
+
+static const struct gf100_gr_func
+gp10b_gr = {
+       .init = gp100_gr_init,
+       .init_gpc_mmu = gm200_gr_init_gpc_mmu,
+       .init_rop_active_fbps = gp100_gr_init_rop_active_fbps,
+       .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
+       .init_num_active_ltcs = gp10b_gr_init_num_active_ltcs,
+       .rops = gm200_gr_rops,
+       .ppc_nr = 1,
+       .grctx = &gp102_grctx,
+       .sclass = {
+               { -1, -1, FERMI_TWOD_A },
+               { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
+               { -1, -1, PASCAL_A, &gf100_fermi },
+               { -1, -1, PASCAL_COMPUTE_A },
+               {}
+       }
+};
+
+int
+gp10b_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
+{
+       return gm200_gr_new_(&gp10b_gr, device, index, pgr);
+}
index 003ac915eaadad44c5b0ad2c1bbab9d18377596e..8a8895246d26a23be65eb6fb29cbb001f71f728b 100644 (file)
@@ -198,7 +198,7 @@ nv31_mpeg_intr(struct nvkm_engine *engine)
                }
 
                if (type == 0x00000010) {
-                       if (!nv31_mpeg_mthd(mpeg, mthd, data))
+                       if (nv31_mpeg_mthd(mpeg, mthd, data))
                                show &= ~0x01000000;
                }
        }
index e536f37e24b0c75fbf7882eccae37c5b1d0aeae8..c3cf02ed468ea1ccf6212a5e9c42dbee00fa612e 100644 (file)
@@ -172,7 +172,7 @@ nv44_mpeg_intr(struct nvkm_engine *engine)
                }
 
                if (type == 0x00000010) {
-                       if (!nv44_mpeg_mthd(subdev->device, mthd, data))
+                       if (nv44_mpeg_mthd(subdev->device, mthd, data))
                                show &= ~0x01000000;
                }
        }
index 982efedb4b13e576a3bf2608cda91e1a74cb5f24..d45d7947a964a3399d983b234c685a8c335f63f1 100644 (file)
@@ -463,26 +463,49 @@ nvkm_msgqueue_write_cmdline(struct nvkm_msgqueue *queue, void *buf)
 }
 
 int
-nvkm_msgqueue_acr_boot_falcon(struct nvkm_msgqueue *queue, enum nvkm_secboot_falcon falcon)
+nvkm_msgqueue_acr_boot_falcons(struct nvkm_msgqueue *queue,
+                              unsigned long falcon_mask)
 {
-       if (!queue || !queue->func->acr_func || !queue->func->acr_func->boot_falcon)
+       unsigned long falcon;
+
+       if (!queue || !queue->func->acr_func)
                return -ENODEV;
 
-       return queue->func->acr_func->boot_falcon(queue, falcon);
+       /* Does the firmware support booting multiple falcons? */
+       if (queue->func->acr_func->boot_multiple_falcons)
+               return queue->func->acr_func->boot_multiple_falcons(queue,
+                                                                  falcon_mask);
+
+       /* Else boot all requested falcons individually */
+       if (!queue->func->acr_func->boot_falcon)
+               return -ENODEV;
+
+       for_each_set_bit(falcon, &falcon_mask, NVKM_SECBOOT_FALCON_END) {
+               int ret = queue->func->acr_func->boot_falcon(queue, falcon);
+
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
 }
 
 int
-nvkm_msgqueue_new(u32 version, struct nvkm_falcon *falcon, struct nvkm_msgqueue **queue)
+nvkm_msgqueue_new(u32 version, struct nvkm_falcon *falcon,
+                 const struct nvkm_secboot *sb, struct nvkm_msgqueue **queue)
 {
        const struct nvkm_subdev *subdev = falcon->owner;
        int ret = -EINVAL;
 
        switch (version) {
        case 0x0137c63d:
-               ret = msgqueue_0137c63d_new(falcon, queue);
+               ret = msgqueue_0137c63d_new(falcon, sb, queue);
+               break;
+       case 0x0137bca5:
+               ret = msgqueue_0137bca5_new(falcon, sb, queue);
                break;
        case 0x0148cdec:
-               ret = msgqueue_0148cdec_new(falcon, queue);
+               ret = msgqueue_0148cdec_new(falcon, sb, queue);
                break;
        default:
                nvkm_error(subdev, "unhandled firmware version 0x%08x\n",
index f37afe963d3eeb556980db4d7c8dc6afda9dc248..13b54f8d8e049e5edfd052519306f3a17cc2d32a 100644 (file)
@@ -101,9 +101,11 @@ struct nvkm_msgqueue_init_func {
  * struct nvkm_msgqueue_acr_func - msgqueue functions related to ACR
  *
  * @boot_falcon:       build and send the command to reset a given falcon
+ * @boot_multiple_falcons: build and send the command to reset several falcons
  */
 struct nvkm_msgqueue_acr_func {
        int (*boot_falcon)(struct nvkm_msgqueue *, enum nvkm_secboot_falcon);
+       int (*boot_multiple_falcons)(struct nvkm_msgqueue *, unsigned long);
 };
 
 struct nvkm_msgqueue_func {
@@ -201,7 +203,11 @@ int nvkm_msgqueue_post(struct nvkm_msgqueue *, enum msgqueue_msg_priority,
 void nvkm_msgqueue_process_msgs(struct nvkm_msgqueue *,
                                struct nvkm_msgqueue_queue *);
 
-int msgqueue_0137c63d_new(struct nvkm_falcon *, struct nvkm_msgqueue **);
-int msgqueue_0148cdec_new(struct nvkm_falcon *, struct nvkm_msgqueue **);
+int msgqueue_0137c63d_new(struct nvkm_falcon *, const struct nvkm_secboot *,
+                         struct nvkm_msgqueue **);
+int msgqueue_0137bca5_new(struct nvkm_falcon *, const struct nvkm_secboot *,
+                         struct nvkm_msgqueue **);
+int msgqueue_0148cdec_new(struct nvkm_falcon *, const struct nvkm_secboot *,
+                         struct nvkm_msgqueue **);
 
 #endif
index bba91207fb18f262c76f89a4f36bc4163150494a..fec0273158f6a7f99499c09a7073ec450e019ee3 100644 (file)
@@ -43,6 +43,15 @@ struct msgqueue_0137c63d {
 #define msgqueue_0137c63d(q) \
        container_of(q, struct msgqueue_0137c63d, base)
 
+struct msgqueue_0137bca5 {
+       struct msgqueue_0137c63d base;
+
+       u64 wpr_addr;
+};
+#define msgqueue_0137bca5(q) \
+       container_of(container_of(q, struct msgqueue_0137c63d, base), \
+                    struct msgqueue_0137bca5, base);
+
 static struct nvkm_msgqueue_queue *
 msgqueue_0137c63d_cmd_queue(struct nvkm_msgqueue *queue,
                            enum msgqueue_msg_priority priority)
@@ -180,6 +189,7 @@ msgqueue_0137c63d_init_func = {
 enum {
        ACR_CMD_INIT_WPR_REGION = 0x00,
        ACR_CMD_BOOTSTRAP_FALCON = 0x01,
+       ACR_CMD_BOOTSTRAP_MULTIPLE_FALCONS = 0x03,
 };
 
 static void
@@ -286,11 +296,81 @@ acr_boot_falcon(struct nvkm_msgqueue *priv, enum nvkm_secboot_falcon falcon)
        return 0;
 }
 
+static void
+acr_boot_multiple_falcons_callback(struct nvkm_msgqueue *priv,
+                                  struct nvkm_msgqueue_hdr *hdr)
+{
+       struct acr_bootstrap_falcon_msg {
+               struct nvkm_msgqueue_msg base;
+
+               u32 falcon_mask;
+       } *msg = (void *)hdr;
+       const struct nvkm_subdev *subdev = priv->falcon->owner;
+       unsigned long falcon_mask = msg->falcon_mask;
+       u32 falcon_id, falcon_treated = 0;
+
+       for_each_set_bit(falcon_id, &falcon_mask, NVKM_SECBOOT_FALCON_END) {
+               nvkm_debug(subdev, "%s booted\n",
+                          nvkm_secboot_falcon_name[falcon_id]);
+               falcon_treated |= BIT(falcon_id);
+       }
+
+       if (falcon_treated != msg->falcon_mask) {
+               nvkm_error(subdev, "in bootstrap falcon callback:\n");
+               nvkm_error(subdev, "invalid falcon mask 0x%x\n",
+                          msg->falcon_mask);
+               return;
+       }
+}
+
+static int
+acr_boot_multiple_falcons(struct nvkm_msgqueue *priv, unsigned long falcon_mask)
+{
+       DECLARE_COMPLETION_ONSTACK(completed);
+       /*
+        * flags      - Flag specifying RESET or no RESET.
+        * falcon id  - Falcon id specifying falcon to bootstrap.
+        */
+       struct {
+               struct nvkm_msgqueue_hdr hdr;
+               u8 cmd_type;
+               u32 flags;
+               u32 falcon_mask;
+               u32 use_va_mask;
+               u32 wpr_lo;
+               u32 wpr_hi;
+       } cmd;
+       struct msgqueue_0137bca5 *queue = msgqueue_0137bca5(priv);
+
+       memset(&cmd, 0, sizeof(cmd));
+
+       cmd.hdr.unit_id = MSGQUEUE_0137C63D_UNIT_ACR;
+       cmd.hdr.size = sizeof(cmd);
+       cmd.cmd_type = ACR_CMD_BOOTSTRAP_MULTIPLE_FALCONS;
+       cmd.flags = ACR_CMD_BOOTSTRAP_FALCON_FLAGS_RESET_YES;
+       cmd.falcon_mask = falcon_mask;
+       cmd.wpr_lo = lower_32_bits(queue->wpr_addr);
+       cmd.wpr_hi = upper_32_bits(queue->wpr_addr);
+       nvkm_msgqueue_post(priv, MSGQUEUE_MSG_PRIORITY_HIGH, &cmd.hdr,
+                       acr_boot_multiple_falcons_callback, &completed, true);
+
+       if (!wait_for_completion_timeout(&completed, msecs_to_jiffies(1000)))
+               return -ETIMEDOUT;
+
+       return 0;
+}
+
 static const struct nvkm_msgqueue_acr_func
 msgqueue_0137c63d_acr_func = {
        .boot_falcon = acr_boot_falcon,
 };
 
+static const struct nvkm_msgqueue_acr_func
+msgqueue_0137bca5_acr_func = {
+       .boot_falcon = acr_boot_falcon,
+       .boot_multiple_falcons = acr_boot_multiple_falcons,
+};
+
 static void
 msgqueue_0137c63d_dtor(struct nvkm_msgqueue *queue)
 {
@@ -307,7 +387,8 @@ msgqueue_0137c63d_func = {
 };
 
 int
-msgqueue_0137c63d_new(struct nvkm_falcon *falcon, struct nvkm_msgqueue **queue)
+msgqueue_0137c63d_new(struct nvkm_falcon *falcon, const struct nvkm_secboot *sb,
+                     struct nvkm_msgqueue **queue)
 {
        struct msgqueue_0137c63d *ret;
 
@@ -321,3 +402,35 @@ msgqueue_0137c63d_new(struct nvkm_falcon *falcon, struct nvkm_msgqueue **queue)
 
        return 0;
 }
+
+static const struct nvkm_msgqueue_func
+msgqueue_0137bca5_func = {
+       .init_func = &msgqueue_0137c63d_init_func,
+       .acr_func = &msgqueue_0137bca5_acr_func,
+       .cmd_queue = msgqueue_0137c63d_cmd_queue,
+       .recv = msgqueue_0137c63d_process_msgs,
+       .dtor = msgqueue_0137c63d_dtor,
+};
+
+int
+msgqueue_0137bca5_new(struct nvkm_falcon *falcon, const struct nvkm_secboot *sb,
+                     struct nvkm_msgqueue **queue)
+{
+       struct msgqueue_0137bca5 *ret;
+
+       ret = kzalloc(sizeof(*ret), GFP_KERNEL);
+       if (!ret)
+               return -ENOMEM;
+
+       *queue = &ret->base.base;
+
+       /*
+        * FIXME this must be set to the address of a *GPU* mapping within the
+        * ACR address space!
+        */
+       /* ret->wpr_addr = sb->wpr_addr; */
+
+       nvkm_msgqueue_ctor(&msgqueue_0137bca5_func, falcon, &ret->base.base);
+
+       return 0;
+}
index ed5d0da4f4e92147f0ec624712d4cf1f8655356c..9424803b9ef499d9c15b4102e6789f277863319d 100644 (file)
@@ -247,7 +247,8 @@ msgqueue_0148cdec_func = {
 };
 
 int
-msgqueue_0148cdec_new(struct nvkm_falcon *falcon, struct nvkm_msgqueue **queue)
+msgqueue_0148cdec_new(struct nvkm_falcon *falcon, const struct nvkm_secboot *sb,
+                     struct nvkm_msgqueue **queue)
 {
        struct msgqueue_0148cdec *ret;
 
index 1c5e5ba487a8b68cfbb74c6c4e4c423c1e6d8bef..2571530e82f1c388a0efa24e0ec3d3ccb6df8451 100644 (file)
@@ -28,6 +28,7 @@ nvkm-y += nvkm/subdev/fb/gm200.o
 nvkm-y += nvkm/subdev/fb/gm20b.o
 nvkm-y += nvkm/subdev/fb/gp100.o
 nvkm-y += nvkm/subdev/fb/gp102.o
+nvkm-y += nvkm/subdev/fb/gp10b.o
 
 nvkm-y += nvkm/subdev/fb/ram.o
 nvkm-y += nvkm/subdev/fb/ramnv04.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gp10b.c
new file mode 100644 (file)
index 0000000..f2b1fbf
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#include "gf100.h"
+
+static const struct nvkm_fb_func
+gp10b_fb = {
+       .dtor = gf100_fb_dtor,
+       .oneinit = gf100_fb_oneinit,
+       .init = gm200_fb_init,
+       .init_page = gm200_fb_init_page,
+       .intr = gf100_fb_intr,
+       .memtype_valid = gf100_fb_memtype_valid,
+};
+
+int
+gp10b_fb_new(struct nvkm_device *device, int index, struct nvkm_fb **pfb)
+{
+       return gf100_fb_new_(&gp10b_fb, device, index, pfb);
+}
index 77c649723ad7602055752445863ba50653c392c7..4a57defc99b38ae2de923ba830b0c70de9dff24a 100644 (file)
@@ -164,7 +164,7 @@ static int
 nvkm_gpio_fini(struct nvkm_subdev *subdev, bool suspend)
 {
        struct nvkm_gpio *gpio = nvkm_gpio(subdev);
-       u32 mask = (1 << gpio->func->lines) - 1;
+       u32 mask = (1ULL << gpio->func->lines) - 1;
 
        gpio->func->intr_mask(gpio, NVKM_GPIO_TOGGLED, mask, 0);
        gpio->func->intr_stat(gpio, &mask, &mask);
index ad572d3b5466ade5f4d600106f588908949c3cda..7f5883b78efae50de684bd4437a5406eef368de3 100644 (file)
@@ -3,3 +3,4 @@ nvkm-y += nvkm/subdev/ibus/gf117.o
 nvkm-y += nvkm/subdev/ibus/gk104.o
 nvkm-y += nvkm/subdev/ibus/gk20a.o
 nvkm-y += nvkm/subdev/ibus/gm200.o
+nvkm-y += nvkm/subdev/ibus/gp10b.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gp10b.c
new file mode 100644 (file)
index 0000000..39db90a
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#include <subdev/ibus.h>
+
+#include "priv.h"
+
+static int
+gp10b_ibus_init(struct nvkm_subdev *ibus)
+{
+       struct nvkm_device *device = ibus->device;
+
+       nvkm_wr32(device, 0x1200a8, 0x0);
+
+       /* init ring */
+       nvkm_wr32(device, 0x12004c, 0x4);
+       nvkm_wr32(device, 0x122204, 0x2);
+       nvkm_rd32(device, 0x122204);
+
+       /* timeout configuration */
+       nvkm_wr32(device, 0x009080, 0x800186a0);
+
+       return 0;
+}
+
+static const struct nvkm_subdev_func
+gp10b_ibus = {
+       .init = gp10b_ibus_init,
+       .intr = gk104_ibus_intr,
+};
+
+int
+gp10b_ibus_new(struct nvkm_device *device, int index,
+              struct nvkm_subdev **pibus)
+{
+       struct nvkm_subdev *ibus;
+       if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL)))
+               return -ENOMEM;
+       nvkm_subdev_ctor(&gp10b_ibus, device, index, ibus);
+       return 0;
+}
index 9dec58ec3d9f41512a504aef0b246a6f5470cd33..cd5adbec5e574c2bf7fd686ca41b9e59a68fe31c 100644 (file)
@@ -94,7 +94,7 @@ struct gk20a_instmem {
        struct nvkm_instmem base;
 
        /* protects vaddr_* and gk20a_instobj::vaddr* */
-       spinlock_t lock;
+       struct mutex lock;
 
        /* CPU mappings LRU */
        unsigned int vaddr_use;
@@ -184,11 +184,10 @@ gk20a_instobj_acquire_iommu(struct nvkm_memory *memory)
        struct gk20a_instmem *imem = node->base.imem;
        struct nvkm_ltc *ltc = imem->base.subdev.device->ltc;
        const u64 size = nvkm_memory_size(memory);
-       unsigned long flags;
 
        nvkm_ltc_flush(ltc);
 
-       spin_lock_irqsave(&imem->lock, flags);
+       mutex_lock(&imem->lock);
 
        if (node->base.vaddr) {
                if (!node->use_cpt) {
@@ -216,7 +215,7 @@ gk20a_instobj_acquire_iommu(struct nvkm_memory *memory)
 
 out:
        node->use_cpt++;
-       spin_unlock_irqrestore(&imem->lock, flags);
+       mutex_unlock(&imem->lock);
 
        return node->base.vaddr;
 }
@@ -239,9 +238,8 @@ gk20a_instobj_release_iommu(struct nvkm_memory *memory)
        struct gk20a_instobj_iommu *node = gk20a_instobj_iommu(memory);
        struct gk20a_instmem *imem = node->base.imem;
        struct nvkm_ltc *ltc = imem->base.subdev.device->ltc;
-       unsigned long flags;
 
-       spin_lock_irqsave(&imem->lock, flags);
+       mutex_lock(&imem->lock);
 
        /* we should at least have one user to release... */
        if (WARN_ON(node->use_cpt == 0))
@@ -252,7 +250,7 @@ gk20a_instobj_release_iommu(struct nvkm_memory *memory)
                list_add_tail(&node->vaddr_node, &imem->vaddr_lru);
 
 out:
-       spin_unlock_irqrestore(&imem->lock, flags);
+       mutex_unlock(&imem->lock);
 
        wmb();
        nvkm_ltc_invalidate(ltc);
@@ -306,19 +304,18 @@ gk20a_instobj_dtor_iommu(struct nvkm_memory *memory)
        struct gk20a_instmem *imem = node->base.imem;
        struct device *dev = imem->base.subdev.device->dev;
        struct nvkm_mm_node *r = node->base.mem.mem;
-       unsigned long flags;
        int i;
 
        if (unlikely(!r))
                goto out;
 
-       spin_lock_irqsave(&imem->lock, flags);
+       mutex_lock(&imem->lock);
 
        /* vaddr has already been recycled */
        if (node->base.vaddr)
                gk20a_instobj_iommu_recycle_vaddr(node);
 
-       spin_unlock_irqrestore(&imem->lock, flags);
+       mutex_unlock(&imem->lock);
 
        /* clear IOMMU bit to unmap pages */
        r->offset &= ~BIT(imem->iommu_bit - imem->iommu_pgshift);
@@ -571,7 +568,7 @@ gk20a_instmem_new(struct nvkm_device *device, int index,
        if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
                return -ENOMEM;
        nvkm_instmem_ctor(&gk20a_instmem, device, index, &imem->base);
-       spin_lock_init(&imem->lock);
+       mutex_init(&imem->lock);
        *pimem = &imem->base;
 
        /* do not allow more than 1MB of CPU-mapped instmem */
index 12943f92c20608e64f8f4b5a90921c35506bcce2..2befbe36dc28dcf02757dd5f0de718f392046167 100644 (file)
@@ -11,3 +11,4 @@ nvkm-y += nvkm/subdev/mc/gf100.o
 nvkm-y += nvkm/subdev/mc/gk104.o
 nvkm-y += nvkm/subdev/mc/gk20a.o
 nvkm-y += nvkm/subdev/mc/gp100.o
+nvkm-y += nvkm/subdev/mc/gp10b.o
index 4d22f4abd6deeea71c830efbd18415ee3a172dd6..7321ad3758c3b292e7486cf30e9905706d04073e 100644 (file)
@@ -42,7 +42,7 @@ gp100_mc_intr_update(struct gp100_mc *mc)
        }
 }
 
-static void
+void
 gp100_mc_intr_unarm(struct nvkm_mc *base)
 {
        struct gp100_mc *mc = gp100_mc(base);
@@ -53,7 +53,7 @@ gp100_mc_intr_unarm(struct nvkm_mc *base)
        spin_unlock_irqrestore(&mc->lock, flags);
 }
 
-static void
+void
 gp100_mc_intr_rearm(struct nvkm_mc *base)
 {
        struct gp100_mc *mc = gp100_mc(base);
@@ -64,7 +64,7 @@ gp100_mc_intr_rearm(struct nvkm_mc *base)
        spin_unlock_irqrestore(&mc->lock, flags);
 }
 
-static void
+void
 gp100_mc_intr_mask(struct nvkm_mc *base, u32 mask, u32 intr)
 {
        struct gp100_mc *mc = gp100_mc(base);
@@ -87,13 +87,14 @@ gp100_mc = {
 };
 
 int
-gp100_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc)
+gp100_mc_new_(const struct nvkm_mc_func *func, struct nvkm_device *device,
+             int index, struct nvkm_mc **pmc)
 {
        struct gp100_mc *mc;
 
        if (!(mc = kzalloc(sizeof(*mc), GFP_KERNEL)))
                return -ENOMEM;
-       nvkm_mc_ctor(&gp100_mc, device, index, &mc->base);
+       nvkm_mc_ctor(func, device, index, &mc->base);
        *pmc = &mc->base;
 
        spin_lock_init(&mc->lock);
@@ -101,3 +102,9 @@ gp100_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc)
        mc->mask = 0x7fffffff;
        return 0;
 }
+
+int
+gp100_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc)
+{
+       return gp100_mc_new_(&gp100_mc, device, index, pmc);
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gp10b.c
new file mode 100644 (file)
index 0000000..2283e3b
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "priv.h"
+
+void
+gp10b_mc_init(struct nvkm_mc *mc)
+{
+       struct nvkm_device *device = mc->subdev.device;
+       nvkm_wr32(device, 0x000200, 0xffffffff); /* everything on */
+       nvkm_wr32(device, 0x00020c, 0xffffffff); /* everything out of ELPG */
+}
+
+static const struct nvkm_mc_func
+gp10b_mc = {
+       .init = gp10b_mc_init,
+       .intr = gk104_mc_intr,
+       .intr_unarm = gp100_mc_intr_unarm,
+       .intr_rearm = gp100_mc_intr_rearm,
+       .intr_mask = gp100_mc_intr_mask,
+       .intr_stat = gf100_mc_intr_stat,
+       .reset = gk104_mc_reset,
+};
+
+int
+gp10b_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc)
+{
+       return gp100_mc_new_(&gp10b_mc, device, index, pmc);
+}
index 4f0576a06d2454489ffdcce6d3b601a286653a98..3be4126441e469ba4ef548c607208ed6dbff7631 100644 (file)
@@ -41,12 +41,18 @@ extern const struct nvkm_mc_map nv17_mc_reset[];
 void nv44_mc_init(struct nvkm_mc *);
 
 void nv50_mc_init(struct nvkm_mc *);
+void gk104_mc_init(struct nvkm_mc *);
 
 void gf100_mc_intr_unarm(struct nvkm_mc *);
 void gf100_mc_intr_rearm(struct nvkm_mc *);
 void gf100_mc_intr_mask(struct nvkm_mc *, u32, u32);
 u32 gf100_mc_intr_stat(struct nvkm_mc *);
 void gf100_mc_unk260(struct nvkm_mc *, u32);
+void gp100_mc_intr_unarm(struct nvkm_mc *);
+void gp100_mc_intr_rearm(struct nvkm_mc *);
+void gp100_mc_intr_mask(struct nvkm_mc *, u32, u32);
+int gp100_mc_new_(const struct nvkm_mc_func *, struct nvkm_device *, int,
+                 struct nvkm_mc **);
 
 extern const struct nvkm_mc_map gk104_mc_intr[];
 extern const struct nvkm_mc_map gk104_mc_reset[];
index ac7f50ae53c6dbc0c402f3a862f19f2c26b38b71..e698f483652164f844e0f79bb8bb2a47dd694d2a 100644 (file)
@@ -11,3 +11,4 @@ nvkm-y += nvkm/subdev/secboot/acr_r375.o
 nvkm-y += nvkm/subdev/secboot/gm200.o
 nvkm-y += nvkm/subdev/secboot/gm20b.o
 nvkm-y += nvkm/subdev/secboot/gp102.o
+nvkm-y += nvkm/subdev/secboot/gp10b.o
index 93d804652d44e9b709c1afeedb77240431ec421f..b615fc81aca467f8451595d6f0365e768b1d10ca 100644 (file)
@@ -39,8 +39,7 @@ struct nvkm_acr_func {
        int (*fini)(struct nvkm_acr *, struct nvkm_secboot *, bool);
        int (*load)(struct nvkm_acr *, struct nvkm_falcon *,
                    struct nvkm_gpuobj *, u64);
-       int (*reset)(struct nvkm_acr *, struct nvkm_secboot *,
-                    enum nvkm_secboot_falcon);
+       int (*reset)(struct nvkm_acr *, struct nvkm_secboot *, unsigned long);
 };
 
 /**
index 993a38eb3ed5a8b0d8bd346714ba24cad228f7cc..a721354249ce68420d467990e0963a206fa9d2d3 100644 (file)
@@ -26,8 +26,6 @@
 #include <core/gpuobj.h>
 #include <core/firmware.h>
 #include <engine/falcon.h>
-#include <subdev/mc.h>
-#include <subdev/timer.h>
 #include <subdev/pmu.h>
 #include <core/msgqueue.h>
 #include <engine/sec2.h>
@@ -241,6 +239,7 @@ struct ls_ucode_img_r352 {
  */
 struct ls_ucode_img *
 acr_r352_ls_ucode_img_load(const struct acr_r352 *acr,
+                          const struct nvkm_secboot *sb,
                           enum nvkm_secboot_falcon falcon_id)
 {
        const struct nvkm_subdev *subdev = acr->base.subdev;
@@ -253,7 +252,7 @@ acr_r352_ls_ucode_img_load(const struct acr_r352 *acr,
 
        img->base.falcon_id = falcon_id;
 
-       ret = acr->func->ls_func[falcon_id]->load(subdev, &img->base);
+       ret = acr->func->ls_func[falcon_id]->load(sb, &img->base);
 
        if (ret) {
                kfree(img->base.ucode_data);
@@ -462,12 +461,14 @@ acr_r352_ls_write_wpr(struct acr_r352 *acr, struct list_head *imgs,
  * will be copied into the WPR region by the HS firmware.
  */
 static int
-acr_r352_prepare_ls_blob(struct acr_r352 *acr, u64 wpr_addr, u32 wpr_size)
+acr_r352_prepare_ls_blob(struct acr_r352 *acr, struct nvkm_secboot *sb)
 {
        const struct nvkm_subdev *subdev = acr->base.subdev;
        struct list_head imgs;
        struct ls_ucode_img *img, *t;
        unsigned long managed_falcons = acr->base.managed_falcons;
+       u64 wpr_addr = sb->wpr_addr;
+       u32 wpr_size = sb->wpr_size;
        int managed_count = 0;
        u32 image_wpr_size, ls_blob_size;
        int falcon_id;
@@ -479,7 +480,7 @@ acr_r352_prepare_ls_blob(struct acr_r352 *acr, u64 wpr_addr, u32 wpr_size)
        for_each_set_bit(falcon_id, &managed_falcons, NVKM_SECBOOT_FALCON_END) {
                struct ls_ucode_img *img;
 
-               img = acr->func->ls_ucode_img_load(acr, falcon_id);
+               img = acr->func->ls_ucode_img_load(acr, sb, falcon_id);
                if (IS_ERR(img)) {
                        if (acr->base.optional_falcons & BIT(falcon_id)) {
                                managed_falcons &= ~BIT(falcon_id);
@@ -704,7 +705,7 @@ acr_r352_load_blobs(struct acr_r352 *acr, struct nvkm_secboot *sb)
                return 0;
 
        /* Load and prepare the managed falcon's firmwares */
-       ret = acr_r352_prepare_ls_blob(acr, sb->wpr_addr, sb->wpr_size);
+       ret = acr_r352_prepare_ls_blob(acr, sb);
        if (ret)
                return ret;
 
@@ -882,7 +883,6 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb)
 {
        const struct nvkm_subdev *subdev = &sb->subdev;
        unsigned long managed_falcons = acr->base.managed_falcons;
-       u32 reg;
        int falcon_id;
        int ret;
 
@@ -917,54 +917,13 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb)
                const struct acr_r352_ls_func *func =
                                                  acr->func->ls_func[falcon_id];
 
-               if (func->post_run)
-                       func->post_run(&acr->base, sb);
-       }
-
-       /* Re-start ourselves if we are managed */
-       if (!nvkm_secboot_is_managed(sb, acr->base.boot_falcon))
-               return 0;
-
-       /* Enable interrupts */
-       nvkm_falcon_wr32(sb->boot_falcon, 0x10, 0xff);
-       nvkm_mc_intr_mask(subdev->device, sb->boot_falcon->owner->index, true);
-
-       /* Start LS firmware on boot falcon */
-       nvkm_falcon_start(sb->boot_falcon);
-
-       /*
-        * There is a bug where the LS firmware sometimes require to be started
-        * twice (this happens only on SEC). Detect and workaround that
-        * condition.
-        *
-        * Once started, the falcon will end up in STOPPED condition (bit 5)
-        * if successful, or in HALT condition (bit 4) if not.
-        */
-       nvkm_msec(subdev->device, 1,
-                 if ((reg = nvkm_rd32(subdev->device,
-                                      sb->boot_falcon->addr + 0x100)
-                      & 0x30) != 0)
-                         break;
-       );
-       if (reg & BIT(4)) {
-               nvkm_debug(subdev, "applying workaround for start bug...");
-               nvkm_falcon_start(sb->boot_falcon);
-               nvkm_msec(subdev->device, 1,
-                       if ((reg = nvkm_rd32(subdev->device,
-                                            sb->boot_falcon->addr + 0x100)
-                            & 0x30) != 0)
-                               break;
-               );
-               if (reg & BIT(4)) {
-                       nvkm_error(subdev, "%s failed to start\n",
-                              nvkm_secboot_falcon_name[acr->base.boot_falcon]);
-                       return -EINVAL;
+               if (func->post_run) {
+                       ret = func->post_run(&acr->base, sb);
+                       if (ret)
+                               return ret;
                }
        }
 
-       nvkm_debug(subdev, "%s started\n",
-                  nvkm_secboot_falcon_name[acr->base.boot_falcon]);
-
        return 0;
 }
 
@@ -976,15 +935,16 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb)
  */
 static int
 acr_r352_reset_nopmu(struct acr_r352 *acr, struct nvkm_secboot *sb,
-                    enum nvkm_secboot_falcon falcon)
+                    unsigned long falcon_mask)
 {
+       int falcon;
        int ret;
 
        /*
         * Perform secure boot each time we are called on FECS. Since only FECS
         * and GPCCS are managed and started together, this ought to be safe.
         */
-       if (falcon != NVKM_SECBOOT_FALCON_FECS)
+       if (!(falcon_mask & BIT(NVKM_SECBOOT_FALCON_FECS)))
                goto end;
 
        ret = acr_r352_shutdown(acr, sb);
@@ -996,7 +956,9 @@ acr_r352_reset_nopmu(struct acr_r352 *acr, struct nvkm_secboot *sb,
                return ret;
 
 end:
-       acr->falcon_state[falcon] = RESET;
+       for_each_set_bit(falcon, &falcon_mask, NVKM_SECBOOT_FALCON_END) {
+               acr->falcon_state[falcon] = RESET;
+       }
        return 0;
 }
 
@@ -1009,11 +971,11 @@ end:
  */
 static int
 acr_r352_reset(struct nvkm_acr *_acr, struct nvkm_secboot *sb,
-              enum nvkm_secboot_falcon falcon)
+              unsigned long falcon_mask)
 {
        struct acr_r352 *acr = acr_r352(_acr);
        struct nvkm_msgqueue *queue;
-       const char *fname = nvkm_secboot_falcon_name[falcon];
+       int falcon;
        bool wpr_already_set = sb->wpr_set;
        int ret;
 
@@ -1026,7 +988,7 @@ acr_r352_reset(struct nvkm_acr *_acr, struct nvkm_secboot *sb,
        if (!nvkm_secboot_is_managed(sb, _acr->boot_falcon)) {
                /* Redo secure boot entirely if it was already done */
                if (wpr_already_set)
-                       return acr_r352_reset_nopmu(acr, sb, falcon);
+                       return acr_r352_reset_nopmu(acr, sb, falcon_mask);
                /* Else return the result of the initial invokation */
                else
                        return ret;
@@ -1044,13 +1006,15 @@ acr_r352_reset(struct nvkm_acr *_acr, struct nvkm_secboot *sb,
        }
 
        /* Otherwise just ask the LS firmware to reset the falcon */
-       nvkm_debug(&sb->subdev, "resetting %s falcon\n", fname);
-       ret = nvkm_msgqueue_acr_boot_falcon(queue, falcon);
+       for_each_set_bit(falcon, &falcon_mask, NVKM_SECBOOT_FALCON_END)
+               nvkm_debug(&sb->subdev, "resetting %s falcon\n",
+                          nvkm_secboot_falcon_name[falcon]);
+       ret = nvkm_msgqueue_acr_boot_falcons(queue, falcon_mask);
        if (ret) {
-               nvkm_error(&sb->subdev, "cannot boot %s falcon\n", fname);
+               nvkm_error(&sb->subdev, "error during falcon reset: %d\n", ret);
                return ret;
        }
-       nvkm_debug(&sb->subdev, "falcon %s reset\n", fname);
+       nvkm_debug(&sb->subdev, "falcon reset done\n");
 
        return 0;
 }
index 6e88520566c9c8d2d7dbd8190d1fa146afba6eb5..3d58ab87156325de7097c51d6820c01b77414ecb 100644 (file)
@@ -57,11 +57,11 @@ hsf_load_header_app_size(const struct hsf_load_header *hdr, u32 app)
  * @lhdr_flags: LS flags
  */
 struct acr_r352_ls_func {
-       int (*load)(const struct nvkm_subdev *, struct ls_ucode_img *);
+       int (*load)(const struct nvkm_secboot *, struct ls_ucode_img *);
        void (*generate_bl_desc)(const struct nvkm_acr *,
                                 const struct ls_ucode_img *, u64, void *);
        u32 bl_desc_size;
-       void (*post_run)(const struct nvkm_acr *, const struct nvkm_secboot *);
+       int (*post_run)(const struct nvkm_acr *, const struct nvkm_secboot *);
        u32 lhdr_flags;
 };
 
@@ -82,6 +82,7 @@ struct acr_r352_func {
        bool shadow_blob;
 
        struct ls_ucode_img *(*ls_ucode_img_load)(const struct acr_r352 *,
+                                                 const struct nvkm_secboot *,
                                                  enum nvkm_secboot_falcon);
        int (*ls_fill_headers)(struct acr_r352 *, struct list_head *);
        int (*ls_write_wpr)(struct acr_r352 *, struct list_head *,
@@ -145,6 +146,7 @@ struct nvkm_acr *acr_r352_new_(const struct acr_r352_func *,
                               enum nvkm_secboot_falcon, unsigned long);
 
 struct ls_ucode_img *acr_r352_ls_ucode_img_load(const struct acr_r352 *,
+                                               const struct nvkm_secboot *,
                                                enum nvkm_secboot_falcon);
 int acr_r352_ls_fill_headers(struct acr_r352 *, struct list_head *);
 int acr_r352_ls_write_wpr(struct acr_r352 *, struct list_head *,
index f860713642f1a64dff0b8b9d60cb1b36976e5400..866877b88797b568f2d604f156ed2ad4118538f3 100644 (file)
@@ -107,6 +107,7 @@ struct ls_ucode_img_r367 {
 
 struct ls_ucode_img *
 acr_r367_ls_ucode_img_load(const struct acr_r352 *acr,
+                          const struct nvkm_secboot *sb,
                           enum nvkm_secboot_falcon falcon_id)
 {
        const struct nvkm_subdev *subdev = acr->base.subdev;
@@ -119,7 +120,7 @@ acr_r367_ls_ucode_img_load(const struct acr_r352 *acr,
 
        img->base.falcon_id = falcon_id;
 
-       ret = acr->func->ls_func[falcon_id]->load(subdev, &img->base);
+       ret = acr->func->ls_func[falcon_id]->load(sb, &img->base);
        if (ret) {
                kfree(img->base.ucode_data);
                kfree(img->base.sig);
index ec6a71ca36be8b0e09367fc1594ddd77194675ad..8bdfb3e5cd1cf888f4d14cc9597755b4611c35cc 100644 (file)
@@ -28,6 +28,7 @@
 void acr_r367_fixup_hs_desc(struct acr_r352 *, struct nvkm_secboot *, void *);
 
 struct ls_ucode_img *acr_r367_ls_ucode_img_load(const struct acr_r352 *,
+                                               const struct nvkm_secboot *,
                                                enum nvkm_secboot_falcon);
 int acr_r367_ls_fill_headers(struct acr_r352 *, struct list_head *);
 int acr_r367_ls_write_wpr(struct acr_r352 *, struct list_head *,
index 5c11e8c5096483d21d31314a99e3041f850f0625..ee29c6c11afd524a10b8d3dc9eeb4fcca37e7d41 100644 (file)
@@ -102,15 +102,15 @@ nvkm_secboot_falcon_name[] = {
  * nvkm_secboot_reset() - reset specified falcon
  */
 int
-nvkm_secboot_reset(struct nvkm_secboot *sb, enum nvkm_secboot_falcon falcon)
+nvkm_secboot_reset(struct nvkm_secboot *sb, unsigned long falcon_mask)
 {
        /* Unmanaged falcon? */
-       if (!(BIT(falcon) & sb->acr->managed_falcons)) {
+       if ((falcon_mask | sb->acr->managed_falcons) != sb->acr->managed_falcons) {
                nvkm_error(&sb->subdev, "cannot reset unmanaged falcon!\n");
                return -EINVAL;
        }
 
-       return sb->acr->func->reset(sb->acr, sb, falcon);
+       return sb->acr->func->reset(sb->acr, sb, falcon_mask);
 }
 
 /**
index 6dc9fc384f244ea39d5c823cbe673d7b819a0e85..c8ab3d76bdef73988118d0006be254b2f3c380c0 100644 (file)
@@ -41,4 +41,7 @@ void *gm200_secboot_dtor(struct nvkm_secboot *);
 int gm200_secboot_run_blob(struct nvkm_secboot *, struct nvkm_gpuobj *,
                           struct nvkm_falcon *);
 
+/* Tegra-only */
+int gm20b_secboot_tegra_read_wpr(struct gm200_secboot *, u32);
+
 #endif
index 29e6f73dfd7e76482b96537a0886444c37e76319..b10ed59a49116a70e27c7d62f0ebdd16c717ca64 100644 (file)
 #include "acr.h"
 #include "gm200.h"
 
+#define TEGRA210_MC_BASE                       0x70019000
+
 #ifdef CONFIG_ARCH_TEGRA
-#define TEGRA_MC_BASE                          0x70019000
 #define MC_SECURITY_CARVEOUT2_CFG0             0xc58
 #define MC_SECURITY_CARVEOUT2_BOM_0            0xc5c
 #define MC_SECURITY_CARVEOUT2_BOM_HI_0         0xc60
 #define MC_SECURITY_CARVEOUT2_SIZE_128K                0xc64
 #define TEGRA_MC_SECURITY_CARVEOUT_CFG_LOCKED  (1 << 1)
 /**
- * sb_tegra_read_wpr() - read the WPR registers on Tegra
+ * gm20b_secboot_tegra_read_wpr() - read the WPR registers on Tegra
  *
  * On dGPU, we can manage the WPR region ourselves, but on Tegra the WPR region
  * is reserved from system memory by the bootloader and irreversibly locked.
  * This function reads the address and size of the pre-configured WPR region.
  */
-static int
-gm20b_tegra_read_wpr(struct gm200_secboot *gsb)
+int
+gm20b_secboot_tegra_read_wpr(struct gm200_secboot *gsb, u32 mc_base)
 {
        struct nvkm_secboot *sb = &gsb->base;
        void __iomem *mc;
        u32 cfg;
 
-       mc = ioremap(TEGRA_MC_BASE, 0xd00);
+       mc = ioremap(mc_base, 0xd00);
        if (!mc) {
                nvkm_error(&sb->subdev, "Cannot map Tegra MC registers\n");
                return PTR_ERR(mc);
@@ -70,8 +71,8 @@ gm20b_tegra_read_wpr(struct gm200_secboot *gsb)
        return 0;
 }
 #else
-static int
-gm20b_tegra_read_wpr(struct gm200_secboot *gsb)
+int
+gm20b_secboot_tegra_read_wpr(struct gm200_secboot *gsb, u32 mc_base)
 {
        nvkm_error(&gsb->base.subdev, "Tegra support not compiled in\n");
        return -EINVAL;
@@ -84,7 +85,7 @@ gm20b_secboot_oneinit(struct nvkm_secboot *sb)
        struct gm200_secboot *gsb = gm200_secboot(sb);
        int ret;
 
-       ret = gm20b_tegra_read_wpr(gsb);
+       ret = gm20b_secboot_tegra_read_wpr(gsb, TEGRA210_MC_BASE);
        if (ret)
                return ret;
 
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
new file mode 100644 (file)
index 0000000..632e954
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "acr.h"
+#include "gm200.h"
+
+#define TEGRA186_MC_BASE                       0x02c10000
+
+static int
+gp10b_secboot_oneinit(struct nvkm_secboot *sb)
+{
+       struct gm200_secboot *gsb = gm200_secboot(sb);
+       int ret;
+
+       ret = gm20b_secboot_tegra_read_wpr(gsb, TEGRA186_MC_BASE);
+       if (ret)
+               return ret;
+
+       return gm200_secboot_oneinit(sb);
+}
+
+static const struct nvkm_secboot_func
+gp10b_secboot = {
+       .dtor = gm200_secboot_dtor,
+       .oneinit = gp10b_secboot_oneinit,
+       .fini = gm200_secboot_fini,
+       .run_blob = gm200_secboot_run_blob,
+};
+
+int
+gp10b_secboot_new(struct nvkm_device *device, int index,
+                 struct nvkm_secboot **psb)
+{
+       int ret;
+       struct gm200_secboot *gsb;
+       struct nvkm_acr *acr;
+
+       acr = acr_r352_new(BIT(NVKM_SECBOOT_FALCON_FECS) |
+                          BIT(NVKM_SECBOOT_FALCON_GPCCS) |
+                          BIT(NVKM_SECBOOT_FALCON_PMU));
+       if (IS_ERR(acr))
+               return PTR_ERR(acr);
+
+       gsb = kzalloc(sizeof(*gsb), GFP_KERNEL);
+       if (!gsb) {
+               psb = NULL;
+               return -ENOMEM;
+       }
+       *psb = &gsb->base;
+
+       ret = nvkm_secboot_ctor(&gp10b_secboot, acr, device, index, &gsb->base);
+       if (ret)
+               return ret;
+
+       return 0;
+}
+
+MODULE_FIRMWARE("nvidia/gp10b/acr/bl.bin");
+MODULE_FIRMWARE("nvidia/gp10b/acr/ucode_load.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/fecs_bl.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/fecs_inst.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/fecs_data.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/fecs_sig.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/gpccs_bl.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/gpccs_inst.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/gpccs_data.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/gpccs_sig.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/sw_ctx.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/sw_nonctx.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/sw_bundle_init.bin");
+MODULE_FIRMWARE("nvidia/gp10b/gr/sw_method_init.bin");
+MODULE_FIRMWARE("nvidia/gp10b/pmu/desc.bin");
+MODULE_FIRMWARE("nvidia/gp10b/pmu/image.bin");
+MODULE_FIRMWARE("nvidia/gp10b/pmu/sig.bin");
index 4ff9138a2a83e9f03cfb9c245c65fd8c87fcf79f..9b7c402594e80c16a9fe05e2f9a8147d5c2c1405 100644 (file)
@@ -147,11 +147,11 @@ struct fw_bl_desc {
        u32 data_size;
 };
 
-int acr_ls_ucode_load_fecs(const struct nvkm_subdev *, struct ls_ucode_img *);
-int acr_ls_ucode_load_gpccs(const struct nvkm_subdev *, struct ls_ucode_img *);
-int acr_ls_ucode_load_pmu(const struct nvkm_subdev *, struct ls_ucode_img *);
-void acr_ls_pmu_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
-int acr_ls_ucode_load_sec2(const struct nvkm_subdev *, struct ls_ucode_img *);
-void acr_ls_sec2_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
+int acr_ls_ucode_load_fecs(const struct nvkm_secboot *, struct ls_ucode_img *);
+int acr_ls_ucode_load_gpccs(const struct nvkm_secboot *, struct ls_ucode_img *);
+int acr_ls_ucode_load_pmu(const struct nvkm_secboot *, struct ls_ucode_img *);
+int acr_ls_pmu_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
+int acr_ls_ucode_load_sec2(const struct nvkm_secboot *, struct ls_ucode_img *);
+int acr_ls_sec2_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
 
 #endif
index 40a6df77bb8a7ab8c43e9fe05cab030051f5584f..d1cf02d22db1ff24926ddd881b7f15cbcd78d82c 100644 (file)
@@ -144,15 +144,13 @@ error:
 }
 
 int
-acr_ls_ucode_load_fecs(const struct nvkm_subdev *subdev,
-                      struct ls_ucode_img *img)
+acr_ls_ucode_load_fecs(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
 {
-       return ls_ucode_img_load_gr(subdev, img, "fecs");
+       return ls_ucode_img_load_gr(&sb->subdev, img, "fecs");
 }
 
 int
-acr_ls_ucode_load_gpccs(const struct nvkm_subdev *subdev,
-                       struct ls_ucode_img *img)
+acr_ls_ucode_load_gpccs(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
 {
-       return ls_ucode_img_load_gr(subdev, img, "gpccs");
+       return ls_ucode_img_load_gr(&sb->subdev, img, "gpccs");
 }
index ef0b298b70d7659fdab3b20a0fa399f41a5e5acc..ee989210725e9c4113e2621ba9af22d792c7ee0b 100644 (file)
@@ -28,6 +28,8 @@
 #include <core/msgqueue.h>
 #include <subdev/pmu.h>
 #include <engine/sec2.h>
+#include <subdev/mc.h>
+#include <subdev/timer.h>
 
 /**
  * acr_ls_ucode_load_msgqueue - load and prepare a ucode img for a msgqueue fw
@@ -73,10 +75,11 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
        return 0;
 }
 
-static void
+static int
 acr_ls_msgqueue_post_run(struct nvkm_msgqueue *queue,
                         struct nvkm_falcon *falcon, u32 addr_args)
 {
+       struct nvkm_device *device = falcon->owner->device;
        u32 cmdline_size = NVKM_MSGQUEUE_CMDLINE_SIZE;
        u8 buf[cmdline_size];
 
@@ -85,65 +88,118 @@ acr_ls_msgqueue_post_run(struct nvkm_msgqueue *queue,
        nvkm_falcon_load_dmem(falcon, buf, addr_args, cmdline_size, 0);
        /* rearm the queue so it will wait for the init message */
        nvkm_msgqueue_reinit(queue);
+
+       /* Enable interrupts */
+       nvkm_falcon_wr32(falcon, 0x10, 0xff);
+       nvkm_mc_intr_mask(device, falcon->owner->index, true);
+
+       /* Start LS firmware on boot falcon */
+       nvkm_falcon_start(falcon);
+
+       return 0;
 }
 
 int
-acr_ls_ucode_load_pmu(const struct nvkm_subdev *subdev,
-                     struct ls_ucode_img *img)
+acr_ls_ucode_load_pmu(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
 {
-       struct nvkm_pmu *pmu = subdev->device->pmu;
+       struct nvkm_pmu *pmu = sb->subdev.device->pmu;
        int ret;
 
-       ret = acr_ls_ucode_load_msgqueue(subdev, "pmu", img);
+       ret = acr_ls_ucode_load_msgqueue(&sb->subdev, "pmu", img);
        if (ret)
                return ret;
 
        /* Allocate the PMU queue corresponding to the FW version */
        ret = nvkm_msgqueue_new(img->ucode_desc.app_version, pmu->falcon,
-                               &pmu->queue);
+                               sb, &pmu->queue);
        if (ret)
                return ret;
 
        return 0;
 }
 
-void
+int
 acr_ls_pmu_post_run(const struct nvkm_acr *acr, const struct nvkm_secboot *sb)
 {
        struct nvkm_device *device = sb->subdev.device;
        struct nvkm_pmu *pmu = device->pmu;
        u32 addr_args = pmu->falcon->data.limit - NVKM_MSGQUEUE_CMDLINE_SIZE;
+       int ret;
+
+       ret = acr_ls_msgqueue_post_run(pmu->queue, pmu->falcon, addr_args);
+       if (ret)
+               return ret;
 
-       acr_ls_msgqueue_post_run(pmu->queue, pmu->falcon, addr_args);
+       nvkm_debug(&sb->subdev, "%s started\n",
+                  nvkm_secboot_falcon_name[acr->boot_falcon]);
+
+       return 0;
 }
 
 int
-acr_ls_ucode_load_sec2(const struct nvkm_subdev *subdev,
-                      struct ls_ucode_img *img)
+acr_ls_ucode_load_sec2(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
 {
-       struct nvkm_sec2 *sec = subdev->device->sec2;
+       struct nvkm_sec2 *sec = sb->subdev.device->sec2;
        int ret;
 
-       ret = acr_ls_ucode_load_msgqueue(subdev, "sec2", img);
+       ret = acr_ls_ucode_load_msgqueue(&sb->subdev, "sec2", img);
        if (ret)
                return ret;
 
        /* Allocate the PMU queue corresponding to the FW version */
        ret = nvkm_msgqueue_new(img->ucode_desc.app_version, sec->falcon,
-                               &sec->queue);
+                               sb, &sec->queue);
        if (ret)
                return ret;
 
        return 0;
 }
 
-void
+int
 acr_ls_sec2_post_run(const struct nvkm_acr *acr, const struct nvkm_secboot *sb)
 {
-       struct nvkm_device *device = sb->subdev.device;
+       const struct nvkm_subdev *subdev = &sb->subdev;
+       struct nvkm_device *device = subdev->device;
        struct nvkm_sec2 *sec = device->sec2;
        /* on SEC arguments are always at the beginning of EMEM */
-       u32 addr_args = 0x01000000;
+       const u32 addr_args = 0x01000000;
+       u32 reg;
+       int ret;
 
-       acr_ls_msgqueue_post_run(sec->queue, sec->falcon, addr_args);
+       ret = acr_ls_msgqueue_post_run(sec->queue, sec->falcon, addr_args);
+       if (ret)
+               return ret;
+
+       /*
+        * There is a bug where the LS firmware sometimes require to be started
+        * twice (this happens only on SEC). Detect and workaround that
+        * condition.
+        *
+        * Once started, the falcon will end up in STOPPED condition (bit 5)
+        * if successful, or in HALT condition (bit 4) if not.
+        */
+       nvkm_msec(device, 1,
+                 if ((reg = nvkm_falcon_rd32(sb->boot_falcon, 0x100) & 0x30) != 0)
+                         break;
+       );
+       if (reg & BIT(4)) {
+               nvkm_debug(subdev, "applying workaround for start bug...");
+               nvkm_falcon_start(sb->boot_falcon);
+               nvkm_msec(subdev->device, 1,
+                       if ((reg = nvkm_rd32(subdev->device,
+                                            sb->boot_falcon->addr + 0x100)
+                            & 0x30) != 0)
+                               break;
+               );
+               if (reg & BIT(4)) {
+                       nvkm_error(subdev, "%s failed to start\n",
+                              nvkm_secboot_falcon_name[acr->boot_falcon]);
+                       return -EINVAL;
+               }
+       }
+
+       nvkm_debug(&sb->subdev, "%s started\n",
+                  nvkm_secboot_falcon_name[acr->boot_falcon]);
+
+       return 0;
 }
index 62aba976e744c146c26d7fedf44c54cdd480361e..5dc2106da2bc0d61dece9e0ccd6500cd480fffe2 100644 (file)
@@ -7,6 +7,16 @@ config DRM_PANEL
 menu "Display Panels"
        depends on DRM && DRM_PANEL
 
+config DRM_PANEL_LVDS
+       tristate "Generic LVDS panel driver"
+       depends on OF
+       depends on BACKLIGHT_CLASS_DEVICE
+       select VIDEOMODE_HELPERS
+       help
+         This driver supports LVDS panels that don't require device-specific
+         handling of power supplies or control signals. It implements automatic
+         backlight handling if the panel is attached to a backlight controller.
+
 config DRM_PANEL_SIMPLE
        tristate "support for simple panels"
        depends on OF
index a5c7ec0236e0174079cce0f07d46372967e9cf3b..20b5060d1f47cb34e3be793de5502781c2f4f6e7 100644 (file)
@@ -1,3 +1,4 @@
+obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.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-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
new file mode 100644 (file)
index 0000000..3216aa9
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+ * rcar_du_crtc.c  --  R-Car Display Unit CRTCs
+ *
+ * Copyright (C) 2016 Laurent Pinchart
+ * Copyright (C) 2016 Renesas Electronics Corporation
+ *
+ * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/backlight.h>
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+#include <drm/drmP.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_panel.h>
+
+#include <video/display_timing.h>
+#include <video/of_display_timing.h>
+#include <video/videomode.h>
+
+struct panel_lvds {
+       struct drm_panel panel;
+       struct device *dev;
+
+       const char *label;
+       unsigned int width;
+       unsigned int height;
+       struct videomode video_mode;
+       unsigned int bus_format;
+       bool data_mirror;
+
+       struct backlight_device *backlight;
+
+       struct gpio_desc *enable_gpio;
+       struct gpio_desc *reset_gpio;
+};
+
+static inline struct panel_lvds *to_panel_lvds(struct drm_panel *panel)
+{
+       return container_of(panel, struct panel_lvds, panel);
+}
+
+static int panel_lvds_disable(struct drm_panel *panel)
+{
+       struct panel_lvds *lvds = to_panel_lvds(panel);
+
+       if (lvds->backlight) {
+               lvds->backlight->props.power = FB_BLANK_POWERDOWN;
+               lvds->backlight->props.state |= BL_CORE_FBBLANK;
+               backlight_update_status(lvds->backlight);
+       }
+
+       return 0;
+}
+
+static int panel_lvds_unprepare(struct drm_panel *panel)
+{
+       struct panel_lvds *lvds = to_panel_lvds(panel);
+
+       if (lvds->enable_gpio)
+               gpiod_set_value_cansleep(lvds->enable_gpio, 0);
+
+       return 0;
+}
+
+static int panel_lvds_prepare(struct drm_panel *panel)
+{
+       struct panel_lvds *lvds = to_panel_lvds(panel);
+
+       if (lvds->enable_gpio)
+               gpiod_set_value_cansleep(lvds->enable_gpio, 1);
+
+       return 0;
+}
+
+static int panel_lvds_enable(struct drm_panel *panel)
+{
+       struct panel_lvds *lvds = to_panel_lvds(panel);
+
+       if (lvds->backlight) {
+               lvds->backlight->props.state &= ~BL_CORE_FBBLANK;
+               lvds->backlight->props.power = FB_BLANK_UNBLANK;
+               backlight_update_status(lvds->backlight);
+       }
+
+       return 0;
+}
+
+static int panel_lvds_get_modes(struct drm_panel *panel)
+{
+       struct panel_lvds *lvds = to_panel_lvds(panel);
+       struct drm_connector *connector = lvds->panel.connector;
+       struct drm_display_mode *mode;
+
+       mode = drm_mode_create(lvds->panel.drm);
+       if (!mode)
+               return 0;
+
+       drm_display_mode_from_videomode(&lvds->video_mode, mode);
+       mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
+       drm_mode_probed_add(connector, mode);
+
+       connector->display_info.width_mm = lvds->width;
+       connector->display_info.height_mm = lvds->height;
+       drm_display_info_set_bus_formats(&connector->display_info,
+                                        &lvds->bus_format, 1);
+       connector->display_info.bus_flags = lvds->data_mirror
+                                         ? DRM_BUS_FLAG_DATA_LSB_TO_MSB
+                                         : DRM_BUS_FLAG_DATA_MSB_TO_LSB;
+
+       return 1;
+}
+
+static const struct drm_panel_funcs panel_lvds_funcs = {
+       .disable = panel_lvds_disable,
+       .unprepare = panel_lvds_unprepare,
+       .prepare = panel_lvds_prepare,
+       .enable = panel_lvds_enable,
+       .get_modes = panel_lvds_get_modes,
+};
+
+static int panel_lvds_parse_dt(struct panel_lvds *lvds)
+{
+       struct device_node *np = lvds->dev->of_node;
+       struct display_timing timing;
+       const char *mapping;
+       int ret;
+
+       ret = of_get_display_timing(np, "panel-timing", &timing);
+       if (ret < 0)
+               return ret;
+
+       videomode_from_timing(&timing, &lvds->video_mode);
+
+       ret = of_property_read_u32(np, "width-mm", &lvds->width);
+       if (ret < 0) {
+               dev_err(lvds->dev, "%s: invalid or missing %s DT property\n",
+                       of_node_full_name(np), "width-mm");
+               return -ENODEV;
+       }
+       ret = of_property_read_u32(np, "height-mm", &lvds->height);
+       if (ret < 0) {
+               dev_err(lvds->dev, "%s: invalid or missing %s DT property\n",
+                       of_node_full_name(np), "height-mm");
+               return -ENODEV;
+       }
+
+       of_property_read_string(np, "label", &lvds->label);
+
+       ret = of_property_read_string(np, "data-mapping", &mapping);
+       if (ret < 0) {
+               dev_err(lvds->dev, "%s: invalid or missing %s DT property\n",
+                       of_node_full_name(np), "data-mapping");
+               return -ENODEV;
+       }
+
+       if (!strcmp(mapping, "jeida-18")) {
+               lvds->bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG;
+       } else if (!strcmp(mapping, "jeida-24")) {
+               lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
+       } else if (!strcmp(mapping, "vesa-24")) {
+               lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
+       } else {
+               dev_err(lvds->dev, "%s: invalid or missing %s DT property\n",
+                       of_node_full_name(np), "data-mapping");
+               return -EINVAL;
+       }
+
+       lvds->data_mirror = of_property_read_bool(np, "data-mirror");
+
+       return 0;
+}
+
+static int panel_lvds_probe(struct platform_device *pdev)
+{
+       struct panel_lvds *lvds;
+       struct device_node *np;
+       int ret;
+
+       lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL);
+       if (!lvds)
+               return -ENOMEM;
+
+       lvds->dev = &pdev->dev;
+
+       ret = panel_lvds_parse_dt(lvds);
+       if (ret < 0)
+               return ret;
+
+       /* Get GPIOs and backlight controller. */
+       lvds->enable_gpio = devm_gpiod_get_optional(lvds->dev, "enable",
+                                                    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);
+               return ret;
+       }
+
+       lvds->reset_gpio = devm_gpiod_get_optional(lvds->dev, "reset",
+                                                    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);
+               return ret;
+       }
+
+       np = of_parse_phandle(lvds->dev->of_node, "backlight", 0);
+       if (np) {
+               lvds->backlight = of_find_backlight_by_node(np);
+               of_node_put(np);
+
+               if (!lvds->backlight)
+                       return -EPROBE_DEFER;
+       }
+
+       /*
+        * TODO: Handle all power supplies specified in the DT node in a generic
+        * way for panels that don't care about power supply ordering. LVDS
+        * panels that require a specific power sequence will need a dedicated
+        * driver.
+        */
+
+       /* Register the panel. */
+       drm_panel_init(&lvds->panel);
+       lvds->panel.dev = lvds->dev;
+       lvds->panel.funcs = &panel_lvds_funcs;
+
+       ret = drm_panel_add(&lvds->panel);
+       if (ret < 0)
+               goto error;
+
+       dev_set_drvdata(lvds->dev, lvds);
+       return 0;
+
+error:
+       put_device(&lvds->backlight->dev);
+       return ret;
+}
+
+static int panel_lvds_remove(struct platform_device *pdev)
+{
+       struct panel_lvds *lvds = dev_get_drvdata(&pdev->dev);
+
+       drm_panel_detach(&lvds->panel);
+       drm_panel_remove(&lvds->panel);
+
+       panel_lvds_disable(&lvds->panel);
+
+       if (lvds->backlight)
+               put_device(&lvds->backlight->dev);
+
+       return 0;
+}
+
+static const struct of_device_id panel_lvds_of_table[] = {
+       { .compatible = "panel-lvds", },
+       { /* Sentinel */ },
+};
+
+MODULE_DEVICE_TABLE(of, panel_lvds_of_table);
+
+static struct platform_driver panel_lvds_driver = {
+       .probe          = panel_lvds_probe,
+       .remove         = panel_lvds_remove,
+       .driver         = {
+               .name   = "panel-lvds",
+               .of_match_table = panel_lvds_of_table,
+       },
+};
+
+module_platform_driver(panel_lvds_driver);
+
+MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
+MODULE_DESCRIPTION("LVDS Panel Driver");
+MODULE_LICENSE("GPL");
index 4c2fd056dd6da6c207e5ac944788cbc3ac2b3028..8a50dab19e5cfd44700b0a7d7b13816288085621 100644 (file)
@@ -11,15 +11,17 @@ config DRM_RCAR_DU
          Choose this option if you have an R-Car chipset.
          If M is selected the module will be called rcar-du-drm.
 
-config DRM_RCAR_HDMI
-       bool "R-Car DU HDMI Encoder Support"
-       depends on DRM_RCAR_DU
+config DRM_RCAR_DW_HDMI
+       tristate "R-Car DU Gen3 HDMI Encoder Support"
+       depends on DRM && OF
+       select DRM_DW_HDMI
        help
-         Enable support for external HDMI encoders.
+         Enable support for R-Car Gen3 internal HDMI encoder.
 
 config DRM_RCAR_LVDS
        bool "R-Car DU LVDS Encoder Support"
        depends on DRM_RCAR_DU
+       select DRM_PANEL
        help
          Enable support for the R-Car Display Unit embedded LVDS encoders.
 
index d3b44651061aa1799988d3d741986c8ed8bc644d..2131e722de3bc3ae437236cb78a066d76085e8ec 100644 (file)
@@ -4,13 +4,11 @@ rcar-du-drm-y := rcar_du_crtc.o \
                 rcar_du_group.o \
                 rcar_du_kms.o \
                 rcar_du_lvdscon.o \
-                rcar_du_plane.o \
-                rcar_du_vgacon.o
-
-rcar-du-drm-$(CONFIG_DRM_RCAR_HDMI)    += rcar_du_hdmienc.o
+                rcar_du_plane.o
 
 rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)    += rcar_du_lvdsenc.o
 
 rcar-du-drm-$(CONFIG_DRM_RCAR_VSP)     += rcar_du_vsp.o
 
 obj-$(CONFIG_DRM_RCAR_DU)              += rcar-du-drm.o
+obj-$(CONFIG_DRM_RCAR_DW_HDMI)         += rcar_dw_hdmi.o
index edcbe2e3625df312385989369a0366c99fe499ba..4ed6f2340af024a4298c126e62a6fd1b46512ef8 100644 (file)
@@ -106,9 +106,62 @@ static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc)
  * Hardware Setup
  */
 
+struct dpll_info {
+       unsigned int output;
+       unsigned int fdpll;
+       unsigned int n;
+       unsigned int m;
+};
+
+static void rcar_du_dpll_divider(struct rcar_du_crtc *rcrtc,
+                                struct dpll_info *dpll,
+                                unsigned long input,
+                                unsigned long target)
+{
+       unsigned long best_diff = (unsigned long)-1;
+       unsigned long diff;
+       unsigned int fdpll;
+       unsigned int m;
+       unsigned int n;
+
+       for (n = 39; n < 120; n++) {
+               for (m = 0; m < 4; m++) {
+                       for (fdpll = 1; fdpll < 32; fdpll++) {
+                               unsigned long output;
+
+                               /* 1/2 (FRQSEL=1) for duty rate 50% */
+                               output = input * (n + 1) / (m + 1)
+                                      / (fdpll + 1) / 2;
+
+                               if (output >= 400000000)
+                                       continue;
+
+                               diff = abs((long)output - (long)target);
+                               if (best_diff > diff) {
+                                       best_diff = diff;
+                                       dpll->n = n;
+                                       dpll->m = m;
+                                       dpll->fdpll = fdpll;
+                                       dpll->output = output;
+                               }
+
+                               if (diff == 0)
+                                       goto done;
+                       }
+               }
+       }
+
+done:
+       dev_dbg(rcrtc->group->dev->dev,
+               "output:%u, fdpll:%u, n:%u, m:%u, diff:%lu\n",
+                dpll->output, dpll->fdpll, dpll->n, dpll->m,
+                best_diff);
+}
+
 static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
 {
        const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;
+       struct rcar_du_device *rcdu = rcrtc->group->dev;
        unsigned long mode_clock = mode->clock * 1000;
        unsigned long clk;
        u32 value;
@@ -124,12 +177,18 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
        escr = div | ESCR_DCLKSEL_CLKS;
 
        if (rcrtc->extclock) {
+               struct dpll_info dpll = { 0 };
                unsigned long extclk;
                unsigned long extrate;
                unsigned long rate;
                u32 extdiv;
 
                extclk = clk_get_rate(rcrtc->extclock);
+               if (rcdu->info->dpll_ch & (1 << rcrtc->index)) {
+                       rcar_du_dpll_divider(rcrtc, &dpll, extclk, mode_clock);
+                       extclk = dpll.output;
+               }
+
                extdiv = DIV_ROUND_CLOSEST(extclk, mode_clock);
                extdiv = clamp(extdiv, 1U, 64U) - 1;
 
@@ -140,7 +199,27 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
                    abs((long)rate - (long)mode_clock)) {
                        dev_dbg(rcrtc->group->dev->dev,
                                "crtc%u: using external clock\n", rcrtc->index);
-                       escr = extdiv | ESCR_DCLKSEL_DCLKIN;
+
+                       if (rcdu->info->dpll_ch & (1 << rcrtc->index)) {
+                               u32 dpllcr = DPLLCR_CODE | DPLLCR_CLKE
+                                          | DPLLCR_FDPLL(dpll.fdpll)
+                                          | DPLLCR_N(dpll.n) | DPLLCR_M(dpll.m)
+                                          | DPLLCR_STBY;
+
+                               if (rcrtc->index == 1)
+                                       dpllcr |= DPLLCR_PLCS1
+                                              |  DPLLCR_INCS_DOTCLKIN1;
+                               else
+                                       dpllcr |= DPLLCR_PLCS0
+                                              |  DPLLCR_INCS_DOTCLKIN0;
+
+                               rcar_du_group_write(rcrtc->group, DPLLCR,
+                                                   dpllcr);
+
+                               escr = ESCR_DCLKSEL_DCLKIN | 1;
+                       } else {
+                               escr = ESCR_DCLKSEL_DCLKIN | extdiv;
+                       }
                }
        }
 
@@ -488,22 +567,29 @@ static void rcar_du_crtc_disable(struct drm_crtc *crtc)
        rcar_du_crtc_stop(rcrtc);
        rcar_du_crtc_put(rcrtc);
 
+       spin_lock_irq(&crtc->dev->event_lock);
+       if (crtc->state->event) {
+               drm_crtc_send_vblank_event(crtc, crtc->state->event);
+               crtc->state->event = NULL;
+       }
+       spin_unlock_irq(&crtc->dev->event_lock);
+
        rcrtc->outputs = 0;
 }
 
 static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc,
                                      struct drm_crtc_state *old_crtc_state)
 {
-       struct drm_pending_vblank_event *event = crtc->state->event;
        struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
        struct drm_device *dev = rcrtc->crtc.dev;
        unsigned long flags;
 
-       if (event) {
+       if (crtc->state->event) {
                WARN_ON(drm_crtc_vblank_get(crtc) != 0);
 
                spin_lock_irqsave(&dev->event_lock, flags);
-               rcrtc->event = event;
+               rcrtc->event = crtc->state->event;
+               crtc->state->event = NULL;
                spin_unlock_irqrestore(&dev->event_lock, flags);
        }
 
index a7194812997ed16f1a0040403eb1da31451daf6e..15871fae7445f645eb0f8c7ff02d823040c11dcd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * rcar_du_crtc.h  --  R-Car Display Unit CRTCs
  *
- * Copyright (C) 2013-2014 Renesas Electronics Corporation
+ * Copyright (C) 2013-2015 Renesas Electronics Corporation
  *
  * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  *
@@ -61,6 +61,8 @@ enum rcar_du_output {
        RCAR_DU_OUTPUT_DPAD1,
        RCAR_DU_OUTPUT_LVDS0,
        RCAR_DU_OUTPUT_LVDS1,
+       RCAR_DU_OUTPUT_HDMI0,
+       RCAR_DU_OUTPUT_HDMI1,
        RCAR_DU_OUTPUT_TCON,
        RCAR_DU_OUTPUT_MAX,
 };
index 62a3b3e32153915844f0b3371720b944c9e716bd..d6a0255181ccea6c1883bdb2946c82937aa1b61c 100644 (file)
@@ -44,12 +44,10 @@ static const struct rcar_du_device_info rcar_du_r8a7779_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_DPAD1] = {
                        .possible_crtcs = BIT(1) | BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 1,
                },
        },
@@ -68,17 +66,14 @@ static const struct rcar_du_device_info rcar_du_r8a7790_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(2) | BIT(1) | BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_LVDS0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 1,
                },
                [RCAR_DU_OUTPUT_LVDS1] = {
                        .possible_crtcs = BIT(2) | BIT(1),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 2,
                },
        },
@@ -97,12 +92,10 @@ static const struct rcar_du_device_info rcar_du_r8a7791_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(1) | BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_LVDS0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 1,
                },
        },
@@ -118,12 +111,10 @@ static const struct rcar_du_device_info rcar_du_r8a7792_info = {
                /* R8A7792 has two RGB outputs. */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_DPAD1] = {
                        .possible_crtcs = BIT(1),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 1,
                },
        },
@@ -141,12 +132,10 @@ static const struct rcar_du_device_info rcar_du_r8a7794_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_DPAD1] = {
                        .possible_crtcs = BIT(1),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 1,
                },
        },
@@ -160,21 +149,28 @@ static const struct rcar_du_device_info rcar_du_r8a7795_info = {
                  | RCAR_DU_FEATURE_VSP1_SOURCE,
        .num_crtcs = 4,
        .routes = {
-               /* R8A7795 has one RGB output, one LVDS output and two
-                * (currently unsupported) HDMI outputs.
+               /* R8A7795 has one RGB output, two HDMI outputs and one
+                * LVDS output.
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(3),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
+               [RCAR_DU_OUTPUT_HDMI0] = {
+                       .possible_crtcs = BIT(1),
+                       .port = 1,
+               },
+               [RCAR_DU_OUTPUT_HDMI1] = {
+                       .possible_crtcs = BIT(2),
+                       .port = 2,
+               },
                [RCAR_DU_OUTPUT_LVDS0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 3,
                },
        },
        .num_lvds = 1,
+       .dpll_ch =  BIT(1) | BIT(2),
 };
 
 static const struct rcar_du_device_info rcar_du_r8a7796_info = {
@@ -189,12 +185,10 @@ static const struct rcar_du_device_info rcar_du_r8a7796_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(2),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_LVDS0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 2,
                },
        },
@@ -318,10 +312,8 @@ static int rcar_du_probe(struct platform_device *pdev)
        if (rcdu == NULL)
                return -ENOMEM;
 
-       init_waitqueue_head(&rcdu->commit.wait);
-
        rcdu->dev = &pdev->dev;
-       rcdu->info = of_match_device(rcar_du_of_table, rcdu->dev)->data;
+       rcdu->info = of_device_get_match_data(rcdu->dev);
 
        platform_set_drvdata(pdev, rcdu);
 
index c843c3134498a985b5e56151e1ececbb5bef49eb..f8cd79488eceeef97acae4e2a0c3a55c78e4f7aa 100644 (file)
@@ -38,7 +38,6 @@ struct rcar_du_lvdsenc;
 /*
  * struct rcar_du_output_routing - Output routing specification
  * @possible_crtcs: bitmask of possible CRTCs for the output
- * @encoder_type: DRM type of the internal encoder associated with the output
  * @port: device tree port number corresponding to this output route
  *
  * The DU has 5 possible outputs (DPAD0/1, LVDS0/1, TCON). Output routing data
@@ -47,7 +46,6 @@ struct rcar_du_lvdsenc;
  */
 struct rcar_du_output_routing {
        unsigned int possible_crtcs;
-       unsigned int encoder_type;
        unsigned int port;
 };
 
@@ -67,6 +65,7 @@ struct rcar_du_device_info {
        unsigned int num_crtcs;
        struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX];
        unsigned int num_lvds;
+       unsigned int dpll_ch;
 };
 
 #define RCAR_DU_MAX_CRTCS              4
@@ -98,11 +97,6 @@ struct rcar_du_device {
        unsigned int vspd1_sink;
 
        struct rcar_du_lvdsenc *lvds[RCAR_DU_MAX_LVDS];
-
-       struct {
-               wait_queue_head_t wait;
-               u32 pending;
-       } commit;
 };
 
 static inline bool rcar_du_has(struct rcar_du_device *rcdu,
index ab8645c57e2d5f94a0a36b41910ef1db6861d638..3e048dd98b6421946f7e0c4612b0d991d59e4a45 100644 (file)
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_panel.h>
 
 #include "rcar_du_drv.h"
 #include "rcar_du_encoder.h"
-#include "rcar_du_hdmienc.h"
 #include "rcar_du_kms.h"
 #include "rcar_du_lvdscon.h"
 #include "rcar_du_lvdsenc.h"
-#include "rcar_du_vgacon.h"
 
 /* -----------------------------------------------------------------------------
  * Encoder
@@ -33,6 +32,11 @@ static void rcar_du_encoder_disable(struct drm_encoder *encoder)
 {
        struct rcar_du_encoder *renc = to_rcar_encoder(encoder);
 
+       if (renc->connector && renc->connector->panel) {
+               drm_panel_disable(renc->connector->panel);
+               drm_panel_unprepare(renc->connector->panel);
+       }
+
        if (renc->lvds)
                rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, false);
 }
@@ -43,6 +47,11 @@ static void rcar_du_encoder_enable(struct drm_encoder *encoder)
 
        if (renc->lvds)
                rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, true);
+
+       if (renc->connector && renc->connector->panel) {
+               drm_panel_prepare(renc->connector->panel);
+               drm_panel_enable(renc->connector->panel);
+       }
 }
 
 static int rcar_du_encoder_atomic_check(struct drm_encoder *encoder,
@@ -52,30 +61,36 @@ static int rcar_du_encoder_atomic_check(struct drm_encoder *encoder,
        struct rcar_du_encoder *renc = to_rcar_encoder(encoder);
        struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
        const struct drm_display_mode *mode = &crtc_state->mode;
-       const struct drm_display_mode *panel_mode;
        struct drm_connector *connector = conn_state->connector;
        struct drm_device *dev = encoder->dev;
 
-       /* DAC encoders have currently no restriction on the mode. */
-       if (encoder->encoder_type == DRM_MODE_ENCODER_DAC)
-               return 0;
-
-       if (list_empty(&connector->modes)) {
-               dev_dbg(dev->dev, "encoder: empty modes list\n");
-               return -EINVAL;
+       /*
+        * Only panel-related encoder types require validation here, everything
+        * else is handled by the bridge drivers.
+        */
+       if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) {
+               const struct drm_display_mode *panel_mode;
+
+               if (list_empty(&connector->modes)) {
+                       dev_dbg(dev->dev, "encoder: empty modes list\n");
+                       return -EINVAL;
+               }
+
+               panel_mode = list_first_entry(&connector->modes,
+                                             struct drm_display_mode, head);
+
+               /* We're not allowed to modify the resolution. */
+               if (mode->hdisplay != panel_mode->hdisplay ||
+                   mode->vdisplay != panel_mode->vdisplay)
+                       return -EINVAL;
+
+               /*
+                * The flat panel mode is fixed, just copy it to the adjusted
+                * mode.
+                */
+               drm_mode_copy(adjusted_mode, panel_mode);
        }
 
-       panel_mode = list_first_entry(&connector->modes,
-                                     struct drm_display_mode, head);
-
-       /* We're not allowed to modify the resolution. */
-       if (mode->hdisplay != panel_mode->hdisplay ||
-           mode->vdisplay != panel_mode->vdisplay)
-               return -EINVAL;
-
-       /* The flat panel mode is fixed, just copy it to the adjusted mode. */
-       drm_mode_copy(adjusted_mode, panel_mode);
-
        if (renc->lvds)
                rcar_du_lvdsenc_atomic_check(renc->lvds, adjusted_mode);
 
@@ -83,16 +98,54 @@ static int rcar_du_encoder_atomic_check(struct drm_encoder *encoder,
 }
 
 static void rcar_du_encoder_mode_set(struct drm_encoder *encoder,
-                                    struct drm_display_mode *mode,
-                                    struct drm_display_mode *adjusted_mode)
+                                    struct drm_crtc_state *crtc_state,
+                                    struct drm_connector_state *conn_state)
 {
        struct rcar_du_encoder *renc = to_rcar_encoder(encoder);
+       struct drm_display_info *info = &conn_state->connector->display_info;
+       enum rcar_lvds_mode mode;
+
+       rcar_du_crtc_route_output(crtc_state->crtc, renc->output);
+
+       if (!renc->lvds) {
+               /*
+                * The DU driver creates connectors only for the outputs of the
+                * internal LVDS encoders.
+                */
+               renc->connector = NULL;
+               return;
+       }
+
+       renc->connector = to_rcar_connector(conn_state->connector);
+
+       if (!info->num_bus_formats || !info->bus_formats) {
+               dev_err(encoder->dev->dev, "no LVDS bus format reported\n");
+               return;
+       }
+
+       switch (info->bus_formats[0]) {
+       case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
+       case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:
+               mode = RCAR_LVDS_MODE_JEIDA;
+               break;
+       case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:
+               mode = RCAR_LVDS_MODE_VESA;
+               break;
+       default:
+               dev_err(encoder->dev->dev,
+                       "unsupported LVDS bus format 0x%04x\n",
+                       info->bus_formats[0]);
+               return;
+       }
+
+       if (info->bus_flags & DRM_BUS_FLAG_DATA_LSB_TO_MSB)
+               mode |= RCAR_LVDS_MODE_MIRROR;
 
-       rcar_du_crtc_route_output(encoder->crtc, renc->output);
+       rcar_du_lvdsenc_set_mode(renc->lvds, mode);
 }
 
 static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
-       .mode_set = rcar_du_encoder_mode_set,
+       .atomic_mode_set = rcar_du_encoder_mode_set,
        .disable = rcar_du_encoder_disable,
        .enable = rcar_du_encoder_enable,
        .atomic_check = rcar_du_encoder_atomic_check,
@@ -103,14 +156,13 @@ static const struct drm_encoder_funcs encoder_funcs = {
 };
 
 int rcar_du_encoder_init(struct rcar_du_device *rcdu,
-                        enum rcar_du_encoder_type type,
                         enum rcar_du_output output,
                         struct device_node *enc_node,
                         struct device_node *con_node)
 {
        struct rcar_du_encoder *renc;
        struct drm_encoder *encoder;
-       unsigned int encoder_type;
+       struct drm_bridge *bridge = NULL;
        int ret;
 
        renc = devm_kzalloc(rcdu->dev, sizeof(*renc), GFP_KERNEL);
@@ -133,52 +185,51 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
                break;
        }
 
-       switch (type) {
-       case RCAR_DU_ENCODER_VGA:
-               encoder_type = DRM_MODE_ENCODER_DAC;
-               break;
-       case RCAR_DU_ENCODER_LVDS:
-               encoder_type = DRM_MODE_ENCODER_LVDS;
-               break;
-       case RCAR_DU_ENCODER_HDMI:
-               encoder_type = DRM_MODE_ENCODER_TMDS;
-               break;
-       case RCAR_DU_ENCODER_NONE:
-       default:
-               /* No external encoder, use the internal encoder type. */
-               encoder_type = rcdu->info->routes[output].encoder_type;
-               break;
-       }
+       if (enc_node) {
+               dev_dbg(rcdu->dev, "initializing encoder %s for output %u\n",
+                       of_node_full_name(enc_node), output);
 
-       if (type == RCAR_DU_ENCODER_HDMI) {
-               ret = rcar_du_hdmienc_init(rcdu, renc, enc_node);
-               if (ret < 0)
+               /* Locate the DRM bridge from the encoder DT node. */
+               bridge = of_drm_find_bridge(enc_node);
+               if (!bridge) {
+                       ret = -EPROBE_DEFER;
                        goto done;
+               }
        } else {
-               ret = drm_encoder_init(rcdu->ddev, encoder, &encoder_funcs,
-                                      encoder_type, NULL);
-               if (ret < 0)
-                       goto done;
-
-               drm_encoder_helper_add(encoder, &encoder_helper_funcs);
+               dev_dbg(rcdu->dev,
+                       "initializing internal encoder for output %u\n",
+                       output);
        }
 
-       switch (encoder_type) {
-       case DRM_MODE_ENCODER_LVDS:
-               ret = rcar_du_lvds_connector_init(rcdu, renc, con_node);
-               break;
-
-       case DRM_MODE_ENCODER_DAC:
-               ret = rcar_du_vga_connector_init(rcdu, renc);
-               break;
-
-       case DRM_MODE_ENCODER_TMDS:
-               /* connector managed by the bridge driver */
-               break;
-
-       default:
-               ret = -EINVAL;
-               break;
+       ret = drm_encoder_init(rcdu->ddev, encoder, &encoder_funcs,
+                              DRM_MODE_ENCODER_NONE, NULL);
+       if (ret < 0)
+               goto done;
+
+       drm_encoder_helper_add(encoder, &encoder_helper_funcs);
+
+       if (bridge) {
+               /*
+                * Attach the bridge to the encoder. The bridge will create the
+                * connector.
+                */
+               ret = drm_bridge_attach(encoder, bridge, NULL);
+               if (ret) {
+                       drm_encoder_cleanup(encoder);
+                       return ret;
+               }
+       } else {
+               /* There's no bridge, create the connector manually. */
+               switch (output) {
+               case RCAR_DU_OUTPUT_LVDS0:
+               case RCAR_DU_OUTPUT_LVDS1:
+                       ret = rcar_du_lvds_connector_init(rcdu, renc, con_node);
+                       break;
+
+               default:
+                       ret = -EINVAL;
+                       break;
+               }
        }
 
 done:
index a050a36998579796f2dbdcac1ef10a1cb2314d84..5422fa4df2727518356e66825d86321f119ff445 100644 (file)
 #include <drm/drm_crtc.h>
 #include <drm/drm_encoder.h>
 
+struct drm_panel;
 struct rcar_du_device;
-struct rcar_du_hdmienc;
 struct rcar_du_lvdsenc;
 
-enum rcar_du_encoder_type {
-       RCAR_DU_ENCODER_UNUSED = 0,
-       RCAR_DU_ENCODER_NONE,
-       RCAR_DU_ENCODER_VGA,
-       RCAR_DU_ENCODER_LVDS,
-       RCAR_DU_ENCODER_HDMI,
-};
-
 struct rcar_du_encoder {
        struct drm_encoder base;
        enum rcar_du_output output;
-       struct rcar_du_hdmienc *hdmi;
+       struct rcar_du_connector *connector;
        struct rcar_du_lvdsenc *lvds;
 };
 
@@ -44,13 +36,13 @@ struct rcar_du_encoder {
 struct rcar_du_connector {
        struct drm_connector connector;
        struct rcar_du_encoder *encoder;
+       struct drm_panel *panel;
 };
 
 #define to_rcar_connector(c) \
        container_of(c, struct rcar_du_connector, connector)
 
 int rcar_du_encoder_init(struct rcar_du_device *rcdu,
-                        enum rcar_du_encoder_type type,
                         enum rcar_du_output output,
                         struct device_node *enc_node,
                         struct device_node *con_node);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
deleted file mode 100644 (file)
index c4c5d1a..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * R-Car Display Unit HDMI Encoder
- *
- * Copyright (C) 2014 Renesas Electronics Corporation
- *
- * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#include <linux/slab.h>
-
-#include <drm/drmP.h>
-#include <drm/drm_crtc.h>
-#include <drm/drm_crtc_helper.h>
-
-#include "rcar_du_drv.h"
-#include "rcar_du_encoder.h"
-#include "rcar_du_hdmienc.h"
-#include "rcar_du_lvdsenc.h"
-
-struct rcar_du_hdmienc {
-       struct rcar_du_encoder *renc;
-       bool enabled;
-};
-
-#define to_rcar_hdmienc(e)     (to_rcar_encoder(e)->hdmi)
-
-static void rcar_du_hdmienc_disable(struct drm_encoder *encoder)
-{
-       struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
-
-       if (hdmienc->renc->lvds)
-               rcar_du_lvdsenc_enable(hdmienc->renc->lvds, encoder->crtc,
-                                      false);
-
-       hdmienc->enabled = false;
-}
-
-static void rcar_du_hdmienc_enable(struct drm_encoder *encoder)
-{
-       struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
-
-       if (hdmienc->renc->lvds)
-               rcar_du_lvdsenc_enable(hdmienc->renc->lvds, encoder->crtc,
-                                      true);
-
-       hdmienc->enabled = true;
-}
-
-static int rcar_du_hdmienc_atomic_check(struct drm_encoder *encoder,
-                                       struct drm_crtc_state *crtc_state,
-                                       struct drm_connector_state *conn_state)
-{
-       struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
-       struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
-
-       if (hdmienc->renc->lvds)
-               rcar_du_lvdsenc_atomic_check(hdmienc->renc->lvds,
-                                            adjusted_mode);
-
-       return 0;
-}
-
-
-static void rcar_du_hdmienc_mode_set(struct drm_encoder *encoder,
-                                    struct drm_display_mode *mode,
-                                    struct drm_display_mode *adjusted_mode)
-{
-       struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
-
-       rcar_du_crtc_route_output(encoder->crtc, hdmienc->renc->output);
-}
-
-static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
-       .mode_set = rcar_du_hdmienc_mode_set,
-       .disable = rcar_du_hdmienc_disable,
-       .enable = rcar_du_hdmienc_enable,
-       .atomic_check = rcar_du_hdmienc_atomic_check,
-};
-
-static void rcar_du_hdmienc_cleanup(struct drm_encoder *encoder)
-{
-       struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
-
-       if (hdmienc->enabled)
-               rcar_du_hdmienc_disable(encoder);
-
-       drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs encoder_funcs = {
-       .destroy = rcar_du_hdmienc_cleanup,
-};
-
-int rcar_du_hdmienc_init(struct rcar_du_device *rcdu,
-                        struct rcar_du_encoder *renc, struct device_node *np)
-{
-       struct drm_encoder *encoder = rcar_encoder_to_drm_encoder(renc);
-       struct drm_bridge *bridge;
-       struct rcar_du_hdmienc *hdmienc;
-       int ret;
-
-       hdmienc = devm_kzalloc(rcdu->dev, sizeof(*hdmienc), GFP_KERNEL);
-       if (hdmienc == NULL)
-               return -ENOMEM;
-
-       /* Locate the DRM bridge from the HDMI encoder DT node. */
-       bridge = of_drm_find_bridge(np);
-       if (!bridge)
-               return -EPROBE_DEFER;
-
-       ret = drm_encoder_init(rcdu->ddev, encoder, &encoder_funcs,
-                              DRM_MODE_ENCODER_TMDS, NULL);
-       if (ret < 0)
-               return ret;
-
-       drm_encoder_helper_add(encoder, &encoder_helper_funcs);
-
-       renc->hdmi = hdmienc;
-       hdmienc->renc = renc;
-
-       /* Link the bridge to the encoder. */
-       ret = drm_bridge_attach(encoder, bridge, NULL);
-       if (ret) {
-               drm_encoder_cleanup(encoder);
-               return ret;
-       }
-
-       return 0;
-}
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.h b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.h
deleted file mode 100644 (file)
index 2ff0128..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * R-Car Display Unit HDMI Encoder
- *
- * Copyright (C) 2014 Renesas Electronics Corporation
- *
- * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __RCAR_DU_HDMIENC_H__
-#define __RCAR_DU_HDMIENC_H__
-
-#include <linux/module.h>
-
-struct device_node;
-struct rcar_du_device;
-struct rcar_du_encoder;
-
-#if IS_ENABLED(CONFIG_DRM_RCAR_HDMI)
-int rcar_du_hdmienc_init(struct rcar_du_device *rcdu,
-                        struct rcar_du_encoder *renc, struct device_node *np);
-#else
-static inline int rcar_du_hdmienc_init(struct rcar_du_device *rcdu,
-                                      struct rcar_du_encoder *renc,
-                                      struct device_node *np)
-{
-       return -ENOSYS;
-}
-#endif
-
-#endif /* __RCAR_DU_HDMIENC_H__ */
index ff61f6032f2c46d28f730d826b86bf2c84bca847..f4125c8ca902100fea09090f1725a255f316c310 100644 (file)
@@ -249,18 +249,9 @@ static int rcar_du_atomic_check(struct drm_device *dev,
        return rcar_du_atomic_check_planes(dev, state);
 }
 
-struct rcar_du_commit {
-       struct work_struct work;
-       struct drm_device *dev;
-       struct drm_atomic_state *state;
-       u32 crtcs;
-};
-
-static void rcar_du_atomic_complete(struct rcar_du_commit *commit)
+static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
 {
-       struct drm_device *dev = commit->dev;
-       struct rcar_du_device *rcdu = dev->dev_private;
-       struct drm_atomic_state *old_state = commit->state;
+       struct drm_device *dev = old_state->dev;
 
        /* Apply the atomic update. */
        drm_atomic_helper_commit_modeset_disables(dev, old_state);
@@ -268,114 +259,31 @@ static void rcar_du_atomic_complete(struct rcar_du_commit *commit)
        drm_atomic_helper_commit_planes(dev, old_state,
                                        DRM_PLANE_COMMIT_ACTIVE_ONLY);
 
+       drm_atomic_helper_commit_hw_done(old_state);
        drm_atomic_helper_wait_for_vblanks(dev, old_state);
 
        drm_atomic_helper_cleanup_planes(dev, old_state);
-
-       drm_atomic_state_put(old_state);
-
-       /* Complete the commit, wake up any waiter. */
-       spin_lock(&rcdu->commit.wait.lock);
-       rcdu->commit.pending &= ~commit->crtcs;
-       wake_up_all_locked(&rcdu->commit.wait);
-       spin_unlock(&rcdu->commit.wait.lock);
-
-       kfree(commit);
-}
-
-static void rcar_du_atomic_work(struct work_struct *work)
-{
-       struct rcar_du_commit *commit =
-               container_of(work, struct rcar_du_commit, work);
-
-       rcar_du_atomic_complete(commit);
-}
-
-static int rcar_du_atomic_commit(struct drm_device *dev,
-                                struct drm_atomic_state *state,
-                                bool nonblock)
-{
-       struct rcar_du_device *rcdu = dev->dev_private;
-       struct rcar_du_commit *commit;
-       struct drm_crtc *crtc;
-       struct drm_crtc_state *crtc_state;
-       unsigned int i;
-       int ret;
-
-       ret = drm_atomic_helper_prepare_planes(dev, state);
-       if (ret)
-               return ret;
-
-       /* Allocate the commit object. */
-       commit = kzalloc(sizeof(*commit), GFP_KERNEL);
-       if (commit == NULL) {
-               ret = -ENOMEM;
-               goto error;
-       }
-
-       INIT_WORK(&commit->work, rcar_du_atomic_work);
-       commit->dev = dev;
-       commit->state = state;
-
-       /* Wait until all affected CRTCs have completed previous commits and
-        * mark them as pending.
-        */
-       for_each_crtc_in_state(state, crtc, crtc_state, i)
-               commit->crtcs |= drm_crtc_mask(crtc);
-
-       spin_lock(&rcdu->commit.wait.lock);
-       ret = wait_event_interruptible_locked(rcdu->commit.wait,
-                       !(rcdu->commit.pending & commit->crtcs));
-       if (ret == 0)
-               rcdu->commit.pending |= commit->crtcs;
-       spin_unlock(&rcdu->commit.wait.lock);
-
-       if (ret) {
-               kfree(commit);
-               goto error;
-       }
-
-       /* Swap the state, this is the point of no return. */
-       drm_atomic_helper_swap_state(state, true);
-
-       drm_atomic_state_get(state);
-       if (nonblock)
-               schedule_work(&commit->work);
-       else
-               rcar_du_atomic_complete(commit);
-
-       return 0;
-
-error:
-       drm_atomic_helper_cleanup_planes(dev, state);
-       return ret;
 }
 
 /* -----------------------------------------------------------------------------
  * Initialization
  */
 
+static const struct drm_mode_config_helper_funcs rcar_du_mode_config_helper = {
+       .atomic_commit_tail = rcar_du_atomic_commit_tail,
+};
+
 static const struct drm_mode_config_funcs rcar_du_mode_config_funcs = {
        .fb_create = rcar_du_fb_create,
        .output_poll_changed = rcar_du_output_poll_changed,
        .atomic_check = rcar_du_atomic_check,
-       .atomic_commit = rcar_du_atomic_commit,
+       .atomic_commit = drm_atomic_helper_commit,
 };
 
 static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
                                     enum rcar_du_output output,
                                     struct of_endpoint *ep)
 {
-       static const struct {
-               const char *compatible;
-               enum rcar_du_encoder_type type;
-       } encoders[] = {
-               { "adi,adv7123", RCAR_DU_ENCODER_VGA },
-               { "adi,adv7511w", RCAR_DU_ENCODER_HDMI },
-               { "thine,thc63lvdm83d", RCAR_DU_ENCODER_LVDS },
-       };
-
-       enum rcar_du_encoder_type enc_type = RCAR_DU_ENCODER_NONE;
        struct device_node *connector = NULL;
        struct device_node *encoder = NULL;
        struct device_node *ep_node = NULL;
@@ -394,6 +302,13 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
                return -ENODEV;
        }
 
+       if (!of_device_is_available(entity)) {
+               dev_dbg(rcdu->dev,
+                       "connected entity %s is disabled, skipping\n",
+                       entity->full_name);
+               return -ENODEV;
+       }
+
        entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0);
 
        for_each_endpoint_of_node(entity, ep_node) {
@@ -422,30 +337,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
 
        of_node_put(entity_ep_node);
 
-       if (encoder) {
-               /*
-                * If an encoder has been found, get its type based on its
-                * compatible string.
-                */
-               unsigned int i;
-
-               for (i = 0; i < ARRAY_SIZE(encoders); ++i) {
-                       if (of_device_is_compatible(encoder,
-                                                   encoders[i].compatible)) {
-                               enc_type = encoders[i].type;
-                               break;
-                       }
-               }
-
-               if (i == ARRAY_SIZE(encoders)) {
-                       dev_warn(rcdu->dev,
-                                "unknown encoder type for %s, skipping\n",
-                                encoder->full_name);
-                       of_node_put(encoder);
-                       of_node_put(connector);
-                       return -EINVAL;
-               }
-       } else {
+       if (!encoder) {
                /*
                 * If no encoder has been found the entity must be the
                 * connector.
@@ -453,7 +345,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
                connector = entity;
        }
 
-       ret = rcar_du_encoder_init(rcdu, enc_type, output, encoder, connector);
+       ret = rcar_du_encoder_init(rcdu, output, encoder, connector);
        if (ret && ret != -EPROBE_DEFER)
                dev_warn(rcdu->dev,
                         "failed to initialize encoder %s on output %u (%d), skipping\n",
@@ -561,6 +453,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
        dev->mode_config.max_width = 4095;
        dev->mode_config.max_height = 2047;
        dev->mode_config.funcs = &rcar_du_mode_config_funcs;
+       dev->mode_config.helper_private = &rcar_du_mode_config_helper;
 
        rcdu->num_crtcs = rcdu->info->num_crtcs;
 
index 3bcfd161c53f2e90c38f6cb5ac79e449a8bda84e..ee91481131ad15a46eb8c07a05270c80a811f94b 100644 (file)
@@ -15,6 +15,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_panel.h>
 
 #include <video/display_timing.h>
 #include <video/of_display_timing.h>
 #include "rcar_du_kms.h"
 #include "rcar_du_lvdscon.h"
 
-struct rcar_du_lvds_connector {
-       struct rcar_du_connector connector;
-
-       struct {
-               unsigned int width_mm;          /* Panel width in mm */
-               unsigned int height_mm;         /* Panel height in mm */
-               struct videomode mode;
-       } panel;
-};
-
-#define to_rcar_lvds_connector(c) \
-       container_of(c, struct rcar_du_lvds_connector, connector.connector)
-
 static int rcar_du_lvds_connector_get_modes(struct drm_connector *connector)
 {
-       struct rcar_du_lvds_connector *lvdscon =
-               to_rcar_lvds_connector(connector);
-       struct drm_display_mode *mode;
-
-       mode = drm_mode_create(connector->dev);
-       if (mode == NULL)
-               return 0;
+       struct rcar_du_connector *rcon = to_rcar_connector(connector);
 
-       mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
-
-       drm_display_mode_from_videomode(&lvdscon->panel.mode, mode);
-
-       drm_mode_probed_add(connector, mode);
-
-       return 1;
+       return drm_panel_get_modes(rcon->panel);
 }
 
 static const struct drm_connector_helper_funcs connector_helper_funcs = {
        .get_modes = rcar_du_lvds_connector_get_modes,
 };
 
+static void rcar_du_lvds_connector_destroy(struct drm_connector *connector)
+{
+       struct rcar_du_connector *rcon = to_rcar_connector(connector);
+
+       drm_panel_detach(rcon->panel);
+       drm_connector_cleanup(connector);
+}
+
 static const struct drm_connector_funcs connector_funcs = {
        .dpms = drm_atomic_helper_connector_dpms,
        .reset = drm_atomic_helper_connector_reset,
        .fill_modes = drm_helper_probe_single_connector_modes,
-       .destroy = drm_connector_cleanup,
+       .destroy = rcar_du_lvds_connector_destroy,
        .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
@@ -75,27 +59,19 @@ int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,
                                const struct device_node *np)
 {
        struct drm_encoder *encoder = rcar_encoder_to_drm_encoder(renc);
-       struct rcar_du_lvds_connector *lvdscon;
+       struct rcar_du_connector *rcon;
        struct drm_connector *connector;
-       struct display_timing timing;
        int ret;
 
-       lvdscon = devm_kzalloc(rcdu->dev, sizeof(*lvdscon), GFP_KERNEL);
-       if (lvdscon == NULL)
+       rcon = devm_kzalloc(rcdu->dev, sizeof(*rcon), GFP_KERNEL);
+       if (rcon == NULL)
                return -ENOMEM;
 
-       ret = of_get_display_timing(np, "panel-timing", &timing);
-       if (ret < 0)
-               return ret;
-
-       videomode_from_timing(&timing, &lvdscon->panel.mode);
+       connector = &rcon->connector;
 
-       of_property_read_u32(np, "width-mm", &lvdscon->panel.width_mm);
-       of_property_read_u32(np, "height-mm", &lvdscon->panel.height_mm);
-
-       connector = &lvdscon->connector.connector;
-       connector->display_info.width_mm = lvdscon->panel.width_mm;
-       connector->display_info.height_mm = lvdscon->panel.height_mm;
+       rcon->panel = of_drm_find_panel(np);
+       if (!rcon->panel)
+               return -EPROBE_DEFER;
 
        ret = drm_connector_init(rcdu->ddev, connector, &connector_funcs,
                                 DRM_MODE_CONNECTOR_LVDS);
@@ -112,7 +88,11 @@ int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,
        if (ret < 0)
                return ret;
 
-       lvdscon->connector.encoder = renc;
+       ret = drm_panel_attach(rcon->panel, connector);
+       if (ret < 0)
+               return ret;
+
+       rcon->encoder = renc;
 
        return 0;
 }
index e3a4985f6f3fe023d23efa5bce971ea1d6a1b771..1661f620121005398956028dfc8c291aac96238a 100644 (file)
@@ -31,6 +31,7 @@ struct rcar_du_lvdsenc {
        bool enabled;
 
        enum rcar_lvds_input input;
+       enum rcar_lvds_mode mode;
 };
 
 static void rcar_lvds_write(struct rcar_du_lvdsenc *lvds, u32 reg, u32 data)
@@ -61,7 +62,7 @@ static void rcar_du_lvdsenc_start_gen2(struct rcar_du_lvdsenc *lvds,
        /* Select the input, hardcode mode 0, enable LVDS operation and turn
         * bias circuitry on.
         */
-       lvdcr0 = LVDCR0_BEN | LVDCR0_LVEN;
+       lvdcr0 = (lvds->mode << LVDCR0_LVMD_SHIFT) | LVDCR0_BEN | LVDCR0_LVEN;
        if (rcrtc->index == 2)
                lvdcr0 |= LVDCR0_DUSEL;
        rcar_lvds_write(lvds, LVDCR0, lvdcr0);
@@ -114,7 +115,7 @@ static void rcar_du_lvdsenc_start_gen3(struct rcar_du_lvdsenc *lvds,
         * Turn the PLL on, set it to LVDS normal mode, wait for the startup
         * delay and turn the output on.
         */
-       lvdcr0 = LVDCR0_PLLON;
+       lvdcr0 = (lvds->mode << LVDCR0_LVMD_SHIFT) | LVDCR0_PLLON;
        rcar_lvds_write(lvds, LVDCR0, lvdcr0);
 
        lvdcr0 |= LVDCR0_PWD;
@@ -211,6 +212,12 @@ void rcar_du_lvdsenc_atomic_check(struct rcar_du_lvdsenc *lvds,
                mode->clock = clamp(mode->clock, 25175, 148500);
 }
 
+void rcar_du_lvdsenc_set_mode(struct rcar_du_lvdsenc *lvds,
+                             enum rcar_lvds_mode mode)
+{
+       lvds->mode = mode;
+}
+
 static int rcar_du_lvdsenc_get_resources(struct rcar_du_lvdsenc *lvds,
                                         struct platform_device *pdev)
 {
index dfdba746edf48da5c9f16e55ff6a9fa033cf074e..7218ac89333e7b4c168230f0178950e7d44d750e 100644 (file)
@@ -26,8 +26,17 @@ enum rcar_lvds_input {
        RCAR_LVDS_INPUT_DU2,
 };
 
+/* Keep in sync with the LVDCR0.LVMD hardware register values. */
+enum rcar_lvds_mode {
+       RCAR_LVDS_MODE_JEIDA = 0,
+       RCAR_LVDS_MODE_MIRROR = 1,
+       RCAR_LVDS_MODE_VESA = 4,
+};
+
 #if IS_ENABLED(CONFIG_DRM_RCAR_LVDS)
 int rcar_du_lvdsenc_init(struct rcar_du_device *rcdu);
+void rcar_du_lvdsenc_set_mode(struct rcar_du_lvdsenc *lvds,
+                             enum rcar_lvds_mode mode);
 int rcar_du_lvdsenc_enable(struct rcar_du_lvdsenc *lvds,
                           struct drm_crtc *crtc, bool enable);
 void rcar_du_lvdsenc_atomic_check(struct rcar_du_lvdsenc *lvds,
@@ -37,6 +46,10 @@ static inline int rcar_du_lvdsenc_init(struct rcar_du_device *rcdu)
 {
        return 0;
 }
+static inline void rcar_du_lvdsenc_set_mode(struct rcar_du_lvdsenc *lvds,
+                                           enum rcar_lvds_mode mode)
+{
+}
 static inline int rcar_du_lvdsenc_enable(struct rcar_du_lvdsenc *lvds,
                                         struct drm_crtc *crtc, bool enable)
 {
index fedb0161e2344d17c3f6f743a016bf853d09c281..d5bae99d3cfe193fcbc658fb8cb90bc20bb24130 100644 (file)
 #define DEFR10_TSEL_H3_TCON1   (0 << 1) /* DEFR102 register only (DU2/DU3) */
 #define DEFR10_DEFE10          (1 << 0)
 
+#define DPLLCR                 0x20044
+#define DPLLCR_CODE            (0x95 << 24)
+#define DPLLCR_PLCS1           (1 << 23)
+/*
+ * PLCS0 is bit 21, but H3 ES1.x requires bit 20 to be set as well. As bit 20
+ * isn't implemented by other SoC in the Gen3 family it can safely be set
+ * unconditionally.
+ */
+#define DPLLCR_PLCS0           (3 << 20)
+#define DPLLCR_CLKE            (1 << 18)
+#define DPLLCR_FDPLL(n)                ((n) << 12)
+#define DPLLCR_N(n)            ((n) << 5)
+#define DPLLCR_M(n)            ((n) << 3)
+#define DPLLCR_STBY            (1 << 2)
+#define DPLLCR_INCS_DOTCLKIN0  (0 << 0)
+#define DPLLCR_INCS_DOTCLKIN1  (1 << 1)
+
+#define DPLLC2R                        0x20048
+#define DPLLC2R_CODE           (0x95 << 24)
+#define DPLLC2R_SELC           (1 << 12)
+#define DPLLC2R_M(n)           ((n) << 8)
+#define DPLLC2R_FDPLL(n)       ((n) << 0)
+
 /* -----------------------------------------------------------------------------
  * Display Timing Generation Registers
  */
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c
deleted file mode 100644 (file)
index 8d6125c..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * rcar_du_vgacon.c  --  R-Car Display Unit VGA Connector
- *
- * Copyright (C) 2013-2014 Renesas Electronics Corporation
- *
- * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#include <drm/drmP.h>
-#include <drm/drm_atomic_helper.h>
-#include <drm/drm_crtc.h>
-#include <drm/drm_crtc_helper.h>
-
-#include "rcar_du_drv.h"
-#include "rcar_du_encoder.h"
-#include "rcar_du_kms.h"
-#include "rcar_du_vgacon.h"
-
-static int rcar_du_vga_connector_get_modes(struct drm_connector *connector)
-{
-       return 0;
-}
-
-static const struct drm_connector_helper_funcs connector_helper_funcs = {
-       .get_modes = rcar_du_vga_connector_get_modes,
-};
-
-static enum drm_connector_status
-rcar_du_vga_connector_detect(struct drm_connector *connector, bool force)
-{
-       return connector_status_connected;
-}
-
-static const struct drm_connector_funcs connector_funcs = {
-       .dpms = drm_atomic_helper_connector_dpms,
-       .reset = drm_atomic_helper_connector_reset,
-       .detect = rcar_du_vga_connector_detect,
-       .fill_modes = drm_helper_probe_single_connector_modes,
-       .destroy = drm_connector_cleanup,
-       .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-       .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-};
-
-int rcar_du_vga_connector_init(struct rcar_du_device *rcdu,
-                              struct rcar_du_encoder *renc)
-{
-       struct drm_encoder *encoder = rcar_encoder_to_drm_encoder(renc);
-       struct rcar_du_connector *rcon;
-       struct drm_connector *connector;
-       int ret;
-
-       rcon = devm_kzalloc(rcdu->dev, sizeof(*rcon), GFP_KERNEL);
-       if (rcon == NULL)
-               return -ENOMEM;
-
-       connector = &rcon->connector;
-       connector->display_info.width_mm = 0;
-       connector->display_info.height_mm = 0;
-       connector->interlace_allowed = true;
-
-       ret = drm_connector_init(rcdu->ddev, connector, &connector_funcs,
-                                DRM_MODE_CONNECTOR_VGA);
-       if (ret < 0)
-               return ret;
-
-       drm_connector_helper_add(connector, &connector_helper_funcs);
-
-       connector->dpms = DRM_MODE_DPMS_OFF;
-       drm_object_property_set_value(&connector->base,
-               rcdu->ddev->mode_config.dpms_property, DRM_MODE_DPMS_OFF);
-
-       ret = drm_mode_connector_attach_encoder(connector, encoder);
-       if (ret < 0)
-               return ret;
-
-       return 0;
-}
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.h b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.h
deleted file mode 100644 (file)
index 112f503..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * rcar_du_vgacon.h  --  R-Car Display Unit VGA Connector
- *
- * Copyright (C) 2013-2014 Renesas Electronics Corporation
- *
- * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __RCAR_DU_VGACON_H__
-#define __RCAR_DU_VGACON_H__
-
-struct rcar_du_device;
-struct rcar_du_encoder;
-
-int rcar_du_vga_connector_init(struct rcar_du_device *rcdu,
-                              struct rcar_du_encoder *renc);
-
-#endif /* __RCAR_DU_VGACON_H__ */
index 510dcc9c6816d046242805909bd796200096529b..f1d0f182452821bbf09c81c931277c659e1f4eae 100644 (file)
@@ -68,7 +68,7 @@ void rcar_du_vsp_disable(struct rcar_du_crtc *crtc);
 void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc);
 void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc);
 #else
-static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp) { return 0; };
+static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp) { return -ENXIO; };
 static inline void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) { };
 static inline void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) { };
 static inline void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) { };
diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
new file mode 100644 (file)
index 0000000..7539626
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * R-Car Gen3 HDMI PHY
+ *
+ * Copyright (C) 2016 Renesas Electronics Corporation
+ *
+ * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#include <drm/bridge/dw_hdmi.h>
+
+#define RCAR_HDMI_PHY_OPMODE_PLLCFG    0x06    /* Mode of operation and PLL dividers */
+#define RCAR_HDMI_PHY_PLLCURRGMPCTRL   0x10    /* PLL current and Gmp (conductance) */
+#define RCAR_HDMI_PHY_PLLDIVCTRL       0x11    /* PLL dividers */
+
+struct rcar_hdmi_phy_params {
+       unsigned long mpixelclock;
+       u16 opmode_div; /* Mode of operation and PLL dividers */
+       u16 curr_gmp;   /* PLL current and Gmp (conductance) */
+       u16 div;        /* PLL dividers */
+};
+
+static const struct rcar_hdmi_phy_params rcar_hdmi_phy_params[] = {
+       { 35500000,  0x0003, 0x0344, 0x0328 },
+       { 44900000,  0x0003, 0x0285, 0x0128 },
+       { 71000000,  0x0002, 0x1184, 0x0314 },
+       { 90000000,  0x0002, 0x1144, 0x0114 },
+       { 140250000, 0x0001, 0x20c4, 0x030a },
+       { 182750000, 0x0001, 0x2084, 0x010a },
+       { 281250000, 0x0000, 0x0084, 0x0305 },
+       { 297000000, 0x0000, 0x0084, 0x0105 },
+       { ~0UL,      0x0000, 0x0000, 0x0000 },
+};
+
+static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi,
+                                  const struct dw_hdmi_plat_data *pdata,
+                                  unsigned long mpixelclock)
+{
+       const struct rcar_hdmi_phy_params *params = rcar_hdmi_phy_params;
+
+       for (; params && params->mpixelclock != ~0UL; ++params) {
+               if (mpixelclock <= params->mpixelclock)
+                       break;
+       }
+
+       if (params->mpixelclock == ~0UL)
+               return -EINVAL;
+
+       dw_hdmi_phy_i2c_write(hdmi, params->opmode_div,
+                             RCAR_HDMI_PHY_OPMODE_PLLCFG);
+       dw_hdmi_phy_i2c_write(hdmi, params->curr_gmp,
+                             RCAR_HDMI_PHY_PLLCURRGMPCTRL);
+       dw_hdmi_phy_i2c_write(hdmi, params->div, RCAR_HDMI_PHY_PLLDIVCTRL);
+
+       return 0;
+}
+
+static const struct dw_hdmi_plat_data rcar_dw_hdmi_plat_data = {
+       .configure_phy  = rcar_hdmi_phy_configure,
+};
+
+static int rcar_dw_hdmi_probe(struct platform_device *pdev)
+{
+       return dw_hdmi_probe(pdev, &rcar_dw_hdmi_plat_data);
+}
+
+static int rcar_dw_hdmi_remove(struct platform_device *pdev)
+{
+       dw_hdmi_remove(pdev);
+
+       return 0;
+}
+
+static const struct of_device_id rcar_dw_hdmi_of_table[] = {
+       { .compatible = "renesas,rcar-gen3-hdmi" },
+       { /* Sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, rcar_dw_hdmi_of_table);
+
+static struct platform_driver rcar_dw_hdmi_platform_driver = {
+       .probe          = rcar_dw_hdmi_probe,
+       .remove         = rcar_dw_hdmi_remove,
+       .driver         = {
+               .name   = "rcar-dw-hdmi",
+               .of_match_table = rcar_dw_hdmi_of_table,
+       },
+};
+
+module_platform_driver(rcar_dw_hdmi_platform_driver);
+
+MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
+MODULE_DESCRIPTION("Renesas R-Car Gen3 HDMI Encoder Driver");
+MODULE_LICENSE("GPL");
index 1ab9bceee755fd3194f8fe0862e91b3de81d6e79..8cdf9e4ae772c31fecddf658ecc913e43683ad16 100644 (file)
@@ -2,4 +2,8 @@ obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o
 
 imx-ipu-v3-objs := ipu-common.o ipu-cpmem.o ipu-csi.o ipu-dc.o ipu-di.o \
                ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-image-convert.o \
-               ipu-pre.o ipu-prg.o ipu-smfc.o ipu-vdi.o
+               ipu-smfc.o ipu-vdi.o
+
+ifdef CONFIG_DRM
+       imx-ipu-v3-objs += ipu-pre.o ipu-prg.o
+endif
index 7aefccec31b1e84ef8ab5a0b7ed98b0fca37ce11..16d556816b5fcaa62758549d9bceaa88bd4bc839 100644 (file)
@@ -1401,7 +1401,8 @@ static int ipu_probe(struct platform_device *pdev)
 
        ipu->id = of_alias_get_id(np, "ipu");
 
-       if (of_device_is_compatible(np, "fsl,imx6qp-ipu")) {
+       if (of_device_is_compatible(np, "fsl,imx6qp-ipu") &&
+           IS_ENABLED(CONFIG_DRM)) {
                ipu->prg_priv = ipu_prg_lookup_by_phandle(&pdev->dev,
                                                          "fsl,prg", ipu->id);
                if (!ipu->prg_priv)
@@ -1538,8 +1539,10 @@ static struct platform_driver imx_ipu_driver = {
 };
 
 static struct platform_driver * const drivers[] = {
+#if IS_ENABLED(CONFIG_DRM)
        &ipu_pre_drv,
        &ipu_prg_drv,
+#endif
        &imx_ipu_driver,
 };
 
index 941f57f311aa2221bea207958225e4e1e894a358..8250062eb8a515b6c8ebbf717730f6131c6d4cbc 100644 (file)
@@ -224,6 +224,10 @@ struct drm_display_info {
 #define DRM_BUS_FLAG_PIXDATA_POSEDGE   (1<<2)
 /* drive data on neg. edge */
 #define DRM_BUS_FLAG_PIXDATA_NEGEDGE   (1<<3)
+/* data is transmitted MSB to LSB on the bus */
+#define DRM_BUS_FLAG_DATA_MSB_TO_LSB   (1<<4)
+/* data is transmitted LSB to MSB on the bus */
+#define DRM_BUS_FLAG_DATA_LSB_TO_MSB   (1<<5)
 
        /**
         * @bus_flags: Additional information (like pixel signal polarity) for
index 2584c1cca42f6dd77d8f0540362768a310c98227..76f6f78a352bac46627025769c4e116529d62167 100644 (file)
@@ -154,6 +154,12 @@ struct drm_etnaviv_gem_submit_bo {
  * one or more cmdstream buffers.  This allows for conditional execution
  * (context-restore), and IB buffers needed for per tile/bin draw cmds.
  */
+#define ETNA_SUBMIT_NO_IMPLICIT         0x0001
+#define ETNA_SUBMIT_FENCE_FD_IN         0x0002
+#define ETNA_SUBMIT_FENCE_FD_OUT        0x0004
+#define ETNA_SUBMIT_FLAGS              (ETNA_SUBMIT_NO_IMPLICIT | \
+                                        ETNA_SUBMIT_FENCE_FD_IN | \
+                                        ETNA_SUBMIT_FENCE_FD_OUT)
 #define ETNA_PIPE_3D      0x00
 #define ETNA_PIPE_2D      0x01
 #define ETNA_PIPE_VG      0x02
@@ -167,6 +173,8 @@ struct drm_etnaviv_gem_submit {
        __u64 bos;            /* in, ptr to array of submit_bo's */
        __u64 relocs;         /* in, ptr to array of submit_reloc's */
        __u64 stream;         /* in, ptr to cmdstream */
+       __u32 flags;          /* in, mask of ETNA_SUBMIT_x */
+       __s32 fence_fd;       /* in/out, fence fd (see ETNA_SUBMIT_FENCE_FD_x) */
 };
 
 /* The normal way to synchronize with the GPU is just to CPU_PREP on