qseecom: Add support for bus scaling.

Add support for scaling bus to various level:
LOW, MEDIUM, HIGH.  Expose IOCTL to user space
clients to enable selecting a specific bus bandwidth
setting.

Change-Id: I8ef94b84464e86d3a71e4c78c502e99ef2e0ec9a
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: Abhishek Ranjan <aranja@codeaurora.org>
qseecom: Add basic suspend resume functionality.

If ce clock is not disabled in suspend state, memory may be corrupted and
device can not wake up. Thus, if clock is enabled, we disable it in qseecom
suspend function and re-enable it again in resume function.

Change-Id: I70349ad3070c340add1f3fbe392a4bec2b8af9bf
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: Abhishek Ranjan <aranja@codeaurora.org>
qseecom: update clock ref count when bus scaling timer is running.

when there are multiple enable/dislable clock operations, ce clock
ref count is not updated correctly when the timer to disable clock
is running. Specifically, the ref count is not decreased when the
old operation is finished and then we reset clock for the new enable
clock. Thus, the ce clock is not disabled after all operation are
completed due to incorrect clk ref count. We make a change to
decrease clock reference count before reset timer, when the timer
is running, then clock is disabled when all ce clock operations
finish and the timer expires.

Change-Id: If71fd526acd9a74bf21731841fae0b98e76a89b5
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: Abhishek Ranjan <aranja@codeaurora.org>
qseecom: change qseecom bus scaling timer operation.

To ensure ce clock is not disabled before tz operation is completed,
we delete the old timer when tz side operation begins, and then add
a new timer after tz operation is completed.

Change-Id: I4bc8fe3d9305cc1ed5db8e6490832fcc791ef3d7
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: Abhishek Ranjan <aranja@codeaurora.org>
qseecom: Ensure CE clk is managed properly.

Clk access ref count is not updated correctly when issuing a
request that requires enabling clk. this results in leaving the
clk on during regular operation resulting in failure of the
device to go into low power mode.

Change-Id: I80232433ff09277fe83d78142dcec75e7493d96e
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: Abhishek Ranjan <aranja@codeaurora.org>
Merge "qseecom: Add support for bus scaling."
Merge "qseecom: Add basic suspend resume functionality."
Merge "qseecom: update clock ref count when bus scaling timer is running."
Merge "qseecom: change qseecom bus scaling timer operation."
Merge "qseecom: Ensure CE clk is managed properly."