summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vc4
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/vc4')
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.c36
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.h2
-rw-r--r--drivers/gpu/drm/vc4/vc4_regs.h2
3 files changed, 25 insertions, 15 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 1b35313749..c133e96b8a 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -324,21 +324,21 @@ static int vc4_drm_bind(struct device *dev)
if (!is_vc5) {
ret = drmm_mutex_init(drm, &vc4->bin_bo_lock);
if (ret)
- return ret;
+ goto err;
ret = vc4_bo_cache_init(drm);
if (ret)
- return ret;
+ goto err;
}
ret = drmm_mode_config_init(drm);
if (ret)
- return ret;
+ goto err;
if (!is_vc5) {
ret = vc4_gem_init(drm);
if (ret)
- return ret;
+ goto err;
}
node = of_find_compatible_node(NULL, NULL, "raspberrypi,bcm2835-firmware");
@@ -346,13 +346,15 @@ static int vc4_drm_bind(struct device *dev)
firmware = rpi_firmware_get(node);
of_node_put(node);
- if (!firmware)
- return -EPROBE_DEFER;
+ if (!firmware) {
+ ret = -EPROBE_DEFER;
+ goto err;
+ }
}
ret = drm_aperture_remove_framebuffers(driver);
if (ret)
- return ret;
+ goto err;
if (firmware) {
ret = rpi_firmware_property(firmware,
@@ -366,32 +368,33 @@ static int vc4_drm_bind(struct device *dev)
ret = component_bind_all(dev, drm);
if (ret)
- return ret;
+ goto err;
ret = devm_add_action_or_reset(dev, vc4_component_unbind_all, vc4);
if (ret)
- return ret;
+ goto err;
ret = vc4_plane_create_additional_planes(drm);
if (ret)
- goto unbind_all;
+ goto err;
ret = vc4_kms_load(drm);
if (ret < 0)
- goto unbind_all;
+ goto err;
drm_for_each_crtc(crtc, drm)
vc4_crtc_disable_at_boot(crtc);
ret = drm_dev_register(drm, 0);
if (ret < 0)
- goto unbind_all;
+ goto err;
drm_fbdev_dma_setup(drm, 16);
return 0;
-unbind_all:
+err:
+ platform_set_drvdata(pdev, NULL);
return ret;
}
@@ -401,6 +404,7 @@ static void vc4_drm_unbind(struct device *dev)
drm_dev_unplug(drm);
drm_atomic_helper_shutdown(drm);
+ dev_set_drvdata(dev, NULL);
}
static const struct component_master_ops vc4_drm_ops = {
@@ -444,6 +448,11 @@ static void vc4_platform_drm_remove(struct platform_device *pdev)
component_master_del(&pdev->dev, &vc4_drm_ops);
}
+static void vc4_platform_drm_shutdown(struct platform_device *pdev)
+{
+ drm_atomic_helper_shutdown(platform_get_drvdata(pdev));
+}
+
static const struct of_device_id vc4_of_match[] = {
{ .compatible = "brcm,bcm2711-vc5", },
{ .compatible = "brcm,bcm2835-vc4", },
@@ -455,6 +464,7 @@ MODULE_DEVICE_TABLE(of, vc4_of_match);
static struct platform_driver vc4_platform_driver = {
.probe = vc4_platform_drm_probe,
.remove_new = vc4_platform_drm_remove,
+ .shutdown = vc4_platform_drm_shutdown,
.driver = {
.name = "vc4-drm",
.of_match_table = vc4_of_match,
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index bf66499765..ab61e96e7e 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -76,7 +76,7 @@ struct vc4_perfmon {
* Note that counter values can't be reset, but you can fake a reset by
* destroying the perfmon and creating a new one.
*/
- u64 counters[];
+ u64 counters[] __counted_by(ncounters);
};
struct vc4_dev {
diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h
index f3763bd600..8ac9515554 100644
--- a/drivers/gpu/drm/vc4/vc4_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
@@ -588,7 +588,7 @@ enum {
# define VC4_HDMI_HORZA_HAP_MASK VC4_MASK(12, 0)
# define VC4_HDMI_HORZA_HAP_SHIFT 0
-/* Horizontal pack porch (htotal - hsync_end). */
+/* Horizontal back porch (htotal - hsync_end). */
# define VC4_HDMI_HORZB_HBP_MASK VC4_MASK(29, 20)
# define VC4_HDMI_HORZB_HBP_SHIFT 20
/* Horizontal sync pulse (hsync_end - hsync_start). */