Commit graph

873,069 commits

Author SHA1 Message Date
David Collins
bb67ea43af spmi: add SPMI PMIC arbiter debug bus driver
Add a new SPMI bus driver which can manage the SPMI debug bus
found on SPMI PMIC arbiter version 5 and above.  This debug
bus has read and write access to all PMIC peripherals regardless
of ownership configurations.  It cannot be used on production
devices because it is disabled by an eFuse.

Change-Id: I7dd7171d775db02269b98bb079bdccf5d0f4aae4
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 18:06:36 -07:00
Guru Das Srinagesh
5b36ca42b5 mfd: introduce I2C PMIC controller
The I2C PMIC Controller is used by multi-function PMIC devices
which communicate over the I2C bus.  The controller enumerates
all child nodes as platform devices, and instantiates a regmap
interface for them to communicate over the I2C bus.

The controller also controls interrupts for all of the children
platform devices.  The controller handles the summary interrupt
by deciphering which peripheral triggered the interrupt, and
which of the peripheral interrupts were triggered.  Finally, it
calls the interrupt handlers for each of the virtual interrupts
that were registered.

This is a snapshot from msm-4.19
commit 9a702c565e5a ("Use 'GPL-2.0-only' as the
SPDX-License-Identifier tag").

Change-Id: I28a4905e1666c06cb2c06d00f56ef66981621b2d
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 18:06:35 -07:00
David Collins
4354299c32 thermal: qcom-spmi-temp-alarm: add support for GEN2 rev 1 PMIC peripherals
Add support for TEMP_ALARM GEN2 PMIC peripherals with digital
major revision 1.  This revision utilizes a different temperature
threshold mapping than earlier revisions.

Change-Id: Iaae5c64558d1ac7fb87d2f5a5b2baa26bf1c38eb
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:38:15 -07:00
David Collins
497dff9805 pinctrl: qcom: spmi-gpio: add support for PM*8350* PMIC variants
Add support for qcom,pm8350-gpio, qcom,pm8350b-gpio,
qcom,pm8350c-gpio, and qcom,pmk8350-gpio variants.

Change-Id: I9f914a4e0c54997665bff8372f7fd2c57efccf14
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:38:14 -07:00
David Collins
e9e26d44be pinctrl: qcom: spmi-gpio: correct parent irqspec translation
pmic_gpio_child_to_parent_hwirq() and
gpiochip_populate_parent_fwspec_fourcell() translate a pinctrl-
spmi-gpio irqspec to an SPMI controller irqspec.  When they do
this, they use a fixed SPMI slave ID of 0 and a fixed GPIO
peripheral offset of 0xC0 (corresponding to SPMI address 0xC000).
This translation results in an incorrect irqspec for secondary
PMICs that don't have a slave ID of 0 as well as for PMIC chips
which have GPIO peripherals located at a base address other than
0xC000.

Correct this issue by passing the slave ID of the pinctrl-spmi-
gpio device's parent in the SPMI controller irqspec and by
calculating the peripheral ID base from the device tree 'reg'
property of the pinctrl-spmi-gpio device.

Change-Id: If04a7ca73b995dd99939d340f2d33d4488197de0
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:38:12 -07:00
Anirudh Ghayal
e20a3a1beb pinctrl: qcom: spmi-gpio: Fix the GPIO strength mapping
The SPMI based PMICs have the HIGH and LOW GPIO output
strength mappings interchanged, fix them.

Keep the mapping same for older SSBI based PMICs.

CRs-Fixed: 2246473
Change-Id: I4ec78469c436b54642ee67108943c82fba46e1c4
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2019-11-01 14:38:11 -07:00
Subbaraman Narayanamurthy
3f96cb1a83 pinctrl: qcom: spmi-gpio: add support to enable/disable output
Currently, if the GPIO is configured as output in the bootloader
and user changes the mode to input in HLOS, it would end up
getting configured as input/output. Functionally, this is fine;
however, there may be some requirements where the output needs
to be disabled so that it can be used only for input.

Add support to enable/disable output mode through "output-enable"
or "output-disable" pinctrl properties.

Change-Id: Ie857f94d529a6209bcb82ef3775d414f19d5678a
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2019-11-01 14:38:10 -07:00
Abhijeet Dharmapurikar
5a5e52e13f mfd: qcom-spmi-pmic: instantiate pmic peripherals at arch_initcall
The spmi_devices spawn platform devices for pmic peripherals. Some of these
devices are required early on in the boot process.

Initialize the driver at arch_initcall to avoid unnecessary probe
deferrals.

Change-Id: I38474bedcb284ed5a7df1ec8d26f680787f2c074
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
[collinsd@codeaurora.org: add module exit function]
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:37:38 -07:00
David Collins
a4d2754961 mfd: qcom-spmi-pmic: add support for slow SPMI busses
Add device tree support for configuring if mutexes or spinlocks
should be used in the regmap configuration (i.e. the fast_io
element value).  This ensures that qcom-spmi-pmic slave devices
can be used with SPMI busses that must operate in process
context.

Change-Id: I3abdee36935457db497ce6ff2a242755fc3aff90
Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2019-11-01 14:30:00 -07:00
Subbaraman Narayanamurthy
ff2fb11b08 spmi: spmi-pmic-arb: Fix hw_irq overflow
Currently, when handling the SPMI summary interrupt, the hw_irq
number is calculated based on SID, Peripheral ID, IRQ index and
APID. This is then passed to irq_find_mapping() to see if a
mapping exists for this hw_irq and if available, invoke the
interrupt handler. Since the IRQ index uses an "int" type, hw_irq
which is of unsigned long data type can take a large value when
SID has its MSB set to 1 and the type conversion happens. Because
of this, irq_find_mapping() returns 0 as there is no mapping
for this hw_irq. This ends up invoking cleanup_irq() as if
the interrupt is spurious whereas it is actually a valid
interrupt. Fix this by using the proper data type (u32) for id.

CRs-Fixed: 2357600
Change-Id: I451e33d61e063d3a9381c2b43767946117a5bbb9
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2019-11-01 14:20:32 -07:00
Yimin Peng
ac4ae512b2 spmi: pmic-arb: support updating interrupt type flags
Have the qpnpint_irq_set_type function clear unwanted high/low
trigger bits when updating the interrupt flags.

Change-Id: Ie55d6178ea94350ecf8c79714cb863ea63d76ea6
Signed-off-by: Yimin Peng <yiminp@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2019-11-01 14:20:31 -07:00
David Collins
e4f7eef56d spmi: spmi-pmic-arb: increase SPMI transaction timeout delay
Increase the SPMI transaction timeout delay from 100 us to
1000 us in order to account for the slower execution time
found on some simulator targets.

Change-Id: I5805fa77131336e56db35ae7948012e072c15746
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:20:29 -07:00
David Collins
0cf5f1b07b spmi: spmi-pmic-arb: block access for invalid PMIC arbiter v5 SPMI writes
The system crashes due to an access permission violation when
writing to a PMIC peripheral which is not owned by the current
ee.  Add a check for PMIC arbiter version 5 for such invalid
write requests and return an error instead of crashing the
system.

Change-Id: If601a8c737f10be2a7d1e894f7285cf0de4eb4a5
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:20:28 -07:00
David Collins
27abf44b3c spmi: spmi-pmic-arb: correct duplicate APID to PPID mapping logic
Correct the way that duplicate PPID mappings are handled for PMIC
arbiter v5.  The final APID mapped to a given PPID should be the
one which has write owner = APPS EE, if it exists, or if not
that, then the first APID mapped to the PPID, if it exists.

Change-Id: I387e25d5e0d29434a6191faaf887db1e1a90243d
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:20:20 -07:00
Ashay Jaiswal
12684b27b8 spmi-pmic-arb: add support to dispatch interrupt based on IRQ status
Current implementation of SPMI arbiter dispatches interrupt based on the
Arbiter's accumulator status, in some cases the accumulator status may
remain zero and the interrupt remains un-handled. Add logic to dispatch
interrupts based Arbiter's IRQ status if the accumulator status is zero.

Change-Id: I068f5c7d33758063878721d7cce1308fa803e3bd
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:18:11 -07:00
David Collins
1783d5b87c spmi: spmi-pmic-arb: check apid against limits before calling irq handler
Check that the apid for an SPMI interrupt falls between the
min_apid and max_apid that can be handled by the APPS processor
before invoking the per-apid interrupt handler:
periph_interrupt().

This avoids an access violation in rare cases where the status
bit is set for an interrupt that is not owned by the APPS
processor.

Change-Id: Ib74cb4ae7be9849f0243659bb4c1435340e1e087
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:15:25 -07:00
Subbaraman Narayanamurthy
3d5821adf6 spmi: pmic-arb: do not ack and clear peripheral interrupts in cleanup_irq
Currently, cleanup_irq() is invoked when a peripheral's interrupt
fires and there is no mapping present in the interrupt domain of
spmi interrupt controller.

The cleanup_irq clears the arbiter bit, clears the pmic interrupt
and disables it at the pmic in that order. The last disable in
cleanup_irq races with request_irq() in that it stomps over the
enable issued by request_irq. Fix this by not writing to the pmic
in cleanup_irq. The latched bit will be left set in the pmic,
which will not send us more interrupts even if the enable bit
stays enabled.

When a client wants to request an interrupt, use the activate
callback on the irq_domain to clear latched bit. This ensures
that the latched, if set due to the above changes in cleanup_irq
or when the bootloader leaves it set, gets cleaned up, paving way
for upcoming interrupts to trigger.

With this, there is a possibility of unwanted triggering of
interrupt right after the latched bit is cleared - the interrupt
may be left enabled too. To avoid that, clear the enable first
followed by clearing the latched bit in the activate callback.

Change-Id: If126d6f6cdf6c944ca513c53a71a91e225ee63e2
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
[collinsd@codeaurora.org: fix merge conflict]
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:08:58 -07:00
Abhijeet Dharmapurikar
84d765b0da spmi: pmic_arb: add a print in cleanup_irq
The cleanup_irq() was meant to clear and mask interrupts that were
left enabled in the hardware but there was no interrupt handler
registered for it. Add an error print when it gets invoked.

Change-Id: Iccf0daadeb82b0fca29829424439ac225e2b3b88
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 14:03:59 -07:00
Abhijeet Dharmapurikar
4c8cc75386 spmi: pmic-arb: instantiate spmi_devices at arch_initcall
The spmi arbiter device spawns spmi_devices which in turn spawn
platform_devices for pmic peripherals.

Move the arbiter's driver init to arch_initcall so that the subsequent
devices it spawns get instantiated earlier.

Change-Id: Ib96937f274745549ee86f758673aab4db97acbaf
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
[collinsd@codeaurora.org: added module exit function]
Signed-off-by: David Collins <collinsd@codeaurora.org>
2019-11-01 13:55:22 -07:00
Patrick Daly
f4031a6aa1 spmi: pmic-arb: Use asynchronous probe
A spmi controller may have many child devices, which together may take
a signifigant amount of time to register and probe. Reduce this effect
by probing asynchronously.

After:
[    0.277217] calling__software_resume+0x0/0x24c_@_1
Before:
[    0.319295] calling__software_resume+0x0/0x24c_@_1

Change-Id: I95704a2ae7aae98e23dc9f29c7d023867d60388d
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Signed-off-by: Swathi Sridhar <swatsrid@codeaurora.org>
2019-11-01 11:11:12 -07:00
qctecmdr
727f8a7022 Merge "clk: dt-bindings: gcc: Add USB PIPE clocks" 2019-11-01 10:09:03 -07:00
qctecmdr
6eaa9bf7dd Merge "techpack: Fix uapi headers_install" 2019-11-01 08:40:50 -07:00
qctecmdr
76af7ae5db Merge "i2c: i2c-msm-geni: Add I2C GENI driver snapshot" 2019-11-01 07:55:53 -07:00
qctecmdr
07714cda66 Merge "dmaengine: gpi: add GPI dmaengine driver snapshot" 2019-11-01 06:58:21 -07:00
qctecmdr
8745f6ecc5 Merge "clk: qcom: clk-alpha-pll: Remove zonda pll set rate delay" 2019-11-01 05:19:13 -07:00
qctecmdr
8e4b26ff82 Merge "media: v4l2-core: Enable VIDIOC_DQBUF ioctl functionality" 2019-11-01 04:27:18 -07:00
qctecmdr
8e02afb87a Merge "clk: qcom: clk-alpha-pll: Add support for controlling zonda5lpe PLL" 2019-11-01 03:52:02 -07:00
qctecmdr
b2f9ea926a Merge "arm64: defconfig: Enable global synx driver" 2019-11-01 02:57:25 -07:00
qctecmdr
8db7ec54b8 Merge "usb: gadget: Add support for usb runtime pm APIs" 2019-10-31 22:12:21 -07:00
qctecmdr
4091569308 Merge "cnss2: Switch to new genl structure" 2019-10-31 21:28:51 -07:00
qctecmdr
c7e8b77730 Merge "usb: gadget: rndis: Add packet filter handling for hw accelerated path" 2019-10-31 20:49:49 -07:00
qctecmdr
ad5d02f552 Merge "USB: rndis: Honor dl_max_packet_size value sent by host" 2019-10-31 20:07:48 -07:00
qctecmdr
5d1673603d Merge "usb: gadget: rndis: Add new rndis parameters" 2019-10-31 19:21:32 -07:00
qctecmdr
706ab1d034 Merge "usb: gadget: Add support for rndis flow control callback" 2019-10-31 18:40:50 -07:00
qctecmdr
7b8d417d82 Merge "usb: Add support for rndis uplink aggregation" 2019-10-31 17:49:56 -07:00
qctecmdr
3df179a516 Merge "usb: dwc3-msm: Allow xo_clk to be optional" 2019-10-31 16:59:16 -07:00
qctecmdr
6ad49b177f Merge "ion: Assume in-kernel clients for prefetch and drain" 2019-10-31 16:17:38 -07:00
qctecmdr
bba34cd529 Merge "usb: dwc3-msm: Get usb power_supply from device tree" 2019-10-31 15:32:40 -07:00
qctecmdr
b49d4cf260 Merge "usb: dwc3-msm: Add usb_ep_autoconfig_by_name" 2019-10-31 14:44:59 -07:00
qctecmdr
8a9739baf5 Merge "cnss_genl: Use new structure for genl" 2019-10-31 13:49:24 -07:00
qctecmdr
8db00d553d Merge "serial: msm-geni-serial: Remove usage of wakeup_source_init API" 2019-10-31 12:58:22 -07:00
qctecmdr
d63fbd0841 Merge "drivers: pinctrl: msm: Add fwnode when setting up hireachy" 2019-10-31 12:15:33 -07:00
Vivek Aknurwar
ee3bb8c044 clk: dt-bindings: gcc: Add USB PIPE clocks
Update header file for usb pipe clock constants.

Change-Id: I459339210549e3f42c6ac0e578f6e9ffb5c5d1df
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2019-10-30 16:38:23 -07:00
Vivek Aknurwar
009694fac6 clk: qcom: clk-alpha-pll: Remove zonda pll set rate delay
Remove zonda pll set rate delay as it deemed unnecessary.

Change-Id: I0f2e564a7b979c0a11b751ca2eaf952a8b11591d
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2019-10-30 16:34:38 -07:00
Vivek Aknurwar
f1e212735a clk: qcom: clk-alpha-pll: Add support for controlling zonda5lpe PLL
Add programming sequence support for managing the zonda 5lpe
PLL.

Change-Id: I6eaef174c42ff148503d37bdbe9ebbabd7f65238
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2019-10-30 16:34:38 -07:00
Sumukh Hallymysore Ravindra
125cc7f8df arm64: defconfig: Enable global synx driver
Enable global synx driver for Lahaina.

Change-Id: I0564cdf69c9e5756bb18bfc78bfddb1ecc933145
Signed-off-by: Sumukh Hallymysore Ravindra <shallymy@codeaurora.org>
2019-10-30 08:51:20 -07:00
qctecmdr
3817fdb8ea Merge "ASoC: msm: qdsp6v2: Get path delay support in compress path" 2019-10-30 06:31:57 -07:00
qctecmdr
b57987c390 Merge "scsi: ufs: Fix compiler warning" 2019-10-30 05:43:08 -07:00
qctecmdr
8a43707391 Merge "arm64: defconfig: Enable shmbridge driver" 2019-10-30 04:30:54 -07:00
qctecmdr
69b59e60a9 Merge "shmbridge: GKI change for shmbridge" 2019-10-30 03:37:40 -07:00