<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/spmi, branch v6.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.0</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2022-06-18T12:48:19Z</updated>
<entry>
<title>spmi: add a helper to look up an SPMI device from a device node</title>
<updated>2022-06-18T12:48:19Z</updated>
<author>
<name>Caleb Connolly</name>
<email>caleb.connolly@linaro.org</email>
</author>
<published>2022-04-29T22:08:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9a2139c2912ea64e288749c21452930dc752d4fd'/>
<id>urn:sha1:9a2139c2912ea64e288749c21452930dc752d4fd</id>
<content type='text'>
The helper function spmi_device_from_of() takes a device node and
returns the SPMI device associated with it.
This is like of_find_device_by_node but for SPMI devices.

Signed-off-by: Caleb Connolly &lt;caleb.connolly@linaro.org&gt;
Acked-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20220429220904.137297-2-caleb.connolly@linaro.org
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>spmi: spmi-pmic-arb: fix irq_set_type race condition</title>
<updated>2021-12-17T16:18:18Z</updated>
<author>
<name>David Collins</name>
<email>quic_collinsd@quicinc.com</email>
</author>
<published>2021-12-16T19:08:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1b18af40c1db195619e611faaeae624d6319b1f1'/>
<id>urn:sha1:1b18af40c1db195619e611faaeae624d6319b1f1</id>
<content type='text'>
The qpnpint_irq_set_type() callback function configures the type
(edge vs level) and polarity (high, low, or both) of a particular
PMIC interrupt within a given peripheral.  To do this, it reads
the three consecutive IRQ configuration registers, modifies the
specified IRQ bit within the register values, and finally writes
the three modified register values back to the PMIC.  While a
spinlock is used to provide mutual exclusion on the SPMI bus
during the register read and write calls, there is no locking
around the overall read, modify, write sequence.  This opens up
the possibility of a race condition if two tasks set the type of
a PMIC IRQ within the same peripheral simultaneously.

When the race condition is encountered, both tasks will read the
old value of the registers and IRQ bits set by one of the tasks
will be dropped upon the register write of the other task.  This
then leads to PMIC IRQs being enabled with an incorrect type and
polarity configured.  Such misconfiguration can lead to an IRQ
storm that overwhelms the system and causes it to crash.

This race condition and IRQ storm have been observed when using
a pair of pm8941-pwrkey devices to handle PMK8350 pwrkey and
resin interrupts.  The independent devices probe asynchronously
in parallel and can simultaneously request and configure PMIC
IRQs in the same PMIC peripheral.

For a good case, the IRQ configuration calls end up serialized
due to timing deltas and the register read/write sequence looks
like this:

1. pwrkey probe: SPMI  read(0x1311): 0x00, 0x00, 0x00
2. pwrkey probe: SPMI write(0x1311): 0x80, 0x80, 0x80
3. resin probe:  SPMI  read(0x1311): 0x80, 0x80, 0x80
4. resin probe:  SPMI write(0x1311): 0xC0, 0xC0, 0xC0

The final register states after both devices have requested and
enabled their respective IRQs is thus:

0x1311: 0xC0
0x1312: 0xC0
0x1313: 0xC0
0x1314: 0x00
0x1315: 0xC0

For a bad case, the IRQ configuration calls end up occurring
simultaneously and the race condition is encountered.  The
register read/write sequence then looks like this:

1. pwrkey probe: SPMI  read(0x1311): 0x00, 0x00, 0x00
2. resin probe:  SPMI  read(0x1311): 0x00, 0x00, 0x00
3. pwrkey probe: SPMI write(0x1311): 0x80, 0x80, 0x80
4. resin probe:  SPMI write(0x1311): 0x40, 0x40, 0x40

In this case, the final register states after both devices have
requested and enabled their respective IRQs is thus:

0x1311: 0x40
0x1312: 0x40
0x1313: 0x40
0x1314: 0x00
0x1315: 0xC0

This corresponds to the resin IRQ being configured for both
rising and falling edges, as expected.  However, the pwrkey IRQ
is misconfigured as level type with both polarity high and low
set to disabled.  The PMIC IRQ triggering hardware treats this
particular register configuration as if level low triggering is
enabled.

The raw pwrkey IRQ signal is low when the power key is not being
pressed.  Thus, the pwrkey IRQ begins firing continuously in an
IRQ storm.

Fix the race condition by holding the spmi-pmic-arb spinlock for
the duration of the read, modify, write sequence performed in the
qpnpint_irq_set_type() function.  Split the pmic_arb_read_cmd()
and pmic_arb_write_cmd() functions each into three parts so that
hardware register IO is decoupled from spinlock locking.  This
allows a new function pmic_arb_masked_write() to be added which
locks the spinlock and then calls register IO functions to
perform SPMI read and write commands in a single atomic
operation.

