msm: ipc_router: Fix potential leaks and null dereferences

Added null pointer checks to avoid potential null pointer dereferences
and free statements to avoid potential memory leaks

Change-Id: I0553dfe6c61260a700a9dc6a411dcec6483e0eb8
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
msm: socinfo: Add new hw_platform for QRD

New hardware platform added for QRD targets.

Change-Id: I1a94218789dd8dc51bdd16969f081b2949887d5d
Signed-off-by: Taniya Das <tdas@codeaurora.org>
media: dvb: Add notification of overflow event for decoder filter

Applications should receive overflow indication for decoder
filters to get notification on data-loss if happens.

CRs-Fixed: 472160
Change-Id: I467af6cfbb23ccbe81694b039e7cd46c801fdcd2
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>

Conflicts:
	drivers/media/dvb/dvb-core/dmxdev.c
media: dvb: Discard sections TS packets with transport error indicator

Corrupted section data should not be notified to the application,
TS packets holding sections with transport error indicator (TEI)
are discarded.

CRs-Fixed: 473875
Change-Id: I43f500a8cde86ad970360a7f1b50615f16fb7a89
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
dvb: mpq: Secure demux log level

Add secure demux API allowing to set log level verbosity.
Log level can be set from user-sapce via a debugfs entry.
Default is no logging.

Change-Id: I5cfa4533ade061dd2a0663252cea72779018f91d
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
media: dvb: Add proper protection when calling SW filter packet

dvb_dmx_swfilter_packet function did not properly lock against
dvb-demux data-structure like the rest of dvb-demux SW filtering
functions.

Change-Id: Id287f660773f93aeac8b0fc01df6f995b72ac93b
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>

Conflicts:
	drivers/media/dvb/dvb-core/dvb_demux.c
media: dvb: Fix SDMX process size when crossing limit in TSIF

When playing live from TSIF, TS packet is always 192 bytes long.
The SDMX process limit size was not calculated correctly taking
this case into account.

Change-Id: Id80da8b648cabb222a179c1d49cacdb138f94316
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
media: dvb: Fix support for maximum TSPP buffer size

The maximum allowed buffer size depends on maximum allowed
number of BAM descriptors. The maximum allowed number of
descriptors was changed to meet HW capabilities. A check
whether user buffer size requires number of descriptors
larger than what is allowed was added.

CRs-Fixed: 490749
Change-Id: Ic60414af156ee8d969263b7636393693277c8f61
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>

Conflicts:
	drivers/media/dvb/mpq/demux/mpq_dmx_plugin_tspp_v1.c
	drivers/misc/tspp.c
media: dvb: Protect against removing all PIDs from an active filter

When TS filter is active (running), it is not allowed to remove
all PIDs associated with the filter; The filter state would be
invalid and as such may result in unexpected behavior while
performing runtime operations on the filter.

CRs-Fixed: 492444
Change-Id: I340b02bed218e89ffe89932e3b3e9ea93f429876
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
media: dvb: Add initialization of PES error indicators

Following SDMX notification on PES data the errors indicators
for PES event were not cleared if SDMX did not report any error.

CRs-Fixed: 493108
Change-Id: I89b43ce193b96462b804848c5e484d25343d5f40
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
media: dvb: Fix race condition in DVR thread

When DVR thread is created, it may happen that user sets
DVR buffer mode to external buffer but did not yet set the
buffer itself, meanwhile, DVR thread checks whether the
input buffer was already set and if not the thread terminates.

This causes termination of DVR thread for no good reason.
DVR thread should be terminated only when DVR device is closed.
The change removes termination of the thread when input buffer
is not set yet to avoid such race condition.

CRs-Fixed: 493761
Change-Id: I57c9acd13bd493ae08d28703bf5f6c0dea55c20a
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
media: dvb: Fix parsing of SDMX results

When playing from memory, it may happen that demux thread
is stalled while parsing SDMX results due to PULL mode.
While thread is stalled it is possible that user asked to
add new filter and therefore the SDMX filter count increases.

When thread gets back from stalling, it may parse additional
filters result even-though they were not processed by SDMX yet,
hence parsing un-initialized data.

Change-Id: Idb9430ec07f5869585ed1ae9ab3d43c4d31ff4d2
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
media: dvb: Fix error handling of SDMX API failures

When setting of key-ladder index fails, there's no need
to fail starting of the filter since it could only mean
that decryption might fail if encrypted packets are encountered.

In addition, if closing SDMX session fails, SDMX TZ application
might be removed anyhow, therefore we should clear reference
counting of SDMX session so that it is re-opened if requested
in the future.

Change-Id: I17e1ce62b72910e2086d948807af969725c6f18b
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
ASoC: wcd9xxx: Fix MBHC irq handler deadlock scenario.

There is a chance to encounter deadlock when either electrical mbhc irq
or mechanical mbhc irq releases resource lock to let polling thread finish
its job.  This is due to the possibility of one irq handler can preempt
already running the other type of irq handler.
Introduce a new mutex to avoid this preemption.

CRs-fixed: 428653
Change-Id: Idf24c62224026c9c061de12c31e248c05b47de9d
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>

Conflicts:

	drivers/mfd/wcd9xxx-irq.c

Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
rmnet_smux: Increase Rmnet device instance count

Rmnet supports only one device instance.

Increase Rmnet device instance count to enable dual PDN support.

CRs-Fixed: 497343
Change-Id: I1b3eacec4404ac72a524380a1fff39e6b257ade8
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
radio-tavarua: Handle I2C read/write errors during sleep mode.

Getting read/write errors when the I2C is not resumed from the sleep

Added re-try mechanism to handle during I2C read/write

Change-Id: I5a533b085ccfcda2181a2d5ea792bbb3d187c477
CRs-Fixed: 427937
Signed-off-by: Venkateshwarlu Domakonda <Venkateshwarlu@codeaurora.org>
radio: iris: Add synchronize mechanism to handle multiple command requests

Used mutex to synchronize the command requests.

Change-Id: Ie58b996bbc76b36095020556a2046b7aa5c351fa
CRs-Fixed: 448591
Signed-off-by: Venkateshwarlu Domakonda <Venkateshwarlu@codeaurora.org>
radio: iris: Added IOCTLS to get/set AF Jump, Search Thresholds

Implement ioctl to get/set AF Jump RMSSI Threshold,
AF Jump RMSSI Samples, Good Channel RMSSI Threshold,
Search Algo Type, SINR FIRST STAGE, RMSSI FIRST STAGE

Change-Id: I0c79de6966cb93fbbc5befafc9aaaea95982ddb8
CRs-Fixed: 460621
Signed-off-by: Ayaz Ahmad <aahmad@codeaurora.org>
radio-iris: Configure repeat count for PS string

- When FM Rx tuned to a station, not receiving complete PS string.
  SOC is not waiting for complete PS string. it is sending PS event
  even if it has part of PS string as well.
- Added support for setting repeat count for PS string
  to get refined PS string from receiver.

CRs-Fixed: 474719
Change-Id: I71c0c1c8af9488573c05d816c37982f9ed935a87
Signed-off-by: Venkateshwarlu Domakonda <Venkateshwarlu@codeaurora.org>
spi_qsd: Correction in DMA mode check.

Due to bug in the if() condition msm_use_dm function
is always returning '0' when cs_change is true. Due to
this issue the DMA mode is not bieng used when it has to be.

This patch fixes this issue.

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