当前位置:网站首页>Transplant DAC chip mcp4725 to nuc980
Transplant DAC chip mcp4725 to nuc980
2022-07-07 01:21:00 【Ti-laser】
This article introduces migration DAC chip MCP4725 Methods .
Because the official linux-4.4.x Although there is one mcp4725.c The driver , But this drive is suitable for none dts Old application scenarios , And my system uses dts The tree needs to replace the driver , The specific method is :
From the website linux/mcp4725.c at master · torvalds/linux · GitHub
download mcp4725.c, The downloaded file can only be compiled and used normally after the following adjustments , As follows :
1 Add header file :#include <linux/of_device.h>
2 find IIO_ENUM_AVAILABLE And delete the second parameter , It takes the form of :
IIO_ENUM_AVAILABLE("powerdown_mode",
&mcp472x_powerdown_mode_enum[MCP4725]),
IIO_ENUM_AVAILABLE("powerdown_mode",
&mcp472x_powerdown_mode_enum[MCP4726]),
3 find device_get_match_data Change to of_device_get_match_data
if (dev_fwnode(&client->dev))
data->id = (uintptr_t)of_device_get_match_data(&client->dev);
else
......
4 Replace include/linux/iio/dac/mcp4725.h For the following :
....
struct mcp4725_platform_data {
bool use_vref;
bool vref_buffered;
};
....
5 Modify file :
drivers/base/property.c +108, allow dev_fwnode Called externally :
struct fwnode_handle *dev_fwnode(struct device *dev)
{
return IS_ENABLED(CONFIG_OF) && dev->of_node ?
&dev->of_node->fwnode : dev->fwnode;
}
EXPORT_SYMBOL_GPL(dev_fwnode);
6 adjustment include/linux/property.h, Declare the output function
struct fwnode_handle *dev_fwnode(struct device *dev);
7 because DAC The chip is attached to I2c1 On the bus , Documents need to be modified nuc980-iot.dtsi, Add blue part :
i2c1: [email protected] {
compatible = "nuvoton,nuc980-i2c1";
.........
#address-cells = <1>;
#size-cells = <0>;
compatible = "microchip,mcp4725";
reg = <0x61>;
};
After the compilation is normal, it will be written into the board and then enter /sys/devices/iio:deviceX You can see the node information , there X Please replace it according to the actual situation of your system .
Can write DA The value is then tested and verified with a multimeter .
echo 2000 > out_voltage0_raw
边栏推荐
- [JS] obtain the N days before and after the current time or the n months before and after the current time (hour, minute, second, year, month, day)
- 2022 Google CTF SEGFAULT LABYRINTH wp
- ClickHouse字段分组聚合、按照任意时间段粒度查询SQL
- THREE. AxesHelper is not a constructor
- Oracle: Practice of CDB restricting PDB resources
- Body mass index program, entry to write dead applet project
- JTAG principle of arm bare board debugging
- MySQL script batch queries all tables containing specified field types in the database
- Tensorflow GPU installation
- 线段树(SegmentTree)
猜你喜欢
资产安全问题或制约加密行业发展 风控+合规成为平台破局关键
Force buckle 1037 Effective boomerang
go-zero微服务实战系列(九、极致优化秒杀性能)
ClickHouse字段分组聚合、按照任意时间段粒度查询SQL
微信公众号发送模板消息
Do you understand this patch of the interface control devaxpress WinForms skin editor?
Can the system hibernation file be deleted? How to delete the system hibernation file
JTAG principle of arm bare board debugging
[100 cases of JVM tuning practice] 05 - Method area tuning practice (Part 2)
c语言—数组
随机推荐
【案例分享】网络环路检测基本功能配置
Neon Optimization: summary of performance optimization experience
[JS] obtain the N days before and after the current time or the n months before and after the current time (hour, minute, second, year, month, day)
2022 Google CTF SEGFAULT LABYRINTH wp
UI control telerik UI for WinForms new theme - vs2022 heuristic theme
Niuke cold training camp 6B (Freund has no green name level)
[100 cases of JVM tuning practice] 04 - Method area tuning practice (Part 1)
Maidong Internet won the bid of Beijing life insurance to boost customers' brand value
How to manage distributed teams?
The cost of returning tables in MySQL
【js】获取当前时间的前后n天或前后n个月(时分秒年月日都可)
JTAG debugging experience of arm bare board debugging
Byte P7 professional level explanation: common tools and test methods for interface testing, Freeman
[case sharing] basic function configuration of network loop detection
系统休眠文件可以删除吗 系统休眠文件怎么删除
NEON优化:矩阵转置的指令优化案例
实现mysql与ES的增量数据同步
Table table setting fillet
云呐-工单管理制度及流程,工单管理规范
【芯片方案设计】脉搏血氧仪