RK3288|RK3288 Android7.1 RTC-pcf8563调试 待机唤醒

(1) 先把kernel 目录下.config pcf8563打开,且rk808关闭
RK3288|RK3288 Android7.1 RTC-pcf8563调试 待机唤醒
文章图片

(2) dts 配置,在根节点添加rtc_pcf8563节点。 之后再在硬件接口i2c
上添加pcf8563子节点。
RK3288|RK3288 Android7.1 RTC-pcf8563调试 待机唤醒
文章图片

RK3288|RK3288 Android7.1 RTC-pcf8563调试 待机唤醒
文章图片

(3) 在rtc-lib.c 文件中按图片修改:
RK3288|RK3288 Android7.1 RTC-pcf8563调试 待机唤醒
文章图片

之后在rtc-pcf8563.c 增加待机写闹钟函数
static int pcf8563_rtc_setalarm_pwron(struct device *dev, struct rtc_time *tm)
{

struct i2c_client *client = to_i2c_client(dev); unsigned char buf[4]; int err; printk("enter pcf8563 rtc setalarm pwron function\r\n"); /* The alarm has no seconds, round up to nearest minute */ if (tm->tm_sec) { time64_t alarm_time = rtc_tm_to_time64(tm); alarm_time += 60 - tm->tm_sec; rtc_time64_to_tm(alarm_time, tm); }dev_info(dev, "%s, min=%d hour=%d wday=%d mday=%d " , __func__, tm->tm_min, tm->tm_hour, tm->tm_wday, tm->tm_mday); //tm->tm_wday=tm->tm_wday+4; // for app set to kernel 2020-05-07buf[0] = bin2bcd(tm->tm_min); buf[1] = bin2bcd(tm->tm_hour); buf[2] = bin2bcd(tm->tm_mday); buf[3] = (tm->tm_wday & 0x07); dev_info(dev, "%s, after min=%d hour=%d mday=%d wday=%d " , __func__, buf[0], buf[1], buf[2], buf[3]); //err = pcf8563_write_block_data(client, PCF8563_REG_AMN, 4, buf); err = pcf8563_write_block_data(client, PCF8563_REG_AMN, 3, buf); if (err) return err; printk("%s err=%d",__func__,err); return pcf8563_set_alarm_mode(client, 1);

}
将上面pcf8563_rtc_setalarm_pwron函数
RK3288|RK3288 Android7.1 RTC-pcf8563调试 待机唤醒
文章图片

【RK3288|RK3288 Android7.1 RTC-pcf8563调试 待机唤醒】本人创建QQ群,进QQ技术交流,QQ群:712288614

    推荐阅读