文章目录
TI5754M 简介
TAS5754M 是TI一款DAC芯片,D类。
主要应用:
• LCD/LED TV and Multi-Purpose Monitors
• Sound Bars, Docking Stations, PC Audio
• Wireless Subwoofers, Bluetooth and Active
硬件Block Digram 和THD+N
datasheet 1
Audio DSP在EVM上调整
安装软件 purePath2
连线等初始化
启动应用,选择5754M:
连接EVM
进行基本配置:
Biquad
调试Audio 处理流程,根据下图一个一个模块处理:
EQ3 DRC 4,DBE/PBE5
调整对应的参, 以DRC 三段设置为例
在线调试效果
修改寄存器对应的值,点击运行按钮,可以动态调整。
导出最后结果
保存已经调试好参数。导出结果
driver
定义数据结构,与工作队列
typedef struct
{
unsigned char bAddr;
unsigned int bLength;
unsigned char bArray[MAX_AMP_REG_LEN];
}TAS5754M_REGMAP;
struct TAS5754M_PRIV
{
int gpio_nreset;
int gpio_pdn;
struct workqueue_struct *dspworkqueue;
struct delayed_work dwork;
struct i2c_client *tasi2cdev;
};
驱动流程一致,参考TAS其他系列
*/
static const struct of_device_id tas5754m_dt_ids[] = {
{ .compatible = "ti,tas5754m", },
{ }
};
MODULE_DEVICE_TABLE(of, tas5754m_dt_ids);
static const struct i2c_device_id tas5754m_i2c_id[] = {
{ "tas5754m", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, tas5754m_i2c_id);
static int tas5754m_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
{
struct TAS5754M_PRIV *priv;
struct device *dev = &i2c->dev;
int gpio_nreset = -EINVAL;
int gpio_pdn = -EINVAL;
int ret =0;
int err = -ENOMEM;
unsigned char array5754[2] = {0x3E,0x45};
priv = devm_kzalloc(dev, sizeof(struct TAS5754M_PRIV), GFP_KERNEL);
...
i2c_set_clientdata(i2c, priv);
if (of_match_device(of_match_ptr(tas5754m_dt_ids), dev)) {
struct device_node *of_node = dev->of_node;
gpio_nreset = of_get_named_gpio(of_node, "reset-gpio", 0);
gpio_pdn = of_get_named_gpio(of_node, "mute-gpio", 0);
}
.../*gpio 初值 */
priv->gpio_nreset = gpio_nreset;
priv->gpio_pdn = gpio_pdn;
priv->tasi2cdev = i2c;
g_taspridata = priv;
/* DSP 初始值*/
tas5754_i2c_write_interface(i2c,array5754,2);
/*加载 DSP调整好的效果寄存器 */
tas5754_init();
...
return ret;
err_gpio_reset:
if (gpio_is_valid(gpio_nreset))
gpio_free(gpio_nreset);
err_gpio_pdn:
if (gpio_is_valid(gpio_pdn))
gpio_free(gpio_pdn);
kfree(priv);
return err;
}
static int tas5754m_i2c_remove(struct i2c_client *i2c)
{
struct TAS5754M_PRIV *priv = i2c_get_clientdata(i2c);
if (gpio_is_valid(priv->gpio_nreset)){
gpio_free(priv->gpio_nreset);
}
if (gpio_is_valid(priv->gpio_pdn)){
gpio_free(priv->gpio_pdn);
}
kfree(priv);
return 0;
}
static struct i2c_driver tas5754m_i2c_driver = {
.driver = {
.name = "tas5754m",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(tas5754m_dt_ids),
},
.id_table = tas5754m_i2c_id,
.probe = tas5754m_i2c_probe,
.remove = tas5754m_i2c_remove,
};
module_i2c_driver(tas5754m_i2c_driver);
参考文章6
static void tas575x_task(struct work_struct *work)
{
int i = 0;
unsigned char array[2];
int cnt = sizeof(tas5754registers)/sizeof(tas5754registers[0]);
for(i = 0; i<cnt; i++){
array[0]=tas5754registers[i].reg;
array[1]=tas5754registers[i].value;
tas5754_i2c_write_interface(g_taspridata->tasi2cdev,array,2);
}
}
static int tas5754_init(void){
//创建工作队列
g_taspridata->dspworkqueue = create_singlethread_workqueue("tas575x_workqueue");
// 创建工作,调用函数是tas575x_task
INIT_DELAYED_WORK(&g_taspridata->dwork,tas575x_task);
//延时5s去执行
queue_delayed_work(g_taspridata->dspworkqueue ,&g_taspridata->dwork,1500);
return 0;
}
/*增加ioctl,为上层提供systemcall接口 */
static const struct file_operations tas5754io_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = tas5754io_ioctl,
};
static struct miscdevice tas5754io_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = "tas5754io-dsp",
.fops = &tas5754io_fops,
};
static int __init tas5754io_modinit(void)
{
int ret = 0;
ret = misc_register(&tas5754io_misc);
if (ret < 0) {
printk(KERN_ERR "Failed to register 5754M MISC driver: %d\n", ret);
}
return ret;
}
module_init(tas5754io_modinit);
static void __exit tas5754io_exit(void)
{
misc_deregister(&tas5754io_misc);
}
module_exit(tas5754io_exit);
AP 调试
喇叭连接到AP THD+N 需要小于1%