.. | .. |
---|
560 | 560 | int zero_batocv_to_cap; |
---|
561 | 561 | int zero_xsoc; |
---|
562 | 562 | unsigned long finish_base; |
---|
563 | | - time_t rtc_base; |
---|
| 563 | + time64_t rtc_base; |
---|
564 | 564 | int sm_remain_cap; |
---|
565 | 565 | int sm_linek; |
---|
566 | 566 | int sm_chrg_dsoc; |
---|
.. | .. |
---|
631 | 631 | |
---|
632 | 632 | static u64 get_boot_sec(void) |
---|
633 | 633 | { |
---|
634 | | - struct timespec ts; |
---|
| 634 | + struct timespec64 ts; |
---|
635 | 635 | |
---|
636 | | - get_monotonic_boottime(&ts); |
---|
| 636 | + ktime_get_boottime_ts64(&ts); |
---|
637 | 637 | |
---|
638 | 638 | return ts.tv_sec; |
---|
639 | 639 | } |
---|
.. | .. |
---|
710 | 710 | unsigned int val) |
---|
711 | 711 | { |
---|
712 | 712 | return regmap_field_write(battery->rmap_fields[field_id], val); |
---|
713 | | -} |
---|
714 | | - |
---|
715 | | -static bool rk817_is_bat_exist(struct rk817_battery_device *battery) |
---|
716 | | -{ |
---|
717 | | - if (battery->chip_id == RK817_ID) |
---|
718 | | - return rk817_bat_field_read(battery, BAT_EXS) ? true : false; |
---|
719 | | - |
---|
720 | | - return true; |
---|
721 | 713 | } |
---|
722 | 714 | |
---|
723 | 715 | /*cal_offset: current offset value*/ |
---|
.. | .. |
---|
1186 | 1178 | buf = (cap >> 0) & 0xff; |
---|
1187 | 1179 | rk817_bat_field_write(battery, Q_INIT_L0, buf); |
---|
1188 | 1180 | |
---|
1189 | | - battery->rsoc = capacity * 1000 * 100 / battery->fcc; |
---|
| 1181 | + battery->rsoc = capacity * 1000 * 100 / DIV(battery->fcc); |
---|
1190 | 1182 | battery->remain_cap = capacity * 1000; |
---|
1191 | 1183 | DBG("new remaincap: %d\n", battery->remain_cap); |
---|
1192 | 1184 | fuel_gauge_q_init_info(battery); |
---|
.. | .. |
---|
1874 | 1866 | ret = of_property_read_u32(np, "virtual_power", &pdata->bat_mode); |
---|
1875 | 1867 | if (ret < 0) |
---|
1876 | 1868 | dev_err(dev, "virtual_power missing!\n"); |
---|
1877 | | - if (!rk817_is_bat_exist(battery)) |
---|
1878 | | - battery->pdata->bat_mode = MODE_VIRTUAL; |
---|
1879 | 1869 | |
---|
1880 | 1870 | ret = of_property_read_u32(np, "bat_res", &pdata->bat_res); |
---|
1881 | 1871 | if (ret < 0) |
---|
.. | .. |
---|
3089 | 3079 | { |
---|
3090 | 3080 | } |
---|
3091 | 3081 | |
---|
3092 | | -static time_t rk817_get_rtc_sec(void) |
---|
| 3082 | +static time64_t rk817_get_rtc_sec(void) |
---|
3093 | 3083 | { |
---|
3094 | 3084 | int err; |
---|
3095 | 3085 | struct rtc_time tm; |
---|
3096 | | - struct timespec tv = { .tv_nsec = NSEC_PER_SEC >> 1, }; |
---|
3097 | 3086 | struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); |
---|
3098 | | - time_t sec; |
---|
3099 | 3087 | |
---|
3100 | 3088 | err = rtc_read_time(rtc, &tm); |
---|
3101 | 3089 | if (err) { |
---|
.. | .. |
---|
3109 | 3097 | return 0; |
---|
3110 | 3098 | } |
---|
3111 | 3099 | |
---|
3112 | | - rtc_tm_to_time(&tm, &tv.tv_sec); |
---|
3113 | | - sec = tv.tv_sec; |
---|
3114 | | - |
---|
3115 | | - return sec; |
---|
| 3100 | + return rtc_tm_to_time64(&tm); |
---|
3116 | 3101 | } |
---|
3117 | 3102 | |
---|
3118 | 3103 | #ifdef CONFIG_PM_SLEEP |
---|