drm/rockchip: attach rgb bridge to encoders needing it

A patch from »drm/rockchip: add support for lvds controller and external encoders« in state Rework for linux-kernel

From: Heiko Stuebner <heiko@...> Date: Tue, 27 Jan 2015 11:13:55 +0100

Commit-Message

On SoCs like the rk3288 the lvds controller needs to be configured even for just providing rgb data to an attached encoder. As internals of the rockchip drm driver should not leak into the implementation of generic i2c encoders etc, go through the list of encoders and attach any necessary rgb bridges when building the drm device in the load callback. Signed-off-by: Heiko Stuebner <heiko@...>

Patch-Comment

.../devicetree/bindings/video/rockchip-vop.txt | 16 +++++++++++ drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 32 ++++++++++++++++++++++ 2 files changed, 48 insertions(+)

Statistics

  • 48 lines added
  • 0 lines removed

Changes

----------- Documentation/devicetree/bindings/video/rockchip-vop.txt -----------
index d15351f..b7762ed 100644
@@ -32,6 +32,11 @@ Required properties:
- port: A port node with endpoint definitions as defined in
Documentation/devicetree/bindings/media/video-interfaces.txt.
+Optional properties in encoder nodes:
+- rockchip,rgb-bridge: if a separate controller is regulating access
+ to the rgb output interface it should be referenced
+ in the encoder node.
+
Example:
SoC specific DT entry:
vopb: vopb@ff930000 {
@@ -56,3 +61,14 @@ SoC specific DT entry:
};
};
};
+
+Additional entries when a rgb-bridge is used:
+
+ lvds: lvds@ff96c000 {
+ ...
+ };
+
+ external-encoder {
+ ...
+ rockchip,rgb-bridge = <&lvds>;
+ };
----------------- drivers/gpu/drm/rockchip/rockchip_drm_drv.c ------------------
index 30da781..86a3e61 100644
@@ -130,6 +130,7 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
struct dma_iommu_mapping *mapping;
struct device *dev = drm_dev->dev;
struct drm_connector *connector;
+ struct drm_encoder *encoder;
int ret;
private = devm_kzalloc(drm_dev->dev, sizeof(*private), GFP_KERNEL);
@@ -173,6 +174,37 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
goto err_detach_device;
/*
+ * Attach rgb bridge to encoders needing it.
+ */
+ list_for_each_entry(encoder, &drm_dev->mode_config.encoder_list, head) {
+ struct device_node *rgb_node;
+
+ if (!encoder->of_node)
+ continue;
+
+ rgb_node = of_parse_phandle(encoder->of_node,
+ "rockchip,rgb-bridge", 0);
+ if (rgb_node) {
+ struct drm_bridge *bridge;
+
+ bridge = of_drm_find_bridge(rgb_node);
+ of_node_put(rgb_node);
+ if (!bridge) {
+ ret = -EPROBE_DEFER;
+ goto err_unbind;
+ }
+
+ encoder->bridge = bridge;
+ bridge->encoder = encoder;
+ ret = drm_bridge_attach(encoder->dev, bridge);
+ if (ret) {
+ DRM_ERROR("Failed to attach bridge to drm\n");
+ goto err_unbind;
+ }
+ }
+ }
+
+ /*
* All components are now added, we can publish the connector sysfs
* entries to userspace. This will generate hotplug events and so
* userspace will expect to be able to access DRM at this point.
 
 

Recent Patches

About Us

Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel, tempor at, varius non, purus. Mauris vitae nisl nec metus placerat consectetuer.

Read More...