bma023: Support for Bosch BMA023, BMA150 and SMB380 accelerometers
Hi Alan,
A few doubts
Quoted 16 lines
+
+/**
+ *bma023_suspend- called on device suspend
+ * @client: i2c client of sensor+ * @mesg: actual suspend type
+ *
+ * Put the device into sleep mode before we suspend the machine.
+ */(quoted diff) +7
-0+static int bma023_suspend(struct i2c_client *client, pm_message_t mesg) +{ + bma023_set_power_mode(client, BMA023_SUSPEND); + return 0; +} + +/**
Review
Quoted 10 lines
(quoted diff) +10
-0+ * bma023_resume - called on device resume + * @client: i2c client of sensor + * + * Put the device into powered mode on resume. + */ +static int bma023_resume(struct i2c_client *client) +{ + struct bma023_sensor *sensor = dev_get_drvdata(&client->dev); + if (bma023_get_check_reg(client) != BMA023_INSPECT_VAL) + bma023_initialize(sensor);
The initialise is only in the resume and not in the runtime resume.
Quoted 1 line
+
bma023_set_power_mode(client, sensor->power_mode);
where is sensor->power_mode getting updated.
Quoted 1 line
+ msleep(4); /* wait for accel chip resume */
The startup time from poweroff seems to be 3ms am I missing something. May consider a #define for the time.
Quoted 7 lines
+ return 0;
(quoted diff) +6
-0+} + +#else +#define bma023_suspend NULL +#define bma023_resume NULL +#endif
<snip>
Quoted 4 lines
+ .probe =
bma023_probe,
+ .remove =__devexit_p(bma023_remove),
+ .suspend =bma023_suspend,
+ .resume =bma023_resume,
You may consider moving these also to the pm ops.
However these can be taken up later feel free to ignore such comments.
Quoted 1 line
+ .id_table =
bma023_ids,