Skip to content

Commit 8843866

Browse files
Marek VasutThomas Zimmermann
authored andcommitted
drm/bridge: lvds-codec: Add support for pixel data sampling edge select
The OnSemi FIN3385 Parallel-to-LVDS encoder has a dedicated input line to select input pixel data sampling edge. Add DT property "pclk-sample", not the same as the one used by display timings but rather the same as used by media, and configure bus flags based on this DT property. Signed-off-by: Marek Vasut <[email protected]> Cc: Laurent Pinchart <[email protected]> Cc: Rob Herring <[email protected]> Cc: Sam Ravnborg <[email protected]> Cc: [email protected] To: [email protected] Reviewed-by: Sam Ravnborg <[email protected]> Signed-off-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent d7df394 commit 8843866

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/gpu/drm/bridge/lvds-codec.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct lvds_codec {
2121
struct device *dev;
2222
struct drm_bridge bridge;
2323
struct drm_bridge *panel_bridge;
24+
struct drm_bridge_timings timings;
2425
struct regulator *vcc;
2526
struct gpio_desc *powerdown_gpio;
2627
u32 connector_type;
@@ -119,6 +120,7 @@ static int lvds_codec_probe(struct platform_device *pdev)
119120
struct device_node *bus_node;
120121
struct drm_panel *panel;
121122
struct lvds_codec *lvds_codec;
123+
u32 val;
122124
int ret;
123125

124126
lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL);
@@ -187,12 +189,25 @@ static int lvds_codec_probe(struct platform_device *pdev)
187189
}
188190
}
189191

192+
/*
193+
* Encoder might sample data on different clock edge than the display,
194+
* for example OnSemi FIN3385 has a dedicated strapping pin to select
195+
* the sampling edge.
196+
*/
197+
if (lvds_codec->connector_type == DRM_MODE_CONNECTOR_LVDS &&
198+
!of_property_read_u32(dev->of_node, "pclk-sample", &val)) {
199+
lvds_codec->timings.input_bus_flags = val ?
200+
DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE :
201+
DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE;
202+
}
203+
190204
/*
191205
* The panel_bridge bridge is attached to the panel's of_node,
192206
* but we need a bridge attached to our of_node for our user
193207
* to look up.
194208
*/
195209
lvds_codec->bridge.of_node = dev->of_node;
210+
lvds_codec->bridge.timings = &lvds_codec->timings;
196211
drm_bridge_add(&lvds_codec->bridge);
197212

198213
platform_set_drvdata(pdev, lvds_codec);

0 commit comments

Comments
 (0)