Commit 15438ab0 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-next-2017-10-05' of git://anongit.freedesktop.org/git/drm-misc into drm-next

More drm-misc for 4.15:

Cross-subsystem Changes:
- bunch more simple outreachy patches (Meghana Madhyastha, Aishwarya
  Pant, Haneen Mohammed)
- Quite a pile of static checker/cocci/spelling fixups all over.
- Final driver patches+core cleanup of Noralf's new drm_gem_fb_create
  helper.

Core Changes:
- legacy DPMS docs improved
- add dri-devel m-l to fbdev to catch people who try to fix
  fbcon-on-kms bugs in the wrong place

Driver Changes:
- vc4: prep for dsi panels (Eric)

* tag 'drm-misc-next-2017-10-05' of git://anongit.freedesktop.org/git/drm-misc: (34 commits)
  drm: fix typo in drm_gem_get_pages() comment
  MAINTAINERS: Add dri-devel as a mailing list for anything fbdev
  drm/virtio: Replace instances of reference/unreference with get/put
  drm/fb-cma-helper: Remove unused functions
  drm/tve200: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()
  drm/sun4i: Use drm_gem_fb_create()
  drm/shmobile: Use drm_gem_fb_create()
  drm/rcar-du: Use drm_gem_fb_create()
  drm/mxsfb: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()
  drm/meson: Use drm_gem_fb_create()
  drm/hisilicon/kirin: Use drm_gem_fb_create()
  drm/fsl-dcu: Use drm_gem_fb_create()
  drm/tinydrm: Use drm_gem_framebuffer_helper
  drm: of: always initialize panel in drm_of_find_panel_or_bridge()
  drm/tve200: Check for IS_ERR instead of NULL in probe
  drm/tve200: make two functions static
  drm/armada: Remove unused #include <drmP.h>
  drm/rockchip: Rely on the default best_encoder() behavior
  drm/vc4: Set up the DSI host at pdev probe time, not component bind.
  drm/vc4: Avoid using vrefresh==0 mode in DSI htotal math.
  ...
