History

Merge tag 'du-next-20210105' of git://linuxtv.org/pinchartl/media into drm-next

- Add default modes for connectors in unknown state - R-Car DU conversion to DRM-managed API - R-Car DU miscellaneous fixes - Miscellaneous bridge and bridge bindings fixes - Assorted misc driver cleanups - Constify drm_driver for PCI devices

Daniel Vetter committed 5 years ago

Commit 73dc9232 parents ca765c7 3fc5a2835 files · +209 −226Browse files

Unified · Split

35 files
  1. Documentation/devicetree/bindings/display/bridge/renesas,lvds.yaml +3 −3
  2. Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.yaml +11 −5
  3. drivers/gpu/drm/arc/arcpgu_crtc.c +2 −7
  4. drivers/gpu/drm/arc/arcpgu_drv.c +1 −1
  5. drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2 −4
  6. drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +2 −4
  7. drivers/gpu/drm/bridge/thc63lvd1024.c +1 −1
  8. drivers/gpu/drm/drm_drv.c +0 −4
  9. drivers/gpu/drm/drm_dumb_buffers.c +5 −3
  10. drivers/gpu/drm/drm_gem.c +1 −11
  11. drivers/gpu/drm/drm_internal.h +3 −0
  12. drivers/gpu/drm/drm_pci.c +22 −11
  13. drivers/gpu/drm/drm_probe_helper.c +2 −1
  14. drivers/gpu/drm/kmb/kmb_drv.c +1 −1
  15. drivers/gpu/drm/rcar-du/rcar_cmm.c +1 −1
  16. drivers/gpu/drm/rcar-du/rcar_du_crtc.c +3 −9
  17. drivers/gpu/drm/rcar-du/rcar_du_drv.c +13 −20
  18. drivers/gpu/drm/rcar-du/rcar_du_drv.h +11 −5
  19. drivers/gpu/drm/rcar-du/rcar_du_encoder.c +49 −49
  20. drivers/gpu/drm/rcar-du/rcar_du_encoder.h +0 −2
  21. drivers/gpu/drm/rcar-du/rcar_du_kms.c +29 −13
  22. drivers/gpu/drm/rcar-du/rcar_du_plane.c +4 −4
  23. drivers/gpu/drm/rcar-du/rcar_du_vsp.c +20 −8
  24. drivers/gpu/drm/rcar-du/rcar_du_writeback.c +1 −1
  25. drivers/gpu/drm/sti/sti_cursor.c +1 −8
  26. drivers/gpu/drm/sti/sti_gdp.c +1 −8
  27. drivers/gpu/drm/sti/sti_hqvdp.c +1 −8
  28. drivers/gpu/drm/tdfx/tdfx_drv.c +1 −1
  29. drivers/gpu/drm/vc4/vc4_plane.c +1 −6
  30. drivers/gpu/drm/zte/zx_plane.c +1 −6
  31. include/drm/drm_device.h +3 −11
  32. include/drm/drm_drv.h +0 −2
  33. include/drm/drm_gem.h +0 −3
  34. include/drm/drm_legacy.h +6 −4
  35. include/drm/drm_modeset_helper_vtables.h +7 −1
