Skip to content

Commit fd7226f

Browse files
committed
Merge tag 'drm/tegra/for-5.6-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next
drm/tegra: Changes for v5.6-rc1 This contains a small set of mostly fixes and some minor improvements. Signed-off-by: Dave Airlie <[email protected]> From: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 688486a + 033ccdb commit fd7226f

File tree

17 files changed

+593
-352
lines changed

17 files changed

+593
-352
lines changed

drivers/gpu/drm/tegra/dc.c

Lines changed: 87 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,6 +1727,7 @@ static void tegra_crtc_atomic_disable(struct drm_crtc *crtc,
17271727
{
17281728
struct tegra_dc *dc = to_tegra_dc(crtc);
17291729
u32 value;
1730+
int err;
17301731

17311732
if (!tegra_dc_idle(dc)) {
17321733
tegra_dc_stop(dc);
@@ -1773,7 +1774,9 @@ static void tegra_crtc_atomic_disable(struct drm_crtc *crtc,
17731774

17741775
spin_unlock_irq(&crtc->dev->event_lock);
17751776

1776-
pm_runtime_put_sync(dc->dev);
1777+
err = host1x_client_suspend(&dc->client);
1778+
if (err < 0)
1779+
dev_err(dc->dev, "failed to suspend: %d\n", err);
17771780
}
17781781

17791782
static void tegra_crtc_atomic_enable(struct drm_crtc *crtc,
@@ -1783,8 +1786,13 @@ static void tegra_crtc_atomic_enable(struct drm_crtc *crtc,
17831786
struct tegra_dc_state *state = to_dc_state(crtc->state);
17841787
struct tegra_dc *dc = to_tegra_dc(crtc);
17851788
u32 value;
1789+
int err;
17861790

1787-
pm_runtime_get_sync(dc->dev);
1791+
err = host1x_client_resume(&dc->client);
1792+
if (err < 0) {
1793+
dev_err(dc->dev, "failed to resume: %d\n", err);
1794+
return;
1795+
}
17881796

17891797
/* initialize display controller */
17901798
if (dc->syncpt) {
@@ -1996,7 +2004,7 @@ static bool tegra_dc_has_window_groups(struct tegra_dc *dc)
19962004

19972005
static int tegra_dc_init(struct host1x_client *client)
19982006
{
1999-
struct drm_device *drm = dev_get_drvdata(client->parent);
2007+
struct drm_device *drm = dev_get_drvdata(client->host);
20002008
unsigned long flags = HOST1X_SYNCPT_CLIENT_MANAGED;
20012009
struct tegra_dc *dc = host1x_client_to_dc(client);
20022010
struct tegra_drm *tegra = drm->dev_private;
@@ -2012,6 +2020,15 @@ static int tegra_dc_init(struct host1x_client *client)
20122020
if (!tegra_dc_has_window_groups(dc))
20132021
return 0;
20142022

2023+
/*
2024+
* Set the display hub as the host1x client parent for the display
2025+
* controller. This is needed for the runtime reference counting that
2026+
* ensures the display hub is always powered when any of the display
2027+
* controllers are.
2028+
*/
2029+
if (dc->soc->has_nvdisplay)
2030+
client->parent = &tegra->hub->client;
2031+
20152032
dc->syncpt = host1x_syncpt_request(client, flags);
20162033
if (!dc->syncpt)
20172034
dev_warn(dc->dev, "failed to allocate syncpoint\n");
@@ -2077,9 +2094,9 @@ static int tegra_dc_init(struct host1x_client *client)
20772094

20782095
/*
20792096
* Inherit the DMA parameters (such as maximum segment size) from the
2080-
* parent device.
2097+
* parent host1x device.
20812098
*/
2082-
client->dev->dma_parms = client->parent->dma_parms;
2099+
client->dev->dma_parms = client->host->dma_parms;
20832100

20842101
return 0;
20852102

@@ -2121,9 +2138,74 @@ static int tegra_dc_exit(struct host1x_client *client)
21212138
return 0;
21222139
}
21232140

2141+
static int tegra_dc_runtime_suspend(struct host1x_client *client)
2142+
{
2143+
struct tegra_dc *dc = host1x_client_to_dc(client);
2144+
struct device *dev = client->dev;
2145+
int err;
2146+
2147+
err = reset_control_assert(dc->rst);
2148+
if (err < 0) {
2149+
dev_err(dev, "failed to assert reset: %d\n", err);
2150+
return err;
2151+
}
2152+
2153+
if (dc->soc->has_powergate)
2154+
tegra_powergate_power_off(dc->powergate);
2155+
2156+
clk_disable_unprepare(dc->clk);
2157+
pm_runtime_put_sync(dev);
2158+
2159+
return 0;
2160+
}
2161+
2162+
static int tegra_dc_runtime_resume(struct host1x_client *client)
2163+
{
2164+
struct tegra_dc *dc = host1x_client_to_dc(client);
2165+
struct device *dev = client->dev;
2166+
int err;
2167+
2168+
err = pm_runtime_get_sync(dev);
2169+
if (err < 0) {
2170+
dev_err(dev, "failed to get runtime PM: %d\n", err);
2171+
return err;
2172+
}
2173+
2174+
if (dc->soc->has_powergate) {
2175+
err = tegra_powergate_sequence_power_up(dc->powergate, dc->clk,
2176+
dc->rst);
2177+
if (err < 0) {
2178+
dev_err(dev, "failed to power partition: %d\n", err);
2179+
goto put_rpm;
2180+
}
2181+
} else {
2182+
err = clk_prepare_enable(dc->clk);
2183+
if (err < 0) {
2184+
dev_err(dev, "failed to enable clock: %d\n", err);
2185+
goto put_rpm;
2186+
}
2187+
2188+
err = reset_control_deassert(dc->rst);
2189+
if (err < 0) {
2190+
dev_err(dev, "failed to deassert reset: %d\n", err);
2191+
goto disable_clk;
2192+
}
2193+
}
2194+
2195+
return 0;
2196+
2197+
disable_clk:
2198+
clk_disable_unprepare(dc->clk);
2199+
put_rpm:
2200+
pm_runtime_put_sync(dev);
2201+
return err;
2202+
}
2203+
21242204
static const struct host1x_client_ops dc_client_ops = {
21252205
.init = tegra_dc_init,
21262206
.exit = tegra_dc_exit,
2207+
.suspend = tegra_dc_runtime_suspend,
2208+
.resume = tegra_dc_runtime_resume,
21272209
};
21282210

21292211
static const struct tegra_dc_soc_info tegra20_dc_soc_info = {
@@ -2535,65 +2617,10 @@ static int tegra_dc_remove(struct platform_device *pdev)
25352617
return 0;
25362618
}
25372619

2538-
#ifdef CONFIG_PM
2539-
static int tegra_dc_suspend(struct device *dev)
2540-
{
2541-
struct tegra_dc *dc = dev_get_drvdata(dev);
2542-
int err;
2543-
2544-
err = reset_control_assert(dc->rst);
2545-
if (err < 0) {
2546-
dev_err(dev, "failed to assert reset: %d\n", err);
2547-
return err;
2548-
}
2549-
2550-
if (dc->soc->has_powergate)
2551-
tegra_powergate_power_off(dc->powergate);
2552-
2553-
clk_disable_unprepare(dc->clk);
2554-
2555-
return 0;
2556-
}
2557-
2558-
static int tegra_dc_resume(struct device *dev)
2559-
{
2560-
struct tegra_dc *dc = dev_get_drvdata(dev);
2561-
int err;
2562-
2563-
if (dc->soc->has_powergate) {
2564-
err = tegra_powergate_sequence_power_up(dc->powergate, dc->clk,
2565-
dc->rst);
2566-
if (err < 0) {
2567-
dev_err(dev, "failed to power partition: %d\n", err);
2568-
return err;
2569-
}
2570-
} else {
2571-
err = clk_prepare_enable(dc->clk);
2572-
if (err < 0) {
2573-
dev_err(dev, "failed to enable clock: %d\n", err);
2574-
return err;
2575-
}
2576-
2577-
err = reset_control_deassert(dc->rst);
2578-
if (err < 0) {
2579-
dev_err(dev, "failed to deassert reset: %d\n", err);
2580-
return err;
2581-
}
2582-
}
2583-
2584-
return 0;
2585-
}
2586-
#endif
2587-
2588-
static const struct dev_pm_ops tegra_dc_pm_ops = {
2589-
SET_RUNTIME_PM_OPS(tegra_dc_suspend, tegra_dc_resume, NULL)
2590-
};
2591-
25922620
struct platform_driver tegra_dc_driver = {
25932621
.driver = {
25942622
.name = "tegra-dc",
25952623
.of_match_table = tegra_dc_of_match,
2596-
.pm = &tegra_dc_pm_ops,
25972624
},
25982625
.probe = tegra_dc_probe,
25992626
.remove = tegra_dc_remove,

drivers/gpu/drm/tegra/dpaux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ static int tegra_dpaux_remove(struct platform_device *pdev)
588588
/* make sure pads are powered down when not in use */
589589
tegra_dpaux_pad_power_down(dpaux);
590590

591-
pm_runtime_put(&pdev->dev);
591+
pm_runtime_put_sync(&pdev->dev);
592592
pm_runtime_disable(&pdev->dev);
593593

594594
drm_dp_aux_unregister(&dpaux->aux);

drivers/gpu/drm/tegra/drm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra,
905905
int host1x_client_iommu_attach(struct host1x_client *client)
906906
{
907907
struct iommu_domain *domain = iommu_get_domain_for_dev(client->dev);
908-
struct drm_device *drm = dev_get_drvdata(client->parent);
908+
struct drm_device *drm = dev_get_drvdata(client->host);
909909
struct tegra_drm *tegra = drm->dev_private;
910910
struct iommu_group *group = NULL;
911911
int err;
@@ -941,7 +941,7 @@ int host1x_client_iommu_attach(struct host1x_client *client)
941941

942942
void host1x_client_iommu_detach(struct host1x_client *client)
943943
{
944-
struct drm_device *drm = dev_get_drvdata(client->parent);
944+
struct drm_device *drm = dev_get_drvdata(client->host);
945945
struct tegra_drm *tegra = drm->dev_private;
946946
struct iommu_domain *domain;
947947

drivers/gpu/drm/tegra/drm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output);
144144
void tegra_output_exit(struct tegra_output *output);
145145
void tegra_output_find_possible_crtcs(struct tegra_output *output,
146146
struct drm_device *drm);
147+
int tegra_output_suspend(struct tegra_output *output);
148+
int tegra_output_resume(struct tegra_output *output);
147149

148150
int tegra_output_connector_get_modes(struct drm_connector *connector);
149151
enum drm_connector_status

0 commit comments

Comments
 (0)