All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] drm/display: simplify support for transparent DRM bridges
@ 2023-08-02  1:18 ` Dmitry Baryshkov
  0 siblings, 0 replies; 37+ 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: dri-devel, linux-arm-msm, linux-phy, linux-usb, freedreno

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] 37+ messages in thread
* Re: [PATCH v3 1/3] drm/display: add transparent bridge helper
@ 2023-08-08 21:58 kernel test robot
  0 siblings, 0 replies; 37+ messages in thread
From: kernel test robot @ 2023-08-08 21:58 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20230802011845.4176631-2-dmitry.baryshkov@linaro.org>
References: <20230802011845.4176631-2-dmitry.baryshkov@linaro.org>
TO: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
TO: David Airlie <airlied@gmail.com>
TO: Daniel Vetter <daniel@ffwll.ch>
TO: Andy Gross <agross@kernel.org>
TO: Bjorn Andersson <andersson@kernel.org>
TO: Konrad Dybcio <konrad.dybcio@linaro.org>
TO: Vinod Koul <vkoul@kernel.org>
TO: Kishon Vijay Abraham I <kishon@kernel.org>
TO: Heikki Krogerus <heikki.krogerus@linux.intel.com>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
TO: Neil Armstrong <neil.armstrong@linaro.org>
CC: linux-phy@lists.infradead.org
CC: linux-arm-msm@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: freedreno@lists.freedesktop.org
CC: dri-devel@lists.freedesktop.org

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-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-2-dmitry.baryshkov%40linaro.org
patch subject: [PATCH v3 1/3] drm/display: add transparent bridge helper
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago
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 <error27@gmail.com>
| 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  29  
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;
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);
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  }
abf701043719cd Dmitry Baryshkov 2023-08-02  63  EXPORT_SYMBOL_GPL(drm_simple_bridge_register);
abf701043719cd Dmitry Baryshkov 2023-08-02  64  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2023-08-09  7:58 UTC | newest]

Thread overview: 37+ 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 ` Dmitry Baryshkov
2023-08-02  1:18 ` 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   ` Dmitry Baryshkov
2023-08-02  8:08   ` Neil Armstrong
2023-08-02  8:08     ` Neil Armstrong
2023-08-02  8:08     ` Neil Armstrong
2023-08-02  8:09     ` Neil Armstrong
2023-08-02  8:09       ` Neil Armstrong
2023-08-02  8:09       ` Neil Armstrong
2023-08-02  8:15   ` Neil Armstrong
2023-08-02  8:15     ` Neil Armstrong
2023-08-02  8:15     ` Neil Armstrong
2023-08-02  9:12     ` Dmitry Baryshkov
2023-08-02  9:12       ` Dmitry Baryshkov
2023-08-02  9:12       ` Dmitry Baryshkov
2023-08-06 12:30   ` kernel test robot
2023-08-06 12:30     ` kernel test robot
2023-08-06 12:30     ` kernel test robot
2023-08-09  7:58   ` Dan Carpenter
2023-08-09  7:58     ` Dan Carpenter
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   ` Dmitry Baryshkov
2023-08-02  1:18   ` Dmitry Baryshkov
2023-08-02  1:18 ` [PATCH v3 3/3] usb: typec: nb7vpq904m: " Dmitry Baryshkov
2023-08-02  1:18   ` Dmitry Baryshkov
2023-08-02  1:18   ` Dmitry Baryshkov
2023-08-02 11:00   ` Heikki Krogerus
2023-08-02 11:00     ` Heikki Krogerus
2023-08-02 11:00     ` Heikki Krogerus
2023-08-08 19:15   ` kernel test robot
2023-08-08 19:15     ` kernel test robot
2023-08-08 19:15     ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-08-08 21:58 [PATCH v3 1/3] drm/display: add transparent bridge helper kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.