Commit 7b83741b authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm/panel/for-3.20-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/panel: Changes for v3.20-rc1

This contains the long-awaited drm_bridge series that makes Chromebooks
work for people. I had thought this would've been perfect by now, but
then I go and build test it and the first thing it does is yell about a
recursive dependency. I fixed that up because I was feeling bad for not
getting around to look at this earlier.

Biseds that there is new support for two more panels, a couple of fixup
patches to the Sharp LQ101R1SX01 dual-channel DSI panel driver and a
potential NULL pointer dereference fix.

* tag 'drm/panel/for-3.20-rc1' of git://anongit.freedesktop.org/tegra/linux: (23 commits)
  drm/bridge: dw-hdmi: Adapt to bridge API change
  drm/sti: fixup for bridge interface
  drm/bridge: dw-hdmi: Fix return error path
  drm: Check the right variable when setting formats
  Documentation: bridge: Add documentation for ps8622 DT properties
  Documentation: devicetree: Add vendor prefix for parade
  Documentation: drm: bridge: move to video/bridge
  drm/bridge: ptn3460: use gpiod interface
  drm/bridge: ptn3460: probe connector at the end of bridge attach
  drm/bridge: ptn3460: support drm_panel
  drm/exynos: dp: support drm_bridge
  drm/bridge: ptn3460: Convert to I2C driver model
  drm/bridge: make bridge registration independent of drm flow
  drm/bridge: do not pass drm_bridge_funcs to drm_bridge_init
  drm/bridge: ptn3460: Few trivial cleanups
  drm/panel: simple: Add AVIC TM070DDH03 panel support
  of: Add vendor prefix for Shanghai AVIC Optoelectronics Co., Ltd.
  drm/panel: sharp: lq101r1sx01: Remove unneeded include
  drm/panel: sharp: lq101r1sx01: Respect power timings
  drm/panel: sharp: lq101r1sx01: Add delay after display on
  ...
