input: sensor: compass: Add sec-salve-id for compass
Xiaohui Tao [Wed, 11 Sep 2013 00:49:42 +0000 (17:49 -0700)]
Bug 1356943

Change-Id: If34b39b849e350fd9312b9a73130db13c3571b4c
Signed-off-by: Xiaohui Tao <xtao@nvidia.com>
Reviewed-on: http://git-master/r/272840
(cherry picked from commit 9f42dfc3cda19db08aec5a01ed124789240c4970)
Reviewed-on: http://git-master/r/273830
Reviewed-by: Jon Mayo <jmayo@nvidia.com>

arch/arm/boot/dts/tegra114-tegratab.dts
drivers/input/misc/compass/ak8975_input.c

index d9a061c..64f0153 100644 (file)
@@ -44,6 +44,7 @@
                        reg = <0x0d>;
                        orientation = [00 01 00 01 00 00 00 00 ff];
                        config = "mpu";
+                       sec-slave-id = <18>;
                };
        };
 
index 665a4be..55c0c36 100644 (file)
@@ -1424,6 +1424,12 @@ static struct mpu_platform_data *akm_parse_dt(struct i2c_client *client)
                return ERR_PTR(-EINVAL);
        }
 
+       if (of_property_read_u32(np, "sec-slave-id",
+                               &pdata->sec_slave_id) < 0) {
+               dev_err(&client->dev, "Cannot read sec-slave-id\n");
+               return ERR_PTR(-EINVAL);
+       }
+
        return pdata;
 }
 
@@ -1467,6 +1473,11 @@ static int akm_probe(struct i2c_client *client,
        if (err)
                goto akm_probe_err;
 
+       if (!inf->initd)
+               err = akm_init_hw(inf);
+       if (err)
+               goto akm_probe_err;
+
        inf->wq = create_singlethread_workqueue(AKM_NAME);
        if (!inf->wq) {
                dev_err(&client->dev, "%s workqueue ERR\n", __func__);