mmc: core: Add the ability to enable BKOPS

If the card and the host support BKOPS, and BKOPS is not enabled
yet, set the BKOPS_EN bit to enable BKOPS.
This bit is one time programmable.

(cherry picked from commit e966c1ca32d118b26ca6e26267f0c13c9c0e0052)

Change-Id: I2b97898857bed676021fe56a6f6e49762cf609fa
Signed-off-by: Maya Erez <merez@codeaurora.org>
mmc: msm_sdcc: Enable eMMCv4.5 BKOPS support

Set MMC_CAP2_INIT_BKOPS. This will set the BKOPS_EN bit in the
ext_csd register. The BKOPS_EN bit is one time programmable.

(cherry picked from commit b7f382b25fbd363c43af2332b4ff490e13aab6e4)

Change-Id: Ie913561b2b82ff28366ffe564ffcafe8fc19a96a
Signed-off-by: Maya Erez <merez@codeaurora.org>
msm: camera: kernel driver for camera sensor

PLD for ov8830, ov9726 camera sensors.
Autofocus tuned header support for ov8830.

Change-Id: I38066d65430b810cd7c6a5a0b5e21e1f9f0aaf8f
(cherry picked from commit c6143aa0e8e5b8dd5fe692b54a6934f69d397258)
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
mmc: Revert all packing related patches

The version of packing support excepted by the linux community is
slightly different from the one that was merged. This revert is needed
in order to upload the latest version from the linux community.

This patch reverts the following commits:
1.mmc: card: Add eMMC4.5 write packed commands unit-tests
2.mmc: card: Fix packing control enabling algorithm
3.mmc: block: Add MMC write packing statistics
4.mmc: msm_sdcc: enable the write packing control
5.mmc: msm_sdcc: Enable write packing capability
6.mmc: block: Add write packing control
7.mmc: core: Support packed write command for eMMC4.5 device
8.mmc: core: Add packed command feature of eMMC4.5

(cherry picked from commit f94cf3da103b344b13fa4d6665fd21dad1b95ead)

Change-Id: I2efc6dc8d8f6d5cc7e9efa99ec74914ffff96fcd
  commit:  9b54d88c6a11ebfe069b7fdebcb521da21754c3f
  commit: e2ecb58a6c5011549aac3e86fb1c13e7b7c65104
  commit: e544d700e2dac1584a8172c4dc347d81ede203bd
  commit: 8afe8d2a98a1bbf3804162ff5c95a56226935f5a
  commit: 25e2261a556c4393f79d58bce814bb3df34b9549
  commit: 63c61d6d8b8f37c71b4162b3affffdf72ac06811
  commit: 968c774ea6466fa7adbf2eac333220132acda306
  commit: 516994eee39282b8648b509e449ff83b49833209.
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: add packed command feature of eMMC4.5

This patch adds packed command feature of eMMC4.5.
The maximum number for packing read(or write) is offered
and exception event relevant to packed command which is
used for error handling is enabled. If host wants to use
this feature, MMC_CAP2_PACKED_CMD should be set.

(cherry picked from commit c70e9669bffa2f2ffe4d8f9768980e1cd08df4b2)

Change-Id: If3af1299c7dbdc9f66b13ec5b99038225d5b17f0
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Reviewed-by: Maya Erez <merez@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: support packed write command for eMMC4.5 device

This patch supports packed write command of eMMC4.5 device.
Several writes can be grouped in packed command and all data
of the individual commands can be sent in a single transfer
on the bus.

[tlinder@codeaurora.org: Difference in definition:
R1_EXP_EVENT -- > R1_EXCEPTION_EVENT]

(cherry picked from commit 53f8f574c6c68687098cd064af8224da44de2484)

Change-Id: I26ee7c0b957a3aec5e4ffc6d6df806ea38435784
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Reviewed-by: Maya Erez <merez@codeaurora.org>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: msm_sdcc: Enable write packing capability

The write packing allows sending several requests in a single command
to the card and increases the eMMC performance in sequential write
operations.

(cherry picked from commit 34a444f2041763d617391be44f4a9ac1b7d6eab7)

Change-Id: I45978c8130d3898b21e36309696647c380521a87
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: block: Add write packing control

The write packing control will ensure that read requests latency is
not increased due to long write packed commands.

The trigger for enabling the write packing is managing to pack several
write requests. The number of potential packed requests that will trigger
the packing can be configured via sysfs by writing the required value to:
/sys/block/<block_dev_name>/num_wr_reqs_to_start_packing.
The trigger for disabling the write packing is fetching a read request.

(cherry picked from commit 0cc76400d65f0d7b3f2f8f1ece3c8061652a35d7)

Change-Id: I51a44d2673e40e4e404317ddb632a9fb204e9a06
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: card: Fix packing control enabling algorithm

When hitting a stop potential packing event, we should zero
num_of_potential_packed_wr_reqs, so that the packing won't be
enabled too early.

(cherry picked from commit 285ee17e20580759ef349b43e48565cfad8adb10)

Change-Id: I384d74dc6eece67358a51fb0add5d988aee44d5d
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: block: Add MMC write packing statistics