parents 21773f16 b5217bf4
Shanghai AVIC Optoelectronics 7" 1024x600 color TFT-LCD panel
Required properties:
- compatible: should be "avic,tm070ddh03"
This binding is compatible with the simple-panel binding, which is specified
in simple-panel.txt in this directory.
GiantPlus GPG48273QS5 4.3" (480x272) WQVGA TFT LCD panel
Required properties:
- compatible: should be "giantplus,gpg48273qs5"
This binding is compatible with the simple-panel binding, which is specified
in simple-panel.txt in this directory.
...@@ -23,6 +23,7 @@ armadeus ARMadeus Systems SARL ...@@ -23,6 +23,7 @@ armadeus ARMadeus Systems SARL
atmel Atmel Corporation atmel Atmel Corporation
auo AU Optronics Corporation auo AU Optronics Corporation
avago Avago Technologies avago Avago Technologies
avic Shanghai AVIC Optoelectronics Co., Ltd.
bosch Bosch Sensortec GmbH bosch Bosch Sensortec GmbH
brcm Broadcom Corporation brcm Broadcom Corporation
buffalo Buffalo, Inc. buffalo Buffalo, Inc.
...@@ -62,6 +63,7 @@ fsl Freescale Semiconductor ...@@ -62,6 +63,7 @@ fsl Freescale Semiconductor
GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc. GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc.
gef GE Fanuc Intelligent Platforms Embedded Systems, Inc. gef GE Fanuc Intelligent Platforms Embedded Systems, Inc.
geniatech Geniatech, Inc. geniatech Geniatech, Inc.
giantplus Giantplus Technology Co., Ltd.
globalscale Globalscale Technologies, Inc. globalscale Globalscale Technologies, Inc.
gmt Global Mixed-mode Technology, Inc. gmt Global Mixed-mode Technology, Inc.
google Google, Inc. google Google, Inc.
...@@ -119,6 +121,7 @@ nxp NXP Semiconductors ...@@ -119,6 +121,7 @@ nxp NXP Semiconductors
onnn ON Semiconductor Corp. onnn ON Semiconductor Corp.
opencores OpenCores.org opencores OpenCores.org
panasonic Panasonic Corporation panasonic Panasonic Corporation
parade Parade Technologies Inc.
pericom Pericom Technology Inc. pericom Pericom Technology Inc.
phytec PHYTEC Messtechnik GmbH phytec PHYTEC Messtechnik GmbH
picochip Picochip Ltd picochip Picochip Ltd
......
ps8622-bridge bindings
Required properties:
- compatible: "parade,ps8622" or "parade,ps8625"
- reg: first i2c address of the bridge
- sleep-gpios: OF device-tree gpio specification for PD_ pin.
- reset-gpios: OF device-tree gpio specification for RST_ pin.
Optional properties:
- lane-count: number of DP lanes to use
- use-external-pwm: backlight will be controlled by an external PWM
- video interfaces: Device node can contain video interface port
nodes for panel according to [1].
[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
Example:
lvds-bridge@48 {
compatible = "parade,ps8622";
reg = <0x48>;
sleep-gpios = <&gpc3 6 1 0 0>;
reset-gpios = <&gpc3 1 1 0 0>;
lane-count = <1>;
ports {
port@0 {
bridge_out: endpoint {
remote-endpoint = <&panel_in>;
};
};
};
};
...@@ -3,8 +3,8 @@ ptn3460 bridge bindings ...@@ -3,8 +3,8 @@ ptn3460 bridge bindings
Required properties: Required properties:
- compatible: "nxp,ptn3460" - compatible: "nxp,ptn3460"
- reg: i2c address of the bridge - reg: i2c address of the bridge
- powerdown-gpio: OF device-tree gpio specification - powerdown-gpio: OF device-tree gpio specification for PD_N pin.
- reset-gpio: OF device-tree gpio specification - reset-gpio: OF device-tree gpio specification for RST_N pin.
- edid-emulation: The EDID emulation entry to use - edid-emulation: The EDID emulation entry to use
+-------+------------+------------------+ +-------+------------+------------------+
| Value | Resolution | Description | | Value | Resolution | Description |
...@@ -17,6 +17,11 @@ Required properties: ...@@ -17,6 +17,11 @@ Required properties:
| 6 | 1600x900 | ChiMei M215HGE | | 6 | 1600x900 | ChiMei M215HGE |
+-------+------------+------------------+ +-------+------------+------------------+
- video interfaces: Device node can contain video interface port
nodes for panel according to [1].
[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
Example: Example:
lvds-bridge@20 { lvds-bridge@20 {
compatible = "nxp,ptn3460"; compatible = "nxp,ptn3460";
...@@ -24,4 +29,11 @@ Example: ...@@ -24,4 +29,11 @@ Example:
powerdown-gpio = <&gpy2 5 1 0 0>; powerdown-gpio = <&gpy2 5 1 0 0>;
reset-gpio = <&gpx1 5 1 0 0>; reset-gpio = <&gpx1 5 1 0 0>;
edid-emulation = <5>; edid-emulation = <5>;
ports {
port@0 {
bridge_out: endpoint {
remote-endpoint = <&panel_in>;
};
};
};
}; };
...@@ -66,6 +66,10 @@ Optional properties for dp-controller: ...@@ -66,6 +66,10 @@ Optional properties for dp-controller:
Hotplug detect GPIO. Hotplug detect GPIO.
Indicates which GPIO should be used for hotplug Indicates which GPIO should be used for hotplug
detection detection
-video interfaces: Device node can contain video interface port
nodes according to [1].
[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
Example: Example:
...@@ -105,4 +109,12 @@ Board Specific portion: ...@@ -105,4 +109,12 @@ Board Specific portion:
vsync-len = <6>; vsync-len = <6>;
}; };
}; };
ports {
port@0 {
dp_out: endpoint {
remote-endpoint = <&bridge_in>;
};
};
};
}; };
...@@ -14,7 +14,7 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \ ...@@ -14,7 +14,7 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \
drm_info.o drm_debugfs.o drm_encoder_slave.o \ drm_info.o drm_debugfs.o drm_encoder_slave.o \
drm_trace_points.o drm_global.o drm_prime.o \ drm_trace_points.o drm_global.o drm_prime.o \
drm_rect.o drm_vma_manager.o drm_flip_work.o \ drm_rect.o drm_vma_manager.o drm_flip_work.o \
drm_modeset_lock.o drm_atomic.o drm_modeset_lock.o drm_atomic.o drm_bridge.o
drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_COMPAT) += drm_ioc32.o
drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
......
config DRM_PTN3460 config DRM_DW_HDMI
tristate "PTN3460 DP/LVDS bridge" tristate
depends on DRM depends on DRM
select DRM_KMS_HELPER select DRM_KMS_HELPER
---help---
config DRM_DW_HDMI config DRM_PTN3460
tristate tristate "PTN3460 DP/LVDS bridge"
depends on DRM depends on DRM
depends on OF
select DRM_KMS_HELPER select DRM_KMS_HELPER
select DRM_PANEL
---help---
ptn3460 eDP-LVDS bridge chip driver.
...@@ -1373,12 +1373,6 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge) ...@@ -1373,12 +1373,6 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge)
dw_hdmi_poweron(hdmi); dw_hdmi_poweron(hdmi);
} }
static void dw_hdmi_bridge_destroy(struct drm_bridge *bridge)
{
drm_bridge_cleanup(bridge);
kfree(bridge);
}
static void dw_hdmi_bridge_nop(struct drm_bridge *bridge) static void dw_hdmi_bridge_nop(struct drm_bridge *bridge)
{ {
/* do nothing */ /* do nothing */
...@@ -1468,7 +1462,6 @@ struct drm_bridge_funcs dw_hdmi_bridge_funcs = { ...@@ -1468,7 +1462,6 @@ struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
.post_disable = dw_hdmi_bridge_nop, .post_disable = dw_hdmi_bridge_nop,
.mode_set = dw_hdmi_bridge_mode_set, .mode_set = dw_hdmi_bridge_mode_set,
.mode_fixup = dw_hdmi_bridge_mode_fixup, .mode_fixup = dw_hdmi_bridge_mode_fixup,
.destroy = dw_hdmi_bridge_destroy,
}; };
static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id) static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id)
...@@ -1531,8 +1524,8 @@ static int dw_hdmi_register(struct drm_device *drm, struct dw_hdmi *hdmi) ...@@ -1531,8 +1524,8 @@ static int dw_hdmi_register(struct drm_device *drm, struct dw_hdmi *hdmi)
hdmi->bridge = bridge; hdmi->bridge = bridge;
bridge->driver_private = hdmi; bridge->driver_private = hdmi;
bridge->funcs = &dw_hdmi_bridge_funcs;
ret = drm_bridge_init(drm, bridge, &dw_hdmi_bridge_funcs); ret = drm_bridge_attach(drm, bridge);
if (ret) { if (ret) {
DRM_ERROR("Failed to initialize bridge with drm\n"); DRM_ERROR("Failed to initialize bridge with drm\n");
return -EINVAL; return -EINVAL;
...@@ -1649,7 +1642,7 @@ int dw_hdmi_bind(struct device *dev, struct device *master, ...@@ -1649,7 +1642,7 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
dw_hdmi_irq, IRQF_SHARED, dw_hdmi_irq, IRQF_SHARED,
dev_name(dev), hdmi); dev_name(dev), hdmi);
if (ret) if (ret)
return ret; goto err_iahb;
/* /*
* To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator
......
This diff is collapsed.
/*
* Copyright (c) 2014 Samsung Electronics Co., Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sub license,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <linux/err.h>
#include <linux/module.h>
#include <drm/drm_crtc.h>
#include "drm/drmP.h"
static DEFINE_MUTEX(bridge_lock);
static LIST_HEAD(bridge_list);
int drm_bridge_add(struct drm_bridge *bridge)
{
mutex_lock(&bridge_lock);
list_add_tail(&bridge->list, &bridge_list);
mutex_unlock(&bridge_lock);
return 0;
}
EXPORT_SYMBOL(drm_bridge_add);
void drm_bridge_remove(struct drm_bridge *bridge)
{
mutex_lock(&bridge_lock);
list_del_init(&bridge->list);
mutex_unlock(&bridge_lock);
}
EXPORT_SYMBOL(drm_bridge_remove);
extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge)
{
if (!dev || !bridge)
return -EINVAL;
if (bridge->dev)
return -EBUSY;
bridge->dev = dev;
if (bridge->funcs->attach)
return bridge->funcs->attach(bridge);
return 0;
}
EXPORT_SYMBOL(drm_bridge_attach);
#ifdef CONFIG_OF
struct drm_bridge *of_drm_find_bridge(struct device_node *np)
{
struct drm_bridge *bridge;
mutex_lock(&bridge_lock);
list_for_each_entry(bridge, &bridge_list, list) {
if (bridge->of_node == np) {
mutex_unlock(&bridge_lock);
return bridge;
}
}
mutex_unlock(&bridge_lock);
return NULL;
}
EXPORT_SYMBOL(of_drm_find_bridge);
#endif
MODULE_AUTHOR("Ajay Kumar <ajaykumar.rs@samsung.com>");
MODULE_DESCRIPTION("DRM bridge infrastructure");
MODULE_LICENSE("GPL and additional rights");
...@@ -787,7 +787,7 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info, ...@@ -787,7 +787,7 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info,
if (formats && num_formats) { if (formats && num_formats) {
fmts = kmemdup(formats, sizeof(*formats) * num_formats, fmts = kmemdup(formats, sizeof(*formats) * num_formats,
GFP_KERNEL); GFP_KERNEL);
if (!formats) if (!fmts)
return -ENOMEM; return -ENOMEM;
} }
...@@ -1065,61 +1065,6 @@ void drm_connector_unplug_all(struct drm_device *dev) ...@@ -1065,61 +1065,6 @@ void drm_connector_unplug_all(struct drm_device *dev)
} }
EXPORT_SYMBOL(drm_connector_unplug_all); EXPORT_SYMBOL(drm_connector_unplug_all);
/**
* drm_bridge_init - initialize a drm transcoder/bridge
* @dev: drm device
* @bridge: transcoder/bridge to set up
* @funcs: bridge function table
*
* Initialises a preallocated bridge. Bridges should be
* subclassed as part of driver connector objects.
*
* Returns:
* Zero on success, error code on failure.
*/
int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge,
const struct drm_bridge_funcs *funcs)
{
int ret;
drm_modeset_lock_all(dev);
ret = drm_mode_object_get(dev, &bridge->base, DRM_MODE_OBJECT_BRIDGE);
if (ret)
goto out;
bridge->dev = dev;
bridge->funcs = funcs;
list_add_tail(&bridge->head, &dev->mode_config.bridge_list);
dev->mode_config.num_bridge++;
out:
drm_modeset_unlock_all(dev);
return ret;
}
EXPORT_SYMBOL(drm_bridge_init);
/**
* drm_bridge_cleanup - cleans up an initialised bridge
* @bridge: bridge to cleanup
*
* Cleans up the bridge but doesn't free the object.
*/
void drm_bridge_cleanup(struct drm_bridge *bridge)
{
struct drm_device *dev = bridge->dev;
drm_modeset_lock_all(dev);
drm_mode_object_put(dev, &bridge->base);
list_del(&bridge->head);
dev->mode_config.num_bridge--;
drm_modeset_unlock_all(dev);
memset(bridge, 0, sizeof(*bridge));
}
EXPORT_SYMBOL(drm_bridge_cleanup);
/** /**
* drm_encoder_init - Init a preallocated encoder * drm_encoder_init - Init a preallocated encoder
* @dev: drm device * @dev: drm device
...@@ -1715,7 +1660,6 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr ...@@ -1715,7 +1660,6 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr
total_objects += dev->mode_config.num_crtc; total_objects += dev->mode_config.num_crtc;
total_objects += dev->mode_config.num_connector; total_objects += dev->mode_config.num_connector;
total_objects += dev->mode_config.num_encoder; total_objects += dev->mode_config.num_encoder;
total_objects += dev->mode_config.num_bridge;
group->id_list = kcalloc(total_objects, sizeof(uint32_t), GFP_KERNEL); group->id_list = kcalloc(total_objects, sizeof(uint32_t), GFP_KERNEL);
if (!group->id_list) if (!group->id_list)
...@@ -1724,7 +1668,6 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr ...@@ -1724,7 +1668,6 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr
group->num_crtcs = 0; group->num_crtcs = 0;
group->num_connectors = 0; group->num_connectors = 0;
group->num_encoders = 0; group->num_encoders = 0;
group->num_bridges = 0;
return 0; return 0;
} }
...@@ -1744,7 +1687,6 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev, ...@@ -1744,7 +1687,6 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev,
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_bridge *bridge;
int ret; int ret;
ret = drm_mode_group_init(dev, group); ret = drm_mode_group_init(dev, group);
...@@ -1762,11 +1704,6 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev, ...@@ -1762,11 +1704,6 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev,
group->id_list[group->num_crtcs + group->num_encoders + group->id_list[group->num_crtcs + group->num_encoders +
group->num_connectors++] = connector->base.id; group->num_connectors++] = connector->base.id;
list_for_each_entry(bridge, &dev->mode_config.bridge_list, head)
group->id_list[group->num_crtcs + group->num_encoders +
group->num_connectors + group->num_bridges++] =
bridge->base.id;
return 0; return 0;
} }
EXPORT_SYMBOL(drm_mode_group_init_legacy_group); EXPORT_SYMBOL(drm_mode_group_init_legacy_group);
...@@ -5443,7 +5380,6 @@ void drm_mode_config_init(struct drm_device *dev) ...@@ -5443,7 +5380,6 @@ void drm_mode_config_init(struct drm_device *dev)
INIT_LIST_HEAD(&dev->mode_config.fb_list); INIT_LIST_HEAD(&dev->mode_config.fb_list);
INIT_LIST_HEAD(&dev->mode_config.crtc_list); INIT_LIST_HEAD(&dev->mode_config.crtc_list);
INIT_LIST_HEAD(&dev->mode_config.connector_list); INIT_LIST_HEAD(&dev->mode_config.connector_list);
INIT_LIST_HEAD(&dev->mode_config.bridge_list);
INIT_LIST_HEAD(&dev->mode_config.encoder_list); INIT_LIST_HEAD(&dev->mode_config.encoder_list);
INIT_LIST_HEAD(&dev->mode_config.property_list); INIT_LIST_HEAD(&dev->mode_config.property_list);
INIT_LIST_HEAD(&dev->mode_config.property_blob_list); INIT_LIST_HEAD(&dev->mode_config.property_blob_list);
...@@ -5483,7 +5419,6 @@ void drm_mode_config_cleanup(struct drm_device *dev) ...@@ -5483,7 +5419,6 @@ void drm_mode_config_cleanup(struct drm_device *dev)
struct drm_connector *connector, *ot; struct drm_connector *connector, *ot;
struct drm_crtc *crtc, *ct; struct drm_crtc *crtc, *ct;
struct drm_encoder *encoder, *enct; struct drm_encoder *encoder, *enct;
struct drm_bridge *bridge, *brt;
struct drm_framebuffer *fb, *fbt; struct drm_framebuffer *fb, *fbt;
struct drm_property *property, *pt; struct drm_property *property, *pt;
struct drm_property_blob *blob, *bt; struct drm_property_blob *blob, *bt;
...@@ -5494,11 +5429,6 @@ void drm_mode_config_cleanup(struct drm_device *dev) ...@@ -5494,11 +5429,6 @@ void drm_mode_config_cleanup(struct drm_device *dev)
encoder->funcs->destroy(encoder); encoder->funcs->destroy(encoder);
} }
list_for_each_entry_safe(bridge, brt,
&dev->mode_config.bridge_list, head) {
bridge->funcs->destroy(bridge);
}
list_for_each_entry_safe(connector, ot, list_for_each_entry_safe(connector, ot,
&dev->mode_config.connector_list, head) { &dev->mode_config.connector_list, head) {
connector->funcs->destroy(connector); connector->funcs->destroy(connector);
......
...@@ -323,8 +323,6 @@ EXPORT_SYMBOL(mipi_dsi_packet_format_is_long); ...@@ -323,8 +323,6 @@ EXPORT_SYMBOL(mipi_dsi_packet_format_is_long);
int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
const struct mipi_dsi_msg *msg) const struct mipi_dsi_msg *msg)
{ {
const u8 *tx = msg->tx_buf;
if (!packet || !msg) if (!packet || !msg)
return -EINVAL; return -EINVAL;
...@@ -353,8 +351,10 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, ...@@ -353,8 +351,10 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
packet->header[2] = (msg->tx_len >> 8) & 0xff; packet->header[2] = (msg->tx_len >> 8) & 0xff;
packet->payload_length = msg->tx_len; packet->payload_length = msg->tx_len;
packet->payload = tx; packet->payload = msg->tx_buf;
} else { } else {
const u8 *tx = msg->tx_buf;
packet->header[1] = (msg->tx_len > 0) ? tx[0] : 0; packet->header[1] = (msg->tx_len > 0) ? tx[0] : 0;
packet->header[2] = (msg->tx_len > 1) ? tx[1] : 0; packet->header[2] = (msg->tx_len > 1) ? tx[1] : 0;
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/of_graph.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/component.h> #include <linux/component.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
...@@ -993,32 +994,20 @@ static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = { ...@@ -993,32 +994,20 @@ static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
.best_encoder = exynos_dp_best_encoder, .best_encoder = exynos_dp_best_encoder,
}; };
static bool find_bridge(const char *compat, struct bridge_init *bridge)
{
bridge->client = NULL;
bridge->node = of_find_compatible_node(NULL, NULL, compat);
if (!bridge->node)
return false;
bridge->client = of_find_i2c_device_by_node(bridge->node);
if (!bridge->client)
return false;
return true;
}
/* returns the number of bridges attached */ /* returns the number of bridges attached */
static int exynos_drm_attach_lcd_bridge(struct drm_device *dev, static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
struct drm_encoder *encoder) struct drm_encoder *encoder)
{ {
struct bridge_init bridge;
int ret; int ret;
if (find_bridge("nxp,ptn3460", &bridge)) { encoder->bridge = dp->bridge;
ret = ptn3460_init(dev, encoder, bridge.client, bridge.node); dp->bridge->encoder = encoder;
if (!ret) ret = drm_bridge_attach(encoder->dev, dp->bridge);
return 1; if (ret) {
DRM_ERROR("Failed to attach bridge to drm\n");
return ret;
} }
return 0; return 0;
} }
...@@ -1032,9 +1021,11 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display, ...@@ -1032,9 +1021,11 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
dp->encoder = encoder; dp->encoder = encoder;
/* Pre-empt DP connector creation if there's a bridge */ /* Pre-empt DP connector creation if there's a bridge */
ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder); if (dp->bridge) {
if (ret) ret = exynos_drm_attach_lcd_bridge(dp, encoder);
if (!ret)
return 0; return 0;
}
connector->polled = DRM_CONNECTOR_POLL_HPD; connector->polled = DRM_CONNECTOR_POLL_HPD;
...@@ -1241,7 +1232,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) ...@@ -1241,7 +1232,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
} }
} }
if (!dp->panel) { if (!dp->panel && !dp->bridge) {
ret = exynos_dp_dt_parse_panel(dp); ret = exynos_dp_dt_parse_panel(dp);
if (ret) if (ret)
return ret; return ret;
...@@ -1325,7 +1316,7 @@ static const struct component_ops exynos_dp_ops = { ...@@ -1325,7 +1316,7 @@ static const struct component_ops exynos_dp_ops = {
static int exynos_dp_probe(struct platform_device *pdev) static int exynos_dp_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *panel_node; struct device_node *panel_node, *bridge_node, *endpoint;
struct exynos_dp_device *dp; struct exynos_dp_device *dp;
int ret; int ret;
...@@ -1351,6 +1342,18 @@ static int exynos_dp_probe(struct platform_device *pdev) ...@@ -1351,6 +1342,18 @@ static int exynos_dp_probe(struct platform_device *pdev)
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
if (endpoint) {
bridge_node = of_graph_get_remote_port_parent(endpoint);
if (bridge_node) {
dp->bridge = of_drm_find_bridge(bridge_node);
of_node_put(bridge_node);
if (!dp->bridge)
return -EPROBE_DEFER;
} else
return -EPROBE_DEFER;
}
ret = component_add(&pdev->dev, &exynos_dp_ops); ret = component_add(&pdev->dev, &exynos_dp_ops);
if (ret) if (ret)
exynos_drm_component_del(&pdev->dev, exynos_drm_component_del(&pdev->dev,
......
...@@ -153,6 +153,7 @@ struct exynos_dp_device { ...@@ -153,6 +153,7 @@ struct exynos_dp_device {
struct drm_connector connector; struct drm_connector connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_panel *panel; struct drm_panel *panel;
struct drm_bridge *bridge;
struct clk *clock; struct clk *clock;
unsigned int irq; unsigned int irq;
void __iomem *reg_base; void __iomem *reg_base;
......
...@@ -247,9 +247,9 @@ int hdmi_modeset_init(struct hdmi *hdmi, ...@@ -247,9 +247,9 @@ int hdmi_modeset_init(struct hdmi *hdmi,
return 0; return 0;
fail: fail:
/* bridge/connector are normally destroyed by drm: */ /* bridge is normally destroyed by drm: */
if (hdmi->bridge) { if (hdmi->bridge) {
hdmi->bridge->funcs->destroy(hdmi->bridge); hdmi_bridge_destroy(hdmi->bridge);
hdmi->bridge = NULL; hdmi->bridge = NULL;
} }
if (hdmi->connector) { if (hdmi->connector) {
......
...@@ -146,6 +146,7 @@ void hdmi_audio_set_sample_rate(struct hdmi *hdmi, int rate); ...@@ -146,6 +146,7 @@ void hdmi_audio_set_sample_rate(struct hdmi *hdmi, int rate);
*/ */
struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi); struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi);
void hdmi_bridge_destroy(struct drm_bridge *bridge);
/* /*
* hdmi connector: * hdmi connector:
......
...@@ -23,10 +23,9 @@ struct hdmi_bridge { ...@@ -23,10 +23,9 @@ struct hdmi_bridge {
}; };
#define to_hdmi_bridge(x) container_of(x, struct hdmi_bridge, base) #define to_hdmi_bridge(x) container_of(x, struct hdmi_bridge, base)
static void hdmi_bridge_destroy(struct drm_bridge *bridge) void hdmi_bridge_destroy(struct drm_bridge *bridge)
{ {
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
drm_bridge_cleanup(bridge);
kfree(hdmi_bridge); kfree(hdmi_bridge);
} }
...@@ -200,7 +199,6 @@ static const struct drm_bridge_funcs hdmi_bridge_funcs = { ...@@ -200,7 +199,6 @@ static const struct drm_bridge_funcs hdmi_bridge_funcs = {
.disable = hdmi_bridge_disable, .disable = hdmi_bridge_disable,
.post_disable = hdmi_bridge_post_disable, .post_disable = hdmi_bridge_post_disable,
.mode_set = hdmi_bridge_mode_set, .mode_set = hdmi_bridge_mode_set,
.destroy = hdmi_bridge_destroy,
}; };
...@@ -220,8 +218,9 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi) ...@@ -220,8 +218,9 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
hdmi_bridge->hdmi = hdmi; hdmi_bridge->hdmi = hdmi;
bridge = &hdmi_bridge->base; bridge = &hdmi_bridge->base;
bridge->funcs = &hdmi_bridge_funcs;
drm_bridge_init(hdmi->dev, bridge, &hdmi_bridge_funcs); drm_bridge_attach(hdmi->dev, bridge);
return bridge; return bridge;
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include <video/mipi_display.h> #include <video/mipi_display.h>
#include <linux/host1x.h>
struct sharp_panel { struct sharp_panel {
struct drm_panel base; struct drm_panel base;
/* the datasheet refers to them as DSI-LINK1 and DSI-LINK2 */ /* the datasheet refers to them as DSI-LINK1 and DSI-LINK2 */
...@@ -41,6 +39,16 @@ static inline struct sharp_panel *to_sharp_panel(struct drm_panel *panel) ...@@ -41,6 +39,16 @@ static inline struct sharp_panel *to_sharp_panel(struct drm_panel *panel)
return container_of(panel, struct sharp_panel, base); return container_of(panel, struct sharp_panel, base);
} }
static void sharp_wait_frames(struct sharp_panel *sharp, unsigned int frames)
{
unsigned int refresh = drm_mode_vrefresh(sharp->mode);
if (WARN_ON(frames > refresh))
return;
msleep(1000 / (refresh / frames));
}
static int sharp_panel_write(struct sharp_panel *sharp, u16 offset, u8 value) static int sharp_panel_write(struct sharp_panel *sharp, u16 offset, u8 value)
{ {
u8 payload[3] = { offset >> 8, offset & 0xff, value }; u8 payload[3] = { offset >> 8, offset & 0xff, value };
...@@ -106,6 +114,8 @@ static int sharp_panel_unprepare(struct drm_panel *panel) ...@@ -106,6 +114,8 @@ static int sharp_panel_unprepare(struct drm_panel *panel)
if (!sharp->prepared) if (!sharp->prepared)
return 0; return 0;
sharp_wait_frames(sharp, 4);
err = mipi_dsi_dcs_set_display_off(sharp->link1); err = mipi_dsi_dcs_set_display_off(sharp->link1);
if (err < 0) if (err < 0)
dev_err(panel->dev, "failed to set display off: %d\n", err); dev_err(panel->dev, "failed to set display off: %d\n", err);
...@@ -170,15 +180,13 @@ static int sharp_panel_prepare(struct drm_panel *panel) ...@@ -170,15 +180,13 @@ static int sharp_panel_prepare(struct drm_panel *panel)
if (err < 0) if (err < 0)
return err; return err;
usleep_range(10000, 20000); /*
* According to the datasheet, the panel needs around 10 ms to fully
err = mipi_dsi_dcs_soft_reset(sharp->link1); * power up. At least another 120 ms is required before exiting sleep
if (err < 0) { * mode to make sure the panel is ready. Throw in another 20 ms for
dev_err(panel->dev, "soft reset failed: %d\n", err); * good measure.
goto poweroff; */
} msleep(150);
msleep(120);
err = mipi_dsi_dcs_exit_sleep_mode(sharp->link1); err = mipi_dsi_dcs_exit_sleep_mode(sharp->link1);
if (err < 0) { if (err < 0) {
...@@ -238,6 +246,9 @@ static int sharp_panel_prepare(struct drm_panel *panel) ...@@ -238,6 +246,9 @@ static int sharp_panel_prepare(struct drm_panel *panel)
sharp->prepared = true; sharp->prepared = true;
/* wait for 6 frames before continuing */
sharp_wait_frames(sharp, 6);
return 0; return 0;
poweroff: poweroff:
......
...@@ -448,6 +448,34 @@ static const struct panel_desc auo_b133htn01 = { ...@@ -448,6 +448,34 @@ static const struct panel_desc auo_b133htn01 = {
}, },
}; };
static const struct drm_display_mode avic_tm070ddh03_mode = {
.clock = 51200,
.hdisplay = 1024,
.hsync_start = 1024 + 160,
.hsync_end = 1024 + 160 + 4,
.htotal = 1024 + 160 + 4 + 156,
.vdisplay = 600,
.vsync_start = 600 + 17,
.vsync_end = 600 + 17 + 1,
.vtotal = 600 + 17 + 1 + 17,
.vrefresh = 60,
};
static const struct panel_desc avic_tm070ddh03 = {
.modes = &avic_tm070ddh03_mode,
.num_modes = 1,
.bpc = 8,
.size = {
.width = 154,
.height = 90,
},
.delay = {
.prepare = 20,
.enable = 200,
.disable = 200,
},
};
static const struct drm_display_mode chunghwa_claa101wa01a_mode = { static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
.clock = 72070, .clock = 72070,
.hdisplay = 1366, .hdisplay = 1366,
...@@ -566,6 +594,29 @@ static const struct panel_desc foxlink_fl500wvr00_a0t = { ...@@ -566,6 +594,29 @@ static const struct panel_desc foxlink_fl500wvr00_a0t = {
.bus_format = MEDIA_BUS_FMT_RGB888_1X24, .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
}; };
static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
.clock = 9000,
.hdisplay = 480,
.hsync_start = 480 + 5,
.hsync_end = 480 + 5 + 1,
.htotal = 480 + 5 + 1 + 40,
.vdisplay = 272,
.vsync_start = 272 + 8,
.vsync_end = 272 + 8 + 1,
.vtotal = 272 + 8 + 1 + 8,
.vrefresh = 60,
};
static const struct panel_desc giantplus_gpg482739qs5 = {
.modes = &giantplus_gpg482739qs5_mode,
.num_modes = 1,
.bpc = 8,
.size = {
.width = 95,
.height = 54,
},
};
static const struct drm_display_mode hannstar_hsd070pww1_mode = { static const struct drm_display_mode hannstar_hsd070pww1_mode = {
.clock = 71100, .clock = 71100,
.hdisplay = 1280, .hdisplay = 1280,
...@@ -744,6 +795,9 @@ static const struct of_device_id platform_of_match[] = { ...@@ -744,6 +795,9 @@ static const struct of_device_id platform_of_match[] = {
}, { }, {
.compatible = "auo,b133xtn01", .compatible = "auo,b133xtn01",
.data = &auo_b133xtn01, .data = &auo_b133xtn01,
}, {
.compatible = "avic,tm070ddh03",
.data = &avic_tm070ddh03,
}, { }, {
.compatible = "chunghwa,claa101wa01a", .compatible = "chunghwa,claa101wa01a",
.data = &chunghwa_claa101wa01a .data = &chunghwa_claa101wa01a
...@@ -762,6 +816,9 @@ static const struct of_device_id platform_of_match[] = { ...@@ -762,6 +816,9 @@ static const struct of_device_id platform_of_match[] = {
}, { }, {
.compatible = "foxlink,fl500wvr00-a0t", .compatible = "foxlink,fl500wvr00-a0t",
.data = &foxlink_fl500wvr00_a0t, .data = &foxlink_fl500wvr00_a0t,
}, {
.compatible = "giantplus,gpg482739qs5",
.data = &giantplus_gpg482739qs5
}, { }, {
.compatible = "hannstar,hsd070pww1", .compatible = "hannstar,hsd070pww1",
.data = &hannstar_hsd070pww1, .data = &hannstar_hsd070pww1,
......
...@@ -91,6 +91,7 @@ struct sti_dvo { ...@@ -91,6 +91,7 @@ struct sti_dvo {
struct dvo_config *config; struct dvo_config *config;
bool enabled; bool enabled;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_bridge *bridge;
}; };
struct sti_dvo_connector { struct sti_dvo_connector {
...@@ -272,19 +273,12 @@ static void sti_dvo_bridge_nope(struct drm_bridge *bridge) ...@@ -272,19 +273,12 @@ static void sti_dvo_bridge_nope(struct drm_bridge *bridge)
/* do nothing */ /* do nothing */
} }
static void sti_dvo_brigde_destroy(struct drm_bridge *bridge)
{
drm_bridge_cleanup(bridge);
kfree(bridge);
}
static const struct drm_bridge_funcs sti_dvo_bridge_funcs = { static const struct drm_bridge_funcs sti_dvo_bridge_funcs = {
.pre_enable = sti_dvo_pre_enable, .pre_enable = sti_dvo_pre_enable,
.enable = sti_dvo_bridge_nope, .enable = sti_dvo_bridge_nope,
.disable = sti_dvo_disable, .disable = sti_dvo_disable,
.post_disable = sti_dvo_bridge_nope, .post_disable = sti_dvo_bridge_nope,
.mode_set = sti_dvo_set_mode, .mode_set = sti_dvo_set_mode,
.destroy = sti_dvo_brigde_destroy,
}; };
static int sti_dvo_connector_get_modes(struct drm_connector *connector) static int sti_dvo_connector_get_modes(struct drm_connector *connector)
...@@ -416,8 +410,21 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data) ...@@ -416,8 +410,21 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
return -ENOMEM; return -ENOMEM;
bridge->driver_private = dvo; bridge->driver_private = dvo;
drm_bridge_init(drm_dev, bridge, &sti_dvo_bridge_funcs); bridge->funcs = &sti_dvo_bridge_funcs;
bridge->of_node = dvo->dev.of_node;
err = drm_bridge_add(bridge);
if (err) {
DRM_ERROR("Failed to add bridge\n");
return err;
}
err = drm_bridge_attach(drm_dev, bridge);
if (err) {
DRM_ERROR("Failed to attach bridge\n");
return err;
}
dvo->bridge = bridge;
encoder->bridge = bridge; encoder->bridge = bridge;
connector->encoder = encoder; connector->encoder = encoder;
dvo->encoder = encoder; dvo->encoder = encoder;
...@@ -446,7 +453,7 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data) ...@@ -446,7 +453,7 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
err_sysfs: err_sysfs:
drm_connector_unregister(drm_connector); drm_connector_unregister(drm_connector);
err_connector: err_connector:
drm_bridge_cleanup(bridge); drm_bridge_remove(bridge);
drm_connector_cleanup(drm_connector); drm_connector_cleanup(drm_connector);
return -EINVAL; return -EINVAL;
} }
...@@ -454,7 +461,9 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data) ...@@ -454,7 +461,9 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
static void sti_dvo_unbind(struct device *dev, static void sti_dvo_unbind(struct device *dev,
struct device *master, void *data) struct device *master, void *data)
{ {
/* do nothing */ struct sti_dvo *dvo = dev_get_drvdata(dev);
drm_bridge_remove(dvo->bridge);
} }
static const struct component_ops sti_dvo_ops = { static const struct component_ops sti_dvo_ops = {
......
...@@ -508,19 +508,12 @@ static void sti_hda_bridge_nope(struct drm_bridge *bridge) ...@@ -508,19 +508,12 @@ static void sti_hda_bridge_nope(struct drm_bridge *bridge)
/* do nothing */ /* do nothing */
} }
static void sti_hda_brigde_destroy(struct drm_bridge *bridge)
{
drm_bridge_cleanup(bridge);
kfree(bridge);
}
static const struct drm_bridge_funcs sti_hda_bridge_funcs = { static const struct drm_bridge_funcs sti_hda_bridge_funcs = {
.pre_enable = sti_hda_pre_enable, .pre_enable = sti_hda_pre_enable,
.enable = sti_hda_bridge_nope, .enable = sti_hda_bridge_nope,
.disable = sti_hda_disable, .disable = sti_hda_disable,
.post_disable = sti_hda_bridge_nope, .post_disable = sti_hda_bridge_nope,
.mode_set = sti_hda_set_mode, .mode_set = sti_hda_set_mode,
.destroy = sti_hda_brigde_destroy,
}; };
static int sti_hda_connector_get_modes(struct drm_connector *connector) static int sti_hda_connector_get_modes(struct drm_connector *connector)
...@@ -664,7 +657,8 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data) ...@@ -664,7 +657,8 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
return -ENOMEM; return -ENOMEM;
bridge->driver_private = hda; bridge->driver_private = hda;
drm_bridge_init(drm_dev, bridge, &sti_hda_bridge_funcs); bridge->funcs = &sti_hda_bridge_funcs;
drm_bridge_attach(drm_dev, bridge);
encoder->bridge = bridge; encoder->bridge = bridge;
connector->encoder = encoder; connector->encoder = encoder;
...@@ -693,7 +687,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data) ...@@ -693,7 +687,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
err_sysfs: err_sysfs:
drm_connector_unregister(drm_connector); drm_connector_unregister(drm_connector);
err_connector: err_connector:
drm_bridge_cleanup(bridge);
drm_connector_cleanup(drm_connector); drm_connector_cleanup(drm_connector);
return -EINVAL; return -EINVAL;
} }
......
...@@ -463,19 +463,12 @@ static void sti_hdmi_bridge_nope(struct drm_bridge *bridge) ...@@ -463,19 +463,12 @@ static void sti_hdmi_bridge_nope(struct drm_bridge *bridge)
/* do nothing */ /* do nothing */
} }
static void sti_hdmi_brigde_destroy(struct drm_bridge *bridge)
{
drm_bridge_cleanup(bridge);
kfree(bridge);
}
static const struct drm_bridge_funcs sti_hdmi_bridge_funcs = { static const struct drm_bridge_funcs sti_hdmi_bridge_funcs = {
.pre_enable = sti_hdmi_pre_enable, .pre_enable = sti_hdmi_pre_enable,
.enable = sti_hdmi_bridge_nope, .enable = sti_hdmi_bridge_nope,
.disable = sti_hdmi_disable, .disable = sti_hdmi_disable,
.post_disable = sti_hdmi_bridge_nope, .post_disable = sti_hdmi_bridge_nope,
.mode_set = sti_hdmi_set_mode, .mode_set = sti_hdmi_set_mode,
.destroy = sti_hdmi_brigde_destroy,
}; };
static int sti_hdmi_connector_get_modes(struct drm_connector *connector) static int sti_hdmi_connector_get_modes(struct drm_connector *connector)
...@@ -635,7 +628,8 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -635,7 +628,8 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
goto err_adapt; goto err_adapt;
bridge->driver_private = hdmi; bridge->driver_private = hdmi;
drm_bridge_init(drm_dev, bridge, &sti_hdmi_bridge_funcs); bridge->funcs = &sti_hdmi_bridge_funcs;
drm_bridge_attach(drm_dev, bridge);
encoder->bridge = bridge; encoder->bridge = bridge;
connector->encoder = encoder; connector->encoder = encoder;
...@@ -667,7 +661,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -667,7 +661,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
err_sysfs: err_sysfs:
drm_connector_unregister(drm_connector); drm_connector_unregister(drm_connector);
err_connector: err_connector:
drm_bridge_cleanup(bridge);
drm_connector_cleanup(drm_connector); drm_connector_cleanup(drm_connector);
err_adapt: err_adapt:
put_device(&hdmi->ddc_adapt->dev); put_device(&hdmi->ddc_adapt->dev);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#define _DRM_BRIDGE_PTN3460_H_ #define _DRM_BRIDGE_PTN3460_H_
struct drm_device; struct drm_device;
struct drm_bridge;
struct drm_encoder; struct drm_encoder;
struct i2c_client; struct i2c_client;
struct device_node; struct device_node;
...@@ -23,6 +24,9 @@ struct device_node; ...@@ -23,6 +24,9 @@ struct device_node;
int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
struct i2c_client *client, struct device_node *node); struct i2c_client *client, struct device_node *node);
void ptn3460_destroy(struct drm_bridge *bridge);
#else #else
static inline int ptn3460_init(struct drm_device *dev, static inline int ptn3460_init(struct drm_device *dev,
...@@ -32,6 +36,10 @@ static inline int ptn3460_init(struct drm_device *dev, ...@@ -32,6 +36,10 @@ static inline int ptn3460_init(struct drm_device *dev,
return 0; return 0;
} }
static inline void ptn3460_destroy(struct drm_bridge *bridge)
{
}
#endif #endif
#endif #endif
...@@ -868,15 +868,16 @@ struct drm_plane { ...@@ -868,15 +868,16 @@ struct drm_plane {
/** /**
* struct drm_bridge_funcs - drm_bridge control functions * struct drm_bridge_funcs - drm_bridge control functions
* @attach: Called during drm_bridge_attach
* @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge
* @disable: Called right before encoder prepare, disables the bridge * @disable: Called right before encoder prepare, disables the bridge
* @post_disable: Called right after encoder prepare, for lockstepped disable * @post_disable: Called right after encoder prepare, for lockstepped disable
* @mode_set: Set this mode to the bridge * @mode_set: Set this mode to the bridge
* @pre_enable: Called right before encoder commit, for lockstepped commit * @pre_enable: Called right before encoder commit, for lockstepped commit
* @enable: Called right after encoder commit, enables the bridge * @enable: Called right after encoder commit, enables the bridge
* @destroy: make object go away
*/ */
struct drm_bridge_funcs { struct drm_bridge_funcs {
int (*attach)(struct drm_bridge *bridge);
bool (*mode_fixup)(struct drm_bridge *bridge, bool (*mode_fixup)(struct drm_bridge *bridge,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode); struct drm_display_mode *adjusted_mode);
...@@ -887,22 +888,24 @@ struct drm_bridge_funcs { ...@@ -887,22 +888,24 @@ struct drm_bridge_funcs {
struct drm_display_mode *adjusted_mode); struct drm_display_mode *adjusted_mode);
void (*pre_enable)(struct drm_bridge *bridge); void (*pre_enable)(struct drm_bridge *bridge);
void (*enable)(struct drm_bridge *bridge); void (*enable)(struct drm_bridge *bridge);
void (*destroy)(struct drm_bridge *bridge);
}; };
/** /**
* struct drm_bridge - central DRM bridge control structure * struct drm_bridge - central DRM bridge control structure
* @dev: DRM device this bridge belongs to * @dev: DRM device this bridge belongs to
* @head: list management * @of_node: device node pointer to the bridge
* @list: to keep track of all added bridges
* @base: base mode object * @base: base mode object
* @funcs: control functions * @funcs: control functions
* @driver_private: pointer to the bridge driver's internal context * @driver_private: pointer to the bridge driver's internal context
*/ */
struct drm_bridge { struct drm_bridge {
struct drm_device *dev; struct drm_device *dev;
struct list_head head; struct drm_encoder *encoder;
#ifdef CONFIG_OF
struct drm_mode_object base; struct device_node *of_node;
#endif
struct list_head list;
const struct drm_bridge_funcs *funcs; const struct drm_bridge_funcs *funcs;
void *driver_private; void *driver_private;
...@@ -1007,7 +1010,6 @@ struct drm_mode_group { ...@@ -1007,7 +1010,6 @@ struct drm_mode_group {
uint32_t num_crtcs; uint32_t num_crtcs;
uint32_t num_encoders; uint32_t num_encoders;
uint32_t num_connectors; uint32_t num_connectors;
uint32_t num_bridges;
/* list of object IDs for this group */ /* list of object IDs for this group */
uint32_t *id_list; uint32_t *id_list;
...@@ -1026,8 +1028,6 @@ struct drm_mode_group { ...@@ -1026,8 +1028,6 @@ struct drm_mode_group {
* @fb_list: list of framebuffers available * @fb_list: list of framebuffers available
* @num_connector: number of connectors on this device * @num_connector: number of connectors on this device
* @connector_list: list of connector objects * @connector_list: list of connector objects
* @num_bridge: number of bridges on this device
* @bridge_list: list of bridge objects
* @num_encoder: number of encoders on this device * @num_encoder: number of encoders on this device
* @encoder_list: list of encoder objects * @encoder_list: list of encoder objects
* @num_overlay_plane: number of overlay planes on this device * @num_overlay_plane: number of overlay planes on this device
...@@ -1072,8 +1072,6 @@ struct drm_mode_config { ...@@ -1072,8 +1072,6 @@ struct drm_mode_config {
int num_connector; int num_connector;
struct list_head connector_list; struct list_head connector_list;
int num_bridge;
struct list_head bridge_list;
int num_encoder; int num_encoder;
struct list_head encoder_list; struct list_head encoder_list;
...@@ -1222,9 +1220,10 @@ extern unsigned int drm_connector_index(struct drm_connector *connector); ...@@ -1222,9 +1220,10 @@ extern unsigned int drm_connector_index(struct drm_connector *connector);
/* helper to unplug all connectors from sysfs for device */ /* helper to unplug all connectors from sysfs for device */
extern void drm_connector_unplug_all(struct drm_device *dev); extern void drm_connector_unplug_all(struct drm_device *dev);
extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge, extern int drm_bridge_add(struct drm_bridge *bridge);
const struct drm_bridge_funcs *funcs); extern void drm_bridge_remove(struct drm_bridge *bridge);
extern void drm_bridge_cleanup(struct drm_bridge *bridge); extern struct drm_bridge *of_drm_find_bridge(struct device_node *np);
extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge);
extern int drm_encoder_init(struct drm_device *dev, extern int drm_encoder_init(struct drm_device *dev,
struct drm_encoder *encoder, struct drm_encoder *encoder,
......
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