drm/bridge: Allow using fwnode API to get the next bridge
Subsystems (29)
v6 cover drm/bridge: Allow using fwnode API to get the next bridge
Currently, the various display bridge drivers rely on OF infrastructures to works very well, yet there are platforms and/or devices absence of 'OF' support. Such as virtual display drivers, USB display apapters and ACPI based systems etc.
Add fwnode based helpers to fill the niche, this allows part of the display bridge drivers to work across systems. As the fwnode API has wider coverage than DT counterpart and the fwnode graphs are compatible with the OF graph, so the provided helpers can be used on all systems in theory. Assumed that fwnode graphs are well established on the system.
Tested on TI BeaglePlay board.
v1 -> v2:
* Modify it66121 to switch togather
* Drop the 'side-by-side' implement
* Add drm_bridge_find_next_bridge_by_fwnode() helper
* Add drm_bridge_set_node() helper
v2 -> v3:
* Read kernel-doc and improve function comments (Dmitry)
* Drop the 'port' argument of it66121_read_bus_width() (Dmitry)
* drm-bridge: sii902x get nuked
v3 -> v4:
* drm-bridge: tfp410 get nuked
* Add platform module alias
* Rebase and improve commit message and function comments
v4 -> v5:
* Modify sii9234, ch7033 and ANX7688
* Trivial fixes
v5 -> v6:
* Implement the same thing with no boilerplate introduced
* Add 'struct device *' field to the drm_bridge structure
* Re-implement of_drm_find_bridge() with drm_bridge_find_by_fwnode()
Sui Jingfeng (10):
drm/bridge: Allow using fwnode APIs to get the next bridge drm/bridge: Set firmware node of drm_bridge instances automatically drm/bridge: Implement of_drm_find_bridge() on the top of
drm_bridge_find_by_fwnode()
drm/bridge: simple-bridge: Use fwnode APIs to acquire device
properties
drm/bridge: display-connector: Use fwnode APIs to acquire device
properties
drm/bridge: sii902x: Switch to use fwnode APIs to acquire device
properties
drm-bridge: it66121: Use fwnode APIs to acquire device properties drm/bridge: tfp410: Use fwnode APIs to acquire device properties drm/bridge: sii9234: Use fwnode APIs to abstract DT dependent API away drm/bridge: ch7033: Switch to use fwnode based APIs
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 +- .../drm/bridge/analogix/analogix-anx6345.c | 4 +- .../drm/bridge/analogix/analogix-anx78xx.c | 4 +- drivers/gpu/drm/bridge/analogix/anx7625.c | 3 +- .../gpu/drm/bridge/cadence/cdns-dsi-core.c | 3 +- .../drm/bridge/cadence/cdns-mhdp8546-core.c | 3 +- drivers/gpu/drm/bridge/chipone-icn6211.c | 5 +- drivers/gpu/drm/bridge/chrontel-ch7033.c | 15 ++-- drivers/gpu/drm/bridge/cros-ec-anx7688.c | 4 +- drivers/gpu/drm/bridge/display-connector.c | 26 +++--- drivers/gpu/drm/bridge/fsl-ldb.c | 3 +- drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 3 +- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c | 3 +- .../drm/bridge/imx/imx8qxp-pixel-combiner.c | 3 +- .../gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 3 +- drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 3 +- drivers/gpu/drm/bridge/ite-it6505.c | 3 +- drivers/gpu/drm/bridge/ite-it66121.c | 58 ++++++++----- drivers/gpu/drm/bridge/lontium-lt8912b.c | 3 +- drivers/gpu/drm/bridge/lontium-lt9211.c | 3 +- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 +- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 3 +- drivers/gpu/drm/bridge/lvds-codec.c | 3 +- .../bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 3 +- drivers/gpu/drm/bridge/microchip-lvds.c | 3 +- drivers/gpu/drm/bridge/nwl-dsi.c | 3 +- drivers/gpu/drm/bridge/nxp-ptn3460.c | 3 +- drivers/gpu/drm/bridge/panel.c | 3 +- drivers/gpu/drm/bridge/parade-ps8622.c | 3 +- drivers/gpu/drm/bridge/parade-ps8640.c | 1 - drivers/gpu/drm/bridge/samsung-dsim.c | 3 +- drivers/gpu/drm/bridge/sii902x.c | 46 ++++------ drivers/gpu/drm/bridge/sii9234.c | 8 +- drivers/gpu/drm/bridge/sil-sii8620.c | 3 +- drivers/gpu/drm/bridge/simple-bridge.c | 24 +++-- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 3 +- drivers/gpu/drm/bridge/tc358762.c | 3 +- drivers/gpu/drm/bridge/tc358764.c | 3 +- drivers/gpu/drm/bridge/tc358767.c | 3 +- drivers/gpu/drm/bridge/tc358768.c | 3 +- drivers/gpu/drm/bridge/tc358775.c | 3 +- drivers/gpu/drm/bridge/thc63lvd1024.c | 3 +- drivers/gpu/drm/bridge/ti-dlpc3433.c | 3 +- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 3 +- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 +- drivers/gpu/drm/bridge/ti-tfp410.c | 42 ++++----- drivers/gpu/drm/bridge/ti-tpd12s015.c | 3 +- drivers/gpu/drm/drm_bridge.c | 87 +++++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_mic.c | 3 +- drivers/gpu/drm/i2c/tda998x_drv.c | 5 +- drivers/gpu/drm/mcde/mcde_dsi.c | 3 +- drivers/gpu/drm/mediatek/mtk_dsi.c | 3 +- drivers/gpu/drm/mediatek/mtk_hdmi.c | 3 +- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 3 +- drivers/gpu/drm/meson/meson_encoder_dsi.c | 3 +- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 3 +- drivers/gpu/drm/omapdrm/dss/dpi.c | 3 +- drivers/gpu/drm/omapdrm/dss/dsi.c | 3 +- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 3 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 3 +- drivers/gpu/drm/omapdrm/dss/sdi.c | 3 +- drivers/gpu/drm/omapdrm/dss/venc.c | 3 +- drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 3 +- .../gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 3 +- .../gpu/drm/renesas/rcar-du/rzg2l_mipi_dsi.c | 3 +- drivers/gpu/drm/sti/sti_dvo.c | 3 +- drivers/gpu/drm/vc4/vc4_dsi.c | 5 +- drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 2 +- include/drm/drm_bridge.h | 21 +++-- 70 files changed, 256 insertions(+), 260 deletions(-)
Signature · 1 line
2.34.1
PATCH v6 1/10 drm/bridge: Allow using fwnode APIs to get the next bridge
The various display bridge drivers rely on 'OF' infrastructures to works very well, yet there are some platforms and/or devices lack of 'OF' support. Such as virtual display drivers, USB display apapters and ACPI based systems etc.
Add fwnode based helpers to fill the niche, this allows part of display bridge drivers to work across systems. As the fwnode APIs has wider coverage than DT counterpart, and fwnode graphs are compatible with OF graphs. So the newly created helpers can be used on all systems in theory, assumed that there has valid OF/fwnode graphs established.
Note, the involved drm bridge instance should also has the fwnode assigned, so that the user of it could find it via the fwnode handle.
--- drivers/gpu/drm/drm_bridge.c | 74 ++++++++++++++++++++++++++++++++++++ include/drm/drm_bridge.h | 11 +++++- 2 files changed, 83 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_bridge.c +74 -0
@@ -1363,6 +1363,80 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np)EXPORT_SYMBOL (of_drm_find_bridge);#endif +/** +* drm_bridge_find_by_fwnode - Find the bridge corresponding to the fwnode +* +* @fwnode: fwnode for which to find the matching drm_bridge +* +* This function looks up a drm_bridge in the global bridge list, based on +* its associated fwnode. Drivers who want to use this function should has +* fwnode handle assigned to the fwnode member of the struct drm_bridge +* instance. +* +* Returns: +* * A reference to the requested drm_bridge object on success, or +* * %NULL otherwise (object does not exist or the driver of requested +* bridge not probed yet). +*/ +struct drm_bridge *drm_bridge_find_by_fwnode (struct fwnode_handle *fwnode) +{ +struct drm_bridge *ret =NULL ; +struct drm_bridge *bridge; + +if (!fwnode) +return NULL ; + +mutex_lock (&bridge_lock); + +list_for_each_entry (bridge, &bridge_list, list) { +if (bridge->fwnode == fwnode) { + ret = bridge; +break ; + } + } + +mutex_unlock (&bridge_lock); + +return ret; +} +EXPORT_SYMBOL_GPL (drm_bridge_find_by_fwnode); + +/** +* drm_bridge_find_next_bridge_by_fwnode - Find the next bridge by fwnode +* @fwnode: fwnode pointer to the current device. +* @port: identifier of the port node of the next bridge is connected. +* +* This function find the next bridge of the current node the fwnode +* pointed to, assumed that the fwnode graph has been well established. +* +* Returns: +* * A reference to the requested drm_bridge object on success, or +* * -%ENODEV if the fwnode graph or OF graph is not complete, or +* * %NULL if object does not exist or the next bridge is not ready yet. +*/ +struct drm_bridge * +drm_bridge_find_next_bridge_by_fwnode (struct fwnode_handle *fwnode,u32 port) +{ +struct drm_bridge *bridge; +struct fwnode_handle *ep; +struct fwnode_handle *remote; + + ep =fwnode_graph_get_endpoint_by_id (fwnode, port,0 ,0 ); +if (!ep) +return ERR_PTR (-ENODEV ); + + remote =fwnode_graph_get_remote_port_parent (ep); +fwnode_handle_put (ep); +if (!remote) +return ERR_PTR (-ENODEV ); + + bridge =drm_bridge_find_by_fwnode (remote); +fwnode_handle_put (remote); + +return bridge; +} +EXPORT_SYMBOL_GPL (drm_bridge_find_next_bridge_by_fwnode); +MODULE_AUTHOR ("Ajay Kumar <[email protected]>" );MODULE_DESCRIPTION ("DRM bridge infrastructure" );MODULE_LICENSE ("GPL and additional rights" );
include/drm/drm_bridge.h +9 -2
@@ -26,14 +26,13 @@#include <linux/ctype.h> #include <linux/list.h> #include <linux/mutex.h> +#include <linux/of.h> #include <drm/drm_atomic.h> #include <drm/drm_encoder.h> #include <drm/drm_mode_object.h> #include <drm/drm_modes.h> -struct device_node ; -struct drm_bridge ;struct drm_bridge_timings ;struct drm_connector ;
@@ -721,6 +720,8 @@ struct drm_bridge {struct list_head chain_node;/** @of_node: device node pointer to the bridge */ struct device_node *of_node; +/** @fwnode: fwnode pointer to the bridge */ +struct fwnode_handle *fwnode;/** @list: to keep track of all added bridges */ struct list_head list;/**
@@ -797,6 +798,12 @@ static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np) }#endif +struct drm_bridge * +drm_bridge_find_by_fwnode (struct fwnode_handle *fwnode); + +struct drm_bridge * +drm_bridge_find_next_bridge_by_fwnode (struct fwnode_handle *fwnode,u32 port); +/** * drm_bridge_get_next_bridge() - Get the next bridge in the chain * @bridge: bridge object
Signature · 1 line
2.34.1
PATCH v6 2/10 drm/bridge: Set firmware node of drm_bridge instances automatically
In reply to Sui JingfengNormally, the drm_bridge::of_node won't be used by bridge driver instances themselves. Rather, it is mainly used by other modules to find associated drm bridge drvier. Therefore, adding a drm bridge to the global bridge list and setting 'of_node' field of a drm bridge share the same goal. Both are for finding purpose, therefore better to group them to one function.
Update the drm_bridge_add() interface and implementation to achieve such goal atomically, new implementation will fetch the device node from the backing device of the drm bridge driver automatically. For the majority cases, which is one device backing one drm bridge driver, this model works well. Drivers still can set it manually by passing NULL if this model doesn't fit.
While at it, Add a 'struct device *' pointer to the drm_bridge structure. As it already being passed in by both of drm_bridge_add() and devm_drm_bridge_add(). A lot of driver instances has already added it into their derived structure, promote it into drm_bridge core helps to reduce a batch of boilerplates.
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 +-- .../gpu/drm/bridge/analogix/analogix-anx6345.c | 4 +--- .../gpu/drm/bridge/analogix/analogix-anx78xx.c | 4 +--- drivers/gpu/drm/bridge/analogix/anx7625.c | 3 +-- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 3 +-- .../gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 3 +-- drivers/gpu/drm/bridge/chipone-icn6211.c | 5 ++--- drivers/gpu/drm/bridge/chrontel-ch7033.c | 3 +-- drivers/gpu/drm/bridge/cros-ec-anx7688.c | 4 +--- drivers/gpu/drm/bridge/display-connector.c | 3 +-- drivers/gpu/drm/bridge/fsl-ldb.c | 3 +-- drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 3 ++- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c | 3 +-- .../gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 3 ++- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 3 +-- drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 3 +-- drivers/gpu/drm/bridge/ite-it6505.c | 3 +-- drivers/gpu/drm/bridge/ite-it66121.c | 3 +-- drivers/gpu/drm/bridge/lontium-lt8912b.c | 3 +-- drivers/gpu/drm/bridge/lontium-lt9211.c | 3 +-- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 +-- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 3 +-- drivers/gpu/drm/bridge/lvds-codec.c | 3 +-- .../drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 3 +-- drivers/gpu/drm/bridge/microchip-lvds.c | 3 +-- drivers/gpu/drm/bridge/nwl-dsi.c | 3 +-- drivers/gpu/drm/bridge/nxp-ptn3460.c | 3 +-- drivers/gpu/drm/bridge/panel.c | 3 +-- drivers/gpu/drm/bridge/parade-ps8622.c | 3 +-- drivers/gpu/drm/bridge/parade-ps8640.c | 1 - drivers/gpu/drm/bridge/samsung-dsim.c | 3 +-- drivers/gpu/drm/bridge/sii902x.c | 3 +-- drivers/gpu/drm/bridge/sii9234.c | 3 +-- drivers/gpu/drm/bridge/sil-sii8620.c | 3 +-- drivers/gpu/drm/bridge/simple-bridge.c | 3 +-- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 +-- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 3 +-- drivers/gpu/drm/bridge/tc358762.c | 3 +-- drivers/gpu/drm/bridge/tc358764.c | 3 +-- drivers/gpu/drm/bridge/tc358767.c | 3 +-- drivers/gpu/drm/bridge/tc358768.c | 3 +-- drivers/gpu/drm/bridge/tc358775.c | 3 +-- drivers/gpu/drm/bridge/thc63lvd1024.c | 3 +-- drivers/gpu/drm/bridge/ti-dlpc3433.c | 3 +-- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 3 +-- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 +-- drivers/gpu/drm/bridge/ti-tfp410.c | 3 +-- drivers/gpu/drm/bridge/ti-tpd12s015.c | 3 +-- drivers/gpu/drm/drm_bridge.c | 16 ++++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_mic.c | 3 +-- drivers/gpu/drm/i2c/tda998x_drv.c | 5 +---- drivers/gpu/drm/mcde/mcde_dsi.c | 3 +-- drivers/gpu/drm/mediatek/mtk_dsi.c | 3 +-- drivers/gpu/drm/mediatek/mtk_hdmi.c | 3 +-- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 3 +-- drivers/gpu/drm/meson/meson_encoder_dsi.c | 3 +-- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 3 +-- drivers/gpu/drm/omapdrm/dss/dpi.c | 3 +-- drivers/gpu/drm/omapdrm/dss/dsi.c | 3 +-- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 3 +-- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 3 +-- drivers/gpu/drm/omapdrm/dss/sdi.c | 3 +-- drivers/gpu/drm/omapdrm/dss/venc.c | 3 +-- drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 3 +-- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 3 +-- drivers/gpu/drm/renesas/rcar-du/rzg2l_mipi_dsi.c | 3 +-- drivers/gpu/drm/sti/sti_dvo.c | 3 +-- drivers/gpu/drm/vc4/vc4_dsi.c | 5 +---- drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 2 +- include/drm/drm_bridge.h | 4 +++- 70 files changed, 87 insertions(+), 143 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -2
@@ -1319,10 +1319,9 @@ static int adv7511_probe(struct i2c_client *i2c)if (adv7511->i2c_main->irq) adv7511->bridge.ops |=DRM_BRIDGE_OP_HPD ; - adv7511->bridge.of_node = dev->of_node; adv7511->bridge.type =DRM_MODE_CONNECTOR_HDMIA ; -drm_bridge_add (&adv7511->bridge); +drm_bridge_add (&adv7511->bridge, dev);adv7511_audio_init (dev, adv7511);
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +1 -3
@@ -697,8 +697,6 @@ static int anx6345_i2c_probe(struct i2c_client *client)mutex_init (&anx6345->lock); - anx6345->bridge.of_node = client->dev.of_node; - anx6345->client = client;i2c_set_clientdata (client, anx6345);
@@ -766,7 +764,7 @@ static int anx6345_i2c_probe(struct i2c_client *client)anx6345_poweron (anx6345);if (anx6345_get_chip_id (anx6345)) { anx6345->bridge.funcs = &anx6345_bridge_funcs; -drm_bridge_add (&anx6345->bridge); +drm_bridge_add (&anx6345->bridge, dev);return 0 ; }else {
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +1 -3
@@ -1228,8 +1228,6 @@ static int anx78xx_i2c_probe(struct i2c_client *client)mutex_init (&anx78xx->lock); - anx78xx->bridge.of_node = client->dev.of_node; - anx78xx->client = client;i2c_set_clientdata (client, anx78xx);
@@ -1335,7 +1333,7 @@ static int anx78xx_i2c_probe(struct i2c_client *client) anx78xx->bridge.funcs = &anx78xx_bridge_funcs; -drm_bridge_add (&anx78xx->bridge); +drm_bridge_add (&anx78xx->bridge, &client->dev);/* If cable is pulled out, just poweroff and wait for HPD event */ if (!gpiod_get_value (anx78xx->pdata.gpiod_hpd))
drivers/gpu/drm/bridge/analogix/anx7625.c +1 -2
@@ -2607,7 +2607,6 @@ static int anx7625_link_bridge(struct drm_dp_aux *aux) } platform->bridge.funcs = &anx7625_bridge_funcs; - platform->bridge.of_node = dev->of_node;if (!anx7625_of_panel_on_aux_bus (dev)) platform->bridge.ops |=DRM_BRIDGE_OP_EDID ;if (!platform->pdata.panel_bridge)
@@ -2617,7 +2616,7 @@ static int anx7625_link_bridge(struct drm_dp_aux *aux) DRM_MODE_CONNECTOR_eDP : DRM_MODE_CONNECTOR_DisplayPort; -drm_bridge_add (&platform->bridge); +drm_bridge_add (&platform->bridge, dev);if (!platform->pdata.is_dpi) { ret =anx7625_attach_dsi (platform);
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +1 -2
@@ -975,7 +975,7 @@ static int cdns_dsi_attach(struct mipi_dsi_host *host,* register the input to the bridge framework so that it can take place * in a display pipeline. */ -drm_bridge_add (&input->bridge); +drm_bridge_add (&input->bridge, dsi->base.dev);return 0 ; }
@@ -1227,7 +1227,6 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)*/ input->id =CDNS_DPI_INPUT ; input->bridge.funcs = &cdns_dsi_bridge_funcs; - input->bridge.of_node = pdev->dev.of_node;/* Mask all interrupts before registering the IRQ handler. */ writel (0 , dsi->regs +MCTL_MAIN_STS_CTL );
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1 -2
@@ -2552,7 +2552,6 @@ static int cdns_mhdp_probe(struct platform_device *pdev) mhdp->display_fmt.color_format =DRM_COLOR_FORMAT_RGB444 ; mhdp->display_fmt.bpc =8 ; - mhdp->bridge.of_node = pdev->dev.of_node; mhdp->bridge.funcs = &cdns_mhdp_bridge_funcs; mhdp->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID |DRM_BRIDGE_OP_HPD ;
@@ -2578,7 +2577,7 @@ static int cdns_mhdp_probe(struct platform_device *pdev)if (mhdp->hdcp_supported)cdns_mhdp_hdcp_init (mhdp); -drm_bridge_add (&mhdp->bridge); +drm_bridge_add (&mhdp->bridge, dev);return 0 ;
drivers/gpu/drm/bridge/chipone-icn6211.c +2 -3
@@ -702,7 +702,6 @@ static int chipone_common_probe(struct device *dev, struct chipone **icnr) icn->bridge.funcs = &chipone_bridge_funcs; icn->bridge.type =DRM_MODE_CONNECTOR_DPI ; - icn->bridge.of_node = dev->of_node; *icnr = icn;
@@ -729,7 +728,7 @@ static int chipone_dsi_probe(struct mipi_dsi_device *dsi)mipi_dsi_set_drvdata (dsi, icn); -drm_bridge_add (&icn->bridge); +drm_bridge_add (&icn->bridge, dev); ret =chipone_dsi_attach (icn);if (ret)
@@ -757,7 +756,7 @@ static int chipone_i2c_probe(struct i2c_client *client)dev_set_drvdata (dev, icn);i2c_set_clientdata (client, icn); -drm_bridge_add (&icn->bridge); +drm_bridge_add (&icn->bridge, dev);return chipone_dsi_host_attach (icn); }
drivers/gpu/drm/bridge/chrontel-ch7033.c +1 -2
@@ -575,8 +575,7 @@ static int ch7033_probe(struct i2c_client *client)INIT_LIST_HEAD (&priv->bridge.list); priv->bridge.funcs = &ch7033_bridge_funcs; - priv->bridge.of_node = dev->of_node; -drm_bridge_add (&priv->bridge); +drm_bridge_add (&priv->bridge, dev);dev_info (dev,"Chrontel CH7033 Video Encoder\n" );return 0 ;
drivers/gpu/drm/bridge/cros-ec-anx7688.c +1 -3
@@ -143,8 +143,6 @@ static int cros_ec_anx7688_bridge_probe(struct i2c_client *client) fw_version = (u16 )buffer[0 ] <<8 | buffer[1 ];dev_info (dev,"ANX7688 firmware version 0x%04x\n" , fw_version); - anx7688->bridge.of_node = dev->of_node; -/* FW version >= 0.85 supports bandwidth/lane count registers */ if (fw_version >=ANX7688_MINIMUM_FW_VERSION ) anx7688->filter = true;
@@ -154,7 +152,7 @@ static int cros_ec_anx7688_bridge_probe(struct i2c_client *client) fw_version); anx7688->bridge.funcs = &cros_ec_anx7688_bridge_funcs; -drm_bridge_add (&anx7688->bridge); +drm_bridge_add (&anx7688->bridge, dev);return 0 ; }
drivers/gpu/drm/bridge/display-connector.c +1 -2
@@ -358,7 +358,6 @@ static int display_connector_probe(struct platform_device *pdev) } conn->bridge.funcs = &display_connector_bridge_funcs; - conn->bridge.of_node = pdev->dev.of_node;if (conn->bridge.ddc) conn->bridge.ops |=DRM_BRIDGE_OP_EDID
@@ -376,7 +375,7 @@ static int display_connector_probe(struct platform_device *pdev) conn->hpd_gpio ?"with" :"without" , conn->bridge.ops); -drm_bridge_add (&conn->bridge); +drm_bridge_add (&conn->bridge, &pdev->dev);return 0 ; }
drivers/gpu/drm/bridge/fsl-ldb.c +1 -2
@@ -308,7 +308,6 @@ static int fsl_ldb_probe(struct platform_device *pdev) fsl_ldb->dev = &pdev->dev; fsl_ldb->bridge.funcs = &funcs; - fsl_ldb->bridge.of_node = dev->of_node; fsl_ldb->clk =devm_clk_get (dev,"ldb" );if (IS_ERR (fsl_ldb->clk))
@@ -368,7 +367,7 @@ static int fsl_ldb_probe(struct platform_device *pdev)platform_set_drvdata (pdev, fsl_ldb); -drm_bridge_add (&fsl_ldb->bridge); +drm_bridge_add (&fsl_ldb->bridge, dev);return 0 ; }
drivers/gpu/drm/bridge/imx/imx-ldb-helper.c +2 -1
@@ -206,8 +206,9 @@ void ldb_add_bridge_helper(struct ldb *ldb, ldb_ch->bridge.driver_private = ldb_ch; ldb_ch->bridge.funcs = bridge_funcs; ldb_ch->bridge.of_node = ldb_ch->np; + ldb_ch->bridge.fwnode =of_fwnode_handle (ldb_ch->np); -drm_bridge_add (&ldb_ch->bridge); +drm_bridge_add (&ldb_ch->bridge,NULL ); } }EXPORT_SYMBOL_GPL (ldb_add_bridge_helper);
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c +1 -2
@@ -165,10 +165,9 @@ static int imx8mp_hdmi_pvi_probe(struct platform_device *pdev)/* Register the bridge. */ pvi->bridge.funcs = &imx_hdmi_pvi_bridge_funcs; - pvi->bridge.of_node = pdev->dev.of_node; pvi->bridge.timings = pvi->next_bridge->timings; -drm_bridge_add (&pvi->bridge); +drm_bridge_add (&pvi->bridge, &pdev->dev);return 0 ; }
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +2 -1
@@ -335,9 +335,10 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev) ch->bridge.driver_private = ch; ch->bridge.funcs = &imx8qxp_pc_bridge_funcs; ch->bridge.of_node = child; + ch->bridge.fwnode =of_fwnode_handle (child); ch->is_available = true; -drm_bridge_add (&ch->bridge); +drm_bridge_add (&ch->bridge,NULL ); }return 0 ;
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c +1 -2
@@ -386,9 +386,8 @@ static int imx8qxp_pixel_link_bridge_probe(struct platform_device *pdev) pl->bridge.driver_private = pl; pl->bridge.funcs = &imx8qxp_pixel_link_bridge_funcs; - pl->bridge.of_node = np; -drm_bridge_add (&pl->bridge); +drm_bridge_add (&pl->bridge, dev);return ret; }
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c +1 -2
@@ -443,9 +443,8 @@ static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev) p2d->bridge.driver_private = p2d; p2d->bridge.funcs = &imx8qxp_pxl2dpi_bridge_funcs; - p2d->bridge.of_node = np; -drm_bridge_add (&p2d->bridge); +drm_bridge_add (&p2d->bridge, dev);return ret; }
drivers/gpu/drm/bridge/ite-it6505.c +1 -2
@@ -3399,7 +3399,6 @@ static int it6505_i2c_probe(struct i2c_client *client)mutex_init (&it6505->mode_lock);mutex_init (&it6505->aux_lock); - it6505->bridge.of_node = client->dev.of_node; it6505->connector_status = connector_status_disconnected; it6505->dev = &client->dev;i2c_set_clientdata (client, it6505);
@@ -3471,7 +3470,7 @@ static int it6505_i2c_probe(struct i2c_client *client) it6505->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; it6505->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID |DRM_BRIDGE_OP_HPD ; -drm_bridge_add (&it6505->bridge); +drm_bridge_add (&it6505->bridge, dev);return 0 ; }
drivers/gpu/drm/bridge/ite-it66121.c +1 -2
@@ -1578,7 +1578,6 @@ static int it66121_probe(struct i2c_client *client) } ctx->bridge.funcs = &it66121_bridge_funcs; - ctx->bridge.of_node = dev->of_node; ctx->bridge.type =DRM_MODE_CONNECTOR_HDMIA ; ctx->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID ;if (client->irq >0 ) {
@@ -1596,7 +1595,7 @@ static int it66121_probe(struct i2c_client *client)it66121_audio_codec_init (ctx, dev); -drm_bridge_add (&ctx->bridge); +drm_bridge_add (&ctx->bridge, dev);dev_info (ctx->dev,"IT66121 revision %d probed\n" , revision_id);
drivers/gpu/drm/bridge/lontium-lt8912b.c +1 -2
@@ -777,11 +777,10 @@ static int lt8912_probe(struct i2c_client *client)i2c_set_clientdata (client, lt); lt->bridge.funcs = <8912_bridge_funcs; - lt->bridge.of_node = dev->of_node; lt->bridge.ops = (DRM_BRIDGE_OP_EDID |DRM_BRIDGE_OP_DETECT ); -drm_bridge_add (<->bridge); +drm_bridge_add (<->bridge, dev); ret =lt8912_attach_dsi (lt);if (ret)
drivers/gpu/drm/bridge/lontium-lt9211.c +1 -2
@@ -756,8 +756,7 @@ static int lt9211_probe(struct i2c_client *client)i2c_set_clientdata (client, ctx); ctx->bridge.funcs = <9211_funcs; - ctx->bridge.of_node = dev->of_node; -drm_bridge_add (&ctx->bridge); +drm_bridge_add (&ctx->bridge, dev); ret =lt9211_host_attach (ctx);if (ret)
drivers/gpu/drm/bridge/lontium-lt9611.c +1 -2
@@ -1114,12 +1114,11 @@ static int lt9611_probe(struct i2c_client *client)i2c_set_clientdata (client, lt9611); lt9611->bridge.funcs = <9611_bridge_funcs; - lt9611->bridge.of_node = client->dev.of_node; lt9611->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID |DRM_BRIDGE_OP_HPD |DRM_BRIDGE_OP_MODES ; lt9611->bridge.type =DRM_MODE_CONNECTOR_HDMIA ; -drm_bridge_add (<9611->bridge); +drm_bridge_add (<9611->bridge, dev);/* Attach primary DSI */ lt9611->dsi0 =lt9611_attach_dsi (lt9611, lt9611->dsi0_node);
drivers/gpu/drm/bridge/lontium-lt9611uxc.c +1 -2
@@ -934,13 +934,12 @@ static int lt9611uxc_probe(struct i2c_client *client)i2c_set_clientdata (client, lt9611uxc); lt9611uxc->bridge.funcs = <9611uxc_bridge_funcs; - lt9611uxc->bridge.of_node = client->dev.of_node; lt9611uxc->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID ;if (lt9611uxc->hpd_supported) lt9611uxc->bridge.ops |=DRM_BRIDGE_OP_HPD ; lt9611uxc->bridge.type =DRM_MODE_CONNECTOR_HDMIA ; -drm_bridge_add (<9611uxc->bridge); +drm_bridge_add (<9611uxc->bridge, dev);/* Attach primary DSI */ lt9611uxc->dsi0 =lt9611uxc_attach_dsi (lt9611uxc, lt9611uxc->dsi0_node);
drivers/gpu/drm/bridge/lvds-codec.c +1 -2
@@ -201,9 +201,8 @@ static int lvds_codec_probe(struct platform_device *pdev)* but we need a bridge attached to our of_node for our user * to look up. */ - lvds_codec->bridge.of_node = dev->of_node; lvds_codec->bridge.timings = &lvds_codec->timings; -drm_bridge_add (&lvds_codec->bridge); +drm_bridge_add (&lvds_codec->bridge, dev);platform_set_drvdata (pdev, lvds_codec);
drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +1 -2
@@ -274,8 +274,7 @@ static int ge_b850v3_register(void) ge_b850v3_lvds_ptr->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID ; ge_b850v3_lvds_ptr->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; - ge_b850v3_lvds_ptr->bridge.of_node = dev->of_node; -drm_bridge_add (&ge_b850v3_lvds_ptr->bridge); +drm_bridge_add (&ge_b850v3_lvds_ptr->bridge, dev);/* Clear pending interrupts since power up. */ i2c_smbus_write_word_data(stdp4028_i2c,
drivers/gpu/drm/bridge/microchip-lvds.c +1 -2
@@ -190,7 +190,6 @@ static int mchp_lvds_probe(struct platform_device *pdev)if (IS_ERR (lvds->panel_bridge))return PTR_ERR (lvds->panel_bridge); - lvds->bridge.of_node = dev->of_node; lvds->bridge.type =DRM_MODE_CONNECTOR_LVDS ; lvds->bridge.funcs = &mchp_lvds_bridge_funcs;
@@ -201,7 +200,7 @@ static int mchp_lvds_probe(struct platform_device *pdev)return ret; } -drm_bridge_add (&lvds->bridge); +drm_bridge_add (&lvds->bridge, dev);return 0 ; }
drivers/gpu/drm/bridge/nwl-dsi.c +1 -2
@@ -1182,7 +1182,6 @@ static int nwl_dsi_probe(struct platform_device *pdev) dsi->bridge.driver_private = dsi; dsi->bridge.funcs = &nwl_dsi_bridge_funcs; - dsi->bridge.of_node = dev->of_node; dsi->bridge.timings = &nwl_dsi_timings;dev_set_drvdata (dev, dsi);
@@ -1195,7 +1194,7 @@ static int nwl_dsi_probe(struct platform_device *pdev)return ret; } -drm_bridge_add (&dsi->bridge); +drm_bridge_add (&dsi->bridge, dev);return 0 ; }
drivers/gpu/drm/bridge/nxp-ptn3460.c +1 -2
@@ -303,8 +303,7 @@ static int ptn3460_probe(struct i2c_client *client) ptn_bridge->bridge.funcs = &ptn3460_bridge_funcs; ptn_bridge->bridge.ops =DRM_BRIDGE_OP_EDID ; ptn_bridge->bridge.type =DRM_MODE_CONNECTOR_LVDS ; - ptn_bridge->bridge.of_node = dev->of_node; -drm_bridge_add (&ptn_bridge->bridge); +drm_bridge_add (&ptn_bridge->bridge, dev);i2c_set_clientdata (client, ptn_bridge);
drivers/gpu/drm/bridge/panel.c +1 -2
@@ -299,11 +299,10 @@ struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel, panel_bridge->panel = panel; panel_bridge->bridge.funcs = &panel_bridge_bridge_funcs; - panel_bridge->bridge.of_node = panel->dev->of_node; panel_bridge->bridge.ops =DRM_BRIDGE_OP_MODES ; panel_bridge->bridge.type = connector_type; -drm_bridge_add (&panel_bridge->bridge); +drm_bridge_add (&panel_bridge->bridge, panel->dev);return &panel_bridge->bridge; }
drivers/gpu/drm/bridge/parade-ps8622.c +1 -2
@@ -511,8 +511,7 @@ static int ps8622_probe(struct i2c_client *client) ps8622->bridge.funcs = &ps8622_bridge_funcs; ps8622->bridge.type =DRM_MODE_CONNECTOR_LVDS ; - ps8622->bridge.of_node = dev->of_node; -drm_bridge_add (&ps8622->bridge); +drm_bridge_add (&ps8622->bridge, dev);i2c_set_clientdata (client, ps8622);
drivers/gpu/drm/bridge/parade-ps8640.c +0 -1
@@ -663,7 +663,6 @@ static int ps8640_probe(struct i2c_client *client)return PTR_ERR (ps_bridge->gpio_reset); ps_bridge->bridge.funcs = &ps8640_bridge_funcs; - ps_bridge->bridge.of_node = dev->of_node; ps_bridge->bridge.type = DRM_MODE_CONNECTOR_eDP;/*
drivers/gpu/drm/bridge/samsung-dsim.c +1 -2
@@ -1739,7 +1739,7 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host,mipi_dsi_pixel_format_to_bpp (device->format), device->mode_flags); -drm_bridge_add (&dsi->bridge); +drm_bridge_add (&dsi->bridge, dev);/* * This is a temporary solution and should be made by more generic way.
@@ -1987,7 +1987,6 @@ int samsung_dsim_probe(struct platform_device *pdev)pm_runtime_enable (dev); dsi->bridge.funcs = &samsung_dsim_bridge_funcs; - dsi->bridge.of_node = dev->of_node; dsi->bridge.type =DRM_MODE_CONNECTOR_DSI ;/* DE_LOW: i.MX8M Mini/Nano LCDIF-DSIM glue logic inverts HS/VS/DE */
drivers/gpu/drm/bridge/sii902x.c +1 -2
@@ -1097,14 +1097,13 @@ static int sii902x_init(struct sii902x *sii902x) goto err_unreg_audio; sii902x->bridge.funcs = &sii902x_bridge_funcs; - sii902x->bridge.of_node = dev->of_node; sii902x->bridge.timings = &default_sii902x_timings; sii902x->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID ;if (sii902x->i2c->irq >0 ) sii902x->bridge.ops |=DRM_BRIDGE_OP_HPD ; -drm_bridge_add (&sii902x->bridge); +drm_bridge_add (&sii902x->bridge, dev);return 0 ;
drivers/gpu/drm/bridge/sii9234.c +1 -2
@@ -922,8 +922,7 @@ static int sii9234_probe(struct i2c_client *client)i2c_set_clientdata (client, ctx); ctx->bridge.funcs = &sii9234_bridge_funcs; - ctx->bridge.of_node = dev->of_node; -drm_bridge_add (&ctx->bridge); +drm_bridge_add (&ctx->bridge, dev);sii9234_cable_in (ctx);
drivers/gpu/drm/bridge/sil-sii8620.c +1 -2
@@ -2336,8 +2336,7 @@ static int sii8620_probe(struct i2c_client *client)i2c_set_clientdata (client, ctx); ctx->bridge.funcs = &sii8620_bridge_funcs; - ctx->bridge.of_node = dev->of_node; -drm_bridge_add (&ctx->bridge); +drm_bridge_add (&ctx->bridge, dev);if (!ctx->extcon)sii8620_cable_in (ctx);
drivers/gpu/drm/bridge/simple-bridge.c +1 -2
@@ -205,10 +205,9 @@ static int simple_bridge_probe(struct platform_device *pdev)/* Register the bridge. */ sbridge->bridge.funcs = &simple_bridge_bridge_funcs; - sbridge->bridge.of_node = pdev->dev.of_node; sbridge->bridge.timings = sbridge->info->timings; -drm_bridge_add (&sbridge->bridge); +drm_bridge_add (&sbridge->bridge, &pdev->dev);return 0 ; }
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -2
@@ -3525,7 +3525,6 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, | DRM_BRIDGE_OP_HPD; hdmi->bridge.interlace_allowed = true; hdmi->bridge.ddc = hdmi->ddc; - hdmi->bridge.of_node = pdev->dev.of_node; hdmi->bridge.type =DRM_MODE_CONNECTOR_HDMIA ;memset (&pdevinfo,0 ,sizeof (pdevinfo));
@@ -3599,7 +3598,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, hdmi->cec =platform_device_register_full (&pdevinfo); } -drm_bridge_add (&hdmi->bridge); +drm_bridge_add (&hdmi->bridge, dev);return hdmi;
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -2
@@ -339,7 +339,7 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, bridge->pre_enable_prev_first = true; dsi->panel_bridge = bridge; -drm_bridge_add (&dsi->bridge); +drm_bridge_add (&dsi->bridge, dsi->dev);if (pdata->host_ops && pdata->host_ops->attach) { ret = pdata->host_ops->attach (pdata->priv_data, device);
@@ -1260,7 +1260,6 @@ __dw_mipi_dsi_probe(struct platform_device *pdev, dsi->bridge.driver_private = dsi; dsi->bridge.funcs = &dw_mipi_dsi_bridge_funcs; - dsi->bridge.of_node = pdev->dev.of_node;return dsi; }
drivers/gpu/drm/bridge/tc358762.c +1 -2
@@ -286,10 +286,9 @@ static int tc358762_probe(struct mipi_dsi_device *dsi) ctx->bridge.funcs = &tc358762_bridge_funcs; ctx->bridge.type =DRM_MODE_CONNECTOR_DPI ; - ctx->bridge.of_node = dev->of_node; ctx->bridge.pre_enable_prev_first = true; -drm_bridge_add (&ctx->bridge); +drm_bridge_add (&ctx->bridge, dev); ret =mipi_dsi_attach (dsi);if (ret <0 ) {
drivers/gpu/drm/bridge/tc358764.c +1 -2
@@ -368,10 +368,9 @@ static int tc358764_probe(struct mipi_dsi_device *dsi)return ret; ctx->bridge.funcs = &tc358764_bridge_funcs; - ctx->bridge.of_node = dev->of_node; ctx->bridge.pre_enable_prev_first = true; -drm_bridge_add (&ctx->bridge); +drm_bridge_add (&ctx->bridge, dev); ret =mipi_dsi_attach (dsi);if (ret <0 ) {
drivers/gpu/drm/bridge/tc358767.c +1 -2
@@ -2462,8 +2462,7 @@ static int tc_probe(struct i2c_client *client)return ret; } - tc->bridge.of_node = dev->of_node; -drm_bridge_add (&tc->bridge); +drm_bridge_add (&tc->bridge, dev);i2c_set_clientdata (client, tc);
drivers/gpu/drm/bridge/tc358768.c +1 -2
@@ -451,7 +451,7 @@ static int tc358768_dsi_host_attach(struct mipi_dsi_host *host,if (ret) priv->pd_lines = priv->dsi_bpp; -drm_bridge_add (&priv->bridge); +drm_bridge_add (&priv->bridge, priv->dev);return 0 ; }
@@ -1299,7 +1299,6 @@ static int tc358768_i2c_probe(struct i2c_client *client) priv->bridge.funcs = &tc358768_bridge_funcs; priv->bridge.timings = &default_tc358768_timings; - priv->bridge.of_node = np;i2c_set_clientdata (client, priv);
drivers/gpu/drm/bridge/tc358775.c +1 -2
@@ -706,9 +706,8 @@ static int tc_probe(struct i2c_client *client) } tc->bridge.funcs = &tc_bridge_funcs; - tc->bridge.of_node = dev->of_node; tc->bridge.pre_enable_prev_first = true; -drm_bridge_add (&tc->bridge); +drm_bridge_add (&tc->bridge, dev);i2c_set_clientdata (client, tc);
drivers/gpu/drm/bridge/thc63lvd1024.c +1 -2
@@ -206,11 +206,10 @@ static int thc63_probe(struct platform_device *pdev)return ret; thc63->bridge.driver_private = thc63; - thc63->bridge.of_node = pdev->dev.of_node; thc63->bridge.funcs = &thc63_bridge_func; thc63->bridge.timings = &thc63->timings; -drm_bridge_add (&thc63->bridge); +drm_bridge_add (&thc63->bridge, &pdev->dev);return 0 ; }
drivers/gpu/drm/bridge/ti-dlpc3433.c +1 -2
@@ -366,8 +366,7 @@ static int dlpc3433_probe(struct i2c_client *client)i2c_set_clientdata (client, dlpc); dlpc->bridge.funcs = &dlpc_bridge_funcs; - dlpc->bridge.of_node = dev->of_node; -drm_bridge_add (&dlpc->bridge); +drm_bridge_add (&dlpc->bridge, dev); ret =dlpc_host_attach (dlpc);if (ret)
drivers/gpu/drm/bridge/ti-sn65dsi83.c +1 -2
@@ -708,9 +708,8 @@ static int sn65dsi83_probe(struct i2c_client *client)i2c_set_clientdata (client, ctx); ctx->bridge.funcs = &sn65dsi83_funcs; - ctx->bridge.of_node = dev->of_node; ctx->bridge.pre_enable_prev_first = true; -drm_bridge_add (&ctx->bridge); +drm_bridge_add (&ctx->bridge, dev); ret =sn65dsi83_host_attach (ctx);if (ret) {
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -2
@@ -1312,14 +1312,13 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev,return ret; pdata->bridge.funcs = &ti_sn_bridge_funcs; - pdata->bridge.of_node = np; pdata->bridge.type = pdata->next_bridge->type == DRM_MODE_CONNECTOR_DisplayPort ? DRM_MODE_CONNECTOR_DisplayPort : DRM_MODE_CONNECTOR_eDP;if (pdata->bridge.type == DRM_MODE_CONNECTOR_DisplayPort) pdata->bridge.ops =DRM_BRIDGE_OP_EDID |DRM_BRIDGE_OP_DETECT ; -drm_bridge_add (&pdata->bridge); +drm_bridge_add (&pdata->bridge, pdata->dev); ret =ti_sn_attach_host (adev, pdata);if (ret) {
drivers/gpu/drm/bridge/ti-tfp410.c +1 -2
@@ -348,7 +348,6 @@ static int tfp410_init(struct device *dev, bool i2c)dev_set_drvdata (dev, dvi); dvi->bridge.funcs = &tfp410_bridge_funcs; - dvi->bridge.of_node = dev->of_node; dvi->bridge.timings = &dvi->timings; dvi->bridge.type =DRM_MODE_CONNECTOR_DVID ;
@@ -376,7 +375,7 @@ static int tfp410_init(struct device *dev, bool i2c) }/* Register the DRM bridge. */ -drm_bridge_add (&dvi->bridge); +drm_bridge_add (&dvi->bridge, dev);return 0 ; }
drivers/gpu/drm/bridge/ti-tpd12s015.c +1 -2
@@ -122,7 +122,6 @@ static int tpd12s015_probe(struct platform_device *pdev)platform_set_drvdata (pdev, tpd); tpd->bridge.funcs = &tpd12s015_bridge_funcs; - tpd->bridge.of_node = pdev->dev.of_node; tpd->bridge.type =DRM_MODE_CONNECTOR_HDMIA ; tpd->bridge.ops =DRM_BRIDGE_OP_DETECT ;
@@ -174,7 +173,7 @@ static int tpd12s015_probe(struct platform_device *pdev) }/* Register the DRM bridge. */ -drm_bridge_add (&tpd->bridge); +drm_bridge_add (&tpd->bridge, &pdev->dev);return 0 ; }
drivers/gpu/drm/drm_bridge.c +14 -2
@@ -202,11 +202,23 @@ static LIST_HEAD(bridge_list);* drm_bridge_add - add the given bridge to the global bridge list * * @bridge: bridge control structure +* @dev: pointer to the kernel device that backing this bridge */ -void drm_bridge_add (struct drm_bridge *bridge) +void drm_bridge_add (struct drm_bridge *bridge,struct device *dev) {mutex_init (&bridge->hpd_mutex); +if (dev) { +if (dev->of_node) { + bridge->of_node = dev->of_node; + bridge->fwnode =of_fwnode_handle (dev->of_node); + }else { + bridge->fwnode = dev->fwnode; + } + + bridge->kdev = dev; + } +mutex_lock (&bridge_lock);list_add_tail (&bridge->list, &bridge_list);mutex_unlock (&bridge_lock);
@@ -231,7 +243,7 @@ static void drm_bridge_remove_void(void *bridge)*/ int devm_drm_bridge_add (struct device *dev,struct drm_bridge *bridge) { -drm_bridge_add (bridge); +drm_bridge_add (bridge, dev);return devm_add_action_or_reset (dev, drm_bridge_remove_void, bridge); }EXPORT_SYMBOL (devm_drm_bridge_add);
drivers/gpu/drm/exynos/exynos_drm_mic.c +1 -2
@@ -422,9 +422,8 @@ static int exynos_mic_probe(struct platform_device *pdev)platform_set_drvdata (pdev, mic); mic->bridge.funcs = &mic_bridge_funcs; - mic->bridge.of_node = dev->of_node; -drm_bridge_add (&mic->bridge); +drm_bridge_add (&mic->bridge, dev);pm_runtime_enable (dev);
drivers/gpu/drm/i2c/tda998x_drv.c +1 -4
@@ -1989,11 +1989,8 @@ static int tda998x_create(struct device *dev) } priv->bridge.funcs = &tda998x_bridge_funcs; -#ifdef CONFIG_OF - priv->bridge.of_node = dev->of_node; -#endif -drm_bridge_add (&priv->bridge); +drm_bridge_add (&priv->bridge, dev);return 0 ;
drivers/gpu/drm/mcde/mcde_dsi.c +1 -2
@@ -1138,8 +1138,7 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,/* Create a bridge for this DSI channel */ d->bridge.funcs = &mcde_dsi_bridge_funcs; - d->bridge.of_node = dev->of_node; -drm_bridge_add (&d->bridge); +drm_bridge_add (&d->bridge, dev);/* TODO: first come first serve, use a list */ mcde->bridge = &d->bridge;
drivers/gpu/drm/mediatek/mtk_dsi.c +1 -2
@@ -908,7 +908,7 @@ static int mtk_dsi_host_attach(struct mipi_dsi_host *host,if (IS_ERR (dsi->next_bridge))return PTR_ERR (dsi->next_bridge); -drm_bridge_add (&dsi->bridge); +drm_bridge_add (&dsi->bridge, dev); ret =component_add (host->dev, &mtk_dsi_component_ops);if (ret) {
@@ -1155,7 +1155,6 @@ static int mtk_dsi_probe(struct platform_device *pdev)platform_set_drvdata (pdev, dsi); dsi->bridge.funcs = &mtk_dsi_bridge_funcs; - dsi->bridge.of_node = dev->of_node; dsi->bridge.type =DRM_MODE_CONNECTOR_DSI ;return 0 ;
drivers/gpu/drm/mediatek/mtk_hdmi.c +1 -2
@@ -1735,11 +1735,10 @@ static int mtk_hdmi_probe(struct platform_device *pdev) } hdmi->bridge.funcs = &mtk_hdmi_bridge_funcs; - hdmi->bridge.of_node = pdev->dev.of_node; hdmi->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID |DRM_BRIDGE_OP_HPD ; hdmi->bridge.type =DRM_MODE_CONNECTOR_HDMIA ; -drm_bridge_add (&hdmi->bridge); +drm_bridge_add (&hdmi->bridge, &pdev->dev); ret =mtk_hdmi_clk_enable_audio (hdmi);if (ret) {
drivers/gpu/drm/meson/meson_encoder_cvbs.c +1 -2
@@ -246,12 +246,11 @@ int meson_encoder_cvbs_probe(struct meson_drm *priv)/* CVBS Encoder Bridge */ meson_encoder_cvbs->bridge.funcs = &meson_encoder_cvbs_bridge_funcs; - meson_encoder_cvbs->bridge.of_node = priv->dev->of_node; meson_encoder_cvbs->bridge.type = DRM_MODE_CONNECTOR_Composite; meson_encoder_cvbs->bridge.ops =DRM_BRIDGE_OP_MODES ; meson_encoder_cvbs->bridge.interlace_allowed = true; -drm_bridge_add (&meson_encoder_cvbs->bridge); +drm_bridge_add (&meson_encoder_cvbs->bridge, priv->dev); meson_encoder_cvbs->priv = priv;
drivers/gpu/drm/meson/meson_encoder_dsi.c +1 -2
@@ -124,10 +124,9 @@ int meson_encoder_dsi_probe(struct meson_drm *priv)/* DSI Encoder Bridge */ meson_encoder_dsi->bridge.funcs = &meson_encoder_dsi_bridge_funcs; - meson_encoder_dsi->bridge.of_node = priv->dev->of_node; meson_encoder_dsi->bridge.type =DRM_MODE_CONNECTOR_DSI ; -drm_bridge_add (&meson_encoder_dsi->bridge); +drm_bridge_add (&meson_encoder_dsi->bridge, priv->dev); meson_encoder_dsi->priv = priv;
drivers/gpu/drm/meson/meson_encoder_hdmi.c +1 -2
@@ -393,11 +393,10 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv)/* HDMI Encoder Bridge */ meson_encoder_hdmi->bridge.funcs = &meson_encoder_hdmi_bridge_funcs; - meson_encoder_hdmi->bridge.of_node = priv->dev->of_node; meson_encoder_hdmi->bridge.type =DRM_MODE_CONNECTOR_HDMIA ; meson_encoder_hdmi->bridge.interlace_allowed = true; -drm_bridge_add (&meson_encoder_hdmi->bridge); +drm_bridge_add (&meson_encoder_hdmi->bridge, priv->dev); meson_encoder_hdmi->priv = priv;
drivers/gpu/drm/omapdrm/dss/dpi.c +1 -2
@@ -561,10 +561,9 @@ static const struct drm_bridge_funcs dpi_bridge_funcs = {static void dpi_bridge_init (struct dpi_data *dpi) { dpi->bridge.funcs = &dpi_bridge_funcs; - dpi->bridge.of_node = dpi->pdev->dev.of_node; dpi->bridge.type =DRM_MODE_CONNECTOR_DPI ; -drm_bridge_add (&dpi->bridge); +drm_bridge_add (&dpi->bridge, &dpi->pdev->dev); }static void dpi_bridge_cleanup (struct dpi_data *dpi)
drivers/gpu/drm/omapdrm/dss/dsi.c +1 -2
@@ -4701,10 +4701,9 @@ static const struct drm_bridge_funcs dsi_bridge_funcs = {static void dsi_bridge_init (struct dsi_data *dsi) { dsi->bridge.funcs = &dsi_bridge_funcs; - dsi->bridge.of_node = dsi->host.dev->of_node; dsi->bridge.type =DRM_MODE_CONNECTOR_DSI ; -drm_bridge_add (&dsi->bridge); +drm_bridge_add (&dsi->bridge, dsi->host.dev); }static void dsi_bridge_cleanup (struct dsi_data *dsi)
drivers/gpu/drm/omapdrm/dss/hdmi4.c +1 -2
@@ -506,11 +506,10 @@ static const struct drm_bridge_funcs hdmi4_bridge_funcs = {static void hdmi4_bridge_init (struct omap_hdmi *hdmi) { hdmi->bridge.funcs = &hdmi4_bridge_funcs; - hdmi->bridge.of_node = hdmi->pdev->dev.of_node; hdmi->bridge.ops =DRM_BRIDGE_OP_EDID ; hdmi->bridge.type =DRM_MODE_CONNECTOR_HDMIA ; -drm_bridge_add (&hdmi->bridge); +drm_bridge_add (&hdmi->bridge, &hdmi->pdev->dev); }static void hdmi4_bridge_cleanup (struct omap_hdmi *hdmi)
drivers/gpu/drm/omapdrm/dss/hdmi5.c +1 -2
@@ -481,11 +481,10 @@ static const struct drm_bridge_funcs hdmi5_bridge_funcs = {static void hdmi5_bridge_init (struct omap_hdmi *hdmi) { hdmi->bridge.funcs = &hdmi5_bridge_funcs; - hdmi->bridge.of_node = hdmi->pdev->dev.of_node; hdmi->bridge.ops =DRM_BRIDGE_OP_EDID ; hdmi->bridge.type =DRM_MODE_CONNECTOR_HDMIA ; -drm_bridge_add (&hdmi->bridge); + drm_bridge_add(&hdmi->bridge, &hdmi->pdev->dev.); }static void hdmi5_bridge_cleanup (struct omap_hdmi *hdmi)
drivers/gpu/drm/omapdrm/dss/sdi.c +1 -2
@@ -283,10 +283,9 @@ static const struct drm_bridge_funcs sdi_bridge_funcs = {static void sdi_bridge_init (struct sdi_device *sdi) { sdi->bridge.funcs = &sdi_bridge_funcs; - sdi->bridge.of_node = sdi->pdev->dev.of_node; sdi->bridge.type =DRM_MODE_CONNECTOR_LVDS ; -drm_bridge_add (&sdi->bridge); +drm_bridge_add (&sdi->bridge, &sdi->pdev->dev); }static void sdi_bridge_cleanup (struct sdi_device *sdi)
drivers/gpu/drm/omapdrm/dss/venc.c +1 -2
@@ -664,12 +664,11 @@ static const struct drm_bridge_funcs venc_bridge_funcs = {static void venc_bridge_init (struct venc_device *venc) { venc->bridge.funcs = &venc_bridge_funcs; - venc->bridge.of_node = venc->pdev->dev.of_node; venc->bridge.ops =DRM_BRIDGE_OP_MODES ; venc->bridge.type =DRM_MODE_CONNECTOR_SVIDEO ; venc->bridge.interlace_allowed = true; -drm_bridge_add (&venc->bridge); +drm_bridge_add (&venc->bridge, &venc->pdev->dev); }static void venc_bridge_cleanup (struct venc_device *venc)
drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c +1 -2
@@ -896,7 +896,6 @@ static int rcar_lvds_probe(struct platform_device *pdev)return ret; lvds->bridge.funcs = &rcar_lvds_bridge_ops; - lvds->bridge.of_node = pdev->dev.of_node; lvds->mmio =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (lvds->mmio))
@@ -913,7 +912,7 @@ static int rcar_lvds_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev); -drm_bridge_add (&lvds->bridge); +drm_bridge_add (&lvds->bridge, &pdev->dev);return 0 ; }
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c +1 -2
@@ -918,8 +918,7 @@ static int rcar_mipi_dsi_host_attach(struct mipi_dsi_host *host,/* Initialize the DRM bridge. */ dsi->bridge.funcs = &rcar_mipi_dsi_bridge_ops; - dsi->bridge.of_node = dsi->dev->of_node; -drm_bridge_add (&dsi->bridge); +drm_bridge_add (&dsi->bridge, dsi->dev);return 0 ; }
drivers/gpu/drm/renesas/rcar-du/rzg2l_mipi_dsi.c +1 -2
@@ -636,7 +636,7 @@ static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,return ret; } -drm_bridge_add (&dsi->bridge); +drm_bridge_add (&dsi->bridge, dsi->dev);return 0 ; }
@@ -762,7 +762,6 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)/* Initialize the DRM bridge. */ dsi->bridge.funcs = &rzg2l_mipi_dsi_bridge_ops; - dsi->bridge.of_node = dsi->dev->of_node;/* Init host device */ dsi->host.dev = dsi->dev;
drivers/gpu/drm/sti/sti_dvo.c +1 -2
@@ -460,8 +460,7 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data) bridge->driver_private = dvo; bridge->funcs = &sti_dvo_bridge_funcs; - bridge->of_node = dvo->dev.of_node; -drm_bridge_add (bridge); +drm_bridge_add (bridge, &dvo->dev); err =drm_bridge_attach (encoder, bridge,NULL ,0 );if (err)
drivers/gpu/drm/vc4/vc4_dsi.c +1 -4
@@ -1379,7 +1379,7 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host,return 0 ; } -drm_bridge_add (&dsi->bridge); +drm_bridge_add (&dsi->bridge, &dsi->pdev->dev); ret =component_add (&dsi->pdev->dev, &vc4_dsi_ops);if (ret) {
@@ -1815,9 +1815,6 @@ static int vc4_dsi_dev_probe(struct platform_device *pdev) dsi->pdev = pdev; dsi->bridge.funcs = &vc4_dsi_bridge_funcs; -#ifdef CONFIG_OF - dsi->bridge.of_node = dev->of_node; -#endif dsi->bridge.type =DRM_MODE_CONNECTOR_DSI ; dsi->dsi_host.ops = &vc4_dsi_host_ops; dsi->dsi_host.dev = dev;
drivers/gpu/drm/xlnx/zynqmp_dpsub.c +1 -1
@@ -256,7 +256,7 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)if (ret) goto err_dp; -drm_bridge_add (dpsub->bridge); +drm_bridge_add (dpsub->bridge, &pdev->dev);if (dpsub->dma_enabled) { ret =zynqmp_dpsub_drm_init (dpsub);
include/drm/drm_bridge.h +3 -1
@@ -712,6 +712,8 @@ enum drm_bridge_ops {struct drm_bridge {/** @base: inherit from &drm_private_object */ struct drm_private_obj base; +/** @kdev: pointer to the kernel device that backing this bridge */ +struct device *kdev;/** @dev: DRM device this bridge belongs to */ struct drm_device *dev;/** @encoder: encoder to which this bridge is connected */
@@ -782,7 +784,7 @@ drm_priv_to_bridge(struct drm_private_obj *priv) return container_of(priv, struct drm_bridge, base); } -void drm_bridge_add (struct drm_bridge *bridge); +void drm_bridge_add (struct drm_bridge *bridge,struct device *dev);int devm_drm_bridge_add (struct device *dev,struct drm_bridge *bridge);void drm_bridge_remove (struct drm_bridge *bridge); int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
Signature · 1 line
2.34.1
Re: [PATCH v6 02/10] drm/bridge: Set firmware node of drm_bridge instances automatically
Quoted 21 lines · Sui Jingfeng
Normally, the
drm_bridge::of_nodewon't be used by bridge driver instances themselves. Rather, it is mainly used by other modules to find associated drm bridge drvier. Therefore, adding a drm bridge to the global bridge list and setting 'of_node' field of a drm bridge share the same goal. Both are for finding purpose, therefore better to group them to one function.Update the
drm_bridge_add()interface and implementation to achieve such goal atomically, new implementation will fetch the device node from the backing device of the drm bridge driver automatically. For the majority cases, which is one device backing one drm bridge driver, this model works well. Drivers still can set it manually by passing NULL if this model doesn't fit.While at it, Add a 'struct device *' pointer to the
drm_bridgestructure. As it already being passed in by both ofdrm_bridge_add()anddevm_drm_bridge_add(). A lot of driver instances has already added it into their derived structure, promote it intodrm_bridgecore helps to reduce a batch of boilerplates.Signed-off-by Sui Jingfeng <[email protected]>---
[trimmed]
drivers/gpu/drm/drm_bridge.c static void drm_bridge_remove_void(void *bridge) · line 247
Quoted 7 lines
drivers/gpu/drm/drm_bridge.c +1
-1@@ -231,7 +243,7 @@ static void drm_bridge_remove_void(void *bridge)*/ int devm_drm_bridge_add (struct device *dev,struct drm_bridge *bridge) { -drm_bridge_add (bridge); +drm_bridge_add (bridge, dev);return devm_add_action_or_reset (dev, drm_bridge_remove_void, bridge);
This breaks aux-hpd-bridge, which gets of_node as an external pointer rather than dev->of_node.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v6 02/10] drm/bridge: Set firmware node of drm_bridge instances automatically
Hi,
Quoted 25 lines · Dmitry Baryshkov
Quoted 21 lines · Sui Jingfeng
Normally, the
drm_bridge::of_nodewon't be used by bridge driver instances themselves. Rather, it is mainly used by other modules to find associated drm bridge drvier. Therefore, adding a drm bridge to the global bridge list and setting 'of_node' field of a drm bridge share the same goal. Both are for finding purpose, therefore better to group them to one function.Update the
drm_bridge_add()interface and implementation to achieve such goal atomically, new implementation will fetch the device node from the backing device of the drm bridge driver automatically. For the majority cases, which is one device backing one drm bridge driver, this model works well. Drivers still can set it manually by passing NULL if this model doesn't fit.While at it, Add a 'struct device *' pointer to the
drm_bridgestructure. As it already being passed in by both ofdrm_bridge_add()anddevm_drm_bridge_add(). A lot of driver instances has already added it into their derived structure, promote it intodrm_bridgecore helps to reduce a batch of boilerplates.Signed-off-by Sui Jingfeng <[email protected]>---
[trimmed]
Quoted 11 lines
drivers/gpu/drm/drm_bridge.c static void drm_bridge_remove_void(void *bridge) · line 247
Quoted 7 lines
drivers/gpu/drm/drm_bridge.c +1
-1@@ -231,7 +243,7 @@ static void drm_bridge_remove_void(void *bridge)*/ int devm_drm_bridge_add (struct device *dev,struct drm_bridge *bridge) { -drm_bridge_add (bridge); +drm_bridge_add (bridge, dev);return devm_add_action_or_reset (dev, drm_bridge_remove_void, bridge);This breaks aux-hpd-bridge, which gets
of_nodeas an external pointer rather thandev->of_node.
Yes, you are right. I forget to modify that driver. My bad, will be fixed at the next version.
Signature · 2 lines
Best regards Sui
kernel test robot
build botRe: [PATCH v6 02/10] drm/bridge: Set firmware node of drm_bridge instances automatically
In reply to Sui Jingfengkernel test robot noticed the following build errors:
Hi Sui,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-exynos/exynos-drm-next]
[also build test ERROR on linus/master v6.10-rc1 next-20240523] [cannot apply to shawnguo/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sui-Jingfeng/drm-bridge-Allow-using-fwnode-APIs-to-get-the-next-bridge/20240527-042402 base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next patch link: https://lore.kernel.org/r/20240526202115.129049-3-sui.jingfeng%40linux.dev patch subject: [PATCH v6 02/10] drm/bridge: Set firmware node of drm_bridge instances automatically config: arm-defconfig (https://download.01.org/0day-ci/archive/20240527/[email protected]/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240527/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/omapdrm/dss/hdmi5.c:487:49: error: expected identifier
drm_bridge_add(&hdmi->bridge, &hdmi->pdev->dev.);
^1 error generated.
vim +487 drivers/gpu/drm/omapdrm/dss/hdmi5.c
480
481 static void hdmi5_bridge_init(struct omap_hdmi *hdmi)
482 {
483 hdmi->bridge.funcs = &hdmi5_bridge_funcs;
484 hdmi->bridge.ops = DRM_BRIDGE_OP_EDID;
485 hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
486
> 487 drm_bridge_add(&hdmi->bridge, &hdmi->pdev->dev.);
488 }
489
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH v6 02/10] drm/bridge: Set firmware node of drm_bridge instances automatically
Hi,
Quoted 41 lines · kernel test robot
Hi Sui,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-exynos/exynos-drm-next]
[also build test ERROR on linus/master v6.10-rc1 next-20240523] [cannot apply to shawnguo/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Sui-Jingfeng/drm-bridge-Allow-using-fwnode-APIs-to-get-the-next-bridge/20240527-042402 base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next patch link: https://lore.kernel.org/r/20240526202115.129049-3-sui.jingfeng%40linux.dev patch subject: [PATCH v6 02/10] drm/bridge: Set firmware node of drm_bridge instances automatically config: arm-defconfig (https://download.01.org/0day-ci/archive/20240527/[email protected]/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240527/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/omapdrm/dss/hdmi5.c:487:49: error: expected identifierdrm_bridge_add(&hdmi->bridge, &hdmi->pdev->dev.); ^ 1 error generated.vim +487
drivers/gpu/drm/omapdrm/dss/hdmi5.c480 481 static void hdmi5_bridge_init(struct omap_hdmi *hdmi) 482 { 483 hdmi->bridge.funcs = &hdmi5_bridge_funcs; 484 hdmi->bridge.ops = DRM_BRIDGE_OP_EDID; 485 hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA; 486
Quoted 4 lines
Quoted 1 line
487
drm_bridge_add(&hdmi->bridge, &hdmi->pdev->dev.);488 } 489
Sorry, my bad. I have do compile test on ARM64 before posting. checkpatch.pl report a style problem, then I manually modify this patch, accidentally add the tail '.' character. Will be fixed at the next version.
Signature · 2 lines
Best regards Sui
PATCH v6 3/10 drm/bridge: Implement of_drm_find_bridge() on the top of drm_bridge_find_by_fwnode()
In reply to Sui JingfengBefore applying this patch, people may worry about the OF and non-OF API will have a risk to diverge. Eliminate the risk by reimplement the of_drm_find_bridge() on the top of drm_bridge_find_by_fwnode(). As for now the fundamental searching method is unique.
--- drivers/gpu/drm/drm_bridge.c | 29 ----------------------------- include/drm/drm_bridge.h | 14 +++++--------- 2 files changed, 5 insertions(+), 38 deletions(-)
drivers/gpu/drm/drm_bridge.c +0 -29
@@ -1346,35 +1346,6 @@ void drm_bridge_hpd_notify(struct drm_bridge *bridge, }EXPORT_SYMBOL_GPL (drm_bridge_hpd_notify); -#ifdef CONFIG_OF -/** -* of_drm_find_bridge - find the bridge corresponding to the device node in -* the global bridge list -* -* @np: device node -* -* RETURNS: -* drm_bridge control struct on success, NULL on failure -*/ -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 -/** * drm_bridge_find_by_fwnode - Find the bridge corresponding to the fwnode *
include/drm/drm_bridge.h +5 -9
@@ -791,21 +791,17 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,struct drm_bridge *previous, enum drm_bridge_attach_flags flags); -#ifdef CONFIG_OF -struct drm_bridge *of_drm_find_bridge (struct device_node *np); -#else -static inline struct drm_bridge *of_drm_find_bridge (struct device_node *np) -{ -return NULL ; -} -#endif -struct drm_bridge *drm_bridge_find_by_fwnode (struct fwnode_handle *fwnode);struct drm_bridge *drm_bridge_find_next_bridge_by_fwnode (struct fwnode_handle *fwnode,u32 port); +static inline struct drm_bridge *of_drm_find_bridge (struct device_node *np) +{ +return drm_bridge_find_by_fwnode (of_fwnode_handle (np)); +} +/** * drm_bridge_get_next_bridge() - Get the next bridge in the chain * @bridge: bridge object
Signature · 1 line
2.34.1
PATCH v6 4/10 drm/bridge: simple-bridge: Use fwnode APIs to acquire device properties
In reply to Sui JingfengMake this driver less DT-dependent by calling the newly created helpers, also switch to use fwnode APIs to acquire additional device properties. A side benifit is that boilerplates get reduced, no functional changes for DT-based systems.
--- drivers/gpu/drm/bridge/simple-bridge.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/simple-bridge.c +9 -12
@@ -8,8 +8,6 @@#include <linux/gpio/consumer.h> #include <linux/module.h> -#include <linux/of.h> -#include <linux/of_graph.h> #include <linux/platform_device.h> #include <linux/regulator/consumer.h>
@@ -164,33 +162,32 @@ static const struct drm_bridge_funcs simple_bridge_bridge_funcs = {static int simple_bridge_probe (struct platform_device *pdev) { +struct fwnode_handle *fwnode =dev_fwnode (&pdev->dev);struct simple_bridge *sbridge; -struct device_node *remote; +int ret; sbridge =devm_kzalloc (&pdev->dev,sizeof (*sbridge),GFP_KERNEL );if (!sbridge)return -ENOMEM ;platform_set_drvdata (pdev, sbridge); - sbridge->info =of_device_get_match_data (&pdev->dev); + sbridge->info =device_get_match_data (&pdev->dev);/* Get the next bridge in the pipeline. */ - remote =of_graph_get_remote_node (pdev->dev.of_node,1 ,-1 ); -if (!remote) -return -EINVAL ; - - sbridge->next_bridge =of_drm_find_bridge (remote); -of_node_put (remote); - + sbridge->next_bridge =drm_bridge_find_next_bridge_by_fwnode (fwnode,1 );if (!sbridge->next_bridge) {dev_dbg (&pdev->dev,"Next bridge not found, deferring probe\n" );return -EPROBE_DEFER ; + }else if (IS_ERR (sbridge->next_bridge)) { + ret =PTR_ERR (sbridge->next_bridge); +dev_err (&pdev->dev,"Error on finding the next bridge: %d\n" , ret); +return ret; }/* Get the regulator and GPIO resources. */ sbridge->vdd =devm_regulator_get_optional (&pdev->dev,"vdd" );if (IS_ERR (sbridge->vdd)) { -int ret =PTR_ERR (sbridge->vdd); + ret =PTR_ERR (sbridge->vdd);if (ret == -EPROBE_DEFER )return -EPROBE_DEFER ; sbridge->vdd =NULL ;
Signature · 1 line
2.34.1
PATCH v6 5/10 drm/bridge: display-connector: Use fwnode APIs to acquire device properties
In reply to Sui JingfengSwitch to use the fwnode APIs, which is a fundamental step to make this driver OF-independent possible. No functional changes for DT-based systems.
--- drivers/gpu/drm/bridge/display-connector.c | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/display-connector.c +11 -12
@@ -9,7 +9,6 @@#include <linux/media-bus-format.h> #include <linux/module.h> #include <linux/mutex.h> -#include <linux/of.h> #include <linux/platform_device.h> #include <linux/regulator/consumer.h>
@@ -204,6 +203,7 @@ static int display_connector_get_supply(struct platform_device *pdev,static int display_connector_probe (struct platform_device *pdev) { +struct fwnode_handle *fwnode =dev_fwnode (&pdev->dev);struct display_connector *conn;unsigned int type;const char *label =NULL ;
@@ -215,15 +215,15 @@ static int display_connector_probe(struct platform_device *pdev)platform_set_drvdata (pdev, conn); - type = (uintptr_t )of_device_get_match_data (&pdev->dev); + type = (uintptr_t )device_get_match_data (&pdev->dev);/* Get the exact connector type. */ switch (type) {case DRM_MODE_CONNECTOR_DVII : {bool analog, digital; - analog =of_property_read_bool (pdev->dev.of_node,"analog" ); - digital =of_property_read_bool (pdev->dev.of_node,"digital" ); + analog =fwnode_property_present (fwnode,"analog" ); + digital =fwnode_property_present (fwnode,"digital" );if (analog && !digital) { conn->bridge.type =DRM_MODE_CONNECTOR_DVIA ; }else if (!analog && digital) {
@@ -240,8 +240,7 @@ static int display_connector_probe(struct platform_device *pdev)case DRM_MODE_CONNECTOR_HDMIA : {const char *hdmi_type; - ret =of_property_read_string (pdev->dev.of_node,"type" , - &hdmi_type); + ret =fwnode_property_read_string (fwnode,"type" , &hdmi_type);if (ret <0 ) {dev_err (&pdev->dev,"HDMI connector with no type\n" );return -EINVAL ;
@@ -271,7 +270,7 @@ static int display_connector_probe(struct platform_device *pdev) conn->bridge.interlace_allowed = true;/* Get the optional connector label. */ -of_property_read_string (pdev->dev.of_node,"label" , &label); +fwnode_property_read_string (fwnode,"label" , &label);/* * Get the HPD GPIO for DVI, HDMI and DP connectors. If the GPIO can provide
@@ -309,12 +308,12 @@ static int display_connector_probe(struct platform_device *pdev)if (type ==DRM_MODE_CONNECTOR_DVII || type ==DRM_MODE_CONNECTOR_HDMIA || type ==DRM_MODE_CONNECTOR_VGA ) { -struct device_node *phandle; +struct fwnode_handle *phandle; - phandle =of_parse_phandle (pdev->dev.of_node,"ddc-i2c-bus" ,0 ); -if (phandle) { - conn->bridge.ddc =of_get_i2c_adapter_by_node (phandle); -of_node_put (phandle); + phandle =fwnode_find_reference (fwnode,"ddc-i2c-bus" ,0 ); +if (!IS_ERR (phandle)) { + conn->bridge.ddc =i2c_get_adapter_by_fwnode (phandle); +fwnode_handle_put (phandle);if (!conn->bridge.ddc)return -EPROBE_DEFER ; }else {
Signature · 1 line
2.34.1
PATCH v6 6/10 drm/bridge: sii902x: Switch to use fwnode APIs to acquire device properties
In reply to Sui JingfengMake this driver less DT-dependent by calling the freshly created helpers, also switch to use fwnode APIs to acquire additional device properties. One side benifit is that boilerplates get reduced, no functional changes for DT-based systems.
--- drivers/gpu/drm/bridge/sii902x.c | 43 +++++++++++--------------------- 1 file changed, 15 insertions(+), 28 deletions(-)
drivers/gpu/drm/bridge/sii902x.c +15 -28
@@ -827,20 +827,17 @@ static int sii902x_audio_codec_init(struct sii902x *sii902x, .spdif = 0, .max_i2s_channels = 0, }; +struct fwnode_handle *fwnode =dev_fwnode (dev);u8 lanes[4 ];int num_lanes, i; -if (!of_property_read_bool (dev->of_node,"#sound-dai-cells" )) { +if (!fwnode_property_present (fwnode,"#sound-dai-cells" )) {dev_dbg (dev,"%s: No \"#sound-dai-cells\", no audio\n" , __func__);return 0 ; } - num_lanes =of_property_read_variable_u8_array (dev->of_node, -"sil,i2s-data-lanes" , - lanes,1 , -ARRAY_SIZE (lanes)); - + num_lanes =fwnode_property_count_u8 (fwnode,"sil,i2s-data-lanes" );if (num_lanes == -EINVAL ) { dev_dbg(dev, "%s: No \"sil,i2s-data-lanes\", use default <0>\n",
@@ -852,7 +849,11 @@ static int sii902x_audio_codec_init(struct sii902x *sii902x,"%s: Error gettin \"sil,i2s-data-lanes\": %d\n" , __func__, num_lanes);return num_lanes; + }else { +fwnode_property_read_u8_array (fwnode,"sil,i2s-data-lanes" , + lanes, num_lanes); } + codec_data.max_i2s_channels =2 * num_lanes;for (i =0 ; i < num_lanes; i++)
@@ -1117,7 +1118,6 @@ static int sii902x_init(struct sii902x *sii902x)static int sii902x_probe (struct i2c_client *client) {struct device *dev = &client->dev; -struct device_node *endpoint;struct sii902x *sii902x;static const char *const supplies[] = {"iovcc" ,"cvcc12" };int ret;
@@ -1146,27 +1146,14 @@ static int sii902x_probe(struct i2c_client *client)return PTR_ERR (sii902x->reset_gpio); } - endpoint =of_graph_get_endpoint_by_regs (dev->of_node,1 ,-1 ); -if (endpoint) { -struct device_node *remote =of_graph_get_remote_port_parent (endpoint); - -of_node_put (endpoint); -if (!remote) { -dev_err (dev,"Endpoint in port@1 unconnected\n" ); -return -ENODEV ; - } - -if (!of_device_is_available (remote)) { -dev_err (dev,"port@1 remote device is disabled\n" ); -of_node_put (remote); -return -ENODEV ; - } - - sii902x->next_bridge =of_drm_find_bridge (remote); -of_node_put (remote); -if (!sii902x->next_bridge) -return dev_err_probe (dev, -EPROBE_DEFER , -"Failed to find remote bridge\n" ); + sii902x->next_bridge =drm_bridge_find_next_bridge_by_fwnode (dev_fwnode (dev),1 ); +if (!sii902x->next_bridge) { +return dev_err_probe (dev, -EPROBE_DEFER , +"Failed to find the next bridge\n" ); + }else if (IS_ERR (sii902x->next_bridge)) { + ret =PTR_ERR (sii902x->next_bridge); +dev_err (dev,"Error on find the next bridge: %d\n" , ret); +return ret; }mutex_init (&sii902x->mutex);
Signature · 1 line
2.34.1
PATCH v6 7/10 drm-bridge: it66121: Use fwnode APIs to acquire device properties
In reply to Sui JingfengMake this driver less DT-dependent by calling the newly created helpers, also switch to use fwnode APIs to acquire additional device properties. A side benifit is that boilerplates get reduced, no functional changes for DT-based systems.
--- drivers/gpu/drm/bridge/ite-it66121.c | 55 +++++++++++++++++----------- 1 file changed, 34 insertions(+), 21 deletions(-)
drivers/gpu/drm/bridge/ite-it66121.c +34 -21
@@ -15,7 +15,6 @@#include <linux/bitfield.h> #include <linux/property.h> #include <linux/regmap.h> -#include <linux/of_graph.h> #include <linux/gpio/consumer.h> #include <linux/pinctrl/consumer.h> #include <linux/regulator/consumer.h>
@@ -1480,7 +1479,7 @@ static int it66121_audio_codec_init(struct it66121_ctx *ctx, struct device *dev)dev_dbg (dev,"%s\n" , __func__); -if (!of_property_read_bool (dev->of_node,"#sound-dai-cells" )) { +if (!fwnode_property_present (dev_fwnode (dev),"#sound-dai-cells" )) {dev_info (dev,"No \"#sound-dai-cells\", no audio\n" );return 0 ; }
@@ -1503,13 +1502,36 @@ static const char * const it66121_supplies[] = {"vcn33" ,"vcn18" ,"vrf12" }; +static int it66121_read_bus_width (struct fwnode_handle *fwnode,u32 *bus_width) +{ +struct fwnode_handle *endpoint; +u32 val; +int ret; + + endpoint =fwnode_graph_get_endpoint_by_id (fwnode,0 ,0 ,0 ); +if (!endpoint) +return -EINVAL ; + + ret =fwnode_property_read_u32 (endpoint,"bus-width" , &val); +fwnode_handle_put (endpoint); +if (ret) +return ret; + +if (val !=12 && val !=24 ) +return -EINVAL ; + + *bus_width = val; + +return 0 ; +} +static int it66121_probe (struct i2c_client *client) {u32 revision_id, vendor_ids[2 ] = {0 }, device_ids[2 ] = {0 }; -struct device_node *ep;int ret;struct it66121_ctx *ctx;struct device *dev = &client->dev; +struct fwnode_handle *fwnode =dev_fwnode (dev);if (!i2c_check_functionality (client->adapter,I2C_FUNC_I2C )) {dev_err (dev,"I2C check functionality failed.\n" );
@@ -1520,29 +1542,20 @@ static int it66121_probe(struct i2c_client *client)if (!ctx)return -ENOMEM ; - ep =of_graph_get_endpoint_by_regs (dev->of_node,0 ,0 ); -if (!ep) -return -EINVAL ; - ctx->dev = dev; ctx->client = client; ctx->info =i2c_get_match_data (client); -of_property_read_u32 (ep,"bus-width" , &ctx->bus_width); -of_node_put (ep); - -if (ctx->bus_width !=12 && ctx->bus_width !=24 ) -return -EINVAL ; - - ep =of_graph_get_remote_node (dev->of_node,1 ,-1 ); -if (!ep) { -dev_err (ctx->dev,"The endpoint is unconnected\n" ); -return -EINVAL ; - } + ret =it66121_read_bus_width (fwnode, &ctx->bus_width); +if (ret) +return ret; - ctx->next_bridge =of_drm_find_bridge (ep); -of_node_put (ep); -if (!ctx->next_bridge) { + ctx->next_bridge =drm_bridge_find_next_bridge_by_fwnode (fwnode,1 ); +if (IS_ERR (ctx->next_bridge)) { + ret =PTR_ERR (ctx->next_bridge); +dev_err (dev,"Error in founding the next bridge: %d\n" , ret); +return ret; + }else if (!ctx->next_bridge) {dev_dbg (ctx->dev,"Next bridge not found, deferring probe\n" );return -EPROBE_DEFER ; }
Signature · 1 line
2.34.1
PATCH v6 8/10 drm/bridge: tfp410: Use fwnode APIs to acquire device properties
In reply to Sui JingfengMake this driver less DT-dependent by calling the newly created helpers, also switch to use fwnode APIs to acquire additional device properties. No functional changes for DT-based systems.
--- drivers/gpu/drm/bridge/ti-tfp410.c | 39 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/gpu/drm/bridge/ti-tfp410.c +20 -19
@@ -261,8 +261,9 @@ static const struct drm_bridge_timings tfp410_default_timings = {static int tfp410_parse_timings (struct tfp410 *dvi,bool i2c) { +struct fwnode_handle *fwnode =dev_fwnode (dvi->dev);struct drm_bridge_timings *timings = &dvi->timings; -struct device_node *ep; +struct fwnode_handle *ep;u32 pclk_sample =0 ;u32 bus_width =24 ;u32 deskew =0 ;
@@ -283,14 +284,14 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)* and EDGE pins. They are specified in DT through endpoint properties * and vendor-specific properties. */ - ep =of_graph_get_endpoint_by_regs (dvi->dev->of_node,0 ,0 ); + ep =fwnode_graph_get_endpoint_by_id (fwnode,0 ,0 ,0 );if (!ep)return -EINVAL ;/* Get the sampling edge from the endpoint. */ -of_property_read_u32 (ep,"pclk-sample" , &pclk_sample); -of_property_read_u32 (ep,"bus-width" , &bus_width); -of_node_put (ep); +fwnode_property_read_u32 (ep,"pclk-sample" , &pclk_sample); +fwnode_property_read_u32 (ep,"bus-width" , &bus_width); +fwnode_handle_put (ep); timings->input_bus_flags =DRM_BUS_FLAG_DE_HIGH ;
@@ -319,7 +320,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) }/* Get the setup and hold time from vendor-specific properties. */ -of_property_read_u32 (dvi->dev->of_node,"ti,deskew" , &deskew); +fwnode_property_read_u32 (fwnode,"ti,deskew" , &deskew);if (deskew >7 )return -EINVAL ;
@@ -331,12 +332,12 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)static int tfp410_init (struct device *dev,bool i2c) { -struct device_node *node; +struct fwnode_handle *fwnode =dev_fwnode (dev);struct tfp410 *dvi;int ret; -if (!dev->of_node) { -dev_err (dev,"device-tree data is missing\n" ); +if (!fwnode) { +dev_err (dev,"firmware data is missing\n" );return -ENXIO ; }
@@ -356,15 +357,15 @@ static int tfp410_init(struct device *dev, bool i2c)return ret;/* Get the next bridge, connected to port@1. */ - node =of_graph_get_remote_node (dev->of_node,1 ,-1 ); -if (!node) -return -ENODEV ; - - dvi->next_bridge =of_drm_find_bridge (node); -of_node_put (node); - -if (!dvi->next_bridge) + dvi->next_bridge =drm_bridge_find_next_bridge_by_fwnode (fwnode,1 ); +if (IS_ERR (dvi->next_bridge)) { + ret =PTR_ERR (dvi->next_bridge); +dev_err (dev,"Error in founding the next bridge: %d\n" , ret); +return ret; + }else if (!dvi->next_bridge) { +dev_dbg (dev,"Next bridge not found, deferring probe\n" );return -EPROBE_DEFER ; + }/* Get the powerdown GPIO. */ dvi->powerdown = devm_gpiod_get_optional(dev, "powerdown",
@@ -416,10 +417,10 @@ static struct platform_driver tfp410_platform_driver = {/* There is currently no i2c functionality. */ static int tfp410_i2c_probe (struct i2c_client *client) { +struct fwnode_handle *fwnode =dev_fwnode (&client->dev);int reg; -if (!client->dev.of_node || -of_property_read_u32 (client->dev.of_node,"reg" , ®)) { +if (!fwnode ||fwnode_property_read_u32 (fwnode,"reg" , ®)) {dev_err (&client->dev,"Can't get i2c reg property from device-tree\n" );return -ENXIO ;
Signature · 1 line
2.34.1
PATCH v6 9/10 drm/bridge: sii9234: Use fwnode APIs to abstract DT dependent API away
In reply to Sui JingfengSwitch to use the freshly created drm_bridge_set_node() helper, no functional changes. The reason behind of this introduction is that the name 'of_node' itself has a smell of DT dependent, and it is a internal memeber, when there has helper function, we should use the revelant helper and avoid directly referencing and/or dereferencing it.
--- drivers/gpu/drm/bridge/sii9234.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/sii9234.c +3 -2
@@ -817,10 +817,11 @@ static int sii9234_init_resources(struct sii9234 *ctx, struct i2c_client *client) {struct i2c_adapter *adapter = client->adapter; +struct fwnode_handle *fwnode =dev_fwnode (ctx->dev);int ret; -if (!ctx->dev->of_node) { -dev_err (ctx->dev,"not DT device\n" ); +if (!fwnode) { +dev_err (ctx->dev,"firmware data is missing\n" );return -ENODEV ; }
Signature · 1 line
2.34.1
PATCH v6 10/10 drm/bridge: ch7033: Switch to use fwnode based APIs
In reply to Sui JingfengUse the freshly created helper to replace the use of DT-dependent APIs, also print error log if the fwnode graph is not complete which is benefit to debug.
--- drivers/gpu/drm/bridge/chrontel-ch7033.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/chrontel-ch7033.c +9 -3
@@ -531,6 +531,7 @@ static const struct regmap_config ch7033_regmap_config = {static int ch7033_probe (struct i2c_client *client) {struct device *dev = &client->dev; +struct fwnode_handle *fwnode =dev_fwnode (dev);struct ch7033_priv *priv;unsigned int val;int ret;
@@ -541,10 +542,15 @@ static int ch7033_probe(struct i2c_client *client)dev_set_drvdata (dev, priv); - ret =drm_of_find_panel_or_bridge (dev->of_node,1 ,-1 ,NULL , - &priv->next_bridge); -if (ret) + priv->next_bridge =drm_bridge_find_next_bridge_by_fwnode (fwnode,1 ); +if (IS_ERR (priv->next_bridge)) { + ret =PTR_ERR (priv->next_bridge); +dev_err (dev,"Error in founding the next bridge: %d\n" , ret);return ret; + }else if (!priv->next_bridge) { +dev_dbg (dev,"Next bridge not found, deferring probe\n" ); +return -EPROBE_DEFER ; + } priv->regmap =devm_regmap_init_i2c (client, &ch7033_regmap_config);if (IS_ERR (priv->regmap)) {
Signature · 1 line
2.34.1