Skip to contentSkip to conversation

Add DRM for stih4xx platforms

PATCH Superseded Benjamin Gaignard 1 participant 20 messages May 13, 2014

Subsystems (4)

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add DRM for stih4xx platforms

This series of patches add the support of DRM/KMS drivers for STMicroelectronics chipsets stih416 and stih407.

patcheset version 2:
- Use componentized device instead of register sub-devices in master driver probe function
- Fix Makefile and Kconfig to only allow built-in compilation

patches could be found here: git://git.linaro.org/people/benjamin.gaignard/kernel.git
on branch: drm_kms_for_next-v2

patcheset version 1:
- First path submission

Hardware is split in two main blocks: Compositor and TVout. Each of them includes specific hardware IPs and the display timing are controlled by a specific Video Timing Generator hardware IP (VTG).

Compositor is made of the follow hardware IPs:
- GDP (Generic Display Pipeline) which is an entry point for graphic (RGB) buffers
- VDP (Video Diplay Pipeline) which is an entry point for video (YUV) buffers
- HQVDP (High Quality Video Display Processor) that supports scaling, deinterlacing and some miscellaneous image quality improvements. It fetches the Video decoded buffers from memory, processes them and pushes them to the Compositor through a HW dedicated bus.
- Mixer is responsible of mixing all the entries depending of their respective z-order and layout

TVout is divided in 3 parts:
- HDMI to generate HDMI signals, depending of chipset version HDMI phy can change.
- HDA to generate signals for HD analog TV
- VIP to control/switch data path coming from Compositor

On stih416 compositor and Tvout are on different dies so a Video Trafic Advance inter-die Communication mechanism (VTAC) is needed.

+---------------------------------------------+   +----------------------------------------+
| +-------------------------------+   +----+  |   |  +----+   +--------------------------+ |
| |                               |   |    |  |   |  |    |   |  +---------+     +----+  | |
| | +----+              +------+  |   |    |  |   |  |    |   |  | VIP     |---->|HDMI|  | |
| | |GPD +------------->|      |  |   |    |  |   |  |    |   |  |         |     +----+  | |
| | +----+              |Mixer |--|-->|    |  |   |  |    |---|->| switcher|             | |
| |                     |      |  |   |    |  |   |  |    |   |  |         |     +----+  | |
| |                     |      |  |   |    |  |   |  |    |   |  |         |---->|HDA |  | |
| |                     +------+  |   |VTAC|========>|VTAC|   |  +---------+     +----+  | |
| |                               |   |    |  |   |  |    |   |                          | |
| |         Compositor            |   |    |  |   |  |    |   |           TVout          | |
| +-------------------------------+   |    |  |   |  |    |   +--------------------------+ |
|                      ^              |    |  |   |  |    |             ^                  |
|                      |              |    |  |   |  |    |             |                  |
|               +--------------+      |    |  |   |  |    |      +-------------+           |
|               | VTG (master) |----->|    |  |   |  |    |----->| VTG (slave) |           |
|               +--------------+      +----+  |   |  +----+      +-------------+           |
|Digital die                                  |   |                              Analog Die|
+---------------------------------------------+   +----------------------------------------+

On stih407 Compositor and Tvout are on the same die

+-----------------------------------------------------------------+
| +-------------------------------+  +--------------------------+ |
| |                               |  |  +---------+     +----+  | |
| | +----+              +------+  |  |  | VIP     |---->|HDMI|  | |
| | |GPD +------------->|      |  |  |  |         |     +----+  | |
| | +----+              |Mixer |--|--|->| switcher|             | |
| | +----+   +-----+    |      |  |  |  |         |     +----+  | |
| | |VDP +-->+HQVDP+--->|      |  |  |  |         |---->|HDA |  | |
| | +----+   +-----+    +------+  |  |  +---------+     +----+  | |
| |                               |  |                          | |
| |         Compositor            |  |           TVout          | |
| +-------------------------------+  +--------------------------+ |
|                              ^        ^                         |
|                              |        |                         |
|                           +--------------+                      |
|                           |     VTG      |                      |
|                           +--------------+                      |
|Digital die                                                      |
+-----------------------------------------------------------------+

In addition of the drivers for the IPs listed before a thin I2C driver (hdmiddc) is used by HDMI driver to retrieve EDID for monitor.

To unify interfaces of GDP and VDP we create a "layer" interface called by compositor to control both GPD and VDP.

Hardware have memory contraints (alignment, contiguous) so we use CMA drm helpers functions to allocate frame buffer.

File naming convention is:
- sti_* for IPs drivers
- sti_drm_* for drm functions implementation.

Benjamin Gaignard (18):
drm: sti: add bindings for DRM driver
drm: sti: add VTG driver
drm: sti: add VTAC drivers
drm: sti: add HDMI driver
drm: sti: add I2C client driver for HDMI
drm: sti: add HDA driver
drm: sti: add TVOut driver
drm: sti: add sti layer interface definition
drm: sti: add GDP layer
drm: sti: add VID layer
drm: sti: add Mixer
drm: sti: add Compositor
drm: sti: add debug to GDP
drm: sti: add debug to VID
drm: sti: add debug to TVout
drm: sti: add debug to mixer
drm: sti: Add DRM driver itself
drm: sti: add HQVDP driver

Vincent Abriou (1):
drm: sti: rename mixer registers to be main/aux independent

 .../devicetree/bindings/gpu/st,stih4xx.txt         |  187 ++++
 drivers/gpu/drm/Kconfig                            |    2 +
 drivers/gpu/drm/Makefile                           |    1 +
 drivers/gpu/drm/sti/Kconfig                        |   26 +
 drivers/gpu/drm/sti/Makefile                       |   23 +
 drivers/gpu/drm/sti/sti_compositor.c               |  222 ++++
 drivers/gpu/drm/sti/sti_compositor.h               |   84 ++
 drivers/gpu/drm/sti/sti_ddc.c                      |   56 +
 drivers/gpu/drm/sti/sti_drm_connector.c            |  195 ++++
 drivers/gpu/drm/sti/sti_drm_connector.h            |   16 +
 drivers/gpu/drm/sti/sti_drm_crtc.c                 |  440 ++++++++
 drivers/gpu/drm/sti/sti_drm_crtc.h                 |   21 +
 drivers/gpu/drm/sti/sti_drm_drv.c                  |  447 ++++++++
 drivers/gpu/drm/sti/sti_drm_drv.h                  |   39 +
 drivers/gpu/drm/sti/sti_drm_encoder.c              |  201 ++++
 drivers/gpu/drm/sti/sti_drm_encoder.h              |   16 +
 drivers/gpu/drm/sti/sti_drm_plane.c                |  195 ++++
 drivers/gpu/drm/sti/sti_drm_plane.h                |   16 +
 drivers/gpu/drm/sti/sti_gdp.c                      |  726 +++++++++++++
 drivers/gpu/drm/sti/sti_gdp.h                      |   75 ++
 drivers/gpu/drm/sti/sti_hda.c                      |  853 +++++++++++++++
 drivers/gpu/drm/sti/sti_hda.h                      |   14 +
 drivers/gpu/drm/sti/sti_hdmi.c                     | 1072 +++++++++++++++++++
 drivers/gpu/drm/sti/sti_hdmi.h                     |  198 ++++
 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c         |  398 +++++++
 drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c         |  224 ++++
 drivers/gpu/drm/sti/sti_hqvdp.c                    | 1107 ++++++++++++++++++++
 drivers/gpu/drm/sti/sti_hqvdp.h                    |   55 +
 drivers/gpu/drm/sti/sti_hqvdp_lut.h                |  373 +++++++
 drivers/gpu/drm/sti/sti_layer.c                    |  324 ++++++
 drivers/gpu/drm/sti/sti_layer.h                    |  116 ++
 drivers/gpu/drm/sti/sti_mixer.c                    |  405 +++++++
 drivers/gpu/drm/sti/sti_mixer.h                    |   54 +
 drivers/gpu/drm/sti/sti_tvout.c                    |  884 ++++++++++++++++
 drivers/gpu/drm/sti/sti_tvout.h                    |  105 ++
 drivers/gpu/drm/sti/sti_vid.c                      |  259 +++++
 drivers/gpu/drm/sti/sti_vid.h                      |   34 +
 drivers/gpu/drm/sti/sti_vtac_rx.c                  |  167 +++
 drivers/gpu/drm/sti/sti_vtac_tx.c                  |  182 ++++
 drivers/gpu/drm/sti/sti_vtac_utils.h               |   52 +
 drivers/gpu/drm/sti/sti_vtg.c                      |  467 +++++++++
 drivers/gpu/drm/sti/sti_vtg.h                      |   20 +
 drivers/gpu/drm/sti/sti_vtg_utils.c                |   99 ++
 drivers/gpu/drm/sti/sti_vtg_utils.h                |   29 +
 44 files changed, 10479 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpu/st,stih4xx.txt
 create mode 100644 drivers/gpu/drm/sti/Kconfig
 create mode 100644 drivers/gpu/drm/sti/Makefile
 create mode 100644 drivers/gpu/drm/sti/sti_compositor.c
 create mode 100644 drivers/gpu/drm/sti/sti_compositor.h
 create mode 100644 drivers/gpu/drm/sti/sti_ddc.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_connector.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_connector.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_crtc.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_crtc.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_drv.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_drv.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_encoder.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_encoder.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_plane.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_plane.h
 create mode 100644 drivers/gpu/drm/sti/sti_gdp.c
 create mode 100644 drivers/gpu/drm/sti/sti_gdp.h
 create mode 100644 drivers/gpu/drm/sti/sti_hda.c
 create mode 100644 drivers/gpu/drm/sti/sti_hda.h
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi.c
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi.h
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c
 create mode 100644 drivers/gpu/drm/sti/sti_hqvdp.c
 create mode 100644 drivers/gpu/drm/sti/sti_hqvdp.h
 create mode 100644 drivers/gpu/drm/sti/sti_hqvdp_lut.h
 create mode 100644 drivers/gpu/drm/sti/sti_layer.c
 create mode 100644 drivers/gpu/drm/sti/sti_layer.h
 create mode 100644 drivers/gpu/drm/sti/sti_mixer.c
 create mode 100644 drivers/gpu/drm/sti/sti_mixer.h
 create mode 100644 drivers/gpu/drm/sti/sti_tvout.c
 create mode 100644 drivers/gpu/drm/sti/sti_tvout.h
 create mode 100644 drivers/gpu/drm/sti/sti_vid.c
 create mode 100644 drivers/gpu/drm/sti/sti_vid.h
 create mode 100644 drivers/gpu/drm/sti/sti_vtac_rx.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtac_tx.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtac_utils.h
 create mode 100644 drivers/gpu/drm/sti/sti_vtg.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtg.h
 create mode 100644 drivers/gpu/drm/sti/sti_vtg_utils.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtg_utils.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/19 drm: sti: add bindings for DRM driver

Add DRM/KMS driver bindings documentation.
Describe the required properties for each of the hardware IPs drivers.

---
 .../devicetree/bindings/gpu/st,stih4xx.txt         | 187 +++++++++++++++++++++
 1 file changed, 187 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpu/st,stih4xx.txt