Documentation/devicetree/bindings/display/bridge/renesas,lvds.yaml+3−3
@@ -83,9 +83,9 @@ properties: · 82 unmodified lines
8383 $ref: /schemas/types.yaml#/definitions/phandle
8484 description:
8585 phandle to the companion LVDS encoder. This property is mandatory
86− for the first LVDS encoder on D3 and E3 SoCs, and shall point to
87− the second encoder to be used as a companion in dual-link mode. It
88− shall not be set for any other LVDS encoder.
86+ for the first LVDS encoder on R-Car D3 and E3, and RZ/G2E SoCs, and shall
87+ point to the second encoder to be used as a companion in dual-link mode.
88+ It shall not be set for any other LVDS encoder.
8989
9090 required:
9191 - compatible
Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.yaml+11−5
@@ -30,11 +30,17 @@ properties: · 29 unmodified lines
3030 This device has four video ports. Their connections are modeled using the
3131 OF graph bindings specified in Documentation/devicetree/bindings/graph.txt.
3232
33− The device can operate in single-link mode or dual-link mode. In
34− single-link mode, all pixels are received on port@0, and port@1 shall not
35− contain any endpoint. In dual-link mode, even-numbered pixels are
36− received on port@0 and odd-numbered pixels on port@1, and both port@0 and
37− port@1 shall contain endpoints.
33+ The device can operate in single or dual input and output modes.
34+
35+ When operating in single input mode, all pixels are received on port@0,
36+ and port@1 shall not contain any endpoint. In dual input mode,
37+ even-numbered pixels are received on port@0 and odd-numbered pixels on
38+ port@1, and both port@0 and port@1 shall contain endpoints.
39+
40+ When operating in single output mode all pixels are output from the first
41+ CMOS/TTL port and port@3 shall not contain any endpoint. In dual output
42+ mode pixels are output from both CMOS/TTL ports and both port@2 and
43+ port@3 shall contain endpoints.
3844
3945 properties:
4046 '#address-cells':
drivers/gpu/drm/arc/arcpgu_crtc.c+2−7
@@ -162,15 +162,10 @@ static const struct drm_plane_helper_funcs arc_pgu_plane_helper_funcs = { · 161 unmodified lines
162162 .atomic_update = arc_pgu_plane_atomic_update,
163163 };
164164
165−static void arc_pgu_plane_destroy(struct drm_plane *plane)
166−{
167− drm_plane_cleanup(plane);
168−}
169−
170165 static const struct drm_plane_funcs arc_pgu_plane_funcs = {
171166 .update_plane = drm_atomic_helper_update_plane,
172167 .disable_plane = drm_atomic_helper_disable_plane,
173− .destroy = arc_pgu_plane_destroy,
168+ .destroy = drm_plane_cleanup,
174169 .reset = drm_atomic_helper_plane_reset,
175170 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
176171 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
@@ -213,7 +208,7 @@ int arc_pgu_setup_crtc(struct drm_device *drm) · 36 unmodified lines
213208 ret = drm_crtc_init_with_planes(drm, &arcpgu->crtc, primary, NULL,
214209 &arc_pgu_crtc_funcs, NULL);
215210 if (ret) {
216− arc_pgu_plane_destroy(primary);
211+ drm_plane_cleanup(primary);
217212 return ret;
218213 }
219214
drivers/gpu/drm/arc/arcpgu_drv.c+1−1
@@ -145,7 +145,7 @@ static void arcpgu_debugfs_init(struct drm_minor *minor) · 144 unmodified lines
145145 }
146146 #endif
147147
148−static struct drm_driver arcpgu_drm_driver = {
148+static const struct drm_driver arcpgu_drm_driver = {
149149 .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
150150 .name = "arcpgu",
151151 .desc = "ARC PGU Controller",
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c+2−4
@@ -1292,8 +1292,7 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id) · 1291 unmodified lines
12921292
12931293 err_unregister_cec:
12941294 i2c_unregister_device(adv7511->i2c_cec);
1295− if (adv7511->cec_clk)
1296− clk_disable_unprepare(adv7511->cec_clk);
1295+ clk_disable_unprepare(adv7511->cec_clk);
12971296 err_i2c_unregister_packet:
12981297 i2c_unregister_device(adv7511->i2c_packet);
12991298 err_i2c_unregister_edid:
@@ -1311,8 +1310,7 @@ static int adv7511_remove(struct i2c_client *i2c) · 11 unmodified lines
13111310 if (adv7511->type == ADV7533 || adv7511->type == ADV7535)
13121311 adv7533_detach_dsi(adv7511);
13131312 i2c_unregister_device(adv7511->i2c_cec);
1314− if (adv7511->cec_clk)
1315− clk_disable_unprepare(adv7511->cec_clk);
1313+ clk_disable_unprepare(adv7511->cec_clk);
13161314
13171315 adv7511_uninit_regulators(adv7511);
13181316
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c+2−4
@@ -3440,8 +3440,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, · 3439 unmodified lines
34403440
34413441 err_iahb:
34423442 clk_disable_unprepare(hdmi->iahb_clk);
3443− if (hdmi->cec_clk)
3444− clk_disable_unprepare(hdmi->cec_clk);
3443+ clk_disable_unprepare(hdmi->cec_clk);
34453444 err_isfr:
34463445 clk_disable_unprepare(hdmi->isfr_clk);
34473446 err_res:
@@ -3465,8 +3464,7 @@ void dw_hdmi_remove(struct dw_hdmi *hdmi) · 17 unmodified lines
34653464
34663465 clk_disable_unprepare(hdmi->iahb_clk);
34673466 clk_disable_unprepare(hdmi->isfr_clk);
3468− if (hdmi->cec_clk)
3469− clk_disable_unprepare(hdmi->cec_clk);
3467+ clk_disable_unprepare(hdmi->cec_clk);
34703468
34713469 if (hdmi->i2c)
34723470 i2c_del_adapter(&hdmi->i2c->adap);
drivers/gpu/drm/bridge/thc63lvd1024.c+1−1
@@ -202,7 +202,7 @@ static int thc63_probe(struct platform_device *pdev) · 201 unmodified lines
202202 thc63->dev = &pdev->dev;
203203 platform_set_drvdata(pdev, thc63);
204204
205− thc63->vcc = devm_regulator_get_optional(thc63->dev, "vcc");
205+ thc63->vcc = devm_regulator_get(thc63->dev, "vcc");
206206 if (IS_ERR(thc63->vcc)) {
207207 if (PTR_ERR(thc63->vcc) == -EPROBE_DEFER)
208208 return -EPROBE_DEFER;
drivers/gpu/drm/drm_drv.c+0−4
@@ -589,11 +589,7 @@ static int drm_dev_init(struct drm_device *dev, · 588 unmodified lines
589589
590590 kref_init(&dev->ref);
591591 dev->dev = get_device(parent);
592−#ifdef CONFIG_DRM_LEGACY
593− dev->driver = (struct drm_driver *)driver;
594−#else
595592 dev->driver = driver;
596−#endif
597593
598594 INIT_LIST_HEAD(&dev->managed.resources);
599595 spin_lock_init(&dev->managed.lock);
drivers/gpu/drm/drm_dumb_buffers.c+5−3
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <drm/drm_mode.h>
3030
3131 #include "drm_crtc_internal.h"
32+#include "drm_internal.h"
3233
3334 /**
3435 * DOC: overview
@@ -46,9 +47,10 @@ · 11 unmodified lines
4647 * KMS frame buffers.
4748 *
4849 * To support dumb objects drivers must implement the &drm_driver.dumb_create
49− * operation. &drm_driver.dumb_destroy defaults to drm_gem_dumb_destroy() if
50− * not set and &drm_driver.dumb_map_offset defaults to
51− * drm_gem_dumb_map_offset(). See the callbacks for further details.
50+ * and &drm_driver.dumb_map_offset operations (the latter defaults to
51+ * drm_gem_dumb_map_offset() if not set). Drivers that don't use GEM handles
52+ * additionally need to implement the &drm_driver.dumb_destroy operation. See
53+ * the callbacks for further details.
5254 *
5355 * Note that dumb objects may not be used for gpu acceleration, as has been
5456 * attempted on some ARM embedded platforms. Such drivers really must have
drivers/gpu/drm/drm_gem.c+1−11
@@ -335,22 +335,12 @@ out: · 334 unmodified lines
335335 }
336336 EXPORT_SYMBOL_GPL(drm_gem_dumb_map_offset);
337337
338−/**
339− * drm_gem_dumb_destroy - dumb fb callback helper for gem based drivers
340− * @file: drm file-private structure to remove the dumb handle from
341− * @dev: corresponding drm_device
342− * @handle: the dumb handle to remove
343− *
344− * This implements the &drm_driver.dumb_destroy kms driver callback for drivers
345− * which use gem to manage their backing storage.
346− */
347338 int drm_gem_dumb_destroy(struct drm_file *file,
348339 struct drm_device *dev,
349− uint32_t handle)
340+ u32 handle)
350341 {
351342 return drm_gem_handle_delete(file, handle);
352343 }
353−EXPORT_SYMBOL(drm_gem_dumb_destroy);
354344
355345 /**
356346 * drm_gem_handle_create_tail - internal functions to create a handle
drivers/gpu/drm/drm_internal.h+3−0
@@ -191,6 +191,9 @@ void drm_gem_unpin(struct drm_gem_object *obj); · 190 unmodified lines
191191 int drm_gem_vmap(struct drm_gem_object *obj, struct dma_buf_map *map);
192192 void drm_gem_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map);
193193
194+int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev,
195+ u32 handle);
196+
194197 /* drm_debugfs.c drm_debugfs_crc.c */
195198 #if defined(CONFIG_DEBUG_FS)
196199 int drm_debugfs_init(struct drm_minor *minor, int minor_id,
drivers/gpu/drm/drm_pci.c+22−11
@@ -24,6 +24,8 @@ · 23 unmodified lines
2424
2525 #include <linux/dma-mapping.h>
2626 #include <linux/export.h>
27+#include <linux/list.h>
28+#include <linux/mutex.h>
2729 #include <linux/pci.h>
2830 #include <linux/slab.h>
2931
@@ -36,6 +38,9 @@ · 6 unmodified lines
3638 #include "drm_legacy.h"
3739
3840 #ifdef CONFIG_DRM_LEGACY
41+/* List of devices hanging off drivers with stealth attach. */
42+static LIST_HEAD(legacy_dev_list);
43+static DEFINE_MUTEX(legacy_dev_list_lock);
3944
4045 /**
4146 * drm_pci_alloc - Allocate a PCI consistent memory block, for DMA.
@@ -196,7 +201,7 @@ static void drm_pci_agp_init(struct drm_device *dev) · 154 unmodified lines
196201
197202 static int drm_get_pci_dev(struct pci_dev *pdev,
198203 const struct pci_device_id *ent,
199− struct drm_driver *driver)
204+ const struct drm_driver *driver)
200205 {
201206 struct drm_device *dev;
202207 int ret;
@@ -225,10 +230,11 @@ static int drm_get_pci_dev(struct pci_dev *pdev, · 22 unmodified lines
225230 if (ret)
226231 goto err_agp;
227232
228− /* No locking needed since shadow-attach is single-threaded since it may
229− * only be called from the per-driver module init hook. */
230− if (drm_core_check_feature(dev, DRIVER_LEGACY))
231− list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list);
233+ if (drm_core_check_feature(dev, DRIVER_LEGACY)) {
234+ mutex_lock(&legacy_dev_list_lock);
235+ list_add_tail(&dev->legacy_dev_list, &legacy_dev_list);
236+ mutex_unlock(&legacy_dev_list_lock);
237+ }
232238
233239 return 0;
234240
@@ -249,7 +255,8 @@ err_free: · 14 unmodified lines
249255 *
250256 * Return: 0 on success or a negative error code on failure.
251257 */
252−int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
258+int drm_legacy_pci_init(const struct drm_driver *driver,
259+ struct pci_driver *pdriver)
253260 {
254261 struct pci_dev *pdev = NULL;
255262 const struct pci_device_id *pid;
@@ -261,7 +268,6 @@ int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) · 5 unmodified lines
261268 return -EINVAL;
262269
263270 /* If not using KMS, fall back to stealth mode manual scanning. */
264− INIT_LIST_HEAD(&driver->legacy_dev_list);
265271 for (i = 0; pdriver->id_table[i].vendor != 0; i++) {
266272 pid = &pdriver->id_table[i];
267273
@@ -295,7 +301,8 @@ EXPORT_SYMBOL(drm_legacy_pci_init); · 27 unmodified lines
295301 * Unregister a DRM driver shadow-attached through drm_legacy_pci_init(). This
296302 * is deprecated and only used by dri1 drivers.
297303 */
298−void drm_legacy_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
304+void drm_legacy_pci_exit(const struct drm_driver *driver,
305+ struct pci_driver *pdriver)
299306 {
300307 struct drm_device *dev, *tmp;
301308
@@ -304,11 +311,15 @@ void drm_legacy_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver) · 2 unmodified lines
304311 if (!(driver->driver_features & DRIVER_LEGACY)) {
305312 WARN_ON(1);
306313 } else {
307− list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list,
314+ mutex_lock(&legacy_dev_list_lock);
315+ list_for_each_entry_safe(dev, tmp, &legacy_dev_list,
308316 legacy_dev_list) {
309− list_del(&dev->legacy_dev_list);
310− drm_put_dev(dev);
317+ if (dev->driver == driver) {
318+ list_del(&dev->legacy_dev_list);
319+ drm_put_dev(dev);
320+ }
311321 }
322+ mutex_unlock(&legacy_dev_list_lock);
312323 }
313324 DRM_INFO("Module unloaded\n");
314325 }
drivers/gpu/drm/drm_probe_helper.c+2−1
@@ -515,7 +515,8 @@ retry: · 514 unmodified lines
515515 if (count == 0 && connector->status == connector_status_connected)
516516 count = drm_add_override_edid_modes(connector);
517517
518− if (count == 0 && connector->status == connector_status_connected)
518+ if (count == 0 && (connector->status == connector_status_connected ||
519+ connector->status == connector_status_unknown))
519520 count = drm_add_modes_noedid(connector, 1024, 768);
520521 count += drm_helper_probe_add_cmdline_mode(connector);
521522 if (count == 0)
drivers/gpu/drm/kmb/kmb_drv.c+1−1
@@ -400,7 +400,7 @@ static void kmb_irq_reset(struct drm_device *drm) · 399 unmodified lines
400400
401401 DEFINE_DRM_GEM_CMA_FOPS(fops);
402402
403−static struct drm_driver kmb_driver = {
403+static const struct drm_driver kmb_driver = {
404404 .driver_features = DRIVER_GEM |
405405 DRIVER_MODESET | DRIVER_ATOMIC,
406406 .irq_handler = kmb_isr,
drivers/gpu/drm/rcar-du/rcar_cmm.c+1−1
@@ -122,7 +122,7 @@ int rcar_cmm_enable(struct platform_device *pdev) · 121 unmodified lines
122122 {
123123 int ret;
124124
125− ret = pm_runtime_get_sync(&pdev->dev);
125+ ret = pm_runtime_resume_and_get(&pdev->dev);
126126 if (ret < 0)
127127 return ret;
128128
drivers/gpu/drm/rcar-du/rcar_du_crtc.c+3−9
@@ -730,13 +730,10 @@ static void rcar_du_crtc_atomic_enable(struct drm_crtc *crtc, · 729 unmodified lines
730730 */
731731 if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index) &&
732732 rstate->outputs == BIT(RCAR_DU_OUTPUT_DPAD0)) {
733− struct rcar_du_encoder *encoder =
734− rcdu->encoders[RCAR_DU_OUTPUT_LVDS0 + rcrtc->index];
733+ struct drm_bridge *bridge = rcdu->lvds[rcrtc->index];
735734 const struct drm_display_mode *mode =
736735 &crtc->state->adjusted_mode;
737− struct drm_bridge *bridge;
738736
739− bridge = drm_bridge_chain_get_first_bridge(&encoder->base);
740737 rcar_lvds_clk_enable(bridge, mode->clock * 1000);
741738 }
742739
@@ -764,15 +761,12 @@ static void rcar_du_crtc_atomic_disable(struct drm_crtc *crtc, · 21 unmodified lines
764761
765762 if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index) &&
766763 rstate->outputs == BIT(RCAR_DU_OUTPUT_DPAD0)) {
767− struct rcar_du_encoder *encoder =
768− rcdu->encoders[RCAR_DU_OUTPUT_LVDS0 + rcrtc->index];
769− struct drm_bridge *bridge;
764+ struct drm_bridge *bridge = rcdu->lvds[rcrtc->index];
770765
771766 /*
772767 * Disable the LVDS clock output, see
773768 * rcar_du_crtc_atomic_enable().
774769 */
775− bridge = drm_bridge_chain_get_first_bridge(&encoder->base);
776770 rcar_lvds_clk_disable(bridge);
777771 }
778772
@@ -1256,7 +1250,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex, · 477 unmodified lines
12561250 else
12571251 primary = &rgrp->planes[swindex % 2].plane;
12581252
1259− ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, primary, NULL,
1253+ ret = drm_crtc_init_with_planes(&rcdu->ddev, crtc, primary, NULL,
12601254 rcdu->info->gen <= 2 ?
12611255 &crtc_funcs_gen2 : &crtc_funcs_gen3,
12621256 NULL);
drivers/gpu/drm/rcar-du/rcar_du_drv.c+13−20
@@ -18,10 +18,11 @@ · 17 unmodified lines
1818 #include <linux/wait.h>
1919
2020 #include <drm/drm_atomic_helper.h>
21+#include <drm/drm_drv.h>
2122 #include <drm/drm_fb_cma_helper.h>
2223 #include <drm/drm_fb_helper.h>
23−#include <drm/drm_drv.h>
2424 #include <drm/drm_gem_cma_helper.h>
25+#include <drm/drm_managed.h>
2526 #include <drm/drm_probe_helper.h>
2627
2728 #include "rcar_du_drv.h"
@@ -527,14 +528,14 @@ static int rcar_du_pm_suspend(struct device *dev) · 499 unmodified lines
527528 {
528529 struct rcar_du_device *rcdu = dev_get_drvdata(dev);
529530
530− return drm_mode_config_helper_suspend(rcdu->ddev);
531+ return drm_mode_config_helper_suspend(&rcdu->ddev);
531532 }
532533
533534 static int rcar_du_pm_resume(struct device *dev)
534535 {
535536 struct rcar_du_device *rcdu = dev_get_drvdata(dev);
536537
537− return drm_mode_config_helper_resume(rcdu->ddev);
538+ return drm_mode_config_helper_resume(&rcdu->ddev);
538539 }
539540 #endif
540541
@@ -549,7 +550,7 @@ static const struct dev_pm_ops rcar_du_pm_ops = { · 8 unmodified lines
549550 static int rcar_du_remove(struct platform_device *pdev)
550551 {
551552 struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
552− struct drm_device *ddev = rcdu->ddev;
553+ struct drm_device *ddev = &rcdu->ddev;
553554
554555 drm_dev_unregister(ddev);
555556
@@ -563,14 +564,14 @@ static int rcar_du_remove(struct platform_device *pdev) · 7 unmodified lines
563564 static int rcar_du_probe(struct platform_device *pdev)
564565 {
565566 struct rcar_du_device *rcdu;
566− struct drm_device *ddev;
567567 struct resource *mem;
568568 int ret;
569569
570570 /* Allocate and initialize the R-Car device structure. */
571− rcdu = devm_kzalloc(&pdev->dev, sizeof(*rcdu), GFP_KERNEL);
572− if (rcdu == NULL)
573− return -ENOMEM;
571+ rcdu = devm_drm_dev_alloc(&pdev->dev, &rcar_du_driver,
572+ struct rcar_du_device, ddev);
573+ if (IS_ERR(rcdu))
574+ return PTR_ERR(rcdu);
574575
575576 rcdu->dev = &pdev->dev;
576577 rcdu->info = of_device_get_match_data(rcdu->dev);
@@ -584,13 +585,6 @@ static int rcar_du_probe(struct platform_device *pdev) · 7 unmodified lines
584585 return PTR_ERR(rcdu->mmio);
585586
586587 /* DRM/KMS objects */
587− ddev = drm_dev_alloc(&rcar_du_driver, &pdev->dev);
588− if (IS_ERR(ddev))
589− return PTR_ERR(ddev);
590−
591− rcdu->ddev = ddev;
592− ddev->dev_private = rcdu;
593−
594588 ret = rcar_du_modeset_init(rcdu);
595589 if (ret < 0) {
596590 if (ret != -EPROBE_DEFER)
@@ -599,25 +593,24 @@ static int rcar_du_probe(struct platform_device *pdev) · 2 unmodified lines
599593 goto error;
600594 }
601595
602− ddev->irq_enabled = 1;
596+ rcdu->ddev.irq_enabled = 1;
603597
604598 /*
605599 * Register the DRM device with the core and the connectors with
606600 * sysfs.
607601 */
608− ret = drm_dev_register(ddev, 0);
602+ ret = drm_dev_register(&rcdu->ddev, 0);
609603 if (ret)
610604 goto error;
611605
612606 DRM_INFO("Device %s probed\n", dev_name(&pdev->dev));
613607
614− drm_fbdev_generic_setup(ddev, 32);
608+ drm_fbdev_generic_setup(&rcdu->ddev, 32);
615609
616610 return 0;
617611
618612 error:
619− rcar_du_remove(pdev);
620−
613+ drm_kms_helper_poll_fini(&rcdu->ddev);
621614 return ret;
622615 }
623616
drivers/gpu/drm/rcar-du/rcar_du_drv.h+11−5
@@ -13,6 +13,8 @@ · 12 unmodified lines
1313 #include <linux/kernel.h>
1414 #include <linux/wait.h>
1515
16+#include <drm/drm_device.h>
17+
1618 #include "rcar_cmm.h"
1719 #include "rcar_du_crtc.h"
1820 #include "rcar_du_group.h"
@@ -20,10 +22,9 @@ · 1 unmodified line
2022
2123 struct clk;
2224 struct device;
23−struct drm_device;
25+struct drm_bridge;
2426 struct drm_property;
2527 struct rcar_du_device;
26−struct rcar_du_encoder;
2728
2829 #define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK BIT(0) /* Per-CRTC IRQ and clock */
2930 #define RCAR_DU_FEATURE_VSP1_SOURCE BIT(1) /* Has inputs from VSP1 */
@@ -71,6 +72,7 @@ struct rcar_du_device_info { · 41 unmodified lines
7172 #define RCAR_DU_MAX_CRTCS 4
7273 #define RCAR_DU_MAX_GROUPS DIV_ROUND_UP(RCAR_DU_MAX_CRTCS, 2)
7374 #define RCAR_DU_MAX_VSPS 4
75+#define RCAR_DU_MAX_LVDS 2
7476
7577 struct rcar_du_device {
7678 struct device *dev;
@@ -78,16 +80,15 @@ struct rcar_du_device { · 1 unmodified line
7880
7981 void __iomem *mmio;
8082
81− struct drm_device *ddev;
83+ struct drm_device ddev;
8284
8385 struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS];
8486 unsigned int num_crtcs;
8587
86− struct rcar_du_encoder *encoders[RCAR_DU_OUTPUT_MAX];
87−
8888 struct rcar_du_group groups[RCAR_DU_MAX_GROUPS];
8989 struct platform_device *cmms[RCAR_DU_MAX_CRTCS];
9090 struct rcar_du_vsp vsps[RCAR_DU_MAX_VSPS];
91+ struct drm_bridge *lvds[RCAR_DU_MAX_LVDS];
9192
9293 struct {
9394 struct drm_property *colorkey;
@@ -98,6 +99,11 @@ struct rcar_du_device { · 4 unmodified lines
9899 unsigned int vspd1_sink;
99100 };
100101
102+static inline struct rcar_du_device *to_rcar_du_device(struct drm_device *dev)
103+{
104+ return container_of(dev, struct rcar_du_device, ddev);
105+}
106+
101107 static inline bool rcar_du_has(struct rcar_du_device *rcdu,
102108 unsigned int feature)
103109 {
drivers/gpu/drm/rcar-du/rcar_du_encoder.c+49−49
@@ -8,12 +8,13 @@ · 7 unmodified lines
88 */
99
1010 #include <linux/export.h>
11+#include <linux/slab.h>
1112
1213 #include <drm/drm_bridge.h>
1314 #include <drm/drm_crtc.h>
15+#include <drm/drm_managed.h>
1416 #include <drm/drm_modeset_helper_vtables.h>
1517 #include <drm/drm_panel.h>
16−#include <drm/drm_simple_kms_helper.h>
1718
1819 #include "rcar_du_drv.h"
1920 #include "rcar_du_encoder.h"
@@ -44,26 +45,25 @@ static unsigned int rcar_du_encoder_count_ports(struct device_node *node) · 24 unmodified lines
4445 return num_ports;
4546 }
4647
48+static const struct drm_encoder_funcs rcar_du_encoder_funcs = {
49+};
50+
51+static void rcar_du_encoder_release(struct drm_device *dev, void *res)
52+{
53+ struct rcar_du_encoder *renc = res;
54+
55+ drm_encoder_cleanup(&renc->base);
56+ kfree(renc);
57+}
58+
4759 int rcar_du_encoder_init(struct rcar_du_device *rcdu,
4860 enum rcar_du_output output,
4961 struct device_node *enc_node)
5062 {
5163 struct rcar_du_encoder *renc;
52− struct drm_encoder *encoder;
5364 struct drm_bridge *bridge;
5465 int ret;
5566
56− renc = devm_kzalloc(rcdu->dev, sizeof(*renc), GFP_KERNEL);
57− if (renc == NULL)
58− return -ENOMEM;
59−
60− rcdu->encoders[output] = renc;
61− renc->output = output;
62− encoder = rcar_encoder_to_drm_encoder(renc);
63−
64− dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
65− enc_node, output);
66−
6767 /*
6868 * Locate the DRM bridge from the DT node. For the DPAD outputs, if the
6969 * DT node has a single port, assume that it describes a panel and
@@ -74,57 +74,57 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu, · 4 unmodified lines
7474 rcar_du_encoder_count_ports(enc_node) == 1) {
7575 struct drm_panel *panel = of_drm_find_panel(enc_node);
7676
77− if (IS_ERR(panel)) {
78− ret = PTR_ERR(panel);
79− goto done;
80− }
77+ if (IS_ERR(panel))
78+ return PTR_ERR(panel);
8179
8280 bridge = devm_drm_panel_bridge_add_typed(rcdu->dev, panel,
8381 DRM_MODE_CONNECTOR_DPI);
84− if (IS_ERR(bridge)) {
85− ret = PTR_ERR(bridge);
86− goto done;
87− }
82+ if (IS_ERR(bridge))
83+ return PTR_ERR(bridge);
8884 } else {
8985 bridge = of_drm_find_bridge(enc_node);
90− if (!bridge) {
91− ret = -EPROBE_DEFER;
92− goto done;
93− }
86+ if (!bridge)
87+ return -EPROBE_DEFER;
88+
89+ if (output == RCAR_DU_OUTPUT_LVDS0 ||
90+ output == RCAR_DU_OUTPUT_LVDS1)
91+ rcdu->lvds[output - RCAR_DU_OUTPUT_LVDS0] = bridge;
9492 }
9593
9694 /*
97− * On Gen3 skip the LVDS1 output if the LVDS1 encoder is used as a
98− * companion for LVDS0 in dual-link mode.
95+ * Create and initialize the encoder. On Gen3 skip the LVDS1 output if
96+ * the LVDS1 encoder is used as a companion for LVDS0 in dual-link
97+ * mode.
9998 */
10099 if (rcdu->info->gen >= 3 && output == RCAR_DU_OUTPUT_LVDS1) {
101− if (rcar_lvds_dual_link(bridge)) {
102− ret = -ENOLINK;
103− goto done;
104− }
100+ if (rcar_lvds_dual_link(bridge))
101+ return -ENOLINK;
105102 }
106103
107− ret = drm_simple_encoder_init(rcdu->ddev, encoder,
108− DRM_MODE_ENCODER_NONE);
109− if (ret < 0)
110− goto done;
104+ renc = kzalloc(sizeof(*renc), GFP_KERNEL);
105+ if (renc == NULL)
106+ return -ENOMEM;
111107
112− /*
113− * Attach the bridge to the encoder. The bridge will create the
114− * connector.
115− */
116− ret = drm_bridge_attach(encoder, bridge, NULL, 0);
117− if (ret) {
118− drm_encoder_cleanup(encoder);
119− return ret;
120− }
108+ renc->output = output;
109+
110+ dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
111+ enc_node, output);
121112
122−done:
113+ ret = drm_encoder_init(&rcdu->ddev, &renc->base, &rcar_du_encoder_funcs,
114+ DRM_MODE_ENCODER_NONE, NULL);
123115 if (ret < 0) {
124− if (encoder->name)
125− encoder->funcs->destroy(encoder);
126− devm_kfree(rcdu->dev, renc);
116+ kfree(renc);
117+ return ret;
127118 }
128119
129− return ret;
120+ ret = drmm_add_action_or_reset(&rcdu->ddev, rcar_du_encoder_release,
121+ renc);
122+ if (ret)
123+ return ret;
124+
125+ /*
126+ * Attach the bridge to the encoder. The bridge will create the
127+ * connector.
128+ */
129+ return drm_bridge_attach(&renc->base, bridge, NULL, 0);
130130 }
drivers/gpu/drm/rcar-du/rcar_du_encoder.h+0−2
@@ -22,8 +22,6 @@ struct rcar_du_encoder { · 21 unmodified lines
2222 #define to_rcar_encoder(e) \
2323 container_of(e, struct rcar_du_encoder, base)
2424
25−#define rcar_encoder_to_drm_encoder(e) (&(e)->base)
26−
2725 int rcar_du_encoder_init(struct rcar_du_device *rcdu,
2826 enum rcar_du_output output,
2927 struct device_node *enc_node);
drivers/gpu/drm/rcar-du/rcar_du_kms.c+29−13
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <drm/drm_fb_cma_helper.h>
1515 #include <drm/drm_gem_cma_helper.h>
1616 #include <drm/drm_gem_framebuffer_helper.h>
17+#include <drm/drm_managed.h>
1718 #include <drm/drm_probe_helper.h>
1819 #include <drm/drm_vblank.h>
1920
@@ -327,7 +328,7 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc) · 307 unmodified lines
327328 int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev,
328329 struct drm_mode_create_dumb *args)
329330 {
330− struct rcar_du_device *rcdu = dev->dev_private;
331+ struct rcar_du_device *rcdu = to_rcar_du_device(dev);
331332 unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
332333 unsigned int align;
333334
@@ -349,7 +350,7 @@ static struct drm_framebuffer * · 15 unmodified lines
349350 rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
350351 const struct drm_mode_fb_cmd2 *mode_cmd)
351352 {
352− struct rcar_du_device *rcdu = dev->dev_private;
353+ struct rcar_du_device *rcdu = to_rcar_du_device(dev);
353354 const struct rcar_du_format_info *format;
354355 unsigned int chroma_pitch;
355356 unsigned int max_pitch;
@@ -421,7 +422,7 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv, · 65 unmodified lines
421422 static int rcar_du_atomic_check(struct drm_device *dev,
422423 struct drm_atomic_state *state)
423424 {
424− struct rcar_du_device *rcdu = dev->dev_private;
425+ struct rcar_du_device *rcdu = to_rcar_du_device(dev);
425426 int ret;
426427
427428 ret = drm_atomic_helper_check(dev, state);
@@ -437,7 +438,7 @@ static int rcar_du_atomic_check(struct drm_device *dev, · 9 unmodified lines
437438 static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
438439 {
439440 struct drm_device *dev = old_state->dev;
440− struct rcar_du_device *rcdu = dev->dev_private;
441+ struct rcar_du_device *rcdu = to_rcar_du_device(dev);
441442 struct drm_crtc_state *crtc_state;
442443 struct drm_crtc *crtc;
443444 unsigned int i;
@@ -583,7 +584,7 @@ static int rcar_du_properties_init(struct rcar_du_device *rcdu) · 139 unmodified lines
583584 * or enable source color keying (1).
584585 */
585586 rcdu->props.colorkey =
586− drm_property_create_range(rcdu->ddev, 0, "colorkey",
587+ drm_property_create_range(&rcdu->ddev, 0, "colorkey",
587588 0, 0x01ffffff);
588589 if (rcdu->props.colorkey == NULL)
589590 return -ENOMEM;
@@ -700,10 +701,10 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu) · 110 unmodified lines
700701 int ret;
701702
702703 cmm = of_parse_phandle(np, "renesas,cmms", i);
703− if (IS_ERR(cmm)) {
704+ if (!cmm) {
704705 dev_err(rcdu->dev,
705706 "Failed to parse 'renesas,cmms' property\n");
706− return PTR_ERR(cmm);
707+ return -EINVAL;
707708 }
708709
709710 if (!of_device_is_available(cmm)) {
@@ -713,10 +714,10 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu) · 3 unmodified lines
713714 }
714715
715716 pdev = of_find_device_by_node(cmm);
716− if (IS_ERR(pdev)) {
717+ if (!pdev) {
717718 dev_err(rcdu->dev, "No device found for CMM%u\n", i);
718719 of_node_put(cmm);
719− return PTR_ERR(pdev);
720+ return -EINVAL;
720721 }
721722
722723 of_node_put(cmm);
@@ -726,8 +727,12 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu) · 3 unmodified lines
726727 * disabled: return 0 and let the DU continue probing.
727728 */
728729 ret = rcar_cmm_init(pdev);
729− if (ret)
730+ if (ret) {
731+ platform_device_put(pdev);
730732 return ret == -ENODEV ? 0 : ret;
733+ }
734+
735+ rcdu->cmms[i] = pdev;
731736
732737 /*
733738 * Enforce suspend/resume ordering by making the CMM a provider
@@ -739,20 +744,27 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu) · 5 unmodified lines
739744 "Failed to create device link to CMM%u\n", i);
740745 return -EINVAL;
741746 }
742−
743− rcdu->cmms[i] = pdev;
744747 }
745748
746749 return 0;
747750 }
748751
752+static void rcar_du_modeset_cleanup(struct drm_device *dev, void *res)
753+{
754+ struct rcar_du_device *rcdu = to_rcar_du_device(dev);
755+ unsigned int i;
756+
757+ for (i = 0; i < ARRAY_SIZE(rcdu->cmms); ++i)
758+ platform_device_put(rcdu->cmms[i]);
759+}
760+
749761 int rcar_du_modeset_init(struct rcar_du_device *rcdu)
750762 {
751763 static const unsigned int mmio_offsets[] = {
752764 DU0_REG_OFFSET, DU2_REG_OFFSET
753765 };
754766
755− struct drm_device *dev = rcdu->ddev;
767+ struct drm_device *dev = &rcdu->ddev;
756768 struct drm_encoder *encoder;
757769 unsigned int dpad0_sources;
758770 unsigned int num_encoders;
@@ -766,6 +778,10 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) · 7 unmodified lines
766778 if (ret)
767779 return ret;
768780
781+ ret = drmm_add_action(&rcdu->ddev, rcar_du_modeset_cleanup, NULL);
782+ if (ret)
783+ return ret;
784+
769785 dev->mode_config.min_width = 0;
770786 dev->mode_config.min_height = 0;
771787 dev->mode_config.normalize_zpos = true;
drivers/gpu/drm/rcar-du/rcar_du_plane.c+4−4
@@ -128,7 +128,7 @@ static int rcar_du_plane_hwalloc(struct rcar_du_plane *plane, · 127 unmodified lines
128128 int rcar_du_atomic_check_planes(struct drm_device *dev,
129129 struct drm_atomic_state *state)
130130 {
131− struct rcar_du_device *rcdu = dev->dev_private;
131+ struct rcar_du_device *rcdu = to_rcar_du_device(dev);
132132 unsigned int group_freed_planes[RCAR_DU_MAX_GROUPS] = { 0, };
133133 unsigned int group_free_planes[RCAR_DU_MAX_GROUPS] = { 0, };
134134 bool needs_realloc = false;
@@ -773,9 +773,9 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp) · 638 unmodified lines
773773
774774 plane->group = rgrp;
775775
776− ret = drm_universal_plane_init(rcdu->ddev, &plane->plane, crtcs,
777− &rcar_du_plane_funcs, formats,
778− ARRAY_SIZE(formats),
776+ ret = drm_universal_plane_init(&rcdu->ddev, &plane->plane,
777+ crtcs, &rcar_du_plane_funcs,
778+ formats, ARRAY_SIZE(formats),
779779 NULL, type, NULL);
780780 if (ret < 0)
781781 return ret;
drivers/gpu/drm/rcar-du/rcar_du_vsp.c+20−8
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/dma-mapping.h>
2222 #include <linux/of_platform.h>
2323 #include <linux/scatterlist.h>
24+#include <linux/slab.h>
2425 #include <linux/videodev2.h>
2526
2627 #include <media/vsp1.h>
@@ -344,6 +345,15 @@ static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = { · 317 unmodified lines
344345 static void rcar_du_vsp_cleanup(struct drm_device *dev, void *res)
345346 {
346347 struct rcar_du_vsp *vsp = res;
348+ unsigned int i;
349+
350+ for (i = 0; i < vsp->num_planes; ++i) {
351+ struct rcar_du_vsp_plane *plane = &vsp->planes[i];
352+
353+ drm_plane_cleanup(&plane->plane);
354+ }
355+
356+ kfree(vsp->planes);
347357
348358 put_device(vsp->vsp);
349359 }
@@ -354,6 +364,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, · 4 unmodified lines
354364 struct rcar_du_device *rcdu = vsp->dev;
355365 struct platform_device *pdev;
356366 unsigned int num_crtcs = hweight32(crtcs);
367+ unsigned int num_planes;
357368 unsigned int i;
358369 int ret;
359370
@@ -364,7 +375,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, · 4 unmodified lines
364375
365376 vsp->vsp = &pdev->dev;
366377
367− ret = drmm_add_action(rcdu->ddev, rcar_du_vsp_cleanup, vsp);
378+ ret = drmm_add_action_or_reset(&rcdu->ddev, rcar_du_vsp_cleanup, vsp);
368379 if (ret < 0)
369380 return ret;
370381
@@ -376,14 +387,13 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, · 5 unmodified lines
376387 * The VSP2D (Gen3) has 5 RPFs, but the VSP1D (Gen2) is limited to
377388 * 4 RPFs.
378389 */
379− vsp->num_planes = rcdu->info->gen >= 3 ? 5 : 4;
390+ num_planes = rcdu->info->gen >= 3 ? 5 : 4;
380391
381− vsp->planes = devm_kcalloc(rcdu->dev, vsp->num_planes,
382− sizeof(*vsp->planes), GFP_KERNEL);
392+ vsp->planes = kcalloc(num_planes, sizeof(*vsp->planes), GFP_KERNEL);
383393 if (!vsp->planes)
384394 return -ENOMEM;
385395
386− for (i = 0; i < vsp->num_planes; ++i) {
396+ for (i = 0; i < num_planes; ++i) {
387397 enum drm_plane_type type = i < num_crtcs
388398 ? DRM_PLANE_TYPE_PRIMARY
389399 : DRM_PLANE_TYPE_OVERLAY;
@@ -392,8 +402,8 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, · 2 unmodified lines
392402 plane->vsp = vsp;
393403 plane->index = i;
394404
395− ret = drm_universal_plane_init(rcdu->ddev, &plane->plane, crtcs,
396− &rcar_du_vsp_plane_funcs,
405+ ret = drm_universal_plane_init(&rcdu->ddev, &plane->plane,
406+ crtcs, &rcar_du_vsp_plane_funcs,
397407 rcar_du_vsp_formats,
398408 ARRAY_SIZE(rcar_du_vsp_formats),
399409 NULL, type, NULL);
@@ -409,8 +419,10 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, · 9 unmodified lines
409419 } else {
410420 drm_plane_create_alpha_property(&plane->plane);
411421 drm_plane_create_zpos_property(&plane->plane, 1, 1,
412− vsp->num_planes - 1);
422+ num_planes - 1);
413423 }
424+
425+ vsp->num_planes++;
414426 }
415427
416428 return 0;
drivers/gpu/drm/rcar-du/rcar_du_writeback.c+1−1
@@ -204,7 +204,7 @@ int rcar_du_writeback_init(struct rcar_du_device *rcdu, · 203 unmodified lines
204204 drm_connector_helper_add(&wb_conn->base,
205205 &rcar_du_wb_conn_helper_funcs);
206206
207− return drm_writeback_connector_init(rcdu->ddev, wb_conn,
207+ return drm_writeback_connector_init(&rcdu->ddev, wb_conn,
208208 &rcar_du_wb_conn_funcs,
209209 &rcar_du_wb_enc_helper_funcs,
210210 writeback_formats,
drivers/gpu/drm/sti/sti_cursor.c+1−8
@@ -330,13 +330,6 @@ static const struct drm_plane_helper_funcs sti_cursor_helpers_funcs = { · 329 unmodified lines
330330 .atomic_disable = sti_cursor_atomic_disable,
331331 };
332332
333−static void sti_cursor_destroy(struct drm_plane *drm_plane)
334−{
335− DRM_DEBUG_DRIVER("\n");
336−
337− drm_plane_cleanup(drm_plane);
338−}
339−
340333 static int sti_cursor_late_register(struct drm_plane *drm_plane)
341334 {
342335 struct sti_plane *plane = to_sti_plane(drm_plane);
@@ -350,7 +343,7 @@ static int sti_cursor_late_register(struct drm_plane *drm_plane) · 7 unmodified lines
350343 static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
351344 .update_plane = drm_atomic_helper_update_plane,
352345 .disable_plane = drm_atomic_helper_disable_plane,
353− .destroy = sti_cursor_destroy,
346+ .destroy = drm_plane_cleanup,
354347 .reset = sti_plane_reset,
355348 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
356349 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
drivers/gpu/drm/sti/sti_gdp.c+1−8
@@ -884,13 +884,6 @@ static const struct drm_plane_helper_funcs sti_gdp_helpers_funcs = { · 883 unmodified lines
884884 .atomic_disable = sti_gdp_atomic_disable,
885885 };
886886
887−static void sti_gdp_destroy(struct drm_plane *drm_plane)
888−{
889− DRM_DEBUG_DRIVER("\n");
890−
891− drm_plane_cleanup(drm_plane);
892−}
893−
894887 static int sti_gdp_late_register(struct drm_plane *drm_plane)
895888 {
896889 struct sti_plane *plane = to_sti_plane(drm_plane);
@@ -902,7 +895,7 @@ static int sti_gdp_late_register(struct drm_plane *drm_plane) · 5 unmodified lines
902895 static const struct drm_plane_funcs sti_gdp_plane_helpers_funcs = {
903896 .update_plane = drm_atomic_helper_update_plane,
904897 .disable_plane = drm_atomic_helper_disable_plane,
905− .destroy = sti_gdp_destroy,
898+ .destroy = drm_plane_cleanup,
906899 .reset = sti_plane_reset,
907900 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
908901 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
drivers/gpu/drm/sti/sti_hqvdp.c+1−8
@@ -1262,13 +1262,6 @@ static const struct drm_plane_helper_funcs sti_hqvdp_helpers_funcs = { · 1261 unmodified lines
12621262 .atomic_disable = sti_hqvdp_atomic_disable,
12631263 };
12641264
1265−static void sti_hqvdp_destroy(struct drm_plane *drm_plane)
1266−{
1267− DRM_DEBUG_DRIVER("\n");
1268−
1269− drm_plane_cleanup(drm_plane);
1270−}
1271−
12721265 static int sti_hqvdp_late_register(struct drm_plane *drm_plane)
12731266 {
12741267 struct sti_plane *plane = to_sti_plane(drm_plane);
@@ -1282,7 +1275,7 @@ static int sti_hqvdp_late_register(struct drm_plane *drm_plane) · 7 unmodified lines
12821275 static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
12831276 .update_plane = drm_atomic_helper_update_plane,
12841277 .disable_plane = drm_atomic_helper_disable_plane,
1285− .destroy = sti_hqvdp_destroy,
1278+ .destroy = drm_plane_cleanup,
12861279 .reset = sti_plane_reset,
12871280 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
12881281 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
drivers/gpu/drm/tdfx/tdfx_drv.c+1−1
@@ -56,7 +56,7 @@ static const struct file_operations tdfx_driver_fops = { · 55 unmodified lines
5656 .llseek = noop_llseek,
5757 };
5858
59−static struct drm_driver driver = {
59+static const struct drm_driver driver = {
6060 .driver_features = DRIVER_LEGACY,
6161 .fops = &tdfx_driver_fops,
6262 .name = DRIVER_NAME,
drivers/gpu/drm/vc4/vc4_plane.c+1−6
@@ -1268,11 +1268,6 @@ static const struct drm_plane_helper_funcs vc4_plane_helper_funcs = { · 1267 unmodified lines
12681268 .atomic_async_update = vc4_plane_atomic_async_update,
12691269 };
12701270
1271−static void vc4_plane_destroy(struct drm_plane *plane)
1272−{
1273− drm_plane_cleanup(plane);
1274−}
1275−
12761271 static bool vc4_format_mod_supported(struct drm_plane *plane,
12771272 uint32_t format,
12781273 uint64_t modifier)
@@ -1323,7 +1318,7 @@ static bool vc4_format_mod_supported(struct drm_plane *plane, · 44 unmodified lines
13231318 static const struct drm_plane_funcs vc4_plane_funcs = {
13241319 .update_plane = drm_atomic_helper_update_plane,
13251320 .disable_plane = drm_atomic_helper_disable_plane,
1326− .destroy = vc4_plane_destroy,
1321+ .destroy = drm_plane_cleanup,
13271322 .set_property = NULL,
13281323 .reset = vc4_plane_reset,
13291324 .atomic_duplicate_state = vc4_plane_duplicate_state,
drivers/gpu/drm/zte/zx_plane.c+1−6
@@ -438,15 +438,10 @@ static const struct drm_plane_helper_funcs zx_gl_plane_helper_funcs = { · 437 unmodified lines
438438 .atomic_disable = zx_plane_atomic_disable,
439439 };
440440
441−static void zx_plane_destroy(struct drm_plane *plane)
442−{
443− drm_plane_cleanup(plane);
444−}
445−
446441 static const struct drm_plane_funcs zx_plane_funcs = {
447442 .update_plane = drm_atomic_helper_update_plane,
448443 .disable_plane = drm_atomic_helper_disable_plane,
449− .destroy = zx_plane_destroy,
444+ .destroy = drm_plane_cleanup,
450445 .reset = drm_atomic_helper_plane_reset,
451446 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
452447 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
include/drm/drm_device.h+3−11
@@ -51,13 +51,6 @@ enum switch_power_state { · 50 unmodified lines
5151 * may contain multiple heads.
5252 */
5353 struct drm_device {
54− /**
55− * @legacy_dev_list:
56− *
57− * List of devices per driver for stealth attach cleanup
58− */
59− struct list_head legacy_dev_list;
60−
6154 /** @if_version: Highest interface version set */
6255 int if_version;
6356
@@ -83,11 +76,7 @@ struct drm_device { · 19 unmodified lines
8376 } managed;
8477
8578 /** @driver: DRM driver managing the device */
86−#ifdef CONFIG_DRM_LEGACY
87− struct drm_driver *driver;
88−#else
8979 const struct drm_driver *driver;
90−#endif
9180
9281 /**
9382 * @dev_private:
@@ -336,6 +325,9 @@ struct drm_device { · 242 unmodified lines
336325 /* Everything below here is for legacy driver, never use! */
337326 /* private: */
338327 #if IS_ENABLED(CONFIG_DRM_LEGACY)
328+ /* List of devices per driver for stealth attach cleanup */
329+ struct list_head legacy_dev_list;
330+
339331 /* Context handle management - linked list of context handles */
340332 struct list_head ctxlist;
341333
include/drm/drm_drv.h+0−2
@@ -499,8 +499,6 @@ struct drm_driver { · 498 unmodified lines
499499 /* Everything below here is for legacy driver, never use! */
500500 /* private: */
501501
502− /* List of devices hanging off this driver with stealth attach. */
503− struct list_head legacy_dev_list;
504502 int (*firstopen) (struct drm_device *);
505503 void (*preclose) (struct drm_device *, struct drm_file *file_priv);
506504 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
include/drm/drm_gem.h+0−3
@@ -416,8 +416,5 @@ int drm_gem_fence_array_add_implicit(struct xarray *fence_array, · 415 unmodified lines
416416 bool write);
417417 int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
418418 u32 handle, u64 *offset);
419−int drm_gem_dumb_destroy(struct drm_file *file,
420− struct drm_device *dev,
421− uint32_t handle);
422419
423420 #endif /* __DRM_GEM_H__ */
include/drm/drm_legacy.h+6−4
@@ -198,8 +198,10 @@ struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size, · 197 unmodified lines
198198 size_t align);
199199 void drm_pci_free(struct drm_device *dev, struct drm_dma_handle *dmah);
200200
201−int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
202−void drm_legacy_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
201+int drm_legacy_pci_init(const struct drm_driver *driver,
202+ struct pci_driver *pdriver);
203+void drm_legacy_pci_exit(const struct drm_driver *driver,
204+ struct pci_driver *pdriver);
203205
204206 #else
205207
@@ -214,13 +216,13 @@ static inline void drm_pci_free(struct drm_device *dev, · 8 unmodified lines
214216 {
215217 }
216218
217−static inline int drm_legacy_pci_init(struct drm_driver *driver,
219+static inline int drm_legacy_pci_init(const struct drm_driver *driver,
218220 struct pci_driver *pdriver)
219221 {
220222 return -EINVAL;
221223 }
222224
223−static inline void drm_legacy_pci_exit(struct drm_driver *driver,
225+static inline void drm_legacy_pci_exit(const struct drm_driver *driver,
224226 struct pci_driver *pdriver)
225227 {
226228 }
include/drm/drm_modeset_helper_vtables.h+7−1
@@ -866,13 +866,19 @@ struct drm_connector_helper_funcs { · 865 unmodified lines
866866 * The usual way to implement this is to cache the EDID retrieved in the
867867 * probe callback somewhere in the driver-private connector structure.
868868 * In this function drivers then parse the modes in the EDID and add
869− * them by calling drm_add_edid_modes(). But connectors that driver a
869+ * them by calling drm_add_edid_modes(). But connectors that drive a
870870 * fixed panel can also manually add specific modes using
871871 * drm_mode_probed_add(). Drivers which manually add modes should also
872872 * make sure that the &drm_connector.display_info,
873873 * &drm_connector.width_mm and &drm_connector.height_mm fields are
874874 * filled in.
875875 *
876+ * Note that the caller function will automatically add standard VESA
877+ * DMT modes up to 1024x768 if the .get_modes() helper operation returns
878+ * no mode and if the connector status is connector_status_connected or
879+ * connector_status_unknown. There is no need to call
880+ * drm_add_modes_noedid() manually in that case.
881+ *
876882 * Virtual drivers that just want some standard VESA mode with a given
877883 * resolution can call drm_add_modes_noedid(), and mark the preferred
878884 * one using drm_set_preferred_mode().