Revert "Revert "msm_fb: Increase PWM granularity to 255 levels for 8960 fluid""

This reverts commit 988cf899932688b4e7b97b2b21931670e37e2afc.

Change-Id: Id56ea30890361e0f95fa65d3fd26230d4684ec80
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Revert "Revert "msm_fb: Increase backlight granularity from 15 to 255 levels""

This reverts commit 0f481a380bac42f5df610c0f2afff286727c77a4.

Change-Id: Ic4bab04230905515017cfbc6c6e115360b8c85c9
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: display: reduce pwm frquency to fix the broswer blank issue

screen goes completely blank while loading a webpage at low back
light value. reducing the pwm frequency range to fix the issue.

Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
CRs-fixed: 362987 342485
(cherry picked from commit 75692782e15de0990247e2d6252fbd26ca849278)

Change-Id: I7e08eda6db604485eb33272d86e4ae7ef485cc26
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
fs: yaffs2: Add null pointer check before dereferencing inode

In yaffs_rename(), d_entry->d_inode can be NULL if the
target directory doesn't exist or if there is any race
condition such as target directory being deleted while
renaming another directory to target directory name.
Avoid dereferencing d_inode in such cases.

CRs-Fixed: 360748
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
(cherry picked from commit fb92e57e92999dcd0f4620c1f02f07c2f9c8438f)

Conflicts:

	fs/yaffs2/yaffs_vfs.c

Change-Id: I47217f501e6561aa863f827e3da41a965244ba2f
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
bluetooth: LE conn whitelist implementation

Add support to create connection to LE devices using
whitelist. With this, the Controller can try to connect
to multiple devices at the same time. The following
interfaces are added.
1. Add/Remove device from whitelist
2. Clear all the devices from whitelist
3. Create Connection to devices from whitelist
4. Cancel create connection to whitelist devices

CRs-fixed: 388980
Signed-off-by: Sunny Kapdi <sunnyk@codeaurora.org>
(cherry picked from commit 93bef895b01b79f49af60ba1394c9c3f6e563212)

Change-Id: Id88c8808ccec8a318e05c8eaeb5ba2d49601ac4c
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
mmc: msm_sdcc: set IO_PAD_PWR_SWITCH bit based on IO voltage level

SDCC4 controller has IO_PAD_PWR_SWITCH control bit in MCI_CLK register.
Driver should set this bit to 1 if the IO voltage level is within
low voltage range (1.7v - 1.9v) else clear it.

But driver sets this bit to 1 only if the MMC core layer initiates
the voltage switch sequence. So if voltage switch sequence is not
initiated (which is the case with non UHS-I cards) then even if
the IO voltage level is within low voltage range, IO_PAD_PWR_SWITCH
bit remains cleared.

This change checks the IO voltage level and based on that sets the
IO_PAD_PWR_SWITCH bit.

CRs-Fixed: 386445
Change-Id: I1df7b7fd795c26e1c7179aaee23452844ec6fddf
(cherry picked from commit 341b9e7dbaf0a3caf6e41d37486e3bccc9795feb)
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
power: pm8921-bms: add api to stop/start ocv updates

OCV (open circuit voltage) updates could cause the state of charge
to drift by a considerable amount. There are cases where an OCV
update is undesirable. Provide facility to disable OCV updates.

Change-Id: If660c2004abf65e26db21f85bc1646388f2a10cd
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
power: bms/ccadc: move ccadc calibration to ccadc driver

There is a dependency for the CCADC calibration work on the BMS
driver. This prevents some devices that do not use the BMS
to utilize the CCADC.

Remove this dependency by moving the ccadc calibration
work to the CCADC driver to avoid this.

Change-Id: If43c781d6d2bc27f64dbbe594b6e81c5a5642f0b
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
power: pm8921-bms: remember soc between restarts

Currently the code does not have a mechanism to remember the soc
reported just before shutting down and upon restarting the new
soc reported is off from the previous soc value reported.

This change introduces
- a method to save soc in an unused coincell back register: ssbi address
  0x107 is not used on 8921 and serves the purpose of storing the soc.
  The driver reads this value and uses it to scale the reported soc.
- a method to detect that a battery was removed and perhaps replaced by a
  different one. If the battery is found replaced the driver is notified
  of the change and it disregards the soc value it read from the backup
  register. The charger driver has a battery backed bit (force vref
  therm) which it sets in its initialization sequence. Once set the
  value remains between restarts, unless the battery is removed. The
  default value of this bit is 0. Hence if a zero is detected before
  writing to it, battery was removed between restarts - this mechanism
  is used to notify the BMS to disregard the soc read from the backup
  register.

Note that for this to work correctly the bootloader needs to be updated to
not overwrite register 0x107 upon restart.

CRs-Fixed: 370287
Change-Id: If7d098552d36eb27a396ee7d37f78d3629861f6e
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
power: pm8xxx-ccadc: remove support for pm8921 v1.0 and v1.1

