From: Stephan Gerhold <stephan@gerhold.net>
To: Sebastian Reichel <sre@kernel.org>, Lee Jones <lee.jones@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Beomho Seo <beomho.seo@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
~postmarketos/upstreaming@lists.sr.ht,
Stephan Gerhold <stephan@gerhold.net>
Subject: [PATCH v2 2/3] power: supply: rt5033_battery: Fix device tree enumeration
Date: Mon, 17 May 2021 12:51:12 +0200 [thread overview]
Message-ID: <20210517105113.240379-3-stephan@gerhold.net> (raw)
In-Reply-To: <20210517105113.240379-1-stephan@gerhold.net>
The fuel gauge in the RT5033 PMIC has its own I2C bus and interrupt
line. Therefore, it is not actually part of the RT5033 MFD and needs
its own of_match_table to probe properly.
Also, given that it's independent of the MFD, there is actually
no need to make the Kconfig depend on MFD_RT5033. Although the driver
uses the shared <linux/mfd/rt5033.h> header, there is no compile
or runtime dependency on the RT5033 MFD driver.
Cc: Beomho Seo <beomho.seo@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Fixes: b847dd96e659 ("power: rt5033_battery: Add RT5033 Fuel gauge device driver")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
Changes in v2: Fix stupid typo :(
---
drivers/power/supply/Kconfig | 3 ++-
drivers/power/supply/rt5033_battery.c | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index e696364126f1..20a2f93252f9 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -712,7 +712,8 @@ config BATTERY_GOLDFISH
config BATTERY_RT5033
tristate "RT5033 fuel gauge support"
- depends on MFD_RT5033
+ depends on I2C
+ select REGMAP_I2C
help
This adds support for battery fuel gauge in Richtek RT5033 PMIC.
The fuelgauge calculates and determines the battery state of charge
diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c
index f330452341f0..9ad0afe83d1b 100644
--- a/drivers/power/supply/rt5033_battery.c
+++ b/drivers/power/supply/rt5033_battery.c
@@ -164,9 +164,16 @@ static const struct i2c_device_id rt5033_battery_id[] = {
};
MODULE_DEVICE_TABLE(i2c, rt5033_battery_id);
+static const struct of_device_id rt5033_battery_of_match[] = {
+ { .compatible = "richtek,rt5033-battery", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, rt5033_battery_of_match);
+
static struct i2c_driver rt5033_battery_driver = {
.driver = {
.name = "rt5033-battery",
+ .of_match_table = rt5033_battery_of_match,
},
.probe = rt5033_battery_probe,
.remove = rt5033_battery_remove,
--
2.31.1
next prev parent reply other threads:[~2021-05-17 10:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 10:51 [PATCH v2 0/3] Fix RT5033 battery device tree probing Stephan Gerhold
2021-05-17 10:51 ` [PATCH v2 1/3] dt-bindings: power: supply: Add DT schema for richtek,rt5033-battery Stephan Gerhold
2021-05-19 18:57 ` Rob Herring
2021-05-17 10:51 ` Stephan Gerhold [this message]
2021-05-17 10:51 ` [PATCH v2 3/3] mfd: rt5033: Drop rt5033-battery sub-device Stephan Gerhold
2021-05-19 14:46 ` Lee Jones
2021-06-14 16:47 ` Stephan Gerhold
2021-06-04 10:34 ` [PATCH v2 0/3] Fix RT5033 battery device tree probing Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210517105113.240379-3-stephan@gerhold.net \
--to=stephan@gerhold.net \
--cc=beomho.seo@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox