History log of /linux-master/drivers/mfd/qcom-spmi-pmic.c
Revision Date Author Comments
# 4773d2f1 20-Nov-2023 Dang Huynh <danct12@riseup.net>

mfd: qcom-spmi-pmic: Add support for PM8937

Add the subtype and compatible strings for PM8937.

The PM8937 is found in various SoCs, including MSM8917, MSM8937,
MSM8940 and APQ variants.

Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Signed-off-by: Dang Huynh <danct12@riseup.net>
Link: https://lore.kernel.org/r/20231121-pm8937-v2-1-b0171ab62075@riseup.net
Signed-off-by: Lee Jones <lee@kernel.org>


# 272f99ed 03-Oct-2023 Johan Hovold <johan+linaro@kernel.org>

spmi: rename spmi device lookup helper

Rename the SPMI device helper which is used to lookup a device from its
OF node as spmi_find_device_by_of_node() so that it reflects the
implementation and matches how other helpers like this are named.

This will specifically make it more clear that this is a lookup function
which returns a reference counted structure.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20231003152927.15000-6-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>


# 830fafce 17-Oct-2023 Rob Herring <robh@kernel.org>

mfd: Use device_get_match_data() in a bunch of drivers

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231017203612.2701060-1-robh@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>


# 10450565 03-Oct-2023 Johan Hovold <johan+linaro@kernel.org>

mfd: qcom-spmi-pmic: Switch to EXPORT_SYMBOL_GPL()

Switch to using EXPORT_SYMBOL_GPL() for the revid helper as there is no
reason not to use it.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Acked-by: Caleb Connolly <caleb.connolly@linaro.org>
Link: https://lore.kernel.org/r/20231003152927.15000-4-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>


# 7b439aaa 03-Oct-2023 Johan Hovold <johan+linaro@kernel.org>

mfd: qcom-spmi-pmic: Fix revid implementation

The Qualcomm SPMI PMIC revid implementation is broken in multiple ways.

First, it assumes that just because the sibling base device has been
registered that means that it is also bound to a driver, which may not
be the case (e.g. due to probe deferral or asynchronous probe). This
could trigger a NULL-pointer dereference when attempting to access the
driver data of the unbound device.

Second, it accesses driver data of a sibling device directly and without
any locking, which means that the driver data may be freed while it is
being accessed (e.g. on driver unbind).

Third, it leaks a struct device reference to the sibling device which is
looked up using the spmi_device_from_of() every time a function (child)
device is calling the revid function (e.g. on probe).

Fix this mess by reimplementing the revid lookup so that it is done only
at probe of the PMIC device; the base device fetches the revid info from
the hardware, while any secondary SPMI device fetches the information
from the base device and caches it so that it can be accessed safely
from its children. If the base device has not been probed yet then probe
of a secondary device is deferred.

Fixes: e9c11c6e3a0e ("mfd: qcom-spmi-pmic: expose the PMIC revid information to clients")
Cc: stable@vger.kernel.org # 6.0
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Acked-by: Caleb Connolly <caleb.connolly@linaro.org>
Link: https://lore.kernel.org/r/20231003152927.15000-3-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>


# a0fa44c2 03-Oct-2023 Johan Hovold <johan+linaro@kernel.org>

mfd: qcom-spmi-pmic: Fix reference leaks in revid helper

The Qualcomm SPMI PMIC revid implementation is broken in multiple ways.

First, it totally ignores struct device_node reference counting and
leaks references to the parent bus node as well as each child it
iterates over using an open-coded for_each_child_of_node().

Second, it leaks references to each spmi device on the bus that it
iterates over by failing to drop the reference taken by the
spmi_device_from_of() helper.

Fix the struct device_node leaks by reimplementing the lookup using
for_each_child_of_node() and adding the missing reference count
decrements. Fix the sibling struct device leaks by dropping the
unnecessary lookups of devices with the wrong USID.

Note that this still leaves one struct device reference leak in case a
base device is found but it is not the parent of the device used for the
lookup. This will be addressed in a follow-on patch.

Fixes: e9c11c6e3a0e ("mfd: qcom-spmi-pmic: expose the PMIC revid information to clients")
Cc: stable@vger.kernel.org # 6.0
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Acked-by: Caleb Connolly <caleb.connolly@linaro.org>
Link: https://lore.kernel.org/r/20231003152927.15000-2-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>


# 90d7c403 18-Aug-2022 Robert Marko <robimarko@gmail.com>

mfd: qcom-spmi-pmic: Add support for PMP8074

