Lines Matching +full:li +full:- +full:ion
46 val->intval = batt->technology; in lego_ev3_battery_get_property()
50 ret = iio_read_channel_processed(batt->iio_v, &val->intval); in lego_ev3_battery_get_property()
54 val->intval *= 2000; in lego_ev3_battery_get_property()
55 val->intval += 50000; in lego_ev3_battery_get_property()
58 ret = iio_read_channel_processed(batt->iio_i, &val2); in lego_ev3_battery_get_property()
64 val->intval += val2; in lego_ev3_battery_get_property()
67 val->intval = batt->v_max; in lego_ev3_battery_get_property()
70 val->intval = batt->v_min; in lego_ev3_battery_get_property()
74 ret = iio_read_channel_processed(batt->iio_i, &val->intval); in lego_ev3_battery_get_property()
78 val->intval *= 20000; in lego_ev3_battery_get_property()
79 val->intval /= 15; in lego_ev3_battery_get_property()
82 val->intval = POWER_SUPPLY_SCOPE_SYSTEM; in lego_ev3_battery_get_property()
85 return -EINVAL; in lego_ev3_battery_get_property()
100 * Only allow changing technology from Unknown to NiMH. Li-ion in lego_ev3_battery_set_property()
107 if (batt->technology != POWER_SUPPLY_TECHNOLOGY_UNKNOWN) in lego_ev3_battery_set_property()
108 return -EINVAL; in lego_ev3_battery_set_property()
109 switch (val->intval) { in lego_ev3_battery_set_property()
111 batt->technology = POWER_SUPPLY_TECHNOLOGY_NiMH; in lego_ev3_battery_set_property()
112 batt->v_max = 7800000; in lego_ev3_battery_set_property()
113 batt->v_min = 5400000; in lego_ev3_battery_set_property()
116 return -EINVAL; in lego_ev3_battery_set_property()
120 return -EINVAL; in lego_ev3_battery_set_property()
132 batt->technology == POWER_SUPPLY_TECHNOLOGY_UNKNOWN; in lego_ev3_battery_property_is_writeable()
145 .name = "lego-ev3-battery",
156 struct device *dev = &pdev->dev; in lego_ev3_battery_probe()
163 return -ENOMEM; in lego_ev3_battery_probe()
167 batt->iio_v = devm_iio_channel_get(dev, "voltage"); in lego_ev3_battery_probe()
168 err = PTR_ERR_OR_ZERO(batt->iio_v); in lego_ev3_battery_probe()
173 batt->iio_i = devm_iio_channel_get(dev, "current"); in lego_ev3_battery_probe()
174 err = PTR_ERR_OR_ZERO(batt->iio_i); in lego_ev3_battery_probe()
179 batt->rechargeable_gpio = devm_gpiod_get(dev, "rechargeable", GPIOD_IN); in lego_ev3_battery_probe()
180 err = PTR_ERR_OR_ZERO(batt->rechargeable_gpio); in lego_ev3_battery_probe()
189 if (gpiod_get_value(batt->rechargeable_gpio)) { in lego_ev3_battery_probe()
190 /* 2-cell Li-ion, 7.4V nominal */ in lego_ev3_battery_probe()
191 batt->technology = POWER_SUPPLY_TECHNOLOGY_LION; in lego_ev3_battery_probe()
192 batt->v_max = 84000000; in lego_ev3_battery_probe()
193 batt->v_min = 60000000; in lego_ev3_battery_probe()
196 batt->technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN; in lego_ev3_battery_probe()
197 batt->v_max = 90000000; in lego_ev3_battery_probe()
198 batt->v_min = 48000000; in lego_ev3_battery_probe()
201 psy_cfg.of_node = pdev->dev.of_node; in lego_ev3_battery_probe()
204 batt->psy = devm_power_supply_register(dev, &lego_ev3_battery_desc, in lego_ev3_battery_probe()
206 err = PTR_ERR_OR_ZERO(batt->psy); in lego_ev3_battery_probe()
216 { .compatible = "lego,ev3-battery", },
223 .name = "lego-ev3-battery",