msm: emac: fix timestamping sync

Reset the RX/TX timestamp FIFO to avoid the
timestamping out of sync.

Change-Id: I8d117944671da3886262a78206e45161c1d3760f
Acked-by: Jie Luo <jluo@qti.qualcomm.com>
Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
ARM: dts: msm: device tree file for 8939 PM

Add SPM driver and LPM device entries

Change-Id: I42d7201cbf6e45cf77de68be56486703be6924b6
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
net: tc_qdisc_flow_control returning qdisc size

Changed the tc_qdisc_flow_control API to return the size of the
qdisc in order to be able to collect data on the size of the
qdisc before doing flow control operations. This is required to effectively
diagnose the state of the queues when debugging flow control.

CRs-Fixed: 657414
Change-Id: I4aff2157410e1170de2d0791757ed2e12830a2db
Acked-by: Sivan Reinstein <sivanr@qti.qualcomm.com>
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
net: rmnet_data: adding new trace points

Added new trace points for flow control events and
aggregation/deaggregation.

CRs-Fixed: 661459
Change-Id: I22e5b441f5bb8ff055b0577954cc9f6285b68a74
Acked-by: Sivan Reinstein <sivanr@qti.qualcomm.com>
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
defconfig: msm8994: enable correct charger driver

MSM8994 ships with the qpnp-smbcharger chip in the PMI8994, and the
SMB1357 charger as an external charger. It does not include the SMB1360
chip, nor the VM-BMS, nor the linear charger.

Remove the extraneous drivers and enable QPNP_SMBCHARGER and
SMB135X_CHARGER.

Change-Id: I6db4f4c2aae2130b05806d7e0ee383565c734628
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-smbcharger: make certain interrupts wakeable

Add an enable_irq_wake for the following interrupts in order to
facilitate correct power supply reporting of charge state and battery
health: tcc-thr, batt-hot, batt-warm, batt-cool, batt-cold,
batt-missing, batt-low, chg-hot, safety-timer-timeout.

Also make the usbin_uv and src_detect irqs wakeable in order to
allow usb insertions to wake the device out of sleep. Do the same for
dc-uv for wireless charger removal.

Change-Id: I3140d594d2a192fe62d30c6bdeb73fe3827cd290
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-smbcharger: enable the fastchg interrupt

Enable the fastcharge interrupt (precharge-to-fastcharge threshold
interrupt) in order to allow the charger driver to update the battery
power supply with the charging status whenever the device starts
charging.

Change-Id: I354fe73198f9d1dc23b51845d5d17f6ad7f477bf
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-smbcharger: fix various register addressing bugs

Fix the following register addressing bugs in the qpnp-smbcharger driver
that impede the functionality of the charger:

	1. The peripheral mask in the sec_access masked write function
	   is incorrect. It should be 0xFF not 0x3. This causes the
	   charger driver to fail to write to all secure access registers.
	2. The vfloat and tcc settings are using the wrong peripheral
	   bases. Change these to use the charger base.
	3. The charger enable command register is using the wrong
	   polarity. The setting should use active low, since the
	   charger_en command register is default 0.

Change-Id: I155927ea567549ffe881a6a045ce6b239f927f31
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-smbcharger: fix out of boundary read on current table

The charger driver has a bug where it starts reading on
usb_current_table[ARRAY_SIZE(usb_current_table)] when trying to find the
correct usb current to use. This will read outside the array boundaries
and will give an incorrect value (most likely 0 because of how the
arrays are laid out).

The effects will most likely be setting a max usb current of 300mA
whenever a DCP or a CDP is plugged into the device.

Fix this by starting iteration on the correct value (array_size - 1).

Also, remove the extraneous call to calc_thermal_limited_current in the
smbchg_set_usb_current_max function. The callers of this function will
be the ones to limit the current based on thermal limits if necessary.

Change-Id: I41add7e79b444effa56632ec93b408bca876a85b
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-smbcharger: use the analog TCC sensors

Currently many PMI8994 charger parts are untrimmed. The fuel gauge adc
can give wildly wrong values, and this can impact the charger end of
charging.

Fix this by switching to using the analog termination current sensors
instead.

