* [PATCH v4 1/2] power: supply: ltc2941-battery-gauge: Add vendor to compatibles in binding
@ 2017-03-29 16:00 Javier Martinez Canillas
2017-03-29 16:00 ` [PATCH v4 2/2] power: supply: ltc2941-battery-gauge: Add OF device ID table Javier Martinez Canillas
[not found] ` <20170329160057.8298-1-javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
0 siblings, 2 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2017-03-29 16:00 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Mark Rutland, Rob Herring,
Javier Martinez Canillas, linux-pm-u79uwXL29TY76Z2rM5mHXA,
Sebastian Reichel
The DT binding document for LTC2941 and LTC2943 battery gauges did not use
a vendor prefix in the listed compatible strings. The driver says that the
manufacturer is Linear Technology which is "lltc" in vendor-prefixes.txt.
There isn't an upstream Device Tree source file that has nodes defined for
these devices, so there's no need to keep the old compatible strings.
Signed-off-by: Javier Martinez Canillas <javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
Documentation/devicetree/bindings/power/supply/ltc2941.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/power/supply/ltc2941.txt b/Documentation/devicetree/bindings/power/supply/ltc2941.txt
index ea42ae12d924..a9d7aa60558b 100644
--- a/Documentation/devicetree/bindings/power/supply/ltc2941.txt
+++ b/Documentation/devicetree/bindings/power/supply/ltc2941.txt
@@ -6,8 +6,8 @@ temperature monitoring, and uses a slightly different conversion
formula for the charge counter.
Required properties:
-- compatible: Should contain "ltc2941" or "ltc2943" which also indicates the
- type of I2C chip attached.
+- compatible: Should contain "lltc,ltc2941" or "lltc,ltc2943" which also
+ indicates the type of I2C chip attached.
- reg: The 7-bit I2C address.
- lltc,resistor-sense: The sense resistor value in milli-ohms. Can be a 32-bit
negative value when the battery has been connected to the wrong end of the
@@ -20,7 +20,7 @@ Required properties:
Example from the Topic Miami Florida board:
fuelgauge: ltc2943@64 {
- compatible = "ltc2943";
+ compatible = "lltc,ltc2943";
reg = <0x64>;
lltc,resistor-sense = <15>;
lltc,prescaler-exponent = <5>; /* 2^(2*5) = 1024 */
--
2.9.3
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v4 2/2] power: supply: ltc2941-battery-gauge: Add OF device ID table 2017-03-29 16:00 [PATCH v4 1/2] power: supply: ltc2941-battery-gauge: Add vendor to compatibles in binding Javier Martinez Canillas @ 2017-03-29 16:00 ` Javier Martinez Canillas 2017-04-11 14:29 ` Sebastian Reichel [not found] ` <20170329160057.8298-1-javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> 1 sibling, 1 reply; 5+ messages in thread From: Javier Martinez Canillas @ 2017-03-29 16:00 UTC (permalink / raw) To: linux-kernel Cc: devicetree, Mark Rutland, Rob Herring, Javier Martinez Canillas, Sebastian Reichel, linux-pm The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> --- Changes in v4: - Add a vendor prefix to OF device compatible strings (Sebastian Reichel). Changes in v3: - Don't use of_match_ptr() to avoid build warning when CONFIG_OF is disabled. Changes in v2: - Fix build warning reported by kbuild test robot. - Fix wrong compatible strings due a copy & paste error. drivers/power/supply/ltc2941-battery-gauge.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/ltc2941-battery-gauge.c b/drivers/power/supply/ltc2941-battery-gauge.c index 4adf2ba021ce..7efb908f4451 100644 --- a/drivers/power/supply/ltc2941-battery-gauge.c +++ b/drivers/power/supply/ltc2941-battery-gauge.c @@ -9,6 +9,7 @@ */ #include <linux/kernel.h> #include <linux/module.h> +#include <linux/of_device.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/swab.h> @@ -61,7 +62,7 @@ struct ltc294x_info { struct power_supply *supply; /* Supply pointer */ struct power_supply_desc supply_desc; /* Supply description */ struct delayed_work work; /* Work scheduler */ - int num_regs; /* Number of registers (chip type) */ + unsigned long num_regs; /* Number of registers (chip type) */ int charge; /* Last charge register content */ int r_sense; /* mOhm */ int Qlsb; /* nAh */ @@ -387,7 +388,7 @@ static int ltc294x_i2c_probe(struct i2c_client *client, np = of_node_get(client->dev.of_node); - info->num_regs = id->driver_data; + info->num_regs = (unsigned long)of_device_get_match_data(&client->dev); info->supply_desc.name = np->name; /* r_sense can be negative, when sense+ is connected to the battery @@ -497,9 +498,23 @@ static const struct i2c_device_id ltc294x_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, ltc294x_i2c_id); +static const struct of_device_id ltc294x_i2c_of_match[] = { + { + .compatible = "lltc,ltc2941", + .data = (void *)LTC2941_NUM_REGS + }, + { + .compatible = "lltc,ltc2943", + .data = (void *)LTC2943_NUM_REGS + }, + { }, +}; +MODULE_DEVICE_TABLE(of, ltc294x_i2c_of_match); + static struct i2c_driver ltc294x_driver = { .driver = { .name = "LTC2941", + .of_match_table = ltc294x_i2c_of_match, .pm = LTC294X_PM_OPS, }, .probe = ltc294x_i2c_probe, -- 2.9.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 2/2] power: supply: ltc2941-battery-gauge: Add OF device ID table 2017-03-29 16:00 ` [PATCH v4 2/2] power: supply: ltc2941-battery-gauge: Add OF device ID table Javier Martinez Canillas @ 2017-04-11 14:29 ` Sebastian Reichel 0 siblings, 0 replies; 5+ messages in thread From: Sebastian Reichel @ 2017-04-11 14:29 UTC (permalink / raw) To: Javier Martinez Canillas Cc: linux-kernel, devicetree, Mark Rutland, Rob Herring, linux-pm [-- Attachment #1: Type: text/plain, Size: 632 bytes --] Hi, On Wed, Mar 29, 2017 at 12:00:57PM -0400, Javier Martinez Canillas wrote: > The driver doesn't have a struct of_device_id table but supported devices > are registered via Device Trees. This is working on the assumption that a > I2C device registered via OF will always match a legacy I2C device ID and > that the MODALIAS reported will always be of the form i2c:<device>. > > But this could change in the future so the correct approach is to have an > OF device ID table if the devices are registered via OF. > > Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Thanks, queued. -- Sebastian [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20170329160057.8298-1-javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>]
* Re: [PATCH v4 1/2] power: supply: ltc2941-battery-gauge: Add vendor to compatibles in binding [not found] ` <20170329160057.8298-1-javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> @ 2017-04-03 15:15 ` Rob Herring 2017-04-11 14:28 ` Sebastian Reichel 1 sibling, 0 replies; 5+ messages in thread From: Rob Herring @ 2017-04-03 15:15 UTC (permalink / raw) To: Javier Martinez Canillas Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Mark Rutland, linux-pm-u79uwXL29TY76Z2rM5mHXA, Sebastian Reichel On Wed, Mar 29, 2017 at 12:00:56PM -0400, Javier Martinez Canillas wrote: > The DT binding document for LTC2941 and LTC2943 battery gauges did not use > a vendor prefix in the listed compatible strings. The driver says that the > manufacturer is Linear Technology which is "lltc" in vendor-prefixes.txt. > > There isn't an upstream Device Tree source file that has nodes defined for > these devices, so there's no need to keep the old compatible strings. > > Signed-off-by: Javier Martinez Canillas <javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> > --- > > Changes in v4: None > Changes in v3: None > Changes in v2: None > > Documentation/devicetree/bindings/power/supply/ltc2941.txt | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/2] power: supply: ltc2941-battery-gauge: Add vendor to compatibles in binding [not found] ` <20170329160057.8298-1-javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> 2017-04-03 15:15 ` [PATCH v4 1/2] power: supply: ltc2941-battery-gauge: Add vendor to compatibles in binding Rob Herring @ 2017-04-11 14:28 ` Sebastian Reichel 1 sibling, 0 replies; 5+ messages in thread From: Sebastian Reichel @ 2017-04-11 14:28 UTC (permalink / raw) To: Javier Martinez Canillas Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Mark Rutland, Rob Herring, linux-pm-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 601 bytes --] Hi, On Wed, Mar 29, 2017 at 12:00:56PM -0400, Javier Martinez Canillas wrote: > The DT binding document for LTC2941 and LTC2943 battery gauges did not use > a vendor prefix in the listed compatible strings. The driver says that the > manufacturer is Linear Technology which is "lltc" in vendor-prefixes.txt. > > There isn't an upstream Device Tree source file that has nodes defined for > these devices, so there's no need to keep the old compatible strings. > > Signed-off-by: Javier Martinez Canillas <javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> Thanks, queued. -- Sebastian [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-04-11 14:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-29 16:00 [PATCH v4 1/2] power: supply: ltc2941-battery-gauge: Add vendor to compatibles in binding Javier Martinez Canillas
2017-03-29 16:00 ` [PATCH v4 2/2] power: supply: ltc2941-battery-gauge: Add OF device ID table Javier Martinez Canillas
2017-04-11 14:29 ` Sebastian Reichel
[not found] ` <20170329160057.8298-1-javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2017-04-03 15:15 ` [PATCH v4 1/2] power: supply: ltc2941-battery-gauge: Add vendor to compatibles in binding Rob Herring
2017-04-11 14:28 ` Sebastian Reichel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).