Documentation/devicetree/bindings/gpu/st,stih4xx.txt new file +187 -0
new file mode 100644
index 0000000..4755760
@@ -0,0 +1,187 @@
+STMicroelectronics stih4xx platforms
+
+- sti-display-subsystem: Master device for DRM sub-components
+  This device must be the parent of all the sub-components and is responsible
+  of bind them.
+  Required properties:
+  - compatible: "st,sti-display-subsystem"
+  - ranges
+
+- sti-compositor: frame compositor engine
+  Required properties:
+  - compatible: "st,stih<chip>-compositor"
+  - reg: Physical base address of the IP registers and length of memory mapped region.
+  - clocks: from common clock binding: handle hardware IP needed clocks, the
+    number of clocks may depend of the SoC type.
+    See ../clocks/clock-bindings.txt for details.
+  - clock-names: names of the clocks listed in clocks property in the same
+    order.
+  - resets: resets to be used by the device
+    See ../reset/reset.txt for details.
+  - reset-names: names of the resets listed in resets property in the same
+    order.
+
+- sti-vtac: video timing advanced inter dye communication Rx and TX
+  Required properties:
+  - compatible: "st,stih<chip>-vtac-rx" or "st,stih<chip>-vtac-tx"
+  - reg: Physical base address of the IP registers and length of memory mapped region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+    the same order.
+  - clocks: from common clock binding: handle hardware IP needed clocks, the
+    number of clocks may depend of the SoC type.
+    See ../clocks/clock-bindings.txt for details.
+  - clock-names: names of the clocks listed in clocks property in the same
+    order.
+  - vtac-rx-aux: Must be set to indicated that the device is dedicated to
+    auxillary data path if not the device is used for main data path.
+  - vtac-tx-aux: Must be set to indicated that the device is dedicated to
+    auxillary data path if not the device is used for main data path.
+
+- sti-vtg: video timing generator
+  Required properties:
+  - compatible: "st,stih<chip>-vtg"
+  - reg: Physical base address of the IP registers and length of memory mapped region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+    the same order.
+  - interrupts : VTG interrupt number to the CPU.
+  - interrupt-names: name of the interrupts listed in interrupts property in
+    the same order.
+  - vtg-aux: Must be set to indicated that the device is dedicated to
+    auxillary data path if not the device is used for main data path.
+
+- sti-tvout: video out hardware block
+  Required properties:
+  - compatible: "st,stih<chip>-tvout"
+  - reg: Physical base address of the IP registers and length of memory mapped region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+    the same order.
+  - resets: resets to be used by the device
+    See ../reset/reset.txt for details.
+  - reset-names: names of the resets listed in resets property in the same
+    order.
+  - ranges: to allow probing of subdevices
+
+- sti-hdmi: hdmi output block
+  Required properties:
+  - compatible: "st,stih<chip>-hdmi";
+  - reg: Physical base address of the IP registers and length of memory mapped region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+    the same order.
+  - interrupts : HDMI interrupt number to the CPU.
+  - interrupt-names: name of the interrupts listed in interrupts property in
+    the same order
+  - clocks: from common clock binding: handle hardware IP needed clocks, the
+    number of clocks may depend of the SoC type.
+  - clock-names: names of the clocks listed in clocks property in the same
+    order.
+  - hdmi,hpd-gpio: gpio id to detect if an hdmi cable is plugged or not.
+
+sti-hda:
+  Required properties:
+  - compatible: "st,stih<chip>-hda"
+  - reg: Physical base address of the IP registers and length of memory mapped region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+    the same order.
+  - clocks: from common clock binding: handle hardware IP needed clocks, the
+    number of clocks may depend of the SoC type.
+    See ../clocks/clock-bindings.txt for details.
+  - clock-names: names of the clocks listed in clocks property in the same
+    order.
+
+Example:
+
+/ {
+	...
+	sti-display-subsystem {
+		compatible = "st,sti-display-subsystem";
+		ranges;
+
+		sti-compositor@fd340000 {
+			compatible	= "st,stih416-compositor";
+			reg		= <0xfd340000 0x1000>;
+			clock-names	= "compo_main", "compo_aux",
+			                  "pix_main", "pix_aux";
+			clocks          = <&CLK_M_A2_DIV1 CLK_M_COMPO_MAIN>, <&CLK_M_A2_DIV1 CLK_M_COMPO_AUX>,
+					  <&CLOCKGEN_C_VCC CLK_S_PIX_MAIN>, <&CLOCKGEN_C_VCC CLK_S_PIX_AUX>;
+			reset-names     = "compo-main", "compo-aux";
+			resets          = <&softreset STIH416_COMPO_M_SOFTRESET>, <&softreset STIH416_COMPO_A_SOFTRESET>;
+		};
+
+		sti-vtac-rx-main@fee82800 {
+			compatible	= "st,stih416-vtac-rx";
+			reg		= <0xfee82800 0x200>;
+			clock-names     = "vtac_main_phy";
+			clocks          = <&CLK_M_A2_DIV0 CLK_M_VTAC_MAIN_PHY>;
+		};
+
+		sti-vtac-rx-aux@fee82a00 {
+			compatible	= "st,stih416-vtac-rx";
+			reg		= <0xfee82a00 0x200>;
+			clock-names     = "vtac_aux_phy";
+			clocks          = <&CLK_M_A2_DIV0 CLK_M_VTAC_AUX_PHY>;
+			vtac-rx-aux;
+		};
+
+		sti-vtac-tx-main@fd349000 {
+			compatible	= "st,stih416-vtac-tx";
+			reg		= <0xfd349000 0x200>, <0xfd320000 0x10000>;
+			reg-names	= "vtac-tx", "vtac-phy";
+			clock-names     = "vtac_tx_phy";
+			clocks           = <&CLK_S_A1_HS CLK_S_VTAC_TX_PHY>;
+		};
+
+		sti-vtac-tx-aux@fd349200 {
+			compatible	= "st,stih416-vtac-tx";
+			reg		= <0xfd349200 0x200>, <0xfd320000 0x10000>;
+			reg-names	= "vtac-tx", "vtac-phy";
+			clock-names     = "vtac_tx_phy";
+			clocks          = <&CLK_S_A1_HS CLK_S_VTAC_TX_PHY>;
+			vtac-tx-aux;
+		};
+
+		sti-vtg-main@fd348000 {
+			compatible	= "st,stih416-vtg";
+			reg		= <0xfd348000 0x400>, <0xfe85A800 0x300>;
+			reg-names	= "master", "slave";
+			interrupts	= <GIC_SPI 175 IRQ_TYPE_NONE>;
+			interrupt-names = "synchro_irq";
+		};
+
+		sti-vtg-aux@fd348400 {
+			compatible	= "st,stih416-vtg";
+			reg		= <0xfd348400 0x400>, <0xfe858200 0x300>;
+			reg-names	= "master", "slave";
+			interrupts	= <GIC_SPI 176 IRQ_TYPE_NONE>;
+			interrupt-names = "synchro_irq";
+			vtg-aux;
+		};
+
+		sti-tvout@fe000000 {
+			compatible	= "st,stih416-tvout";
+			reg		= <0xfe000000 0x1000>, <0xfe85a000 0x400>, <0xfe830000 0x10000>;
+			reg-names	= "tvout-reg", "hda-reg", "syscfg";
+			reset-names     = "tvout";
+			resets          = <&softreset STIH416_HDTVOUT_SOFTRESET>;
+		};
+
+		sti-hdmi@fe85c000 {
+			compatible	= "st,stih416-hdmi";
+			reg		= <0xfe85c000 0x1000>, <0xfe830000 0x10000>;
+			reg-names	= "hdmi-reg", "syscfg";
+			interrupts	= <GIC_SPI 173 IRQ_TYPE_NONE>;
+			interrupt-names	= "hdmi_irq";
+		        clock-names	= "hdmi_pix", "hdmi_tmds", "hdmi_phy", "hdmi_audio";
+			clocks          = <&CLOCKGEN_C_VCC CLK_S_PIX_HDMI>, <&CLOCKGEN_C_VCC CLK_S_TMDS_HDMI>, <&CLOCKGEN_C_VCC CLK_S_HDMI_REJECT_PLL>, <&CLOCKGEN_B1 CLK_S_PCM_0>;
+			hdmi,hpd-gpio	= <&PIO2 5>;
+		};
+
+		sti-hda@fe85a000 {
+			compatible	= "st,stih416-hda";
+			reg		= <0xfe85a000 0x400>, <0xfe83085c 0x4>;
+			reg-names	= "hda-reg", "video-dacs-ctrl";
+			clock-names	= "hda_pix", "hda_hddac";
+			clocks          = <&CLOCKGEN_C_VCC CLK_S_PIX_HD>, <&CLOCKGEN_C_VCC CLK_S_HDDAC>;
+		};
+	};
+	...
+};
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/19 drm: sti: add VTG driver

In reply to Benjamin Gaignard

Video Time Generator drivers are used to synchronize the compositor
and tvout hardware IPs by providing line count, sample count,
synchronization signals (HSYNC, VSYNC) and top and bottom fields indication. VTG are used by pair for each data path (main or auxiliary): one for master and one for slave.

---
 drivers/gpu/drm/Kconfig             |   2 +
 drivers/gpu/drm/Makefile            |   1 +
 drivers/gpu/drm/sti/Kconfig         |  11 +
 drivers/gpu/drm/sti/Makefile        |   3 +
 drivers/gpu/drm/sti/sti_vtg.c       | 467 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_vtg.h       |  20 ++
 drivers/gpu/drm/sti/sti_vtg_utils.c |  99 ++++++++
 drivers/gpu/drm/sti/sti_vtg_utils.h |  29 +++
 8 files changed, 632 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/Kconfig
 create mode 100644 drivers/gpu/drm/sti/Makefile
 create mode 100644 drivers/gpu/drm/sti/sti_vtg.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtg.h
 create mode 100644 drivers/gpu/drm/sti/sti_vtg_utils.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtg_utils.h
drivers/gpu/drm/Kconfig +2 -0
index d1cc2f6..0e30029 100644
@@ -201,3 +201,5 @@ source "drivers/gpu/drm/tegra/Kconfig"
 source "drivers/gpu/drm/panel/Kconfig"
 
 source "drivers/gpu/drm/bridge/Kconfig"
+
+source "drivers/gpu/drm/sti/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index 5e792b0..44f7b17 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_QXL) += qxl/
 obj-$(CONFIG_DRM_BOCHS) += bochs/
 obj-$(CONFIG_DRM_MSM) += msm/
 obj-$(CONFIG_DRM_TEGRA) += tegra/
+obj-$(CONFIG_DRM_STI) += sti/
 obj-y			+= i2c/
 obj-y			+= panel/
 obj-y			+= bridge/
drivers/gpu/drm/sti/Kconfig new file +11 -0
new file mode 100644
index 0000000..3fff278
@@ -0,0 +1,11 @@
+config DRM_STI
+	bool "DRM Support for STMicroelectronics SoC stiH41x Series"
+	depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM)
+	help
+	  Choose this option to enable DRM on STM stiH41x chipset
+
+config VTG_STI
+	bool "Video Timing Generator for STMicroelectronics SoC stiH41x Series"
+	depends on DRM_STI
+	help
+	  Choose this option to enable VTG on STM stiH41x chipset
drivers/gpu/drm/sti/Makefile new file +3 -0
new file mode 100644
index 0000000..33216e1
@@ -0,0 +1,3 @@
+ccflags-y := -Iinclude/drm
+
+obj-$(CONFIG_VTG_STI) += sti_vtg.o sti_vtg_utils.o
drivers/gpu/drm/sti/sti_vtg.c new file +467 -0

467 lines not on this page · raw message

drivers/gpu/drm/sti/sti_vtg.h new file +20 -0
new file mode 100644
index 0000000..da67eb3
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard <[email protected]> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_VTG_H_
+#define _STI_VTG_H_
+
+#include <linux/platform_device.h>
+#include <drm/drmP.h>
+
+extern struct device *vtg_main;
+extern struct device *vtg_aux;
+
+int vtg_set_config(struct device *dev, const struct drm_display_mode *mode);
+int vtg_register_client(struct device *dev, struct notifier_block *nb);
+int vtg_unregister_client(struct device *dev, struct notifier_block *nb);
+
+#endif
drivers/gpu/drm/sti/sti_vtg_utils.c new file +99 -0

99 lines not on this page · raw message

