Hi Stephan, I think the regulator_bulk usage is good, and the core_enable/disable_regulator functions implemented the way you did is perfect for the init/shutdown phase. We just need to change the suspend/resume implementation to use something different. Thanks, JB From: linux-iio-owner@xxxxxxxxxxxxxxx <linux-iio-owner@xxxxxxxxxxxxxxx> on behalf of Stephan Gerhold <stephan@xxxxxxxxxxx> Sent: Wednesday, November 6, 2019 22:36 To: Jean-Baptiste Maneyrol <JManeyrol@xxxxxxxxxxxxxx> Cc: Jonathan Cameron <jic23@xxxxxxxxxx>; Hartmut Knaack <knaack.h@xxxxxx>; Lars-Peter Clausen <lars@xxxxxxxxxx>; Peter Meerwald-Stadler <pmeerw@xxxxxxxxxx>; Rob Herring <robh+dt@xxxxxxxxxx>; Mark Rutland <mark.rutland@xxxxxxx>; Linus Walleij <linus.walleij@xxxxxxxxxx>; Brian Masney <masneyb@xxxxxxxxxxxxx>; Jonathan Marek <jonathan@xxxxxxxx>; linux-iio@xxxxxxxxxxxxxxx <linux-iio@xxxxxxxxxxxxxxx>; devicetree@xxxxxxxxxxxxxxx <devicetree@xxxxxxxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx <linux-kernel@xxxxxxxxxxxxxxx> Subject: Re: [PATCH 2/2] iio: imu: mpu6050: Add support for vdd-supply regulator CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe. Hi JB, On Wed, Nov 06, 2019 at 07:55:20PM +0000, Jean-Baptiste Maneyrol wrote: > Hello Stephan, > > nice patch but I have an important concern. > > We are calling the core_enable/disable_regulator functions when going into suspend and resume. > With your changes, we are going to power down the chip when going into suspend and then power it up again. > This way we will loose all already set configuration, like FSR, sampling rate, init values, ... > The chip will not be able to work correctly anymore after a suspend-resume cycle. > > You need to change the resume/suspend handlers to only disable/enable the vddio regulator, not the vdd one. That is a good point, thanks! I guess we are not able to use the regulator bulk API in this case... I will send a v2 soon. Stephan