msm: kgsl: Fix range checking for profile wrapping

There is a chance that the profile code will not wrap correctly.
This can cause the in stream profiling to cause buffer pre-run
or undershoot (accessing data before the buffer). Fix logic to
cause the correct wrapping.

Change-Id: I9aa68228ff5be1bd26ee1cf1a486859346a8027f
CRs-Fixed: 585754
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: kgsl: Don't open kgsl device in erroneous case

If kgsl_get_process_private() returns NULL, it goes to
err_stop with result = -ENOMEM. If open_count is 0,
adreno_stop() overwrites the result variable with 0.
This leads to kgsl_open() to be successful while it
shouldn't.

Change-Id: Ic12d92a099280e4d958fa192fa5128211120d361
Signed-off-by: Prabhat Awasthi <pawasthi@codeaurora.org>
ARM: dts: msm: Allow L2 to be in GDHS during Standalone PC for msm8974

Add a new low power level that puts L2 in GDHS mode during standalone
PC. This low power mode will give additional savings by putting L2 into
GDHS mode while the core does power collapse.

This can only be done in single core cases, the pm driver code takes
care of ensuring that L2 can be put into GDHS only when one core is online.

Change-Id: I71d237283820974c4d509606a01b67f5791d2fb9
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
arm: dts: msm8974: Enable L2 power collapse during sleep

The L2 power collapse was removed to address DDR corruption associated
with voltage droop on the MX rail. Power collapsing the MX rail doesn't
cause the Voltage to droop on the MX rail

Change-Id: Ia4ce5d374ed1197b924ae9f8fb4a5a325f81dbba
CRs-fixed: 497712
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
arm/dt: 8974: Add enabled interrupts to bypass list

The following interrupts were added to Bypass list
to enable XO shutdown for smart panel during static
display

hwirq: 56 ->  modem_wdog
hwirq: 70 ->  msm_iommu_pmon_nonsecure_irq
hwirq: 97 ->  msm_iommu_nonsecure_irq
hwirq: 105 -> msm_iommu_pmon_nonsecure_irq
hwirq: 181 -> wcnss_wdog
hwirq: 211 -> dwc3_otg

Signed-off-by: Badhri Jagan Sridharan <badhris@codeaurora.org>
Change-Id: I554e8090bcc8168f0f7e60f6962e55871ea44b1b
ARM: dts:  msm: Add BAM interrupt to bypass list

Since BAM irq originates at the Modem, marking this interrupt as a
bypass as modem is halted when the system enters a deep sleep mode.

Change-Id: I3b06e504f3aea8f567a3a4f910719c3165fd5f03
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
msm_sdcc: Fix building without BROADCOM_WIFI_RESERVED_MEM

There's no DMA QoS support when a static buffer isn't in use

Change-Id: If34a11c1f4362d08e3198558f7e0830f47447b5d
msm: vidc: fix memory leak issue in dynamic buffer mode

While flushing output buffers held in v4l2 video
driver, i.e, with ref count equal to 2, the driver
was freeing the binfo structure. This would leak
the mapped output buffer memory. By avoiding
freeing of the binfo structure, the driver waits
for the release reference event from the firmware
to free and unmap the output buffer. Also move
initialization of dequeued flag for buffers to be
held in driver, till the time we queue this buffer
to firmware. By not doing so, the video driver can
enter a race condition, whereby, a output buffer could
be unmapped and freed before v4l2 client has called
dequeue on the buffer.

Change-Id: Ic95f13b9f4426574012539a76c0b87bedb8e805a
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
ext4: fix memory leak in xattr

If we take the 2nd retry path in ext4_expand_extra_isize_ea, we
potentionally return from the function without having freed these
allocations.  If we don't do the return, we over-write the previous
allocation pointers, so we leak either way.

Spotted with Coverity.

[ Fixed by tytso to set is and bs to NULL after freeing these
  pointers, in case in the retry loop we later end up triggering an
  error causing a jump to cleanup, at which point we could have a double
  free bug. -- Ted ]

Change-Id: I49b8ca41a6c6d44b563eb23306870258a3affd3b
Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Cc: stable@vger.kernel.org
Git-commit: 6e4ea8e33b2057b85d75175dd89b93f5e26de3bc
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Osvaldo Banuelos <osvaldob@codeaurora.org>
mdss: dsi: Resolving memory leak in parse dsi commands

