cpufreq: Enforce PM QoS min/max limits

Observe PM QoS CPU frequency minimum and maximum in addition
to policy settings.

Bug 888312

Change-Id: Ia4f60a1649a9952e02f6847c8add3b2ea5d47524
Reviewed-on: http://git-master/r/72207
Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/75884
Reviewed-by: Automatic_Commit_Validation_User

Rebase-Id: Red1299253123d231af705a130f07e7aa77698fd8
Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq.c

Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>
cpufreq: Preserve sysfs min/max request

Store the value received via sysfs as the user_policy
min/max value instead of the currently enforced min/max.
This allows restoring the user min/max values when
constraints on enforced min/max change.

Bug 888312

Change-Id: I8a5adf022585e5bd91fa3b1d8d448065efa6827a
Reviewed-on: http://git-master/r/73982
Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/75886
Reviewed-by: Automatic_Commit_Validation_User

Rebase-Id: Ra33b58958c1251c5931e84c2a81726fe9b5b1e92
Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq.c

Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>
cpufreq: Typecast compared integers

The min/max frequencies in cpufreq_policy are unsigned integers
but pm_qos_request() returns a signed int. Compare as unsigned,
frequencies are never negative.

Bug 949219

Change-Id: Iba0de9ad6bf221f7a2e5560f597aa56cbeb7b6f6
Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Reviewed-on: http://git-master/r/91214
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

Rebase-Id: Rf996a487f263e4bee451da38d3317a6ae53214dd
Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq.c

Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>
cpufreq: interface for setting governor for a cpu

This implementation sets governor for a cpu using existing
cpufreq interfaces.

bug 871958

Change-Id: Ic4e7e2a2b0babaf1829b559b5db211666d449b86
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: http://git-master/r/97939
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Rebase-Id: Rb3099a95700c83e412808b91da1c076f0873722c
Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>

Conflicts:
	include/linux/cpufreq.h

Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>
cpufreq: Don't clip PM QoS requests to old policy limits

Clipping PM QoS requests to combined old policy limits that include
both PM QoS and user policy requests creates a circular dependency.
As a result new PM QoS maximum limit is rejected if it is above
previous PM QoS minimum limit even though the new PM QoS minimum
limit has been already lowered below new PM QoS maximum limit.

Instead clip PM QoS request to the old user policy limits only.

Change-Id: Ice0a53a699e0798f07f0e32d6b8a28586fe5db0c
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/102386
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Donghan Ryu <dryu@nvidia.com>
Reviewed-by: Antti Miettinen <amiettinen@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Tested-by: Vikas Ramesh Kedigehalli <vikasr@nvidia.com>

Rebase-Id: R86b13b0253d70595c37d835ffdc809d9f7172e8f
Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq.c

Signed-off-by: Jake Weinstein <xboxlover360@gmail.com>
Update defconfig