clk: qcom: gdsc: Fix handling of hw control enable/disable
authorRajendra Nayak <rnayak@codeaurora.org>
Mon, 23 Jan 2017 04:26:21 +0000 (09:56 +0530)
committerStephen Boyd <sboyd@codeaurora.org>
Fri, 27 Jan 2017 00:00:38 +0000 (16:00 -0800)
commit843be1e7fb30f6309aa9389344b16dca57e6d4e2
tree95866c166df695bdc17099ce0dc9377fc3c31b5e
parent340a84ce1eddd6671ce0c57d890fd90f6ae27fa2
clk: qcom: gdsc: Fix handling of hw control enable/disable

Once a gdsc is brought in and out of HW control, there is a
power down and up cycle which can take upto 1us. Polling on
the gdsc status immediately after the hw control enable/disable
can mislead software/firmware to belive the gdsc is already either on
or off, while its yet to complete the power cycle.
To avoid this add a 1us delay post a enable/disable of HW control
mode.

Also after the HW control mode is disabled, poll on the status to
check gdsc status reflects its 'on' before force disabling it
in software.

Reported-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Fixes: 904bb4f5c7de ("clk: qcom: gdsc: Add support for gdscs with HW control")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/qcom/gdsc.c