linux_dsm_epyc7002/drivers/gpu/drm/msm/edp/edp_bridge.c
Dave Airlie f164a94c2c drm-misc-next for 5.1:
UAPI Changes:
  - New fourcc identifier for ARM Framebuffer Compression v1.3
 
 Cross-subsystem Changes:
 
 Core Changes:
  - Reorganisation of drm_device and drm_framebuffer headers
  - Cleanup of the drmP inclusion
  - Fix leaks in the fb-helpers
  - Allow for depth different from bpp in fb-helper fbdev emulation
  - Remove drm_mode_object from drm_display_mode
 
 Driver Changes:
  - Add reflection properties to rockchip
  - a bunch of fixes for virtio
  - a bunch of fixes for dp_mst and drivers using it, and introduction of a
    new refcounting scheme
  - Convertion of bochs to atomic and generic fbdev emulation
  - Allow meson to remove the firmware framebuffers
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXD+OHgAKCRDj7w1vZxhR
 xe3IAP4s59sFVMZseVJpwSe41OJ1ipD/cyIbtXU94X6nFd6zCAD+Jm4q+XIIS+uv
 7ElmJ2BD7rwicqSViWNG8tteHYfjrAU=
 =XPsb
 -----END PGP SIGNATURE-----

Merge tag 'drm-misc-next-2019-01-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for 5.1:

UAPI Changes:
 - New fourcc identifier for ARM Framebuffer Compression v1.3

Cross-subsystem Changes:

Core Changes:
 - Reorganisation of drm_device and drm_framebuffer headers
 - Cleanup of the drmP inclusion
 - Fix leaks in the fb-helpers
 - Allow for depth different from bpp in fb-helper fbdev emulation
 - Remove drm_mode_object from drm_display_mode

Driver Changes:
 - Add reflection properties to rockchip
 - a bunch of fixes for virtio
 - a bunch of fixes for dp_mst and drivers using it, and introduction of a
   new refcounting scheme
 - Convertion of bochs to atomic and generic fbdev emulation
 - Allow meson to remove the firmware framebuffers

[airlied: patch rcar-du to add drm_modes.h]
Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190116200428.u2n4jbk4mzza7n6e@flea
2019-01-18 09:31:28 +10:00

114 lines
2.7 KiB
C

/*
* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edp.h"
struct edp_bridge {
struct drm_bridge base;
struct msm_edp *edp;
};
#define to_edp_bridge(x) container_of(x, struct edp_bridge, base)
void edp_bridge_destroy(struct drm_bridge *bridge)
{
}
static void edp_bridge_pre_enable(struct drm_bridge *bridge)
{
struct edp_bridge *edp_bridge = to_edp_bridge(bridge);
struct msm_edp *edp = edp_bridge->edp;
DBG("");
msm_edp_ctrl_power(edp->ctrl, true);
}
static void edp_bridge_enable(struct drm_bridge *bridge)
{
DBG("");
}
static void edp_bridge_disable(struct drm_bridge *bridge)
{
DBG("");
}
static void edp_bridge_post_disable(struct drm_bridge *bridge)
{
struct edp_bridge *edp_bridge = to_edp_bridge(bridge);
struct msm_edp *edp = edp_bridge->edp;
DBG("");
msm_edp_ctrl_power(edp->ctrl, false);
}
static void edp_bridge_mode_set(struct drm_bridge *bridge,
const struct drm_display_mode *mode,
const struct drm_display_mode *adjusted_mode)
{
struct drm_device *dev = bridge->dev;
struct drm_connector *connector;
struct edp_bridge *edp_bridge = to_edp_bridge(bridge);
struct msm_edp *edp = edp_bridge->edp;
DBG("set mode: " DRM_MODE_FMT, DRM_MODE_ARG(mode));
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
if ((connector->encoder != NULL) &&
(connector->encoder->bridge == bridge)) {
msm_edp_ctrl_timing_cfg(edp->ctrl,
adjusted_mode, &connector->display_info);
break;
}
}
}
static const struct drm_bridge_funcs edp_bridge_funcs = {
.pre_enable = edp_bridge_pre_enable,
.enable = edp_bridge_enable,
.disable = edp_bridge_disable,
.post_disable = edp_bridge_post_disable,
.mode_set = edp_bridge_mode_set,
};
/* initialize bridge */
struct drm_bridge *msm_edp_bridge_init(struct msm_edp *edp)
{
struct drm_bridge *bridge = NULL;
struct edp_bridge *edp_bridge;
int ret;
edp_bridge = devm_kzalloc(edp->dev->dev,
sizeof(*edp_bridge), GFP_KERNEL);
if (!edp_bridge) {
ret = -ENOMEM;
goto fail;
}
edp_bridge->edp = edp;
bridge = &edp_bridge->base;
bridge->funcs = &edp_bridge_funcs;
ret = drm_bridge_attach(edp->encoder, bridge, NULL);
if (ret)
goto fail;
return bridge;
fail:
if (bridge)
edp_bridge_destroy(bridge);
return ERR_PTR(ret);
}