drivers/gpu/drm/sti/sti_vtg_utils.h new file +29 -0
new file mode 100644
index 0000000..fea2852
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Authors: Benjamin Gaignard <[email protected]>
+ *          Fabien Dessenne <[email protected]>
+ *          for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_VTG_UTILS_H_
+#define _STI_VTG_UTILS_H_
+
+#include <drm/drmP.h>
+
+#define WAIT_NEXT_VSYNC_MS      50 /*ms*/
+
+#define VTG_MAIN                0
+#define VTG_AUX                 1
+
+#define VTG_TOP_FIELD_EVENT     1
+#define VTG_BOTTOM_FIELD_EVENT  2
+
+int sti_vtg_setconfig(int main_aux, const struct drm_display_mode *mode);
+int sti_vtg_register_client(int main_aux, struct notifier_block *nb);
+int sti_vtg_unregister_client(int main_aux, struct notifier_block *nb);
+
+u32 sti_vtg_get_line_number(struct drm_display_mode mode, int y);
+u32 sti_vtg_get_pixel_number(struct drm_display_mode mode, int x);
+
+#endif
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 3/19 drm: sti: add VTAC drivers

In reply to Benjamin Gaignard

Video Trafic Advance Communication Rx and Tx drivers are designed for inter-die communication.

Both Tx and Rx must share the same configuration to communicate that is why vtac_mode[] is shared in sti_vtac_utils.h.

---
 drivers/gpu/drm/sti/Kconfig          |   6 ++
 drivers/gpu/drm/sti/Makefile         |   1 +
 drivers/gpu/drm/sti/sti_vtac_rx.c    | 167 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_vtac_tx.c    | 182 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_vtac_utils.h |  52 ++++++++++
 5 files changed, 408 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_vtac_rx.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtac_tx.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtac_utils.h
drivers/gpu/drm/sti/Kconfig +6 -0
index 3fff278..cdd5119 100644
@@ -4,6 +4,12 @@ config DRM_STI
 	help
 	  Choose this option to enable DRM on STM stiH41x chipset
 
+config VTAC_STI
+	tristate "Video Trafic Advance Communication Rx and Tx for STMicroelectronics SoC stiH41x Series"
+	depends on DRM_STI
+	help
+	  Choose this option to enable VTAC on STM stiH41x chipset
+
 config VTG_STI
 	bool "Video Timing Generator for STMicroelectronics SoC stiH41x Series"
 	depends on DRM_STI
drivers/gpu/drm/sti/Makefile +1 -0
index 33216e1..79fdcb6 100644
@@ -1,3 +1,4 @@
 ccflags-y := -Iinclude/drm
 
+obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
 obj-$(CONFIG_VTG_STI) += sti_vtg.o sti_vtg_utils.o
drivers/gpu/drm/sti/sti_vtac_rx.c new file +167 -0

167 lines not on this page · raw message

drivers/gpu/drm/sti/sti_vtac_tx.c new file +182 -0

182 lines not on this page · raw message

drivers/gpu/drm/sti/sti_vtac_utils.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 4/19 drm: sti: add HDMI driver

In reply to Benjamin Gaignard

Add driver for HDMI ouput

---
 drivers/gpu/drm/sti/Makefile               |   5 +
 drivers/gpu/drm/sti/sti_hdmi.c             | 530 +++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_hdmi.h             | 195 +++++++++++
 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c | 398 ++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c | 224 ++++++++++++
 5 files changed, 1352 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi.c
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi.h
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c
drivers/gpu/drm/sti/Makefile +5 -0
index 79fdcb6..5295fc7 100644
@@ -1,4 +1,9 @@
 ccflags-y := -Iinclude/drm
 
+stidrm-y := sti_hdmi.o \
+			sti_hdmi_tx3g0c55phy.o \
+			sti_hdmi_tx3g4c28phy.o
+
 obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
 obj-$(CONFIG_VTG_STI) += sti_vtg.o sti_vtg_utils.o
+obj-$(CONFIG_DRM_STI) += stidrm.o
\ No newline at end of file
drivers/gpu/drm/sti/sti_hdmi.c new file +530 -0

530 lines not on this page · raw message

drivers/gpu/drm/sti/sti_hdmi.h new file +195 -0

195 lines not on this page · raw message

drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c new file +398 -0

398 lines not on this page · raw message

drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c new file +224 -0

224 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 5/19 drm: sti: add I2C client driver for HDMI

In reply to Benjamin Gaignard

Add I2C client driver to retrieve EDID.

---
 drivers/gpu/drm/sti/Makefile  |  3 ++-
 drivers/gpu/drm/sti/sti_ddc.c | 56 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/sti/sti_ddc.c
drivers/gpu/drm/sti/Makefile +2 -1
index 5295fc7..6c474eb 100644
@@ -2,7 +2,8 @@ ccflags-y := -Iinclude/drm
 
 stidrm-y := sti_hdmi.o \
 			sti_hdmi_tx3g0c55phy.o \
-			sti_hdmi_tx3g4c28phy.o
+			sti_hdmi_tx3g4c28phy.o \
+			sti_ddc.o
 
 obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
 obj-$(CONFIG_VTG_STI) += sti_vtg.o sti_vtg_utils.o
drivers/gpu/drm/sti/sti_ddc.c new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.9.1
#6 lore raw

PATCH v2 6/19 drm: sti: add HDA driver

In reply to Benjamin Gaignard

Add driver to support analog TV ouput.

---
 drivers/gpu/drm/sti/Makefile  |   1 +
 drivers/gpu/drm/sti/sti_hda.c | 481 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 482 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_hda.c
drivers/gpu/drm/sti/Makefile +1 -0
index 6c474eb..aa69ea0 100644
@@ -3,6 +3,7 @@ ccflags-y := -Iinclude/drm
 stidrm-y := sti_hdmi.o \
 			sti_hdmi_tx3g0c55phy.o \
 			sti_hdmi_tx3g4c28phy.o \
+			sti_hda.o \
 			sti_ddc.o
 
 obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
drivers/gpu/drm/sti/sti_hda.c new file +481 -0

481 lines not on this page · raw message

Signature · 1 line
1.9.1
#7 lore raw

PATCH v2 7/19 drm: sti: add TVOut driver

In reply to Benjamin Gaignard

TVout hardware block is responsible to dispatch the data flow coming from compositor block to any of the output (HDMI or Analog TV). It control when output are start/stop and configure according the require flow path.

---
 drivers/gpu/drm/sti/Makefile    |   3 +-
 drivers/gpu/drm/sti/sti_hda.c   | 372 +++++++++++++++++++++
 drivers/gpu/drm/sti/sti_hda.h   |  14 +
 drivers/gpu/drm/sti/sti_hdmi.c  | 542 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_hdmi.h  |   3 +
 drivers/gpu/drm/sti/sti_tvout.c | 703 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_tvout.h | 105 ++++++
 7 files changed, 1741 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/sti/sti_hda.h
 create mode 100644 drivers/gpu/drm/sti/sti_tvout.c
 create mode 100644 drivers/gpu/drm/sti/sti_tvout.h
drivers/gpu/drm/sti/Makefile +2 -1
index aa69ea0..45536c3 100644
@@ -1,6 +1,7 @@
 ccflags-y := -Iinclude/drm
 
-stidrm-y := sti_hdmi.o \
+stidrm-y :=	sti_tvout.o \
+			sti_hdmi.o \
 			sti_hdmi_tx3g0c55phy.o \
 			sti_hdmi_tx3g4c28phy.o \
 			sti_hda.o \
drivers/gpu/drm/sti/sti_hda.c +372 -0

384 lines not on this page · raw message

drivers/gpu/drm/sti/sti_hda.h new file +14 -0
new file mode 100644
index 0000000..e88b30e
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2014
+ * Authors: Fabien Dessenne <[email protected]> for STMicroelectronics.
+ * License terms: GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_HDA_H_
+#define _STI_HDA_H_
+
+#include "sti_tvout.h"
+
+struct sti_tvout_connector *sti_hda_create(struct sti_tvout *tvout);
+
+#endif
drivers/gpu/drm/sti/sti_hdmi.c +542 -0

548 lines not on this page · raw message

drivers/gpu/drm/sti/sti_hdmi.h +3 -0
index c14c683..ed90a2c 100644
@@ -11,6 +11,8 @@
 
 #include <drm/drmP.h>
 
+#include "sti_tvout.h"
+
 /* HDMI v2.9 macro cell */
 #define HDMI_CFG                        0x0000
 #define HDMI_INT_EN                     0x0004
@@ -181,6 +183,7 @@ struct hdmi_phy_config {
 	u32 config[4];
 };
 
+struct sti_tvout_connector *sti_hdmi_create(struct sti_tvout *tvout);
 void sti_hdmi_attach_ddc_client(struct i2c_client *ddc);
 
 int sti_hdmi_tx3g0c55phy_start(struct sti_hdmi *hdmi);
drivers/gpu/drm/sti/sti_tvout.c new file +703 -0

703 lines not on this page · raw message

drivers/gpu/drm/sti/sti_tvout.h new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
1.9.1
#8 lore raw

PATCH v2 8/19 drm: sti: add sti layer interface definition

In reply to Benjamin Gaignard

STI hardware have various input sub-devices before mixing block. Each type of sub-device have different capabilities for scaling, filtering or accepted pixel format.
This layer interface abstract those differences and make the interaction with compositor more simple.

---
 drivers/gpu/drm/sti/sti_layer.h | 104 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_layer.h
drivers/gpu/drm/sti/sti_layer.h new file +104 -0
new file mode 100644
index 0000000..ed8386a
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Authors: Benjamin Gaignard <[email protected]>
+ *          Fabien Dessenne <[email protected]>
+ *          for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_LAYER_H_
+#define _STI_LAYER_H_
+
+#include <drm/drmP.h>
+
+#define to_sti_layer(x) container_of(x, struct sti_layer, plane)
+
+#define STI_LAYER_TYPE_SHIFT 8
+#define STI_LAYER_TYPE_MASK (~((1<<STI_LAYER_TYPE_SHIFT)-1))
+
+
+enum sti_layer_type {
+	STI_GDP = 1 << STI_LAYER_TYPE_SHIFT,
+	STI_VID = 2 << STI_LAYER_TYPE_SHIFT,
+	STI_CUR = 3 << STI_LAYER_TYPE_SHIFT,
+	STI_BCK = 4 << STI_LAYER_TYPE_SHIFT
+};
+
+enum sti_layer_id_of_type {
+	STI_ID_0 = 0,
+	STI_ID_1 = 1,
+	STI_ID_2 = 2,
+	STI_ID_3 = 3
+};
+
+enum sti_layer_desc {
+	STI_GDP_0	= STI_GDP | STI_ID_0,
+	STI_GDP_1	= STI_GDP | STI_ID_1,
+	STI_GDP_2	= STI_GDP | STI_ID_2,
+	STI_GDP_3	= STI_GDP | STI_ID_3,
+	STI_VID_0	= STI_VID | STI_ID_0,
+	STI_VID_1	= STI_VID | STI_ID_1,
+	STI_CURSOR	= STI_CUR,
+	STI_BACK	= STI_BCK
+};
+
+struct sti_fps_info {
+	bool output;
+	int curr_frame_counter;
+	int last_frame_counter;
+	struct timespec last_timestamp;
+};
+
+/*
+ * STI layer structure
+ *
+ * @plane:		drm plane it is bound to (if any)
+ * @fb:			drm fb it is bound to
+ * @mode:		display mode
+ * @desc:		layer type & id
+ * @zorder:		layer z-order
+ * @enabled:		to know if the layer is active or not
+ * @src_x src_y:	coordinates of the input (fb) area
+ * @src_w src_h:	size of the input (fb) area
+ * @dst_x dst_y:	coordinates of the output (crtc) area
+ * @dst_w dst_h:	size of the output (crtc) area
+ * @format:		format
+ * @pitches:		pitch of 'planes' (eg: Y, U, V)
+ * @offsets:		offset of 'planes'
+ * @paddr:		physical address of the input buffer
+ * @fps_info:		frame per second info
+ */
+struct sti_layer {
+	struct drm_plane plane;
+	struct drm_framebuffer *fb;
+	struct drm_display_mode *mode;
+	enum sti_layer_desc desc;
+	int zorder;
+	bool enabled;
+	int src_x, src_y;
+	int src_w, src_h;
+	int dst_x, dst_y;
+	int dst_w, dst_h;
+	uint32_t format;
+	int pitches[4];
+	int offsets[4];
+	dma_addr_t paddr;
+	struct sti_fps_info fps_info;
+};
+
+struct sti_layer *sti_layer_create(struct device *dev, int desc,
+			void __iomem *baseaddr);
+int sti_layer_prepare(struct sti_layer *layer, struct drm_framebuffer *fb,
+			struct drm_display_mode *mode,
+			int dest_x, int dest_y,
+			int dest_w, int dest_h,
+			int src_x, int src_y,
+			int src_w, int src_h);
+int sti_layer_commit(struct sti_layer *layer);
+int sti_layer_disable(struct sti_layer *layer);
+const uint32_t *sti_layer_get_formats(struct sti_layer *layer);
+int sti_layer_get_nb_formats(struct sti_layer *layer);
+struct sti_layer *sti_layer_find_layer(struct sti_layer *layer[],
+			enum sti_layer_desc desc);
+const char *sti_layer_to_str(struct sti_layer *layer);
+#endif
Signature · 1 line
1.9.1
#9 lore raw

