diff options
author | Thierry Reding <treding@nvidia.com> | 2013-12-12 05:03:59 -0500 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2013-12-20 09:56:06 -0500 |
commit | 8620fc629aeec02ac3b3735703940696386a3039 (patch) | |
tree | e8571fbce2979ceb4f67c6033a9351cc0743de6f | |
parent | 6b7c79d19157d52901398964ad115dd472cedfde (diff) |
drm/tegra: Add Tegra124 DC support
Tegra124 and later support interlacing, but the driver doesn't support
it yet. Make sure interlacing stays disabled on hardware that supports
it.
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 50 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/dc.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/drm.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/drm.h | 3 |
4 files changed, 53 insertions, 6 deletions
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index cd7f1e499616..f89445d3cab7 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -15,6 +15,10 @@ | |||
15 | #include "drm.h" | 15 | #include "drm.h" |
16 | #include "gem.h" | 16 | #include "gem.h" |
17 | 17 | ||
18 | struct tegra_dc_soc_info { | ||
19 | bool supports_interlacing; | ||
20 | }; | ||
21 | |||
18 | struct tegra_plane { | 22 | struct tegra_plane { |
19 | struct drm_plane base; | 23 | struct drm_plane base; |
20 | unsigned int index; | 24 | unsigned int index; |
@@ -658,6 +662,13 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, | |||
658 | /* program display mode */ | 662 | /* program display mode */ |
659 | tegra_dc_set_timings(dc, mode); | 663 | tegra_dc_set_timings(dc, mode); |
660 | 664 | ||
665 | /* interlacing isn't supported yet, so disable it */ | ||
666 | if (dc->soc->supports_interlacing) { | ||
667 | value = tegra_dc_readl(dc, DC_DISP_INTERLACE_CONTROL); | ||
668 | value &= ~INTERLACE_ENABLE; | ||
669 | tegra_dc_writel(dc, value, DC_DISP_INTERLACE_CONTROL); | ||
670 | } | ||
671 | |||
661 | value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; | 672 | value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; |
662 | tegra_dc_writel(dc, value, DC_DISP_DATA_ENABLE_OPTIONS); | 673 | tegra_dc_writel(dc, value, DC_DISP_DATA_ENABLE_OPTIONS); |
663 | 674 | ||
@@ -1167,8 +1178,36 @@ static const struct host1x_client_ops dc_client_ops = { | |||
1167 | .exit = tegra_dc_exit, | 1178 | .exit = tegra_dc_exit, |
1168 | }; | 1179 | }; |
1169 | 1180 | ||
1181 | static const struct tegra_dc_soc_info tegra20_dc_soc_info = { | ||
1182 | .supports_interlacing = false, | ||
1183 | }; | ||
1184 | |||
1185 | static const struct tegra_dc_soc_info tegra30_dc_soc_info = { | ||
1186 | .supports_interlacing = false, | ||
1187 | }; | ||
1188 | |||
1189 | static const struct tegra_dc_soc_info tegra124_dc_soc_info = { | ||
1190 | .supports_interlacing = true, | ||
1191 | }; | ||
1192 | |||
1193 | static const struct of_device_id tegra_dc_of_match[] = { | ||
1194 | { | ||
1195 | .compatible = "nvidia,tegra124-dc", | ||
1196 | .data = &tegra124_dc_soc_info, | ||
1197 | }, { | ||
1198 | .compatible = "nvidia,tegra30-dc", | ||
1199 | .data = &tegra30_dc_soc_info, | ||
1200 | }, { | ||
1201 | .compatible = "nvidia,tegra20-dc", | ||
1202 | .data = &tegra20_dc_soc_info, | ||
1203 | }, { | ||
1204 | /* sentinel */ | ||
1205 | } | ||
1206 | }; | ||
1207 | |||
1170 | static int tegra_dc_probe(struct platform_device *pdev) | 1208 | static int tegra_dc_probe(struct platform_device *pdev) |
1171 | { | 1209 | { |
1210 | const struct of_device_id *id; | ||
1172 | struct resource *regs; | 1211 | struct resource *regs; |
1173 | struct tegra_dc *dc; | 1212 | struct tegra_dc *dc; |
1174 | int err; | 1213 | int err; |
@@ -1177,9 +1216,14 @@ static int tegra_dc_probe(struct platform_device *pdev) | |||
1177 | if (!dc) | 1216 | if (!dc) |
1178 | return -ENOMEM; | 1217 | return -ENOMEM; |
1179 | 1218 | ||
1219 | id = of_match_node(tegra_dc_of_match, pdev->dev.of_node); | ||
1220 | if (!id) | ||
1221 | return -ENODEV; | ||
1222 | |||
1180 | spin_lock_init(&dc->lock); | 1223 | spin_lock_init(&dc->lock); |
1181 | INIT_LIST_HEAD(&dc->list); | 1224 | INIT_LIST_HEAD(&dc->list); |
1182 | dc->dev = &pdev->dev; | 1225 | dc->dev = &pdev->dev; |
1226 | dc->soc = id->data; | ||
1183 | 1227 | ||
1184 | dc->clk = devm_clk_get(&pdev->dev, NULL); | 1228 | dc->clk = devm_clk_get(&pdev->dev, NULL); |
1185 | if (IS_ERR(dc->clk)) { | 1229 | if (IS_ERR(dc->clk)) { |
@@ -1253,12 +1297,6 @@ static int tegra_dc_remove(struct platform_device *pdev) | |||
1253 | return 0; | 1297 | return 0; |
1254 | } | 1298 | } |
1255 | 1299 | ||
1256 | static struct of_device_id tegra_dc_of_match[] = { | ||
1257 | { .compatible = "nvidia,tegra30-dc", }, | ||
1258 | { .compatible = "nvidia,tegra20-dc", }, | ||
1259 | { }, | ||
1260 | }; | ||
1261 | |||
1262 | struct platform_driver tegra_dc_driver = { | 1300 | struct platform_driver tegra_dc_driver = { |
1263 | .driver = { | 1301 | .driver = { |
1264 | .name = "tegra-dc", | 1302 | .name = "tegra-dc", |
diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 788627a060d7..e6a9df0abe68 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h | |||
@@ -294,6 +294,11 @@ | |||
294 | #define DC_DISP_SD_HW_K_VALUES 0x4dd | 294 | #define DC_DISP_SD_HW_K_VALUES 0x4dd |
295 | #define DC_DISP_SD_MAN_K_VALUES 0x4de | 295 | #define DC_DISP_SD_MAN_K_VALUES 0x4de |
296 | 296 | ||
297 | #define DC_DISP_INTERLACE_CONTROL 0x4e5 | ||
298 | #define INTERLACE_STATUS (1 << 2) | ||
299 | #define INTERLACE_START (1 << 1) | ||
300 | #define INTERLACE_ENABLE (1 << 0) | ||
301 | |||
297 | #define DC_WIN_CSC_YOF 0x611 | 302 | #define DC_WIN_CSC_YOF 0x611 |
298 | #define DC_WIN_CSC_KYRGB 0x612 | 303 | #define DC_WIN_CSC_KYRGB 0x612 |
299 | #define DC_WIN_CSC_KUR 0x613 | 304 | #define DC_WIN_CSC_KUR 0x613 |
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index a0b34816298c..eec8d2e2db5c 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c | |||
@@ -658,6 +658,7 @@ static const struct of_device_id host1x_drm_subdevs[] = { | |||
658 | { .compatible = "nvidia,tegra114-dsi", }, | 658 | { .compatible = "nvidia,tegra114-dsi", }, |
659 | { .compatible = "nvidia,tegra114-hdmi", }, | 659 | { .compatible = "nvidia,tegra114-hdmi", }, |
660 | { .compatible = "nvidia,tegra114-gr3d", }, | 660 | { .compatible = "nvidia,tegra114-gr3d", }, |
661 | { .compatible = "nvidia,tegra124-dc", }, | ||
661 | { /* sentinel */ } | 662 | { /* sentinel */ } |
662 | }; | 663 | }; |
663 | 664 | ||
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 6b293c88a8ca..bf1cac7658f8 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h | |||
@@ -88,6 +88,7 @@ extern int tegra_drm_unregister_client(struct tegra_drm *tegra, | |||
88 | extern int tegra_drm_init(struct tegra_drm *tegra, struct drm_device *drm); | 88 | extern int tegra_drm_init(struct tegra_drm *tegra, struct drm_device *drm); |
89 | extern int tegra_drm_exit(struct tegra_drm *tegra); | 89 | extern int tegra_drm_exit(struct tegra_drm *tegra); |
90 | 90 | ||
91 | struct tegra_dc_soc_info; | ||
91 | struct tegra_output; | 92 | struct tegra_output; |
92 | 93 | ||
93 | struct tegra_dc { | 94 | struct tegra_dc { |
@@ -113,6 +114,8 @@ struct tegra_dc { | |||
113 | 114 | ||
114 | /* page-flip handling */ | 115 | /* page-flip handling */ |
115 | struct drm_pending_vblank_event *event; | 116 | struct drm_pending_vblank_event *event; |
117 | |||
118 | const struct tegra_dc_soc_info *soc; | ||
116 | }; | 119 | }; |
117 | 120 | ||
118 | static inline struct tegra_dc * | 121 | static inline struct tegra_dc * |