Lines Matching full:batt
41 struct lego_ev3_battery *batt = power_supply_get_drvdata(psy); in lego_ev3_battery_get_property() local
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()
58 ret = iio_read_channel_processed(batt->iio_i, &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()
95 struct lego_ev3_battery *batt = power_supply_get_drvdata(psy); in lego_ev3_battery_set_property() local
107 if (batt->technology != POWER_SUPPLY_TECHNOLOGY_UNKNOWN) 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()
129 struct lego_ev3_battery *batt = power_supply_get_drvdata(psy); in lego_ev3_battery_property_is_writeable() local
132 batt->technology == POWER_SUPPLY_TECHNOLOGY_UNKNOWN; in lego_ev3_battery_property_is_writeable()
157 struct lego_ev3_battery *batt; in lego_ev3_battery_probe() local
161 batt = devm_kzalloc(dev, sizeof(*batt), GFP_KERNEL); in lego_ev3_battery_probe()
162 if (!batt) in lego_ev3_battery_probe()
165 platform_set_drvdata(pdev, batt); 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()
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()
202 psy_cfg.drv_data = batt; 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()