Skip to content

Commit 8904a1e

Browse files
committed
Merge tag 'drm/tegra/for-6.4-rc1' of https://gitlab.freedesktop.org/drm/tegra into drm-next
drm/tegra: Changes for v6.4-rc1 The majority of this is minor cleanups and fixes. Other than those, this contains Uwe's conversion to the new driver remove callback and Thomas' fbdev DRM client conversion. The driver can now also be built on other architectures to easy compile coverage. Finally, this adds Mikko as a second maintainer for the driver. As a next step we also want Tegra DRM to move into drm-misc to streamline the maintenance process. Signed-off-by: Daniel Vetter <[email protected]> From: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 52b113e + 2429b3c commit 8904a1e

File tree

30 files changed

+370
-465
lines changed

30 files changed

+370
-465
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6933,6 +6933,7 @@ F: drivers/phy/mediatek/phy-mtk-mipi*
69336933

69346934
DRM DRIVERS FOR NVIDIA TEGRA
69356935
M: Thierry Reding <[email protected]>
6936+
M: Mikko Perttunen <[email protected]>
69366937
69376938
69386939
S: Supported

drivers/gpu/drm/tegra/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
config DRM_TEGRA
33
tristate "NVIDIA Tegra DRM"
4-
depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
4+
depends on ARCH_TEGRA || COMPILE_TEST
55
depends on COMMON_CLK
66
depends on DRM
77
depends on OF

drivers/gpu/drm/tegra/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ tegra-drm-y := \
2929

3030
tegra-drm-y += trace.o
3131

32+
tegra-drm-$(CONFIG_DRM_FBDEV_EMULATION) += fbdev.o
33+
3234
obj-$(CONFIG_DRM_TEGRA) += tegra-drm.o

drivers/gpu/drm/tegra/dc.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,6 @@ static int tegra_crtc_calculate_memory_bandwidth(struct drm_crtc *crtc,
23812381
const struct tegra_plane_state *tegra_state;
23822382
const struct drm_plane_state *plane_state;
23832383
struct tegra_dc *dc = to_tegra_dc(crtc);
2384-
const struct drm_crtc_state *old_state;
23852384
struct drm_crtc_state *new_state;
23862385
struct tegra_plane *tegra;
23872386
struct drm_plane *plane;
@@ -2396,7 +2395,6 @@ static int tegra_crtc_calculate_memory_bandwidth(struct drm_crtc *crtc,
23962395
return 0;
23972396

23982397
new_state = drm_atomic_get_new_crtc_state(state, crtc);
2399-
old_state = drm_atomic_get_old_crtc_state(state, crtc);
24002398

24012399
/*
24022400
* For overlapping planes pixel's data is fetched for each plane at
@@ -3263,27 +3261,15 @@ static int tegra_dc_probe(struct platform_device *pdev)
32633261
return err;
32643262
}
32653263

3266-
static int tegra_dc_remove(struct platform_device *pdev)
3264+
static void tegra_dc_remove(struct platform_device *pdev)
32673265
{
32683266
struct tegra_dc *dc = platform_get_drvdata(pdev);
3269-
int err;
32703267

3271-
err = host1x_client_unregister(&dc->client);
3272-
if (err < 0) {
3273-
dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
3274-
err);
3275-
return err;
3276-
}
3268+
host1x_client_unregister(&dc->client);
32773269

3278-
err = tegra_dc_rgb_remove(dc);
3279-
if (err < 0) {
3280-
dev_err(&pdev->dev, "failed to remove RGB output: %d\n", err);
3281-
return err;
3282-
}
3270+
tegra_dc_rgb_remove(dc);
32833271

32843272
pm_runtime_disable(&pdev->dev);
3285-
3286-
return 0;
32873273
}
32883274

32893275
struct platform_driver tegra_dc_driver = {
@@ -3292,5 +3278,5 @@ struct platform_driver tegra_dc_driver = {
32923278
.of_match_table = tegra_dc_of_match,
32933279
},
32943280
.probe = tegra_dc_probe,
3295-
.remove = tegra_dc_remove,
3281+
.remove_new = tegra_dc_remove,
32963282
};

drivers/gpu/drm/tegra/dc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void tegra_crtc_atomic_post_commit(struct drm_crtc *crtc,
169169

170170
/* from rgb.c */
171171
int tegra_dc_rgb_probe(struct tegra_dc *dc);
172-
int tegra_dc_rgb_remove(struct tegra_dc *dc);
172+
void tegra_dc_rgb_remove(struct tegra_dc *dc);
173173
int tegra_dc_rgb_init(struct drm_device *drm, struct tegra_dc *dc);
174174
int tegra_dc_rgb_exit(struct tegra_dc *dc);
175175

drivers/gpu/drm/tegra/dpaux.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
579579
return 0;
580580
}
581581

582-
static int tegra_dpaux_remove(struct platform_device *pdev)
582+
static void tegra_dpaux_remove(struct platform_device *pdev)
583583
{
584584
struct tegra_dpaux *dpaux = platform_get_drvdata(pdev);
585585

@@ -594,8 +594,6 @@ static int tegra_dpaux_remove(struct platform_device *pdev)
594594
mutex_lock(&dpaux_lock);
595595
list_del(&dpaux->list);
596596
mutex_unlock(&dpaux_lock);
597-
598-
return 0;
599597
}
600598

601599
static int tegra_dpaux_suspend(struct device *dev)
@@ -695,7 +693,7 @@ struct platform_driver tegra_dpaux_driver = {
695693
.pm = pm_ptr(&tegra_dpaux_pm_ops),
696694
},
697695
.probe = tegra_dpaux_probe,
698-
.remove = tegra_dpaux_remove,
696+
.remove_new = tegra_dpaux_remove,
699697
};
700698

