]> www.infradead.org Git - users/willy/linux.git/commitdiff
power: supply: ds2760: Remove unused ds2760_battery_set_charged
authorDr. David Alan Gilbert <linux@treblig.org>
Fri, 7 Mar 2025 23:02:24 +0000 (23:02 +0000)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Sat, 8 Mar 2025 00:06:41 +0000 (01:06 +0100)
With power_supply_set_battery_charged() deleted in the previous
patch, there's no one left to call the set_charged method.
The only implemented is in ds2760, unwire it and delete the
associated functions and data.

(Arguably it might be time to delete ds2760 since I don't
think there are any users left)

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250307230225.128775-3-linux@treblig.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/ds2760_battery.c

index 83bdec5a2bda901460e0a8618949baa7ecc11e46..a7f7d4c3f1ee1f6095ba5293cd1e019a07f66689 100644 (file)
@@ -112,7 +112,6 @@ struct ds2760_device_info {
        struct power_supply_desc bat_desc;
        struct workqueue_struct *monitor_wqueue;
        struct delayed_work monitor_work;
-       struct delayed_work set_charged_work;
        struct notifier_block pm_notifier;
 };
 
@@ -489,50 +488,6 @@ static void ds2760_battery_external_power_changed(struct power_supply *psy)
 }
 
 
-static void ds2760_battery_set_charged_work(struct work_struct *work)
-{
-       char bias;
-       struct ds2760_device_info *di = container_of(work,
-               struct ds2760_device_info, set_charged_work.work);
-
-       dev_dbg(di->dev, "%s\n", __func__);
-
-       ds2760_battery_read_status(di);
-
-       /* When we get notified by external circuitry that the battery is
-        * considered fully charged now, we know that there is no current
-        * flow any more. However, the ds2760's internal current meter is
-        * too inaccurate to rely on - spec say something ~15% failure.
-        * Hence, we use the current offset bias register to compensate
-        * that error.
-        */
-
-       if (!power_supply_am_i_supplied(di->bat))
-               return;
-
-       bias = (signed char) di->current_raw +
-               (signed char) di->raw[DS2760_CURRENT_OFFSET_BIAS];
-
-       dev_dbg(di->dev, "%s: bias = %d\n", __func__, bias);
-
-       w1_ds2760_write(di->dev, &bias, DS2760_CURRENT_OFFSET_BIAS, 1);
-       w1_ds2760_store_eeprom(di->dev, DS2760_EEPROM_BLOCK1);
-       w1_ds2760_recall_eeprom(di->dev, DS2760_EEPROM_BLOCK1);
-
-       /* Write to the di->raw[] buffer directly - the CURRENT_OFFSET_BIAS
-        * value won't be read back by ds2760_battery_read_status() */
-       di->raw[DS2760_CURRENT_OFFSET_BIAS] = bias;
-}
-
-static void ds2760_battery_set_charged(struct power_supply *psy)
-{
-       struct ds2760_device_info *di = power_supply_get_drvdata(psy);
-
-       /* postpone the actual work by 20 secs. This is for debouncing GPIO
-        * signals and to let the current value settle. See AN4188. */
-       mod_delayed_work(di->monitor_wqueue, &di->set_charged_work, HZ * 20);
-}
-
 static int ds2760_battery_get_property(struct power_supply *psy,
                                       enum power_supply_property psp,
                                       union power_supply_propval *val)
@@ -692,7 +647,6 @@ static int w1_ds2760_add_slave(struct w1_slave *sl)
        di->bat_desc.set_property       = ds2760_battery_set_property;
        di->bat_desc.property_is_writeable =
                                  ds2760_battery_property_is_writeable;
-       di->bat_desc.set_charged        = ds2760_battery_set_charged;
        di->bat_desc.external_power_changed =
                                  ds2760_battery_external_power_changed;
 
@@ -747,8 +701,6 @@ static int w1_ds2760_add_slave(struct w1_slave *sl)
        }
 
        INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work);
-       INIT_DELAYED_WORK(&di->set_charged_work,
-                         ds2760_battery_set_charged_work);
        di->monitor_wqueue = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
        if (!di->monitor_wqueue) {
                retval = -ESRCH;
@@ -774,7 +726,6 @@ static void w1_ds2760_remove_slave(struct w1_slave *sl)
 
        unregister_pm_notifier(&di->pm_notifier);
        cancel_delayed_work_sync(&di->monitor_work);
-       cancel_delayed_work_sync(&di->set_charged_work);
        destroy_workqueue(di->monitor_wqueue);
 }