PATCH v2 9/19 drm: sti: add GDP layer

In reply to Benjamin Gaignard

Generic Display Pipeline are one of the compositor input sub-devices. GDP are dedicated to graphic input like RGB plans.

---
 drivers/gpu/drm/sti/Makefile    |   3 +-
 drivers/gpu/drm/sti/sti_gdp.c   | 491 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_gdp.h   |  73 ++++++
 drivers/gpu/drm/sti/sti_layer.h |   5 +
 4 files changed, 571 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/sti/sti_gdp.c
 create mode 100644 drivers/gpu/drm/sti/sti_gdp.h
drivers/gpu/drm/sti/Makefile +2 -1
index 45536c3..cc04475 100644
@@ -1,10 +1,11 @@
 ccflags-y := -Iinclude/drm
 
-stidrm-y :=	sti_tvout.o \
+stidrm-y := sti_tvout.o \
 			sti_hdmi.o \
 			sti_hdmi_tx3g0c55phy.o \
 			sti_hdmi_tx3g4c28phy.o \
 			sti_hda.o \
+			sti_gdp.o \
 			sti_ddc.o
 
 obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
drivers/gpu/drm/sti/sti_gdp.c new file +491 -0

491 lines not on this page · raw message

drivers/gpu/drm/sti/sti_gdp.h new file +73 -0

73 lines not on this page · raw message

drivers/gpu/drm/sti/sti_layer.h +5 -0
index ed8386a..45cd1ea 100644
@@ -10,6 +10,7 @@
 #define _STI_LAYER_H_
 
 #include <drm/drmP.h>
+#include "sti_gdp.h"
 
 #define to_sti_layer(x) container_of(x, struct sti_layer, plane)
 