This ccadc module is reused in multiple pmics. It is now unnecessary
to check for 8921 versions in the driver. As a result of this change
older 8921 versions are not supported.

CRs-Fixed: 372679
Change-Id: I2114f9428e2ba1a29c2bc9caaaa75106caf1dfc3
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
power: pm8921-bms: remove support for pm8921 v1.0 and v1.1

The bms module is reused in multiple pmics. It is now unnecessary
to check for 8921 versions in the driver. As a result of this change
older 8921 versions are not supported.

CRs-Fixed: 372679
Change-Id: Ie9131d47ed08fa6fa39812c9e60be34cc6280e4c
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
msm: camera: Fixed VPE crash issue.

Check if VPE base has been unmapped before accessing VPE h/w registers.

Change-Id: I5457612902a3382df4e776ee726f030272c7b731
CRs-Fixed: 390332

Signed-off-by: Chandan Gera <cgera@codeaurora.org>
Bluetooth: fix shutdown on SCO sockets

shutdown should wait for SCO link to be properly disconnected before
detroying the socket, otherwise an application using the socket may
assume link is properly disconnected before it really happens which
can be a problem when e.g synchronizing profile switch.

Signed-off-by: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
(cherry picked from commit 2e02b861173406a1287a53ca7b836a4ad5fd4255)

Change-Id: I30a63c5898eff1b0d18673303c4a87f35e286253
CRs-fixed: 365445
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
power: pm8921-charger: Bound lower AICL limit at 500 mA

AICL is only relevant for wall chargers for current
ratings above 500 mA. Once the minimum value is reached
stop decreasing the IUSB_MAX value to avoid a complete
charging stop by setting IUSB_MAX to 100 mA.

Change-Id: I9b100a5a06aa22552ba8251ce4137e69aea7d07c
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Bluetooth: Validate session before rfcomm_session_del

In rfcomm_session_put API the session count is decremented
and when it is equal to zero rfcomm_session_del is called
where session is removed from sessions list and freed. The
current change is verify the existance of session in list
before acting session. The avoids the possibility of action
on a deleted session, which causes crash.

CRs-Fixed: 383000
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
(cherry picked from commit ff724cc3a2f52f1190b28c56b28bdb16e6613ad4)

Change-Id: Iebfdd9789ed20537aa6e57a1611688dbb0bfda66
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Bluetooth: Avoid race condition between hci registration/un-registration

Syncronized hci device registration/un-registration to avoid race
condition when called from mutiple paths/scenarios concurrently.

CRs-fixed: 375287
Signed-off-by: Bhasker Neti <bneti@codeaurora.org>
(cherry picked from commit 6d353eea1df6995cf2d7619547b203479b20e3bc)

Change-Id: Id8f577eb16e77811d62098e7dca4d9147616f71c
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
ARM: 7382/1: mm: truncate memory banks to fit in 4GB space for classic MMU

If a bank of memory spanning the 4GB boundary is added on a !CONFIG_LPAE
kernel then we will hang early during boot since the memory bank will
have wrapped around to zero.

This patch truncates memory banks for !LPAE configurations when the end
address is not representable in 32 bits.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit b5b28874153adc2dc8fda9d6854bb011e6752952)

Change-Id: I2c483e3d43ffd8269dc9247934945ef4e1d52b6b
CRs-fixed: 355203
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Bluetooth: Block SCO disconnect operation on BT_CLOSED state.

Have maximum blocking time for shutdown operation as DISCONNECT_TIMEOUT.
During this period when SCO connection closes, the userspace will be
updated on the close operation. Existing approach of immidiate return
on shutdown call can cause synchronization issues on SCO state between
kernel and userspace. This happens when disconnect operation takes
more time at kernel space.

CRs-fixed: 365445
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
(cherry picked from commit f799996e309cad545b3a7f84ef6f333a09c8b876)

Change-Id: If398b1d14f62af498c3653bfa13a0344ec52b769
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
ASoC: msm: Reset the calibration block after subsystem restart

    - After sub system restart ACDB cannot push data to Q6
    - Memory map is not happening after sub system restart, because
      the calibration block address is same as the cached address.
      Without memory map calibration block is sent to DSP, where it is
      failing with memory map error.
    - Reset the calibration block after sub system restart, so that
      memory map happens after sub system restart.

CRs-Fixed: 389214
Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>
(cherry picked from commit b71818e0ee674b2357d419c6559b5aa009d96a14)

Change-Id: I9046d124b2789eef33ff5c356ea52e96bb09f5db
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
radio-tavarua: Validate whether the current station is good or bad

Provide mechanism to decide whether the currently tuned station
is valid or not.

CRs-Fixed: 371689
Signed-off-by: Anantha Krishnan <ananthk@codeaurora.org>
(cherry picked from commit 4c2dcd4a4cec5939fffda43f162c04757fdba42c)

Change-Id: I95d34c1e952088bc0648a047399f31c4d5f7f63a
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>