701699
struct drm_dp_aux *drm_dp_aux_find_by_of_node(struct device_node *np)

drivers/gpu/drm/tegra/drm.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ static int tegra_atomic_check(struct drm_device *drm,
5656

5757
static const struct drm_mode_config_funcs tegra_drm_mode_config_funcs = {
5858
.fb_create = tegra_fb_create,
59-
#ifdef CONFIG_DRM_FBDEV_EMULATION
60-
.output_poll_changed = drm_fb_helper_output_poll_changed,
61-
#endif
6259
.atomic_check = tegra_atomic_check,
6360
.atomic_commit = drm_atomic_helper_commit,
6461
};
@@ -885,7 +882,6 @@ static const struct drm_driver tegra_drm_driver = {
885882
DRIVER_ATOMIC | DRIVER_RENDER | DRIVER_SYNCOBJ,
886883
.open = tegra_drm_open,
887884
.postclose = tegra_drm_postclose,
888-
.lastclose = drm_fb_helper_lastclose,
889885

890886
#if defined(CONFIG_DEBUG_FS)
891887
.debugfs_init = tegra_debugfs_init,
@@ -1185,15 +1181,11 @@ static int host1x_drm_probe(struct host1x_device *dev)
11851181
drm->mode_config.funcs = &tegra_drm_mode_config_funcs;
11861182
drm->mode_config.helper_private = &tegra_drm_mode_config_helpers;
11871183

1188-
err = tegra_drm_fb_prepare(drm);
1189-
if (err < 0)
1190-
goto config;
1191-
11921184
drm_kms_helper_poll_init(drm);
11931185

11941186
err = host1x_device_init(dev);
11951187
if (err < 0)
1196-
goto fbdev;
1188+
goto poll;
11971189

11981190
/*
11991191
* Now that all display controller have been initialized, the maximum
@@ -1256,18 +1248,14 @@ static int host1x_drm_probe(struct host1x_device *dev)
12561248
if (err < 0)
12571249
goto hub;
12581250

1259-
err = tegra_drm_fb_init(drm);
1251+
err = drm_dev_register(drm, 0);
12601252
if (err < 0)
12611253
goto hub;
12621254

1263-
err = drm_dev_register(drm, 0);
1264-
if (err < 0)
1265-
goto fb;
1255+
tegra_fbdev_setup(drm);
12661256

12671257
return 0;
12681258

1269-
fb:
1270-
tegra_drm_fb_exit(drm);
12711259
hub:
12721260
if (tegra->hub)
12731261
tegra_display_hub_cleanup(tegra->hub);
@@ -1280,10 +1268,8 @@ static int host1x_drm_probe(struct host1x_device *dev)
12801268
}
12811269

12821270
host1x_device_exit(dev);
1283-
fbdev:
1271+
poll:
12841272
drm_kms_helper_poll_fini(drm);
1285-
tegra_drm_fb_free(drm);
1286-
config:
12871273
drm_mode_config_cleanup(drm);
12881274
domain:
12891275
if (tegra->domain)
@@ -1304,7 +1290,6 @@ static int host1x_drm_remove(struct host1x_device *dev)
13041290
drm_dev_unregister(drm);
13051291

13061292
drm_kms_helper_poll_fini(drm);
1307-
tegra_drm_fb_exit(drm);
13081293
drm_atomic_helper_shutdown(drm);
13091294
drm_mode_config_cleanup(drm);
13101295

drivers/gpu/drm/tegra/drm.h

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <drm/drm_bridge.h>
1616
#include <drm/drm_edid.h>
1717
#include <drm/drm_encoder.h>
18-
#include <drm/drm_fb_helper.h>
1918
#include <drm/drm_fixed.h>
2019
#include <drm/drm_probe_helper.h>
2120
#include <uapi/drm/tegra_drm.h>
@@ -29,13 +28,6 @@
2928

3029
struct reset_control;
3130

32-
#ifdef CONFIG_DRM_FBDEV_EMULATION
33-
struct tegra_fbdev {
34-
struct drm_fb_helper base;
35-
struct drm_framebuffer *fb;
36-
};
37-
#endif
38-
3931
struct tegra_drm {
4032
struct drm_device *drm;
4133

@@ -53,10 +45,6 @@ struct tegra_drm {
5345
struct mutex clients_lock;
5446
struct list_head clients;
5547

56-
#ifdef CONFIG_DRM_FBDEV_EMULATION
57-
struct tegra_fbdev *fbdev;
58-
#endif
59-
6048
unsigned int hmask, vmask;
6149
unsigned int pitch_align;
6250
unsigned int num_crtcs;
@@ -196,13 +184,20 @@ struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer,
196184
bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer);
197185
int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer,
198186
struct tegra_bo_tiling *tiling);
187+
struct drm_framebuffer *tegra_fb_alloc(struct drm_device *drm,
188+
const struct drm_mode_fb_cmd2 *mode_cmd,
189+
struct tegra_bo **planes,
190+
unsigned int num_planes);
199191
struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
200192
struct drm_file *file,
201193
const struct drm_mode_fb_cmd2 *cmd);
202-
int tegra_drm_fb_prepare(struct drm_device *drm);
203-
void tegra_drm_fb_free(struct drm_device *drm);
204-
int tegra_drm_fb_init(struct drm_device *drm);
205-
void tegra_drm_fb_exit(struct drm_device *drm);
194+
195+
#ifdef CONFIG_DRM_FBDEV_EMULATION
196+
void tegra_fbdev_setup(struct drm_device *drm);
197+
#else
198+
static inline void tegra_fbdev_setup(struct drm_device *drm)
199+
{ }
200+
#endif
206201

207202
extern struct platform_driver tegra_display_hub_driver;
208203
extern struct platform_driver tegra_dc_driver;

drivers/gpu/drm/tegra/dsi.c

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,15 @@ static void tegra_dsi_encoder_enable(struct drm_encoder *encoder)
912912
u32 value;
913913
int err;
914914

915+
/* If the bootloader enabled DSI it needs to be disabled
916+
* in order for the panel initialization commands to be
917+
* properly sent.
918+
*/
919+
value = tegra_dsi_readl(dsi, DSI_POWER_CONTROL);
920+
921+
if (value & DSI_POWER_CONTROL_ENABLE)
922+
tegra_dsi_disable(dsi);
923+
915924
err = tegra_dsi_prepare(dsi);
916925
if (err < 0) {
917926
dev_err(dsi->dev, "failed to prepare: %d\n", err);
@@ -1589,28 +1598,24 @@ static int tegra_dsi_probe(struct platform_device *pdev)
15891598
}
15901599

15911600
dsi->clk = devm_clk_get(&pdev->dev, NULL);
1592-
if (IS_ERR(dsi->clk)) {
1593-
dev_err(&pdev->dev, "cannot get DSI clock\n");
1594-
return PTR_ERR(dsi->clk);
1595-
}
1601+
if (IS_ERR(dsi->clk))
1602+
return dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk),
1603+
"cannot get DSI clock\n");
15961604