@@ -67,6 +68,7 @@ struct sti_fps_info {
  * @offsets:		offset of 'planes'
  * @paddr:		physical address of the input buffer
  * @fps_info:		frame per second info
+ * @gdp:                related GDP (if the layer is a GDP)
  */
 struct sti_layer {
 	struct drm_plane plane;
@@ -74,6 +76,7 @@ struct sti_layer {
 	struct drm_display_mode *mode;
 	enum sti_layer_desc desc;
 	int zorder;
+	int mixer_id;
 	bool enabled;
 	int src_x, src_y;
 	int src_w, src_h;
@@ -84,12 +87,14 @@ struct sti_layer {
 	int offsets[4];
 	dma_addr_t paddr;
 	struct sti_fps_info fps_info;
+	struct sti_gdp *gdp;
 };
 
 struct sti_layer *sti_layer_create(struct device *dev, int desc,
 			void __iomem *baseaddr);
 int sti_layer_prepare(struct sti_layer *layer, struct drm_framebuffer *fb,
 			struct drm_display_mode *mode,
+			int mixer_id,
 			int dest_x, int dest_y,
 			int dest_w, int dest_h,
 			int src_x, int src_y,
Signature · 1 line
1.9.1
#10 lore raw

PATCH v2 10/19 drm: sti: add VID layer

In reply to Benjamin Gaignard

VIDeo plug are one of the compositor input sub-devices. VID are dedicated to video inputs like YUV plans.

---
 drivers/gpu/drm/sti/Makefile    |   1 +
 drivers/gpu/drm/sti/sti_layer.h |   4 ++
 drivers/gpu/drm/sti/sti_vid.c   | 138 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_vid.h   |  33 ++++++++++
 4 files changed, 176 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_vid.c
 create mode 100644 drivers/gpu/drm/sti/sti_vid.h
drivers/gpu/drm/sti/Makefile +1 -0
index cc04475..b9a3b74 100644
@@ -6,6 +6,7 @@ stidrm-y := sti_tvout.o \
 			sti_hdmi_tx3g4c28phy.o \
 			sti_hda.o \
 			sti_gdp.o \
+			sti_vid.o \
 			sti_ddc.o
 
 obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
drivers/gpu/drm/sti/sti_layer.h +4 -0
index 45cd1ea..bf3a14f 100644
@@ -11,6 +11,7 @@
 
 #include <drm/drmP.h>
 #include "sti_gdp.h"
+#include "sti_vid.h"
 
 #define to_sti_layer(x) container_of(x, struct sti_layer, plane)
 
@@ -58,6 +59,7 @@ struct sti_fps_info {
  * @mode:		display mode
  * @desc:		layer type & id
  * @zorder:		layer z-order
+ * @mixer_id:           id of the mixer used to display the layer
  * @enabled:		to know if the layer is active or not
  * @src_x src_y:	coordinates of the input (fb) area
  * @src_w src_h:	size of the input (fb) area
@@ -69,6 +71,7 @@ struct sti_fps_info {
  * @paddr:		physical address of the input buffer
  * @fps_info:		frame per second info
  * @gdp:                related GDP (if the layer is a GDP)
+ * @vid:                related VID (if the layer is a VID/VDP)
  */
 struct sti_layer {
 	struct drm_plane plane;
@@ -88,6 +91,7 @@ struct sti_layer {
 	dma_addr_t paddr;
 	struct sti_fps_info fps_info;
 	struct sti_gdp *gdp;
+	struct sti_vid *vid;
 };
 
 struct sti_layer *sti_layer_create(struct device *dev, int desc,
drivers/gpu/drm/sti/sti_vid.c new file +138 -0

138 lines not on this page · raw message

drivers/gpu/drm/sti/sti_vid.h new file +33 -0
new file mode 100644
index 0000000..dd4fd95
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Fabien Dessenne <[email protected]> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_VID_H_
+#define _STI_VID_H_
+
+/*
+ * STI VID structure
+ *
+ * @device:		driver device
+ * @regs:               subdevice register
+ * @get_formats:	get VID supported formats
+ * @get_nb_formats:	get number of format supported
+ * @prepare:		prepare VID before rendering
+ * @commit:		set VID for rendering
+ * @disable:		disable VID
+ */
+struct sti_vid {
+	struct device *dev;
+	void __iomem *regs;
+	const uint32_t* (*get_formats)(void);
+	int (*get_nb_formats)(void);
+	int (*prepare)(void *layer, bool first_prepare);
+	int (*commit)(void *layer);
+	int (*disable)(void *layer);
+};
+
+struct sti_vid *sti_vid_create(struct device *dev, void __iomem *baseaddr);
+
+#endif
Signature · 1 line
1.9.1
#11 lore raw

PATCH v2 11/19 drm: sti: add Mixer

In reply to Benjamin Gaignard

Mixer hardware IP is responsible of mixing the different inputs layers. Z-order is managed by the mixer.
We could 2 mixers: one for main path and one for auxilary path

---
 drivers/gpu/drm/sti/Makefile    |   1 +
 drivers/gpu/drm/sti/sti_mixer.c | 241 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_mixer.h |  52 +++++++++
 3 files changed, 294 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_mixer.c
 create mode 100644 drivers/gpu/drm/sti/sti_mixer.h
drivers/gpu/drm/sti/Makefile +1 -0
index b9a3b74..3d52d2a 100644
@@ -5,6 +5,7 @@ stidrm-y := sti_tvout.o \
 			sti_hdmi_tx3g0c55phy.o \
 			sti_hdmi_tx3g4c28phy.o \
 			sti_hda.o \
+			sti_mixer.o \
 			sti_gdp.o \
 			sti_vid.o \
 			sti_ddc.o
drivers/gpu/drm/sti/sti_mixer.c new file +241 -0

241 lines not on this page · raw message

drivers/gpu/drm/sti/sti_mixer.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.9.1
#12 lore raw

PATCH v2 12/19 drm: sti: add Compositor

In reply to Benjamin Gaignard

Compositor control all the input sub-devices and the mixer. It is the main entry point for composition.
Layer interface is used to control the layer.

---
 drivers/gpu/drm/sti/Kconfig          |   1 +
 drivers/gpu/drm/sti/Makefile         |   2 +
 drivers/gpu/drm/sti/sti_compositor.c | 187 +++++++++++++++++++++
 drivers/gpu/drm/sti/sti_compositor.h |  84 ++++++++++
 drivers/gpu/drm/sti/sti_layer.c      | 309 +++++++++++++++++++++++++++++++++++
 5 files changed, 583 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_compositor.c
 create mode 100644 drivers/gpu/drm/sti/sti_compositor.h
 create mode 100644 drivers/gpu/drm/sti/sti_layer.c
drivers/gpu/drm/sti/Kconfig +1 -0
index cdd5119..9c1218c 100644
@@ -1,6 +1,7 @@
 config DRM_STI
 	bool "DRM Support for STMicroelectronics SoC stiH41x Series"
 	depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM)
+	select DRM_KMS_CMA_HELPER
 	help
 	  Choose this option to enable DRM on STM stiH41x chipset
 
drivers/gpu/drm/sti/Makefile +2 -0
index 3d52d2a..3b804d4 100644
@@ -5,6 +5,8 @@ stidrm-y := sti_tvout.o \
 			sti_hdmi_tx3g0c55phy.o \
 			sti_hdmi_tx3g4c28phy.o \
 			sti_hda.o \
+			sti_compositor.o \
+			sti_layer.o \
 			sti_mixer.o \
 			sti_gdp.o \
 			sti_vid.o \
drivers/gpu/drm/sti/sti_compositor.c new file +187 -0

187 lines not on this page · raw message

drivers/gpu/drm/sti/sti_compositor.h new file +84 -0

84 lines not on this page · raw message

drivers/gpu/drm/sti/sti_layer.c new file +309 -0

309 lines not on this page · raw message

Signature · 1 line
1.9.1
#13 lore raw

PATCH v2 13/19 drm: sti: add debug to GDP

In reply to Benjamin Gaignard

Allow to get more detailed debug information on GDP

---
 drivers/gpu/drm/sti/sti_drm_drv.h |  36 ++++++
 drivers/gpu/drm/sti/sti_gdp.c     | 235 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_gdp.h     |   2 +
 3 files changed, 273 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_drm_drv.h
drivers/gpu/drm/sti/sti_drm_drv.h new file +36 -0
new file mode 100644
index 0000000..5660196
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard <[email protected]> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_DRM_DRV_H_
+#define _STI_DRM_DRV_H_
+
+#include <linux/platform_device.h>
+
+#include <drm/drmP.h>
+
+#include "sti_compositor.h"
+#include "sti_tvout.h"
+
+/*
+ * STI drm private structure
+ * This structure is stored as private in the drm_device
+ *
+ * @compo:                 compositor
+ * @tvout:                 TV OUT
+ * @pageflip_evt_list:     list of pending page flip requests
+ * @plane_zorder_property: z-order property for CRTC planes
+ */
+struct sti_drm_private {
+	struct sti_compositor *compo;
+	struct sti_tvout *tvout;
+	struct list_head pageflip_evt_list;
+	struct drm_property *plane_zorder_property;
+};
+
+#define STI_MAX_FB_HEIGHT	4096
+#define STI_MAX_FB_WIDTH	4096
+
+#endif
drivers/gpu/drm/sti/sti_gdp.c +235 -0

289 lines not on this page · raw message

drivers/gpu/drm/sti/sti_gdp.h +2 -0
index 4f7f40b..84875ff 100644
@@ -69,5 +69,7 @@ struct sti_gdp {
 
 struct sti_gdp *sti_gdp_create(struct device *dev, int id,
 		void __iomem *baseaddr);
+int sti_gdp_dbg_show(struct seq_file *m, void *arg);
+int sti_gdp_node_dbg_show(struct seq_file *m, void *arg);
 
 #endif
Signature · 1 line
1.9.1
#14 lore raw

PATCH v2 14/19 drm: sti: add debug to VID

In reply to Benjamin Gaignard

Make VIdeo plug more verbose on what is on going

---
 drivers/gpu/drm/sti/sti_vid.c | 121 ++++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_vid.h |   1 +
 2 files changed, 122 insertions(+)
drivers/gpu/drm/sti/sti_vid.c +121 -0
index 710665d..35f60d8 100644
@@ -8,6 +8,8 @@
 
 #include "sti_vid.h"
 #include "sti_layer.h"
+#include "sti_compositor.h"
+#include "sti_drm_drv.h"
 #include "sti_vtg_utils.h"
 
 /* Registers */
@@ -49,6 +51,8 @@ static int sti_vid_prepare_layer(void *lay, bool first_prepare)
 	struct sti_layer *layer = (struct sti_layer *)lay;
 	struct sti_vid *vid = layer->vid;
 
+	dev_dbg(vid->dev, "%s %s\n", __func__, sti_layer_to_str(layer));
+
 	/* Unmask */
 	val = readl(vid->regs + VID_CTL);
 	val &= ~VID_CTL_IGNORE;
@@ -64,6 +68,8 @@ static int sti_vid_commit_layer(void *lay)
 	struct drm_display_mode *mode = layer->mode;
 	u32 ydo, xdo, yds, xds;
 
+	dev_dbg(vid->dev, "%s %s\n", __func__, sti_layer_to_str(layer));
+
 	ydo = sti_vtg_get_line_number(*mode, layer->dst_y);
 	yds = sti_vtg_get_line_number(*mode, layer->dst_y + layer->dst_h - 1);
 	xdo = sti_vtg_get_pixel_number(*mode, layer->dst_x);
@@ -81,6 +87,8 @@ static int sti_vid_disable_layer(void *lay)
 	struct sti_layer *layer = (struct sti_layer *)lay;
 	struct sti_vid *vid = layer->vid;
 
+	DRM_DEBUG_DRIVER("%s\n", sti_layer_to_str(layer));
+
 	/* Mask */
 	val = readl(vid->regs + VID_CTL);
 	val |= VID_CTL_IGNORE;
@@ -136,3 +144,116 @@ struct sti_vid *sti_vid_create(struct device *dev, void __iomem *baseaddr)
 
 	return vid;
 }
+
+static void sti_vid_dbg_ctl(struct seq_file *m, int val)
+{
+	val = val >> 30;
+	seq_puts(m, "\t");
+
+	if (!(val & 1))
+		seq_puts(m, "NOT ");
+	seq_puts(m, "ignored on main mixer - ");
+
+	if (!(val & 2))
+		seq_puts(m, "NOT ");
+	seq_puts(m, "ignored on aux mixer");
+}
+
+static void sti_vid_dbg_vpo(struct seq_file *m, int val)
+{
+	seq_printf(m, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void sti_vid_dbg_vps(struct seq_file *m, int val)
+{
+	seq_printf(m, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void sti_vid_dbg_mst(struct seq_file *m, int val)
+{
+	if (val & 1)
+		seq_puts(m, "\tBUFFER UNDERFLOW!");
+}
+
+#define DBG_DUMP(reg) \
+	seq_printf(m, "\n " #reg "\t 0x%08X", readl(vid->regs + reg))
+
+int sti_vid_dbg_show(struct seq_file *m, void *arg)
+{
+	struct drm_info_node *node = (struct drm_info_node *)m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct sti_drm_private *dev_priv = dev->dev_private;
+	struct sti_compositor *compo = dev_priv->compo;
+	enum sti_layer_desc vid_id = *(enum sti_layer_desc *)arg;
+	struct sti_layer *layer;
+	struct sti_vid *vid;
+	struct drm_plane *plane;
+	struct drm_crtc *crtc;
+	struct drm_framebuffer *fb;
+
+	if (compo == NULL) {
+		seq_puts(m, "No compo available\n");
+		goto out;
+	}
+
+	layer = sti_layer_find_layer(compo->layer, vid_id);
+	if (!layer) {
+		seq_puts(m, "Cannot find video layer\n");
+		goto out;
+	}
+	vid = layer->vid;
+
+	seq_printf(m, "\n%s (associated with the mixer_id %d)",
+			sti_layer_to_str(layer), layer->mixer_id);
+	seq_printf(m, "\t %d frame updates",
+		   layer->fps_info.curr_frame_counter);
+
+	DBG_DUMP(VID_CTL);
+	sti_vid_dbg_ctl(m, readl(vid->regs + VID_CTL));
+	DBG_DUMP(VID_ALP);
+	DBG_DUMP(VID_CLF);
+	DBG_DUMP(VID_VPO);
+	sti_vid_dbg_vpo(m, readl(vid->regs + VID_VPO));
+	DBG_DUMP(VID_VPS);
+	sti_vid_dbg_vps(m, readl(vid->regs + VID_VPS));
+	DBG_DUMP(VID_KEY1);
+	DBG_DUMP(VID_KEY2);
+	DBG_DUMP(VID_MPR0);
+	DBG_DUMP(VID_MPR1);
+	DBG_DUMP(VID_MPR2);
+	DBG_DUMP(VID_MPR3);
+	DBG_DUMP(VID_MST);
+	sti_vid_dbg_mst(m, readl(vid->regs + VID_MST));
+	DBG_DUMP(VID_BC);
+	DBG_DUMP(VID_TINT);
+	DBG_DUMP(VID_CSAT);
+
+	seq_puts(m, "\n");
+
+	plane = &layer->plane;
+	if (!plane->base.id) {
+		seq_puts(m, " Not connected to any DRM PLANE\n");
+		goto out;
+	}
+	seq_printf(m, " Connected to DRM PLANE #%d which is:\n",
+		   plane->base.id);
+
+	crtc = plane->crtc;
+	if (!crtc) {
+		seq_puts(m, "\tNot connected to any DRM CRTC\n");
+		goto out;
+	}
+	seq_printf(m, "\tConnected to DRM CRTC #%d\n", crtc->base.id);
+
+	fb = crtc->fb;
+	if (!fb) {
+		seq_puts(m, "\tNot connected to any DRM FB\n");
+		goto out;
+	}
+	seq_printf(m, "\tConnected to DRM FB #%d, %dx%d, %.4s\n",
+		   fb->base.id,
+		   fb->width, fb->height, (char *)&fb->pixel_format);
+
+out:
+	return 0;
+}
drivers/gpu/drm/sti/sti_vid.h +1 -0
index dd4fd95..6261ade 100644
@@ -29,5 +29,6 @@ struct sti_vid {
 };
 
 struct sti_vid *sti_vid_create(struct device *dev, void __iomem *baseaddr);
+int sti_vid_dbg_show(struct seq_file *m, void *arg);
 
 #endif
Signature · 1 line
1.9.1
#15 lore raw

PATCH v2 15/19 drm: sti: add debug to TVout

In reply to Benjamin Gaignard

Use debugfs to dump information about TVout

---
 drivers/gpu/drm/sti/sti_tvout.c | 181 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 181 insertions(+)
drivers/gpu/drm/sti/sti_tvout.c +181 -0
index 7c61ba1..95251c3 100644
@@ -18,6 +18,7 @@
 #include "sti_tvout.h"
 #include "sti_hdmi.h"
 #include "sti_hda.h"
+#include "sti_drm_drv.h"
 
 /* glue regsiters */
 #define TVO_CSC_MAIN_M0                  0x000
@@ -605,6 +606,186 @@ void sti_tvout_disable(struct sti_tvout *tvout,
 			connector->stop(connector);
 }
 
+/*
+ * Debugfs
+ */
+#define TVOUT_DBG_DUMP(reg) seq_printf(m, "\n %-25s 0x%08X", #reg, \
+		readl(tvout->regs + reg))
+#define TVOUT_CONNECTOR_NAME_MAX_LENGHT 10
+#define MAX_STRING_LENGTH 55
+
+static int sti_tvout_dbg_type_to_connector_name(enum sti_tvout_connector_type
+						type, char *name)
+{
+	switch (type) {
+	case STI_TVOUT_CONNECTOR_HDMI:
+		snprintf(name, TVOUT_CONNECTOR_NAME_MAX_LENGHT, "HDMI");
+		break;
+	case STI_TVOUT_CONNECTOR_HDA:
+		snprintf(name, TVOUT_CONNECTOR_NAME_MAX_LENGHT, "HD Analog");
+		break;
+	default:
+		return -1;
+	}
+
+	return 0;
+}
+
+static void tvout_dbg_vip(struct seq_file *m, int val)
+{
+	int r, g, b, tmp, mask;
+	char str[MAX_STRING_LENGTH];
+	static const char *const reorder[] = { "Y_G", "Cb_B", "Cr_R" };
+	static const char *const clipping[] = { "No", "EAV/SAV",
+		"Limited range RGB/Y", "Limited range Cb/Cr",
+		"decided by register" };
+	static const char *const round[] = { "8-bit", "10-bit", "12-bit" };
+	static const char *const input_sel[] = { "Main (color matrix enabled)",
+		"Main (color matrix by-passed)", "", "", "", "", "", "",
+		"Aux (color matrix enabled)", "Aux (color matrix by-passed)",
+		"", "", "", "", "", "Force value"
+	};
+
+	seq_puts(m, "\t");
+
+	mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_R_SHIFT;
+	r = (val & mask) >> TVO_VIP_REORDER_R_SHIFT;
+	mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_G_SHIFT;
+	g = (val & mask) >> TVO_VIP_REORDER_G_SHIFT;
+	mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_B_SHIFT;
+	b = (val & mask) >> TVO_VIP_REORDER_B_SHIFT;
+	snprintf(str, MAX_STRING_LENGTH, "Reorder: %s->%s %s->%s %s->%s",
+		 reorder[r], reorder[TVO_VIP_REORDER_CR_R_SEL],
+		 reorder[g], reorder[TVO_VIP_REORDER_Y_G_SEL],
+		 reorder[b], reorder[TVO_VIP_REORDER_CB_B_SEL]);
+	seq_printf(m, "%-55s", str);
+
+	mask = TVO_VIP_CLIP_MASK << TVO_VIP_CLIP_SHIFT;
+	tmp = (val & mask) >> TVO_VIP_CLIP_SHIFT;
+	snprintf(str, MAX_STRING_LENGTH, "Clipping: %s", clipping[tmp]);
+	seq_printf(m, "%-55s", str);
+
+	seq_printf(m, "\n%-40s", "");
+
+	mask = TVO_VIP_RND_MASK << TVO_VIP_RND_SHIFT;
+	tmp = (val & mask) >> TVO_VIP_RND_SHIFT;
+	snprintf(str, MAX_STRING_LENGTH,
+		 "Round: input data rounded to %s per component", round[tmp]);
+	seq_printf(m, "%-55s", str);
+
+	tmp = (val & TVO_VIP_SEL_INPUT_MASK);
+	snprintf(str, MAX_STRING_LENGTH, "Input selection: %s", input_sel[tmp]);
+	seq_printf(m, "%-55s", str);
+}
+
+static void tvout_dbg_hd_dac_cfg(struct seq_file *m, int val)
+{
+	seq_puts(m, "\t HD DAC ");
+	seq_puts(m, val & 1 ? "disabled" : "enabled");
+}
+
+static int tvout_dbg_show(struct seq_file *m,
+			  enum sti_tvout_connector_type type)
+{
+	struct drm_info_node *node = (struct drm_info_node *)m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct sti_drm_private *dev_priv = dev->dev_private;
+	struct sti_tvout *tvout = dev_priv->tvout;
+	struct sti_tvout_connector *connector = tvout->connector[type];
+	char name[TVOUT_CONNECTOR_NAME_MAX_LENGHT];
+	int ret;
+
+	if (!connector)
+		return -1;
+
+	if (!connector->is_enabled)
+		return -1;
+
+	ret = mutex_lock_interruptible(&dev->struct_mutex);
+	if (ret)
+		return ret;
+
+	if (tvout == NULL) {
+		seq_puts(m, "No tvout available");
+		goto out;
+	}
+
+	ret = sti_tvout_dbg_type_to_connector_name(type, name);
+	if (ret) {
+		seq_puts(m, "No connector!");
+		goto out;
+	}
+
+	seq_printf(m, "\n%s connector: ", name);
+	seq_printf(m, "\nTVOUT: (virt base addr = 0x%p)", tvout->regs);
+	if (connector->is_enabled(connector)) {
+		if (connector->main_path) {
+			seq_puts(m, "\n Connected to the main path");
+			TVOUT_DBG_DUMP(TVO_CSC_MAIN_M0);
+			TVOUT_DBG_DUMP(TVO_CSC_MAIN_M1);
+			TVOUT_DBG_DUMP(TVO_CSC_MAIN_M2);
+			TVOUT_DBG_DUMP(TVO_CSC_MAIN_M3);
+			TVOUT_DBG_DUMP(TVO_CSC_MAIN_M4);
+			TVOUT_DBG_DUMP(TVO_CSC_MAIN_M5);
+			TVOUT_DBG_DUMP(TVO_CSC_MAIN_M6);
+			TVOUT_DBG_DUMP(TVO_CSC_MAIN_M7);
+			TVOUT_DBG_DUMP(TVO_MAIN_IN_VID_FORMAT);
+		} else {
+			seq_puts(m, "\n Connected to the auxiliary path");
+			TVOUT_DBG_DUMP(TVO_CSC_AUX_M0);
+			TVOUT_DBG_DUMP(TVO_CSC_AUX_M2);
+			TVOUT_DBG_DUMP(TVO_CSC_AUX_M3);
+			TVOUT_DBG_DUMP(TVO_CSC_AUX_M4);
+			TVOUT_DBG_DUMP(TVO_CSC_AUX_M5);
+			TVOUT_DBG_DUMP(TVO_CSC_AUX_M6);
+			TVOUT_DBG_DUMP(TVO_CSC_AUX_M7);
+			TVOUT_DBG_DUMP(TVO_AUX_IN_VID_FORMAT);
+		}
+	} else
+		seq_puts(m, " Disabled");
+
+	switch (type) {
+	case STI_TVOUT_CONNECTOR_HDMI:
+		TVOUT_DBG_DUMP(TVO_VIP_HDMI);
+		tvout_dbg_vip(m, readl(tvout->regs + TVO_VIP_HDMI));
+		TVOUT_DBG_DUMP(TVO_HDMI_FORCE_COLOR_0);
+		TVOUT_DBG_DUMP(TVO_HDMI_FORCE_COLOR_1);
+		TVOUT_DBG_DUMP(TVO_HDMI_CLIP_VALUE_B_CB);
+		TVOUT_DBG_DUMP(TVO_HDMI_CLIP_VALUE_Y_G);
+		TVOUT_DBG_DUMP(TVO_HDMI_CLIP_VALUE_R_CR);
+		TVOUT_DBG_DUMP(TVO_HDMI_SYNC_SEL);
+		TVOUT_DBG_DUMP(TVO_HDMI_DFV_OBS);
+		break;
+	case STI_TVOUT_CONNECTOR_HDA:
+		TVOUT_DBG_DUMP(TVO_VIP_HDF);
+		tvout_dbg_vip(m, readl(tvout->regs + TVO_VIP_HDF));
+		TVOUT_DBG_DUMP(TVO_HD_SYNC_SEL);
+		TVOUT_DBG_DUMP(TVO_HD_DAC_CFG_OFF);
+		tvout_dbg_hd_dac_cfg(m,
+				     readl(tvout->regs + TVO_HD_DAC_CFG_OFF));
+		break;
+	default:
+		goto out;
+	}
+
+	if (connector->dbg_show)
+		connector->dbg_show(connector, m);
+out:
+	seq_puts(m, "\n\n");
+	mutex_unlock(&dev->struct_mutex);
+	return 0;
+}
+
+int sti_tvout_hdmi_dbg_show(struct seq_file *m, void *arg)
+{
+	return tvout_dbg_show(m, STI_TVOUT_CONNECTOR_HDMI);
+}
+
+int sti_tvout_hda_dbg_show(struct seq_file *m, void *arg)
+{
+	return tvout_dbg_show(m, STI_TVOUT_CONNECTOR_HDA);
+}
+
 static int sti_tvout_bind(struct device *dev, struct device *master, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
Signature · 1 line
1.9.1
#16 lore raw

PATCH v2 16/19 drm: sti: add debug to mixer

In reply to Benjamin Gaignard

Make mixer driver more verbose

---
 drivers/gpu/drm/sti/sti_mixer.c | 164 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_mixer.h |   2 +
 2 files changed, 166 insertions(+)
drivers/gpu/drm/sti/sti_mixer.c +164 -0
index ab8daf6..fce72e4 100644
@@ -6,7 +6,9 @@
  * License terms:  GNU General Public License (GPL), version 2
  */
 
+#include "sti_drm_drv.h"
 #include "sti_mixer.h"
+#include "sti_compositor.h"
 #include "sti_vtg_utils.h"
 
 /* Identity: G=Y , B=Cb , R=Cr */
@@ -139,6 +141,8 @@ int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer)
 	mask = GAM_DEPTH_MASK_ID << (3 * depth);
 	layer_id = layer_id << (3 * depth);
 
+	DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer),
+			 sti_layer_to_str(layer), depth);
 	dev_dbg(mixer->dev, "GAM_MIXER_MAIN_CRB val 0x%x mask 0x%x\n",
 		layer_id, mask);
 	sti_mixer_reg_writemask(mixer, GAM_MIXER_MAIN_CRB, layer_id, mask);
@@ -197,6 +201,9 @@ int sti_mixer_set_layer_status(struct sti_mixer *mixer,
 {
 	u32 mask, val;
 
+	DRM_DEBUG_DRIVER("%s %s %s\n", status ? "enable" : "disable",
+			 sti_mixer_to_str(mixer), sti_layer_to_str(layer));
+
 	mask = sti_mixer_get_layer_mask(layer);
 	if (!mask) {
 		DRM_ERROR("Can not find layer mask\n");
@@ -239,3 +246,160 @@ struct sti_mixer *sti_mixer_create(struct device *dev, int id,
 
 	return mixer;
 }
+
+static void sti_mixer_dbg_ctl(struct seq_file *m, int val)
+{
+	int count = 0;
+
+	seq_puts(m, "\tEnabled: ");
+	if (val & 1) {
+		seq_puts(m, "BKG ");
+		count++;
+	}
+	val = val >> 1;
+
+	if (val & 1) {
+		seq_puts(m, "VID0 ");
+		count++;
+	}
+	val = val >> 1;
+	if (val & 1) {
+		seq_puts(m, "VID1 ");
+		count++;
+	}
+	val = val >> 1;
+	if (val & 1) {
+		seq_puts(m, "GDP0 ");
+		count++;
+	}
+	val = val >> 1;
+	if (val & 1) {
+		seq_puts(m, "GDP1 ");
+		count++;
+	}
+	val = val >> 1;
+	if (val & 1) {
+		seq_puts(m, "GDP2 ");
+		count++;
+	}
+	val = val >> 1;
+	if (val & 1) {
+		seq_puts(m, "GDP3 ");
+		count++;
+	}
+	if (!count)
+		seq_puts(m, "Nothing");
+}
+
+static void sti_mixer_dbg_crb(struct seq_file *m, int val)
+{
+	int i;
+
+	seq_puts(m, "\tDepth: ");
+	for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) {
+		switch (val & GAM_DEPTH_MASK_ID) {
+		case GAM_DEPTH_VID0_ID:
+			seq_puts(m, "VID0");
+			break;
+		case GAM_DEPTH_VID1_ID:
+			seq_puts(m, "VID1");
+			break;
+		case GAM_DEPTH_GDP0_ID:
+			seq_puts(m, "GDP0");
+			break;
+		case GAM_DEPTH_GDP1_ID:
+			seq_puts(m, "GDP1");
+			break;
+		case GAM_DEPTH_GDP2_ID:
+			seq_puts(m, "GDP2");
+			break;
+		case GAM_DEPTH_GDP3_ID:
+			seq_puts(m, "GDP3");
+			break;
+		default:
+			seq_puts(m, "---");
+		}
+		if (i < GAM_MIXER_NB_DEPTH_LEVEL - 1)
+			seq_puts(m, " < ");
+		val = val >> 3;
+	}
+}
+
+static void sti_mixer_dbg_mxn(struct seq_file *m, void *addr)
+{
+	int i;
+
+	for (i = 1; i < 8; i++)
+		seq_printf(m, "-0x%08X", (int)readl(addr + i * 4));
+}
+
+#define MIXER_DBG_DUMP(reg) seq_printf(m, "\n " #reg "\t 0x%08X", \
+		sti_mixer_reg_read(mixer, reg))
+
+int sti_mixer_dbg_show(struct seq_file *m, void *arg)
+{
+	struct drm_info_node *node = (struct drm_info_node *)m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct sti_drm_private *dev_priv = dev->dev_private;
+	struct sti_compositor *compo = dev_priv->compo;
+	int i, ret;
+
+	ret = mutex_lock_interruptible(&dev->struct_mutex);
+	if (ret)
+		return ret;
+
+	if (compo == NULL) {
+		seq_puts(m, "No compositor available\n");
+		goto out;
+	}
+
+	for (i = 0; i < compo->nb_mixers; i++) {
+		struct drm_crtc *crtc;
+		struct drm_framebuffer *fb;
+		struct sti_mixer *mixer = compo->mixer[i];
+
+		seq_printf(m, "\n%s", sti_mixer_to_str(mixer));
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_CTL);
+		sti_mixer_dbg_ctl(m,
+				  sti_mixer_reg_read(mixer,
+						     GAM_MIXER_MAIN_CTL));
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_BKC);
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_BCO);
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_BCS);
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_AVO);
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_AVS);
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_CRB);
+		sti_mixer_dbg_crb(m,
+				  sti_mixer_reg_read(mixer,
+						     GAM_MIXER_MAIN_CRB));
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_ACT);
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_MBP);
+		MIXER_DBG_DUMP(GAM_MIXER_MAIN_MX0);
+		sti_mixer_dbg_mxn(m, mixer->regs + GAM_MIXER_MAIN_MX0);
+		seq_puts(m, "\n");
+
+		crtc = &mixer->drm_crtc;
+		if (!crtc) {
+			seq_puts(m, " Not connected to any DRM CRTC\n");
+			continue;
+		}
+		seq_printf(m, " Connected to DRM CRTC #%d which is:\n",
+			   crtc->base.id);
+		seq_puts(m, crtc->enabled ? "\tEnabled\n" : "\tDisabled\n");
+		seq_printf(m, "\tMode: %s %dHz\n",
+			   crtc->mode.name, crtc->mode.vrefresh);
+		seq_printf(m, "\tat %d,%d\n", crtc->x, crtc->y);
+
+		fb = crtc->fb;
+		if (!fb) {
+			seq_puts(m, "\tNot connected to any DRM FB\n");
+			continue;
+		}
+		seq_printf(m, "\tConnected to DRM FB #%d, %dx%d, %.4s\n",
+			   fb->base.id,
+			   fb->width, fb->height, (char *)&fb->pixel_format);
+	}
+out:
+	mutex_unlock(&dev->struct_mutex);
+	return 0;
+}
drivers/gpu/drm/sti/sti_mixer.h +2 -0
index a05e21f..abdd1ad 100644
@@ -43,6 +43,8 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer,
 
 void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable);
 
