高通运行linux,高通linux-rtc介绍

标签:

1. 概述

rtc(real time clock) 给linux系统提供时间,设备在断电的情况下,rtc芯片因为有电池的存在,可以继续工作。

驱动:

drivers/rtc/             驱动目录

drivers/rtc/class.c           注册了一个类RTC,然后向驱动程序提供了注册/注销接口

drivers/rtc/interface.c     主要提供了用户程序与RTC驱动的接口函数

drivers/rtc/rtc-dev.c       定义了基本的设备文件操作函数,比如:open,read,ioctl

drivers/rtc/rtc-sysfs.c     与sysfs有关

drivers/rtc/rtc-proc.c      与proc有关

drivers/rtc/rtc-lib.c        库文件, 系统默认启动的时间1970就在这里

drivers/rtc/qpnp-rtc.c     高通RTC驱动实现

drivers/rtc/rtc-xxx.c              通常以该命名方式, 其它芯片的RTC驱动

​​​​​​​

dbc764f69863d49b1da508d298860034.png

pm8916_rtc: qcom,pm8916_rtc {

spmi-dev-container;

compatible = "qcom,qpnp-rtc";

#address-cells = <1>;

#size-cells = <1>;

qcom,qpnp-rtc-write = <0>;

qcom,qpnp-rtc-alarm-pwrup = <0>;

qcom,pm8916_rtc_rw@6000 {

reg = <0x6000 0x100>;

};

qcom,pm8916_rtc_alarm@6100 {

reg = <0x6100 0x100>;

interrupts = <0x0 0x61 0x1>;

};

};

根据设备树内容的规则,这里可看出该平台rtc名称, 寄存器,中断等。

文件操作使用:

/*

* For these RTC methods the device parameter is the physical device

* on whatever bus holds the hardware (I2C, Platform, SPI, etc), which

* was passed to rtc_device_register().  Its driver_data normally holds

* device state, including the rtc_device pointer for the RTC.

*

* Most of these methods are called with rtc_device.ops_lock held,

* through the rtc_*(struct rtc_device *, ...) calls.

*

* The (current) exceptions are mostly

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值