| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * rcar_du_drv.h -- R-Car Display Unit DRM driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2013-2015 Renesas Electronics Corporation |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #ifndef __RCAR_DU_DRV_H__ |
|---|
| .. | .. |
|---|
| 17 | 13 | #include <linux/kernel.h> |
|---|
| 18 | 14 | #include <linux/wait.h> |
|---|
| 19 | 15 | |
|---|
| 16 | +#include "rcar_cmm.h" |
|---|
| 20 | 17 | #include "rcar_du_crtc.h" |
|---|
| 21 | 18 | #include "rcar_du_group.h" |
|---|
| 22 | 19 | #include "rcar_du_vsp.h" |
|---|
| 23 | 20 | |
|---|
| 24 | 21 | struct clk; |
|---|
| 25 | 22 | struct device; |
|---|
| 23 | +struct drm_bridge; |
|---|
| 26 | 24 | struct drm_device; |
|---|
| 27 | | -struct drm_fbdev_cma; |
|---|
| 25 | +struct drm_property; |
|---|
| 28 | 26 | struct rcar_du_device; |
|---|
| 29 | 27 | |
|---|
| 30 | | -#define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0) /* Per-CRTC IRQ and clock */ |
|---|
| 31 | | -#define RCAR_DU_FEATURE_EXT_CTRL_REGS (1 << 1) /* Has extended control registers */ |
|---|
| 32 | | -#define RCAR_DU_FEATURE_VSP1_SOURCE (1 << 2) /* Has inputs from VSP1 */ |
|---|
| 28 | +#define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK BIT(0) /* Per-CRTC IRQ and clock */ |
|---|
| 29 | +#define RCAR_DU_FEATURE_VSP1_SOURCE BIT(1) /* Has inputs from VSP1 */ |
|---|
| 30 | +#define RCAR_DU_FEATURE_INTERLACED BIT(2) /* HW supports interlaced */ |
|---|
| 31 | +#define RCAR_DU_FEATURE_TVM_SYNC BIT(3) /* Has TV switch/sync modes */ |
|---|
| 33 | 32 | |
|---|
| 34 | | -#define RCAR_DU_QUIRK_ALIGN_128B (1 << 0) /* Align pitches to 128 bytes */ |
|---|
| 33 | +#define RCAR_DU_QUIRK_ALIGN_128B BIT(0) /* Align pitches to 128 bytes */ |
|---|
| 35 | 34 | |
|---|
| 36 | 35 | /* |
|---|
| 37 | 36 | * struct rcar_du_output_routing - Output routing specification |
|---|
| .. | .. |
|---|
| 55 | 54 | * @channels_mask: bit mask of available DU channels |
|---|
| 56 | 55 | * @routes: array of CRTC to output routes, indexed by output (RCAR_DU_OUTPUT_*) |
|---|
| 57 | 56 | * @num_lvds: number of internal LVDS encoders |
|---|
| 57 | + * @dpll_mask: bit mask of DU channels equipped with a DPLL |
|---|
| 58 | + * @lvds_clk_mask: bitmask of channels that can use the LVDS clock as dot clock |
|---|
| 58 | 59 | */ |
|---|
| 59 | 60 | struct rcar_du_device_info { |
|---|
| 60 | 61 | unsigned int gen; |
|---|
| .. | .. |
|---|
| 63 | 64 | unsigned int channels_mask; |
|---|
| 64 | 65 | struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX]; |
|---|
| 65 | 66 | unsigned int num_lvds; |
|---|
| 66 | | - unsigned int dpll_ch; |
|---|
| 67 | + unsigned int dpll_mask; |
|---|
| 68 | + unsigned int lvds_clk_mask; |
|---|
| 67 | 69 | }; |
|---|
| 68 | 70 | |
|---|
| 69 | 71 | #define RCAR_DU_MAX_CRTCS 4 |
|---|
| 70 | 72 | #define RCAR_DU_MAX_GROUPS DIV_ROUND_UP(RCAR_DU_MAX_CRTCS, 2) |
|---|
| 71 | 73 | #define RCAR_DU_MAX_VSPS 4 |
|---|
| 74 | +#define RCAR_DU_MAX_LVDS 2 |
|---|
| 72 | 75 | |
|---|
| 73 | 76 | struct rcar_du_device { |
|---|
| 74 | 77 | struct device *dev; |
|---|
| .. | .. |
|---|
| 77 | 80 | void __iomem *mmio; |
|---|
| 78 | 81 | |
|---|
| 79 | 82 | struct drm_device *ddev; |
|---|
| 80 | | - struct drm_fbdev_cma *fbdev; |
|---|
| 81 | | - struct drm_atomic_state *suspend_state; |
|---|
| 82 | 83 | |
|---|
| 83 | 84 | struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS]; |
|---|
| 84 | 85 | unsigned int num_crtcs; |
|---|
| 85 | 86 | |
|---|
| 86 | 87 | struct rcar_du_group groups[RCAR_DU_MAX_GROUPS]; |
|---|
| 88 | + struct platform_device *cmms[RCAR_DU_MAX_CRTCS]; |
|---|
| 87 | 89 | struct rcar_du_vsp vsps[RCAR_DU_MAX_VSPS]; |
|---|
| 90 | + struct drm_bridge *lvds[RCAR_DU_MAX_LVDS]; |
|---|
| 88 | 91 | |
|---|
| 89 | 92 | struct { |
|---|
| 90 | 93 | struct drm_property *colorkey; |
|---|
| 91 | 94 | } props; |
|---|
| 92 | 95 | |
|---|
| 93 | 96 | unsigned int dpad0_source; |
|---|
| 97 | + unsigned int dpad1_source; |
|---|
| 94 | 98 | unsigned int vspd1_sink; |
|---|
| 95 | 99 | }; |
|---|
| 96 | 100 | |
|---|