Add support for PMP8074 PMIC which is a companion PMIC for the Qualcomm
IPQ8074 SoC-s.

It shares the same subtype identifier as PM8901.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20220818221815.346233-2-robimarko@gmail.com


# d23c3c08 29-Apr-2022 Caleb Connolly <caleb.connolly@linaro.org>

mfd: qcom-spmi-pmic: read fab id on supported PMICs

The PMI8998 and PM660 expose the fab_id, this is needed by drivers like
the RRADC to calibrate ADC values.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220429220904.137297-4-caleb.connolly@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# e9c11c6e 29-Apr-2022 Caleb Connolly <caleb.connolly@linaro.org>

mfd: qcom-spmi-pmic: expose the PMIC revid information to clients

Some PMIC functions such as the RRADC need to be aware of the PMIC
chip revision information to implement errata or otherwise adjust
behaviour, export the PMIC information to enable this.

This is specifically required to enable the RRADC to adjust
coefficients based on which chip fab the PMIC was produced in,
this can vary per unique device and therefore has to be read at
runtime.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220429220904.137297-3-caleb.connolly@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# e7488f3e 17-Oct-2021 Bjorn Andersson <bjorn.andersson@linaro.org>

mfd: qcom-spmi-pmic: Add missing PMICs supported by socinfo

The Qualcomm socinfo driver has eight more PMICs described, add these to
the SPMI PMIC driver as well.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211017161218.2378176-4-bjorn.andersson@linaro.org


# 0e2a35ac 17-Oct-2021 Bjorn Andersson <bjorn.andersson@linaro.org>

mfd: qcom-spmi-pmic: Sort compatibles in the driver

Sort the compatibles in the driver, to make it easier to validate that
the DT binding and driver are in sync.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211017161218.2378176-2-bjorn.andersson@linaro.org


# a4b9be29 26-Sep-2020 AngeloGioacchino Del Regno <kholk11@gmail.com>

mfd: qcom-spmi-pmic: Add support for PM660/PM660L

Add the subtype and compatible strings for PM660 and PM660L,
found in various SoCs, including SDM630, SDM636, SDM660 and
SDA variants.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# f5b4c8b4 21-Sep-2019 Angelo G. Del Regno <kholk11@gmail.com>

mfd: qcom-spmi-pmic: Add support for PM/PMI8950

Add the subtype and compatible strings for PM8950 and PMI8950,
found in various SoCs, including MSM8953, MSM8956, MSM8976 and
APQ variants.

Signed-off-by: Angelo G. Del Regno <kholk11@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 97fb5e8d 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 and
only version 2 as published by the free software foundation this
program is distributed in the hope that it will be useful but
without any warranty without even the implied warranty of
merchantability or fitness for a particular purpose see the gnu
general public license for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 294 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.825281744@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c04da893 02-May-2018 Stephen Boyd <swboyd@chromium.org>

mfd: qcom-spmi-pmic: Add support for pm8005, pm8998 and pmi8998

Add the compatibles and PMIC ids for the pm8005, pm8998, and pmi8998
PMICS found on MSM8998 and SDM845 based platforms.

Cc: <devicetree@vger.kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 6f00f8c8 29-May-2017 Benjamin Gaignard <benjamin.gaignard@linaro.org>

mfd: qcom-spmi-pmic: Use devm_of_platform_populate()

Usage of devm_of_platform_populate() simplify driver code
by allowing to delete pmic_spmi_remove().

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 742dcd11 17-Nov-2015 Ivan T. Ivanov <ivan.ivanov@linaro.org>

mfd: qcom-spmi-pmic: Don't access non-existing registers

Revision ID registers are available only on devices with
Slave IDs that are even, so don't make access to unavailable
registers.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
[sboyd@codeaurora.org: Consider all slave ids that are even]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# dc716bbf 16-Mar-2015 Ivan T. Ivanov <iivanov@mm-sol.com>

mfd: qcom-spmi-pmic: Add specific compatible strings for Qualcomm's SPMI PMIC's

Some of the PMIC's could have specific regmap configuration
tables in future, so add specific compatible strings for known
PMIC's. Also print runtime detected chip revision information.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# c3a973a7 01-Aug-2014 Josh Cartwright <joshc@codeaurora.org>

mfd: Add support for Qualcomm SPMI PMICs

The Qualcomm SPMI PMIC chips are components used with the
Snapdragon 800 series SoC family. This driver exists
largely as a glue mfd component, it exists to be an owner
of an SPMI regmap for children devices described in
device tree.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>