cpufreq: interactive: Choose highest frequency below or at target

This generally saves us one freq level.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
cpufreq: Always allow update of user policy

In the cases where the system boots up in a constraint with policy min and
max lower than cpuinfo min/max, and user tries to set a higher user
policy min, the value would be overridden during the verifying the
limits.

Once user initiates the sysfs write the previous user policy is
maintained in policy min and max thus changing the limits for verification
of the current policy. Once the verification is completed restore the
current user policy min/max with the updated values if any. This would take
care of cases uwhere user policy min/max input is higher/lesser than the
current min and max.

Change-Id: I5ad92ba05162cb5c32c3ba3fdae21d2e505493d3
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: Request max register bus bandwidth for PP LUTs during resume

There are a couple postprocessing features that are LUT based features,
and they require a lot of register accesses to configure the hardware.
During the first resume display commit, when all registers are
reconfigured, if any of the LUT based PP features are enabled, then we
will request maximum bus bandwidth to speed up the accesses.

Change-Id: I17a8c0f563db3a3715c170dbcd5666b0ee567b01
Signed-off-by: Benet Clark <benetc@codeaurora.org>

ARM: dts: msm: Reading MDP offsets from device tree for PP functions.

The register address offset values are currently stored in macro
variables. These are now being moved to device tree. These addresses
cannot be calculated in cases of targets which have single DSPP like
8226.

The required register address offset values are added to the
respective target device tree files. The address validation
functions corresponding to PP are modified to read the values from
these newly added device tree entries.

8x10 target does not require this change as it uses MDP3
architecture.

Change-Id: I9387c8fadc36e3bbaceb51b243d3a9537250a3be
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>

msm: mdss: remove obsolete method of mixer register read/writes

Starting apq8084, mixer offsets have changed compared to previous
chip-sets. Some of the code is still using old method of reading
and writing to mixer registers which leads to incorrect hw programming.
Replace these mixer register read/writes with working method.

CRs-Fixed: 564273
Change-Id: I2aa1c5d24c6a1c5b89f77bd8d450c0831dd720b7
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>

msm: mdss: Fix CSC programming for VIG3 pipe

CSC programming assumes that pipe numbers are symmetric for same
type. This assumption is not valid with APQ8084 and leads to skipping
of CSC programming for VIG3 pipe. Fix this by using helper APIs to
find out if pipe is VIG or not rather than directly manipulating data
structures.

Change-Id: I130ee3994d1f5c5a96e644f8095c75d2189fbdda
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>

msm: mdss: fix bandwidth vote release for dual-dsi cmd mode panels

For dual-dsi command mode panels, bandwidth(bw) vote is supposed to be
released once ping-pong done interrupt for both controller is received.
In current implementation, if secondary ctl finishes last, which is the
case most of the times, then bw release is called using secondary ctl.
But bw is calculated/stored using main ctl because of which bw vote is
never released as expected. Fix this by releasing bw vote using main ctl.

Change-Id: Iadbd150ed6a35478da2cb376e29b01e579a526b8
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>

mdss: calculating length based on offsets from dts

If the len values are not mentioned in the device tree, then
calculate the length based on the corresponding offsets
Plus split mdss_sspp into: sspp_vig, sspp_rgb and sspp_dma.
Because in 8092, the lengths are different. Therefore, they
should be separate lengths in the generic implementation.

Change-Id: I0f83ffae15d1ae3e92a01f7f23215c94b23065c7
Signed-off-by: Zohaib Alam <zalam@codeaurora.org>

ARM: dts: msm: Removing len parameters for mdss device tree

The len parameters for sizes of SSPP, DSPP, CTL and Mixer
interfaces are not used in the code anymore.

Removing those parameters from device tree.

Change-Id: Ib49a3d79c27f3291d942e0f36fcb78da93eb43f2
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: Disable bw release for cmd mode panels

For command mode panels, driver can release the bandwidth once
the frame is transferred to the panel and no more processing is
done in the display driver; in some scenarios this results in
more power consumption since more interrupts are generated.
This change disables the bandwidth release for command mode panels
and add a debugfs node to dynamically enable the feature if needed
for debugging purposes.
To enable the bw release:
echo 1 > "<debugfs>/mdp/perf/enable_bw_release"
To disable the bw release (default):
echo 0 > "<debugfs>/mdp/perf/enable_bw_release"

Change-Id: I61670606f1cf52b8d889678e6ffe7d0e911771e7
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: disable bw release from rotator

For rotator path, display driver can release the rotator
bandwidth once the rotator finished processing. In some
scenarios this results in more power consumption since more
interrupts are generated to release the bandwidth.
This change disables the bandwidth release for the rotator path
and add a debugfs node to dynamically enable the feature if
needed.
To enable the bw release for rotator:
echo 1 > "<debugfs>/mdp/perf/enable_rotator_bw_release"
To disable the bw release for rotator (default):
echo 0 > "<debugfs>/mdp/perf/enable_rotator_bw_release"

Change-Id: If147b8fb202edcb389fe85e78f8d61d2a98cef95
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: Correct set backlight call during unblank

If brightness node is written prior to unblank by surfaceflinger
the backlight level being applied would not be correct. The
stored value is also overwritten.

Passing the correct unset backlight value during unblank.

Change-Id: I430bc759e09ecc6dfbc616af47fbc953aa542b9a
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
video: mdss: Fix a few potential NULL pointers

Change-Id: Id9b289c6b02b9bb7b793bb8c686f15c5549a62d3
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: reset cont splash screen flag after notifying panel intf

