All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add support for LTC4282
@ 2023-11-10 15:18 Nuno Sa
  2023-11-10 15:18 ` [PATCH 1/2] dt-bindings: hwmon: Add LTC4282 bindings Nuno Sa
  2023-11-10 15:18 ` [PATCH 2/2] hwmon: ltc4282: add support for the LTC4282 chip Nuno Sa
  0 siblings, 2 replies; 18+ messages in thread
From: Nuno Sa @ 2023-11-10 15:18 UTC (permalink / raw)
  To: linux-hwmon, linux-doc, devicetree
  Cc: Bartosz Golaszewski, Jonathan Corbet, Krzysztof Kozlowski,
	Linus Walleij, Guenter Roeck, Nuno Sa, Rob Herring,
	Andy Shevchenko, Jean Delvare, Conor Dooley

Hi all,

The LTC4282 hot swap controller allows a board to be safely inserted and
removed from a live backplane. Using one or more external N-channel pass
transistors, board supply voltage and inrush current are ramped up at an
adjustable rate. An I2C interface and onboard ADC allows for monitoring
of board current, voltage, power, energy and fault status.

I'm aware that there are ABI in the driver that will surely raise questions.
So, I'll try to add some comments about those:

- For the fault_log stuff please see the comment in the code. There might be
some scenarios where one might really want to latch off the device until a
fault is manually cleared.
- I also see value in the FET interfaces as they are real faults but maybe
the naming is poor.
- I'm not so sure about the power1_good and the power1_fault_log. The
power1_good is more of a real status bit. If the bit is 0, it does not
necessarily means that there's something wrong. If someone removed
(on purpose) the "load", then this will be 0 and there's nothing wrong.
The fault_log is also not one of those bits that will keep the device to
latch on again. However, they might really indicate some misbehave. But,
OTOH (again :)), maybe the GPIO support for this is enough...
- There's also the handling for the overflow bits. I don't think it makes
much sense to export those so I tried to be clever and automatically handle
it the driver. The power_average is the thing making the whole thing more
complicated. If it was only the energy, we could defer it completely to
userspace...
- And there's also the rsense as a mandatory property. Designs like this
completely depend on the calculated rsense so I have no idea (and if it
makes sense) what default should I use if the property is not given.

I'm also cc'ing the GPIO folks for the GPIO bits. And I'm also not so sure
about it. I'm just treating the pins as if I can set value + direction. However,
the only thing that we can do is to PULL_LOW and set the pins in HIGH_Z. So,
I dunno I'm doing the right thing. I wonder if I should just give the ability
to configure the pins through FW with the .set_config hook and then just
allow to read the pin level? The GPIO1 is also odd since is only the one
that directly allows you to control the direction but then, again, you
can just pull it low or high-z.

One last comment is about lines length. I know some maintainer still want
the 80 col limit but since I'm not so sure on the policy in hwmon I just
went for 100. I'm pretty sure I'll need more iterations to get the driver
in, so I'm happy to change it to 80 if required.

Nuno Sa (2):
  dt-bindings: hwmon: Add LTC4282 bindings
  hwmon: ltc4282: add support for the LTC4282 chip

 .../bindings/hwmon/adi,ltc4282.yaml           |  228 +++
 Documentation/hwmon/ltc4282.rst               |  101 ++
 MAINTAINERS                                   |    8 +
 drivers/hwmon/Kconfig                         |   11 +
 drivers/hwmon/Makefile                        |    1 +
 drivers/hwmon/ltc4282.c                       | 1518 +++++++++++++++++
 6 files changed, 1867 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
 create mode 100644 Documentation/hwmon/ltc4282.rst
 create mode 100644 drivers/hwmon/ltc4282.c

-- 
2.42.1



^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [PATCH 2/2] hwmon: ltc4282: add support for the LTC4282 chip
@ 2023-11-12 18:55 kernel test robot
  0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2023-11-12 18:55 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20231110151905.1659873-3-nuno.sa@analog.com>
References: <20231110151905.1659873-3-nuno.sa@analog.com>
TO: Nuno Sa <nuno.sa@analog.com>
TO: linux-hwmon@vger.kernel.org
TO: linux-doc@vger.kernel.org
TO: devicetree@vger.kernel.org
CC: Bartosz Golaszewski <brgl@bgdev.pl>
CC: Jonathan Corbet <corbet@lwn.net>
CC: Krzysztof Kozlowski <krzk@kernel.org>
CC: Linus Walleij <linus.walleij@linaro.org>
CC: Guenter Roeck <linux@roeck-us.net>
CC: Nuno Sa <nuno.sa@analog.com>
CC: Rob Herring <robh+dt@kernel.org>
CC: Andy Shevchenko <andy@kernel.org>
CC: Jean Delvare <jdelvare@suse.com>
CC: Conor Dooley <conor+dt@kernel.org>

