From 5c6e81fff64bf5711d776351b1c31f3136c968b7 Mon Sep 17 00:00:00 2001 From: Ram Chandrasekar Date: Fri, 4 Sep 2015 15:30:05 -0600 Subject: [PATCH] msm: lmh_lite: Fix configurability for LMH software polling Update the lmh hardware driver to get the polling interval value from the lmh interface driver, instead of using a local static variable. LMH interface driver already exposes debug interface to configure the interval value. Change-Id: Ie7d91519f197930ca513b30a671d8f6917d636b0 Signed-off-by: Ram Chandrasekar --- drivers/thermal/lmh_interface.c | 7 +++++++ drivers/thermal/lmh_interface.h | 8 ++++++-- drivers/thermal/lmh_lite.c | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/lmh_interface.c b/drivers/thermal/lmh_interface.c index e7a873b6d426..23ca02813941 100644 --- a/drivers/thermal/lmh_interface.c +++ b/drivers/thermal/lmh_interface.c @@ -38,6 +38,7 @@ #define LMH_DBGFS_READ_TYPES "data_types" #define LMH_DBGFS_CONFIG_TYPES "config_types" #define LMH_TRACE_INTERVAL_XO_TICKS 250 +#define LMH_POLLING_MSEC 30 struct lmh_mon_threshold { long value; @@ -94,6 +95,7 @@ static struct lmh_mon_driver_data *lmh_mon_data; static struct class lmh_class_info = { .name = "msm_limits", }; +static int lmh_poll_interval = LMH_POLLING_MSEC; static DECLARE_RWSEM(lmh_mon_access_lock); static LIST_HEAD(lmh_sensor_list); static DECLARE_RWSEM(lmh_dev_access_lock); @@ -156,6 +158,11 @@ LMH_HW_LOG_FS(hw_log_interval); LMH_DEV_GET(max_level); LMH_DEV_GET(curr_level); +int lmh_get_poll_interval(void) +{ + return lmh_poll_interval; +} + static ssize_t curr_level_set(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { diff --git a/drivers/thermal/lmh_interface.h b/drivers/thermal/lmh_interface.h index bf844b563cc7..801eb1216211 100644 --- a/drivers/thermal/lmh_interface.h +++ b/drivers/thermal/lmh_interface.h @@ -15,7 +15,6 @@ #define __LMH_INTERFACE_H #define LMH_NAME_MAX 20 -#define LMH_POLLING_MSEC 30 #define LMH_READ_LINE_LENGTH 10 enum lmh_trip_type { @@ -51,7 +50,6 @@ struct lmh_debug_ops { int (*debug_get_types)(struct lmh_debug_ops *, bool, uint32_t **); }; -static int lmh_poll_interval = LMH_POLLING_MSEC; #ifdef CONFIG_LIMITS_MONITOR int lmh_get_all_dev_levels(char *, int *); int lmh_set_dev_level(char *, int); @@ -62,6 +60,7 @@ int lmh_device_register(char *, struct lmh_device_ops *); void lmh_device_deregister(struct lmh_device_ops *); int lmh_debug_register(struct lmh_debug_ops *); void lmh_debug_deregister(struct lmh_debug_ops *ops); +int lmh_get_poll_interval(void); #else static inline int lmh_get_all_dev_levels(char *device_name, int *level) { @@ -107,6 +106,11 @@ static inline int lmh_debug_register(struct lmh_debug_ops *) static inline void lmh_debug_deregister(struct lmh_debug_ops *ops) { } + +static inline int lmh_get_poll_interval(void) +{ + return -ENOSYS; +} #endif #endif /*__LMH_INTERFACE_H*/ diff --git a/drivers/thermal/lmh_lite.c b/drivers/thermal/lmh_lite.c index 0b2067a5dee1..e15c7b2f2b77 100644 --- a/drivers/thermal/lmh_lite.c +++ b/drivers/thermal/lmh_lite.c @@ -383,7 +383,7 @@ static void lmh_poll(struct work_struct *work) goto poll_exit; } else { queue_delayed_work(lmh_dat->poll_wq, &lmh_dat->poll_work, - msecs_to_jiffies(lmh_poll_interval)); + msecs_to_jiffies(lmh_get_poll_interval())); } poll_exit: @@ -455,7 +455,7 @@ static irqreturn_t lmh_isr_thread(int irq, void *data) decide_next_action: if (lmh_dat->intr_state == LMH_ISR_POLLING) queue_delayed_work(lmh_dat->poll_wq, &lmh_dat->poll_work, - msecs_to_jiffies(lmh_poll_interval)); + msecs_to_jiffies(lmh_get_poll_interval())); else enable_irq(lmh_dat->irq_num);