diff options
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r-- | drivers/gpu/drm/tegra/Kconfig | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/dpaux.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/drm.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/fbdev.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/gr2d.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/gr3d.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/hdmi.c | 51 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/hub.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/nvdec.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/sor.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/vic.c | 19 |
13 files changed, 82 insertions, 78 deletions
diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig index 498313778175..84e7e6bc3a0c 100644 --- a/drivers/gpu/drm/tegra/Kconfig +++ b/drivers/gpu/drm/tegra/Kconfig @@ -12,7 +12,7 @@ config DRM_TEGRA select DRM_KMS_HELPER select DRM_MIPI_DSI select DRM_PANEL - select FB_SYS_HELPERS if DRM_FBDEV_EMULATION + select FB_DMAMEM_HELPERS if DRM_FBDEV_EMULATION select TEGRA_HOST1X select INTERCONNECT select IOMMU_IOVA diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 6e78416e64b0..13b182ab905f 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -11,7 +11,8 @@ #include <linux/iommu.h> #include <linux/interconnect.h> #include <linux/module.h> -#include <linux/of_device.h> +#include <linux/of.h> +#include <linux/platform_device.h> #include <linux/pm_domain.h> #include <linux/pm_opp.h> #include <linux/pm_runtime.h> diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index 4d2677dcd831..ef02d530f78d 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -8,7 +8,7 @@ #include <linux/interrupt.h> #include <linux/io.h> #include <linux/module.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/pinctrl/pinconf-generic.h> #include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinmux.h> @@ -447,7 +447,6 @@ static const struct pinmux_ops tegra_dpaux_pinmux_ops = { static int tegra_dpaux_probe(struct platform_device *pdev) { struct tegra_dpaux *dpaux; - struct resource *regs; u32 value; int err; @@ -461,14 +460,13 @@ static int tegra_dpaux_probe(struct platform_device *pdev) INIT_LIST_HEAD(&dpaux->list); dpaux->dev = &pdev->dev; - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dpaux->regs = devm_ioremap_resource(&pdev->dev, regs); + dpaux->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(dpaux->regs)) return PTR_ERR(dpaux->regs); dpaux->irq = platform_get_irq(pdev, 0); if (dpaux->irq < 0) - return -ENXIO; + return dpaux->irq; if (!pdev->dev.pm_domain) { dpaux->rst = devm_reset_control_get(&pdev->dev, "dpaux"); diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 35ff303c6674..ff36171c8fb7 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -887,8 +887,6 @@ static const struct drm_driver tegra_drm_driver = { .debugfs_init = tegra_debugfs_init, #endif - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import = tegra_gem_prime_import, .dumb_create = tegra_bo_dumb_create, diff --git a/drivers/gpu/drm/tegra/fbdev.c b/drivers/gpu/drm/tegra/fbdev.c index d042234e1807..db6eaac3d30e 100644 --- a/drivers/gpu/drm/tegra/fbdev.c +++ b/drivers/gpu/drm/tegra/fbdev.c @@ -59,9 +59,9 @@ static void tegra_fbdev_fb_destroy(struct fb_info *info) static const struct fb_ops tegra_fb_ops = { .owner = THIS_MODULE, - __FB_DEFAULT_SYS_OPS_RDWR, + __FB_DEFAULT_DMAMEM_OPS_RDWR, DRM_FB_HELPER_DEFAULT_OPS, - __FB_DEFAULT_SYS_OPS_DRAW, + __FB_DEFAULT_DMAMEM_OPS_DRAW, .fb_mmap = tegra_fb_mmap, .fb_destroy = tegra_fbdev_fb_destroy, }; @@ -132,7 +132,8 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, } } - info->screen_base = (void __iomem *)bo->vaddr + offset; + info->flags |= FBINFO_VIRTFB; + info->screen_buffer = bo->vaddr + offset; info->screen_size = size; info->fix.smem_start = (unsigned long)(bo->iova + offset); info->fix.smem_len = size; diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index dea38892d6e6..a4023163493d 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -694,8 +694,6 @@ static int tegra_gem_prime_mmap(struct dma_buf *buf, struct vm_area_struct *vma) struct drm_gem_object *gem = buf->priv; int err; - dma_resv_assert_held(buf->resv); - err = drm_gem_mmap_obj(gem, gem->size, vma); if (err < 0) return err; diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c index 50f77fddda54..a160d01f26e1 100644 --- a/drivers/gpu/drm/tegra/gr2d.c +++ b/drivers/gpu/drm/tegra/gr2d.c @@ -7,7 +7,8 @@ #include <linux/delay.h> #include <linux/iommu.h> #include <linux/module.h> -#include <linux/of_device.h> +#include <linux/of.h> +#include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/reset.h> @@ -70,22 +71,15 @@ static int gr2d_init(struct host1x_client *client) goto free; } - pm_runtime_enable(client->dev); - pm_runtime_use_autosuspend(client->dev); - pm_runtime_set_autosuspend_delay(client->dev, 200); - err = tegra_drm_register_client(dev->dev_private, drm); if (err < 0) { dev_err(client->dev, "failed to register client: %d\n", err); - goto disable_rpm; + goto detach_iommu; } return 0; -disable_rpm: - pm_runtime_dont_use_autosuspend(client->dev); - pm_runtime_force_suspend(client->dev); - +detach_iommu: host1x_client_iommu_detach(client); free: host1x_syncpt_put(client->syncpts[0]); @@ -299,6 +293,7 @@ static void gr2d_remove(struct platform_device *pdev) { struct gr2d *gr2d = platform_get_drvdata(pdev); + pm_runtime_disable(&pdev->dev); host1x_client_unregister(&gr2d->client.base); } @@ -372,6 +367,10 @@ static int __maybe_unused gr2d_runtime_resume(struct device *dev) goto disable_clk; } + pm_runtime_enable(dev); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_autosuspend_delay(dev, 500); + return 0; disable_clk: diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index c026c2c916c1..00c8564520e7 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -9,7 +9,7 @@ #include <linux/host1x.h> #include <linux/iommu.h> #include <linux/module.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/pm_domain.h> #include <linux/pm_opp.h> @@ -80,22 +80,15 @@ static int gr3d_init(struct host1x_client *client) goto free; } - pm_runtime_enable(client->dev); - pm_runtime_use_autosuspend(client->dev); - pm_runtime_set_autosuspend_delay(client->dev, 200); - err = tegra_drm_register_client(dev->dev_private, drm); if (err < 0) { dev_err(client->dev, "failed to register client: %d\n", err); - goto disable_rpm; + goto detach_iommu; } return 0; -disable_rpm: - pm_runtime_dont_use_autosuspend(client->dev); - pm_runtime_force_suspend(client->dev); - +detach_iommu: host1x_client_iommu_detach(client); free: host1x_syncpt_put(client->syncpts[0]); @@ -554,6 +547,7 @@ static void gr3d_remove(struct platform_device *pdev) { struct gr3d *gr3d = platform_get_drvdata(pdev); + pm_runtime_disable(&pdev->dev); host1x_client_unregister(&gr3d->client.base); } @@ -607,6 +601,10 @@ static int __maybe_unused gr3d_runtime_resume(struct device *dev) goto disable_clk; } + pm_runtime_enable(dev); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_autosuspend_delay(dev, 500); + return 0; disable_clk: diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 6eac54ae1205..80c760986d9e 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -10,7 +10,8 @@ #include <linux/hdmi.h> #include <linux/math64.h> #include <linux/module.h> -#include <linux/of_device.h> +#include <linux/of.h> +#include <linux/platform_device.h> #include <linux/pm_opp.h> #include <linux/pm_runtime.h> #include <linux/regulator/consumer.h> @@ -19,6 +20,7 @@ #include <soc/tegra/common.h> #include <sound/hdmi-codec.h> +#include <drm/drm_bridge_connector.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_debugfs.h> @@ -1544,26 +1546,47 @@ static int tegra_hdmi_init(struct host1x_client *client) { struct tegra_hdmi *hdmi = host1x_client_to_hdmi(client); struct drm_device *drm = dev_get_drvdata(client->host); + struct drm_connector *connector; int err; hdmi->output.dev = client->dev; - drm_connector_init_with_ddc(drm, &hdmi->output.connector, - &tegra_hdmi_connector_funcs, - DRM_MODE_CONNECTOR_HDMIA, - hdmi->output.ddc); - drm_connector_helper_add(&hdmi->output.connector, - &tegra_hdmi_connector_helper_funcs); - hdmi->output.connector.dpms = DRM_MODE_DPMS_OFF; - drm_simple_encoder_init(drm, &hdmi->output.encoder, DRM_MODE_ENCODER_TMDS); drm_encoder_helper_add(&hdmi->output.encoder, &tegra_hdmi_encoder_helper_funcs); - drm_connector_attach_encoder(&hdmi->output.connector, - &hdmi->output.encoder); - drm_connector_register(&hdmi->output.connector); + if (hdmi->output.bridge) { + err = drm_bridge_attach(&hdmi->output.encoder, hdmi->output.bridge, + NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); + if (err) { + dev_err(client->dev, "failed to attach bridge: %d\n", + err); + return err; + } + + connector = drm_bridge_connector_init(drm, &hdmi->output.encoder); + if (IS_ERR(connector)) { + dev_err(client->dev, + "failed to initialize bridge connector: %pe\n", + connector); + return PTR_ERR(connector); + } + + drm_connector_attach_encoder(connector, &hdmi->output.encoder); + } else { + drm_connector_init_with_ddc(drm, &hdmi->output.connector, + &tegra_hdmi_connector_funcs, + DRM_MODE_CONNECTOR_HDMIA, + hdmi->output.ddc); + drm_connector_helper_add(&hdmi->output.connector, + &tegra_hdmi_connector_helper_funcs); + hdmi->output.connector.dpms = DRM_MODE_DPMS_OFF; + + drm_connector_attach_encoder(&hdmi->output.connector, + &hdmi->output.encoder); + drm_connector_register(&hdmi->output.connector); + } err = tegra_output_init(drm, &hdmi->output); if (err < 0) { @@ -1769,7 +1792,6 @@ static irqreturn_t tegra_hdmi_irq(int irq, void *data) static int tegra_hdmi_probe(struct platform_device *pdev) { struct tegra_hdmi *hdmi; - struct resource *regs; int err; hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); @@ -1831,8 +1853,7 @@ static int tegra_hdmi_probe(struct platform_device *pdev) if (err < 0) return err; - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hdmi->regs = devm_ioremap_resource(&pdev->dev, regs); + hdmi->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(hdmi->regs)) return PTR_ERR(hdmi->regs); diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c index 916857361a91..1af5f8318d91 100644 --- a/drivers/gpu/drm/tegra/hub.c +++ b/drivers/gpu/drm/tegra/hub.c @@ -9,8 +9,8 @@ #include <linux/host1x.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/of_graph.h> +#include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/reset.h> diff --git a/drivers/gpu/drm/tegra/nvdec.c b/drivers/gpu/drm/tegra/nvdec.c index ae78a81e5eef..4860790666af 100644 --- a/drivers/gpu/drm/tegra/nvdec.c +++ b/drivers/gpu/drm/tegra/nvdec.c @@ -11,8 +11,6 @@ #include <linux/iopoll.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> -#include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/reset.h> @@ -177,13 +175,9 @@ static int nvdec_init(struct host1x_client *client) goto free_channel; } - pm_runtime_enable(client->dev); - pm_runtime_use_autosuspend(client->dev); - pm_runtime_set_autosuspend_delay(client->dev, 500); - err = tegra_drm_register_client(tegra, drm); if (err < 0) - goto disable_rpm; + goto free_syncpt; /* * Inherit the DMA parameters (such as maximum segment size) from the @@ -193,10 +187,7 @@ static int nvdec_init(struct host1x_client *client) return 0; -disable_rpm: - pm_runtime_dont_use_autosuspend(client->dev); - pm_runtime_force_suspend(client->dev); - +free_syncpt: host1x_syncpt_put(client->syncpts[0]); free_channel: host1x_channel_put(nvdec->channel); @@ -276,6 +267,8 @@ static int nvdec_load_falcon_firmware(struct nvdec *nvdec) return err; } else { virt = tegra_drm_alloc(tegra, size, &iova); + if (IS_ERR(virt)) + return PTR_ERR(virt); } nvdec->falcon.firmware.virt = virt; @@ -539,6 +532,10 @@ static int nvdec_probe(struct platform_device *pdev) goto exit_falcon; } + pm_runtime_enable(dev); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_autosuspend_delay(dev, 500); + return 0; exit_falcon: @@ -551,8 +548,8 @@ static void nvdec_remove(struct platform_device *pdev) { struct nvdec *nvdec = platform_get_drvdata(pdev); + pm_runtime_disable(&pdev->dev); host1x_client_unregister(&nvdec->client.base); - falcon_exit(&nvdec->falcon); } diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index abd6e3b92293..61b437a84806 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -8,7 +8,7 @@ #include <linux/debugfs.h> #include <linux/io.h> #include <linux/module.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/regulator/consumer.h> @@ -3708,7 +3708,6 @@ static int tegra_sor_probe(struct platform_device *pdev) { struct device_node *np; struct tegra_sor *sor; - struct resource *regs; int err; sor = devm_kzalloc(&pdev->dev, sizeof(*sor), GFP_KERNEL); @@ -3781,8 +3780,7 @@ static int tegra_sor_probe(struct platform_device *pdev) } } - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - sor->regs = devm_ioremap_resource(&pdev->dev, regs); + sor->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(sor->regs)) { err = PTR_ERR(sor->regs); goto remove; diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index da7a038dca20..73c356f1c901 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -10,8 +10,6 @@ #include <linux/iommu.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> -#include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/reset.h> @@ -143,13 +141,9 @@ static int vic_init(struct host1x_client *client) goto free_channel; } - pm_runtime_enable(client->dev); - pm_runtime_use_autosuspend(client->dev); - pm_runtime_set_autosuspend_delay(client->dev, 500); - err = tegra_drm_register_client(tegra, drm); if (err < 0) - goto disable_rpm; + goto free_syncpt; /* * Inherit the DMA parameters (such as maximum segment size) from the @@ -159,10 +153,7 @@ static int vic_init(struct host1x_client *client) return 0; -disable_rpm: - pm_runtime_dont_use_autosuspend(client->dev); - pm_runtime_force_suspend(client->dev); - +free_syncpt: host1x_syncpt_put(client->syncpts[0]); free_channel: host1x_channel_put(vic->channel); @@ -529,6 +520,10 @@ static int vic_probe(struct platform_device *pdev) goto exit_falcon; } + pm_runtime_enable(dev); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_autosuspend_delay(dev, 500); + return 0; exit_falcon: @@ -541,8 +536,8 @@ static void vic_remove(struct platform_device *pdev) { struct vic *vic = platform_get_drvdata(pdev); + pm_runtime_disable(&pdev->dev); host1x_client_unregister(&vic->client.base); - falcon_exit(&vic->falcon); } |