The write packing statistics are used for the packed commands unit tests
in order to determine test success or failure

(cherry picked from commit 464fbe1af0248b7e85044ccebf4d4d96dd8fdeaa)

Change-Id: If5465118e0ea1b4c78b73a43b664d5b6bc9cae31
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: block: Update packing statistics with large sector size

This patch adds "large sector size" as a reason for stop packing
to the packing statistics mechanism

(cherry picked from commit 1718ef21fb791a2ea25bd3fbf236913de64ca85f)

Change-Id: I595f7839fa9156d5ed26040943c1d5e3011c2a60
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: msm_sdcc: enable the write packing control

Write packing control prevents degradation of read throughput
in parallel read and write scenarios when the write packing
feature is enabled

(cherry picked from commit dffdbad64760df63918aad2cb148f7286f852dd1)

Change-Id: Id1aadcd21c88619e4c848872a149542495ede180
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: core: Add support for idle time BKOPS

Devices have various maintenance operations need to perform internally.
In order to reduce latencies during time critical operations like read
and write, it is better to execute maintenance operations in other
times - when the host is not being serviced. Such operations are called
Background operations (BKOPS).
The device notifies the status of the BKOPS need by updating BKOPS_STATUS
(EXT_CSD byte [246]).

According to the standard a host that supports BKOPS shall check the
status periodically and start background operations as needed, so that
the device has enough time for its maintenance operations.

This patch adds support for this periodic check of the BKOPS status.
Since foreground operations are of higher priority than background
operations the host will check the need for BKOPS when it is idle,
and in case of an incoming request the BKOPS operation will be
interrupted.

When the mmcqd thread is idle, a delayed work is created to check the
need for BKOPS. The time to start the delayed work is calculated based
on the host controller suspend timeout, in case it was set. If not, a
default time is used.
If BKOPS are required in level 1, which is non-blocking, there will be
polling of the card status to wait for the BKOPS completion and prevent
suspend that will interrupt the BKOPS.
If the card raised an exception, the need for urgent BKOPS (level 2/3)
will be checked immediately and if needed, the BKOPS will be performed
without waiting for the next idle time.

(cherry picked from commit 5f360698caa2894f7cc854199ffba285241d152e)

Change-Id: I6605ce396188807bed93f437224f2243b178523f
Signed-off-by: Maya Erez <merez@codeaurora.org>
mmc: card: Add eMMC4.5 write packed commands unit-tests

Expose the following packed commands tests:
- Test the write packed commands list preparation
- Simulate a returned error code
- Send an invalid packed command to the card

(cherry picked from commit 09b010d749e40e86b42e62406f8886956e03f3bd)

Change-Id: I563a17b8dc313e65c20ed24d542d29ab7b432741
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: card: Add eMMC4.5 packing control unit-tests

Expose the packing control test.
Test the packing control feature under these scenarios:
- Packing expected: entering write packing state,
  staying in write packing state.
- Packing not expected: not entering write packing state
  when not supposed to.
- Mixed states: test the ability to shift from packing
  to no-packing and back, and the opposite.

(cherry picked from commit 202befb5a5a344f88a0b4fd1ed07b9a2c7ce4e3d)

(cherry picked from commit 91e1e32573321986b141f153ffdb5bcc8affe95b)

Change-Id: I06638dc19aa7703d0571d9699b24ce9977b1bcb8
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
mmc: block: Adding device attribute for minimum sectors to start BKOPS

This attribute is used to determine whether the status bit that
indicates the need for BKOPS should be checked. The value is stored in
this attribute represents the minimum number of sectors that needs to
be changed in the device (written or discarded) in order to require
the status-bit of BKOPS to be checked

(cherry picked from commit e6c6b4b14ac2f10aa34cf42b6f558152e438bb37)

Change-Id: I3b05a0826fc9397a13d6b03ee028293f877f8d66
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
ASoC: pcm: allow backend hardware to be freed in pause state

When front-end PCM session is in paused state, back-end PCM
session will be put in paused state as well if given front-end
PCM session is the only client of the given back-end. Then,
even though the application closes front-end PCM session, DPCM
framework will not allow back-end to enter into HW_FREE state,
and hence back-end will never get shutdown completely.

(cherry picked from commit 6479fa2d82c5fa8b756a4755bc84e2ce48dad850)

Change-Id: Ia7381b890cb952c7f265bde69f5dfc95ead62705
CRs-fixed: 411089
CRs-fixed: 409894
Signed-off-by: Banajit Goswami <bgoswa@codeaurora.org>
Merge "msm: rpm_stats: Add support to read master PC stats from RPM MSG RAM."
Merge "msm: rpm_stats: Debugfs support to display master PC stats."
wcnss: Add interface to Reset wcnss

Add wcnss reset interface, this interface generates an FIQ to Riva.
Upon receiving this interrupt, Riva will execute the ERR_FATAL
routine and invoke SSR.

(cherry picked from commit 19e0235abf773c293c341acb4159db585f8a4e96)

Change-Id: If17fda74ededf10957f680fa502a3b092586515a
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>