Merge drm/drm-next into drm-misc-next
Now that 4.19-rc1 is cut, backmerge it into -misc-next. Signed-off-by: Sean Paul <seanpaul@chromium.org>
This commit is contained in:
@@ -229,6 +229,8 @@ static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
|
||||
static int hdlcd_plane_atomic_check(struct drm_plane *plane,
|
||||
struct drm_plane_state *state)
|
||||
{
|
||||
int i;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
u32 src_h = state->src_h >> 16;
|
||||
|
||||
@@ -238,20 +240,17 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!state->fb || !state->crtc)
|
||||
return 0;
|
||||
|
||||
crtc_state = drm_atomic_get_existing_crtc_state(state->state,
|
||||
state->crtc);
|
||||
if (!crtc_state) {
|
||||
DRM_DEBUG_KMS("Invalid crtc state\n");
|
||||
return -EINVAL;
|
||||
for_each_new_crtc_in_state(state->state, crtc, crtc_state, i) {
|
||||
/* we cannot disable the plane while the CRTC is active */
|
||||
if (!state->fb && crtc_state->active)
|
||||
return -EINVAL;
|
||||
return drm_atomic_helper_check_plane_state(state, crtc_state,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
false, true);
|
||||
}
|
||||
|
||||
return drm_atomic_helper_check_plane_state(state, crtc_state,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
false, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hdlcd_plane_atomic_update(struct drm_plane *plane,
|
||||
@@ -280,16 +279,10 @@ static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = {
|
||||
.atomic_update = hdlcd_plane_atomic_update,
|
||||
};
|
||||
|
||||
static void hdlcd_plane_destroy(struct drm_plane *plane)
|
||||
{
|
||||
drm_plane_helper_disable(plane, NULL);
|
||||
drm_plane_cleanup(plane);
|
||||
}
|
||||
|
||||
static const struct drm_plane_funcs hdlcd_plane_funcs = {
|
||||
.update_plane = drm_atomic_helper_update_plane,
|
||||
.disable_plane = drm_atomic_helper_disable_plane,
|
||||
.destroy = hdlcd_plane_destroy,
|
||||
.destroy = drm_plane_cleanup,
|
||||
.reset = drm_atomic_helper_plane_reset,
|
||||
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
|
||||
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
|
||||
@@ -334,10 +327,8 @@ int hdlcd_setup_crtc(struct drm_device *drm)
|
||||
|
||||
ret = drm_crtc_init_with_planes(drm, &hdlcd->crtc, primary, NULL,
|
||||
&hdlcd_crtc_funcs, NULL);
|
||||
if (ret) {
|
||||
hdlcd_plane_destroy(primary);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
drm_crtc_helper_add(&hdlcd->crtc, &hdlcd_crtc_helper_funcs);
|
||||
return 0;
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <drm/drm_fb_cma_helper.h>
|
||||
#include <drm/drm_gem_cma_helper.h>
|
||||
#include <drm/drm_gem_framebuffer_helper.h>
|
||||
#include <drm/drm_modeset_helper.h>
|
||||
#include <drm/drm_of.h>
|
||||
|
||||
#include "hdlcd_drv.h"
|
||||
@@ -100,16 +101,9 @@ setup_fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void hdlcd_fb_output_poll_changed(struct drm_device *drm)
|
||||
{
|
||||
struct hdlcd_drm_private *hdlcd = drm->dev_private;
|
||||
|
||||
drm_fbdev_cma_hotplug_event(hdlcd->fbdev);
|
||||
}
|
||||
|
||||
static const struct drm_mode_config_funcs hdlcd_mode_config_funcs = {
|
||||
.fb_create = drm_gem_fb_create,
|
||||
.output_poll_changed = hdlcd_fb_output_poll_changed,
|
||||
.output_poll_changed = drm_fb_helper_output_poll_changed,
|
||||
.atomic_check = drm_atomic_helper_check,
|
||||
.atomic_commit = drm_atomic_helper_commit,
|
||||
};
|
||||
@@ -124,13 +118,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
|
||||
drm->mode_config.funcs = &hdlcd_mode_config_funcs;
|
||||
}
|
||||
|
||||
static void hdlcd_lastclose(struct drm_device *drm)
|
||||
{
|
||||
struct hdlcd_drm_private *hdlcd = drm->dev_private;
|
||||
|
||||
drm_fbdev_cma_restore_mode(hdlcd->fbdev);
|
||||
}
|
||||
|
||||
static irqreturn_t hdlcd_irq(int irq, void *arg)
|
||||
{
|
||||
struct drm_device *drm = arg;
|
||||
@@ -246,7 +233,7 @@ static struct drm_driver hdlcd_driver = {
|
||||
.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
|
||||
DRIVER_MODESET | DRIVER_PRIME |
|
||||
DRIVER_ATOMIC,
|
||||
.lastclose = hdlcd_lastclose,
|
||||
.lastclose = drm_fb_helper_lastclose,
|
||||
.irq_handler = hdlcd_irq,
|
||||
.irq_preinstall = hdlcd_irq_preinstall,
|
||||
.irq_postinstall = hdlcd_irq_postinstall,
|
||||
@@ -321,14 +308,9 @@ static int hdlcd_drm_bind(struct device *dev)
|
||||
drm_mode_config_reset(drm);
|
||||
drm_kms_helper_poll_init(drm);
|
||||
|
||||
hdlcd->fbdev = drm_fbdev_cma_init(drm, 32,
|
||||
drm->mode_config.num_connector);
|
||||
|
||||
if (IS_ERR(hdlcd->fbdev)) {
|
||||
ret = PTR_ERR(hdlcd->fbdev);
|
||||
hdlcd->fbdev = NULL;
|
||||
ret = drm_fb_cma_fbdev_init(drm, 32, 0);
|
||||
if (ret)
|
||||
goto err_fbdev;
|
||||
}
|
||||
|
||||
ret = drm_dev_register(drm, 0);
|
||||
if (ret)
|
||||
@@ -337,15 +319,13 @@ static int hdlcd_drm_bind(struct device *dev)
|
||||
return 0;
|
||||
|
||||
err_register:
|
||||
if (hdlcd->fbdev) {
|
||||
drm_fbdev_cma_fini(hdlcd->fbdev);
|
||||
hdlcd->fbdev = NULL;
|
||||
}
|
||||
drm_fb_cma_fbdev_fini(drm);
|
||||
err_fbdev:
|
||||
drm_kms_helper_poll_fini(drm);
|
||||
err_vblank:
|
||||
pm_runtime_disable(drm->dev);
|
||||
err_pm_active:
|
||||
drm_atomic_helper_shutdown(drm);
|
||||
component_unbind_all(dev, drm);
|
||||
err_unload:
|
||||
of_node_put(hdlcd->crtc.port);
|
||||
@@ -366,23 +346,23 @@ static void hdlcd_drm_unbind(struct device *dev)
|
||||
struct hdlcd_drm_private *hdlcd = drm->dev_private;
|
||||
|
||||
drm_dev_unregister(drm);
|
||||
if (hdlcd->fbdev) {
|
||||
drm_fbdev_cma_fini(hdlcd->fbdev);
|
||||
hdlcd->fbdev = NULL;
|
||||
}
|
||||
drm_fb_cma_fbdev_fini(drm);
|
||||
drm_kms_helper_poll_fini(drm);
|
||||
component_unbind_all(dev, drm);
|
||||
of_node_put(hdlcd->crtc.port);
|
||||
hdlcd->crtc.port = NULL;
|
||||
pm_runtime_get_sync(drm->dev);
|
||||
pm_runtime_get_sync(dev);
|
||||
drm_crtc_vblank_off(&hdlcd->crtc);
|
||||
drm_irq_uninstall(drm);
|
||||
pm_runtime_put_sync(drm->dev);
|
||||
pm_runtime_disable(drm->dev);
|
||||
of_reserved_mem_device_release(drm->dev);
|
||||
drm_atomic_helper_shutdown(drm);
|
||||
pm_runtime_put(dev);
|
||||
if (pm_runtime_enabled(dev))
|
||||
pm_runtime_disable(dev);
|
||||
of_reserved_mem_device_release(dev);
|
||||
drm_mode_config_cleanup(drm);
|
||||
drm_dev_put(drm);
|
||||
drm->dev_private = NULL;
|
||||
dev_set_drvdata(dev, NULL);
|
||||
drm_dev_put(drm);
|
||||
}
|
||||
|
||||
static const struct component_master_ops hdlcd_master_ops = {
|
||||
@@ -427,35 +407,15 @@ MODULE_DEVICE_TABLE(of, hdlcd_of_match);
|
||||
static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
|
||||
{
|
||||
struct drm_device *drm = dev_get_drvdata(dev);
|
||||
struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
|
||||
|
||||
if (!hdlcd)
|
||||
return 0;
|
||||
|
||||
drm_kms_helper_poll_disable(drm);
|
||||
drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 1);
|
||||
|
||||
hdlcd->state = drm_atomic_helper_suspend(drm);
|
||||
if (IS_ERR(hdlcd->state)) {
|
||||
drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
|
||||
drm_kms_helper_poll_enable(drm);
|
||||
return PTR_ERR(hdlcd->state);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return drm_mode_config_helper_suspend(drm);
|
||||
}
|
||||
|
||||
static int __maybe_unused hdlcd_pm_resume(struct device *dev)
|
||||
{
|
||||
struct drm_device *drm = dev_get_drvdata(dev);
|
||||
struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
|
||||
|
||||
if (!hdlcd)
|
||||
return 0;
|
||||
|
||||
drm_atomic_helper_resume(drm, hdlcd->state);
|
||||
drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
|
||||
drm_kms_helper_poll_enable(drm);
|
||||
drm_mode_config_helper_resume(drm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -9,10 +9,8 @@
|
||||
struct hdlcd_drm_private {
|
||||
void __iomem *mmio;
|
||||
struct clk *clk;
|
||||
struct drm_fbdev_cma *fbdev;
|
||||
struct drm_crtc crtc;
|
||||
struct drm_plane *plane;
|
||||
struct drm_atomic_state *state;
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
atomic_t buffer_underrun_count;
|
||||
atomic_t bus_error_count;
|
||||
|
@@ -616,6 +616,7 @@ static int malidp_bind(struct device *dev)
|
||||
struct malidp_hw_device *hwdev;
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct of_device_id const *dev_id;
|
||||
struct drm_encoder *encoder;
|
||||
/* number of lines for the R, G and B output */
|
||||
u8 output_width[MAX_OUTPUT_CHANNELS];
|
||||
int ret = 0, i;
|
||||
@@ -737,6 +738,15 @@ static int malidp_bind(struct device *dev)
|
||||
goto bind_fail;
|
||||
}
|
||||
|
||||
/* We expect to have a maximum of two encoders one for the actual
|
||||
* display and a virtual one for the writeback connector
|
||||
*/
|
||||
WARN_ON(drm->mode_config.num_encoder > 2);
|
||||
list_for_each_entry(encoder, &drm->mode_config.encoder_list, head) {
|
||||
encoder->possible_clones =
|
||||
(1 << drm->mode_config.num_encoder) - 1;
|
||||
}
|
||||
|
||||
ret = malidp_irq_init(pdev);
|
||||
if (ret < 0)
|
||||
goto irq_init_fail;
|
||||
|
@@ -73,7 +73,7 @@ static void malidp_mw_connector_reset(struct drm_connector *connector)
|
||||
static enum drm_connector_status
|
||||
malidp_mw_connector_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
return connector_status_disconnected;
|
||||
return connector_status_connected;
|
||||
}
|
||||
|
||||
static void malidp_mw_connector_destroy(struct drm_connector *connector)
|
||||
|
Reference in New Issue
Block a user