From: Nicolin Chen Date: Thu, 29 Aug 2013 06:25:22 +0000 (+0800) Subject: ENGR00276567-4 mfd: si476x: Fix power up failure X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5209caaae842fbbe9aaae753595d4ef9f53c9ef0;p=karo-tx-linux.git ENGR00276567-4 mfd: si476x: Fix power up failure This's some logical error in power-up code, thus fix it. Signed-off-by: Nicolin Chen (cherry picked from commit 77d97ad1bb77c0e3c60b9781a06b61d4b4667de1) --- diff --git a/drivers/mfd/si476x-cmd.c b/drivers/mfd/si476x-cmd.c index 6f1ef63086c9..8ac23dff91a1 100644 --- a/drivers/mfd/si476x-cmd.c +++ b/drivers/mfd/si476x-cmd.c @@ -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 diff --git a/drivers/mfd/si476x-i2c.c b/drivers/mfd/si476x-i2c.c index 0e4a76daf187..3eb66d40bf17 100644 --- a/drivers/mfd/si476x-i2c.c +++ b/drivers/mfd/si476x-i2c.c @@ -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;