2 * 1-wire client/driver for the Maxim/Dallas DS2781 Stand-Alone Fuel Gauge IC
4 * Author: Renata Sayakhova <renata@oktetlabs.ru>
6 * Based on ds2780_battery drivers
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
14 #include <linux/module.h>
15 #include <linux/slab.h>
16 #include <linux/param.h>
18 #include <linux/platform_device.h>
19 #include <linux/power_supply.h>
20 #include <linux/idr.h>
23 #include "../../w1/slaves/w1_ds2781.h"
25 /* Current unit measurement in uA for a 1 milli-ohm sense resistor */
26 #define DS2781_CURRENT_UNITS 1563
27 /* Charge unit measurement in uAh for a 1 milli-ohm sense resistor */
28 #define DS2781_CHARGE_UNITS 6250
29 /* Number of bytes in user EEPROM space */
30 #define DS2781_USER_EEPROM_SIZE (DS2781_EEPROM_BLOCK0_END - \
31 DS2781_EEPROM_BLOCK0_START + 1)
32 /* Number of bytes in parameter EEPROM space */
33 #define DS2781_PARAM_EEPROM_SIZE (DS2781_EEPROM_BLOCK1_END - \
34 DS2781_EEPROM_BLOCK1_START + 1)
36 struct ds2781_device_info
{
38 struct power_supply
*bat
;
39 struct power_supply_desc bat_desc
;
40 struct device
*w1_dev
;
48 static const char model
[] = "DS2781";
49 static const char manufacturer
[] = "Maxim/Dallas";
51 static inline struct ds2781_device_info
*
52 to_ds2781_device_info(struct power_supply
*psy
)
54 return power_supply_get_drvdata(psy
);
57 static inline int ds2781_battery_io(struct ds2781_device_info
*dev_info
,
58 char *buf
, int addr
, size_t count
, int io
)
60 return w1_ds2781_io(dev_info
->w1_dev
, buf
, addr
, count
, io
);
63 static int w1_ds2781_read(struct ds2781_device_info
*dev_info
, char *buf
,
64 int addr
, size_t count
)
66 return ds2781_battery_io(dev_info
, buf
, addr
, count
, 0);
69 static inline int ds2781_read8(struct ds2781_device_info
*dev_info
, u8
*val
,
72 return ds2781_battery_io(dev_info
, val
, addr
, sizeof(u8
), 0);
75 static int ds2781_read16(struct ds2781_device_info
*dev_info
, s16
*val
,
81 ret
= ds2781_battery_io(dev_info
, raw
, addr
, sizeof(raw
), 0);
85 *val
= (raw
[0] << 8) | raw
[1];
90 static inline int ds2781_read_block(struct ds2781_device_info
*dev_info
,
91 u8
*val
, int addr
, size_t count
)
93 return ds2781_battery_io(dev_info
, val
, addr
, count
, 0);
96 static inline int ds2781_write(struct ds2781_device_info
*dev_info
, u8
*val
,
97 int addr
, size_t count
)
99 return ds2781_battery_io(dev_info
, val
, addr
, count
, 1);
102 static inline int ds2781_store_eeprom(struct device
*dev
, int addr
)
104 return w1_ds2781_eeprom_cmd(dev
, addr
, W1_DS2781_COPY_DATA
);
107 static inline int ds2781_recall_eeprom(struct device
*dev
, int addr
)
109 return w1_ds2781_eeprom_cmd(dev
, addr
, W1_DS2781_RECALL_DATA
);
112 static int ds2781_save_eeprom(struct ds2781_device_info
*dev_info
, int reg
)
116 ret
= ds2781_store_eeprom(dev_info
->w1_dev
, reg
);
120 ret
= ds2781_recall_eeprom(dev_info
->w1_dev
, reg
);
127 /* Set sense resistor value in mhos */
128 static int ds2781_set_sense_register(struct ds2781_device_info
*dev_info
,
133 ret
= ds2781_write(dev_info
, &conductance
,
134 DS2781_RSNSP
, sizeof(u8
));
138 return ds2781_save_eeprom(dev_info
, DS2781_RSNSP
);
141 /* Get RSGAIN value from 0 to 1.999 in steps of 0.001 */
142 static int ds2781_get_rsgain_register(struct ds2781_device_info
*dev_info
,
145 return ds2781_read16(dev_info
, rsgain
, DS2781_RSGAIN_MSB
);
148 /* Set RSGAIN value from 0 to 1.999 in steps of 0.001 */
149 static int ds2781_set_rsgain_register(struct ds2781_device_info
*dev_info
,
153 u8 raw
[] = {rsgain
>> 8, rsgain
& 0xFF};
155 ret
= ds2781_write(dev_info
, raw
,
156 DS2781_RSGAIN_MSB
, sizeof(raw
));
160 return ds2781_save_eeprom(dev_info
, DS2781_RSGAIN_MSB
);
163 static int ds2781_get_voltage(struct ds2781_device_info
*dev_info
,
170 ret
= w1_ds2781_read(dev_info
, val
, DS2781_VOLT_MSB
, 2 * sizeof(u8
));
174 * The voltage value is located in 10 bits across the voltage MSB
175 * and LSB registers in two's compliment form
176 * Sign bit of the voltage value is in bit 7 of the voltage MSB register
177 * Bits 9 - 3 of the voltage value are in bits 6 - 0 of the
178 * voltage MSB register
179 * Bits 2 - 0 of the voltage value are in bits 7 - 5 of the
180 * voltage LSB register
182 voltage_raw
= (val
[0] << 3) |
185 /* DS2781 reports voltage in units of 9.76mV, but the battery class
186 * reports in units of uV, so convert by multiplying by 9760. */
187 *voltage_uV
= voltage_raw
* 9760;
192 static int ds2781_get_temperature(struct ds2781_device_info
*dev_info
,
199 ret
= w1_ds2781_read(dev_info
, val
, DS2781_TEMP_MSB
, 2 * sizeof(u8
));
203 * The temperature value is located in 10 bits across the temperature
204 * MSB and LSB registers in two's compliment form
205 * Sign bit of the temperature value is in bit 7 of the temperature
207 * Bits 9 - 3 of the temperature value are in bits 6 - 0 of the
208 * temperature MSB register
209 * Bits 2 - 0 of the temperature value are in bits 7 - 5 of the
210 * temperature LSB register
212 temp_raw
= ((val
[0]) << 3) |
214 *temp
= temp_raw
+ (temp_raw
/ 4);
219 static int ds2781_get_current(struct ds2781_device_info
*dev_info
,
220 enum current_types type
, int *current_uA
)
224 u8 sense_res_raw
, reg_msb
;
227 * The units of measurement for current are dependent on the value of
228 * the sense resistor.
230 ret
= ds2781_read8(dev_info
, &sense_res_raw
, DS2781_RSNSP
);
234 if (sense_res_raw
== 0) {
235 dev_err(dev_info
->dev
, "sense resistor value is 0\n");
238 sense_res
= 1000 / sense_res_raw
;
240 if (type
== CURRENT_NOW
)
241 reg_msb
= DS2781_CURRENT_MSB
;
242 else if (type
== CURRENT_AVG
)
243 reg_msb
= DS2781_IAVG_MSB
;
248 * The current value is located in 16 bits across the current MSB
249 * and LSB registers in two's compliment form
250 * Sign bit of the current value is in bit 7 of the current MSB register
251 * Bits 14 - 8 of the current value are in bits 6 - 0 of the current
253 * Bits 7 - 0 of the current value are in bits 7 - 0 of the current
256 ret
= ds2781_read16(dev_info
, ¤t_raw
, reg_msb
);
260 *current_uA
= current_raw
* (DS2781_CURRENT_UNITS
/ sense_res
);
264 static int ds2781_get_accumulated_current(struct ds2781_device_info
*dev_info
,
265 int *accumulated_current
)
272 * The units of measurement for accumulated current are dependent on
273 * the value of the sense resistor.
275 ret
= ds2781_read8(dev_info
, &sense_res_raw
, DS2781_RSNSP
);
279 if (sense_res_raw
== 0) {
280 dev_err(dev_info
->dev
, "sense resistor value is 0\n");
283 sense_res
= 1000 / sense_res_raw
;
286 * The ACR value is located in 16 bits across the ACR MSB and
288 * Bits 15 - 8 of the ACR value are in bits 7 - 0 of the ACR
290 * Bits 7 - 0 of the ACR value are in bits 7 - 0 of the ACR
293 ret
= ds2781_read16(dev_info
, ¤t_raw
, DS2781_ACR_MSB
);
297 *accumulated_current
= current_raw
* (DS2781_CHARGE_UNITS
/ sense_res
);
301 static int ds2781_get_capacity(struct ds2781_device_info
*dev_info
,
307 ret
= ds2781_read8(dev_info
, &raw
, DS2781_RARC
);
315 static int ds2781_get_status(struct ds2781_device_info
*dev_info
, int *status
)
317 int ret
, current_uA
, capacity
;
319 ret
= ds2781_get_current(dev_info
, CURRENT_NOW
, ¤t_uA
);
323 ret
= ds2781_get_capacity(dev_info
, &capacity
);
327 if (power_supply_am_i_supplied(dev_info
->bat
)) {
329 *status
= POWER_SUPPLY_STATUS_FULL
;
330 else if (current_uA
> 50000)
331 *status
= POWER_SUPPLY_STATUS_CHARGING
;
333 *status
= POWER_SUPPLY_STATUS_NOT_CHARGING
;
335 *status
= POWER_SUPPLY_STATUS_DISCHARGING
;
340 static int ds2781_get_charge_now(struct ds2781_device_info
*dev_info
,
347 * The RAAC value is located in 16 bits across the RAAC MSB and
349 * Bits 15 - 8 of the RAAC value are in bits 7 - 0 of the RAAC
351 * Bits 7 - 0 of the RAAC value are in bits 7 - 0 of the RAAC
354 ret
= ds2781_read16(dev_info
, &charge_raw
, DS2781_RAAC_MSB
);
358 *charge_now
= charge_raw
* 1600;
362 static int ds2781_get_control_register(struct ds2781_device_info
*dev_info
,
365 return ds2781_read8(dev_info
, control_reg
, DS2781_CONTROL
);
368 static int ds2781_set_control_register(struct ds2781_device_info
*dev_info
,
373 ret
= ds2781_write(dev_info
, &control_reg
,
374 DS2781_CONTROL
, sizeof(u8
));
378 return ds2781_save_eeprom(dev_info
, DS2781_CONTROL
);
381 static int ds2781_battery_get_property(struct power_supply
*psy
,
382 enum power_supply_property psp
,
383 union power_supply_propval
*val
)
386 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
389 case POWER_SUPPLY_PROP_VOLTAGE_NOW
:
390 ret
= ds2781_get_voltage(dev_info
, &val
->intval
);
393 case POWER_SUPPLY_PROP_TEMP
:
394 ret
= ds2781_get_temperature(dev_info
, &val
->intval
);
397 case POWER_SUPPLY_PROP_MODEL_NAME
:
401 case POWER_SUPPLY_PROP_MANUFACTURER
:
402 val
->strval
= manufacturer
;
405 case POWER_SUPPLY_PROP_CURRENT_NOW
:
406 ret
= ds2781_get_current(dev_info
, CURRENT_NOW
, &val
->intval
);
409 case POWER_SUPPLY_PROP_CURRENT_AVG
:
410 ret
= ds2781_get_current(dev_info
, CURRENT_AVG
, &val
->intval
);
413 case POWER_SUPPLY_PROP_STATUS
:
414 ret
= ds2781_get_status(dev_info
, &val
->intval
);
417 case POWER_SUPPLY_PROP_CAPACITY
:
418 ret
= ds2781_get_capacity(dev_info
, &val
->intval
);
421 case POWER_SUPPLY_PROP_CHARGE_COUNTER
:
422 ret
= ds2781_get_accumulated_current(dev_info
, &val
->intval
);
425 case POWER_SUPPLY_PROP_CHARGE_NOW
:
426 ret
= ds2781_get_charge_now(dev_info
, &val
->intval
);
436 static enum power_supply_property ds2781_battery_props
[] = {
437 POWER_SUPPLY_PROP_STATUS
,
438 POWER_SUPPLY_PROP_VOLTAGE_NOW
,
439 POWER_SUPPLY_PROP_TEMP
,
440 POWER_SUPPLY_PROP_MODEL_NAME
,
441 POWER_SUPPLY_PROP_MANUFACTURER
,
442 POWER_SUPPLY_PROP_CURRENT_NOW
,
443 POWER_SUPPLY_PROP_CURRENT_AVG
,
444 POWER_SUPPLY_PROP_CAPACITY
,
445 POWER_SUPPLY_PROP_CHARGE_COUNTER
,
446 POWER_SUPPLY_PROP_CHARGE_NOW
,
449 static ssize_t
ds2781_get_pmod_enabled(struct device
*dev
,
450 struct device_attribute
*attr
,
455 struct power_supply
*psy
= to_power_supply(dev
);
456 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
459 ret
= ds2781_get_control_register(dev_info
, &control_reg
);
463 return sprintf(buf
, "%d\n",
464 !!(control_reg
& DS2781_CONTROL_PMOD
));
467 static ssize_t
ds2781_set_pmod_enabled(struct device
*dev
,
468 struct device_attribute
*attr
,
473 u8 control_reg
, new_setting
;
474 struct power_supply
*psy
= to_power_supply(dev
);
475 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
478 ret
= ds2781_get_control_register(dev_info
, &control_reg
);
482 ret
= kstrtou8(buf
, 0, &new_setting
);
486 if ((new_setting
!= 0) && (new_setting
!= 1)) {
487 dev_err(dev_info
->dev
, "Invalid pmod setting (0 or 1)\n");
492 control_reg
|= DS2781_CONTROL_PMOD
;
494 control_reg
&= ~DS2781_CONTROL_PMOD
;
496 ret
= ds2781_set_control_register(dev_info
, control_reg
);
503 static ssize_t
ds2781_get_sense_resistor_value(struct device
*dev
,
504 struct device_attribute
*attr
,
509 struct power_supply
*psy
= to_power_supply(dev
);
510 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
512 ret
= ds2781_read8(dev_info
, &sense_resistor
, DS2781_RSNSP
);
516 ret
= sprintf(buf
, "%d\n", sense_resistor
);
520 static ssize_t
ds2781_set_sense_resistor_value(struct device
*dev
,
521 struct device_attribute
*attr
,
527 struct power_supply
*psy
= to_power_supply(dev
);
528 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
530 ret
= kstrtou8(buf
, 0, &new_setting
);
534 ret
= ds2781_set_sense_register(dev_info
, new_setting
);
541 static ssize_t
ds2781_get_rsgain_setting(struct device
*dev
,
542 struct device_attribute
*attr
,
547 struct power_supply
*psy
= to_power_supply(dev
);
548 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
550 ret
= ds2781_get_rsgain_register(dev_info
, &rsgain
);
554 return sprintf(buf
, "%d\n", rsgain
);
557 static ssize_t
ds2781_set_rsgain_setting(struct device
*dev
,
558 struct device_attribute
*attr
,
564 struct power_supply
*psy
= to_power_supply(dev
);
565 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
567 ret
= kstrtou16(buf
, 0, &new_setting
);
571 /* Gain can only be from 0 to 1.999 in steps of .001 */
572 if (new_setting
> 1999) {
573 dev_err(dev_info
->dev
, "Invalid rsgain setting (0 - 1999)\n");
577 ret
= ds2781_set_rsgain_register(dev_info
, new_setting
);
584 static ssize_t
ds2781_get_pio_pin(struct device
*dev
,
585 struct device_attribute
*attr
,
590 struct power_supply
*psy
= to_power_supply(dev
);
591 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
593 ret
= ds2781_read8(dev_info
, &sfr
, DS2781_SFR
);
597 ret
= sprintf(buf
, "%d\n", sfr
& DS2781_SFR_PIOSC
);
601 static ssize_t
ds2781_set_pio_pin(struct device
*dev
,
602 struct device_attribute
*attr
,
608 struct power_supply
*psy
= to_power_supply(dev
);
609 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
611 ret
= kstrtou8(buf
, 0, &new_setting
);
615 if ((new_setting
!= 0) && (new_setting
!= 1)) {
616 dev_err(dev_info
->dev
, "Invalid pio_pin setting (0 or 1)\n");
620 ret
= ds2781_write(dev_info
, &new_setting
,
621 DS2781_SFR
, sizeof(u8
));
628 static ssize_t
ds2781_read_param_eeprom_bin(struct file
*filp
,
629 struct kobject
*kobj
,
630 struct bin_attribute
*bin_attr
,
631 char *buf
, loff_t off
, size_t count
)
633 struct device
*dev
= container_of(kobj
, struct device
, kobj
);
634 struct power_supply
*psy
= to_power_supply(dev
);
635 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
637 return ds2781_read_block(dev_info
, buf
,
638 DS2781_EEPROM_BLOCK1_START
+ off
, count
);
641 static ssize_t
ds2781_write_param_eeprom_bin(struct file
*filp
,
642 struct kobject
*kobj
,
643 struct bin_attribute
*bin_attr
,
644 char *buf
, loff_t off
, size_t count
)
646 struct device
*dev
= container_of(kobj
, struct device
, kobj
);
647 struct power_supply
*psy
= to_power_supply(dev
);
648 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
651 ret
= ds2781_write(dev_info
, buf
,
652 DS2781_EEPROM_BLOCK1_START
+ off
, count
);
656 ret
= ds2781_save_eeprom(dev_info
, DS2781_EEPROM_BLOCK1_START
);
663 static const struct bin_attribute ds2781_param_eeprom_bin_attr
= {
665 .name
= "param_eeprom",
666 .mode
= S_IRUGO
| S_IWUSR
,
668 .size
= DS2781_PARAM_EEPROM_SIZE
,
669 .read
= ds2781_read_param_eeprom_bin
,
670 .write
= ds2781_write_param_eeprom_bin
,
673 static ssize_t
ds2781_read_user_eeprom_bin(struct file
*filp
,
674 struct kobject
*kobj
,
675 struct bin_attribute
*bin_attr
,
676 char *buf
, loff_t off
, size_t count
)
678 struct device
*dev
= container_of(kobj
, struct device
, kobj
);
679 struct power_supply
*psy
= to_power_supply(dev
);
680 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
682 return ds2781_read_block(dev_info
, buf
,
683 DS2781_EEPROM_BLOCK0_START
+ off
, count
);
687 static ssize_t
ds2781_write_user_eeprom_bin(struct file
*filp
,
688 struct kobject
*kobj
,
689 struct bin_attribute
*bin_attr
,
690 char *buf
, loff_t off
, size_t count
)
692 struct device
*dev
= container_of(kobj
, struct device
, kobj
);
693 struct power_supply
*psy
= to_power_supply(dev
);
694 struct ds2781_device_info
*dev_info
= to_ds2781_device_info(psy
);
697 ret
= ds2781_write(dev_info
, buf
,
698 DS2781_EEPROM_BLOCK0_START
+ off
, count
);
702 ret
= ds2781_save_eeprom(dev_info
, DS2781_EEPROM_BLOCK0_START
);
709 static const struct bin_attribute ds2781_user_eeprom_bin_attr
= {
711 .name
= "user_eeprom",
712 .mode
= S_IRUGO
| S_IWUSR
,
714 .size
= DS2781_USER_EEPROM_SIZE
,
715 .read
= ds2781_read_user_eeprom_bin
,
716 .write
= ds2781_write_user_eeprom_bin
,
719 static DEVICE_ATTR(pmod_enabled
, S_IRUGO
| S_IWUSR
, ds2781_get_pmod_enabled
,
720 ds2781_set_pmod_enabled
);
721 static DEVICE_ATTR(sense_resistor_value
, S_IRUGO
| S_IWUSR
,
722 ds2781_get_sense_resistor_value
, ds2781_set_sense_resistor_value
);
723 static DEVICE_ATTR(rsgain_setting
, S_IRUGO
| S_IWUSR
, ds2781_get_rsgain_setting
,
724 ds2781_set_rsgain_setting
);
725 static DEVICE_ATTR(pio_pin
, S_IRUGO
| S_IWUSR
, ds2781_get_pio_pin
,
729 static struct attribute
*ds2781_attributes
[] = {
730 &dev_attr_pmod_enabled
.attr
,
731 &dev_attr_sense_resistor_value
.attr
,
732 &dev_attr_rsgain_setting
.attr
,
733 &dev_attr_pio_pin
.attr
,
737 static const struct attribute_group ds2781_attr_group
= {
738 .attrs
= ds2781_attributes
,
741 static int ds2781_battery_probe(struct platform_device
*pdev
)
743 struct power_supply_config psy_cfg
= {};
745 struct ds2781_device_info
*dev_info
;
747 dev_info
= devm_kzalloc(&pdev
->dev
, sizeof(*dev_info
), GFP_KERNEL
);
751 platform_set_drvdata(pdev
, dev_info
);
753 dev_info
->dev
= &pdev
->dev
;
754 dev_info
->w1_dev
= pdev
->dev
.parent
;
755 dev_info
->bat_desc
.name
= dev_name(&pdev
->dev
);
756 dev_info
->bat_desc
.type
= POWER_SUPPLY_TYPE_BATTERY
;
757 dev_info
->bat_desc
.properties
= ds2781_battery_props
;
758 dev_info
->bat_desc
.num_properties
= ARRAY_SIZE(ds2781_battery_props
);
759 dev_info
->bat_desc
.get_property
= ds2781_battery_get_property
;
761 psy_cfg
.drv_data
= dev_info
;
763 dev_info
->bat
= power_supply_register(&pdev
->dev
, &dev_info
->bat_desc
,
765 if (IS_ERR(dev_info
->bat
)) {
766 dev_err(dev_info
->dev
, "failed to register battery\n");
767 ret
= PTR_ERR(dev_info
->bat
);
771 ret
= sysfs_create_group(&dev_info
->bat
->dev
.kobj
, &ds2781_attr_group
);
773 dev_err(dev_info
->dev
, "failed to create sysfs group\n");
774 goto fail_unregister
;
777 ret
= sysfs_create_bin_file(&dev_info
->bat
->dev
.kobj
,
778 &ds2781_param_eeprom_bin_attr
);
780 dev_err(dev_info
->dev
,
781 "failed to create param eeprom bin file");
782 goto fail_remove_group
;
785 ret
= sysfs_create_bin_file(&dev_info
->bat
->dev
.kobj
,
786 &ds2781_user_eeprom_bin_attr
);
788 dev_err(dev_info
->dev
,
789 "failed to create user eeprom bin file");
790 goto fail_remove_bin_file
;
795 fail_remove_bin_file
:
796 sysfs_remove_bin_file(&dev_info
->bat
->dev
.kobj
,
797 &ds2781_param_eeprom_bin_attr
);
799 sysfs_remove_group(&dev_info
->bat
->dev
.kobj
, &ds2781_attr_group
);
801 power_supply_unregister(dev_info
->bat
);
806 static int ds2781_battery_remove(struct platform_device
*pdev
)
808 struct ds2781_device_info
*dev_info
= platform_get_drvdata(pdev
);
811 * Remove attributes before unregistering power supply
812 * because 'bat' will be freed on power_supply_unregister() call.
814 sysfs_remove_group(&dev_info
->bat
->dev
.kobj
, &ds2781_attr_group
);
816 power_supply_unregister(dev_info
->bat
);
821 static struct platform_driver ds2781_battery_driver
= {
823 .name
= "ds2781-battery",
825 .probe
= ds2781_battery_probe
,
826 .remove
= ds2781_battery_remove
,
828 module_platform_driver(ds2781_battery_driver
);
830 MODULE_LICENSE("GPL");
831 MODULE_AUTHOR("Renata Sayakhova <renata@oktetlabs.ru>");
832 MODULE_DESCRIPTION("Maxim/Dallas DS2781 Stand-Alone Fuel Gauage IC driver");
833 MODULE_ALIAS("platform:ds2781-battery");