All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] typec: mux: Introduce support for multiple TypeC muxes
@ 2021-12-28  5:21 ` Bjorn Andersson
  0 siblings, 0 replies; 62+ messages in thread
From: Bjorn Andersson @ 2021-12-28  5:21 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Rob Herring,
	Greg Kroah-Hartman, Heikki Krogerus, Hans de Goede
  Cc: Rafael J. Wysocki, linux-arm-msm, linux-phy, devicetree,
	linux-kernel, linux-usb

This series introduces a level of indirection between the controller's view of
a typec_mux/switch and the implementation and then expands that to support
multiple drivers.

This is needed in order to support devices such as the Qualcomm Snapdragon 888
HDK, which does muxing and orientation handling in the QMP (USB+DP) PHY and SBU
muxing in the external FSA4480 chip.

Additionally integration of typec mux and switch in the QMP PHY is included in
the series, as is the new FSA4480 driver. This is done to deal with the
renaming of the driver-side typec_mux -> typec_mux_dev.

Bjorn Andersson (8):
  dt-bindings: phy: qcom,qmp-usb3-dp: Add altmode/switch properties
  phy: qcom-qmp: Register typec mux and orientation switch
  device property: Helper to match multiple connections
  device property: Use multi-connection matchers for single case
  typec: mux: Introduce indirection
  typec: mux: Allow multiple mux_devs per mux
  dt-bindings: usb: Add binding for fcs,fsa4480
  usb: typec: mux: Add On Semi fsa4480 driver

 .../bindings/phy/qcom,qmp-usb3-dp-phy.yaml    |  14 +
 .../devicetree/bindings/usb/fcs,fsa4480.yaml  |  72 +++++
 drivers/base/property.c                       |  83 ++++--
 drivers/phy/qualcomm/phy-qcom-qmp.c           | 176 ++++++++++--
 drivers/usb/typec/bus.c                       |   2 +-
 drivers/usb/typec/mux.c                       | 257 +++++++++++++-----
 drivers/usb/typec/mux.h                       |  12 +-
 drivers/usb/typec/mux/Kconfig                 |   9 +
 drivers/usb/typec/mux/Makefile                |   1 +
 drivers/usb/typec/mux/fsa4480.c               | 220 +++++++++++++++
 drivers/usb/typec/mux/intel_pmc_mux.c         |   8 +-
 drivers/usb/typec/mux/pi3usb30532.c           |   8 +-
 include/linux/property.h                      |   5 +
 include/linux/usb/typec_mux.h                 |  22 +-
 14 files changed, 762 insertions(+), 127 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml
 create mode 100644 drivers/usb/typec/mux/fsa4480.c

-- 
2.33.1


^ permalink raw reply	[flat|nested] 62+ messages in thread
* Re: [PATCH 6/8] typec: mux: Allow multiple mux_devs per mux
  2021-12-28  5:21   ` Bjorn Andersson
  (?)
  (?)
