]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00276567-4 mfd: si476x: Fix power up failure
authorNicolin Chen <b42378@freescale.com>
Thu, 29 Aug 2013 06:25:22 +0000 (14:25 +0800)
committerNitin Garg <nitin.garg@freescale.com>
Fri, 16 Jan 2015 03:17:12 +0000 (21:17 -0600)
This's some logical error in power-up code, thus fix it.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
(cherry picked from commit 77d97ad1bb77c0e3c60b9781a06b61d4b4667de1)

drivers/mfd/si476x-cmd.c
drivers/mfd/si476x-i2c.c

index 6f1ef63086c9df98c56c00369c7b91b60c5320c5..8ac23dff91a1660aa486c79c615e068d1c245a2c 100644 (file)
@@ -303,13 +303,13 @@ static int si476x_core_send_command(struct si476x_core *core,
         * possible racing conditions when working in polling mode */
        atomic_set(&core->cts, 0);
 
-       /* if (unlikely(command == CMD_POWER_DOWN) */
-       if (!wait_event_timeout(core->command,
-                               atomic_read(&core->cts),
-                               usecs_to_jiffies(usecs) + 1))
-               dev_warn(&core->client->dev,
-                        "(%s) [CMD 0x%02x] Answer timeout.\n",
-                        __func__, command);
+       if (!(command == CMD_POWER_DOWN))
+               if (!wait_event_timeout(core->command,
+                                       atomic_read(&core->cts),
+                                       usecs_to_jiffies(usecs) + 1))
+                       dev_warn(&core->client->dev,
+                               "(%s) [CMD 0x%02x] Answer timeout.\n",
+                               __func__, command);
 
        /*
          When working in polling mode, for some reason the tuner will
index 0e4a76daf18789b37e84163f2a83bb45afb642ea..3eb66d40bf17e0882e5a4c3e5ca42255cc0c9687 100644 (file)
@@ -303,7 +303,7 @@ int si476x_core_set_power_state(struct si476x_core *core,
                         */
                        udelay(100);
 
-                       err = si476x_core_start(core, false);
+                       err = si476x_core_start(core, true);
                        if (err < 0)
                                goto disable_regulators;
 
@@ -312,7 +312,7 @@ int si476x_core_set_power_state(struct si476x_core *core,
 
                case SI476X_POWER_DOWN:
                        core->power_state = next_state;
-                       err = si476x_core_stop(core, false);
+                       err = si476x_core_stop(core, true);
                        if (err < 0)
                                core->power_state = SI476X_POWER_INCONSISTENT;
 disable_regulators:
@@ -799,6 +799,10 @@ static int si476x_core_probe(struct i2c_client *client,
 
        core->chip_id = id->driver_data;
 
+       /* Power down si476x first */
+       core->power_state = SI476X_POWER_UP_FULL;
+       si476x_core_set_power_state(core, SI476X_POWER_DOWN);
+
        rval = si476x_core_get_revision_info(core);
        if (rval < 0) {
                rval = -ENODEV;