pmaports/device/archived/linux-alcatel-idol347-downstream/smb1360-dump-idol347.patch
Stefan Hansson fb7f99efe2
device: rename unmaintained to archived (MR 5046)
Unmaintained is a name which on multiple occasions have seen lead to
confusion with people having the impression that unmaintained is for all
unmaintained devices, which is not how we're really using it. Many
devices in testing do not actually have a maintainer, yet there has been
no push to move these out of there and into unmaintained.

I think this is a result of that unmaintained was introduced not to keep
unmaintained ports but rather a place to store ports that have a better
replacement but where the inferior one still holds some sort of value,
such as for debugging purposes. These ports also are not necessarily
entirely unmaintained and see more fixes than many ports in testing.

While one approach to solving this problem could be to simply moving all
unmaintained ports to unmaintained, I think this comes with some
problems: It would require an initial effort to figure out which ports
are indeed unmaintained and which just don't have a maintained noted in
the package, and given how many ports there are in testing this would be
a big endeavour. It would also require continuous work on moving ports
into unmaintained as the maintainers go silent if we are to keep testing
and unmaintained's state consistent with reality. Additionally, just
because a port doesn't have a maintainer on paper doens't mean that
there aren't people who aren't willing to fix it up if there are issues
that arise.

As such, I think the way to go is renaming unmaintained to better
reflect the original intent. Thanks to Luca Weiss for suggesting
"archive", and to Arnav Singh for suggesting that "archived" would match
the other category names better.
2024-05-15 17:07:51 +02:00

89 lines
2.6 KiB
Diff

diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index fbd12449dae..6575f0ea241 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -1,6 +1,7 @@
ccflags-$(CONFIG_POWER_SUPPLY_DEBUG) := -DDEBUG
power_supply-y := power_supply_core.o
+power_supply-y += smb1360-dump.o
power_supply-$(CONFIG_SYSFS) += power_supply_sysfs.o
power_supply-$(CONFIG_LEDS_TRIGGERS) += power_supply_leds.o
diff --git a/drivers/power/idol347/smb1360-charger-fg.c b/drivers/power/idol347/smb1360-charger-fg.c
index bc8859cd9a2..1a087158d21 100644
--- a/drivers/power/idol347/smb1360-charger-fg.c
+++ b/drivers/power/idol347/smb1360-charger-fg.c
@@ -3760,6 +3760,41 @@ static int smb1360_jeita_init(struct smb1360_chip *chip)
return rc;
}
+extern void smb1360_dump(struct i2c_client *client);
+extern void smb1360_dump_fg_scratch(struct i2c_client *fg_client);
+extern void smb1360_dump_fg(struct i2c_client *client);
+
+static void smb1360_dump_locked(struct smb1360_chip *chip)
+{
+ mutex_lock(&chip->read_write_lock);
+ smb1360_dump(chip->client);
+ mutex_unlock(&chip->read_write_lock);
+}
+
+static void smb1360_dump_fg_access(struct smb1360_chip *chip)
+{
+ int ret;
+
+ ret = smb1360_enable_fg_access(chip);
+ if (ret)
+ return;
+
+ mutex_lock(&chip->read_write_lock);
+ smb1360_dump_fg_scratch(chip->client);
+
+ /* Do cool hacks to access FG I2C address instead */
+ chip->fg_access_type = FG_ACCESS_CFG;
+ smb1360_select_fg_i2c_address(chip);
+
+ chip->client->addr = chip->fg_i2c_addr;
+ smb1360_dump_fg(chip->client);
+ chip->client->addr = chip->default_i2c_addr;
+ mutex_unlock(&chip->read_write_lock);
+
+ smb1360_disable_fg_access(chip);
+ smb1360_check_cycle_stretch(chip);
+}
+
#define FG_POWERON_DELAY_MS 2000
static int smb1360_hw_init(struct smb1360_chip *chip)
{
@@ -3767,6 +3802,9 @@ static int smb1360_hw_init(struct smb1360_chip *chip)
int i;
u8 reg, mask;
+ /* Dump initial FG registers */
+ smb1360_dump_fg_access(chip);
+
smb1360_check_feature_support(chip);
rc = smb1360_enable_volatile_writes(chip);
@@ -4097,6 +4135,10 @@ static int smb1360_hw_init(struct smb1360_chip *chip)
dev_err(chip->dev, "Couldn't '%s' charging rc = %d\n",
chip->charging_disabled ? "disable" : "enable", rc);
+ /* Dump final registers */
+ smb1360_dump_locked(chip);
+ smb1360_dump_fg_access(chip);
+
return rc;
}
@@ -4540,6 +4582,9 @@ static int smb1360_probe(struct i2c_client *client,
mutex_init(&chip->current_change_lock);
chip->default_i2c_addr = client->addr;
+ /* Dump initial registers */
+ smb1360_dump_locked(chip);
+
pr_debug("default_i2c_addr=%x\n", chip->default_i2c_addr);
rc = smb1360_hw_init(chip);