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 <rkumbako@codeaurora.org>
This commit is contained in:
Ram Chandrasekar 2015-09-04 15:30:05 -06:00 committed by David Keitel
parent f5184f638f
commit 5c6e81fff6
3 changed files with 15 additions and 4 deletions

View file

@ -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)
{

View file

@ -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*/

View file

@ -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);