All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Add support for Battery Status & Battery Caps AMS in TCPM
@ 2025-03-12 23:42 ` Amit Sunil Dhamne via B4 Relay
  0 siblings, 0 replies; 30+ messages in thread
From: Amit Sunil Dhamne @ 2025-03-12 23:42 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Greg Kroah-Hartman, Badhri Jagan Sridharan, Sebastian Reichel,
	Heikki Krogerus, Rafael J. Wysocki, Len Brown, Pavel Machek
  Cc: devicetree, linux-kernel, linux-usb, linux-pm, RD Babiera,
	Kyle Tso, Amit Sunil Dhamne

Support for Battery Status & Battery Caps messages in response to
Get_Battery_Status & Get_Battery_Cap request is required by USB PD devices
powered by battery, as per "USB PD R3.1 V1.8 Spec", "6.13 Message
Applicability" section. This patchset adds support for these AMSes
to achieve greater compliance with the spec.

Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
---
Amit Sunil Dhamne (5):
      dt-bindings: connector: add fixed-batteries property
      power: supply: core: add function to get supplies from fwnode
      usb: typec: tcpm: Add support for Battery Status response message
      power: supply: core: add vendor and product id properties
      usb: typec: tcpm: Add support for Battery Cap response message

 Documentation/ABI/testing/sysfs-class-power        |  20 ++
 .../bindings/connector/usb-connector.yaml          |   8 +
 .../devicetree/bindings/usb/maxim,max33359.yaml    |   1 +
 Documentation/power/power_supply_class.rst         |  11 ++
 drivers/power/supply/power_supply_core.c           |  60 ++++++
 drivers/power/supply/power_supply_sysfs.c          |   2 +
 drivers/usb/typec/tcpm/tcpm.c                      | 217 ++++++++++++++++++++-
 include/linux/power_supply.h                       |   7 +
 include/linux/usb/pd.h                             |  65 ++++++
 9 files changed, 388 insertions(+), 3 deletions(-)
---
base-commit: 80e54e84911a923c40d7bee33a34c1b4be148d7a
change-id: 20250311-batt_ops-be1bd71ca254

Best regards,
-- 
Amit Sunil Dhamne <amitsd@google.com>


^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: [PATCH 2/5] power: supply: core: add function to get supplies from fwnode
@ 2025-03-16 19:34 kernel test robot
  0 siblings, 0 replies; 30+ messages in thread
From: kernel test robot @ 2025-03-16 19:34 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250312-batt_ops-v1-2-88e0bb3129fd@google.com>
References: <20250312-batt_ops-v1-2-88e0bb3129fd@google.com>
TO: Amit Sunil Dhamne via B4 Relay <devnull+amitsd.google.com@kernel.org>
TO: Rob Herring <robh@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Conor Dooley <conor+dt@kernel.org>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
TO: Badhri Jagan Sridharan <badhri@google.com>
TO: Sebastian Reichel <sre@kernel.org>
TO: Heikki Krogerus <heikki.krogerus@linux.intel.com>
TO: "Rafael J. Wysocki" <rafael@kernel.org>
TO: Len Brown <len.brown@intel.com>
TO: Pavel Machek <pavel@kernel.org>
CC: devicetree@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: linux-pm@vger.kernel.org
CC: RD Babiera <rdbabiera@google.com>
CC: Kyle Tso <kyletso@google.com>
CC: Amit Sunil Dhamne <amitsd@google.com>

Hi Amit,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 80e54e84911a923c40d7bee33a34c1b4be148d7a]

url:    https://github.com/intel-lab-lkp/linux/commits/Amit-Sunil-Dhamne-via-B4-Relay/dt-bindings-connector-add-fixed-batteries-property/20250313-074635
base:   80e54e84911a923c40d7bee33a34c1b4be148d7a
patch link:    https://lore.kernel.org/r/20250312-batt_ops-v1-2-88e0bb3129fd%40google.com
patch subject: [PATCH 2/5] power: supply: core: add function to get supplies from fwnode
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: riscv-randconfig-r073-20250316 (https://download.01.org/0day-ci/archive/20250317/202503170343.AW93SIMu-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 14.2.0

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/202503170343.AW93SIMu-lkp@intel.com/

smatch warnings:
drivers/power/supply/power_supply_core.c:649 power_supply_get_by_fwnode_reference_array() error: uninitialized symbol 'ret'.

vim +/ret +649 drivers/power/supply/power_supply_core.c

0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  600  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  601  /**
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  602   * power_supply_get_by_fwnode_reference_array() - Returns an array of power
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  603   * supply objects associated with each fwnode reference present in the property
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  604   * @fwnode: Pointer to fwnode to lookup property
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  605   * @property: Name of property holding references
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  606   * @psy: Resulting array of power_supply pointers. To be provided by the caller.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  607   * @size: size of power_supply pointer array.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  608   *
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  609   * If power supply was found, it increases reference count for the
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  610   * internal power supply's device. The user should power_supply_put()
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  611   * after usage.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  612   *
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  613   * Return: On success returns the number of power supply objects filled
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  614   * in the @psy array.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  615   * -EOVERFLOW when size of @psy array is not suffice.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  616   * -EINVAL when @psy is NULL or @size is 0.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  617   * -ENODATA when fwnode does not contain the given property
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  618   */
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  619  int power_supply_get_by_fwnode_reference_array(struct fwnode_handle *fwnode,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  620  					       const char *property,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  621  					       struct power_supply **psy,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  622  					       ssize_t size)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  623  {
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  624  	int ret, index, count = 0;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  625  	struct fwnode_reference_args args;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  626  	struct device *dev;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  627  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  628  	if (!psy || !size)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  629  		return -EINVAL;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  630  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  631  	for (index = 0; index < size &&
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  632  	     !(ret = fwnode_property_get_reference_args(fwnode, property, NULL,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  633  							0, index, &args));
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  634  	     ++index) {
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  635  		dev = class_find_device(&power_supply_class, NULL, args.fwnode,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  636  					power_supply_match_fwnode);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  637  		fwnode_handle_put(args.fwnode);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  638  		if (!dev)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  639  			continue;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  640  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  641  		if (count > size)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  642  			return -EOVERFLOW;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  643  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  644  		psy[count] = dev_get_drvdata(dev);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  645  		atomic_inc(&psy[count]->use_cnt);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  646  		++count;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  647  	}
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  648  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12 @649  	if (ret != -ENOENT)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  650  		return ret;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  651  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  652  	return index ? count : -ENODATA;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  653  }
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  654  EXPORT_SYMBOL_GPL(power_supply_get_by_fwnode_reference_array);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  655  

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

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

end of thread, other threads:[~2025-04-08 19:54 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12 23:42 [PATCH 0/5] Add support for Battery Status & Battery Caps AMS in TCPM Amit Sunil Dhamne
2025-03-12 23:42 ` Amit Sunil Dhamne via B4 Relay
2025-03-12 23:42 ` [PATCH 1/5] dt-bindings: connector: add fixed-batteries property Amit Sunil Dhamne
2025-03-12 23:42   ` Amit Sunil Dhamne via B4 Relay
2025-03-13  8:48   ` Krzysztof Kozlowski
2025-03-15  0:56     ` Amit Sunil Dhamne
2025-03-16 16:49       ` Krzysztof Kozlowski
2025-03-20 19:49         ` Amit Sunil Dhamne
2025-03-16 16:55       ` Krzysztof Kozlowski
2025-03-20 19:45         ` Amit Sunil Dhamne
2025-03-12 23:42 ` [PATCH 2/5] power: supply: core: add function to get supplies from fwnode Amit Sunil Dhamne
2025-03-12 23:42   ` Amit Sunil Dhamne via B4 Relay
2025-03-19 13:54   ` Heikki Krogerus
2025-04-08 19:54     ` Amit Sunil Dhamne
2025-03-12 23:42 ` [PATCH 3/5] usb: typec: tcpm: Add support for Battery Status response message Amit Sunil Dhamne
2025-03-12 23:42   ` Amit Sunil Dhamne via B4 Relay
2025-03-12 23:42 ` [PATCH 4/5] power: supply: core: add vendor and product id properties Amit Sunil Dhamne
2025-03-12 23:42   ` Amit Sunil Dhamne via B4 Relay
2025-03-12 23:42 ` [PATCH 5/5] usb: typec: tcpm: Add support for Battery Cap response message Amit Sunil Dhamne
2025-03-12 23:42   ` Amit Sunil Dhamne via B4 Relay
2025-03-13  8:50 ` [PATCH 0/5] Add support for Battery Status & Battery Caps AMS in TCPM Krzysztof Kozlowski
2025-03-15  0:49   ` Amit Sunil Dhamne
2025-03-16 16:52     ` Krzysztof Kozlowski
2025-03-20 21:11       ` Amit Sunil Dhamne
2025-03-21  7:51         ` Krzysztof Kozlowski
2025-04-03  3:41           ` Amit Sunil Dhamne
2025-04-03  8:00             ` Krzysztof Kozlowski
2025-04-03  8:02               ` Krzysztof Kozlowski
2025-04-08 19:50                 ` Amit Sunil Dhamne
  -- strict thread matches above, loose matches on Subject: below --
2025-03-16 19:34 [PATCH 2/5] power: supply: core: add function to get supplies from fwnode 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.