Link: https://lore.kernel.org/r/20211118034719.28971-1-quic_collinsd@quicinc.com
Signed-off-by: David Collins &lt;quic_collinsd@quicinc.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20211216190812.1574801-7-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: mediatek: Add support for MT8195</title>
<updated>2021-12-17T16:18:18Z</updated>
<author>
<name>James Lo</name>
<email>james.lo@mediatek.com</email>
</author>
<published>2021-12-16T19:08:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=504eb71e4717ddfedd877d33fce684f3ab6d657c'/>
<id>urn:sha1:504eb71e4717ddfedd877d33fce684f3ab6d657c</id>
<content type='text'>
Add spmi support for MT8195.
Refine indent in spmi-mtk-pmif.c.

Link: https://lore.kernel.org/r/20211119034613.32489-5-james.lo@mediatek.com
Acked-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: James Lo &lt;james.lo@mediatek.com&gt;
Signed-off-by: Henry Chen &lt;henryc.chen@mediatek.com&gt;
Signed-off-by: Hsin-Hsiung Wang &lt;hsin-hsiung.wang@mediatek.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20211216190812.1574801-6-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: mediatek: Add support for MT6873/8192</title>
<updated>2021-12-17T16:18:18Z</updated>
<author>
<name>James Lo</name>
<email>james.lo@mediatek.com</email>
</author>
<published>2021-12-16T19:08:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b45b3ccef8c063d21eb746d85337eaf71f6b5f07'/>
<id>urn:sha1:b45b3ccef8c063d21eb746d85337eaf71f6b5f07</id>
<content type='text'>
Add spmi support for MT6873/8192.
Refine indent in spmi-mtk-pmif.c.

Link: https://lore.kernel.org/r/20211119034613.32489-4-james.lo@mediatek.com
Acked-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: James Lo &lt;james.lo@mediatek.com&gt;
Signed-off-by: Hsin-Hsiung Wang &lt;hsin-hsiung.wang@mediatek.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20211216190812.1574801-5-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: pmic-arb: Add sid and address to error messages</title>
<updated>2021-12-17T16:18:18Z</updated>
<author>
<name>Stephen Boyd</name>
<email>swboyd@chromium.org</email>
</author>
<published>2021-12-16T19:08:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b56ca501a4112b568102e6f910ed3d5e32dde52c'/>
<id>urn:sha1:b56ca501a4112b568102e6f910ed3d5e32dde52c</id>
<content type='text'>
It's useful to know what particular device/component is having trouble
accessing the bus. Add the sid and address to error messages here so
that debugging is a little simpler.

Link: https://lore.kernel.org/r/20210920234849.3614036-1-swboyd@chromium.org
Cc: Subbaraman Narayanamurthy &lt;subbaram@codeaurora.org&gt;
Cc: satya priya &lt;skakit@codeaurora.org&gt;
Reviewed-by: Subbaraman Narayanamurthy &lt;subbaram@codeaurora.org&gt;
Reviewed-by: Satya Priya &lt;skakit@codeaurora.org&gt;
Signed-off-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20211216190812.1574801-2-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bus: Make remove callback return void</title>
<updated>2021-07-21T09:53:42Z</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2021-07-13T19:35:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fc7a6209d5710618eb4f72a77cd81b8d694ecf89'/>
<id>urn:sha1:fc7a6209d5710618eb4f72a77cd81b8d694ecf89</id>
<content type='text'>
The driver core ignores the return value of this callback because there
is only little it can do when a device disappears.

This is the final bit of a long lasting cleanup quest where several
buses were converted to also return void from their remove callback.
Additionally some resource leaks were fixed that were caused by drivers
returning an error code in the expectation that the driver won't go
away.

With struct bus_type::remove returning void it's prevented that newly
implemented buses return an ignored error code and so don't anticipate
wrong expectations for driver authors.