parents ebec44a2 5b9fbfff
...@@ -184,12 +184,6 @@ Contact: Sean Paul, Maintainer of the driver you plan to convert ...@@ -184,12 +184,6 @@ Contact: Sean Paul, Maintainer of the driver you plan to convert
Core refactorings Core refactorings
================= =================
Use new IDR deletion interface to clean up drm_gem_handle_delete()
------------------------------------------------------------------
See the "This is gross" comment -- apparently the IDR system now can return an
error code instead of oopsing.
Clean up the DRM header mess Clean up the DRM header mess
---------------------------- ----------------------------
...@@ -357,7 +351,16 @@ those drivers as simple as possible, so lots of room for refactoring: ...@@ -357,7 +351,16 @@ those drivers as simple as possible, so lots of room for refactoring:
- backlight helpers, probably best to put them into a new drm_backlight.c. - backlight helpers, probably best to put them into a new drm_backlight.c.
This is because drivers/video is de-facto unmaintained. We could also This is because drivers/video is de-facto unmaintained. We could also
move drivers/video/backlight to drivers/gpu/backlight and take it all move drivers/video/backlight to drivers/gpu/backlight and take it all
over within drm-misc, but that's more work. over within drm-misc, but that's more work. Backlight helpers require a fair
bit of reworking and refactoring. A simple example is the enabling of a backlight.
Tinydrm has helpers for this. It would be good if other drivers can also use the
helper. However, there are various cases we need to consider i.e different
drivers seem to have different ways of enabling/disabling a backlight.
We also need to consider the backlight drivers (like gpio_backlight). The situation
is further complicated by the fact that the backlight is tied to fbdev
via fb_notifier_callback() which has complicated logic. For further details, refer
to the following discussion thread:
https://groups.google.com/forum/#!topic/outreachy-kernel/8rBe30lwtdA
- spi helpers, probably best put into spi core/helper code. Thierry said - spi helpers, probably best put into spi core/helper code. Thierry said
the spi maintainer is fast&reactive, so shouldn't be a big issue. the spi maintainer is fast&reactive, so shouldn't be a big issue.
......
...@@ -5461,6 +5461,7 @@ F: drivers/net/wan/sdla.c ...@@ -5461,6 +5461,7 @@ F: drivers/net/wan/sdla.c
FRAMEBUFFER LAYER FRAMEBUFFER LAYER
M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
L: dri-devel@lists.freedesktop.org
L: linux-fbdev@vger.kernel.org L: linux-fbdev@vger.kernel.org
T: git git://github.com/bzolnier/linux.git T: git git://github.com/bzolnier/linux.git
Q: http://patchwork.kernel.org/project/linux-fbdev/list/ Q: http://patchwork.kernel.org/project/linux-fbdev/list/
......
...@@ -625,7 +625,7 @@ EXPORT_SYMBOL_GPL(dma_buf_detach); ...@@ -625,7 +625,7 @@ EXPORT_SYMBOL_GPL(dma_buf_detach);
struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach, struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
enum dma_data_direction direction) enum dma_data_direction direction)
{ {
struct sg_table *sg_table = ERR_PTR(-EINVAL); struct sg_table *sg_table;
might_sleep(); might_sleep();
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
*/ */
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <drm/drmP.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include "armada_crtc.h" #include "armada_crtc.h"
#include "armada_drm.h" #include "armada_drm.h"
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <linux/component.h> #include <linux/component.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
#include <drm/drmP.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include "armada_crtc.h" #include "armada_crtc.h"
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <drm/drmP.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include "armada_drm.h" #include "armada_drm.h"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <drm/drmP.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include "armada_crtc.h" #include "armada_crtc.h"
#include "armada_drm.h" #include "armada_drm.h"
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/shmem_fs.h> #include <linux/shmem_fs.h>
#include <drm/drmP.h>
#include "armada_drm.h" #include "armada_drm.h"
#include "armada_gem.h" #include "armada_gem.h"
#include <drm/armada_drm.h> #include <drm/armada_drm.h>
......
...@@ -70,7 +70,6 @@ int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info) ...@@ -70,7 +70,6 @@ int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info)
return 0; return 0;
} }
EXPORT_SYMBOL(drm_agp_info); EXPORT_SYMBOL(drm_agp_info);
int drm_agp_info_ioctl(struct drm_device *dev, void *data, int drm_agp_info_ioctl(struct drm_device *dev, void *data,
...@@ -95,18 +94,18 @@ int drm_agp_info_ioctl(struct drm_device *dev, void *data, ...@@ -95,18 +94,18 @@ int drm_agp_info_ioctl(struct drm_device *dev, void *data,
* Verifies the AGP device hasn't been acquired before and calls * Verifies the AGP device hasn't been acquired before and calls
* \c agp_backend_acquire. * \c agp_backend_acquire.
*/ */
int drm_agp_acquire(struct drm_device * dev) int drm_agp_acquire(struct drm_device *dev)
{ {
if (!dev->agp) if (!dev->agp)
return -ENODEV; return -ENODEV;
if (dev->agp->acquired) if (dev->agp->acquired)
return -EBUSY; return -EBUSY;
if (!(dev->agp->bridge = agp_backend_acquire(dev->pdev))) dev->agp->bridge = agp_backend_acquire(dev->pdev);
if (!dev->agp->bridge)
return -ENODEV; return -ENODEV;
dev->agp->acquired = 1; dev->agp->acquired = 1;
return 0; return 0;
} }
EXPORT_SYMBOL(drm_agp_acquire); EXPORT_SYMBOL(drm_agp_acquire);
/** /**
...@@ -135,7 +134,7 @@ int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, ...@@ -135,7 +134,7 @@ int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
* *
* Verifies the AGP device has been acquired and calls \c agp_backend_release. * Verifies the AGP device has been acquired and calls \c agp_backend_release.
*/ */
int drm_agp_release(struct drm_device * dev) int drm_agp_release(struct drm_device *dev)
{ {
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
...@@ -161,7 +160,7 @@ int drm_agp_release_ioctl(struct drm_device *dev, void *data, ...@@ -161,7 +160,7 @@ int drm_agp_release_ioctl(struct drm_device *dev, void *data,
* Verifies the AGP device has been acquired but not enabled, and calls * Verifies the AGP device has been acquired but not enabled, and calls
* \c agp_enable. * \c agp_enable.
*/ */
int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode) int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode)
{ {
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
...@@ -171,7 +170,6 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode) ...@@ -171,7 +170,6 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode)
dev->agp->enabled = 1; dev->agp->enabled = 1;
return 0; return 0;
} }
EXPORT_SYMBOL(drm_agp_enable); EXPORT_SYMBOL(drm_agp_enable);
int drm_agp_enable_ioctl(struct drm_device *dev, void *data, int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
...@@ -203,12 +201,14 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) ...@@ -203,12 +201,14 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) entry = kzalloc(sizeof(*entry), GFP_KERNEL);
if (!entry)
return -ENOMEM; return -ENOMEM;
pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
type = (u32) request->type; type = (u32) request->type;
if (!(memory = agp_allocate_memory(dev->agp->bridge, pages, type))) { memory = agp_allocate_memory(dev->agp->bridge, pages, type);
if (!memory) {
kfree(entry); kfree(entry);
return -ENOMEM; return -ENOMEM;
} }
...@@ -244,8 +244,8 @@ int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, ...@@ -244,8 +244,8 @@ int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
* *
* Walks through drm_agp_head::memory until finding a matching handle. * Walks through drm_agp_head::memory until finding a matching handle.
*/ */
static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev, static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device *dev,
unsigned long handle) unsigned long handle)
{ {
struct drm_agp_mem *entry; struct drm_agp_mem *entry;
...@@ -275,9 +275,8 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) ...@@ -275,9 +275,8 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
if (!(entry = drm_agp_lookup_entry(dev, request->handle))) entry = drm_agp_lookup_entry(dev, request->handle);
return -EINVAL; if (!entry || !entry->bound)
if (!entry->bound)
return -EINVAL; return -EINVAL;
ret = drm_unbind_agp(entry->memory); ret = drm_unbind_agp(entry->memory);
if (ret == 0) if (ret == 0)
...@@ -316,12 +315,12 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) ...@@ -316,12 +315,12 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
if (!(entry = drm_agp_lookup_entry(dev, request->handle))) entry = drm_agp_lookup_entry(dev, request->handle);
return -EINVAL; if (!entry || entry->bound)
if (entry->bound)
return -EINVAL; return -EINVAL;
page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE; page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE;
if ((retcode = drm_bind_agp(entry->memory, page))) retcode = drm_bind_agp(entry->memory, page);
if (retcode)
return retcode; return retcode;
entry->bound = dev->agp->base + (page << PAGE_SHIFT); entry->bound = dev->agp->base + (page << PAGE_SHIFT);
DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n",
...@@ -359,7 +358,8 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) ...@@ -359,7 +358,8 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
if (!(entry = drm_agp_lookup_entry(dev, request->handle))) entry = drm_agp_lookup_entry(dev, request->handle);
if (!entry)
return -EINVAL; return -EINVAL;
if (entry->bound) if (entry->bound)
drm_unbind_agp(entry->memory); drm_unbind_agp(entry->memory);
...@@ -373,7 +373,6 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) ...@@ -373,7 +373,6 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
EXPORT_SYMBOL(drm_agp_free); EXPORT_SYMBOL(drm_agp_free);
int drm_agp_free_ioctl(struct drm_device *dev, void *data, int drm_agp_free_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
...@@ -398,11 +397,13 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) ...@@ -398,11 +397,13 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
{ {
struct drm_agp_head *head = NULL; struct drm_agp_head *head = NULL;
if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) head = kzalloc(sizeof(*head), GFP_KERNEL);
if (!head)
return NULL; return NULL;
head->bridge = agp_find_bridge(dev->pdev); head->bridge = agp_find_bridge(dev->pdev);
if (!head->bridge) { if (!head->bridge) {
if (!(head->bridge = agp_backend_acquire(dev->pdev))) { head->bridge = agp_backend_acquire(dev->pdev);
if (!head->bridge) {
kfree(head); kfree(head);
return NULL; return NULL;
} }
......
...@@ -719,6 +719,29 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, ...@@ -719,6 +719,29 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
* callback. For atomic drivers the remapping to the "ACTIVE" property is * callback. For atomic drivers the remapping to the "ACTIVE" property is
* implemented in the DRM core. This is the only standard connector * implemented in the DRM core. This is the only standard connector
* property that userspace can change. * property that userspace can change.
*
* Note that this property cannot be set through the MODE_ATOMIC ioctl,
* userspace must use "ACTIVE" on the CRTC instead.
*
* WARNING:
*
* For userspace also running on legacy drivers the "DPMS" semantics are a
* lot more complicated. First, userspace cannot rely on the "DPMS" value
* returned by the GETCONNECTOR actually reflecting reality, because many
* drivers fail to update it. For atomic drivers this is taken care of in
* drm_atomic_helper_update_legacy_modeset_state().
*
* The second issue is that the DPMS state is only well-defined when the
* connector is connected to a CRTC. In atomic the DRM core enforces that
* "ACTIVE" is off in such a case, no such checks exists for "DPMS".
*
* Finally, when enabling an output using the legacy SETCONFIG ioctl then
* "DPMS" is forced to ON. But see above, that might not be reflected in
* the software value on legacy drivers.
*
* Summarizing: Only set "DPMS" when the connector is known to be enabled,
* assume that a successful SETCONFIG call also sets "DPMS" to on, and
* never read back the value of "DPMS" because it can be incorrect.
* PATH: * PATH:
* Connector path property to identify how this sink is physically * Connector path property to identify how this sink is physically
* connected. Used by DP MST. This should be set by calling * connected. Used by DP MST. This should be set by calling
......
...@@ -286,13 +286,13 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id) ...@@ -286,13 +286,13 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id)
spin_lock_irqsave(&drm_minor_lock, flags); spin_lock_irqsave(&drm_minor_lock, flags);
minor = idr_find(&drm_minors_idr, minor_id); minor = idr_find(&drm_minors_idr, minor_id);
if (minor) if (minor)
drm_dev_ref(minor->dev); drm_dev_get(minor->dev);
spin_unlock_irqrestore(&drm_minor_lock, flags); spin_unlock_irqrestore(&drm_minor_lock, flags);
if (!minor) { if (!minor) {
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} else if (drm_dev_is_unplugged(minor->dev)) { } else if (drm_dev_is_unplugged(minor->dev)) {
drm_dev_unref(minor->dev); drm_dev_put(minor->dev);
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
...@@ -301,7 +301,7 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id) ...@@ -301,7 +301,7 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id)
void drm_minor_release(struct drm_minor *minor) void drm_minor_release(struct drm_minor *minor)
{ {
drm_dev_unref(minor->dev); drm_dev_put(minor->dev);
} }
/** /**
...@@ -326,11 +326,11 @@ void drm_minor_release(struct drm_minor *minor) ...@@ -326,11 +326,11 @@ void drm_minor_release(struct drm_minor *minor)
* When cleaning up a device instance everything needs to be done in reverse: * When cleaning up a device instance everything needs to be done in reverse:
* First unpublish the device instance with drm_dev_unregister(). Then clean up * First unpublish the device instance with drm_dev_unregister(). Then clean up
* any other resources allocated at device initialization and drop the driver's * any other resources allocated at device initialization and drop the driver's
* reference to &drm_device using drm_dev_unref(). * reference to &drm_device using drm_dev_put().
* *
* Note that the lifetime rules for &drm_device instance has still a lot of * Note that the lifetime rules for &drm_device instance has still a lot of
* historical baggage. Hence use the reference counting provided by * historical baggage. Hence use the reference counting provided by
* drm_dev_ref() and drm_dev_unref() only carefully. * drm_dev_get() and drm_dev_put() only carefully.
* *
* It is recommended that drivers embed &struct drm_device into their own device * It is recommended that drivers embed &struct drm_device into their own device
* structure, which is supported through drm_dev_init(). * structure, which is supported through drm_dev_init().
...@@ -345,7 +345,7 @@ void drm_minor_release(struct drm_minor *minor) ...@@ -345,7 +345,7 @@ void drm_minor_release(struct drm_minor *minor)
* Cleans up all DRM device, calling drm_lastclose(). * Cleans up all DRM device, calling drm_lastclose().
* *
* Note: Use of this function is deprecated. It will eventually go away * Note: Use of this function is deprecated. It will eventually go away
* completely. Please use drm_dev_unregister() and drm_dev_unref() explicitly * completely. Please use drm_dev_unregister() and drm_dev_put() explicitly
* instead to make sure that the device isn't userspace accessible any more * instead to make sure that the device isn't userspace accessible any more
* while teardown is in progress, ensuring that userspace can't access an * while teardown is in progress, ensuring that userspace can't access an
* inconsistent state. * inconsistent state.
...@@ -360,7 +360,7 @@ void drm_put_dev(struct drm_device *dev) ...@@ -360,7 +360,7 @@ void drm_put_dev(struct drm_device *dev)
} }
drm_dev_unregister(dev); drm_dev_unregister(dev);
drm_dev_unref(dev); drm_dev_put(dev);
} }
EXPORT_SYMBOL(drm_put_dev); EXPORT_SYMBOL(drm_put_dev);
...@@ -386,7 +386,7 @@ void drm_dev_unplug(struct drm_device *dev) ...@@ -386,7 +386,7 @@ void drm_dev_unplug(struct drm_device *dev)
mutex_lock(&drm_global_mutex); mutex_lock(&drm_global_mutex);
drm_device_set_unplugged(dev); drm_device_set_unplugged(dev);
if (dev->open_count == 0) if (dev->open_count == 0)
drm_dev_unref(dev); drm_dev_put(dev);
mutex_unlock(&drm_global_mutex); mutex_unlock(&drm_global_mutex);
} }
EXPORT_SYMBOL(drm_dev_unplug); EXPORT_SYMBOL(drm_dev_unplug);
...@@ -475,8 +475,8 @@ static void drm_fs_inode_free(struct inode *inode) ...@@ -475,8 +475,8 @@ static void drm_fs_inode_free(struct inode *inode)
* initialization sequence to make sure userspace can't access an inconsistent * initialization sequence to make sure userspace can't access an inconsistent
* state. * state.
* *
* The initial ref-count of the object is 1. Use drm_dev_ref() and * The initial ref-count of the object is 1. Use drm_dev_get() and
* drm_dev_unref() to take and drop further ref-counts. * drm_dev_put() to take and drop further ref-counts.
* *
* Note that for purely virtual devices @parent can be NULL. * Note that for purely virtual devices @parent can be NULL.
* *
...@@ -626,8 +626,8 @@ EXPORT_SYMBOL(drm_dev_fini); ...@@ -626,8 +626,8 @@ EXPORT_SYMBOL(drm_dev_fini);
* initialization sequence to make sure userspace can't access an inconsistent * initialization sequence to make sure userspace can't access an inconsistent
* state. * state.
* *
* The initial ref-count of the object is 1. Use drm_dev_ref() and * The initial ref-count of the object is 1. Use drm_dev_get() and
* drm_dev_unref() to take and drop further ref-counts. * drm_dev_put() to take and drop further ref-counts.
* *
* Note that for purely virtual devices @parent can be NULL. * Note that for purely virtual devices @parent can be NULL.
* *
...@@ -670,36 +670,49 @@ static void drm_dev_release(struct kref *ref) ...@@ -670,36 +670,49 @@ static void drm_dev_release(struct kref *ref)
} }
/** /**
* drm_dev_ref - Take reference of a DRM device * drm_dev_get - Take reference of a DRM device
* @dev: device to take reference of or NULL * @dev: device to take reference of or NULL
* *
* This increases the ref-count of @dev by one. You *must* already own a * This increases the ref-count of @dev by one. You *must* already own a
* reference when calling this. Use drm_dev_unref() to drop this reference * reference when calling this. Use drm_dev_put() to drop this reference
* again. * again.
* *
* This function never fails. However, this function does not provide *any* * This function never fails. However, this function does not provide *any*
* guarantee whether the device is alive or running. It only provides a * guarantee whether the device is alive or running. It only provides a
* reference to the object and the memory associated with it. * reference to the object and the memory associated with it.
*/ */
void drm_dev_ref(struct drm_device *dev) void drm_dev_get(struct drm_device *dev)
{ {
if (dev) if (dev)
kref_get(&dev->ref); kref_get(&dev->ref);
} }
EXPORT_SYMBOL(drm_dev_ref); EXPORT_SYMBOL(drm_dev_get);
/** /**
* drm_dev_unref - Drop reference of a DRM device * drm_dev_put - Drop reference of a DRM device
* @dev: device to drop reference of or NULL * @dev: device to drop reference of or NULL
* *
* This decreases the ref-count of @dev by one. The device is destroyed if the * This decreases the ref-count of @dev by one. The device is destroyed if the
* ref-count drops to zero. * ref-count drops to zero.
*/ */
void drm_dev_unref(struct drm_device *dev) void drm_dev_put(struct drm_device *dev)
{ {
if (dev) if (dev)
kref_put(&dev->ref, drm_dev_release); kref_put(&dev->ref, drm_dev_release);
} }
EXPORT_SYMBOL(drm_dev_put);
/**
* drm_dev_unref - Drop reference of a DRM device
* @dev: device to drop reference of or NULL
*
* This is a compatibility alias for drm_dev_put() and should not be used by new
* code.
*/
void drm_dev_unref(struct drm_device *dev)
{
drm_dev_put(dev);
}
EXPORT_SYMBOL(drm_dev_unref); EXPORT_SYMBOL(drm_dev_unref);
static int create_compat_control_link(struct drm_device *dev) static int create_compat_control_link(struct drm_device *dev)
...@@ -839,7 +852,7 @@ EXPORT_SYMBOL(drm_dev_register); ...@@ -839,7 +852,7 @@ EXPORT_SYMBOL(drm_dev_register);
* *
* Unregister the DRM device from the system. This does the reverse of * Unregister the DRM device from the system. This does the reverse of
* drm_dev_register() but does not deallocate the device. The caller must call * drm_dev_register() but does not deallocate the device. The caller must call
* drm_dev_unref() to drop their final reference. * drm_dev_put() to drop their final reference.
* *
* A special form of unregistering for hotpluggable devices is drm_dev_unplug(), * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
* which can be called while there are still open users of @dev. * which can be called while there are still open users of @dev.
......
...@@ -38,7 +38,7 @@ struct drm_fbdev_cma { ...@@ -38,7 +38,7 @@ struct drm_fbdev_cma {
* Provides helper functions for creating a cma (contiguous memory allocator) * Provides helper functions for creating a cma (contiguous memory allocator)
* backed framebuffer. * backed framebuffer.
* *
* drm_fb_cma_create() is used in the &drm_mode_config_funcs.fb_create * drm_gem_fb_create() is used in the &drm_mode_config_funcs.fb_create
* callback function to create a cma backed framebuffer. * callback function to create a cma backed framebuffer.
* *
* An fbdev framebuffer backed by cma is also available by calling * An fbdev framebuffer backed by cma is also available by calling
...@@ -61,8 +61,8 @@ struct drm_fbdev_cma { ...@@ -61,8 +61,8 @@ struct drm_fbdev_cma {
* } * }
* *
* static struct drm_framebuffer_funcs driver_fb_funcs = { * static struct drm_framebuffer_funcs driver_fb_funcs = {
* .destroy = drm_fb_cma_destroy, * .destroy = drm_gem_fb_destroy,
* .create_handle = drm_fb_cma_create_handle, * .create_handle = drm_gem_fb_create_handle,
* .dirty = driver_fb_dirty, * .dirty = driver_fb_dirty,
* }; * };
* *
...@@ -80,57 +80,6 @@ static inline struct drm_fbdev_cma *to_fbdev_cma(struct drm_fb_helper *helper) ...@@ -80,57 +80,6 @@ static inline struct drm_fbdev_cma *to_fbdev_cma(struct drm_fb_helper *helper)
return container_of(helper, struct drm_fbdev_cma, fb_helper); return container_of(helper, struct drm_fbdev_cma, fb_helper);
} }
void drm_fb_cma_destroy(struct drm_framebuffer *fb)
{
drm_gem_fb_destroy(fb);
}
EXPORT_SYMBOL(drm_fb_cma_destroy);
int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
struct drm_file *file_priv, unsigned int *handle)
{
return drm_gem_fb_create_handle(fb, file_priv, handle);
}
EXPORT_SYMBOL(drm_fb_cma_create_handle);
/**
* drm_fb_cma_create_with_funcs() - helper function for the
* &drm_mode_config_funcs.fb_create
* callback
* @dev: DRM device
* @file_priv: drm file for the ioctl call
* @mode_cmd: metadata from the userspace fb creation request
* @funcs: vtable to be used for the new framebuffer object
*
* This can be used to set &drm_framebuffer_funcs for drivers that need the
* &drm_framebuffer_funcs.dirty callback. Use drm_fb_cma_create() if you don't
* need to change &drm_framebuffer_funcs.
*/
struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev,
struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd,
const struct drm_framebuffer_funcs *funcs)
{
return drm_gem_fb_create_with_funcs(dev, file_priv, mode_cmd, funcs);
}
EXPORT_SYMBOL_GPL(drm_fb_cma_create_with_funcs);
/**
* drm_fb_cma_create() - &drm_mode_config_funcs.fb_create callback function
* @dev: DRM device
* @file_priv: drm file for the ioctl call
* @mode_cmd: metadata from the userspace fb creation request
*
* If your hardware has special alignment or pitch requirements these should be
* checked before calling this function. Use drm_fb_cma_create_with_funcs() if
* you need to set &drm_framebuffer_funcs.dirty.
*/
struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd)
{
return drm_gem_fb_create(dev, file_priv, mode_cmd);
}
EXPORT_SYMBOL_GPL(drm_fb_cma_create);
/** /**
* drm_fb_cma_get_gem_obj() - Get CMA GEM object for framebuffer * drm_fb_cma_get_gem_obj() - Get CMA GEM object for framebuffer
* @fb: The framebuffer * @fb: The framebuffer
...@@ -181,26 +130,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, ...@@ -181,26 +130,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb,
} }
EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr); EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr);
/**
* drm_fb_cma_prepare_fb() - Prepare CMA framebuffer
* @plane: Which plane
* @state: Plane state attach fence to
*
* This should be set as the &struct drm_plane_helper_funcs.prepare_fb hook.
*
* This function checks if the plane FB has an dma-buf attached, extracts
* the exclusive fence and attaches it to plane state for the atomic helper
* to wait on.
*
* There is no need for cleanup_fb for CMA based framebuffer drivers.
*/
int drm_fb_cma_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *state)
{
return drm_gem_fb_prepare_fb(plane, state);
}
EXPORT_SYMBOL_GPL(drm_fb_cma_prepare_fb);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m) static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m)
{ {
......
...@@ -282,15 +282,6 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle) ...@@ -282,15 +282,6 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle)
{ {
struct drm_gem_object *obj; struct drm_gem_object *obj;
/* This is gross. The idr system doesn't let us try a delete and
* return an error code. It just spews if you fail at deleting.
* So, we have to grab a lock around finding the object and then
* doing the delete on it and dropping the refcount, or the user
* could race us to double-decrement the refcount and cause a
* use-after-free later. Given the frequency of our handle lookups,
* we may want to use ida for number allocation and a hash table
* for the pointers, anyway.
*/
spin_lock(&filp->table_lock); spin_lock(&filp->table_lock);
/* Check if we currently have a reference on the object */ /* Check if we currently have a reference on the object */
...@@ -543,7 +534,7 @@ EXPORT_SYMBOL(drm_gem_create_mmap_offset); ...@@ -543,7 +534,7 @@ EXPORT_SYMBOL(drm_gem_create_mmap_offset);
* Note that you are not allowed to change gfp-zones during runtime. That is, * Note that you are not allowed to change gfp-zones during runtime. That is,
* shmem_read_mapping_page_gfp() must be called with the same gfp_zone(gfp) as * shmem_read_mapping_page_gfp() must be called with the same gfp_zone(gfp) as
* set during initialization. If you have special zone constraints, set them * set during initialization. If you have special zone constraints, set them
* after drm_gem_init_object() via mapping_set_gfp_mask(). shmem-core takes care * after drm_gem_object_init() via mapping_set_gfp_mask(). shmem-core takes care
* to keep pages in the required zone during swap-in. * to keep pages in the required zone during swap-in.
*/ */
struct page **drm_gem_get_pages(struct drm_gem_object *obj) struct page **drm_gem_get_pages(struct drm_gem_object *obj)
......
...@@ -233,6 +233,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, ...@@ -233,6 +233,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
if (!panel && !bridge) if (!panel && !bridge)
return -EINVAL; return -EINVAL;
if (panel)
*panel = NULL;
remote = of_graph_get_remote_node(np, port, endpoint); remote = of_graph_get_remote_node(np, port, endpoint);
if (!remote) if (!remote)
......
...@@ -274,7 +274,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, ...@@ -274,7 +274,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
drm_pci_agp_destroy(dev); drm_pci_agp_destroy(dev);
pci_disable_device(pdev); pci_disable_device(pdev);
err_free: err_free:
drm_dev_unref(dev); drm_dev_put(dev);
return ret; return ret;
} }
EXPORT_SYMBOL(drm_get_pci_dev); EXPORT_SYMBOL(drm_get_pci_dev);
......
...@@ -318,7 +318,7 @@ struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, ...@@ -318,7 +318,7 @@ struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
if (IS_ERR(dma_buf)) if (IS_ERR(dma_buf))
return dma_buf; return dma_buf;
drm_dev_ref(dev); drm_dev_get(dev);
drm_gem_object_get(exp_info->priv); drm_gem_object_get(exp_info->priv);
return dma_buf; return dma_buf;
...@@ -342,7 +342,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf) ...@@ -342,7 +342,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
/* drop the reference on the export fd holds */ /* drop the reference on the export fd holds */
drm_gem_object_put_unlocked(obj); drm_gem_object_put_unlocked(obj);
drm_dev_unref(dev); drm_dev_put(dev);
} }
EXPORT_SYMBOL(drm_gem_dmabuf_release); EXPORT_SYMBOL(drm_gem_dmabuf_release);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include "fsl_dcu_drm_crtc.h" #include "fsl_dcu_drm_crtc.h"
#include "fsl_dcu_drm_drv.h" #include "fsl_dcu_drm_drv.h"
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
static const struct drm_mode_config_funcs fsl_dcu_drm_mode_config_funcs = { static const struct drm_mode_config_funcs fsl_dcu_drm_mode_config_funcs = {
.atomic_check = drm_atomic_helper_check, .atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
.fb_create = drm_fb_cma_create, .fb_create = drm_gem_fb_create,
}; };
int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev) int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev)
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
...@@ -56,7 +57,7 @@ static void kirin_fbdev_output_poll_changed(struct drm_device *dev) ...@@ -56,7 +57,7 @@ static void kirin_fbdev_output_poll_changed(struct drm_device *dev)
} }
static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = { static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = {
.fb_create = drm_fb_cma_create, .fb_create = drm_gem_fb_create,
.output_poll_changed = kirin_fbdev_output_poll_changed, .output_poll_changed = kirin_fbdev_output_poll_changed,
.atomic_check = drm_atomic_helper_check, .atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_plane_helper.h> #include <drm/drm_plane_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_rect.h> #include <drm/drm_rect.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
...@@ -78,7 +79,7 @@ static const struct drm_mode_config_funcs meson_mode_config_funcs = { ...@@ -78,7 +79,7 @@ static const struct drm_mode_config_funcs meson_mode_config_funcs = {
.output_poll_changed = meson_fb_output_poll_changed, .output_poll_changed = meson_fb_output_poll_changed,
.atomic_check = drm_atomic_helper_check, .atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
.fb_create = drm_fb_cma_create, .fb_create = drm_gem_fb_create,
}; };
static irqreturn_t meson_irq(int irq, void *arg) static irqreturn_t meson_irq(int irq, void *arg)
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_panel.h> #include <drm/drm_panel.h>
#include <drm/drm_simple_kms_helper.h> #include <drm/drm_simple_kms_helper.h>
...@@ -92,7 +93,7 @@ void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb) ...@@ -92,7 +93,7 @@ void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb)
} }
static const struct drm_mode_config_funcs mxsfb_mode_config_funcs = { static const struct drm_mode_config_funcs mxsfb_mode_config_funcs = {
.fb_create = drm_fb_cma_create, .fb_create = drm_gem_fb_create,
.atomic_check = drm_atomic_helper_check, .atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
}; };
...@@ -127,7 +128,7 @@ static void mxsfb_pipe_update(struct drm_simple_display_pipe *pipe, ...@@ -127,7 +128,7 @@ static void mxsfb_pipe_update(struct drm_simple_display_pipe *pipe,
static int mxsfb_pipe_prepare_fb(struct drm_simple_display_pipe *pipe, static int mxsfb_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
return drm_fb_cma_prepare_fb(&pipe->plane, plane_state); return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
} }
static struct drm_simple_display_pipe_funcs mxsfb_funcs = { static struct drm_simple_display_pipe_funcs mxsfb_funcs = {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
#include <linux/wait.h> #include <linux/wait.h>
...@@ -213,7 +214,7 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv, ...@@ -213,7 +214,7 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
} }
} }
return drm_fb_cma_create(dev, file_priv, mode_cmd); return drm_gem_fb_create(dev, file_priv, mode_cmd);
} }
static void rcar_du_output_poll_changed(struct drm_device *dev) static void rcar_du_output_poll_changed(struct drm_device *dev)
......
...@@ -287,14 +287,6 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector) ...@@ -287,14 +287,6 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector)
return ret; return ret;
} }
static struct drm_encoder *
cdn_dp_connector_best_encoder(struct drm_connector *connector)
{
struct cdn_dp_device *dp = connector_to_dp(connector);
return &dp->encoder;
}
static int cdn_dp_connector_mode_valid(struct drm_connector *connector, static int cdn_dp_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
...@@ -346,7 +338,6 @@ static int cdn_dp_connector_mode_valid(struct drm_connector *connector, ...@@ -346,7 +338,6 @@ static int cdn_dp_connector_mode_valid(struct drm_connector *connector,
static struct drm_connector_helper_funcs cdn_dp_connector_helper_funcs = { static struct drm_connector_helper_funcs cdn_dp_connector_helper_funcs = {
.get_modes = cdn_dp_connector_get_modes, .get_modes = cdn_dp_connector_get_modes,
.best_encoder = cdn_dp_connector_best_encoder,
.mode_valid = cdn_dp_connector_mode_valid, .mode_valid = cdn_dp_connector_mode_valid,
}; };
......
...@@ -220,7 +220,7 @@ static int rockchip_drm_gem_object_mmap_iommu(struct drm_gem_object *obj, ...@@ -220,7 +220,7 @@ static int rockchip_drm_gem_object_mmap_iommu(struct drm_gem_object *obj,
{ {
struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj);
unsigned int i, count = obj->size >> PAGE_SHIFT; unsigned int i, count = obj->size >> PAGE_SHIFT;
unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; unsigned long user_count = vma_pages(vma);
unsigned long uaddr = vma->vm_start; unsigned long uaddr = vma->vm_start;
unsigned long offset = vma->vm_pgoff; unsigned long offset = vma->vm_pgoff;
unsigned long end = user_count + offset; unsigned long end = user_count + offset;
......
...@@ -346,7 +346,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, ...@@ -346,7 +346,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
struct drm_connector *connector; struct drm_connector *connector;
struct device_node *remote = NULL; struct device_node *remote = NULL;
struct device_node *port, *endpoint; struct device_node *port, *endpoint;
int ret; int ret = 0, child_count = 0;
const char *name; const char *name;
u32 endpoint_id; u32 endpoint_id;
...@@ -358,15 +358,20 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, ...@@ -358,15 +358,20 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
return -EINVAL; return -EINVAL;
} }
for_each_child_of_node(port, endpoint) { for_each_child_of_node(port, endpoint) {
child_count++;
of_property_read_u32(endpoint, "reg", &endpoint_id); of_property_read_u32(endpoint, "reg", &endpoint_id);
ret = drm_of_find_panel_or_bridge(dev->of_node, 1, endpoint_id, ret = drm_of_find_panel_or_bridge(dev->of_node, 1, endpoint_id,
&lvds->panel, &lvds->bridge); &lvds->panel, &lvds->bridge);
if (!ret) if (!ret)
break; break;
} }
if (ret) { if (!child_count) {
DRM_DEV_ERROR(dev, "lvds port does not have any children\n");
ret = -EINVAL;
goto err_put_port;
} else if (ret) {
DRM_DEV_ERROR(dev, "failed to find panel and bridge node\n"); DRM_DEV_ERROR(dev, "failed to find panel and bridge node\n");
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
goto err_put_port; goto err_put_port;
} }
if (lvds->panel) if (lvds->panel)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <video/sh_mobile_meram.h> #include <video/sh_mobile_meram.h>
...@@ -131,7 +132,7 @@ shmob_drm_fb_create(struct drm_device *dev, struct drm_file *file_priv, ...@@ -131,7 +132,7 @@ shmob_drm_fb_create(struct drm_device *dev, struct drm_file *file_priv,
} }
} }
return drm_fb_cma_create(dev, file_priv, mode_cmd); return drm_gem_fb_create(dev, file_priv, mode_cmd);
} }
static const struct drm_mode_config_funcs shmob_drm_mode_config_funcs = { static const struct drm_mode_config_funcs shmob_drm_mode_config_funcs = {
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include "sun4i_drv.h" #include "sun4i_drv.h"
...@@ -28,7 +29,7 @@ static const struct drm_mode_config_funcs sun4i_de_mode_config_funcs = { ...@@ -28,7 +29,7 @@ static const struct drm_mode_config_funcs sun4i_de_mode_config_funcs = {
.output_poll_changed = sun4i_de_output_poll_changed, .output_poll_changed = sun4i_de_output_poll_changed,
.atomic_check = drm_atomic_helper_check, .atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
.fb_create = drm_fb_cma_create, .fb_create = drm_gem_fb_create,
}; };
struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm) struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm)
......
...@@ -75,7 +75,7 @@ static void unref_worker(struct drm_flip_work *work, void *val) ...@@ -75,7 +75,7 @@ static void unref_worker(struct drm_flip_work *work, void *val)
struct drm_device *dev = tilcdc_crtc->base.dev; struct drm_device *dev = tilcdc_crtc->base.dev;
mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->mode_config.mutex);
drm_framebuffer_unreference(val); drm_framebuffer_put(val);
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
} }
...@@ -456,7 +456,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc) ...@@ -456,7 +456,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)
set_scanout(crtc, fb); set_scanout(crtc, fb);
drm_framebuffer_reference(fb); drm_framebuffer_get(fb);
crtc->hwmode = crtc->state->adjusted_mode; crtc->hwmode = crtc->state->adjusted_mode;
} }
...@@ -633,7 +633,7 @@ int tilcdc_crtc_update_fb(struct drm_crtc *crtc, ...@@ -633,7 +633,7 @@ int tilcdc_crtc_update_fb(struct drm_crtc *crtc,
return -EBUSY; return -EBUSY;
} }
drm_framebuffer_reference(fb); drm_framebuffer_get(fb);
crtc->primary->fb = fb; crtc->primary->fb = fb;
tilcdc_crtc->event = event; tilcdc_crtc->event = event;
......
...@@ -226,7 +226,7 @@ static void tilcdc_fini(struct drm_device *dev) ...@@ -226,7 +226,7 @@ static void tilcdc_fini(struct drm_device *dev)
pm_runtime_disable(dev->dev); pm_runtime_disable(dev->dev);
drm_dev_unref(dev); drm_dev_put(dev);
} }
static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <drm/drm_atomic.h> #include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/tinydrm/tinydrm.h> #include <drm/tinydrm/tinydrm.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
...@@ -128,7 +129,7 @@ tinydrm_fb_create(struct drm_device *drm, struct drm_file *file_priv, ...@@ -128,7 +129,7 @@ tinydrm_fb_create(struct drm_device *drm, struct drm_file *file_priv,
{ {
struct tinydrm_device *tdev = drm->dev_private; struct tinydrm_device *tdev = drm->dev_private;
return drm_fb_cma_create_with_funcs(drm, file_priv, mode_cmd, return drm_gem_fb_create_with_funcs(drm, file_priv, mode_cmd,
tdev->fb_funcs); tdev->fb_funcs);
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_modes.h> #include <drm/drm_modes.h>
#include <drm/tinydrm/tinydrm.h> #include <drm/tinydrm/tinydrm.h>
...@@ -144,7 +145,7 @@ EXPORT_SYMBOL(tinydrm_display_pipe_update); ...@@ -144,7 +145,7 @@ EXPORT_SYMBOL(tinydrm_display_pipe_update);
* @pipe: Simple display pipe * @pipe: Simple display pipe
* @plane_state: Plane state * @plane_state: Plane state
* *
* This function uses drm_fb_cma_prepare_fb() to check if the plane FB has an * This function uses drm_gem_fb_prepare_fb() to check if the plane FB has an
* dma-buf attached, extracts the exclusive fence and attaches it to plane * dma-buf attached, extracts the exclusive fence and attaches it to plane
* state for the atomic helper to wait on. Drivers can use this as their * state for the atomic helper to wait on. Drivers can use this as their
* &drm_simple_display_pipe_funcs->prepare_fb callback. * &drm_simple_display_pipe_funcs->prepare_fb callback.
...@@ -152,7 +153,7 @@ EXPORT_SYMBOL(tinydrm_display_pipe_update); ...@@ -152,7 +153,7 @@ EXPORT_SYMBOL(tinydrm_display_pipe_update);
int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe, int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
return drm_fb_cma_prepare_fb(&pipe->plane, plane_state); return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
} }
EXPORT_SYMBOL(tinydrm_display_pipe_prepare_fb); EXPORT_SYMBOL(tinydrm_display_pipe_prepare_fb);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* (at your option) any later version. * (at your option) any later version.
*/ */
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/tinydrm/mipi-dbi.h> #include <drm/tinydrm/mipi-dbi.h>
#include <drm/tinydrm/tinydrm-helpers.h> #include <drm/tinydrm/tinydrm-helpers.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
...@@ -253,8 +254,8 @@ static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb, ...@@ -253,8 +254,8 @@ static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb,
} }
static const struct drm_framebuffer_funcs mipi_dbi_fb_funcs = { static const struct drm_framebuffer_funcs mipi_dbi_fb_funcs = {
.destroy = drm_fb_cma_destroy, .destroy = drm_gem_fb_destroy,
.create_handle = drm_fb_cma_create_handle, .create_handle = drm_gem_fb_create_handle,
.dirty = mipi_dbi_fb_dirty, .dirty = mipi_dbi_fb_dirty,
}; };
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/thermal.h> #include <linux/thermal.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/tinydrm/tinydrm.h> #include <drm/tinydrm/tinydrm.h>
#include <drm/tinydrm/tinydrm-helpers.h> #include <drm/tinydrm/tinydrm-helpers.h>
...@@ -636,8 +637,8 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb, ...@@ -636,8 +637,8 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,
} }
static const struct drm_framebuffer_funcs repaper_fb_funcs = { static const struct drm_framebuffer_funcs repaper_fb_funcs = {
.destroy = drm_fb_cma_destroy, .destroy = drm_gem_fb_destroy,
.create_handle = drm_fb_cma_create_handle, .create_handle = drm_gem_fb_create_handle,
.dirty = repaper_fb_dirty, .dirty = repaper_fb_dirty,
}; };
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <video/mipi_display.h> #include <video/mipi_display.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/tinydrm/mipi-dbi.h> #include <drm/tinydrm/mipi-dbi.h>
#include <drm/tinydrm/tinydrm-helpers.h> #include <drm/tinydrm/tinydrm-helpers.h>
...@@ -167,8 +168,8 @@ static int st7586_fb_dirty(struct drm_framebuffer *fb, ...@@ -167,8 +168,8 @@ static int st7586_fb_dirty(struct drm_framebuffer *fb,
} }
static const struct drm_framebuffer_funcs st7586_fb_funcs = { static const struct drm_framebuffer_funcs st7586_fb_funcs = {
.destroy = drm_fb_cma_destroy, .destroy = drm_gem_fb_destroy,
.create_handle = drm_fb_cma_create_handle, .create_handle = drm_gem_fb_create_handle,
.dirty = st7586_fb_dirty, .dirty = st7586_fb_dirty,
}; };
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_panel.h> #include <drm/drm_panel.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include "tve200_drm.h" #include "tve200_drm.h"
...@@ -221,7 +222,7 @@ static void tve200_display_enable(struct drm_simple_display_pipe *pipe, ...@@ -221,7 +222,7 @@ static void tve200_display_enable(struct drm_simple_display_pipe *pipe,
drm_crtc_vblank_on(crtc); drm_crtc_vblank_on(crtc);
} }
void tve200_display_disable(struct drm_simple_display_pipe *pipe) static void tve200_display_disable(struct drm_simple_display_pipe *pipe)
{ {
struct drm_crtc *crtc = &pipe->crtc; struct drm_crtc *crtc = &pipe->crtc;
struct drm_device *drm = crtc->dev; struct drm_device *drm = crtc->dev;
...@@ -290,10 +291,10 @@ void tve200_disable_vblank(struct drm_device *drm, unsigned int crtc) ...@@ -290,10 +291,10 @@ void tve200_disable_vblank(struct drm_device *drm, unsigned int crtc)
static int tve200_display_prepare_fb(struct drm_simple_display_pipe *pipe, static int tve200_display_prepare_fb(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
return drm_fb_cma_prepare_fb(&pipe->plane, plane_state); return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
} }
const struct drm_simple_display_pipe_funcs tve200_display_funcs = { static const struct drm_simple_display_pipe_funcs tve200_display_funcs = {
.check = tve200_display_check, .check = tve200_display_check,
.enable = tve200_display_enable, .enable = tve200_display_enable,
.disable = tve200_display_disable, .disable = tve200_display_disable,
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_panel.h> #include <drm/drm_panel.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
...@@ -55,7 +56,7 @@ ...@@ -55,7 +56,7 @@
#define DRIVER_DESC "DRM module for Faraday TVE200" #define DRIVER_DESC "DRM module for Faraday TVE200"
static const struct drm_mode_config_funcs mode_config_funcs = { static const struct drm_mode_config_funcs mode_config_funcs = {
.fb_create = drm_fb_cma_create, .fb_create = drm_gem_fb_create,
.atomic_check = drm_atomic_helper_check, .atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
}; };
...@@ -225,7 +226,7 @@ static int tve200_probe(struct platform_device *pdev) ...@@ -225,7 +226,7 @@ static int tve200_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->regs = devm_ioremap_resource(dev, res); priv->regs = devm_ioremap_resource(dev, res);
if (!priv->regs) { if (IS_ERR(priv->regs)) {
dev_err(dev, "%s failed mmio\n", __func__); dev_err(dev, "%s failed mmio\n", __func__);
ret = -EINVAL; ret = -EINVAL;
goto clk_disable; goto clk_disable;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_edid.h> #include <drm/drm_edid.h>
#include <drm/drm_mipi_dsi.h> #include <drm/drm_mipi_dsi.h>
#include <drm/drm_of.h>
#include <drm/drm_panel.h> #include <drm/drm_panel.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
...@@ -504,7 +505,6 @@ struct vc4_dsi { ...@@ -504,7 +505,6 @@ struct vc4_dsi {
struct mipi_dsi_host dsi_host; struct mipi_dsi_host dsi_host;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_bridge *bridge; struct drm_bridge *bridge;
bool is_panel_bridge;
void __iomem *regs; void __iomem *regs;
...@@ -866,7 +866,8 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder, ...@@ -866,7 +866,8 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
adjusted_mode->clock = pixel_clock_hz / 1000 + 1; adjusted_mode->clock = pixel_clock_hz / 1000 + 1;
/* Given the new pixel clock, adjust HFP to keep vrefresh the same. */ /* Given the new pixel clock, adjust HFP to keep vrefresh the same. */
adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * mode->vtotal); adjusted_mode->htotal = adjusted_mode->clock * mode->htotal /
mode->clock;
adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal; adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal;
adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal; adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal;
...@@ -1288,7 +1289,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, ...@@ -1288,7 +1289,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device) struct mipi_dsi_device *device)
{ {
struct vc4_dsi *dsi = host_to_dsi(host); struct vc4_dsi *dsi = host_to_dsi(host);
int ret = 0;
dsi->lanes = device->lanes; dsi->lanes = device->lanes;
dsi->channel = device->channel; dsi->channel = device->channel;
...@@ -1323,34 +1323,12 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, ...@@ -1323,34 +1323,12 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host,
return 0; return 0;
} }
dsi->bridge = of_drm_find_bridge(device->dev.of_node); return 0;
if (!dsi->bridge) {
struct drm_panel *panel =
of_drm_find_panel(device->dev.of_node);
dsi->bridge = drm_panel_bridge_add(panel,
DRM_MODE_CONNECTOR_DSI);
if (IS_ERR(dsi->bridge)) {
ret = PTR_ERR(dsi->bridge);
dsi->bridge = NULL;
return ret;
}
dsi->is_panel_bridge = true;
}
return drm_bridge_attach(dsi->encoder, dsi->bridge, NULL);
} }
static int vc4_dsi_host_detach(struct mipi_dsi_host *host, static int vc4_dsi_host_detach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device) struct mipi_dsi_device *device)
{ {
struct vc4_dsi *dsi = host_to_dsi(host);
if (dsi->is_panel_bridge) {
drm_panel_bridge_remove(dsi->bridge);
dsi->bridge = NULL;
}
return 0; return 0;
} }
...@@ -1492,16 +1470,13 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -1492,16 +1470,13 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm = dev_get_drvdata(master); struct drm_device *drm = dev_get_drvdata(master);
struct vc4_dev *vc4 = to_vc4_dev(drm); struct vc4_dev *vc4 = to_vc4_dev(drm);
struct vc4_dsi *dsi; struct vc4_dsi *dsi = dev_get_drvdata(dev);
struct vc4_dsi_encoder *vc4_dsi_encoder; struct vc4_dsi_encoder *vc4_dsi_encoder;
struct drm_panel *panel;
const struct of_device_id *match; const struct of_device_id *match;
dma_cap_mask_t dma_mask; dma_cap_mask_t dma_mask;
int ret; int ret;
dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
if (!dsi)
return -ENOMEM;
match = of_match_device(vc4_dsi_dt_match, dev); match = of_match_device(vc4_dsi_dt_match, dev);
if (!match) if (!match)
return -ENODEV; return -ENODEV;
...@@ -1516,7 +1491,6 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -1516,7 +1491,6 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
vc4_dsi_encoder->dsi = dsi; vc4_dsi_encoder->dsi = dsi;
dsi->encoder = &vc4_dsi_encoder->base.base; dsi->encoder = &vc4_dsi_encoder->base.base;
dsi->pdev = pdev;
dsi->regs = vc4_ioremap_regs(pdev, 0); dsi->regs = vc4_ioremap_regs(pdev, 0);
if (IS_ERR(dsi->regs)) if (IS_ERR(dsi->regs))
return PTR_ERR(dsi->regs); return PTR_ERR(dsi->regs);
...@@ -1597,6 +1571,18 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -1597,6 +1571,18 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
return ret; return ret;
} }
ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
&panel, &dsi->bridge);
if (ret)
return ret;
if (panel) {
dsi->bridge = devm_drm_panel_bridge_add(dev, panel,
DRM_MODE_CONNECTOR_DSI);
if (IS_ERR(dsi->bridge))
return PTR_ERR(dsi->bridge);
}
/* The esc clock rate is supposed to always be 100Mhz. */ /* The esc clock rate is supposed to always be 100Mhz. */
ret = clk_set_rate(dsi->escape_clock, 100 * 1000000); ret = clk_set_rate(dsi->escape_clock, 100 * 1000000);
if (ret) { if (ret) {
...@@ -1615,12 +1601,11 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -1615,12 +1601,11 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
DRM_MODE_ENCODER_DSI, NULL); DRM_MODE_ENCODER_DSI, NULL);
drm_encoder_helper_add(dsi->encoder, &vc4_dsi_encoder_helper_funcs); drm_encoder_helper_add(dsi->encoder, &vc4_dsi_encoder_helper_funcs);
dsi->dsi_host.ops = &vc4_dsi_host_ops; ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL);
dsi->dsi_host.dev = dev; if (ret) {
dev_err(dev, "bridge attach failed: %d\n", ret);
mipi_dsi_host_register(&dsi->dsi_host); return ret;
}
dev_set_drvdata(dev, dsi);
pm_runtime_enable(dev); pm_runtime_enable(dev);
...@@ -1638,8 +1623,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master, ...@@ -1638,8 +1623,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master,
vc4_dsi_encoder_destroy(dsi->encoder); vc4_dsi_encoder_destroy(dsi->encoder);
mipi_dsi_host_unregister(&dsi->dsi_host);
if (dsi->port == 1) if (dsi->port == 1)
vc4->dsi1 = NULL; vc4->dsi1 = NULL;
} }
...@@ -1651,12 +1634,47 @@ static const struct component_ops vc4_dsi_ops = { ...@@ -1651,12 +1634,47 @@ static const struct component_ops vc4_dsi_ops = {
static int vc4_dsi_dev_probe(struct platform_device *pdev) static int vc4_dsi_dev_probe(struct platform_device *pdev)
{ {
return component_add(&pdev->dev, &vc4_dsi_ops); struct device *dev = &pdev->dev;
struct vc4_dsi *dsi;
int ret;
dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
if (!dsi)
return -ENOMEM;
dev_set_drvdata(dev, dsi);
dsi->pdev = pdev;
/* Note, the initialization sequence for DSI and panels is
* tricky. The component bind above won't get past its
* -EPROBE_DEFER until the panel/bridge probes. The
* panel/bridge will return -EPROBE_DEFER until it has a
* mipi_dsi_host to register its device to. So, we register
* the host during pdev probe time, so vc4 as a whole can then
* -EPROBE_DEFER its component bind process until the panel
* successfully attaches.
*/
dsi->dsi_host.ops = &vc4_dsi_host_ops;
dsi->dsi_host.dev = dev;
mipi_dsi_host_register(&dsi->dsi_host);
ret = component_add(&pdev->dev, &vc4_dsi_ops);
if (ret) {
mipi_dsi_host_unregister(&dsi->dsi_host);
return ret;
}
return 0;
} }
static int vc4_dsi_dev_remove(struct platform_device *pdev) static int vc4_dsi_dev_remove(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
struct vc4_dsi *dsi = dev_get_drvdata(dev);
component_del(&pdev->dev, &vc4_dsi_ops); component_del(&pdev->dev, &vc4_dsi_ops);
mipi_dsi_host_unregister(&dsi->dsi_host);
return 0; return 0;
} }
......
...@@ -53,7 +53,7 @@ static void virtio_gpu_user_framebuffer_destroy(struct drm_framebuffer *fb) ...@@ -53,7 +53,7 @@ static void virtio_gpu_user_framebuffer_destroy(struct drm_framebuffer *fb)
struct virtio_gpu_framebuffer *virtio_gpu_fb struct virtio_gpu_framebuffer *virtio_gpu_fb
= to_virtio_gpu_framebuffer(fb); = to_virtio_gpu_framebuffer(fb);
drm_gem_object_unreference_unlocked(virtio_gpu_fb->obj); drm_gem_object_put_unlocked(virtio_gpu_fb->obj);
drm_framebuffer_cleanup(fb); drm_framebuffer_cleanup(fb);
kfree(virtio_gpu_fb); kfree(virtio_gpu_fb);
} }
...@@ -327,7 +327,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev, ...@@ -327,7 +327,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,
ret = virtio_gpu_framebuffer_init(dev, virtio_gpu_fb, mode_cmd, obj); ret = virtio_gpu_framebuffer_init(dev, virtio_gpu_fb, mode_cmd, obj);
if (ret) { if (ret) {
kfree(virtio_gpu_fb); kfree(virtio_gpu_fb);
drm_gem_object_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return NULL; return NULL;
} }
......
...@@ -72,7 +72,7 @@ int virtio_gpu_gem_create(struct drm_file *file, ...@@ -72,7 +72,7 @@ int virtio_gpu_gem_create(struct drm_file *file,
*obj_p = &obj->gem_base; *obj_p = &obj->gem_base;
/* drop reference from allocate - handle holds it now */ /* drop reference from allocate - handle holds it now */
drm_gem_object_unreference_unlocked(&obj->gem_base); drm_gem_object_put_unlocked(&obj->gem_base);
*handle_p = handle; *handle_p = handle;
return 0; return 0;
...@@ -130,7 +130,7 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv, ...@@ -130,7 +130,7 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv,
return -ENOENT; return -ENOENT;
obj = gem_to_virtio_gpu_obj(gobj); obj = gem_to_virtio_gpu_obj(gobj);
*offset_p = virtio_gpu_object_mmap_offset(obj); *offset_p = virtio_gpu_object_mmap_offset(obj);
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return 0; return 0;
} }
......
...@@ -86,7 +86,7 @@ static void virtio_gpu_unref_list(struct list_head *head) ...@@ -86,7 +86,7 @@ static void virtio_gpu_unref_list(struct list_head *head)
bo = buf->bo; bo = buf->bo;
qobj = container_of(bo, struct virtio_gpu_object, tbo); qobj = container_of(bo, struct virtio_gpu_object, tbo);
drm_gem_object_unreference_unlocked(&qobj->gem_base); drm_gem_object_put_unlocked(&qobj->gem_base);
} }
} }
...@@ -304,7 +304,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data, ...@@ -304,7 +304,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
} }
return ret; return ret;
} }
drm_gem_object_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
rc->res_handle = res_id; /* similiar to a VM address */ rc->res_handle = res_id; /* similiar to a VM address */
rc->bo_handle = handle; rc->bo_handle = handle;
...@@ -341,7 +341,7 @@ static int virtio_gpu_resource_info_ioctl(struct drm_device *dev, void *data, ...@@ -341,7 +341,7 @@ static int virtio_gpu_resource_info_ioctl(struct drm_device *dev, void *data,
ri->size = qobj->gem_base.size; ri->size = qobj->gem_base.size;
ri->res_handle = qobj->hw_res_handle; ri->res_handle = qobj->hw_res_handle;
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return 0; return 0;
} }
...@@ -389,7 +389,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct drm_device *dev, ...@@ -389,7 +389,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct drm_device *dev,
out_unres: out_unres:
virtio_gpu_object_unreserve(qobj); virtio_gpu_object_unreserve(qobj);
out: out:
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return ret; return ret;
} }
...@@ -439,7 +439,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data, ...@@ -439,7 +439,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data,
out_unres: out_unres:
virtio_gpu_object_unreserve(qobj); virtio_gpu_object_unreserve(qobj);
out: out:
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return ret; return ret;
} }
...@@ -462,7 +462,7 @@ static int virtio_gpu_wait_ioctl(struct drm_device *dev, void *data, ...@@ -462,7 +462,7 @@ static int virtio_gpu_wait_ioctl(struct drm_device *dev, void *data,
nowait = true; nowait = true;
ret = virtio_gpu_object_wait(qobj, nowait); ret = virtio_gpu_object_wait(qobj, nowait);
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return ret; return ret;
} }
......
...@@ -155,7 +155,7 @@ struct drm_driver { ...@@ -155,7 +155,7 @@ struct drm_driver {
* reverse order of the initialization. Similarly to the load * reverse order of the initialization. Similarly to the load
* hook, this handler is deprecated and its usage should be * hook, this handler is deprecated and its usage should be
* dropped in favor of an open-coded teardown function at the * dropped in favor of an open-coded teardown function at the
* driver layer. See drm_dev_unregister() and drm_dev_unref() * driver layer. See drm_dev_unregister() and drm_dev_put()
* for the proper way to remove a &struct drm_device. * for the proper way to remove a &struct drm_device.
* *
* The unload() hook is called right after unregistering * The unload() hook is called right after unregistering
...@@ -611,7 +611,8 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, ...@@ -611,7 +611,8 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
int drm_dev_register(struct drm_device *dev, unsigned long flags); int drm_dev_register(struct drm_device *dev, unsigned long flags);
void drm_dev_unregister(struct drm_device *dev); void drm_dev_unregister(struct drm_device *dev);
void drm_dev_ref(struct drm_device *dev); void drm_dev_get(struct drm_device *dev);
void drm_dev_put(struct drm_device *dev);
void drm_dev_unref(struct drm_device *dev); void drm_dev_unref(struct drm_device *dev);
void drm_put_dev(struct drm_device *dev); void drm_put_dev(struct drm_device *dev);
void drm_dev_unplug(struct drm_device *dev); void drm_dev_unplug(struct drm_device *dev);
......
...@@ -28,16 +28,6 @@ void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state); ...@@ -28,16 +28,6 @@ void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state);
void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma, void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
bool state); bool state);
void drm_fb_cma_destroy(struct drm_framebuffer *fb);
int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
struct drm_file *file_priv, unsigned int *handle);
struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev,
struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd,
const struct drm_framebuffer_funcs *funcs);
struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd);
struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb, struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
unsigned int plane); unsigned int plane);
...@@ -45,9 +35,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, ...@@ -45,9 +35,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb,
struct drm_plane_state *state, struct drm_plane_state *state,
unsigned int plane); unsigned int plane);
int drm_fb_cma_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *state);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct seq_file; struct seq_file;
......
...@@ -50,6 +50,9 @@ expression object; ...@@ -50,6 +50,9 @@ expression object;
| |
- drm_property_unreference_blob(object) - drm_property_unreference_blob(object)
+ drm_property_blob_put(object) + drm_property_blob_put(object)
|
- drm_dev_unref(object)
+ drm_dev_put(object)
) )
@r depends on report@ @r depends on report@
...@@ -81,6 +84,8 @@ drm_gem_object_unreference_unlocked(object) ...@@ -81,6 +84,8 @@ drm_gem_object_unreference_unlocked(object)
drm_property_unreference_blob@p(object) drm_property_unreference_blob@p(object)
| |
drm_property_reference_blob@p(object) drm_property_reference_blob@p(object)
|
drm_dev_unref@p(object)
) )
@script:python depends on report@ @script:python depends on report@
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment