[rtc-linux] Re: [PATCH 6/6] rtc-rv3029: Add device tree property for trickle charger
From: Alexandre Belloni <hidden>
Date: 2016-03-04 19:58:49
On 04/03/2016 at 20:49:54 +0100, Michael B=C3=BCsch wrote :
On Fri, 4 Mar 2016 20:43:37 +0100 Alexandre Belloni [off-list ref] wrote: =20quoted
On 04/03/2016 at 19:56:54 +0100, Michael B=C3=BCsch wrote :quoted
+ err =3D of_property_read_u32(of_node, "trickle-resistor-ohms", &ohm=
s);
quoted
quoted
+ if (err) { + /* Disable trickle charger. */ + eectrl &=3D ~RV3029_TRICKLE_MASK; + } else { + /* Enable trickle charger. */ + for (i =3D 0; i < ARRAY_SIZE(rv3029_trickle_tab); i++) { + elem =3D &rv3029_trickle_tab[i]; + if (elem->r >=3D ohms) + break; + } + eectrl &=3D ~RV3029_TRICKLE_MASK; + eectrl |=3D elem->conf; + dev_info(&client->dev, + "Trickle charger enabled at %d ohms resistance.\n", + elem->r); + } =20=20 Now the you have an update_bits functions, you probably want to use it here. This simplifies the function.=20 =20 No. This operates on the eeprom. The update_bits function operates on bare registers. If we have more mask/set operations on the eeprom later, we can add an update_bits function for the eeprom, too. =20
Indeed, I read too fast
--=20 Michael
--=20 Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --=20 --=20 You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. ---=20 You received this message because you are subscribed to the Google Groups "= rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.