* [PATCH v3 0/3] drm/display: simplify support for transparent DRM bridges
@ 2023-08-02 1:18 Dmitry Baryshkov
2023-08-02 1:18 ` [PATCH v3 1/3] drm/display: add transparent bridge helper Dmitry Baryshkov
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-02 1:18 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I,
Heikki Krogerus, Greg Kroah-Hartman, Neil Armstrong
Cc: linux-phy, linux-arm-msm, linux-usb, freedreno, dri-devel
Supporting DP/USB-C can result in a chain of several transparent
bridges (PHY, redrivers, mux, etc). This results in drivers having
similar boilerplate code for such bridges.
Next, these drivers are susceptible to -EPROBE_DEFER loops: the next
bridge can either be probed from the bridge->attach callback, when it is
too late to return -EPROBE_DEFER, or from the probe() callback, when the
next bridge might not yet be available, because it depends on the
resources provided by the probing device.
Last, but not least, this results in the the internal knowledge of DRM
subsystem slowly diffusing into other subsystems, like PHY or USB/TYPEC.
To solve all these issues, define a separate DRM helper, which creates
separate aux device just for the bridge. During probe such aux device
doesn't result in the EPROBE_DEFER loops. Instead it allows the device
drivers to probe properly, according to the actual resource
dependencies. The bridge auxdevs are then probed when the next bridge
becomes available, sparing drivers from drm_bridge_attach() returning
-EPROBE_DEFER.
Proposed merge strategy: immutable branch with the drm commit, which is
then merged into PHY and USB subsystems together with the corresponding
patch.
Changes since v2:
- ifdef'ed bridge->of_node access (LKP)
Changes since v1:
- Added EXPORT_SYMBOL_GPL / MODULE_LICENSE / etc. to drm_simple_bridge
Dmitry Baryshkov (3):
drm/display: add transparent bridge helper
phy: qcom: qmp-combo: switch to DRM_SIMPLE_BRIDGE
usb: typec: nb7vpq904m: switch to DRM_SIMPLE_BRIDGE
drivers/gpu/drm/display/Kconfig | 9 ++
drivers/gpu/drm/display/Makefile | 2 +
drivers/gpu/drm/display/drm_simple_bridge.c | 127 ++++++++++++++++++++
drivers/phy/qualcomm/Kconfig | 2 +-
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 44 +------
drivers/usb/typec/mux/Kconfig | 2 +-
drivers/usb/typec/mux/nb7vpq904m.c | 44 +------
include/drm/display/drm_simple_bridge.h | 19 +++
8 files changed, 163 insertions(+), 86 deletions(-)
create mode 100644 drivers/gpu/drm/display/drm_simple_bridge.c
create mode 100644 include/drm/display/drm_simple_bridge.h
--
2.39.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 1/3] drm/display: add transparent bridge helper
2023-08-02 1:18 [PATCH v3 0/3] drm/display: simplify support for transparent DRM bridges Dmitry Baryshkov
@ 2023-08-02 1:18 ` Dmitry Baryshkov
2023-08-02 8:08 ` Neil Armstrong
` (3 more replies)
2023-08-02 1:18 ` [PATCH v3 2/3] phy: qcom: qmp-combo: switch to DRM_SIMPLE_BRIDGE Dmitry Baryshkov
2023-08-02 1:18 ` [PATCH v3 3/3] usb: typec: nb7vpq904m: " Dmitry Baryshkov
2 siblings, 4 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-02 1:18 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I,
Heikki Krogerus, Greg Kroah-Hartman, Neil Armstrong
Cc: linux-phy, linux-arm-msm, linux-usb, freedreno, dri-devel
Define a helper for creating simple transparent bridges which serve the
only purpose of linking devices into the bridge chain up to the last
bridge representing the connector. This is especially useful for
DP/USB-C bridge chains, which can span across several devices, but do
not require any additional functionality from the intermediate bridges.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/display/Kconfig | 9 ++
drivers/gpu/drm/display/Makefile | 2 +
drivers/gpu/drm/display/drm_simple_bridge.c | 127 ++++++++++++++++++++
include/drm/display/drm_simple_bridge.h | 19 +++
4 files changed, 157 insertions(+)
create mode 100644 drivers/gpu/drm/display/drm_simple_bridge.c
create mode 100644 include/drm/display/drm_simple_bridge.h
diff --git a/drivers/gpu/drm/display/Kconfig b/drivers/gpu/drm/display/Kconfig
index 09712b88a5b8..a6132984b9e3 100644
--- a/drivers/gpu/drm/display/Kconfig
+++ b/drivers/gpu/drm/display/Kconfig
@@ -49,3 +49,12 @@ config DRM_DP_CEC
Note: not all adapters support this feature, and even for those
that do support this they often do not hook up the CEC pin.
+
+config DRM_SIMPLE_BRIDGE
+ tristate
+ depends on DRM
+ select AUXILIARY_BUS
+ select DRM_PANEL_BRIDGE
+ help
+ Simple transparent bridge that is used by several drivers to build
+ bridges chain.
diff --git a/drivers/gpu/drm/display/Makefile b/drivers/gpu/drm/display/Makefile
index 17ac4a1006a8..6e2b0d7f24b3 100644
--- a/drivers/gpu/drm/display/Makefile
+++ b/drivers/gpu/drm/display/Makefile
@@ -16,3 +16,5 @@ drm_display_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
drm_display_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o
obj-$(CONFIG_DRM_DISPLAY_HELPER) += drm_display_helper.o
+
+obj-$(CONFIG_DRM_SIMPLE_BRIDGE) += drm_simple_bridge.o
diff --git a/drivers/gpu/drm/display/drm_simple_bridge.c b/drivers/gpu/drm/display/drm_simple_bridge.c
new file mode 100644
index 000000000000..9e80efe67b93
--- /dev/null
+++ b/drivers/gpu/drm/display/drm_simple_bridge.c
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023 Linaro Ltd.
+ *
+ * Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+ */
+#include <linux/auxiliary_bus.h>
+#include <linux/module.h>
+
+#include <drm/drm_bridge.h>
+#include <drm/display/drm_simple_bridge.h>
+
+static DEFINE_IDA(simple_bridge_ida);
+
+static void drm_simple_bridge_release(struct device *dev)
+{
+ struct auxiliary_device *adev = to_auxiliary_dev(dev);
+
+ kfree(adev);
+}
+
+static void drm_simple_bridge_unregister_adev(void *_adev)
+{
+ struct auxiliary_device *adev = _adev;
+
+ auxiliary_device_delete(adev);
+ auxiliary_device_uninit(adev);
+}
+
+int drm_simple_bridge_register(struct device *parent)
+{
+ struct auxiliary_device *adev;
+ int ret;
+
+ adev = kzalloc(sizeof(*adev), GFP_KERNEL);
+ if (!adev)
+ return -ENOMEM;
+
+ ret = ida_alloc(&simple_bridge_ida, GFP_KERNEL);
+ if (ret < 0)
+ return ret;
+
+ adev->id = ret;
+ adev->name = "simple_bridge";
+ adev->dev.parent = parent;
+ adev->dev.of_node = parent->of_node;
+ adev->dev.release = drm_simple_bridge_release;
+
+ ret = auxiliary_device_init(adev);
+ if (ret) {
+ kfree(adev);
+ return ret;
+ }
+
+ ret = auxiliary_device_add(adev);
+ if (ret) {
+ auxiliary_device_uninit(adev);
+ return ret;
+ }
+
+ return devm_add_action_or_reset(parent, drm_simple_bridge_unregister_adev, adev);
+}
+EXPORT_SYMBOL_GPL(drm_simple_bridge_register);
+
+struct drm_simple_bridge_data {
+ struct drm_bridge bridge;
+ struct drm_bridge *next_bridge;
+ struct device *dev;
+};
+
+static int drm_simple_bridge_attach(struct drm_bridge *bridge,
+ enum drm_bridge_attach_flags flags)
+{
+ struct drm_simple_bridge_data *data;
+
+ if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
+ return -EINVAL;
+
+ data = container_of(bridge, struct drm_simple_bridge_data, bridge);
+
+ return drm_bridge_attach(bridge->encoder, data->next_bridge, bridge,
+ DRM_BRIDGE_ATTACH_NO_CONNECTOR);
+}
+
+static const struct drm_bridge_funcs drm_simple_bridge_funcs = {
+ .attach = drm_simple_bridge_attach,
+};
+
+static int drm_simple_bridge_probe(struct auxiliary_device *auxdev,
+ const struct auxiliary_device_id *id)
+{
+ struct drm_simple_bridge_data *data;
+
+ data = devm_kzalloc(&auxdev->dev, sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ data->dev = &auxdev->dev;
+ data->next_bridge = devm_drm_of_get_bridge(&auxdev->dev, auxdev->dev.of_node, 0, 0);
+ if (IS_ERR(data->next_bridge))
+ return dev_err_probe(&auxdev->dev, PTR_ERR(data->next_bridge),
+ "failed to acquire drm_bridge\n");
+
+ data->bridge.funcs = &drm_simple_bridge_funcs;
+#ifdef CONFIG_OF
+ data->bridge.of_node = data->dev->of_node;
+#endif
+
+ return devm_drm_bridge_add(data->dev, &data->bridge);
+}
+
+static const struct auxiliary_device_id drm_simple_bridge_table[] = {
+ { .name = KBUILD_MODNAME ".simple_bridge" },
+ {},
+};
+MODULE_DEVICE_TABLE(auxiliary, drm_simple_bridge_table);
+
+struct auxiliary_driver drm_simple_bridge_drv = {
+ .name = "simple_bridge",
+ .id_table = drm_simple_bridge_table,
+ .probe = drm_simple_bridge_probe,
+};
+module_auxiliary_driver(drm_simple_bridge_drv);
+
+MODULE_AUTHOR("Dmitry Baryshkov <dmitry.baryshkov@linaro.org>");
+MODULE_DESCRIPTION("DRM simple bridge helper");
+MODULE_LICENSE("GPL");
diff --git a/include/drm/display/drm_simple_bridge.h b/include/drm/display/drm_simple_bridge.h
new file mode 100644
index 000000000000..3da8e1fb1137
--- /dev/null
+++ b/include/drm/display/drm_simple_bridge.h
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023 Linaro Ltd.
+ *
+ * Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+ */
+#ifndef DRM_SIMPLE_BRIDGE_H
+#define DRM_SIMPLE_BRIDGE_H
+
+#if IS_ENABLED(CONFIG_DRM_SIMPLE_BRIDGE)
+int drm_simple_bridge_register(struct device *parent);
+#else
+static inline int drm_simple_bridge_register(struct device *parent)
+{
+ return 0;
+}
+#endif
+
+#endif
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 2/3] phy: qcom: qmp-combo: switch to DRM_SIMPLE_BRIDGE
2023-08-02 1:18 [PATCH v3 0/3] drm/display: simplify support for transparent DRM bridges Dmitry Baryshkov
2023-08-02 1:18 ` [PATCH v3 1/3] drm/display: add transparent bridge helper Dmitry Baryshkov
@ 2023-08-02 1:18 ` Dmitry Baryshkov
2023-08-02 1:18 ` [PATCH v3 3/3] usb: typec: nb7vpq904m: " Dmitry Baryshkov
2 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-02 1:18 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I,
Heikki Krogerus, Greg Kroah-Hartman, Neil Armstrong
Cc: linux-phy, linux-arm-msm, linux-usb, freedreno, dri-devel
Switch to using the new DRM_SIMPLE_BRIDGE helper to create the
transparent DRM bridge device instead of handcoding corresponding
functionality.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/phy/qualcomm/Kconfig | 2 +-
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 44 ++---------------------
2 files changed, 3 insertions(+), 43 deletions(-)
diff --git a/drivers/phy/qualcomm/Kconfig b/drivers/phy/qualcomm/Kconfig
index ced603806375..fb03e3b3f637 100644
--- a/drivers/phy/qualcomm/Kconfig
+++ b/drivers/phy/qualcomm/Kconfig
@@ -63,7 +63,7 @@ config PHY_QCOM_QMP_COMBO
depends on DRM || DRM=n
select GENERIC_PHY
select MFD_SYSCON
- select DRM_PANEL_BRIDGE if DRM
+ select DRM_SIMPLE_BRIDGE if DRM
help
Enable this to support the QMP Combo PHY transceiver that is used
with USB3 and DisplayPort controllers on Qualcomm chips.
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 9c3de41ecedb..5c7615edb161 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -21,7 +21,7 @@
#include <linux/usb/typec.h>
#include <linux/usb/typec_mux.h>
-#include <drm/drm_bridge.h>
+#include <drm/display/drm_simple_bridge.h>
#include <dt-bindings/phy/phy-qcom-qmp.h>
@@ -1419,8 +1419,6 @@ struct qmp_combo {
struct clk_hw dp_link_hw;
struct clk_hw dp_pixel_hw;
- struct drm_bridge bridge;
-
struct typec_switch_dev *sw;
enum typec_orientation orientation;
};
@@ -3193,44 +3191,6 @@ static int qmp_combo_typec_switch_register(struct qmp_combo *qmp)
}
#endif
-#if IS_ENABLED(CONFIG_DRM)
-static int qmp_combo_bridge_attach(struct drm_bridge *bridge,
- enum drm_bridge_attach_flags flags)
-{
- struct qmp_combo *qmp = container_of(bridge, struct qmp_combo, bridge);
- struct drm_bridge *next_bridge;
-
- if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
- return -EINVAL;
-
- next_bridge = devm_drm_of_get_bridge(qmp->dev, qmp->dev->of_node, 0, 0);
- if (IS_ERR(next_bridge)) {
- dev_err(qmp->dev, "failed to acquire drm_bridge: %pe\n", next_bridge);
- return PTR_ERR(next_bridge);
- }
-
- return drm_bridge_attach(bridge->encoder, next_bridge, bridge,
- DRM_BRIDGE_ATTACH_NO_CONNECTOR);
-}
-
-static const struct drm_bridge_funcs qmp_combo_bridge_funcs = {
- .attach = qmp_combo_bridge_attach,
-};
-
-static int qmp_combo_dp_register_bridge(struct qmp_combo *qmp)
-{
- qmp->bridge.funcs = &qmp_combo_bridge_funcs;
- qmp->bridge.of_node = qmp->dev->of_node;
-
- return devm_drm_bridge_add(qmp->dev, &qmp->bridge);
-}
-#else
-static int qmp_combo_dp_register_bridge(struct qmp_combo *qmp)
-{
- return 0;
-}
-#endif
-
static int qmp_combo_parse_dt_lecacy_dp(struct qmp_combo *qmp, struct device_node *np)
{
struct device *dev = qmp->dev;
@@ -3436,7 +3396,7 @@ static int qmp_combo_probe(struct platform_device *pdev)
if (ret)
return ret;
- ret = qmp_combo_dp_register_bridge(qmp);
+ ret = drm_simple_bridge_register(dev);
if (ret)
return ret;
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 3/3] usb: typec: nb7vpq904m: switch to DRM_SIMPLE_BRIDGE
2023-08-02 1:18 [PATCH v3 0/3] drm/display: simplify support for transparent DRM bridges Dmitry Baryshkov
2023-08-02 1:18 ` [PATCH v3 1/3] drm/display: add transparent bridge helper Dmitry Baryshkov
2023-08-02 1:18 ` [PATCH v3 2/3] phy: qcom: qmp-combo: switch to DRM_SIMPLE_BRIDGE Dmitry Baryshkov
@ 2023-08-02 1:18 ` Dmitry Baryshkov
2023-08-02 11:00 ` Heikki Krogerus
2023-08-08 19:15 ` kernel test robot
2 siblings, 2 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-02 1:18 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I,
Heikki Krogerus, Greg Kroah-Hartman, Neil Armstrong
Cc: linux-phy, linux-arm-msm, linux-usb, freedreno, dri-devel
Switch to using the new DRM_SIMPLE_BRIDGE helper to create the
transparent DRM bridge device instead of handcoding corresponding
functionality.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/usb/typec/mux/Kconfig | 2 +-
drivers/usb/typec/mux/nb7vpq904m.c | 44 ++----------------------------
2 files changed, 3 insertions(+), 43 deletions(-)
diff --git a/drivers/usb/typec/mux/Kconfig b/drivers/usb/typec/mux/Kconfig
index 784b9d8107e9..350a7ffce67e 100644
--- a/drivers/usb/typec/mux/Kconfig
+++ b/drivers/usb/typec/mux/Kconfig
@@ -39,7 +39,7 @@ config TYPEC_MUX_NB7VPQ904M
tristate "On Semiconductor NB7VPQ904M Type-C redriver driver"
depends on I2C
depends on DRM || DRM=n
- select DRM_PANEL_BRIDGE if DRM
+ select DRM_SIMPLE_BRIDGE if DRM
select REGMAP_I2C
help
Say Y or M if your system has a On Semiconductor NB7VPQ904M Type-C
diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c
index 9360b65e8b06..c89a956412ea 100644
--- a/drivers/usb/typec/mux/nb7vpq904m.c
+++ b/drivers/usb/typec/mux/nb7vpq904m.c
@@ -11,7 +11,7 @@
#include <linux/regmap.h>
#include <linux/bitfield.h>
#include <linux/of_graph.h>
-#include <drm/drm_bridge.h>
+#include <drm/display/drm_simple_bridge.h>
#include <linux/usb/typec_dp.h>
#include <linux/usb/typec_mux.h>
#include <linux/usb/typec_retimer.h>
@@ -70,8 +70,6 @@ struct nb7vpq904m {
bool swap_data_lanes;
struct typec_switch *typec_switch;
- struct drm_bridge bridge;
-
struct mutex lock; /* protect non-concurrent retimer & switch */
enum typec_orientation orientation;
@@ -297,44 +295,6 @@ static int nb7vpq904m_retimer_set(struct typec_retimer *retimer, struct typec_re
return ret;
}
-#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
-static int nb7vpq904m_bridge_attach(struct drm_bridge *bridge,
- enum drm_bridge_attach_flags flags)
-{
- struct nb7vpq904m *nb7 = container_of(bridge, struct nb7vpq904m, bridge);
- struct drm_bridge *next_bridge;
-
- if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
- return -EINVAL;
-
- next_bridge = devm_drm_of_get_bridge(&nb7->client->dev, nb7->client->dev.of_node, 0, 0);
- if (IS_ERR(next_bridge)) {
- dev_err(&nb7->client->dev, "failed to acquire drm_bridge: %pe\n", next_bridge);
- return PTR_ERR(next_bridge);
- }
-
- return drm_bridge_attach(bridge->encoder, next_bridge, bridge,
- DRM_BRIDGE_ATTACH_NO_CONNECTOR);
-}
-
-static const struct drm_bridge_funcs nb7vpq904m_bridge_funcs = {
- .attach = nb7vpq904m_bridge_attach,
-};
-
-static int nb7vpq904m_register_bridge(struct nb7vpq904m *nb7)
-{
- nb7->bridge.funcs = &nb7vpq904m_bridge_funcs;
- nb7->bridge.of_node = nb7->client->dev.of_node;
-
- return devm_drm_bridge_add(&nb7->client->dev, &nb7->bridge);
-}
-#else
-static int nb7vpq904m_register_bridge(struct nb7vpq904m *nb7)
-{
- return 0;
-}
-#endif
-
static const struct regmap_config nb7_regmap = {
.max_register = 0x1f,
.reg_bits = 8,
@@ -461,7 +421,7 @@ static int nb7vpq904m_probe(struct i2c_client *client)
gpiod_set_value(nb7->enable_gpio, 1);
- ret = nb7vpq904m_register_bridge(nb7);
+ ret = drm_simple_bridge_register(dev);
if (ret)
return ret;
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/3] drm/display: add transparent bridge helper
2023-08-02 1:18 ` [PATCH v3 1/3] drm/display: add transparent bridge helper Dmitry Baryshkov
@ 2023-08-02 8:08 ` Neil Armstrong
2023-08-02 8:09 ` Neil Armstrong
2023-08-02 8:15 ` Neil Armstrong
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Neil Armstrong @ 2023-08-02 8:08 UTC (permalink / raw)
To: Dmitry Baryshkov, David Airlie, Daniel Vetter, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-phy, linux-arm-msm, linux-usb, freedreno, dri-devel
Hi Dmitry,
On 02/08/2023 03:18, Dmitry Baryshkov wrote:
> Define a helper for creating simple transparent bridges which serve the
> only purpose of linking devices into the bridge chain up to the last
> bridge representing the connector. This is especially useful for
> DP/USB-C bridge chains, which can span across several devices, but do
> not require any additional functionality from the intermediate bridges.
Can you CC me on the whole patchset ?
Thanks,
Neil
<snip>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/3] drm/display: add transparent bridge helper
2023-08-02 8:08 ` Neil Armstrong
@ 2023-08-02 8:09 ` Neil Armstrong
0 siblings, 0 replies; 12+ messages in thread
From: Neil Armstrong @ 2023-08-02 8:09 UTC (permalink / raw)
To: Dmitry Baryshkov, David Airlie, Daniel Vetter, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-phy, linux-arm-msm, linux-usb, freedreno, dri-devel
On 02/08/2023 10:08, Neil Armstrong wrote:
> Hi Dmitry,
>
> On 02/08/2023 03:18, Dmitry Baryshkov wrote:
>> Define a helper for creating simple transparent bridges which serve the
>> only purpose of linking devices into the bridge chain up to the last
>> bridge representing the connector. This is especially useful for
>> DP/USB-C bridge chains, which can span across several devices, but do
>> not require any additional functionality from the intermediate bridges.
>
> Can you CC me on the whole patchset ?
Oops I am... sorry for the noise...
>
> Thanks,
> Neil
>
>
> <snip>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/3] drm/display: add transparent bridge helper
2023-08-02 1:18 ` [PATCH v3 1/3] drm/display: add transparent bridge helper Dmitry Baryshkov
2023-08-02 8:08 ` Neil Armstrong
@ 2023-08-02 8:15 ` Neil Armstrong
2023-08-02 9:12 ` Dmitry Baryshkov
2023-08-06 12:30 ` kernel test robot
2023-08-09 7:58 ` Dan Carpenter
3 siblings, 1 reply; 12+ messages in thread
From: Neil Armstrong @ 2023-08-02 8:15 UTC (permalink / raw)
To: Dmitry Baryshkov, David Airlie, Daniel Vetter, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-phy, linux-arm-msm, linux-usb, freedreno, dri-devel
Hi,
On 02/08/2023 03:18, Dmitry Baryshkov wrote:
> Define a helper for creating simple transparent bridges which serve the
> only purpose of linking devices into the bridge chain up to the last
> bridge representing the connector. This is especially useful for
> DP/USB-C bridge chains, which can span across several devices, but do
> not require any additional functionality from the intermediate bridges.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/display/Kconfig | 9 ++
> drivers/gpu/drm/display/Makefile | 2 +
> drivers/gpu/drm/display/drm_simple_bridge.c | 127 ++++++++++++++++++++
I wonder why drm/display/ and not drm/bridge ?
It's an helper, but it's mainly a bridge.
> include/drm/display/drm_simple_bridge.h | 19 +++
> 4 files changed, 157 insertions(+)
> create mode 100644 drivers/gpu/drm/display/drm_simple_bridge.c
> create mode 100644 include/drm/display/drm_simple_bridge.h
>
> diff --git a/drivers/gpu/drm/display/Kconfig b/drivers/gpu/drm/display/Kconfig
> index 09712b88a5b8..a6132984b9e3 100644
> --- a/drivers/gpu/drm/display/Kconfig
> +++ b/drivers/gpu/drm/display/Kconfig
> @@ -49,3 +49,12 @@ config DRM_DP_CEC
>
> Note: not all adapters support this feature, and even for those
> that do support this they often do not hook up the CEC pin.
> +
> +config DRM_SIMPLE_BRIDGE
> + tristate
> + depends on DRM
> + select AUXILIARY_BUS
> + select DRM_PANEL_BRIDGE
> + help
> + Simple transparent bridge that is used by several drivers to build
> + bridges chain.
> diff --git a/drivers/gpu/drm/display/Makefile b/drivers/gpu/drm/display/Makefile
> index 17ac4a1006a8..6e2b0d7f24b3 100644
> --- a/drivers/gpu/drm/display/Makefile
> +++ b/drivers/gpu/drm/display/Makefile
> @@ -16,3 +16,5 @@ drm_display_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
> drm_display_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o
>
> obj-$(CONFIG_DRM_DISPLAY_HELPER) += drm_display_helper.o
> +
> +obj-$(CONFIG_DRM_SIMPLE_BRIDGE) += drm_simple_bridge.o
> diff --git a/drivers/gpu/drm/display/drm_simple_bridge.c b/drivers/gpu/drm/display/drm_simple_bridge.c
> new file mode 100644
> index 000000000000..9e80efe67b93
> --- /dev/null
> +++ b/drivers/gpu/drm/display/drm_simple_bridge.c
> @@ -0,0 +1,127 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2023 Linaro Ltd.
> + *
> + * Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> + */
> +#include <linux/auxiliary_bus.h>
> +#include <linux/module.h>
> +
> +#include <drm/drm_bridge.h>
> +#include <drm/display/drm_simple_bridge.h>
> +
> +static DEFINE_IDA(simple_bridge_ida);
> +
> +static void drm_simple_bridge_release(struct device *dev)
> +{
> + struct auxiliary_device *adev = to_auxiliary_dev(dev);
> +
> + kfree(adev);
> +}
> +
> +static void drm_simple_bridge_unregister_adev(void *_adev)
> +{
> + struct auxiliary_device *adev = _adev;
> +
> + auxiliary_device_delete(adev);
> + auxiliary_device_uninit(adev);
> +}
> +
> +int drm_simple_bridge_register(struct device *parent)
> +{
> + struct auxiliary_device *adev;
> + int ret;
> +
> + adev = kzalloc(sizeof(*adev), GFP_KERNEL);
> + if (!adev)
> + return -ENOMEM;
> +
> + ret = ida_alloc(&simple_bridge_ida, GFP_KERNEL);
> + if (ret < 0)
> + return ret;
> +
> + adev->id = ret;
> + adev->name = "simple_bridge";
> + adev->dev.parent = parent;
> + adev->dev.of_node = parent->of_node;
> + adev->dev.release = drm_simple_bridge_release;
> +
> + ret = auxiliary_device_init(adev);
> + if (ret) {
> + kfree(adev);
> + return ret;
> + }
> +
> + ret = auxiliary_device_add(adev);
> + if (ret) {
> + auxiliary_device_uninit(adev);
> + return ret;
> + }
> +
> + return devm_add_action_or_reset(parent, drm_simple_bridge_unregister_adev, adev);
> +}
> +EXPORT_SYMBOL_GPL(drm_simple_bridge_register);
> +
> +struct drm_simple_bridge_data {
> + struct drm_bridge bridge;
> + struct drm_bridge *next_bridge;
> + struct device *dev;
> +};
> +
> +static int drm_simple_bridge_attach(struct drm_bridge *bridge,
> + enum drm_bridge_attach_flags flags)
> +{
> + struct drm_simple_bridge_data *data;
> +
> + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
> + return -EINVAL;
> +
> + data = container_of(bridge, struct drm_simple_bridge_data, bridge);
> +
> + return drm_bridge_attach(bridge->encoder, data->next_bridge, bridge,
> + DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> +}
> +
> +static const struct drm_bridge_funcs drm_simple_bridge_funcs = {
> + .attach = drm_simple_bridge_attach,
> +};
> +
> +static int drm_simple_bridge_probe(struct auxiliary_device *auxdev,
> + const struct auxiliary_device_id *id)
> +{
> + struct drm_simple_bridge_data *data;
> +
> + data = devm_kzalloc(&auxdev->dev, sizeof(*data), GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> +
> + data->dev = &auxdev->dev;
> + data->next_bridge = devm_drm_of_get_bridge(&auxdev->dev, auxdev->dev.of_node, 0, 0);
> + if (IS_ERR(data->next_bridge))
> + return dev_err_probe(&auxdev->dev, PTR_ERR(data->next_bridge),
> + "failed to acquire drm_bridge\n");
> +
> + data->bridge.funcs = &drm_simple_bridge_funcs;
> +#ifdef CONFIG_OF
> + data->bridge.of_node = data->dev->of_node;
> +#endif
I think the whole stuff should depend on OF since devm_drm_of_get_bridge() is a no-op when !OF
> +
> + return devm_drm_bridge_add(data->dev, &data->bridge);
> +}
> +
> +static const struct auxiliary_device_id drm_simple_bridge_table[] = {
> + { .name = KBUILD_MODNAME ".simple_bridge" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(auxiliary, drm_simple_bridge_table);
> +
> +struct auxiliary_driver drm_simple_bridge_drv = {
> + .name = "simple_bridge",
> + .id_table = drm_simple_bridge_table,
> + .probe = drm_simple_bridge_probe,
> +};
> +module_auxiliary_driver(drm_simple_bridge_drv);
> +
> +MODULE_AUTHOR("Dmitry Baryshkov <dmitry.baryshkov@linaro.org>");
> +MODULE_DESCRIPTION("DRM simple bridge helper");
> +MODULE_LICENSE("GPL");
> diff --git a/include/drm/display/drm_simple_bridge.h b/include/drm/display/drm_simple_bridge.h
> new file mode 100644
> index 000000000000..3da8e1fb1137
> --- /dev/null
> +++ b/include/drm/display/drm_simple_bridge.h
> @@ -0,0 +1,19 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2023 Linaro Ltd.
> + *
> + * Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> + */
> +#ifndef DRM_SIMPLE_BRIDGE_H
> +#define DRM_SIMPLE_BRIDGE_H
> +
> +#if IS_ENABLED(CONFIG_DRM_SIMPLE_BRIDGE)
> +int drm_simple_bridge_register(struct device *parent);
> +#else
> +static inline int drm_simple_bridge_register(struct device *parent)
> +{
> + return 0;
> +}
> +#endif
> +
> +#endif
The design looks fine, but I'll need another review.
Thanks,
Neil
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/3] drm/display: add transparent bridge helper
2023-08-02 8:15 ` Neil Armstrong
@ 2023-08-02 9:12 ` Dmitry Baryshkov
0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-02 9:12 UTC (permalink / raw)
To: neil.armstrong
Cc: Kishon Vijay Abraham I, freedreno, Heikki Krogerus,
Greg Kroah-Hartman, Bjorn Andersson, linux-usb, dri-devel,
Konrad Dybcio, Vinod Koul, Andy Gross, linux-arm-msm, linux-phy
On Wed, 2 Aug 2023 at 11:15, Neil Armstrong <neil.armstrong@linaro.org> wrote:
>
> Hi,
>
> On 02/08/2023 03:18, Dmitry Baryshkov wrote:
> > Define a helper for creating simple transparent bridges which serve the
> > only purpose of linking devices into the bridge chain up to the last
> > bridge representing the connector. This is especially useful for
> > DP/USB-C bridge chains, which can span across several devices, but do
> > not require any additional functionality from the intermediate bridges.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> > drivers/gpu/drm/display/Kconfig | 9 ++
> > drivers/gpu/drm/display/Makefile | 2 +
> > drivers/gpu/drm/display/drm_simple_bridge.c | 127 ++++++++++++++++++++
>
> I wonder why drm/display/ and not drm/bridge ?
>
> It's an helper, but it's mainly a bridge.
Why not? I'm open to any suggestions.
>
> > include/drm/display/drm_simple_bridge.h | 19 +++
> > 4 files changed, 157 insertions(+)
> > create mode 100644 drivers/gpu/drm/display/drm_simple_bridge.c
> > create mode 100644 include/drm/display/drm_simple_bridge.h
> >
> > diff --git a/drivers/gpu/drm/display/Kconfig b/drivers/gpu/drm/display/Kconfig
> > index 09712b88a5b8..a6132984b9e3 100644
> > --- a/drivers/gpu/drm/display/Kconfig
> > +++ b/drivers/gpu/drm/display/Kconfig
> > @@ -49,3 +49,12 @@ config DRM_DP_CEC
> >
> > Note: not all adapters support this feature, and even for those
> > that do support this they often do not hook up the CEC pin.
> > +
> > +config DRM_SIMPLE_BRIDGE
> > + tristate
> > + depends on DRM
> > + select AUXILIARY_BUS
> > + select DRM_PANEL_BRIDGE
> > + help
> > + Simple transparent bridge that is used by several drivers to build
> > + bridges chain.
> > diff --git a/drivers/gpu/drm/display/Makefile b/drivers/gpu/drm/display/Makefile
> > index 17ac4a1006a8..6e2b0d7f24b3 100644
> > --- a/drivers/gpu/drm/display/Makefile
> > +++ b/drivers/gpu/drm/display/Makefile
> > @@ -16,3 +16,5 @@ drm_display_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
> > drm_display_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o
> >
> > obj-$(CONFIG_DRM_DISPLAY_HELPER) += drm_display_helper.o
> > +
> > +obj-$(CONFIG_DRM_SIMPLE_BRIDGE) += drm_simple_bridge.o
> > diff --git a/drivers/gpu/drm/display/drm_simple_bridge.c b/drivers/gpu/drm/display/drm_simple_bridge.c
> > new file mode 100644
> > index 000000000000..9e80efe67b93
> > --- /dev/null
> > +++ b/drivers/gpu/drm/display/drm_simple_bridge.c
> > @@ -0,0 +1,127 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2023 Linaro Ltd.
> > + *
> > + * Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > + */
> > +#include <linux/auxiliary_bus.h>
> > +#include <linux/module.h>
> > +
> > +#include <drm/drm_bridge.h>
> > +#include <drm/display/drm_simple_bridge.h>
> > +
> > +static DEFINE_IDA(simple_bridge_ida);
> > +
> > +static void drm_simple_bridge_release(struct device *dev)
> > +{
> > + struct auxiliary_device *adev = to_auxiliary_dev(dev);
> > +
> > + kfree(adev);
> > +}
> > +
> > +static void drm_simple_bridge_unregister_adev(void *_adev)
> > +{
> > + struct auxiliary_device *adev = _adev;
> > +
> > + auxiliary_device_delete(adev);
> > + auxiliary_device_uninit(adev);
> > +}
> > +
> > +int drm_simple_bridge_register(struct device *parent)
> > +{
> > + struct auxiliary_device *adev;
> > + int ret;
> > +
> > + adev = kzalloc(sizeof(*adev), GFP_KERNEL);
> > + if (!adev)
> > + return -ENOMEM;
> > +
> > + ret = ida_alloc(&simple_bridge_ida, GFP_KERNEL);
> > + if (ret < 0)
> > + return ret;
> > +
> > + adev->id = ret;
> > + adev->name = "simple_bridge";
> > + adev->dev.parent = parent;
> > + adev->dev.of_node = parent->of_node;
> > + adev->dev.release = drm_simple_bridge_release;
> > +
> > + ret = auxiliary_device_init(adev);
> > + if (ret) {
> > + kfree(adev);
> > + return ret;
> > + }
> > +
> > + ret = auxiliary_device_add(adev);
> > + if (ret) {
> > + auxiliary_device_uninit(adev);
> > + return ret;
> > + }
> > +
> > + return devm_add_action_or_reset(parent, drm_simple_bridge_unregister_adev, adev);
> > +}
> > +EXPORT_SYMBOL_GPL(drm_simple_bridge_register);
> > +
> > +struct drm_simple_bridge_data {
> > + struct drm_bridge bridge;
> > + struct drm_bridge *next_bridge;
> > + struct device *dev;
> > +};
> > +
> > +static int drm_simple_bridge_attach(struct drm_bridge *bridge,
> > + enum drm_bridge_attach_flags flags)
> > +{
> > + struct drm_simple_bridge_data *data;
> > +
> > + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
> > + return -EINVAL;
> > +
> > + data = container_of(bridge, struct drm_simple_bridge_data, bridge);
> > +
> > + return drm_bridge_attach(bridge->encoder, data->next_bridge, bridge,
> > + DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> > +}
> > +
> > +static const struct drm_bridge_funcs drm_simple_bridge_funcs = {
> > + .attach = drm_simple_bridge_attach,
> > +};
> > +
> > +static int drm_simple_bridge_probe(struct auxiliary_device *auxdev,
> > + const struct auxiliary_device_id *id)
> > +{
> > + struct drm_simple_bridge_data *data;
> > +
> > + data = devm_kzalloc(&auxdev->dev, sizeof(*data), GFP_KERNEL);
> > + if (!data)
> > + return -ENOMEM;
> > +
> > + data->dev = &auxdev->dev;
> > + data->next_bridge = devm_drm_of_get_bridge(&auxdev->dev, auxdev->dev.of_node, 0, 0);
> > + if (IS_ERR(data->next_bridge))
> > + return dev_err_probe(&auxdev->dev, PTR_ERR(data->next_bridge),
> > + "failed to acquire drm_bridge\n");
> > +
> > + data->bridge.funcs = &drm_simple_bridge_funcs;
> > +#ifdef CONFIG_OF
> > + data->bridge.of_node = data->dev->of_node;
> > +#endif
>
> I think the whole stuff should depend on OF since devm_drm_of_get_bridge() is a no-op when !OF
Hmm, true. Probably we should rework bridges to use fwnode at some point.
>
> > +
> > + return devm_drm_bridge_add(data->dev, &data->bridge);
> > +}
> > +
> > +static const struct auxiliary_device_id drm_simple_bridge_table[] = {
> > + { .name = KBUILD_MODNAME ".simple_bridge" },
> > + {},
> > +};
> > +MODULE_DEVICE_TABLE(auxiliary, drm_simple_bridge_table);
> > +
> > +struct auxiliary_driver drm_simple_bridge_drv = {
> > + .name = "simple_bridge",
> > + .id_table = drm_simple_bridge_table,
> > + .probe = drm_simple_bridge_probe,
> > +};
> > +module_auxiliary_driver(drm_simple_bridge_drv);
> > +
> > +MODULE_AUTHOR("Dmitry Baryshkov <dmitry.baryshkov@linaro.org>");
> > +MODULE_DESCRIPTION("DRM simple bridge helper");
> > +MODULE_LICENSE("GPL");
> > diff --git a/include/drm/display/drm_simple_bridge.h b/include/drm/display/drm_simple_bridge.h
> > new file mode 100644
> > index 000000000000..3da8e1fb1137
> > --- /dev/null
> > +++ b/include/drm/display/drm_simple_bridge.h
> > @@ -0,0 +1,19 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2023 Linaro Ltd.
> > + *
> > + * Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > + */
> > +#ifndef DRM_SIMPLE_BRIDGE_H
> > +#define DRM_SIMPLE_BRIDGE_H
> > +
> > +#if IS_ENABLED(CONFIG_DRM_SIMPLE_BRIDGE)
> > +int drm_simple_bridge_register(struct device *parent);
> > +#else
> > +static inline int drm_simple_bridge_register(struct device *parent)
> > +{
> > + return 0;
> > +}
> > +#endif
> > +
> > +#endif
>
> The design looks fine, but I'll need another review.
>
> Thanks,
> Neil
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/3] usb: typec: nb7vpq904m: switch to DRM_SIMPLE_BRIDGE
2023-08-02 1:18 ` [PATCH v3 3/3] usb: typec: nb7vpq904m: " Dmitry Baryshkov
@ 2023-08-02 11:00 ` Heikki Krogerus
2023-08-08 19:15 ` kernel test robot
1 sibling, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2023-08-02 11:00 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Kishon Vijay Abraham I, Neil Armstrong, Greg Kroah-Hartman,
Bjorn Andersson, linux-usb, dri-devel, Konrad Dybcio, Vinod Koul,
Andy Gross, linux-arm-msm, linux-phy, freedreno
On Wed, Aug 02, 2023 at 04:18:45AM +0300, Dmitry Baryshkov wrote:
> Switch to using the new DRM_SIMPLE_BRIDGE helper to create the
> transparent DRM bridge device instead of handcoding corresponding
> functionality.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/mux/Kconfig | 2 +-
> drivers/usb/typec/mux/nb7vpq904m.c | 44 ++----------------------------
> 2 files changed, 3 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/usb/typec/mux/Kconfig b/drivers/usb/typec/mux/Kconfig
> index 784b9d8107e9..350a7ffce67e 100644
> --- a/drivers/usb/typec/mux/Kconfig
> +++ b/drivers/usb/typec/mux/Kconfig
> @@ -39,7 +39,7 @@ config TYPEC_MUX_NB7VPQ904M
> tristate "On Semiconductor NB7VPQ904M Type-C redriver driver"
> depends on I2C
> depends on DRM || DRM=n
> - select DRM_PANEL_BRIDGE if DRM
> + select DRM_SIMPLE_BRIDGE if DRM
> select REGMAP_I2C
> help
> Say Y or M if your system has a On Semiconductor NB7VPQ904M Type-C
> diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c
> index 9360b65e8b06..c89a956412ea 100644
> --- a/drivers/usb/typec/mux/nb7vpq904m.c
> +++ b/drivers/usb/typec/mux/nb7vpq904m.c
> @@ -11,7 +11,7 @@
> #include <linux/regmap.h>
> #include <linux/bitfield.h>
> #include <linux/of_graph.h>
> -#include <drm/drm_bridge.h>
> +#include <drm/display/drm_simple_bridge.h>
> #include <linux/usb/typec_dp.h>
> #include <linux/usb/typec_mux.h>
> #include <linux/usb/typec_retimer.h>
> @@ -70,8 +70,6 @@ struct nb7vpq904m {
> bool swap_data_lanes;
> struct typec_switch *typec_switch;
>
> - struct drm_bridge bridge;
> -
> struct mutex lock; /* protect non-concurrent retimer & switch */
>
> enum typec_orientation orientation;
> @@ -297,44 +295,6 @@ static int nb7vpq904m_retimer_set(struct typec_retimer *retimer, struct typec_re
> return ret;
> }
>
> -#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
> -static int nb7vpq904m_bridge_attach(struct drm_bridge *bridge,
> - enum drm_bridge_attach_flags flags)
> -{
> - struct nb7vpq904m *nb7 = container_of(bridge, struct nb7vpq904m, bridge);
> - struct drm_bridge *next_bridge;
> -
> - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
> - return -EINVAL;
> -
> - next_bridge = devm_drm_of_get_bridge(&nb7->client->dev, nb7->client->dev.of_node, 0, 0);
> - if (IS_ERR(next_bridge)) {
> - dev_err(&nb7->client->dev, "failed to acquire drm_bridge: %pe\n", next_bridge);
> - return PTR_ERR(next_bridge);
> - }
> -
> - return drm_bridge_attach(bridge->encoder, next_bridge, bridge,
> - DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> -}
> -
> -static const struct drm_bridge_funcs nb7vpq904m_bridge_funcs = {
> - .attach = nb7vpq904m_bridge_attach,
> -};
> -
> -static int nb7vpq904m_register_bridge(struct nb7vpq904m *nb7)
> -{
> - nb7->bridge.funcs = &nb7vpq904m_bridge_funcs;
> - nb7->bridge.of_node = nb7->client->dev.of_node;
> -
> - return devm_drm_bridge_add(&nb7->client->dev, &nb7->bridge);
> -}
> -#else
> -static int nb7vpq904m_register_bridge(struct nb7vpq904m *nb7)
> -{
> - return 0;
> -}
> -#endif
> -
> static const struct regmap_config nb7_regmap = {
> .max_register = 0x1f,
> .reg_bits = 8,
> @@ -461,7 +421,7 @@ static int nb7vpq904m_probe(struct i2c_client *client)
>
> gpiod_set_value(nb7->enable_gpio, 1);
>
> - ret = nb7vpq904m_register_bridge(nb7);
> + ret = drm_simple_bridge_register(dev);
> if (ret)
> return ret;
>
> --
> 2.39.2
--
heikki
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/3] drm/display: add transparent bridge helper
2023-08-02 1:18 ` [PATCH v3 1/3] drm/display: add transparent bridge helper Dmitry Baryshkov
2023-08-02 8:08 ` Neil Armstrong
2023-08-02 8:15 ` Neil Armstrong
@ 2023-08-06 12:30 ` kernel test robot
2023-08-09 7:58 ` Dan Carpenter
3 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2023-08-06 12:30 UTC (permalink / raw)
To: Dmitry Baryshkov, David Airlie, Daniel Vetter, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, Heikki Krogerus, Greg Kroah-Hartman,
Neil Armstrong
Cc: linux-arm-msm, linux-usb, dri-devel, oe-kbuild-all, linux-phy, freedreno
Hi Dmitry,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on usb/usb-testing usb/usb-next usb/usb-linus drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.5-rc4 next-20230804]
[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/Dmitry-Baryshkov/drm-display-add-transparent-bridge-helper/20230802-091932
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20230802011845.4176631-2-dmitry.baryshkov%40linaro.org
patch subject: [PATCH v3 1/3] drm/display: add transparent bridge helper
config: i386-randconfig-r072-20230806 (https://download.01.org/0day-ci/archive/20230806/202308062017.iKU92hML-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230806/202308062017.iKU92hML-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308062017.iKU92hML-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/display/drm_simple_bridge.c:118:25: sparse: sparse: symbol 'drm_simple_bridge_drv' was not declared. Should it be static?
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/3] usb: typec: nb7vpq904m: switch to DRM_SIMPLE_BRIDGE
2023-08-02 1:18 ` [PATCH v3 3/3] usb: typec: nb7vpq904m: " Dmitry Baryshkov
2023-08-02 11:00 ` Heikki Krogerus
@ 2023-08-08 19:15 ` kernel test robot
1 sibling, 0 replies; 12+ messages in thread
From: kernel test robot @ 2023-08-08 19:15 UTC (permalink / raw)
To: Dmitry Baryshkov, David Airlie, Daniel Vetter, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, Heikki Krogerus, Greg Kroah-Hartman,
Neil Armstrong
Cc: linux-usb, linux-arm-msm, llvm, dri-devel, oe-kbuild-all,
linux-phy, freedreno
Hi Dmitry,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on usb/usb-testing usb/usb-next usb/usb-linus drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.5-rc5 next-20230808]
[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/Dmitry-Baryshkov/drm-display-add-transparent-bridge-helper/20230802-091932
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20230802011845.4176631-4-dmitry.baryshkov%40linaro.org
patch subject: [PATCH v3 3/3] usb: typec: nb7vpq904m: switch to DRM_SIMPLE_BRIDGE
config: s390-randconfig-r033-20230808 (https://download.01.org/0day-ci/archive/20230809/202308090347.sZtwmCUB-lkp@intel.com/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce: (https://download.01.org/0day-ci/archive/20230809/202308090347.sZtwmCUB-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308090347.sZtwmCUB-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/bridge/simple-bridge.c:212:18: error: no member named 'of_node' in 'struct drm_bridge'
sbridge->bridge.of_node = pdev->dev.of_node;
~~~~~~~~~~~~~~~ ^
1 error generated.
vim +212 drivers/gpu/drm/bridge/simple-bridge.c
56fe8b6f499167 drivers/gpu/drm/bridge/dumb-vga-dac.c Maxime Ripard 2016-09-30 168
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 169 static int simple_bridge_probe(struct platform_device *pdev)
56fe8b6f499167 drivers/gpu/drm/bridge/dumb-vga-dac.c Maxime Ripard 2016-09-30 170 {
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 171 struct simple_bridge *sbridge;
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 172 struct device_node *remote;
56fe8b6f499167 drivers/gpu/drm/bridge/dumb-vga-dac.c Maxime Ripard 2016-09-30 173
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 174 sbridge = devm_kzalloc(&pdev->dev, sizeof(*sbridge), GFP_KERNEL);
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 175 if (!sbridge)
56fe8b6f499167 drivers/gpu/drm/bridge/dumb-vga-dac.c Maxime Ripard 2016-09-30 176 return -ENOMEM;
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 177 platform_set_drvdata(pdev, sbridge);
56fe8b6f499167 drivers/gpu/drm/bridge/dumb-vga-dac.c Maxime Ripard 2016-09-30 178
272378ec0eb972 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-02-26 179 sbridge->info = of_device_get_match_data(&pdev->dev);
272378ec0eb972 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-02-26 180
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 181 /* Get the next bridge in the pipeline. */
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 182 remote = of_graph_get_remote_node(pdev->dev.of_node, 1, -1);
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 183 if (!remote)
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 184 return -EINVAL;
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 185
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 186 sbridge->next_bridge = of_drm_find_bridge(remote);
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 187 of_node_put(remote);
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 188
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 189 if (!sbridge->next_bridge) {
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 190 dev_dbg(&pdev->dev, "Next bridge not found, deferring probe\n");
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 191 return -EPROBE_DEFER;
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 192 }
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 193
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 194 /* Get the regulator and GPIO resources. */
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 195 sbridge->vdd = devm_regulator_get_optional(&pdev->dev, "vdd");
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 196 if (IS_ERR(sbridge->vdd)) {
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 197 int ret = PTR_ERR(sbridge->vdd);
af948a25ecb214 drivers/gpu/drm/bridge/dumb-vga-dac.c Chen-Yu Tsai 2016-11-16 198 if (ret == -EPROBE_DEFER)
af948a25ecb214 drivers/gpu/drm/bridge/dumb-vga-dac.c Chen-Yu Tsai 2016-11-16 199 return -EPROBE_DEFER;
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 200 sbridge->vdd = NULL;
af948a25ecb214 drivers/gpu/drm/bridge/dumb-vga-dac.c Chen-Yu Tsai 2016-11-16 201 dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret);
af948a25ecb214 drivers/gpu/drm/bridge/dumb-vga-dac.c Chen-Yu Tsai 2016-11-16 202 }
af948a25ecb214 drivers/gpu/drm/bridge/dumb-vga-dac.c Chen-Yu Tsai 2016-11-16 203
2df6428e290a61 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-02-26 204 sbridge->enable = devm_gpiod_get_optional(&pdev->dev, "enable",
2df6428e290a61 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-02-26 205 GPIOD_OUT_LOW);
db8496d0b50519 drivers/gpu/drm/bridge/simple-bridge.c Ye Xingchen 2023-03-22 206 if (IS_ERR(sbridge->enable))
db8496d0b50519 drivers/gpu/drm/bridge/simple-bridge.c Ye Xingchen 2023-03-22 207 return dev_err_probe(&pdev->dev, PTR_ERR(sbridge->enable),
db8496d0b50519 drivers/gpu/drm/bridge/simple-bridge.c Ye Xingchen 2023-03-22 208 "Unable to retrieve enable GPIO\n");
2df6428e290a61 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-02-26 209
00686ac55d0a21 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-05-26 210 /* Register the bridge. */
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 211 sbridge->bridge.funcs = &simple_bridge_bridge_funcs;
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 @212 sbridge->bridge.of_node = pdev->dev.of_node;
272378ec0eb972 drivers/gpu/drm/bridge/simple-bridge.c Laurent Pinchart 2020-02-26 213 sbridge->bridge.timings = sbridge->info->timings;
56fe8b6f499167 drivers/gpu/drm/bridge/dumb-vga-dac.c Maxime Ripard 2016-09-30 214
94ded532ffdb42 drivers/gpu/drm/bridge/dumb-vga-dac.c Laurent Pinchart 2020-02-26 215 drm_bridge_add(&sbridge->bridge);
56fe8b6f499167 drivers/gpu/drm/bridge/dumb-vga-dac.c Maxime Ripard 2016-09-30 216
47e34278549ca4 drivers/gpu/drm/bridge/dumb-vga-dac.c Inki Dae 2017-07-03 217 return 0;
56fe8b6f499167 drivers/gpu/drm/bridge/dumb-vga-dac.c Maxime Ripard 2016-09-30 218 }
56fe8b6f499167 drivers/gpu/drm/bridge/dumb-vga-dac.c Maxime Ripard 2016-09-30 219
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/3] drm/display: add transparent bridge helper
2023-08-02 1:18 ` [PATCH v3 1/3] drm/display: add transparent bridge helper Dmitry Baryshkov
` (2 preceding siblings ...)
2023-08-06 12:30 ` kernel test robot
@ 2023-08-09 7:58 ` Dan Carpenter
3 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2023-08-09 7:58 UTC (permalink / raw)
To: oe-kbuild, Dmitry Baryshkov, David Airlie, Daniel Vetter,
Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, Heikki Krogerus, Greg Kroah-Hartman,
Neil Armstrong
Cc: lkp, linux-arm-msm, linux-usb, dri-devel, oe-kbuild-all,
linux-phy, freedreno
Hi Dmitry,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Dmitry-Baryshkov/drm-display-add-transparent-bridge-helper/20230802-091932
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20230802011845.4176631-2-dmitry.baryshkov%40linaro.org
patch subject: [PATCH v3 1/3] drm/display: add transparent bridge helper
config: x86_64-randconfig-m001-20230808 (https://download.01.org/0day-ci/archive/20230809/202308090559.RMlH2Dl6-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230809/202308090559.RMlH2Dl6-lkp@intel.com/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 <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202308090559.RMlH2Dl6-lkp@intel.com/
smatch warnings:
drivers/gpu/drm/display/drm_simple_bridge.c:41 drm_simple_bridge_register() warn: possible memory leak of 'adev'
vim +/adev +41 drivers/gpu/drm/display/drm_simple_bridge.c
abf701043719cd Dmitry Baryshkov 2023-08-02 30 int drm_simple_bridge_register(struct device *parent)
abf701043719cd Dmitry Baryshkov 2023-08-02 31 {
abf701043719cd Dmitry Baryshkov 2023-08-02 32 struct auxiliary_device *adev;
abf701043719cd Dmitry Baryshkov 2023-08-02 33 int ret;
abf701043719cd Dmitry Baryshkov 2023-08-02 34
abf701043719cd Dmitry Baryshkov 2023-08-02 35 adev = kzalloc(sizeof(*adev), GFP_KERNEL);
abf701043719cd Dmitry Baryshkov 2023-08-02 36 if (!adev)
abf701043719cd Dmitry Baryshkov 2023-08-02 37 return -ENOMEM;
abf701043719cd Dmitry Baryshkov 2023-08-02 38
abf701043719cd Dmitry Baryshkov 2023-08-02 39 ret = ida_alloc(&simple_bridge_ida, GFP_KERNEL);
abf701043719cd Dmitry Baryshkov 2023-08-02 40 if (ret < 0)
abf701043719cd Dmitry Baryshkov 2023-08-02 @41 return ret;
kfree(adev);
abf701043719cd Dmitry Baryshkov 2023-08-02 42
abf701043719cd Dmitry Baryshkov 2023-08-02 43 adev->id = ret;
abf701043719cd Dmitry Baryshkov 2023-08-02 44 adev->name = "simple_bridge";
abf701043719cd Dmitry Baryshkov 2023-08-02 45 adev->dev.parent = parent;
abf701043719cd Dmitry Baryshkov 2023-08-02 46 adev->dev.of_node = parent->of_node;
abf701043719cd Dmitry Baryshkov 2023-08-02 47 adev->dev.release = drm_simple_bridge_release;
abf701043719cd Dmitry Baryshkov 2023-08-02 48
abf701043719cd Dmitry Baryshkov 2023-08-02 49 ret = auxiliary_device_init(adev);
abf701043719cd Dmitry Baryshkov 2023-08-02 50 if (ret) {
abf701043719cd Dmitry Baryshkov 2023-08-02 51 kfree(adev);
This needs to ida_free(&simple_bridge_ida, adev->id) as well. There is
a smatch check for this (check_unwind.c) but I guess I plan to re-write
it a bit before I turn that on.
abf701043719cd Dmitry Baryshkov 2023-08-02 52 return ret;
abf701043719cd Dmitry Baryshkov 2023-08-02 53 }
abf701043719cd Dmitry Baryshkov 2023-08-02 54
abf701043719cd Dmitry Baryshkov 2023-08-02 55 ret = auxiliary_device_add(adev);
abf701043719cd Dmitry Baryshkov 2023-08-02 56 if (ret) {
abf701043719cd Dmitry Baryshkov 2023-08-02 57 auxiliary_device_uninit(adev);
abf701043719cd Dmitry Baryshkov 2023-08-02 58 return ret;
abf701043719cd Dmitry Baryshkov 2023-08-02 59 }
abf701043719cd Dmitry Baryshkov 2023-08-02 60
abf701043719cd Dmitry Baryshkov 2023-08-02 61 return devm_add_action_or_reset(parent, drm_simple_bridge_unregister_adev, adev);
abf701043719cd Dmitry Baryshkov 2023-08-02 62 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-08-09 7:58 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-02 1:18 [PATCH v3 0/3] drm/display: simplify support for transparent DRM bridges Dmitry Baryshkov
2023-08-02 1:18 ` [PATCH v3 1/3] drm/display: add transparent bridge helper Dmitry Baryshkov
2023-08-02 8:08 ` Neil Armstrong
2023-08-02 8:09 ` Neil Armstrong
2023-08-02 8:15 ` Neil Armstrong
2023-08-02 9:12 ` Dmitry Baryshkov
2023-08-06 12:30 ` kernel test robot
2023-08-09 7:58 ` Dan Carpenter
2023-08-02 1:18 ` [PATCH v3 2/3] phy: qcom: qmp-combo: switch to DRM_SIMPLE_BRIDGE Dmitry Baryshkov
2023-08-02 1:18 ` [PATCH v3 3/3] usb: typec: nb7vpq904m: " Dmitry Baryshkov
2023-08-02 11:00 ` Heikki Krogerus
2023-08-08 19:15 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).