PM QoS: Add disable parameter

For testing purposes it is useful to be able to disable
PM Qos.

Bug 1020898
Bug 917572

Reviewed-on: http://git-master/r/124667

Change-Id: I266f5b5730cfe4705197d8b09db7f9eda6766c7c
Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>

Rebase-Id: Re2088674f90436e0b9dd74310d5cda1f9e2868e4
Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>
PM / QoS: export pm_qos_update_request_timeout()

This pm_qos_update_request_timeout() was introduced without being exported.
Should export it as all of the other PM QoS APIs so those drivers compiled as
modules can use it.

Change-Id: Ie51ce52db4ca633117fe18441c42b562220399e8
Signed-off-by: Li Li <lli5@nvidia.com>
Reviewed-on: http://git-master/r/189306
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Eric Miao <emiao@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>
PM QoS: Add GPU frequency limits to PM QoS

Added GPU frequency min/max as PM QoS classes.

Bug 1330780

Change-Id: I2428c62748521c17e23b2df9ca409deda8b36160
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/267702
Reviewed-by: Ilan Aelion <iaelion@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>
pmqos: Replace spinlock with mutex for pm_qos_lock

Using a spinlock (taken with irqsave) meant that pm_qos_lock couldn't be
used to synchronize on the notifiers in order to ensure proper order of
the notifications. This is needed in case where there might be two near
simultaneous pmqos client requests for a bound on the same constraint;
the notifiers in pm_qos_update_target for the two clients could
potentially engage in a race.

Example:

Assume two requests are made (A, B with A coming first) for max cpufreq
and these are the only requests currently available.

Current behavior can result in:

notify(max_cpu_freq, minof(A, B))
notify(max_cpu_freq, minof(LONG_MAX, A))

Expected behavior:

notify(max_cpu_freq, minof(LONG_MAX, A))
notify(max_cpu_freq, minof(A, B))

Most of the PM QoS and Dev PM QoS requester clients were reviewed and
none of them were found to be calling pm_qos_add/update/remove request
from interrupt or atomic context since those calls include the blocking
notifier call which cannot be done in atomic context.

Change-Id: I2fb43cc38da4c701e4872b937dd82cd38f1a1c1e
Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/299036
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>