|
发表于 2020-9-30 09:07:21
6703 浏览 0 回复
MT6885/MT6785/MT6883/MT6768 如何配置AUXADC检测Battery ID或检测其...
如何配置AUXADC检测Battery ID或检测其他sensor,如何读取AUXIN通道的值?
[SOLUTION]
1. PMIC 侧 AUXADC 参考如下:
bat = pmic_get_auxadc_value(AUXADC_LIST_ISENSE);
2. AP 侧 AUXADC 参考如下:
(1). 在 dtsi中配置 channel(示例是使用channel 0)
- &bat_gm30 {
- compatible = "mediatek,bat_gm30";
- + io-channels = <&auxadc 0>;
- + io-channel-names = "batteryID-channel";
- DIFFERENCE_FULLOCV_ITH = <(200)>;
复制代码 添加io-channels = <&auxadc 0>;
添加io-channel-names = "batteryID-channel";
(2). 从battery设备下,通过channel name 找到AUXADC channel
- channel = iio_channel_get(&(battery_dev->dev),"batteryID-channel");
复制代码
(3). 对此channel 进行转换
- ret = iio_read_channel_processed(channel,&auxadc_voltage);
复制代码
(4). 换算成电压值(mv),误差为10 mv
id_volt = auxadc_voltage * 1500 / 4096;
|
|
手机微信同号:13682654092
|
|
|
|
|
登录或注册
|