On+
+/* For tracking power state as set by User Space code */
+static unsigned char power_state = false;
why?
no. we don't want to add this ABI to the MeeGo kernel... it needs to be
done with device runtime PM anyway
(which is a requirement for MeeGo drivers on these platforms)
+static bool set_mode(struct i2c_client *client, unsigned char new_mode)
+{
+ unsigned char curr_mode;
+
+ /* Read the current mode and return if it's already in the new
mode */
+ curr_mode = i2c_smbus_read_byte_data(client, REG_CNTL);
+ if (curr_mode == new_mode)
+ return true;
+
+ /* Changing operating modes requires entry to Power Down mode
first */
+ i2c_smbus_write_byte_data(client, REG_CNTL, POWER_DOWN);
what locking is in use to ensure that nobody else talks to the hardware
during this sequence
+
+ /* Delay a bit, then ensure the device is in Power Down mode */
+ msleep(0);
how long is this delay ??????
+static bool wait_for_data_ready(struct i2c_client *client)
+{
+ unsigned char data_ready = 0;
+ int wait_count = RETRY_COUNT;
+
+ /* Wait for Data Ready bit in ST1 to become 1 */
+ while (--wait_count) {
+ data_ready = i2c_smbus_read_byte_data(client, REG_ST1);
+ if (data_ready)
+ return true; /* Success */
Linux convention is to return 0 on success, negative error codes on failure
+ msleep(0);
how long is this???
+
+ /* Work function for retrieving magnetic field values from sensor */
+ while (retries++ < RETRY_COUNT) {
+ /* Set Single Measurement mode */
+ if (set_mode(client, mode)) {
and here you need a lock or refcoutn (hint: runtime PM will likely just
give you that) to make sure nobody powers your device down as you go.
+ (void)set_mode(client, POWER_DOWN);
uh? why that cast?
+ if (!set_mode(client, POWER_DOWN))
+ printk(KERN_WARNING "ak8975: Problem exiting Fuse ROM
mode !\n");
dev_err ? dev_warn ?
not a very good driver to be honest.. I wonder if the one in the
upstream kernel is any better...
would make a better base to start from.
_______________________________________________
Meego-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel