On 10/01/10 12:46, Samu Onkalo wrote: > Sometimes lis3 chip seems to fail to setup factory tuning at boot up. > This probably happens if there is some odd power ramp down ramp up sequence > for example in device restart. Set boot bit in control2 register to > trig boot sequence manually and wait until it is finished. > Also restore axis enable bits in init. This really ought to be two separate patches. The issues are completely unconnected. I've noticed you tend to fix other things in individual patches as you go along. This makes the harder to review so please break out each conceptual change. Both look fine to me, so feel free to add Acked-by: Jonathan Cameron <jic23@xxxxxxxxx> To a broken out pair of patches. > > Signed-off-by: Samu O kalo <samu.p.onkalo@xxxxxxxxx> > --- > drivers/hwmon/lis3lv02d.c | 19 +++++++++++-------- > drivers/hwmon/lis3lv02d.h | 1 + > drivers/hwmon/lis3lv02d_i2c.c | 2 +- > drivers/hwmon/lis3lv02d_spi.c | 2 +- > 4 files changed, 14 insertions(+), 10 deletions(-) > > diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c > index dc777d2..81e2313 100644 > --- a/drivers/hwmon/lis3lv02d.c > +++ b/drivers/hwmon/lis3lv02d.c > @@ -272,19 +272,22 @@ void lis3lv02d_poweron(struct lis3lv02d *lis3) > > lis3->init(lis3); > > - /* LIS3 power on delay is quite long */ > - msleep(lis3->pwron_delay / lis3lv02d_get_odr()); > - > /* > * Common configuration > * BDU: (12 bits sensors only) LSB and MSB values are not updated until > * both have been read. So the value read will always be correct. > + * Set BOOT bit to refresh factory tuning values. > */ > - if (lis3->whoami == WAI_12B) { > - lis3->read(lis3, CTRL_REG2, ®); > - reg |= CTRL2_BDU; > - lis3->write(lis3, CTRL_REG2, reg); > - } > + lis3->read(lis3, CTRL_REG2, ®); > + if (lis3->whoami == WAI_12B) > + reg |= CTRL2_BDU | CTRL2_BOOT; > + else > + reg |= CTRL2_BOOT_8B; > + lis3->write(lis3, CTRL_REG2, reg); > + > + /* LIS3 power on delay is quite long */ > + msleep(lis3->pwron_delay / lis3lv02d_get_odr()); > + > if (lis3->reg_ctrl) > lis3_context_restore(lis3); > } > diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h > index 8c19185..1522855 100644 > --- a/drivers/hwmon/lis3lv02d.h > +++ b/drivers/hwmon/lis3lv02d.h > @@ -142,6 +142,7 @@ enum lis3lv02d_ctrl2 { > enum lis302d_ctrl2 { > HP_FF_WU2 = 0x08, > HP_FF_WU1 = 0x04, > + CTRL2_BOOT_8B = 0x40, > }; > > enum lis3lv02d_ctrl3 { > diff --git a/drivers/hwmon/lis3lv02d_i2c.c b/drivers/hwmon/lis3lv02d_i2c.c > index 0852bed..c5a60e4 100644 > --- a/drivers/hwmon/lis3lv02d_i2c.c > +++ b/drivers/hwmon/lis3lv02d_i2c.c > @@ -82,7 +82,7 @@ static int lis3_i2c_init(struct lis3lv02d *lis3) > if (ret < 0) > return ret; > > - reg |= CTRL1_PD0; > + reg |= CTRL1_PD0 | CTRL1_Xen | CTRL1_Yen | CTRL1_Zen; > return lis3->write(lis3, CTRL_REG1, reg); > } > > diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c > index b9be5e3..778885d 100644 > --- a/drivers/hwmon/lis3lv02d_spi.c > +++ b/drivers/hwmon/lis3lv02d_spi.c > @@ -50,7 +50,7 @@ static int lis3_spi_init(struct lis3lv02d *lis3) > if (ret < 0) > return ret; > > - reg |= CTRL1_PD0; > + reg |= CTRL1_PD0 | CTRL1_Xen | CTRL1_Yen | CTRL1_Zen; > return lis3->write(lis3, CTRL_REG1, reg); > } > _______________________________________________ lm-sensors mailing list lm-sensors@xxxxxxxxxxxxxx http://lists.lm-sensors.org/mailman/listinfo/lm-sensors