msm: clock-9625: Add NAND device for RPM clock handling

QPIC NAND has three clocks viz. gcc_qpic_system_clk, qcc_qpic_ahb_clk,
and gcc_qpic_clk. Need to set_rate and enable only qpic_clk and then
RPM will enable system_clk and ahb_clk as well.

Add NAND device to the list of RPM clocks to facilitate clock handling
for these QPIC clocks.

CRs-Fixed: 488510
Change-Id: Ic4053bd6ba19c7396ca084b85f42ae782e946057
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
mtd: msm_qpic_nand: Add clock gating and bus bandwidth voting

QPIC NAND has three clocks viz. gcc_qpic_system_clk, qcc_qpic_ahb_clk,
and gcc_qpic_clk. Need to set_rate and enable only qpic_clk and then
RPM will enable system_clk and ahb_clk as well.

But the clocks are always on even when there are no requests to process.
So add support to gate/ungate the clocks accordingly. Also add support
to vote and unvote the bus bandwidth for better performance.

But if the clock is set and immediately suspend is triggered the clocks
would remain still enabled along with bus vote. So introduce both the PM
and Runtime PM suspend/resume to handle these cases as well.

CRs-Fixed: 488510
Change-Id: I373b39e15f6f7e2c10a8ebe182992743a1cb7838
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
ARM: dts: msm: Add bus voting properties for QPIC NAND device for msm9x25

QPIC NAND has three clocks viz. gcc_qpic_system_clk, qcc_qpic_ahb_clk,
and gcc_qpic_clk. Need to set_rate and enable only qpic_clk and then
RPM will enable system_clk and ahb_clk as well.

But bus clock enabling requires voting for bus bandwidth. So add the
properties for bus voting for QPIC NAND device.

CRs-Fixed: 488510
Change-Id: I0fe9d7f6828304e36e629ce1b21ec063b5ba8b1c
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
ARM: dts: msm: Add PIL LPASS device for apq8084

Introduce the PIL LPASS device so that the LPASS can be
brought out of reset and shutdown.

Change-Id: I17dc0608e6a37d5e194aaa84667639a62782465d
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
mdss: hdmi: Support for raw EDID data

Output edid raw data via sysfs. The size is fixed to
5 EDID blocks.

Change-Id: I46330db5e9507850ac9e82b766bcd4e4356c8755
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
mdss: hdmi: Set ITC and CN0_1 bits in AVI infoFrame

Changes ITC and CN0/1 bits in AVI hdmi infoFrame through
sysfs attributes.
Itc can be set either 1 or 0. CN0~1 bits can be set 0x00~0x11.

Change-Id: Ic6ae98ecd4c4b4a425e0219151c91eedab8d50e6
Signed-off-by: Lei Zhou <leizhou@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: mdss: Introduce error checks for rotator sessions

When there are more virtual rotator sessions allocated than
DMA pipes available, rotator pipe allocations might fail and
corresponding error messages are printed which can lead to a
watchdog bark. This change silences those error messages and
also implements an extra check to avoid null pointer
dereference when a session is dequeued without a pipe.

CRs-fixed: 523701
Change-Id: I128ab85aac9e091b13a8772a43342d655c6f736f
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
power: qpnp-bms: disable interrupts at probe

The ocv and cc threshold interrupt are required when the battery is
FULL. Disable them at probe time and enable them once the battery is
reported full.

Change-Id: I75bc0b9128f7a8552380ba184d8a72e54159c01d
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
msm: mdss: hdmi: NUL-terminate spd data

NUL-terminate SPD Vendor name and SPD
Product description data stored in the
control structure of hdmi driver. This
avoids overflows in print messages and info
frames.

Change-Id: I0a0adcfad06625e4d7368d3c5cd0ec38f0e047d8
CRs-Fixed: 520148
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
msm: camera: Add clock setting for OV12830 eeprom

Add clock config for OV12830 OTP on SKUF.

Change-Id: I61ac41bafebdee051ab317dce52d4d9a5a8ad97e
Signed-off-by: Wang Wenbin <wenbinw@codeaurora.org>
msm: camera: Add clock setting for OV5648 eeprom