Free buf variable before exiting function in error cases
in order to avoid possible memory leaks.

Change-Id: I8ebc3f0f3f40be85e312f9646374a074f1414bdb
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
lge_touch_core: Don't announce support for ALL the tools

This confuses the heck out of some apps, and it's simply not true

Change-Id: I68742a8213ca541c017fbdf839194cd34eaea2d6
arm/dt: msm8226: Add adsp heap

Add adsp ION heap for 8226

Change-Id: If5d4cefb696ed811574b9d942d080b8d66687a46
Signed-off-by: Krupal Divvela <kdivvela@codeaurora.org>
gpu: ion: Add support for specifying heap type in the device tree

Currently, there is no way to swap out the underlying heap type for a
given heap ID without modifying msm_ion.c and recompiling the
kernel. This is inconsistent with the rest of Ion which is customized
through the device tree. This change eliminates the need to modify and
recompile the kernel for heap type changes (although the boot image
will still need to be regenerated).

Add a device tree binding to specify the heap_type for Ion heaps.

Change-Id: I0a2b48299c829a828764d74a1d8e3c8f97de706d
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
galbi: Declare ION carveouts in DT files

Required after I0a2b48299c829a828764d74a1d8e3c8f97de706d

Change-Id: I7122029aa3842fc90b88b48cb568599fe125f5b8
gpu: ion: remove IOMMU Heap

The IOMMU heap has been merged into the System heap since there was so
much overlap between the two. Remove the IOMMU heap. ION_IOMMU_HEAP_ID
will now alias to ION_SYSTEM_HEAP_ID.

Change-Id: I1cea1d97eba1488f8d5928e6a0f31a18b0fd92e5
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
leds: pm8xxx: Enable PWM LPG banks based on max current

The current design enables PWM LPG high bank with out
checking the max current. So enable PWM LPG low bank when max
current configured as 4mA and enable PWM LPG high bank when
the max current configured as 8mA. Enabled both PWM LPG low bank
and PWM LPG high bank when max current configure as 12mA.

CRs-Fixed: 486318
Change-Id: Ib7177aafc63c4c33b8c144d665a11d5aaf0ef584
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
mfd: pm8xxx-pwm: Set default to enable both PWM banks

In the cases where PWM lut_config is not required, both PWM banks
are not enabled. So set default to enable both PWM banks if neither
is selected or PWM enable is called without PWM lut_config.

Change-Id: I2bbed2f055022689c5943e374ac99fce4387f663
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
mfd: pm8xxx-pwm: Add support for pwm size of 7 bit

The existing pwm driver only supports 6 and 9bit pwm modes.
In 6 bit and 9 bit PWM modes, PWM high bank supports 12mA current
sink and 4mA current sink is not supported with PWM low bank in
these PWM podes. To support 4mA PWM current sink enable 7 bit PWM
mode and PWM low bank.

CRs-Fixed: 486318
Change-Id: I639d516196bda47346c979f5b8ae3c27fcaef104
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
msm_serial_hs: Add runtime support for determining UARTDM register offsets

Currently, HSUART uses a Kconfig option to determine the UARTDM core
version register offsets during compile time. This change adds runtime
configuration support for determining the version of the UARTDM core,
and use the same with appropriate register mappings in HSUART driver.

Also with addition of runtime support for determining the UARTDM core
version register offsets, Kconfig CONFIG_MSM_UARTDM_Core_v14 is no longer
required. This change also does clean up of defconfig files for removing
the config and uart register header files for achieving the same.

CRs-Fixed: 459281
Change-Id: Iff4ad1c37a3b04345d68cbe0a8befa284b49a539
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
msm_serial_hs: Fix race condition with BAM rx pipe

Crash observed due to the race condition with bam
rx pipe during sps_disconnect and sps_transfer_one
operations executed at the same time on two CPUs.

Because of this race condition rx bam descriptor
pointer becomes NULL and accessing of this pointer
leads to crash.

This patch waits for sps_transfer_one function to
complete, if it is in progress, before calling
sps_disconnect function from the set_termios.

CRs-Fixed: 534029
Change-Id: I7581062a17a3dc7ede8eb58e4d25e3b517812ab2
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>