Thread (12 messages) 12 messages, 3 authors, 2015-06-24

Re: [PATCH 2/2] power_supply: Add support for TI BQ25890 charger chip

From: Krzysztof Kozlowski <hidden>
Date: 2015-05-19 10:03:46
Also in: linux-devicetree, lkml

2015-05-19 18:14 GMT+09:00 Laurentiu Palcu [off-list ref]:
Hi Krzysztof,

On Tue, May 19, 2015 at 05:40:25PM +0900, Krzysztof Kozlowski wrote:
quoted
quoted
+
+static int bq25890_chip_reset(struct bq25890_device *bq)
+{
+       int ret;
+
+       ret = bq25890_field_write(bq, F_REG_RST, 1);
+       if (ret < 0)
+               return ret;
+
+       do {
+               ret = bq25890_field_read(bq, F_REG_RST);
+               if (ret < 0)
+                       return ret;
+
+               usleep_range(5, 10);
+       } while (ret == 1);
Is it possible to loop here indefinetely?
According to specifications, this field is "Reset to 0 after register
reset is completed", so I'm trusting the chip will behave as advertised!
:) We could implement a safety mechanism to avoid looping in case the
chip misbehaves but I don't think it's worth it. What do you think?
I just prefer to use some retry counter because it would be better to
fail the reset instead of being stuck here. The chip may behave
correctly but still a bug could exist in the driver. The retry counter
won't be much complicated here also. But I do not insist so if you
really think it is not worth it then I am fine.

Best regards,
Krzysztof
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help