Reviewed-by: Tom Rix &lt;trix@redhat.com&gt; (For fpga)
Reviewed-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
Reviewed-by: Cornelia Huck &lt;cohuck@redhat.com&gt; (For drivers/s390 and drivers/vfio)
Acked-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt; (For ARM, Amba and related parts)
Acked-by: Mark Brown &lt;broonie@kernel.org&gt;
Acked-by: Chen-Yu Tsai &lt;wens@csie.org&gt; (for sunxi-rsb)
Acked-by: Pali Rohár &lt;pali@kernel.org&gt;
Acked-by: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt; (for media)
Acked-by: Hans de Goede &lt;hdegoede@redhat.com&gt; (For drivers/platform)
Acked-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Acked-By: Vinod Koul &lt;vkoul@kernel.org&gt;
Acked-by: Juergen Gross &lt;jgross@suse.com&gt; (For xen)
Acked-by: Lee Jones &lt;lee.jones@linaro.org&gt; (For mfd)
Acked-by: Johannes Thumshirn &lt;jth@kernel.org&gt; (For mcb)
Acked-by: Johan Hovold &lt;johan@kernel.org&gt;
Acked-by: Srinivas Kandagatla &lt;srinivas.kandagatla@linaro.org&gt; (For slimbus)
Acked-by: Kirti Wankhede &lt;kwankhede@nvidia.com&gt; (For vfio)
Acked-by: Maximilian Luz &lt;luzmaximilian@gmail.com&gt;
Acked-by: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt; (For ulpi and typec)
Acked-by: Samuel Iglesias Gonsálvez &lt;siglesias@igalia.com&gt; (For ipack)
Acked-by: Geoff Levand &lt;geoff@infradead.org&gt; (For ps3)
Acked-by: Yehezkel Bernat &lt;YehezkelShB@gmail.com&gt; (For thunderbolt)
Acked-by: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt; (For intel_th)
Acked-by: Dominik Brodowski &lt;linux@dominikbrodowski.net&gt; (For pcmcia)
Acked-by: Rafael J. Wysocki &lt;rafael@kernel.org&gt; (For ACPI)
Acked-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt; (rpmsg and apr)
Acked-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt; (For intel-ish-hid)
Acked-by: Dan Williams &lt;dan.j.williams@intel.com&gt; (For CXL, DAX, and NVDIMM)
Acked-by: William Breathitt Gray &lt;vilhelm.gray@gmail.com&gt; (For isa)
Acked-by: Stefan Richter &lt;stefanr@s5r6.in-berlin.de&gt; (For firewire)
Acked-by: Benjamin Tissoires &lt;benjamin.tissoires@redhat.com&gt; (For hid)
Acked-by: Thorsten Scherer &lt;t.scherer@eckelmann.de&gt; (For siox)
Acked-by: Sven Van Asbroeck &lt;TheSven73@gmail.com&gt; (For anybuss)
Acked-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt; (For MMC)
Acked-by: Wolfram Sang &lt;wsa@kernel.org&gt; # for I2C
Acked-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
Acked-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Acked-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Acked-by: Finn Thain &lt;fthain@linux-m68k.org&gt;
Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20210713193522.1770306-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: hisi-spmi-controller: move driver from staging</title>
<updated>2021-06-25T08:02:05Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab+huawei@kernel.org</email>
</author>
<published>2021-06-25T07:45:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e562cf3aea3e1ea46566907f7627e5512840a2b4'/>
<id>urn:sha1:e562cf3aea3e1ea46566907f7627e5512840a2b4</id>
<content type='text'>
The Hisilicon 6421v600 SPMI driver is ready for mainstream.

So, move it from staging.

Acked-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
Link: https://lore.kernel.org/r/35b9f9169889c1f4d51eff8bf2035450c9e02576.1624606660.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: spmi-pmic-arb: Fix hw_irq overflow</title>
<updated>2021-02-12T11:26:46Z</updated>
<author>
<name>Subbaraman Narayanamurthy</name>
<email>subbaram@codeaurora.org</email>
</author>
<published>2021-02-12T03:14:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d19db80a366576d3ffadf2508ed876b4c1faf959'/>
<id>urn:sha1:d19db80a366576d3ffadf2508ed876b4c1faf959</id>
<content type='text'>
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.

Cc: stable@vger.kernel.org
Signed-off-by: Subbaraman Narayanamurthy &lt;subbaram@codeaurora.org&gt;
Link: https://lore.kernel.org/r/1612812784-26369-1-git-send-email-subbaram@codeaurora.org
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20210212031417.3148936-1-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: Add driver shutdown support</title>
<updated>2020-12-10T09:45:36Z</updated>
<author>
<name>Hsin-Hsiung Wang</name>
<email>hsin-hsiung.wang@mediatek.com</email>
</author>
<published>2020-12-10T02:33:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d40c2d4ed62df64ce603c208bceff25245380157'/>
<id>urn:sha1:d40c2d4ed62df64ce603c208bceff25245380157</id>
<content type='text'>
Add new shutdown() method.  Use it in the standard driver model style.

Link: https://lore.kernel.org/r/1603187810-30481-2-git-send-email-hsin-hsiung.wang@mediatek.com
Signed-off-by: Hsin-Hsiung Wang &lt;hsin-hsiung.wang@mediatek.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20201210023344.2838141-4-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: fix some coding style issues at the spmi core</title>
<updated>2020-12-10T09:45:36Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab+huawei@kernel.org</email>
</author>
<published>2020-12-10T02:33:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0be0a733c9cd396c3900ac10873419d8b21bfd39'/>
<id>urn:sha1:0be0a733c9cd396c3900ac10873419d8b21bfd39</id>
<content type='text'>
While preparing to port the HiSilicon 6421v600 SPMI driver,
I noticed some coding style issues at the SPMI core.

Address them.

Link: https://lore.kernel.org/r/fec878502147336cbf2cf86e476e9dd797cd7e6f.1601360391.git.mchehab+huawei@kernel.org
Reviewed-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20201210023344.2838141-3-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
