Merge tag 'drm-for-v4.13' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "This is the main pull request for the drm, I think I've got one later driver pull for mediatek SoC driver, I'm undecided on if it needs to go to you yet. Otherwise summary below: Core drm: - Atomic add driver private objects - Deprecate preclose hook in modern drivers - MST bandwidth tracking - Use kvmalloc in more places - Add mode_valid hook for crtc/encoder/bridge - Reduce sync_file construction time - Documentation updates - New DRM synchronisation object support New drivers: - pl111 - pl111 CLCD display controller Panel: - Innolux P079ZCA panel driver - Add NL12880B20-05, NL192108AC18-02D, P320HVN03 panels - panel-samsung-s6e3ha2: Add s6e3hf2 panel support i915: - SKL+ watermark fixes - G4x/G33 reset improvements - DP AUX backlight improvements - Buffer based GuC/host communication - New getparam for (sub)slice infomation - Cannonlake and Coffeelake initial patches - Execbuf optimisations radeon/amdgpu: - Lots of Vega10 bug fixes - Preliminary raven support - KIQ support for compute rings - MEC queue management rework - DCE6 Audio support - SR-IOV improvements - Better radeon/amdgpu selection support nouveau: - HDMI stereoscopic support - Display code rework for >= GM20x GPUs msm: - GEM rework for fine-grained locking - Per-process pagetable work - HDMI fixes for Snapdragon 820. vc4: - Remove 256MB CMA limit from vc4 - Add out-fence support - Add support for cygnus - Get/set tiling ioctls support - Add T-format tiling support for scanout zte: - add VGA support. etnaviv: - Thermal throttle support for newer GPUs - Restore userspace buffer cache performance - dma-buf sync fix stm: - add stm32f429 display support exynos: - Rework vblank handling - Fixup sw-trigger code sun4i: - V3s display engine support - HDMI support for older SoCs - Preliminary work on dual-pipeline SoCs. rcar-du: - VSP work imx-drm: - Remove counter load enable from PRE - Double read/write reduction flag support tegra: - Documentation for the host1x and drm driver. - Lots of staging ioctl fixes due to grate project work. omapdrm: - dma-buf fence support - TILER rotation fixes" * tag 'drm-for-v4.13' of git://people.freedesktop.org/~airlied/linux: (1270 commits) drm: Remove unused drm_file parameter to drm_syncobj_replace_fence() drm/amd/powerplay: fix bug fail to remove sysfs when rmmod amdgpu. amdgpu: Set cik/si_support to 1 by default if radeon isn't built drm/amdgpu/gfx9: fix driver reload with KIQ drm/amdgpu/gfx8: fix driver reload with KIQ drm/amdgpu: Don't call amd_powerplay_destroy() if we don't have powerplay drm/ttm: Fix use-after-free in ttm_bo_clean_mm drm/amd/amdgpu: move get memory type function from early init to sw init drm/amdgpu/cgs: always set reference clock in mode_info drm/amdgpu: fix vblank_time when displays are off drm/amd/powerplay: power value format change for Vega10 drm/amdgpu/gfx9: support the amdgpu.disable_cu option drm/amd/powerplay: change PPSMC_MSG_GetCurrPkgPwr for Vega10 drm/amdgpu: Make amdgpu_cs_parser_init static (v2) drm/amdgpu/cs: fix a typo in a comment drm/amdgpu: Fix the exported always on CU bitmap drm/amdgpu/gfx9: gfx_v9_0_enable_gfx_static_mg_power_gating() can be static drm/amdgpu/psp: upper_32_bits/lower_32_bits for address setup drm/amd/powerplay/cz: print message if smc message fails drm/amdgpu: fix typo in amdgpu_debugfs_test_ib_init ...
This commit is contained in:
@@ -4,6 +4,14 @@ config DRM_BRIDGE
|
||||
help
|
||||
Bridge registration and lookup framework.
|
||||
|
||||
config DRM_PANEL_BRIDGE
|
||||
def_bool y
|
||||
depends on DRM_BRIDGE
|
||||
depends on DRM_KMS_HELPER
|
||||
select DRM_PANEL
|
||||
help
|
||||
DRM bridge wrapper of DRM panels
|
||||
|
||||
menu "Display Interface Bridges"
|
||||
depends on DRM && DRM_BRIDGE
|
||||
|
||||
@@ -27,8 +35,7 @@ config DRM_DUMB_VGA_DAC
|
||||
config DRM_LVDS_ENCODER
|
||||
tristate "Transparent parallel to LVDS encoder support"
|
||||
depends on OF
|
||||
select DRM_KMS_HELPER
|
||||
select DRM_PANEL
|
||||
select DRM_PANEL_BRIDGE
|
||||
help
|
||||
Support for transparent parallel to LVDS encoders that don't require
|
||||
any configuration.
|
||||
|
@@ -1,5 +1,3 @@
|
||||
ccflags-y := -Iinclude/drm
|
||||
|
||||
obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
|
||||
obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
|
||||
obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
|
||||
|
@@ -1061,18 +1061,18 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool anx78xx_bridge_mode_fixup(struct drm_bridge *bridge,
|
||||
const struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
static enum drm_mode_status
|
||||
anx78xx_bridge_mode_valid(struct drm_bridge *bridge,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
|
||||
return false;
|
||||
return MODE_NO_INTERLACE;
|
||||
|
||||
/* Max 1200p at 5.4 Ghz, one lane */
|
||||
if (mode->clock > 154000)
|
||||
return false;
|
||||
return MODE_CLOCK_HIGH;
|
||||
|
||||
return true;
|
||||
return MODE_OK;
|
||||
}
|
||||
|
||||
static void anx78xx_bridge_disable(struct drm_bridge *bridge)
|
||||
@@ -1129,7 +1129,7 @@ static void anx78xx_bridge_enable(struct drm_bridge *bridge)
|
||||
|
||||
static const struct drm_bridge_funcs anx78xx_bridge_funcs = {
|
||||
.attach = anx78xx_bridge_attach,
|
||||
.mode_fixup = anx78xx_bridge_mode_fixup,
|
||||
.mode_valid = anx78xx_bridge_mode_valid,
|
||||
.disable = anx78xx_bridge_disable,
|
||||
.mode_set = anx78xx_bridge_mode_set,
|
||||
.enable = anx78xx_bridge_enable,
|
||||
|
@@ -8,144 +8,18 @@
|
||||
*/
|
||||
|
||||
#include <drm/drmP.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_connector.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_encoder.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_panel.h>
|
||||
|
||||
#include <linux/of_graph.h>
|
||||
|
||||
struct lvds_encoder {
|
||||
struct device *dev;
|
||||
|
||||
struct drm_bridge bridge;
|
||||
struct drm_connector connector;
|
||||
struct drm_panel *panel;
|
||||
};
|
||||
|
||||
static inline struct lvds_encoder *
|
||||
drm_bridge_to_lvds_encoder(struct drm_bridge *bridge)
|
||||
{
|
||||
return container_of(bridge, struct lvds_encoder, bridge);
|
||||
}
|
||||
|
||||
static inline struct lvds_encoder *
|
||||
drm_connector_to_lvds_encoder(struct drm_connector *connector)
|
||||
{
|
||||
return container_of(connector, struct lvds_encoder, connector);
|
||||
}
|
||||
|
||||
static int lvds_connector_get_modes(struct drm_connector *connector)
|
||||
{
|
||||
struct lvds_encoder *lvds = drm_connector_to_lvds_encoder(connector);
|
||||
|
||||
return drm_panel_get_modes(lvds->panel);
|
||||
}
|
||||
|
||||
static const struct drm_connector_helper_funcs lvds_connector_helper_funcs = {
|
||||
.get_modes = lvds_connector_get_modes,
|
||||
};
|
||||
|
||||
static const struct drm_connector_funcs lvds_connector_funcs = {
|
||||
.dpms = drm_atomic_helper_connector_dpms,
|
||||
.reset = drm_atomic_helper_connector_reset,
|
||||
.fill_modes = drm_helper_probe_single_connector_modes,
|
||||
.destroy = drm_connector_cleanup,
|
||||
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
|
||||
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
|
||||
};
|
||||
|
||||
static int lvds_encoder_attach(struct drm_bridge *bridge)
|
||||
{
|
||||
struct lvds_encoder *lvds = drm_bridge_to_lvds_encoder(bridge);
|
||||
struct drm_connector *connector = &lvds->connector;
|
||||
int ret;
|
||||
|
||||
if (!bridge->encoder) {
|
||||
DRM_ERROR("Missing encoder\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
drm_connector_helper_add(connector, &lvds_connector_helper_funcs);
|
||||
|
||||
ret = drm_connector_init(bridge->dev, connector, &lvds_connector_funcs,
|
||||
DRM_MODE_CONNECTOR_LVDS);
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to initialize connector\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
drm_mode_connector_attach_encoder(&lvds->connector, bridge->encoder);
|
||||
|
||||
ret = drm_panel_attach(lvds->panel, &lvds->connector);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void lvds_encoder_detach(struct drm_bridge *bridge)
|
||||
{
|
||||
struct lvds_encoder *lvds = drm_bridge_to_lvds_encoder(bridge);
|
||||
|
||||
drm_panel_detach(lvds->panel);
|
||||
}
|
||||
|
||||
static void lvds_encoder_pre_enable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct lvds_encoder *lvds = drm_bridge_to_lvds_encoder(bridge);
|
||||
|
||||
drm_panel_prepare(lvds->panel);
|
||||
}
|
||||
|
||||
static void lvds_encoder_enable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct lvds_encoder *lvds = drm_bridge_to_lvds_encoder(bridge);
|
||||
|
||||
drm_panel_enable(lvds->panel);
|
||||
}
|
||||
|
||||
static void lvds_encoder_disable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct lvds_encoder *lvds = drm_bridge_to_lvds_encoder(bridge);
|
||||
|
||||
drm_panel_disable(lvds->panel);
|
||||
}
|
||||
|
||||
static void lvds_encoder_post_disable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct lvds_encoder *lvds = drm_bridge_to_lvds_encoder(bridge);
|
||||
|
||||
drm_panel_unprepare(lvds->panel);
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs lvds_encoder_bridge_funcs = {
|
||||
.attach = lvds_encoder_attach,
|
||||
.detach = lvds_encoder_detach,
|
||||
.pre_enable = lvds_encoder_pre_enable,
|
||||
.enable = lvds_encoder_enable,
|
||||
.disable = lvds_encoder_disable,
|
||||
.post_disable = lvds_encoder_post_disable,
|
||||
};
|
||||
|
||||
static int lvds_encoder_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct lvds_encoder *lvds;
|
||||
struct device_node *port;
|
||||
struct device_node *endpoint;
|
||||
struct device_node *panel;
|
||||
|
||||
lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL);
|
||||
if (!lvds)
|
||||
return -ENOMEM;
|
||||
|
||||
lvds->dev = &pdev->dev;
|
||||
platform_set_drvdata(pdev, lvds);
|
||||
|
||||
lvds->bridge.funcs = &lvds_encoder_bridge_funcs;
|
||||
lvds->bridge.of_node = pdev->dev.of_node;
|
||||
struct device_node *panel_node;
|
||||
struct drm_panel *panel;
|
||||
struct drm_bridge *bridge;
|
||||
|
||||
/* Locate the panel DT node. */
|
||||
port = of_graph_get_port_by_id(pdev->dev.of_node, 1);
|
||||
@@ -161,29 +35,34 @@ static int lvds_encoder_probe(struct platform_device *pdev)
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
panel = of_graph_get_remote_port_parent(endpoint);
|
||||
panel_node = of_graph_get_remote_port_parent(endpoint);
|
||||
of_node_put(endpoint);
|
||||
if (!panel) {
|
||||
if (!panel_node) {
|
||||
dev_dbg(&pdev->dev, "no remote endpoint for port 1\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
lvds->panel = of_drm_find_panel(panel);
|
||||
of_node_put(panel);
|
||||
if (!lvds->panel) {
|
||||
panel = of_drm_find_panel(panel_node);
|
||||
of_node_put(panel_node);
|
||||
if (!panel) {
|
||||
dev_dbg(&pdev->dev, "panel not found, deferring probe\n");
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
||||
/* Register the bridge. */
|
||||
return drm_bridge_add(&lvds->bridge);
|
||||
bridge = drm_panel_bridge_add(panel, DRM_MODE_CONNECTOR_LVDS);
|
||||
if (IS_ERR(bridge))
|
||||
return PTR_ERR(bridge);
|
||||
|
||||
platform_set_drvdata(pdev, bridge);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lvds_encoder_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct lvds_encoder *encoder = platform_get_drvdata(pdev);
|
||||
struct drm_bridge *bridge = platform_get_drvdata(pdev);
|
||||
|
||||
drm_bridge_remove(&encoder->bridge);
|
||||
drm_bridge_remove(bridge);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -20,15 +20,13 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_panel.h>
|
||||
|
||||
#include "drm_crtc.h"
|
||||
#include "drm_crtc_helper.h"
|
||||
#include "drm_atomic_helper.h"
|
||||
#include "drm_edid.h"
|
||||
#include "drmP.h"
|
||||
#include <drm/drmP.h>
|
||||
|
||||
#define PTN3460_EDID_ADDR 0x0
|
||||
#define PTN3460_EDID_EMULATION_ADDR 0x84
|
||||
|
200
drivers/gpu/drm/bridge/panel.c
Normal file
200
drivers/gpu/drm/bridge/panel.c
Normal file
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
||||
* Copyright (C) 2017 Broadcom
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <drm/drmP.h>
|
||||
#include <drm/drm_panel.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_connector.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_encoder.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_panel.h>
|
||||
|
||||
struct panel_bridge {
|
||||
struct drm_bridge bridge;
|
||||
struct drm_connector connector;
|
||||
struct drm_panel *panel;
|
||||
u32 connector_type;
|
||||
};
|
||||
|
||||
static inline struct panel_bridge *
|
||||
drm_bridge_to_panel_bridge(struct drm_bridge *bridge)
|
||||
{
|
||||
return container_of(bridge, struct panel_bridge, bridge);
|
||||
}
|
||||
|
||||
static inline struct panel_bridge *
|
||||
drm_connector_to_panel_bridge(struct drm_connector *connector)
|
||||
{
|
||||
return container_of(connector, struct panel_bridge, connector);
|
||||
}
|
||||
|
||||
static int panel_bridge_connector_get_modes(struct drm_connector *connector)
|
||||
{
|
||||
struct panel_bridge *panel_bridge =
|
||||
drm_connector_to_panel_bridge(connector);
|
||||
|
||||
return drm_panel_get_modes(panel_bridge->panel);
|
||||
}
|
||||
|
||||
static const struct drm_connector_helper_funcs
|
||||
panel_bridge_connector_helper_funcs = {
|
||||
.get_modes = panel_bridge_connector_get_modes,
|
||||
};
|
||||
|
||||
static const struct drm_connector_funcs panel_bridge_connector_funcs = {
|
||||
.dpms = drm_atomic_helper_connector_dpms,
|
||||
.reset = drm_atomic_helper_connector_reset,
|
||||
.fill_modes = drm_helper_probe_single_connector_modes,
|
||||
.destroy = drm_connector_cleanup,
|
||||
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
|
||||
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
|
||||
};
|
||||
|
||||
static int panel_bridge_attach(struct drm_bridge *bridge)
|
||||
{
|
||||
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
|
||||
struct drm_connector *connector = &panel_bridge->connector;
|
||||
int ret;
|
||||
|
||||
if (!bridge->encoder) {
|
||||
DRM_ERROR("Missing encoder\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
drm_connector_helper_add(connector,
|
||||
&panel_bridge_connector_helper_funcs);
|
||||
|
||||
ret = drm_connector_init(bridge->dev, connector,
|
||||
&panel_bridge_connector_funcs,
|
||||
panel_bridge->connector_type);
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to initialize connector\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
drm_mode_connector_attach_encoder(&panel_bridge->connector,
|
||||
bridge->encoder);
|
||||
|
||||
ret = drm_panel_attach(panel_bridge->panel, &panel_bridge->connector);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void panel_bridge_detach(struct drm_bridge *bridge)
|
||||
{
|
||||
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
|
||||
|
||||
drm_panel_detach(panel_bridge->panel);
|
||||
}
|
||||
|
||||
static void panel_bridge_pre_enable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
|
||||
|
||||
drm_panel_prepare(panel_bridge->panel);
|
||||
}
|
||||
|
||||
static void panel_bridge_enable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
|
||||
|
||||
drm_panel_enable(panel_bridge->panel);
|
||||
}
|
||||
|
||||
static void panel_bridge_disable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
|
||||
|
||||
drm_panel_disable(panel_bridge->panel);
|
||||
}
|
||||
|
||||
static void panel_bridge_post_disable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
|
||||
|
||||
drm_panel_unprepare(panel_bridge->panel);
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
|
||||
.attach = panel_bridge_attach,
|
||||
.detach = panel_bridge_detach,
|
||||
.pre_enable = panel_bridge_pre_enable,
|
||||
.enable = panel_bridge_enable,
|
||||
.disable = panel_bridge_disable,
|
||||
.post_disable = panel_bridge_post_disable,
|
||||
};
|
||||
|
||||
/**
|
||||
* drm_panel_bridge_add - Creates a drm_bridge and drm_connector that
|
||||
* just calls the appropriate functions from drm_panel.
|
||||
*
|
||||
* @panel: The drm_panel being wrapped. Must be non-NULL.
|
||||
* @connector_type: The DRM_MODE_CONNECTOR_* for the connector to be
|
||||
* created.
|
||||
*
|
||||
* For drivers converting from directly using drm_panel: The expected
|
||||
* usage pattern is that during either encoder module probe or DSI
|
||||
* host attach, a drm_panel will be looked up through
|
||||
* drm_of_find_panel_or_bridge(). drm_panel_bridge_add() is used to
|
||||
* wrap that panel in the new bridge, and the result can then be
|
||||
* passed to drm_bridge_attach(). The drm_panel_prepare() and related
|
||||
* functions can be dropped from the encoder driver (they're now
|
||||
* called by the KMS helpers before calling into the encoder), along
|
||||
* with connector creation. When done with the bridge,
|
||||
* drm_bridge_detach() should be called as normal, then
|
||||
* drm_panel_bridge_remove() to free it.
|
||||
*/
|
||||
struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel,
|
||||
u32 connector_type)
|
||||
{
|
||||
struct panel_bridge *panel_bridge;
|
||||
int ret;
|
||||
|
||||
if (!panel)
|
||||
return ERR_PTR(EINVAL);
|
||||
|
||||
panel_bridge = devm_kzalloc(panel->dev, sizeof(*panel_bridge),
|
||||
GFP_KERNEL);
|
||||
if (!panel_bridge)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
panel_bridge->connector_type = connector_type;
|
||||
panel_bridge->panel = panel;
|
||||
|
||||
panel_bridge->bridge.funcs = &panel_bridge_bridge_funcs;
|
||||
#ifdef CONFIG_OF
|
||||
panel_bridge->bridge.of_node = panel->dev->of_node;
|
||||
#endif
|
||||
|
||||
ret = drm_bridge_add(&panel_bridge->bridge);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
return &panel_bridge->bridge;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_panel_bridge_add);
|
||||
|
||||
/**
|
||||
* drm_panel_bridge_remove - Unregisters and frees a drm_bridge
|
||||
* created by drm_panel_bridge_add().
|
||||
*
|
||||
* @bridge: The drm_bridge being freed.
|
||||
*/
|
||||
void drm_panel_bridge_remove(struct drm_bridge *bridge)
|
||||
{
|
||||
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
|
||||
|
||||
drm_bridge_remove(bridge);
|
||||
devm_kfree(panel_bridge->panel->dev, bridge);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_panel_bridge_remove);
|
@@ -24,14 +24,12 @@
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_panel.h>
|
||||
|
||||
#include "drmP.h"
|
||||
#include "drm_crtc.h"
|
||||
#include "drm_crtc_helper.h"
|
||||
#include "drm_atomic_helper.h"
|
||||
#include <drm/drmP.h>
|
||||
|
||||
/* Brightness scale on the Parade chip */
|
||||
#define PS8622_MAX_BRIGHTNESS 0xff
|
||||
|
@@ -160,7 +160,7 @@ static int sii902x_get_modes(struct drm_connector *connector)
|
||||
time_before(jiffies, timeout));
|
||||
|
||||
if (!(status & SII902X_SYS_CTRL_DDC_BUS_GRTD)) {
|
||||
dev_err(&sii902x->i2c->dev, "failed to acquire the i2c bus");
|
||||
dev_err(&sii902x->i2c->dev, "failed to acquire the i2c bus\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ static int sii902x_get_modes(struct drm_connector *connector)
|
||||
|
||||
if (status & (SII902X_SYS_CTRL_DDC_BUS_REQ |
|
||||
SII902X_SYS_CTRL_DDC_BUS_GRTD)) {
|
||||
dev_err(&sii902x->i2c->dev, "failed to release the i2c bus");
|
||||
dev_err(&sii902x->i2c->dev, "failed to release the i2c bus\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ static int sii902x_bridge_attach(struct drm_bridge *bridge)
|
||||
|
||||
if (!drm_core_check_feature(drm, DRIVER_ATOMIC)) {
|
||||
dev_err(&sii902x->i2c->dev,
|
||||
"sii902x driver is only compatible with DRM devices supporting atomic updates");
|
||||
"sii902x driver is only compatible with DRM devices supporting atomic updates\n");
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
|
||||
|
@@ -173,6 +173,8 @@ struct dw_hdmi {
|
||||
|
||||
unsigned int reg_shift;
|
||||
struct regmap *regm;
|
||||
void (*enable_audio)(struct dw_hdmi *hdmi);
|
||||
void (*disable_audio)(struct dw_hdmi *hdmi);
|
||||
};
|
||||
|
||||
#define HDMI_IH_PHY_STAT0_RX_SENSE \
|
||||
@@ -542,13 +544,41 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_rate);
|
||||
|
||||
static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable)
|
||||
{
|
||||
hdmi_modb(hdmi, enable ? 0 : HDMI_MC_CLKDIS_AUDCLK_DISABLE,
|
||||
HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS);
|
||||
}
|
||||
|
||||
static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi)
|
||||
{
|
||||
hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n);
|
||||
}
|
||||
|
||||
static void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi)
|
||||
{
|
||||
hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0);
|
||||
}
|
||||
|
||||
static void dw_hdmi_i2s_audio_enable(struct dw_hdmi *hdmi)
|
||||
{
|
||||
hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n);
|
||||
hdmi_enable_audio_clk(hdmi, true);
|
||||
}
|
||||
|
||||
static void dw_hdmi_i2s_audio_disable(struct dw_hdmi *hdmi)
|
||||
{
|
||||
hdmi_enable_audio_clk(hdmi, false);
|
||||
}
|
||||
|
||||
void dw_hdmi_audio_enable(struct dw_hdmi *hdmi)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&hdmi->audio_lock, flags);
|
||||
hdmi->audio_enable = true;
|
||||
hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n);
|
||||
if (hdmi->enable_audio)
|
||||
hdmi->enable_audio(hdmi);
|
||||
spin_unlock_irqrestore(&hdmi->audio_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dw_hdmi_audio_enable);
|
||||
@@ -559,7 +589,8 @@ void dw_hdmi_audio_disable(struct dw_hdmi *hdmi)
|
||||
|
||||
spin_lock_irqsave(&hdmi->audio_lock, flags);
|
||||
hdmi->audio_enable = false;
|
||||
hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0);
|
||||
if (hdmi->disable_audio)
|
||||
hdmi->disable_audio(hdmi);
|
||||
spin_unlock_irqrestore(&hdmi->audio_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dw_hdmi_audio_disable);
|
||||
@@ -1573,11 +1604,6 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi)
|
||||
HDMI_MC_FLOWCTRL);
|
||||
}
|
||||
|
||||
static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi)
|
||||
{
|
||||
hdmi_modb(hdmi, 0, HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS);
|
||||
}
|
||||
|
||||
/* Workaround to clear the overflow condition */
|
||||
static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi)
|
||||
{
|
||||
@@ -1691,7 +1717,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
|
||||
|
||||
/* HDMI Initialization Step E - Configure audio */
|
||||
hdmi_clk_regenerator_update_pixel_clock(hdmi);
|
||||
hdmi_enable_audio_clk(hdmi);
|
||||
hdmi_enable_audio_clk(hdmi, true);
|
||||
}
|
||||
|
||||
/* not for DVI mode */
|
||||
@@ -1881,24 +1907,6 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static enum drm_mode_status
|
||||
dw_hdmi_connector_mode_valid(struct drm_connector *connector,
|
||||
struct drm_display_mode *mode)
|
||||
{
|
||||
struct dw_hdmi *hdmi = container_of(connector,
|
||||
struct dw_hdmi, connector);
|
||||
enum drm_mode_status mode_status = MODE_OK;
|
||||
|
||||
/* We don't support double-clocked modes */
|
||||
if (mode->flags & DRM_MODE_FLAG_DBLCLK)
|
||||
return MODE_BAD;
|
||||
|
||||
if (hdmi->plat_data->mode_valid)
|
||||
mode_status = hdmi->plat_data->mode_valid(connector, mode);
|
||||
|
||||
return mode_status;
|
||||
}
|
||||
|
||||
static void dw_hdmi_connector_force(struct drm_connector *connector)
|
||||
{
|
||||
struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
|
||||
@@ -1924,7 +1932,6 @@ static const struct drm_connector_funcs dw_hdmi_connector_funcs = {
|
||||
|
||||
static const struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
|
||||
.get_modes = dw_hdmi_connector_get_modes,
|
||||
.mode_valid = dw_hdmi_connector_mode_valid,
|
||||
.best_encoder = drm_atomic_helper_best_encoder,
|
||||
};
|
||||
|
||||
@@ -1947,18 +1954,22 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool dw_hdmi_bridge_mode_fixup(struct drm_bridge *bridge,
|
||||
const struct drm_display_mode *orig_mode,
|
||||
struct drm_display_mode *mode)
|
||||
static enum drm_mode_status
|
||||
dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct dw_hdmi *hdmi = bridge->driver_private;
|
||||
struct drm_connector *connector = &hdmi->connector;
|
||||
enum drm_mode_status status;
|
||||
enum drm_mode_status mode_status = MODE_OK;
|
||||
|
||||
status = dw_hdmi_connector_mode_valid(connector, mode);
|
||||
if (status != MODE_OK)
|
||||
return false;
|
||||
return true;
|
||||
/* We don't support double-clocked modes */
|
||||
if (mode->flags & DRM_MODE_FLAG_DBLCLK)
|
||||
return MODE_BAD;
|
||||
|
||||
if (hdmi->plat_data->mode_valid)
|
||||
mode_status = hdmi->plat_data->mode_valid(connector, mode);
|
||||
|
||||
return mode_status;
|
||||
}
|
||||
|
||||
static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
|
||||
@@ -2002,7 +2013,7 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
|
||||
.enable = dw_hdmi_bridge_enable,
|
||||
.disable = dw_hdmi_bridge_disable,
|
||||
.mode_set = dw_hdmi_bridge_mode_set,
|
||||
.mode_fixup = dw_hdmi_bridge_mode_fixup,
|
||||
.mode_valid = dw_hdmi_bridge_mode_valid,
|
||||
};
|
||||
|
||||
static irqreturn_t dw_hdmi_i2c_irq(struct dw_hdmi *hdmi)
|
||||
@@ -2403,6 +2414,8 @@ __dw_hdmi_probe(struct platform_device *pdev,
|
||||
audio.irq = irq;
|
||||
audio.hdmi = hdmi;
|
||||
audio.eld = hdmi->connector.eld;
|
||||
hdmi->enable_audio = dw_hdmi_ahb_audio_enable;
|
||||
hdmi->disable_audio = dw_hdmi_ahb_audio_disable;
|
||||
|
||||
pdevinfo.name = "dw-hdmi-ahb-audio";
|
||||
pdevinfo.data = &audio;
|
||||
@@ -2415,6 +2428,8 @@ __dw_hdmi_probe(struct platform_device *pdev,
|
||||
audio.hdmi = hdmi;
|
||||
audio.write = hdmi_writeb;
|
||||
audio.read = hdmi_readb;
|
||||
hdmi->enable_audio = dw_hdmi_i2s_audio_enable;
|
||||
hdmi->disable_audio = dw_hdmi_i2s_audio_disable;
|
||||
|
||||
pdevinfo.name = "dw-hdmi-i2s-audio";
|
||||
pdevinfo.data = &audio;
|
||||
|
Reference in New Issue
Block a user