Hi Nuno,

kernel test robot noticed the following build warnings:

[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on linus/master v6.6 next-20231110]
[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/Nuno-Sa/dt-bindings-hwmon-Add-LTC4282-bindings/20231110-232017
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20231110151905.1659873-3-nuno.sa%40analog.com
patch subject: [PATCH 2/2] hwmon: ltc4282: add support for the LTC4282 chip
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-141-20231112 (https://download.01.org/0day-ci/archive/20231113/202311130219.YBiF8Xu3-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231113/202311130219.YBiF8Xu3-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/202311130219.YBiF8Xu3-lkp@intel.com/

smatch warnings:
drivers/hwmon/ltc4282.c:859 ltc4282_is_visible() warn: signedness bug returning '(-524)'
drivers/hwmon/ltc4282.c:1143 ltc4282_gpio_setup() warn: passing zero to 'dev_err_probe'

vim +859 drivers/hwmon/ltc4282.c

31ea069ddf481b Nuno Sa 2023-11-10  843  
31ea069ddf481b Nuno Sa 2023-11-10  844  static umode_t ltc4282_is_visible(const void *data,
31ea069ddf481b Nuno Sa 2023-11-10  845  				  enum hwmon_sensor_types type,
31ea069ddf481b Nuno Sa 2023-11-10  846  				  u32 attr, int channel)
31ea069ddf481b Nuno Sa 2023-11-10  847  {
31ea069ddf481b Nuno Sa 2023-11-10  848  	switch (type) {
31ea069ddf481b Nuno Sa 2023-11-10  849  	case hwmon_in:
31ea069ddf481b Nuno Sa 2023-11-10  850  		return ltc4282_in_is_visible(data, attr);
31ea069ddf481b Nuno Sa 2023-11-10  851  	case hwmon_curr:
31ea069ddf481b Nuno Sa 2023-11-10  852  		return ltc4282_curr_is_visible(attr);
31ea069ddf481b Nuno Sa 2023-11-10  853  	case hwmon_power:
31ea069ddf481b Nuno Sa 2023-11-10  854  		return ltc4282_power_is_visible(attr);
31ea069ddf481b Nuno Sa 2023-11-10  855  	case hwmon_energy:
31ea069ddf481b Nuno Sa 2023-11-10  856  		/* hwmon_energy_enable */
31ea069ddf481b Nuno Sa 2023-11-10  857  		return 0644;
31ea069ddf481b Nuno Sa 2023-11-10  858  	default:
31ea069ddf481b Nuno Sa 2023-11-10 @859  		return -ENOTSUPP;
31ea069ddf481b Nuno Sa 2023-11-10  860  	}
31ea069ddf481b Nuno Sa 2023-11-10  861  }
31ea069ddf481b Nuno Sa 2023-11-10  862  

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

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

end of thread, other threads:[~2023-11-20 15:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-10 15:18 [PATCH 0/2] Add support for LTC4282 Nuno Sa
2023-11-10 15:18 ` [PATCH 1/2] dt-bindings: hwmon: Add LTC4282 bindings Nuno Sa
2023-11-10 18:42   ` Conor Dooley
2023-11-13  9:32     ` Nuno Sá
2023-11-13 20:12       ` Conor Dooley
2023-11-20 15:03       ` Guenter Roeck
2023-11-10 15:18 ` [PATCH 2/2] hwmon: ltc4282: add support for the LTC4282 chip Nuno Sa
2023-11-10 16:50   ` Andy Shevchenko
2023-11-13 10:13     ` Nuno Sá
2023-11-13 16:31       ` Andy Shevchenko
2023-11-14  8:36         ` Nuno Sá
2023-11-20 15:00       ` Guenter Roeck
2023-11-11  1:04   ` kernel test robot
2023-11-11 17:22   ` Guenter Roeck
2023-11-13  9:24     ` Nuno Sá
2023-11-20 12:10   ` Dan Carpenter
2023-11-20 14:52     ` Guenter Roeck
2023-11-12 18:55 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.