msm: clock-8610: Set axi_clk_src to be the parent of mmss_mmssnoc_axi_clk

The mmss_mmssnoc_axi clock was setup as a dependency for
the MMSSNOC AXI RCG, in order to satisfy the FSM clocking
requirement for clocks downstream to this RCG. However,
in doing so, the AXI RCG was removed as the parent for
the mmss_mmssnoc_axi clock. This allowed the enable state
of the RCG to change while its rate was being switched,
causing the AXI RCG state machine to get stuck.

Remove the depends field in the AXI RCG structure, and
make each downstream clock explicity depend on the
mmss_mmssnoc_axi clock. Set the AXI RCG as the parent
of mmss_mmssnoc_axi to avoid locking up the RCG state
machine.

CRs-Fixed: 531224
Change-Id: I6b8fd7879bb10434cc0383c9d7761f2bb1dc69de
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
arm/dt: 8610: fine tune Himax 8379a configuration

Update Himax panel initialize code from vendor`s
recommendation to fix ESD issue.

Change-Id: I17c6f7d4a65bc4341093fe4bfa179d72ebc2f6dc
Signed-off-by: Shuo Yan <shuoy@codeaurora.org>
cpufreq: ondemand: Fix hotplug deadlock with store_powersave_bias

store_powersave_bias() acquires the hotplug lock and the dbs_mutex
lock, but does so in the wrong order.  Deadlocks like the following
can result.

Thread A:
    get_online_cpus+0x3c/0x5c           <- acquires 'cpu_hotplug.lock'
    store_powersave_bias+0x80/0x3f4     <- acquires 'dbs_mutex'
    kobj_attr_store+0x14/0x20
    sysfs_write_file+0x108/0x13c
    vfs_write+0xb0/0x128
    sys_write+0x38/0x64

Thread B:
    cpufreq_governor_dbs+0x7c/0x55c     <- acquires 'dbs_mutex'
    __cpufreq_governor+0x90/0xe0
    __cpufreq_set_policy+0x1b0/0x258
    cpufreq_add_dev_interface+0x2cc/0x334
    cpufreq_add_dev+0x514/0x580
    cpufreq_cpu_callback+0x88/0x9c
    notifier_call_chain+0x38/0x68
    __cpu_notify+0x28/0x40
    _cpu_up+0xe4/0x118                  <- acquires 'cpu_hotplug.lock'
    cpu_up+0x64/0x80
    store_online+0x48/0x78
    dev_attr_store+0x18/0x24
    sysfs_write_file+0x108/0x13c
    vfs_write+0xb0/0x128
    sys_write+0x38/0x64

Fix this by flipping the order in which the locks are acquired and
released in store_powersave_bias so that it is the same as in the
hotplug path.

Change-Id: Idc59fb29d60b8f7fceb8ed0f2bb9eff4670abda7
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
ARM: dts: msm: Remove reset configuration for pm8226

Reset line connected to vol- key on 8226 platform and
does not need to support reset. PM8941 supported reset
because of a hardware bug and is not needed for pm8226.

CRs-fixed: 530299
Change-Id: I452bd246b655b9fbcc55e076a78503a8fc97da99
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
ARM: dts: msm: Add light and proximity sensor for QRD8612

Add device tree to support Sensortek stk3310 ALPS sensor for
QRD8x12.

Change-Id: Ifcc0db29722560f111ca7b9fb6259a505e415254
Signed-off-by: Bingzhe Cai <bingzhec@codeaurora.org>
power: qpnp-charger: remove incorrect write to TEST_SMBC_MODES

The TEST_SMBC_MODES register controls the duty cycle of the
SMBB_BUCK peripheral. Remove the unecessary write. Instead
the devicetree propert qcom,duty-cycle-100p should be defined
to enable the 100% duty cycle.

Change-Id: Ib6811ae6b85d7e61054e5a7240c9a20b22822a3c
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
power: qpnp-charger: pass correct irq numbers for handlers

Pass in the correct interrupt numbers when manually calling
interrupt handlers at probe time.

Change-Id: I155fe25b1355d795e966983a29c5a6e4e3aadcd8
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
power: qpnp-charger: Fix corner cases for soc based resume

Currently SoC based resume only triggers when SoC is queried. This
does not happen when the charger is inserted/removed, so sometimes
when the battery is almost full and the charger is inserted, charging
will not resume even though SoC is below the set resume limit. Fix
this by scheduling work to read the SoC when usb is inserted.

Also, SoC based resume only checks for battery status to be full.
However if charging never finished, there can be a case where battery
status reads discharging but the charger is connected. In this case
SoC based resume should restart charging. Fix this by checking for
battery status to be not charging instead of full.

Change-Id: I74d318ac4a9b45f0de31c885319c38f6e2732060
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-charger: add support for batfet control regulator

The battery FET (batfet) is put in low power mode (LPM) where it can
allow less than 100mA of current when the PMIC goes to sleep.

This causes problems if high current discharge from the battery
is expected when the system (and the PMIC) go to sleep. Override
this LPM feature and let the batfet remain in high power mode (HPM) if a
high current discharge is expected.

Expose the batfet as a regulator and let the consumers decide whether
to enable or disable this regulator. Enabled means the batfet will stay
in HPM while PMIC goes to sleep whereas disabled means the batfet will
be switched to LPM when the PMIC goes to sleep.

CRs-Fixed: 503417
Change-Id: I883271f17ed04b37016afc9c3ea89235bde7af88
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
power: qpnp-charger: add logs when power supply is changed

When an interrupt happens usually a power_supply_changed is
called which results in the userspace reading all of the power supply
properties.

If an interrupt storm happens, one would see a these property reads
over and over again but it is hard to track which interrupt is storming.

Add debug messages which will help us pin point interrupt storms.

Change-Id: I2a16b29ea44d2ff2738231b6a2d893ad89af9669
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
power: qpnp-charger: fix vbatdet-lo irq storm

An interrupt storm on vbatdet-lo interrupt was observed when the battery
voltage was close to the resume voltage, charging was enabled and fast
charge hadn't yet begun. This causes the vbatdet lo to trigger over and
over since the driver does not disable it.

If the realtime status of the vbatdet-lo reads 0 that means the battery
voltage is lower than vbatdet threshold else 1 otherwise.

The falling edge of vbatdet-lo is used to resume charging once end of
charge (EOC) happens. Remove the usage of falling edge of the vbatdet-lo,
instead enable charging right after EOC happens and since battery voltage
will be higher than vbatdet it won't start charging. When the time comes to
resume charging, either because of SOC or battery voltage falling below
vbatdet threshold, the charger hardware will automatically resume
charging.

Use only the rising edge of the interrupt to wakeup for starting the
EOC worker but immediately disable the interrupt once EOC worker is
scheduled. Also update the EOC worker to enable the rising edge only
when it has confirmed that the voltage is low thrice in a row.

Also take this opportunity to fix a minor issue when charging is
enabled. The forcing of batfet should be disabled before enabling
charging.

Change-Id: I5d8f594de9dfe0ae3ee7ea1f4bf11b5795f8bf4f
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
power: qpnp-charger: fix chg done logic for dual charge path

When two chargers are connected simultaneously and one is
removed do not allow chg_done to be set to false. Charging
should only be reported to not be fully if charging is
resumed or both chargers have been removed.

Change-Id: Ic3e0bf244b89c81a66ec92cb641d8463055d959a
CRs-Fixed: 513398
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
power: qpnp-charger: remove vchg_loop irq

The VCHG_LOOP interrupt has proven to storm
and cause watchdog bites.

To avoid stability issues remove this interrupt.

Change-Id: Ib70331cc32477c1f655112fe698fd392798718d9
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
power: qpnp-charger: fix battery data loading

Currently qpnp_chg_load_battery_data is only loaded
if chip->vadc_dev has an error condition.

Fix this by correcting the brace placement.

Change-Id: If71434a54cff333dcb3bc7645f3b8d1934bda4de
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
power: qpnp-charger: fix JEITA implement issue

When configure JEITA threshold with 0C, checking
condition will fail and JEITA parameters reading
be skipped. Fix this by replacing logic AND with
OR.

CRs-Fixed: 523702
Change-Id: I239d3a3d47b80b48c1fae0d2f2ba32919f56a449
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
power: qpnp-charger: Report FULL sooner

At end of charge, the charger driver disables charging for 2 seconds
in order to stop charging. During these two seconds, the charge_done
flag is not set, so querying the battery power supply reports
DISCHARGING. Move setting the charge_done flag above this wait in
order to report FULL charge immediately.

Change-Id: I23e6fa18b626eb7360df23c4f30f660439a041af
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-charger: change irqs number to signed integers

To allow the probe function to correctly check for errors
change the irq struct from unsigned to signed.

This addresses some issues with static code checks.

CRs-Fixed: 500519
Change-Id: Id3c75d464daabbcaa5a1fd4045dbecd2e473c552
Signed-off-by: David Keitel <dkeitel@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>
of: batterydata: support batt-id-kohm array

The ID resistance of some battery modules goes across several
ranges, this implementation uses an array to support multiple
IDs for one battery module.

Change-Id: I402c04e18865077b07115ba2e909ccbf74909791
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
radio: iris: Fix the issue FM TX fails to turn on

FM TX fails to turn on as the condition to start
the turning process is incorrect.
Use proper condition to turn on FM TX.

CRs-Fixed: 529833
Change-Id: I01dc0620a10f1257f481f4089d392147fbf1ce8f
Signed-off-by: Ayaz Ahmad <aahmad@codeaurora.org>