cpufreq: interactive: Add max_freq_hysteresis feature

Previously known as sampling down factor, max_freq_hysteresis
extends the period that interactive governor will stay at policy->max.
This feature is to accomodate short idle periods in an otherwise very
intensive workload.

When the feature is enabled, it ensures that once a CPU goes to max
frequency, it doesn't reduce the frequency for max_freq_hysteresis
microseconds from the time it first goes to idle.

Change-Id: Ia54985cb554f63f8c22d0b554a0a0f2ed2be038f
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
cpufreq: interactive: Make window alignment optional

Make sampling window alignment optional when scheduler inputs
are not enabled.

Change-Id: If69c111a3efe219cdd1e38c1f46f03404789c0bb
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
cpufreq: interactive: Exercise hispeed settings at a policy level

If a heavy task migrates between otherwise idle CPUs in a policy during
every sample window, the above hispeed delay window for the CPUs would get
restarted for every sample window. Due to the continuous restart of above
hispeed delay window, none of the CPUs would ever pick a target frequency
higher than hispeed frequency. This causes the policy's frequency to be
stuck at hispeed freq even if the load justifies a higher frequency.

To fix this, the above high speed delay window is restarted only when the
policy frequency changes. This ensures that tasks migrating between CPUs in
a policy are handled correctly.

Also, the hispeed load/frequency heuristic is only necessary when the
information is insufficient to determine if the load on the CPU needs at
least hispeed frequency. When the policy frequency is already at or above
hispeed frequency, if the CPU load% based on policy frequency is not above
hispeed load, then the information is clearly sufficient to determine that
the load on the CPU does not need hispeed frequency.

Therefore, compute CPU load% (which is used only to compare against hispeed
load) based on policy frequency instead of CPU target frequency.

Change-Id: I1749d663949e34753ecb5c426a16563796f8b0b2
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
cpufreq: interactive: fix merge derp

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
sound_control: add basic sound control.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
sound_control: update how the new values get applied writing and reading them directly from the tabla registries. This will fix the breakage caused by 4.3.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
sound_control: just some cosmetic changes.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
sound: expose hardware registers to userspace based on the datasheet: http://datasheet.elcodis.com/pdf2/79/40/794029/tpa2028d1.pdf

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
mako: sound: new speaker amp defaults, previous values were distorting on max volume.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
mako: sound: change speaker amp defaults again based on user feedback.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
sound_control: expose mic gain to userspace.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
mako: sound: fix the limiter value (only accepts 1 and 0) and boost fixed_gain a little bit.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
sound_control: add workaround for sound boost resets. Based on https://github.com/faux123/Nexus_5/commit/33407fd2d63290540eb0054bc7c6611f2080ea8b

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>