Add clock config for OV5648 OTP on SKUF

Change-Id: If202d07dca68ee944b3c4068cc11b1a53083503f
Signed-off-by: Su Liu <suliu@codeaurora.org>
usb: msm_otg: wake from apps power collapse during bus resume

In case D+ and D- MPM pins exists in the platform, turn on/off
the level shifter that drive these signals into the MPM as well
as the corresponding MPM pins.

This will allow the chip to wake up from apps power collapse by
the MPM when the USB cable is connected and USB bus resume occurred.

Change-Id: I4785f73dd45e69eb389fa812f7aec8fa48c756c5
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
ARM: dts: msm: enable D+ HV interrupt for 9x25

On 9x25, the USB D+ and D- signals are routed from the HSUSB PHY to
dedicated MPM pins. This way the MPM can wake the chip  when these
signals change.

In this commit we enable only the D+ MPM pin, since we would like the MPM
to wake the chip on USB bus resume, which happens when the D+ is dropping.

Change-Id: I2b1075cc97fa9a1004aafedfc59a9eb9ecc70035
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
ARM: dts: msm: shut off usb clocks on suspend for 9625

So far, when the usb bus was in suspend state the usb driver used
wake up interrupts from the usb bam to in order to start remote wake up
signal to the host due to a packet arrival in the bam pipe. In order
to this interrupt to work, we had to keep usb clocks enable during
suspend.

Today, after implementing handshake with the IPA resource manager, upon
start of remote wake up, the consumer will be first requested by the
resource manager to signal the usb to exit from low power mode, before
the first packet is pushed into the bam pipe, so before the wake up
interrupt will be received.

This allow us to shutdown the usb clocks during suspend and therefore to
support XO shutdown during suspend.

Change-Id: Idd0acfa0a760ada10c25b7ef0be498724acff868
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
usb: msm_otg: add a support for vdd minimization gpio

Add a support to add a dedicated gpio to platform data that will allow
vdd minimization during peripheral suspend. This gpio is used to pullup
the D+ line during suspend, therefore allowing PHY to go to retention mode
and vdd minimization.

Change-Id: I65b287ba1ccbafbd1186677c88204f53e6b9a210
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
usb: msm_otg: workaround for D+ D- HV interrupts in PHY retention

This commit clears HW chicken bit in the D+ D- HV interrupts mechanism.
When this chicken bit is set (by default) then when USB PHY in retention
mode and these interrupts are active, an extra interrupt is fired, causing
for immediate wake up from bus suspend.

Change-Id: I69b281403023bcd15032a181eed43ddb6abcd919
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
msm: camera: fix gpio0 set down by mistake when gc0339 power off

Camera sensor gc0339 has no reset pin, and the default value of
gpio pin is 0. When power off, gpio0 will be pulled down by
mistake. Add some nonzero check before the operation.

CRs-Fixed: 523223
Change-Id: Ifde6b15446731e610e4635f790e880f35073f3a6
Signed-off-by: Wang Wenbin <wenbinw@codeaurora.org>
thermal: Add sensor API to allow any driver to set thresholds

Sensor API allow drivers to set min or max thresholds and get
notified when the corresponding sensor crosses these thresholds.
The sensor API, uses the THERMAL_TRIP_CONFIGURABLE_HI and
THERMAL_TRIP_CONFIGURABLE_LOW, to set the threshold. The existing
sysfs interfaces will not be affected by the newly added API.

Change-Id: I85d2ae132fc3b7b6d157faf0a7390e31fdc7e6da
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
Soc: msm: qdsp6v2: Fix invalid params handling

Alloc and free apis should sanity check all input params.
If allocation fails set client and ion handle to NULL.

Change-Id: Ide3bd782eb90ee8b033e39de232929a1ca7174b7
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
ASoC: msm: qdsp6v2: Clear ION handle after freeing

Once ion memory is freed ion handle should be set to
NULL to avoid double free or any unintended access.
This change clears the ION handle after freeing up
the memory.

Change-Id: I37d76fe2641c111fa4376eff8f7e45f6795414ca
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>