diff options
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/cacheinfo.c | 6 | ||||
| -rw-r--r-- | drivers/base/power/main.c | 3 | ||||
| -rw-r--r-- | drivers/base/power/runtime.c | 23 | ||||
| -rw-r--r-- | drivers/base/regmap/regmap-irq.c | 8 |
4 files changed, 25 insertions, 15 deletions
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index cf78fa6d470d..a7359535caf5 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c | |||
| @@ -79,8 +79,7 @@ static void cache_size(struct cacheinfo *this_leaf, struct device_node *np) | |||
| 79 | ct_idx = get_cacheinfo_idx(this_leaf->type); | 79 | ct_idx = get_cacheinfo_idx(this_leaf->type); |
| 80 | propname = cache_type_info[ct_idx].size_prop; | 80 | propname = cache_type_info[ct_idx].size_prop; |
| 81 | 81 | ||
| 82 | if (of_property_read_u32(np, propname, &this_leaf->size)) | 82 | of_property_read_u32(np, propname, &this_leaf->size); |
| 83 | this_leaf->size = 0; | ||
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | /* not cache_line_size() because that's a macro in include/linux/cache.h */ | 85 | /* not cache_line_size() because that's a macro in include/linux/cache.h */ |
| @@ -114,8 +113,7 @@ static void cache_nr_sets(struct cacheinfo *this_leaf, struct device_node *np) | |||
| 114 | ct_idx = get_cacheinfo_idx(this_leaf->type); | 113 | ct_idx = get_cacheinfo_idx(this_leaf->type); |
| 115 | propname = cache_type_info[ct_idx].nr_sets_prop; | 114 | propname = cache_type_info[ct_idx].nr_sets_prop; |
| 116 | 115 | ||
| 117 | if (of_property_read_u32(np, propname, &this_leaf->number_of_sets)) | 116 | of_property_read_u32(np, propname, &this_leaf->number_of_sets); |
| 118 | this_leaf->number_of_sets = 0; | ||
| 119 | } | 117 | } |
| 120 | 118 | ||
| 121 | static void cache_associativity(struct cacheinfo *this_leaf) | 119 | static void cache_associativity(struct cacheinfo *this_leaf) |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index a690fd400260..0992e67e862b 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <trace/events/power.h> | 32 | #include <trace/events/power.h> |
| 33 | #include <linux/cpufreq.h> | 33 | #include <linux/cpufreq.h> |
| 34 | #include <linux/cpuidle.h> | 34 | #include <linux/cpuidle.h> |
| 35 | #include <linux/devfreq.h> | ||
| 35 | #include <linux/timer.h> | 36 | #include <linux/timer.h> |
| 36 | 37 | ||
| 37 | #include "../base.h" | 38 | #include "../base.h" |
| @@ -1078,6 +1079,7 @@ void dpm_resume(pm_message_t state) | |||
| 1078 | dpm_show_time(starttime, state, 0, NULL); | 1079 | dpm_show_time(starttime, state, 0, NULL); |
| 1079 | 1080 | ||
| 1080 | cpufreq_resume(); | 1081 | cpufreq_resume(); |
| 1082 | devfreq_resume(); | ||
| 1081 | trace_suspend_resume(TPS("dpm_resume"), state.event, false); | 1083 | trace_suspend_resume(TPS("dpm_resume"), state.event, false); |
| 1082 | } | 1084 | } |
| 1083 | 1085 | ||
| @@ -1852,6 +1854,7 @@ int dpm_suspend(pm_message_t state) | |||
| 1852 | trace_suspend_resume(TPS("dpm_suspend"), state.event, true); | 1854 | trace_suspend_resume(TPS("dpm_suspend"), state.event, true); |
| 1853 | might_sleep(); | 1855 | might_sleep(); |
| 1854 | 1856 | ||
| 1857 | devfreq_suspend(); | ||
| 1855 | cpufreq_suspend(); | 1858 | cpufreq_suspend(); |
| 1856 | 1859 | ||
| 1857 | mutex_lock(&dpm_list_mtx); | 1860 | mutex_lock(&dpm_list_mtx); |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 70624695b6d5..ccd296dbb95c 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
| @@ -95,7 +95,7 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status) | |||
| 95 | static void pm_runtime_deactivate_timer(struct device *dev) | 95 | static void pm_runtime_deactivate_timer(struct device *dev) |
| 96 | { | 96 | { |
| 97 | if (dev->power.timer_expires > 0) { | 97 | if (dev->power.timer_expires > 0) { |
| 98 | hrtimer_cancel(&dev->power.suspend_timer); | 98 | hrtimer_try_to_cancel(&dev->power.suspend_timer); |
| 99 | dev->power.timer_expires = 0; | 99 | dev->power.timer_expires = 0; |
| 100 | } | 100 | } |
| 101 | } | 101 | } |
| @@ -121,7 +121,7 @@ static void pm_runtime_cancel_pending(struct device *dev) | |||
| 121 | * Compute the autosuspend-delay expiration time based on the device's | 121 | * Compute the autosuspend-delay expiration time based on the device's |
| 122 | * power.last_busy time. If the delay has already expired or is disabled | 122 | * power.last_busy time. If the delay has already expired or is disabled |
| 123 | * (negative) or the power.use_autosuspend flag isn't set, return 0. | 123 | * (negative) or the power.use_autosuspend flag isn't set, return 0. |
| 124 | * Otherwise return the expiration time in jiffies (adjusted to be nonzero). | 124 | * Otherwise return the expiration time in nanoseconds (adjusted to be nonzero). |
| 125 | * | 125 | * |
| 126 | * This function may be called either with or without dev->power.lock held. | 126 | * This function may be called either with or without dev->power.lock held. |
| 127 | * Either way it can be racy, since power.last_busy may be updated at any time. | 127 | * Either way it can be racy, since power.last_busy may be updated at any time. |
| @@ -130,7 +130,7 @@ u64 pm_runtime_autosuspend_expiration(struct device *dev) | |||
| 130 | { | 130 | { |
| 131 | int autosuspend_delay; | 131 | int autosuspend_delay; |
| 132 | u64 last_busy, expires = 0; | 132 | u64 last_busy, expires = 0; |
| 133 | u64 now = ktime_to_ns(ktime_get()); | 133 | u64 now = ktime_get_mono_fast_ns(); |
| 134 | 134 | ||
| 135 | if (!dev->power.use_autosuspend) | 135 | if (!dev->power.use_autosuspend) |
| 136 | goto out; | 136 | goto out; |
| @@ -141,7 +141,7 @@ u64 pm_runtime_autosuspend_expiration(struct device *dev) | |||
| 141 | 141 | ||
| 142 | last_busy = READ_ONCE(dev->power.last_busy); | 142 | last_busy = READ_ONCE(dev->power.last_busy); |
| 143 | 143 | ||
| 144 | expires = last_busy + autosuspend_delay * NSEC_PER_MSEC; | 144 | expires = last_busy + (u64)autosuspend_delay * NSEC_PER_MSEC; |
| 145 | if (expires <= now) | 145 | if (expires <= now) |
| 146 | expires = 0; /* Already expired. */ | 146 | expires = 0; /* Already expired. */ |
| 147 | 147 | ||
| @@ -525,7 +525,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
| 525 | * We add a slack of 25% to gather wakeups | 525 | * We add a slack of 25% to gather wakeups |
| 526 | * without sacrificing the granularity. | 526 | * without sacrificing the granularity. |
| 527 | */ | 527 | */ |
| 528 | u64 slack = READ_ONCE(dev->power.autosuspend_delay) * | 528 | u64 slack = (u64)READ_ONCE(dev->power.autosuspend_delay) * |
| 529 | (NSEC_PER_MSEC >> 2); | 529 | (NSEC_PER_MSEC >> 2); |
| 530 | 530 | ||
| 531 | dev->power.timer_expires = expires; | 531 | dev->power.timer_expires = expires; |
| @@ -905,8 +905,11 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) | |||
| 905 | spin_lock_irqsave(&dev->power.lock, flags); | 905 | spin_lock_irqsave(&dev->power.lock, flags); |
| 906 | 906 | ||
| 907 | expires = dev->power.timer_expires; | 907 | expires = dev->power.timer_expires; |
| 908 | /* If 'expire' is after 'jiffies' we've been called too early. */ | 908 | /* |
| 909 | if (expires > 0 && expires < ktime_to_ns(ktime_get())) { | 909 | * If 'expires' is after the current time, we've been called |
| 910 | * too early. | ||
| 911 | */ | ||
| 912 | if (expires > 0 && expires < ktime_get_mono_fast_ns()) { | ||
| 910 | dev->power.timer_expires = 0; | 913 | dev->power.timer_expires = 0; |
| 911 | rpm_suspend(dev, dev->power.timer_autosuspends ? | 914 | rpm_suspend(dev, dev->power.timer_autosuspends ? |
| 912 | (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); | 915 | (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); |
| @@ -925,7 +928,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) | |||
| 925 | int pm_schedule_suspend(struct device *dev, unsigned int delay) | 928 | int pm_schedule_suspend(struct device *dev, unsigned int delay) |
| 926 | { | 929 | { |
| 927 | unsigned long flags; | 930 | unsigned long flags; |
| 928 | ktime_t expires; | 931 | u64 expires; |
| 929 | int retval; | 932 | int retval; |
| 930 | 933 | ||
| 931 | spin_lock_irqsave(&dev->power.lock, flags); | 934 | spin_lock_irqsave(&dev->power.lock, flags); |
| @@ -942,8 +945,8 @@ int pm_schedule_suspend(struct device *dev, unsigned int delay) | |||
| 942 | /* Other scheduled or pending requests need to be canceled. */ | 945 | /* Other scheduled or pending requests need to be canceled. */ |
| 943 | pm_runtime_cancel_pending(dev); | 946 | pm_runtime_cancel_pending(dev); |
| 944 | 947 | ||
| 945 | expires = ktime_add(ktime_get(), ms_to_ktime(delay)); | 948 | expires = ktime_get_mono_fast_ns() + (u64)delay * NSEC_PER_MSEC; |
| 946 | dev->power.timer_expires = ktime_to_ns(expires); | 949 | dev->power.timer_expires = expires; |
| 947 | dev->power.timer_autosuspends = 0; | 950 | dev->power.timer_autosuspends = 0; |
| 948 | hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); | 951 | hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); |
| 949 | 952 | ||
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 1bd1145ad8b5..330c1f7e9665 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c | |||
| @@ -108,6 +108,9 @@ static void regmap_irq_sync_unlock(struct irq_data *data) | |||
| 108 | * suppress pointless writes. | 108 | * suppress pointless writes. |
| 109 | */ | 109 | */ |
| 110 | for (i = 0; i < d->chip->num_regs; i++) { | 110 | for (i = 0; i < d->chip->num_regs; i++) { |
| 111 | if (!d->chip->mask_base) | ||
| 112 | continue; | ||
| 113 | |||
| 111 | reg = d->chip->mask_base + | 114 | reg = d->chip->mask_base + |
| 112 | (i * map->reg_stride * d->irq_reg_stride); | 115 | (i * map->reg_stride * d->irq_reg_stride); |
| 113 | if (d->chip->mask_invert) { | 116 | if (d->chip->mask_invert) { |
| @@ -258,7 +261,7 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type) | |||
| 258 | const struct regmap_irq_type *t = &irq_data->type; | 261 | const struct regmap_irq_type *t = &irq_data->type; |
| 259 | 262 | ||
| 260 | if ((t->types_supported & type) != type) | 263 | if ((t->types_supported & type) != type) |
| 261 | return -ENOTSUPP; | 264 | return 0; |
| 262 | 265 | ||
| 263 | reg = t->type_reg_offset / map->reg_stride; | 266 | reg = t->type_reg_offset / map->reg_stride; |
| 264 | 267 | ||
| @@ -588,6 +591,9 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, | |||
| 588 | /* Mask all the interrupts by default */ | 591 | /* Mask all the interrupts by default */ |
| 589 | for (i = 0; i < chip->num_regs; i++) { | 592 | for (i = 0; i < chip->num_regs; i++) { |
| 590 | d->mask_buf[i] = d->mask_buf_def[i]; | 593 | d->mask_buf[i] = d->mask_buf_def[i]; |
| 594 | if (!chip->mask_base) | ||
| 595 | continue; | ||
| 596 | |||
| 591 | reg = chip->mask_base + | 597 | reg = chip->mask_base + |
| 592 | (i * map->reg_stride * d->irq_reg_stride); | 598 | (i * map->reg_stride * d->irq_reg_stride); |
| 593 | if (chip->mask_invert) | 599 | if (chip->mask_invert) |
