From f7e0be452524226e0605b1924c593b1621660bff Mon Sep 17 00:00:00 2001 From: Nicolin Chen Date: Thu, 29 Aug 2013 14:25:22 +0800 Subject: [PATCH] MLK-11429-22: mfd: si476x: Fix power up failure cherry-pick below patch from imx_3.14.y 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) (cherry picked from commit b656522da2685ef9a4da2229b6786d5cd0c12189) --- drivers/mfd/si476x-cmd.c | 14 +++++++------- drivers/mfd/si476x-i2c.c | 8 ++++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/si476x-cmd.c b/drivers/mfd/si476x-cmd.c index 2086b4665288..d5cfe7ba4649 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 c180b7533bba..4865bb84d091 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: @@ -800,6 +800,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; -- 2.17.1