+int sti_mixer_dbg_show(struct seq_file *m, void *arg);
+
 /* depth in Cross-bar control = z order */
 #define GAM_MIXER_NB_DEPTH_LEVEL	7
 
Signature · 1 line
1.9.1
#17 lore raw

PATCH v2 17/19 drm: sti: Add DRM driver itself

In reply to Benjamin Gaignard

Make the link between all the hardware drivers and DRM/KMS interface. Create the driver itself and make it register all the sub-components. Use GEM CMA helpers for buffer allocation.

---
 drivers/gpu/drm/sti/Kconfig             |   8 +
 drivers/gpu/drm/sti/Makefile            |   7 +-
 drivers/gpu/drm/sti/sti_compositor.c    |  41 ++-
 drivers/gpu/drm/sti/sti_drm_connector.c | 195 ++++++++++++++
 drivers/gpu/drm/sti/sti_drm_connector.h |  16 ++
 drivers/gpu/drm/sti/sti_drm_crtc.c      | 440 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_drm_crtc.h      |  21 ++
 drivers/gpu/drm/sti/sti_drm_drv.c       | 435 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_drm_encoder.c   | 201 +++++++++++++++
 drivers/gpu/drm/sti/sti_drm_encoder.h   |  16 ++
 drivers/gpu/drm/sti/sti_drm_plane.c     | 195 ++++++++++++++
 drivers/gpu/drm/sti/sti_drm_plane.h     |  16 ++
 12 files changed, 1587 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/sti/sti_drm_connector.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_connector.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_crtc.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_crtc.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_drv.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_encoder.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_encoder.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_plane.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_plane.h