Change-Id: Ic7cfaecc462c500a8fb5127643f997c39c803299
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
ARM: dts: msm: increase the recharge threshold on PMI8994

On the PMI8994, the charger chip can have some issues reaching a settled
end of charge. If the recharge voltage is too low, the charger chip will
repeatedly start and stop charging, some times causing an interrupt storm.

Fix this by raising the recharge threshold to VFloat - 200mV.

Change-Id: I671fc9c7d1a4fcbfc02e4ddf8d009db67df5ef71
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
clock-mmss-8994: Add oxili_rbbmtimer_clk for MSM8994

Add oxili_rbbmtimer_clk and its root clock to clock-mmss-8994 driver.

Change-Id: I34f9e1ea179aeb8442967c142673491ec0d77681
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
clock-gcc-8994: Update GPLL4 and SDCC1 clock frequencies

Update GPLL4 and SDCC1 clock frequencies according to latest hardware
frequency plan.

Change-Id: I8da612525c1fd410024f2113120bb649da34ea5a
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
msm: kgsl: Reorganize draw context validation

Verify the incoming draw context flags are correct *before* bothering
to initalize the memory. This saves us from having to jump through
hoops to take it down later.

Change-Id: Ic0dedbada00fc63752d2763ec18e1bfc3bb6410f
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
soc: qcom: ddr-health: add a structure to pass info to rpm

Driver needs to send address and size info to RPM. Add a structure to send
this information to rpm with a single kvp resource.

Change-Id: Ic8f285374926f8f8a462fc7a7371771841888649
Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
ASoC: wcd9330: Add HD2 tuning coefficients for HPH path

Add 2nd Harmonic Distortion (HD2) tuning coefficients
for HPH path. HD2 coefficients get turned ON during HPH
enable and turned OFF during path tear down. Enabling HD2
coefficients would increase the Headphone PA efficiency during
audio playback.

Change-Id: I24bc053e6401d5b8f45dc62d88c7fe6a5ba01447
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ARM: dts: msm: Use dummy provider for CPU clock on rumi 8994

RUMI does not model clock details, and thus it's necessary to use a
dummy provider for CPU clocks. Otherwise, CPUFreq will fail due to
missing CPU clocks.

Change-Id: Ib01ab070b878eef40e5c7cc80086ef08710718c0
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
diag: Reduce diag drain timer to 200ms

Reduce the diag drain timer to 200ms to drain the diag traffic
soon. Some tools expect the diag traffic in 200ms.

Change-Id: Ieb6cfa57bd1e72a53f0d3eb16b0a1d3928230327
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
usb: dwc3: otg: Prevent negative runtime PM count in host mode

In the case of OTG_STATE_A_HOST it's possible that this state
may get entered multiple times due to consecutive ID low & BSV
high interrupts. This would cause the pm_runtime_put() to get
called multiple times, and results in the runtime PM usage_count
getting decremented past zero.

Later when the host mode cable gets disconnected, the
dwc3_otg_start_host() routine will attempt to call pm_runtime_get()
but would result in a reference count of zero, and inadvertently
allows the dwc3-msm parent to go into suspend prematurely. This
will allow register acccess after the controller's clocks are
off and cause a system hang.

This is a relatively simple fix that replaces the pm_runtime_put()
with a put_noidle(), which guarantees that the reference count
does not go negative. The "noidle" in this case is allowable
because we are not attempting to go into suspend right away,
since the xHCI child device is active due to it being resumed
right before this. Only when the xHCI suspends will the parent
devices also get suspended.

Change-Id: Ia741c5044d1e3a0dcffae8d250508579d30bd10f
Signed-off-by: Jack Pham <jackp@codeaurora.org>
ARM: dts: msm: Update ocmem bandwidth values on 8084

Current ocmem bandwidth numbers on apq8084 is not sufficient to play
certain clips resulting in frame drops. Update ocmem BW for
1080p @ 60fps clips to meet performance.

CRs-Fixed: 668949
Change-Id: Icf91840726b05e872851624881140a05407c7d1b
Signed-off-by: Sowmya Pandiri <spandiri@codeaurora.org>