.. | .. |
---|
170 | 170 | struct wake_lock wake_lock; |
---|
171 | 171 | struct notifier_block fb_nb; |
---|
172 | 172 | struct timer_list caltimer; |
---|
173 | | - time_t rtc_base; |
---|
| 173 | + time64_t rtc_base; |
---|
174 | 174 | int bat_res; |
---|
175 | 175 | int chrg_status; |
---|
176 | 176 | bool is_initialized; |
---|
.. | .. |
---|
262 | 262 | |
---|
263 | 263 | static u64 get_boot_sec(void) |
---|
264 | 264 | { |
---|
265 | | - struct timespec ts; |
---|
| 265 | + struct timespec64 ts; |
---|
266 | 266 | |
---|
267 | | - get_monotonic_boottime(&ts); |
---|
| 267 | + ktime_get_boottime_ts64(&ts); |
---|
268 | 268 | |
---|
269 | 269 | return ts.tv_sec; |
---|
270 | 270 | } |
---|
.. | .. |
---|
286 | 286 | { |
---|
287 | 287 | u8 i; |
---|
288 | 288 | u16 d; |
---|
| 289 | + |
---|
| 290 | + if (size < 2) |
---|
| 291 | + return 0; |
---|
289 | 292 | |
---|
290 | 293 | for (i = 0; i < size; i++) { |
---|
291 | 294 | if (value < table[i]) |
---|
.. | .. |
---|
1206 | 1209 | struct rk818_battery *di; |
---|
1207 | 1210 | struct fb_event *evdata = data; |
---|
1208 | 1211 | |
---|
1209 | | - if (event != FB_EARLY_EVENT_BLANK && event != FB_EVENT_BLANK) |
---|
1210 | | - return NOTIFY_OK; |
---|
| 1212 | + if (event != FB_EVENT_BLANK) |
---|
| 1213 | + return NOTIFY_DONE; |
---|
1211 | 1214 | |
---|
1212 | 1215 | di = container_of(nb, struct rk818_battery, fb_nb); |
---|
1213 | 1216 | di->fb_blank = *(int *)evdata->data; |
---|
1214 | 1217 | |
---|
1215 | | - return 0; |
---|
| 1218 | + return NOTIFY_OK; |
---|
1216 | 1219 | } |
---|
1217 | 1220 | |
---|
1218 | 1221 | static int rk818_bat_register_fb_notify(struct rk818_battery *di) |
---|
.. | .. |
---|
1740 | 1743 | di->zero_linek = 1200; |
---|
1741 | 1744 | else |
---|
1742 | 1745 | di->zero_linek = 800; |
---|
1743 | | - DBG("ZERO-new: zero_linek adjust step6...\n"); |
---|
| 1746 | + DBG("ZERO-new: zero_linek adjust step6...\n"); |
---|
1744 | 1747 | } |
---|
1745 | 1748 | } else { |
---|
1746 | 1749 | /* xsoc < 0 */ |
---|
.. | .. |
---|
2101 | 2104 | FINISH_CHRG_CUR2 : FINISH_CHRG_CUR1; |
---|
2102 | 2105 | finish_sec = base2sec(di->finish_base); |
---|
2103 | 2106 | soc_sec = di->fcc * 3600 / 100 / DIV(finish_current); |
---|
| 2107 | + if (soc_sec == 0) |
---|
| 2108 | + soc_sec = 1; |
---|
2104 | 2109 | plus_soc = finish_sec / DIV(soc_sec); |
---|
2105 | 2110 | if (finish_sec > soc_sec) { |
---|
2106 | 2111 | rest = finish_sec % soc_sec; |
---|
.. | .. |
---|
3127 | 3132 | SAMPLE_RES_DIV1 : SAMPLE_RES_DIV2; |
---|
3128 | 3133 | } |
---|
3129 | 3134 | |
---|
3130 | | -static time_t rk818_get_rtc_sec(void) |
---|
| 3135 | +static time64_t rk818_get_rtc_sec(void) |
---|
3131 | 3136 | { |
---|
3132 | 3137 | int err; |
---|
3133 | 3138 | struct rtc_time tm; |
---|
3134 | | - struct timespec tv = { .tv_nsec = NSEC_PER_SEC >> 1, }; |
---|
3135 | 3139 | struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); |
---|
3136 | | - time_t sec; |
---|
3137 | 3140 | |
---|
3138 | 3141 | err = rtc_read_time(rtc, &tm); |
---|
3139 | 3142 | if (err) { |
---|
.. | .. |
---|
3147 | 3150 | return 0; |
---|
3148 | 3151 | } |
---|
3149 | 3152 | |
---|
3150 | | - rtc_tm_to_time(&tm, &tv.tv_sec); |
---|
3151 | | - sec = tv.tv_sec; |
---|
3152 | | - |
---|
3153 | | - return sec; |
---|
| 3153 | + return rtc_tm_to_time64(&tm); |
---|
3154 | 3154 | } |
---|
3155 | 3155 | |
---|
3156 | 3156 | static int rk818_bat_rtc_sleep_sec(struct rk818_battery *di) |
---|
.. | .. |
---|
3245 | 3245 | } |
---|
3246 | 3246 | |
---|
3247 | 3247 | pdata->ocv_size = length / sizeof(u32); |
---|
3248 | | - if (pdata->ocv_size <= 0) { |
---|
| 3248 | + if (pdata->ocv_size < 2) { |
---|
3249 | 3249 | dev_err(dev, "invalid ocv table\n"); |
---|
3250 | 3250 | return -EINVAL; |
---|
3251 | 3251 | } |
---|