15971605
dsi->clk_lp = devm_clk_get(&pdev->dev, "lp");
1598-
if (IS_ERR(dsi->clk_lp)) {
1599-
dev_err(&pdev->dev, "cannot get low-power clock\n");
1600-
return PTR_ERR(dsi->clk_lp);
1601-
}
1606+
if (IS_ERR(dsi->clk_lp))
1607+
return dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk_lp),
1608+
"cannot get low-power clock\n");
16021609

16031610
dsi->clk_parent = devm_clk_get(&pdev->dev, "parent");
1604-
if (IS_ERR(dsi->clk_parent)) {
1605-
dev_err(&pdev->dev, "cannot get parent clock\n");
1606-
return PTR_ERR(dsi->clk_parent);
1607-
}
1611+
if (IS_ERR(dsi->clk_parent))
1612+
return dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk_parent),
1613+
"cannot get parent clock\n");
16081614

16091615
dsi->vdd = devm_regulator_get(&pdev->dev, "avdd-dsi-csi");
1610-
if (IS_ERR(dsi->vdd)) {
1611-
dev_err(&pdev->dev, "cannot get VDD supply\n");
1612-
return PTR_ERR(dsi->vdd);
1613-
}
1616+
if (IS_ERR(dsi->vdd))
1617+
return dev_err_probe(&pdev->dev, PTR_ERR(dsi->vdd),
1618+
"cannot get VDD supply\n");
16141619

