mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC 0/2] Again w1-regman and power_supply MAX1721x
@ 2017-05-08  6:13 Alex A. Mihaylov
  2017-05-08  6:13 ` [RFC 1/2] Basic support for regmap ifrastucture over Maxim/Dalas OneWire Bus Alex A. Mihaylov
  2017-05-08  6:13 ` [RFC 2/2] MAX1721x Standalone Fuel Gauge IC power_supply class driver Alex A. Mihaylov
  0 siblings, 2 replies; 3+ messages in thread
From: Alex A. Mihaylov @ 2017-05-08  6:13 UTC (permalink / raw)
  To: linux-kernel, linux-pm, Mark Brown, Greg Kroah-Hartman,
	Sebastian Reichel
  Cc: Alex A. Mihaylov

Hi!
I wrote driver for Maxim MAX17211/MAX17215 standalone fuel gauge IC. 

Earlier I post preliminary versions of this driver and got recommendations to
translate it into the infrastructure of regmap. Accordingly, it was necessary
to implement at least basic support of regmap for the OneWire bus. Which was 
done. There was a criticism about the use of an intermediate platform_device.
In this edition, this is also fixed.

I would like to hear not only criticism, but also constructive proposals
for the implementation or correction of this code.

Known issuie/troubles:
~~~~~~~~~~~~~~~~~~~~~~
1. Endian for W1-regmap
Code writen for use nativ endian for host (master) device. But waiting for
little-endian slave divice. I don't know W1 slave device with big-endian
addrees or data format. May be regmap_bus or regmap_config will be checked
for host/device endian requirements?

2. W1 Family/device infrastructure
All present power_supply class drivers in vanilla kernel use w1-slave devices.
All of them create platform_device with name "chip-battery.X.auto", and 
power_supply class driver use this platform device. Why used this way? I
write code, allocated power_supply at W1 slave (family) device register.
This work as expected.

3. Device names
All W1 device have unical 64 bit ID (8-bit family, 48-bit serial number,
8 bit CRC). W1 infrastructure show 56 bits (family-serial_nimber) as w1
slave device name. I use this (unical) device name as power_supply battery
name. This work. But in /sys/class/power_supply is placed machine readabe 
subdir "26-HexDigString", instead of human-readable "chip-battery.X.auto".
But in /sys/class/power_supply/26-HexDigString/type file still content
human-readable type "Battery".
Thermal zone working, but in /sys/class/thermal/thermal_zoneX/type also
placed "26-HexDigString", instead of "chip-battery.X.auto".
I can rename "26-HexDigString" to "battery-26-HexDigString" or 
"26-HexDigString-battery", but this exceeded 20 chars thermal zone device
name. So, thermal zone will have to be disabled.

Alex A. Mihaylov (2):
  Basic support for regmap ifrastucture over Maxim/Dalas OneWire Bus
  MAX1721x Standalone Fuel Gauge IC power_supply class driver

 drivers/base/regmap/Kconfig             |   6 +-
 drivers/base/regmap/Makefile            |   1 +
 drivers/base/regmap/regmap-w1.c         | 241 +++++++++++++++++++++
 drivers/power/supply/Kconfig            |  14 ++
 drivers/power/supply/Makefile           |   1 +
 drivers/power/supply/max1721x_battery.c | 361 ++++++++++++++++++++++++++++++++
 include/linux/power/max172xx-battery.h  | 100 +++++++++
 include/linux/regmap.h                  |  34 +++
 8 files changed, 757 insertions(+), 1 deletion(-)
 create mode 100644 drivers/base/regmap/regmap-w1.c
 create mode 100644 drivers/power/supply/max1721x_battery.c
 create mode 100644 include/linux/power/max172xx-battery.h

-- 
2.8.4 (Apple Git-73)

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

end of thread, other threads:[~2017-05-08  6:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08  6:13 [RFC 0/2] Again w1-regman and power_supply MAX1721x Alex A. Mihaylov
2017-05-08  6:13 ` [RFC 1/2] Basic support for regmap ifrastucture over Maxim/Dalas OneWire Bus Alex A. Mihaylov
2017-05-08  6:13 ` [RFC 2/2] MAX1721x Standalone Fuel Gauge IC power_supply class driver Alex A. Mihaylov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®