aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-04-18 08:07:24 -0400
committerSebastian Reichel <sebastian.reichel@collabora.co.uk>2018-04-25 18:49:52 -0400
commita78c0c30ec73e90d1b5d8b06f593091d9b9f76d3 (patch)
tree2aeef5350bd810a0ad803ed03224fc6702fe3508
parent04d6f72f68eac61abbdaf56dcbfcc8382542f07e (diff)
power: supply: axp288_fuel_gauge: Remove polling from the driver
Userspace class/power_supply consumers such as upower, already know some supplies need to be polled to get up2date info. Doing this in the kernel and then waking up userspace just causes unnecessary wakeups and i2c transfers. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-rw-r--r--drivers/power/supply/axp288_fuel_gauge.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
index dabcf0c6ea95..084c8ba9749d 100644
--- a/drivers/power/supply/axp288_fuel_gauge.c
+++ b/drivers/power/supply/axp288_fuel_gauge.c
@@ -24,7 +24,6 @@
24#include <linux/regmap.h> 24#include <linux/regmap.h>
25#include <linux/jiffies.h> 25#include <linux/jiffies.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/workqueue.h>
28#include <linux/mfd/axp20x.h> 27#include <linux/mfd/axp20x.h>
29#include <linux/platform_device.h> 28#include <linux/platform_device.h>
30#include <linux/power_supply.h> 29#include <linux/power_supply.h>
@@ -88,7 +87,6 @@
88#define FG_LOW_CAP_CRIT_THR 4 /* 4 perc */ 87#define FG_LOW_CAP_CRIT_THR 4 /* 4 perc */
89#define FG_LOW_CAP_SHDN_THR 0 /* 0 perc */ 88#define FG_LOW_CAP_SHDN_THR 0 /* 0 perc */
90 89
91#define STATUS_MON_DELAY_JIFFIES (HZ * 60) /*60 sec */
92#define NR_RETRY_CNT 3 90#define NR_RETRY_CNT 3
93#define DEV_NAME "axp288_fuel_gauge" 91#define DEV_NAME "axp288_fuel_gauge"
94 92
@@ -128,7 +126,6 @@ struct axp288_fg_info {
128 struct mutex lock; 126 struct mutex lock;
129 int status; 127 int status;
130 int max_volt; 128 int max_volt;
131 struct delayed_work status_monitor;
132 struct dentry *debug_file; 129 struct dentry *debug_file;
133}; 130};
134 131
@@ -592,16 +589,6 @@ static int fuel_gauge_property_is_writeable(struct power_supply *psy,
592 return ret; 589 return ret;
593} 590}
594 591
595static void fuel_gauge_status_monitor(struct work_struct *work)
596{
597 struct axp288_fg_info *info = container_of(work,
598 struct axp288_fg_info, status_monitor.work);
599
600 fuel_gauge_get_status(info);
601 power_supply_changed(info->bat);
602 schedule_delayed_work(&info->status_monitor, STATUS_MON_DELAY_JIFFIES);
603}
604
605static irqreturn_t fuel_gauge_thread_handler(int irq, void *dev) 592static irqreturn_t fuel_gauge_thread_handler(int irq, void *dev)
606{ 593{
607 struct axp288_fg_info *info = dev; 594 struct axp288_fg_info *info = dev;
@@ -781,7 +768,6 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
781 platform_set_drvdata(pdev, info); 768 platform_set_drvdata(pdev, info);
782 769
783 mutex_init(&info->lock); 770 mutex_init(&info->lock);
784 INIT_DELAYED_WORK(&info->status_monitor, fuel_gauge_status_monitor);
785 771
786 for (i = 0; i < IIO_CHANNEL_NUM; i++) { 772 for (i = 0; i < IIO_CHANNEL_NUM; i++) {
787 /* 773 /*
@@ -841,7 +827,6 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
841 827
842 fuel_gauge_create_debugfs(info); 828 fuel_gauge_create_debugfs(info);
843 fuel_gauge_init_irq(info); 829 fuel_gauge_init_irq(info);
844 schedule_delayed_work(&info->status_monitor, STATUS_MON_DELAY_JIFFIES);
845 830
846 return 0; 831 return 0;
847 832
@@ -864,7 +849,6 @@ static int axp288_fuel_gauge_remove(struct platform_device *pdev)
864 struct axp288_fg_info *info = platform_get_drvdata(pdev); 849 struct axp288_fg_info *info = platform_get_drvdata(pdev);
865 int i; 850 int i;
866 851
867 cancel_delayed_work_sync(&info->status_monitor);
868 power_supply_unregister(info->bat); 852 power_supply_unregister(info->bat);
869 fuel_gauge_remove_debugfs(info); 853 fuel_gauge_remove_debugfs(info);
870 854