drivers/gpu/drm/sti/Kconfig +8 -0
index 9c1218c..11b6d62 100644
@@ -1,10 +1,18 @@
 config DRM_STI
 	bool "DRM Support for STMicroelectronics SoC stiH41x Series"
 	depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM)
+	select DRM_KMS_HELPER
+	select DRM_GEM_CMA_HELPER
 	select DRM_KMS_CMA_HELPER
 	help
 	  Choose this option to enable DRM on STM stiH41x chipset
 
+config DRM_STI_FBDEV
+	bool "DRM frame buffer device for STMicroelectronics SoC stiH41x Serie"
+	depends on DRM_STI
+	help
+	  Choose this option to enable FBDEV on top of DRM for STM stiH41x chipset
+
 config VTAC_STI
 	tristate "Video Trafic Advance Communication Rx and Tx for STMicroelectronics SoC stiH41x Series"
 	depends on DRM_STI
drivers/gpu/drm/sti/Makefile +6 -1
index 3b804d4..8eee160 100644
@@ -1,6 +1,11 @@
 ccflags-y := -Iinclude/drm
 
-stidrm-y := sti_tvout.o \
+stidrm-y := sti_drm_drv.o \
+			sti_drm_crtc.o \
+			sti_drm_plane.o \
+			sti_drm_connector.o \
+			sti_drm_encoder.o \
+			sti_tvout.o \
 			sti_hdmi.o \
 			sti_hdmi_tx3g0c55phy.o \
 			sti_hdmi_tx3g4c28phy.o \
drivers/gpu/drm/sti/sti_compositor.c +38 -3

83 lines not on this page · raw message

drivers/gpu/drm/sti/sti_drm_connector.c new file +195 -0

195 lines not on this page · raw message

drivers/gpu/drm/sti/sti_drm_connector.h new file +16 -0
new file mode 100644
index 0000000..068c674
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard <[email protected]> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_DRM_CONNECTOR_H_
+#define _STI_DRM_CONNECTOR_H_
+
+#include "sti_tvout.h"
+
+struct drm_connector *sti_drm_connector_create(struct drm_device *dev,
+		struct sti_tvout *tvout, struct drm_encoder *encoder,
+		enum sti_tvout_connector_type type);
+
+#endif
drivers/gpu/drm/sti/sti_drm_crtc.c new file +440 -0

440 lines not on this page · raw message

drivers/gpu/drm/sti/sti_drm_crtc.h new file +21 -0
new file mode 100644
index 0000000..9d31e41
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard <[email protected]> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_DRM_CRTC_H_
+#define _STI_DRM_CRTC_H_
+
+#include <drm/drmP.h>
+
+#include "sti_mixer.h"
+
+int sti_drm_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer);
+int sti_drm_crtc_enable_vblank(struct drm_device *dev, int crtc);
+void sti_drm_crtc_disable_vblank(struct drm_device *dev, int crtc);
+int sti_drm_crtc_vblank_cb(struct notifier_block *nb,
+		unsigned long event, void *data);
+bool sti_drm_crtc_is_main(struct drm_crtc *drm_crtc);
+
+#endif
drivers/gpu/drm/sti/sti_drm_drv.c new file +435 -0

435 lines not on this page · raw message

drivers/gpu/drm/sti/sti_drm_encoder.c new file +201 -0

201 lines not on this page · raw message

drivers/gpu/drm/sti/sti_drm_encoder.h new file +16 -0
new file mode 100644
index 0000000..35d9945
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard <[email protected]> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_DRM_ENCODER_H_
+#define _STI_DRM_ENCODER_H_
+
+#include "sti_tvout.h"
+
+struct drm_encoder *sti_drm_encoder_create(struct drm_device *dev,
+		struct sti_tvout *tvout, unsigned int possible_crtcs,
+		enum sti_tvout_connector_type type);
+
+#endif
drivers/gpu/drm/sti/sti_drm_plane.c new file +195 -0

195 lines not on this page · raw message

drivers/gpu/drm/sti/sti_drm_plane.h new file +16 -0
new file mode 100644
index 0000000..d182066
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard <[email protected]> for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_DRM_PLANE_H_
+#define _STI_DRM_PLANE_H_
+
+#include <drm/drmP.h>
+#include "sti_layer.h"
+
+struct drm_plane *sti_drm_plane_init(struct drm_device *dev,
+		struct sti_layer *layer, unsigned int possible_crtcs);
+
+#endif
Signature · 1 line
1.9.1
#18 lore raw

PATCH v2 18/19 drm: sti: add HQVDP driver

In reply to Benjamin Gaignard

High Quality Video Display Plug is a data path for doing high quality treatments (filtering, scaling) on video flow.

HQVDP IP is tunneled into compositor via VDP input.

---
 drivers/gpu/drm/sti/Kconfig         |    2 +-
 drivers/gpu/drm/sti/Makefile        |    1 +
 drivers/gpu/drm/sti/sti_drm_drv.c   |   12 +
 drivers/gpu/drm/sti/sti_drm_drv.h   |    3 +
 drivers/gpu/drm/sti/sti_hqvdp.c     | 1107 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_hqvdp.h     |   55 ++
 drivers/gpu/drm/sti/sti_hqvdp_lut.h |  373 ++++++++++++
 drivers/gpu/drm/sti/sti_layer.c     |   27 +-
 drivers/gpu/drm/sti/sti_layer.h     |    3 +
 9 files changed, 1576 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/sti/sti_hqvdp.c
 create mode 100644 drivers/gpu/drm/sti/sti_hqvdp.h
 create mode 100644 drivers/gpu/drm/sti/sti_hqvdp_lut.h
drivers/gpu/drm/sti/Kconfig +1 -1
index 11b6d62..2c80bcf 100644
@@ -14,7 +14,7 @@ config DRM_STI_FBDEV
 	  Choose this option to enable FBDEV on top of DRM for STM stiH41x chipset
 
 config VTAC_STI
-	tristate "Video Trafic Advance Communication Rx and Tx for STMicroelectronics SoC stiH41x Series"
+	bool "Video Trafic Advance Communication Rx and Tx for STMicroelectronics SoC stiH41x Series"
 	depends on DRM_STI
 	help
 	  Choose this option to enable VTAC on STM stiH41x chipset
drivers/gpu/drm/sti/Makefile +1 -0
index 8eee160..b71f0a7 100644
@@ -10,6 +10,7 @@ stidrm-y := sti_drm_drv.o \
 			sti_hdmi_tx3g0c55phy.o \
 			sti_hdmi_tx3g4c28phy.o \
 			sti_hda.o \
+			sti_hqvdp.o \
 			sti_compositor.o \
 			sti_layer.o \
 			sti_mixer.o \
drivers/gpu/drm/sti/sti_drm_drv.c +12 -0
index 952efb6..ccd1f17 100644
@@ -23,6 +23,7 @@
 #include "sti_drm_encoder.h"
 #include "sti_drm_connector.h"
 #include "sti_tvout.h"
+#include "sti_hqvdp.h"
 
 #define DRIVER_NAME	"sti"
 #define DRIVER_DESC	"STMicroelectronics SoC DRM"
@@ -131,6 +132,7 @@ static struct drm_info_list sti_drm_dbg_list[] = {
 	{"mixer", sti_mixer_dbg_show, 0},
 	{"hdmi", sti_tvout_hdmi_dbg_show, 0, NULL},
 	{"hda", sti_tvout_hda_dbg_show, 0, NULL},
+	{"vdp", sti_hqvdp_dbg_show, 0, NULL},
 };
 
 static int sti_drm_fps_get(void *data, u64 *val)
@@ -283,6 +285,16 @@ static int sti_drm_load(struct drm_device *dev, unsigned long flags)
 	if (err)
 		DRM_ERROR("Failed to initialize TVOUT\n");
 
+	/* Load HQVDP firmware */
+	drv = driver_find("sti-hqvdp", &platform_bus_type);
+	if (!drv) {
+		DRM_ERROR("No HQVDP found\n");
+		return -ENOMEM;
+	}
+	err = driver_for_each_device(drv, NULL, dev, sti_hqvdp_load_init);
+	if (err)
+		DRM_ERROR("Failed to initialize HQVDP\n");
+
 	drm_helper_disable_unused_functions(dev);
 #ifdef CONFIG_DRM_STI_FBDEV
 	sti_drm_device = dev;
drivers/gpu/drm/sti/sti_drm_drv.h +3 -0
index 5660196..f84897f 100644
@@ -13,6 +13,7 @@
 
 #include "sti_compositor.h"
 #include "sti_tvout.h"
+#include "sti_hqvdp.h"
 
 /*
  * STI drm private structure
@@ -20,12 +21,14 @@
  *
  * @compo:                 compositor
  * @tvout:                 TV OUT
+ * @hqvdp:                 HQVDP
  * @pageflip_evt_list:     list of pending page flip requests
  * @plane_zorder_property: z-order property for CRTC planes
  */
 struct sti_drm_private {
 	struct sti_compositor *compo;
 	struct sti_tvout *tvout;
+	struct sti_hqvdp *hqvdp;
 	struct list_head pageflip_evt_list;
 	struct drm_property *plane_zorder_property;
 };
drivers/gpu/drm/sti/sti_hqvdp.c new file +1107 -0