Starting with commit a702d63198e3524740be22b66ce1933064174019, the
continuous splash screen feature flag for the secondary panel was also
disabled along with that of the primary panel. However, this should only
be done after notifying the interface drivers about the transition from
the splash screen to the boot animation. This is needed as the DSI panel
driver relies on this flag to avoid unnecessarily configuring the DSI
lanes in to the ultra low power state during this transition.

Change-Id: I59d312248c579d27913f23dc23e9c91a99549725
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mdss: display: move mdss_mdp_irq_enable out of clk_lock scope

There are potential deadlock between irq handler and
mdss_mdp_irq_enable() since both can acquire mdss_lock
before trying to grab local lock. Add koff_lock for kickoff
related function in addition to original clk_lock which used
for clock related function to reduce unnecessary lock contention.

CRs-Fixed: 665524
Change-Id: Iebc5023eb9dc99f2a2709379bfac67ec275046a7
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: support reduced dspp and WB interfaces

MDSS driver has condition check for 1:1 mapping for dspp to
interface and WB to ctrl. This check is not valid for all MDP
version hardware.  It can support less dspp compared to number
of interfaces. It can also support less number of WB paths
compared to controllers. This change enables MDSS driver
to handle such hardware conditions.

Change-Id: Ic08e274c73cc41e80245a0d3d4ae7b854bd5a2d3
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: vidc: handle dynamic buffers in pendingq during flush

In dynamic buffer mode, if flush was received before
stream-on, driver would have incremented the ref count
for output buffers, but not yet sent to firmware. So,
after flush done, there would be no fbd from firmware
and the reference to these buffers would not be removed.
So when the buffers are dequeued, driver fails to
unmap and free the output buffers.
Subsequently, after flush done, when client queues
the same output buffers again to driver, the ref
count is increased and becomes 2. This results in
the driver holding the buffers with itself, thereby
entering in to a deadlock situation and starving the
firmware of output buffers. This results in a video
freeze.

Change-Id: I0c3d13124bd48b900e56e14666eaed2f0e7ee9d6
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: msm_bus: Fix inadvertent stomp on BKE_EN register

While setting the QoS mode of fixed mode masters bad masking
operations is causing accidental stomp on the upper nibble of the
BKE_EN register.

Change-Id: I5675e1dbc6fd5a01faac49c903e12a9c95e32254
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: reset runtime status upon device resume

MDSS is power-collapsed in idle screen cases using the pm runtime
framework. However, it is possible that the runtime PM status may
not match with the post-system sleep status when the device is
resumed. This sometimes leads to the inconsistencies in MDSS
idle-power collapse upon system resume. To address this issue,
reset the runtime PM status in the pm resume handler.

Change-Id: I5696ce6c154f2898b82e70119d3d9a2be79b59b7
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: refactor MDSS idle power collapse logic

MDSS GDSC can be turned off, or power-collased for command mode panels
in static screen use-cases. In the current implementation, the power
collapse is triggered by a worker thread in the interface driver
whenever once it enters the idle state. However, MDP driver already
registers pm_runtime callbacks for idle and suspend notifications and
also maintains a count of active overlay sessions. It is much simpler
and cleaner to trigger idle-power collapse based on that. This also
avoids unnecessary synchronization issues pertaining to the power
collapse worker thread.

Change-Id: I198e6d7685e5ef6eed7cd06a77fa76435940b805
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
wcnss: Reduce the pil_retry count value

wcnss driver doing multiple pil retry which causing boot process
block upto all pil retry finish. reduce the pil retry count so
it will not delay other boot process.

Change-Id: I753e5d381a3559eaee30fddd50ecc65a30815f64
CRs-Fixed: 688990
Signed-off-by: Hardik Kantilal Patel <hkpatel@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ARM: dts: msm: Update the vifeed back routing

Codec clock should be enabled when vifeedback path for speaker
protection is enabled.
Change adds the routing entries to enable the codec clock for
speaker protection vi capture feedback path for 8974.

Change-Id: I6230f5a40a20a3d5e81d194a622083ece8873b79
CRs-fixed: 591723
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
misc: Kill logspam

Change-Id: Ida0b1eaeda4c678f0103675b44a8cc845f3dacbf
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ASoC: msm: Rampup volume on each start

Rampup volume on each trigger start call to compress driver.
This helps in reducing pops heard by the listener after a seek/pause+resume

Change-Id: I0d82c5a9a8ed2b64683e8c0855da2208c90d8199
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
CRs-Fixed: 692337
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mfd: wcd9xxx: Add support for REPEAT_CHANGE_VALUE

Slimbus supports ability to write upto 16 bytes to the same register as
one transaction on the bus through REPEAT_CHANGE_VALUE slimbus message.
Add support to write codec register with multiple values using
REPEAT_CHANGE_VALUE. Not all sizes from 1 to 16 are supported by such a
message, add support in driver to be able to write all sizes from 1 to
16 by splitting the register writes of unsupported sizes into multiple
writes of supported sizes.

Change-Id: I33fdd983068bc10f65523b2a95f1d7741fa6c486
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ASoC: wcd9xxx: Don't enable micbias if headset is removed

If special headset is removed, the callback to
disable micbias will be called, as micbias is
always on with special headset. Mbhc driver
checks a flag, used to disable/enable micbias
for special headset, to make sure micbias is
not disabled by recording. If this flag is not
updated properly before the callback is called
while the headset is removed, it can cause that
micbias is left enabled.

CRs-Fixed: 687630
Change-Id: Id49a2a0ba43821deef8fc5b6fb904239b2273f69
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>