On Sat, Oct 12, 2019 at 05:33:44PM +0100, Jonathan Cameron wrote: > On Sat, 12 Oct 2019 15:35:56 +0000 > Dan Robertson <dan@xxxxxxxxxxxxxxx> wrote: > > On Sat, Oct 12, 2019 at 10:40:33AM +0100, Jonathan Cameron wrote: > > > > > > Silly question. Why is soft_reset preferred to sleep mode? > > > > Not a silly question. I actually debated this when initially implementing the > > driver. The datasheet describes soft-reset behavior in section 4.9, the > > following snippet from the datasheet is particularly relevant: > > > > > The softreset performs a fundamental reset to the device which is largely > > > equivalent to a power cycle. Following a delay, all user configuration > > > settings are overwritten with their default state... > > > > Sleep mode is the default power-mode, so the only real difference would be that > > the oversampling ratio, sampling frequency, and scale would all be reset to > > their defaults with a soft-reset. If we just set the power-mode to sleep mode, > > the user configuration registers would be preserved. > > > > I can add a comment about the behavior of a softreset in bma400_remove. > I'd just not do it. That way there is only the putting it to sleep path. > We normally assume that we don't know the state during startup and aren't > as careful on remove to make sure things are in a default state. > > That way you only need a single path in the remove function. If sleep mode > fails you are probably broken anyway. Sounds good. That does make remove much easier if the device is not ready for a command. I'll remove this in the next patchset version. Cheers, - Dan
Attachment:
signature.asc
Description: Digital signature