@ 2022-01-06 10:43 ` Dan Carpenter
  -1 siblings, 0 replies; 62+ messages in thread
From: kernel test robot @ 2021-12-28 15:41 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 6158 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211228052116.1748443-7-bjorn.andersson@linaro.org>
References: <20211228052116.1748443-7-bjorn.andersson@linaro.org>
TO: Bjorn Andersson <bjorn.andersson@linaro.org>
TO: Kishon Vijay Abraham I <kishon@ti.com>
TO: Vinod Koul <vkoul@kernel.org>
TO: Rob Herring <robh+dt@kernel.org>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
TO: Heikki Krogerus <heikki.krogerus@linux.intel.com>
TO: Hans de Goede <hdegoede@redhat.com>
CC: "Rafael J. Wysocki" <rafael@kernel.org>
CC: linux-arm-msm(a)vger.kernel.org
CC: linux-phy(a)lists.infradead.org
CC: devicetree(a)vger.kernel.org

Hi Bjorn,

I love your patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on robh/for-next driver-core/driver-core-testing linus/master v5.16-rc7]
[cannot apply to next-20211224]
[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]

url:    https://github.com/0day-ci/linux/commits/Bjorn-Andersson/typec-mux-Introduce-support-for-multiple-TypeC-muxes/20211228-132045
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago
config: x86_64-randconfig-m001-20211228 (https://download.01.org/0day-ci/archive/20211228/202112282331.V8Kkx4jf-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/usb/typec/mux.c:114 fwnode_typec_switch_get() warn: possible memory leak of 'sw'
drivers/usb/typec/mux.c:373 fwnode_typec_mux_get() warn: possible memory leak of 'mux'

vim +/sw +114 drivers/usb/typec/mux.c

bdecb33af34f79 Heikki Krogerus 2018-03-20   61  
bdecb33af34f79 Heikki Krogerus 2018-03-20   62  /**
d1c6a769cdf466 Heikki Krogerus 2020-03-02   63   * fwnode_typec_switch_get - Find USB Type-C orientation switch
d1c6a769cdf466 Heikki Krogerus 2020-03-02   64   * @fwnode: The caller device node
bdecb33af34f79 Heikki Krogerus 2018-03-20   65   *
bdecb33af34f79 Heikki Krogerus 2018-03-20   66   * Finds a switch linked with @dev. Returns a reference to the switch on
bdecb33af34f79 Heikki Krogerus 2018-03-20   67   * success, NULL if no matching connection was found, or
bdecb33af34f79 Heikki Krogerus 2018-03-20   68   * ERR_PTR(-EPROBE_DEFER) when a connection was found but the switch
bdecb33af34f79 Heikki Krogerus 2018-03-20   69   * has not been enumerated yet.
bdecb33af34f79 Heikki Krogerus 2018-03-20   70   */
d1c6a769cdf466 Heikki Krogerus 2020-03-02   71  struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode)
bdecb33af34f79 Heikki Krogerus 2018-03-20   72  {
8ddb6d277ef580 Bjorn Andersson 2021-12-27   73  	struct typec_switch_dev *sw_devs[TYPEC_MUX_MAX_DEVS];
bdecb33af34f79 Heikki Krogerus 2018-03-20   74  	struct typec_switch *sw;
8ddb6d277ef580 Bjorn Andersson 2021-12-27   75  	int count;
8ddb6d277ef580 Bjorn Andersson 2021-12-27   76  	int err;
8ddb6d277ef580 Bjorn Andersson 2021-12-27   77  	int i;
bdecb33af34f79 Heikki Krogerus 2018-03-20   78  
8d7c70bd032dda Bjorn Andersson 2021-12-27   79  	sw = kzalloc(sizeof(*sw), GFP_KERNEL);
8d7c70bd032dda Bjorn Andersson 2021-12-27   80  	if (!sw)
8d7c70bd032dda Bjorn Andersson 2021-12-27   81  		return ERR_PTR(-ENOMEM);
8d7c70bd032dda Bjorn Andersson 2021-12-27   82  
8ddb6d277ef580 Bjorn Andersson 2021-12-27   83  	count = fwnode_connection_find_matches(fwnode, "orientation-switch", NULL,
8ddb6d277ef580 Bjorn Andersson 2021-12-27   84  					       typec_switch_match,
8ddb6d277ef580 Bjorn Andersson 2021-12-27   85  					       (void **)sw_devs,
8ddb6d277ef580 Bjorn Andersson 2021-12-27   86  					       ARRAY_SIZE(sw_devs));
8ddb6d277ef580 Bjorn Andersson 2021-12-27   87  	if (count <= 0) {
8d7c70bd032dda Bjorn Andersson 2021-12-27   88  		kfree(sw);
8ddb6d277ef580 Bjorn Andersson 2021-12-27   89  		return NULL;
8d7c70bd032dda Bjorn Andersson 2021-12-27   90  	}
8d7c70bd032dda Bjorn Andersson 2021-12-27   91  
8ddb6d277ef580 Bjorn Andersson 2021-12-27   92  	for (i = 0; i < count; i++) {
8ddb6d277ef580 Bjorn Andersson 2021-12-27   93  		if (IS_ERR(sw_devs[i])) {
8ddb6d277ef580 Bjorn Andersson 2021-12-27   94  			err = PTR_ERR(sw_devs[i]);
8ddb6d277ef580 Bjorn Andersson 2021-12-27   95  			goto put_sw_devs;
8ddb6d277ef580 Bjorn Andersson 2021-12-27   96  		}
8ddb6d277ef580 Bjorn Andersson 2021-12-27   97  	}
8ddb6d277ef580 Bjorn Andersson 2021-12-27   98  
8ddb6d277ef580 Bjorn Andersson 2021-12-27   99  	for (i = 0; i < count; i++) {
8ddb6d277ef580 Bjorn Andersson 2021-12-27  100  		WARN_ON(!try_module_get(sw_devs[i]->dev.parent->driver->owner));
8ddb6d277ef580 Bjorn Andersson 2021-12-27  101  		sw->sw_devs[i] = sw_devs[i];
8ddb6d277ef580 Bjorn Andersson 2021-12-27  102  	}
8d7c70bd032dda Bjorn Andersson 2021-12-27  103  
8ddb6d277ef580 Bjorn Andersson 2021-12-27  104  	sw->num_sw_devs = count;
bdecb33af34f79 Heikki Krogerus 2018-03-20  105  
bdecb33af34f79 Heikki Krogerus 2018-03-20  106  	return sw;
8ddb6d277ef580 Bjorn Andersson 2021-12-27  107  
8ddb6d277ef580 Bjorn Andersson 2021-12-27  108  put_sw_devs:
8ddb6d277ef580 Bjorn Andersson 2021-12-27  109  	for (i = 0; i < count; i++) {
8ddb6d277ef580 Bjorn Andersson 2021-12-27  110  		if (!IS_ERR(sw_devs[i]))
8ddb6d277ef580 Bjorn Andersson 2021-12-27  111  			put_device(&sw_devs[i]->dev);
8ddb6d277ef580 Bjorn Andersson 2021-12-27  112  	}
8ddb6d277ef580 Bjorn Andersson 2021-12-27  113  
8ddb6d277ef580 Bjorn Andersson 2021-12-27 @114  	return ERR_PTR(err);
bdecb33af34f79 Heikki Krogerus 2018-03-20  115  }
d1c6a769cdf466 Heikki Krogerus 2020-03-02  116  EXPORT_SYMBOL_GPL(fwnode_typec_switch_get);
bdecb33af34f79 Heikki Krogerus 2018-03-20  117  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

end of thread, other threads:[~2022-01-07 19:15 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28  5:21 [PATCH 0/8] typec: mux: Introduce support for multiple TypeC muxes Bjorn Andersson
2021-12-28  5:21 ` Bjorn Andersson
2021-12-28  5:21 ` [PATCH 1/8] dt-bindings: phy: qcom,qmp-usb3-dp: Add altmode/switch properties Bjorn Andersson
2021-12-28  5:21   ` [PATCH 1/8] dt-bindings: phy: qcom, qmp-usb3-dp: " Bjorn Andersson
2021-12-28  5:21 ` [PATCH 2/8] phy: qcom-qmp: Register typec mux and orientation switch Bjorn Andersson
2021-12-28  5:21   ` Bjorn Andersson
2021-12-28 12:25   ` Dmitry Baryshkov
2021-12-28 12:25     ` Dmitry Baryshkov
2021-12-28 13:59   ` kernel test robot
2021-12-28 13:59     ` kernel test robot
2021-12-28 13:59     ` kernel test robot
2021-12-28 16:20     ` Bjorn Andersson
2021-12-28 16:20       ` Bjorn Andersson
2021-12-28 16:20       ` Bjorn Andersson
2021-12-29  5:27   ` Vinod Koul
2021-12-29  5:27     ` Vinod Koul
2022-01-07 19:15     ` Bjorn Andersson
2022-01-07 19:15       ` Bjorn Andersson
2021-12-28  5:21 ` [PATCH 3/8] device property: Helper to match multiple connections Bjorn Andersson
2021-12-28  5:21   ` Bjorn Andersson
2021-12-28 13:09   ` Dmitry Baryshkov
2021-12-28 13:09     ` Dmitry Baryshkov
2021-12-28 17:04     ` Bjorn Andersson
2021-12-28 17:04       ` Bjorn Andersson
2021-12-28 18:24       ` Dmitry Baryshkov
2021-12-28 18:24         ` Dmitry Baryshkov
2021-12-28 18:42         ` Bjorn Andersson
2021-12-28 18:42           ` Bjorn Andersson
2021-12-29  5:40       ` Vinod Koul
2021-12-29  5:40         ` Vinod Koul
2021-12-30  9:26   ` Heikki Krogerus
2021-12-30  9:26     ` Heikki Krogerus
2021-12-31  9:09     ` Sakari Ailus
2021-12-31  9:09       ` Sakari Ailus
2022-01-05 20:43       ` Bjorn Andersson
2022-01-05 20:43         ` Bjorn Andersson
2022-01-07 14:33         ` Sakari Ailus
2022-01-07 14:33           ` Sakari Ailus
2022-01-07 15:15           ` Bjorn Andersson
2022-01-07 15:15             ` Bjorn Andersson
2021-12-28  5:21 ` [PATCH 4/8] device property: Use multi-connection matchers for single case Bjorn Andersson
2021-12-28  5:21   ` Bjorn Andersson
2021-12-28  5:21 ` [PATCH 5/8] typec: mux: Introduce indirection Bjorn Andersson
2021-12-28  5:21   ` Bjorn Andersson
2021-12-28  5:21 ` [PATCH 6/8] typec: mux: Allow multiple mux_devs per mux Bjorn Andersson
2021-12-28  5:21   ` Bjorn Andersson
2021-12-28 16:04   ` Dmitry Baryshkov
2021-12-28 16:04     ` Dmitry Baryshkov
2021-12-28 16:40     ` Bjorn Andersson
2021-12-28 16:40       ` Bjorn Andersson
2021-12-28  5:21 ` [PATCH 7/8] dt-bindings: usb: Add binding for fcs,fsa4480 Bjorn Andersson
2021-12-28  5:21   ` Bjorn Andersson
2021-12-28  5:21 ` [PATCH 8/8] usb: typec: mux: Add On Semi fsa4480 driver Bjorn Andersson
2021-12-28  5:21   ` Bjorn Andersson
2021-12-28 12:20 ` [PATCH 0/8] typec: mux: Introduce support for multiple TypeC muxes Hans de Goede
2021-12-28 12:20   ` Hans de Goede
2021-12-28 17:08   ` Bjorn Andersson
2021-12-28 17:08     ` Bjorn Andersson
2021-12-28 15:41 [PATCH 6/8] typec: mux: Allow multiple mux_devs per mux kernel test robot
2022-01-06 10:43 ` Dan Carpenter
2022-01-06 10:43 ` Dan Carpenter
2022-01-06 10:43 ` Dan Carpenter

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.