* [PATCH v2] mfd: sprd: populate sub-devices defined in DT
@ 2020-06-19 9:09 Chunyan Zhang
2020-06-22 9:52 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Chunyan Zhang @ 2020-06-19 9:09 UTC (permalink / raw)
To: Lee Jones
Cc: linux-kernel, Orson Zhai, Baolin Wang, Chunyan Zhang,
Chunyan Zhang, Xiaopeng Bai
From: Chunyan Zhang <chunyan.zhang@unisoc.com>
SC27XX-SPI added subdevices according to a pre-defined mfd_cell array,
no matter these devices were really included on board. In this patch,
switch to use devm_of_platform_populate() for adding sub-devices which
are defined in devicetree.
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
---
Changes since v1:
* Address comments from Lee Jones:
- Switch to use devm_of_platform_populate() to add sub-devices.
---
drivers/mfd/sprd-sc27xx-spi.c | 75 ++---------------------------------
1 file changed, 3 insertions(+), 72 deletions(-)
diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
index 33336cde4724..d030a5da5544 100644
--- a/drivers/mfd/sprd-sc27xx-spi.c
+++ b/drivers/mfd/sprd-sc27xx-spi.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/mfd/core.h>
#include <linux/of_device.h>
+#include <linux/of_platform.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
#include <uapi/linux/usb/charger.h>
@@ -93,73 +94,6 @@ enum usb_charger_type sprd_pmic_detect_charger_type(struct device *dev)
}
EXPORT_SYMBOL_GPL(sprd_pmic_detect_charger_type);
-static const struct mfd_cell sprd_pmic_devs[] = {
- {
- .name = "sc27xx-wdt",
- .of_compatible = "sprd,sc2731-wdt",
- }, {
- .name = "sc27xx-rtc",
- .of_compatible = "sprd,sc2731-rtc",
- }, {
- .name = "sc27xx-charger",
- .of_compatible = "sprd,sc2731-charger",
- }, {
- .name = "sc27xx-chg-timer",
- .of_compatible = "sprd,sc2731-chg-timer",
- }, {
- .name = "sc27xx-fast-chg",
- .of_compatible = "sprd,sc2731-fast-chg",
- }, {
- .name = "sc27xx-chg-wdt",
- .of_compatible = "sprd,sc2731-chg-wdt",
- }, {
- .name = "sc27xx-typec",
- .of_compatible = "sprd,sc2731-typec",
- }, {
- .name = "sc27xx-flash",
- .of_compatible = "sprd,sc2731-flash",
- }, {
- .name = "sc27xx-eic",
- .of_compatible = "sprd,sc2731-eic",
- }, {
- .name = "sc27xx-efuse",
- .of_compatible = "sprd,sc2731-efuse",
- }, {
- .name = "sc27xx-thermal",
- .of_compatible = "sprd,sc2731-thermal",
- }, {
- .name = "sc27xx-adc",
- .of_compatible = "sprd,sc2731-adc",
- }, {
- .name = "sc27xx-audio-codec",
- .of_compatible = "sprd,sc2731-audio-codec",
- }, {
- .name = "sc27xx-regulator",
- .of_compatible = "sprd,sc2731-regulator",
- }, {
- .name = "sc27xx-vibrator",
- .of_compatible = "sprd,sc2731-vibrator",
- }, {
- .name = "sc27xx-keypad-led",
- .of_compatible = "sprd,sc2731-keypad-led",
- }, {
- .name = "sc27xx-bltc",
- .of_compatible = "sprd,sc2731-bltc",
- }, {
- .name = "sc27xx-fgu",
- .of_compatible = "sprd,sc2731-fgu",
- }, {
- .name = "sc27xx-7sreset",
- .of_compatible = "sprd,sc2731-7sreset",
- }, {
- .name = "sc27xx-poweroff",
- .of_compatible = "sprd,sc2731-poweroff",
- }, {
- .name = "sc27xx-syscon",
- .of_compatible = "sprd,sc2731-syscon",
- },
-};
-
static int sprd_pmic_spi_write(void *context, const void *data, size_t count)
{
struct device *dev = context;
@@ -263,12 +197,9 @@ static int sprd_pmic_probe(struct spi_device *spi)
return ret;
}
- ret = devm_mfd_add_devices(&spi->dev, PLATFORM_DEVID_AUTO,
- sprd_pmic_devs, ARRAY_SIZE(sprd_pmic_devs),
- NULL, 0,
- regmap_irq_get_domain(ddata->irq_data));
+ ret = devm_of_platform_populate(&spi->dev);
if (ret) {
- dev_err(&spi->dev, "Failed to register device %d\n", ret);
+ dev_err(&spi->dev, "Failed to populate sub-devices %d\n", ret);
return ret;
}
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] mfd: sprd: populate sub-devices defined in DT
2020-06-19 9:09 [PATCH v2] mfd: sprd: populate sub-devices defined in DT Chunyan Zhang
@ 2020-06-22 9:52 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2020-06-22 9:52 UTC (permalink / raw)
To: Chunyan Zhang
Cc: linux-kernel, Orson Zhai, Baolin Wang, Chunyan Zhang, Xiaopeng Bai
On Fri, 19 Jun 2020, Chunyan Zhang wrote:
> From: Chunyan Zhang <chunyan.zhang@unisoc.com>
>
> SC27XX-SPI added subdevices according to a pre-defined mfd_cell array,
> no matter these devices were really included on board. In this patch,
> switch to use devm_of_platform_populate() for adding sub-devices which
> are defined in devicetree.
>
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> ---
> Changes since v1:
> * Address comments from Lee Jones:
> - Switch to use devm_of_platform_populate() to add sub-devices.
> ---
> drivers/mfd/sprd-sc27xx-spi.c | 75 ++---------------------------------
> 1 file changed, 3 insertions(+), 72 deletions(-)
Applied, thanks.
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-22 9:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19 9:09 [PATCH v2] mfd: sprd: populate sub-devices defined in DT Chunyan Zhang
2020-06-22 9:52 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®