1,107 lines not on this page · raw message

drivers/gpu/drm/sti/sti_hqvdp.h new file +55 -0

55 lines not on this page · raw message

drivers/gpu/drm/sti/sti_hqvdp_lut.h new file +373 -0

373 lines not on this page · raw message

drivers/gpu/drm/sti/sti_layer.c +21 -6
index 54c8694..9d7cd3e 100644
@@ -100,6 +100,8 @@ struct sti_layer *sti_layer_create(struct device *dev, int desc,
 		layer->vid = sti_vid_create(dev, baseaddr);
 		if (!layer->vid)
 			goto err;
+		/* The VDP descriptor is not created now, but will be added
+		 * later upon HQVDP driver probe */
 		break;
 	default:
 		goto err;
@@ -172,9 +174,10 @@ int sti_layer_prepare(struct sti_layer *layer, struct drm_framebuffer *fb,
 		ret = layer->gdp->prepare(layer, !layer->enabled);
 		break;
 	case STI_VID:
-		if (!layer->vid)
+		if ((!layer->vid) || (!layer->vdp))
 			goto err_no_prepare;
-		ret = layer->vid->prepare(layer, !layer->enabled);
+		ret = layer->vdp->prepare(layer, !layer->enabled);
+		ret |= layer->vid->prepare(layer, !layer->enabled);
 		break;
 	default:
 		goto err_no_prepare;
@@ -204,9 +207,10 @@ int sti_layer_commit(struct sti_layer *layer)
 		ret = layer->gdp->commit(layer);
 		break;
 	case STI_VID:
-		if (!layer->vid)
+		if ((!layer->vid) || (!layer->vdp))
 			goto err_no_commit;
-		ret = layer->vid->commit(layer);
+		ret = layer->vdp->commit(layer);
+		ret |= layer->vid->commit(layer);
 		break;
 	default:
 		goto err_no_commit;
@@ -240,9 +244,10 @@ int sti_layer_disable(struct sti_layer *layer)
 		ret = layer->gdp->disable(layer);
 		break;
 	case STI_VID:
-		if (!layer->vid)
+		if ((!layer->vid) || (!layer->vdp))
 			goto err_no_disable;
-		ret = layer->vid->disable(layer);
+		ret = layer->vdp->disable(layer);
+		ret |= layer->vid->disable(layer);
 		break;
 	default:
 		goto err_no_disable;
@@ -272,6 +277,11 @@ const uint32_t *sti_layer_get_formats(struct sti_layer *layer)
 		if (layer->gdp)
 			get_formats = layer->gdp->get_formats;
 		break;
+	case STI_VID:
+		/* The single input of [VDP+VID] is VDP */
+		if (layer->vdp)
+			get_formats = layer->vdp->get_formats;
+		break;
 	default:
 		break;
 	}
@@ -296,6 +306,11 @@ int sti_layer_get_nb_formats(struct sti_layer *layer)
 		if (layer->gdp)
 			get_nb_formats = layer->gdp->get_nb_formats;
 		break;
+	case STI_VID:
+		/* The single input of [VDP+VID] is VDP */
+		if (layer->vdp)
+			get_nb_formats = layer->vdp->get_nb_formats;
+		break;
 	default:
 		break;
 	}
drivers/gpu/drm/sti/sti_layer.h +3 -0
index bf3a14f..bdfb273 100644
@@ -12,6 +12,7 @@
 #include <drm/drmP.h>
 #include "sti_gdp.h"
 #include "sti_vid.h"
+#include "sti_hqvdp.h"
 
 #define to_sti_layer(x) container_of(x, struct sti_layer, plane)
 
@@ -72,6 +73,7 @@ struct sti_fps_info {
  * @fps_info:		frame per second info
  * @gdp:                related GDP (if the layer is a GDP)
  * @vid:                related VID (if the layer is a VID/VDP)
+ * @vdp:                related VDP (if the layer is a VID/VDP)
  */
 struct sti_layer {
 	struct drm_plane plane;
@@ -92,6 +94,7 @@ struct sti_layer {
 	struct sti_fps_info fps_info;
 	struct sti_gdp *gdp;
 	struct sti_vid *vid;
+	struct sti_vdp *vdp;
 };
 
 struct sti_layer *sti_layer_create(struct device *dev, int desc,
Signature · 1 line
1.9.1
#19 lore raw

PATCH v2 19/19 drm: sti: rename mixer registers to be main/aux independent

In reply to Benjamin Gaignard

From: Vincent Abriou <[email protected]>

---
 drivers/gpu/drm/sti/sti_mixer.c | 70 ++++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 35 deletions(-)
drivers/gpu/drm/sti/sti_mixer.c +35 -35
index fce72e4..73d5405 100644
@@ -18,16 +18,16 @@ static const u32 MixerColorSpaceMatIdentity[] = {
 };
 
 /* regs offset */
-#define GAM_MIXER_MAIN_CTL	0x00
-#define GAM_MIXER_MAIN_BKC	0x04
-#define GAM_MIXER_MAIN_BCO	0x0C
-#define GAM_MIXER_MAIN_BCS	0x10
-#define GAM_MIXER_MAIN_AVO	0x28
-#define GAM_MIXER_MAIN_AVS	0x2C
-#define GAM_MIXER_MAIN_CRB	0x34
-#define GAM_MIXER_MAIN_ACT	0x38
-#define GAM_MIXER_MAIN_MBP	0x3C
-#define GAM_MIXER_MAIN_MX0	0x80
+#define GAM_MIXER_CTL	0x00
+#define GAM_MIXER_BKC	0x04
+#define GAM_MIXER_BCO	0x0C
+#define GAM_MIXER_BCS	0x10
+#define GAM_MIXER_AVO	0x28
+#define GAM_MIXER_AVS	0x2C
+#define GAM_MIXER_CRB	0x34
+#define GAM_MIXER_ACT	0x38
+#define GAM_MIXER_MBP	0x3C
+#define GAM_MIXER_MX0	0x80
 
 /* id for depth of CRB reg */
 #define GAM_DEPTH_VID0_ID	1
@@ -82,7 +82,7 @@ static inline void sti_mixer_reg_writemask(struct sti_mixer *mixer,
 void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable)
 {
 	sti_mixer_reg_writemask(mixer,
-				GAM_MIXER_MAIN_CTL, enable, GAM_CTL_BACK_MASK);
+				GAM_MIXER_CTL, enable, GAM_CTL_BACK_MASK);
 }
 
 static void sti_mixer_set_background_color(struct sti_mixer *mixer,
@@ -90,7 +90,7 @@ static void sti_mixer_set_background_color(struct sti_mixer *mixer,
 {
 	u32 val = (red << 16) | (green << 8) | blue;
 
-	sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_BKC, val);
+	sti_mixer_reg_write(mixer, GAM_MIXER_BKC, val);
 }
 
 static void sti_mixer_set_background_area(struct sti_mixer *mixer,
@@ -103,8 +103,8 @@ static void sti_mixer_set_background_area(struct sti_mixer *mixer,
 	xdo = sti_vtg_get_pixel_number(*mode, 0);
 	xds = sti_vtg_get_pixel_number(*mode, mode->hdisplay - 1);
 
-	sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_BCO, ydo << 16 | xdo);
-	sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_BCS, yds << 16 | xds);
+	sti_mixer_reg_write(mixer, GAM_MIXER_BCO, ydo << 16 | xdo);
+	sti_mixer_reg_write(mixer, GAM_MIXER_BCS, yds << 16 | xds);
 }
 
 int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer)
@@ -143,12 +143,12 @@ int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer)
 
 	DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer),
 			 sti_layer_to_str(layer), depth);
-	dev_dbg(mixer->dev, "GAM_MIXER_MAIN_CRB val 0x%x mask 0x%x\n",
+	dev_dbg(mixer->dev, "GAM_MIXER_CRB val 0x%x mask 0x%x\n",
 		layer_id, mask);
-	sti_mixer_reg_writemask(mixer, GAM_MIXER_MAIN_CRB, layer_id, mask);
+	sti_mixer_reg_writemask(mixer, GAM_MIXER_CRB, layer_id, mask);
 
-	dev_dbg(mixer->dev, "Read GAM_MIXER_MAIN_CRB 0x%x\n",
-		sti_mixer_reg_read(mixer, GAM_MIXER_MAIN_CRB));
+	dev_dbg(mixer->dev, "Read GAM_MIXER_CRB 0x%x\n",
+		sti_mixer_reg_read(mixer, GAM_MIXER_CRB));
 	return 0;
 }
 
@@ -164,8 +164,8 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer,
 
 	DRM_DEBUG_DRIVER("%s active video area xdo:%d ydo:%d xds:%d yds:%d\n",
 			 sti_mixer_to_str(mixer), xdo, ydo, xds, yds);
-	sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_AVO, ydo << 16 | xdo);
-	sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_AVS, yds << 16 | xds);
+	sti_mixer_reg_write(mixer, GAM_MIXER_AVO, ydo << 16 | xdo);
+	sti_mixer_reg_write(mixer, GAM_MIXER_AVS, yds << 16 | xds);
 
 	sti_mixer_set_background_color(mixer, 0xFF, 0, 0);
 
@@ -210,7 +210,7 @@ int sti_mixer_set_layer_status(struct sti_mixer *mixer,
 		return -1;
 	}
 	val = status ? mask : 0;
-	sti_mixer_reg_writemask(mixer, GAM_MIXER_MAIN_CTL, val, mask);
+	sti_mixer_reg_writemask(mixer, GAM_MIXER_CTL, val, mask);
 	return 0;
 }
 
@@ -219,7 +219,7 @@ void sti_mixer_set_matrix(struct sti_mixer *mixer)
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(MixerColorSpaceMatIdentity); i++)
-		sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_MX0 + (i * 4),
+		sti_mixer_reg_write(mixer, GAM_MIXER_MX0 + (i * 4),
 				    MixerColorSpaceMatIdentity[i]);
 }
 
@@ -359,23 +359,23 @@ int sti_mixer_dbg_show(struct seq_file *m, void *arg)
 		struct sti_mixer *mixer = compo->mixer[i];
 
 		seq_printf(m, "\n%s", sti_mixer_to_str(mixer));
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_CTL);
+		MIXER_DBG_DUMP(GAM_MIXER_CTL);
 		sti_mixer_dbg_ctl(m,
 				  sti_mixer_reg_read(mixer,
-						     GAM_MIXER_MAIN_CTL));
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_BKC);
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_BCO);
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_BCS);
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_AVO);
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_AVS);
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_CRB);
+						     GAM_MIXER_CTL));
+		MIXER_DBG_DUMP(GAM_MIXER_BKC);
+		MIXER_DBG_DUMP(GAM_MIXER_BCO);
+		MIXER_DBG_DUMP(GAM_MIXER_BCS);
+		MIXER_DBG_DUMP(GAM_MIXER_AVO);
+		MIXER_DBG_DUMP(GAM_MIXER_AVS);
+		MIXER_DBG_DUMP(GAM_MIXER_CRB);
 		sti_mixer_dbg_crb(m,
 				  sti_mixer_reg_read(mixer,
-						     GAM_MIXER_MAIN_CRB));
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_ACT);
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_MBP);
-		MIXER_DBG_DUMP(GAM_MIXER_MAIN_MX0);
-		sti_mixer_dbg_mxn(m, mixer->regs + GAM_MIXER_MAIN_MX0);
+						     GAM_MIXER_CRB));
+		MIXER_DBG_DUMP(GAM_MIXER_ACT);
+		MIXER_DBG_DUMP(GAM_MIXER_MBP);
+		MIXER_DBG_DUMP(GAM_MIXER_MX0);
+		sti_mixer_dbg_mxn(m, mixer->regs + GAM_MIXER_MX0);
 		seq_puts(m, "\n");
 
 		crtc = &mixer->drm_crtc;
Signature · 1 line
1.9.1