当前位置:网站首页>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
边栏推荐
- 动态规划思想《从入门到放弃》
- The cost of returning tables in MySQL
- Maidong Internet won the bid of Beijing life insurance to boost customers' brand value
- Informatics Olympiad YBT 1171: factors of large integers | 1.6 13: factors of large integers
- Transformation transformation operator
- 【信号与系统】
- Supersocket 1.6 creates a simple socket server with message length in the header
- Byte P7 professional level explanation: common tools and test methods for interface testing, Freeman
- UI控件Telerik UI for WinForms新主题——VS2022启发式主题
- HMM 笔记
猜你喜欢
随机推荐
How to manage distributed teams?
系统休眠文件可以删除吗 系统休眠文件怎么删除
2022 Google CTF segfault Labyrinth WP
Data type of pytorch tensor
2022 Google CTF SEGFAULT LABYRINTH wp
Send template message via wechat official account
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such
SuperSocket 1.6 创建一个简易的报文长度在头部的Socket服务器
go-zero微服务实战系列(九、极致优化秒杀性能)
Anfulai embedded weekly report no. 272: 2022.06.27--2022.07.03
Receive user input, height BMI, BMI detection small business entry case
NEON优化:性能优化经验总结
移植DAC芯片MCP4725驱动到NUC980
Cause of handler memory leak
Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform
NEON优化:矩阵转置的指令优化案例
Tensorflow GPU installation
Meet in the middle
[100 cases of JVM tuning practice] 05 - Method area tuning practice (Part 2)
THREE.AxesHelper is not a constructor