16151620
err = tegra_dsi_setup_clocks(dsi);
16161621
if (err < 0) {
@@ -1659,26 +1664,18 @@ static int tegra_dsi_probe(struct platform_device *pdev)
16591664
return err;
16601665
}
16611666

1662-
static int tegra_dsi_remove(struct platform_device *pdev)
1667+
static void tegra_dsi_remove(struct platform_device *pdev)
16631668
{
16641669
struct tegra_dsi *dsi = platform_get_drvdata(pdev);
1665-
int err;
16661670

16671671
pm_runtime_disable(&pdev->dev);
16681672

1669-
err = host1x_client_unregister(&dsi->client);
1670-
if (err < 0) {
1671-
dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
1672-
err);
1673-
return err;
1674-
}
1673+
host1x_client_unregister(&dsi->client);
16751674

16761675
tegra_output_remove(&dsi->output);
16771676

16781677
mipi_dsi_host_unregister(&dsi->host);
16791678
tegra_mipi_free(dsi->mipi);
1680-
1681-
return 0;
16821679
}
16831680

16841681
static const struct of_device_id tegra_dsi_of_match[] = {
@@ -1696,5 +1693,5 @@ struct platform_driver tegra_dsi_driver = {
16961693
.of_match_table = tegra_dsi_of_match,
16971694
},
16981695
.probe = tegra_dsi_probe,
1699-
.remove = tegra_dsi_remove,
1696+
.remove_new = tegra_dsi_remove,
17001697
};

0 commit comments

Comments
 (0)