高通8x12 添加 TP和按键

本文介绍如何在触摸屏驱动中配置虚拟按键,通过修改内核代码和设备树文件实现按键功能。具体步骤包括添加虚拟按键注册函数、创建属性组以及配置设备树参数。

1 .在tp的驱动文件中添加以下代码实现按键功能

  1. static ssize_t  
  2. ft5x06_virtual_keys_register(struct kobject *kobj,  
  3.                  struct kobj_attribute *attr,  
  4.                  char *buf)  
  5. {  
  6.     return snprintf(buf, 200,  
  7.     __stringify(EV_KEY) ":" __stringify(KEY_HOME)  ":120:840:80:60"  
  8.     ":" __stringify(EV_KEY) ":" __stringify(KEY_BACK)   ":360:840:80:60"  
  9.     "\n");  
  10. }  
  11.   
  12. static struct kobj_attribute ft5x06_virtual_keys_attr = {  
  13.     .attr = {  
  14.         .name = "virtualkeys.ft5x06_ts",  
  15.         .mode = S_IRUGO,  
  16.     },  
  17.     .show = &ft5x06_virtual_keys_register,  
  18. };  
  19.   
  20. static struct attribute *ft5x06_virtual_key_properties_attrs[] = {  
  21.     &ft5x06_virtual_keys_attr.attr,  
  22.     NULL,  
  23. };  
  24.   
  25. static struct attribute_group ft5x06_virtual_key_properties_attr_group = {  
  26.     .attrs = ft5x06_virtual_key_properties_attrs,  
  27. };  
  28.   
  29. struct kobject *ft5x06_virtual_key_properties_kobj;  
  30.   
  31.   
  32. static void __init ft5x06_touchpad_setup(void)  
  33. {  
  34.     int rc;  
  35.     ft5x06_virtual_key_properties_kobj =  
  36.             kobject_create_and_add("board_properties", NULL);  
  37.       
  38.   
  39.     if (ft5x06_virtual_key_properties_kobj)  
  40.         rc = sysfs_create_group(ft5x06_virtual_key_properties_kobj,  
  41.                 &ft5x06_virtual_key_properties_attr_group);  
  42.   
  43.     if (!ft5x06_virtual_key_properties_kobj || rc)  
  44.         pr_err("%s: failed to create board_properties\n", __func__);  
  45.   
  46.       
  47. }  
static ssize_t
ft5x06_virtual_keys_register(struct kobject *kobj,
			     struct kobj_attribute *attr,
			     char *buf)
{
	return snprintf(buf, 200,
	__stringify(EV_KEY) ":" __stringify(KEY_HOME)  ":120:840:80:60"
	":" __stringify(EV_KEY) ":" __stringify(KEY_BACK)   ":360:840:80:60"
	"\n");
}

static struct kobj_attribute ft5x06_virtual_keys_attr = {
	.attr = {
		.name = "virtualkeys.ft5x06_ts",
		.mode = S_IRUGO,
	},
	.show = &ft5x06_virtual_keys_register,
};

static struct attribute *ft5x06_virtual_key_properties_attrs[] = {
	&ft5x06_virtual_keys_attr.attr,
	NULL,
};

static struct attribute_group ft5x06_virtual_key_properties_attr_group = {
	.attrs = ft5x06_virtual_key_properties_attrs,
};

struct kobject *ft5x06_virtual_key_properties_kobj;


static void __init ft5x06_touchpad_setup(void)
{
	int rc;
	ft5x06_virtual_key_properties_kobj =
			kobject_create_and_add("board_properties", NULL);
	

	if (ft5x06_virtual_key_properties_kobj)
		rc = sysfs_create_group(ft5x06_virtual_key_properties_kobj,
				&ft5x06_virtual_key_properties_attr_group);

	if (!ft5x06_virtual_key_properties_kobj || rc)
		pr_err("%s: failed to create board_properties\n", __func__);

	
}
另外需要在-mtp.dtsi文件中配置TP的参数和gen_vkeys

  1. i2c@f9923000{  
  2.     focaltech@38{  
  3.         compatible = "focaltech,5x06";  
  4.         reg = <0x38>;  
  5.         interrupt-parent = <&msmgpio>;  
  6.         interrupts = <1 0x2>;  
  7.         vdd-supply = <&pm8110_l19>;  
  8.         vcc_i2c-supply = <&pm8110_l14>;  
  9.         focaltech,family-id = <0x06>;  
  10.         focaltech,reset-gpio = <&msmgpio 0 0x00>;  
  11.         focaltech,irq-gpio = <&msmgpio 1 0x00>;  
  12.         focaltech,display-coords = <0 0 480 854>;  
  13.         focaltech,panel-coords = <0 0 480 946>;  
  14.         focaltech,button-map= <139 102 158>;  
  15.         focaltech,no-force-update;  
  16.         focaltech,i2c-pull-up;  
 i2c@f9923000{
		focaltech@38{
			compatible = "focaltech,5x06";
			reg = <0x38>;
			interrupt-parent = <&msmgpio>;
			interrupts = <1 0x2>;
			vdd-supply = <&pm8110_l19>;
			vcc_i2c-supply = <&pm8110_l14>;
			focaltech,family-id = <0x06>;
			focaltech,reset-gpio = <&msmgpio 0 0x00>;
			focaltech,irq-gpio = <&msmgpio 1 0x00>;
			focaltech,display-coords = <0 0 480 854>;
			focaltech,panel-coords = <0 0 480 946>;
			focaltech,button-map= <139 102 158>;
			focaltech,no-force-update;
			focaltech,i2c-pull-up;

  1. gen-vkeys {  
  2.         compatible = "qcom,gen-vkeys";  
  3.         label = "ft5x06_ts";  
  4.         qcom,disp-maxx = <480>;  
  5.         qcom,disp-maxy = <800>;  
  6.         qcom,panel-maxx = <481>;  
  7.         qcom,panel-maxy = <940>;  
  8.         qcom,key-codes = <102 158 >;  //按键码,TP需要几个就写几个  
  9.         qcom,y-offset = <0>;  
  10.     };  
gen-vkeys {
		compatible = "qcom,gen-vkeys";
		label = "ft5x06_ts";
		qcom,disp-maxx = <480>;
		qcom,disp-maxy = <800>;
		qcom,panel-maxx = <481>;
		qcom,panel-maxy = <940>;
		qcom,key-codes = <102 158 >;  //按键码,TP需要几个就写几个
		qcom,y-offset = <0>;
	};
下面是成功添加后的截图

要在搭载高通X35芯片的设备中集成OpenCore AMR音频编解码库,需要从硬件平台支持、操作系统兼容性、编解码库适配等多个方面进行考虑。 高通X35芯片是一款面向中低端智能手机物联网设备的处理器,基于ARM架构设计,支持Android操作系统[^3]。由于X35属于Qualcomm Snapdragon系列芯片组的一部分,通常已经具备了较为完善的多媒体处理能力,包括音频编解码支持。OpenCore AMR是一个开源的AMR音频编解码实现,常用于早期的Android系统中进行语音编码。 ### 集成步骤与建议 1. **确认系统环境** 设备应运行支持OpenCore框架的Android版本。虽然较新的Android系统已逐步转向使用其他音频框架(如AOSP的MediaCodec),但OpenCore AMR仍可在旧版本系统中运行。建议确认设备所使用的Android版本是否兼容OpenCore AMR。 2. **获取OpenCore AMR源码** 可从开源社区或AOSP仓库中获取OpenCore AMR的源代码。通常该库包含在`external/opencore/`目录下。确保所使用的版本与目标Android系统版本匹配。 3. **配置构建环境** 若需重新编译系统镜像,需配置Android构建环境。执行`source build/envsetup.sh``lunch`命令选择目标设备配置。之后将OpenCore AMR模块添加到构建配置中,确保在编译时被包含进系统镜像。 4. **适配硬件抽象层(HAL)** 高通X35芯片通常会提供音频相关的HAL接口。需要确认OpenCore AMR是否能通过这些接口与底层音频驱动通信。如需修改,可能需要调整`libopencore_amr`中的音频输出模块,使其适配`audio.primary.*.so`等HAL组件。 5. **测试与调试** 编译完成后,将新生成的系统镜像烧录至设备,并通过`amrtest`等工具测试AMR编解码功能是否正常工作。使用`logcat`查看系统日志,排查可能出现的兼容性问题。 6. **优化与验证** 若发现性能问题或兼容性错误,需进一步优化OpenCore AMR的线程调度、内存管理等模块。同时验证其在不同音频格式、采样率下的表现是否稳定。 ```bash # 示例:添加OpenCore AMR模块到Android构建配置 PRODUCT_PACKAGES += \ libopencore_amr \ amrtest ``` ### 注意事项 - OpenCore AMR已逐渐被更现代的编解码器(如AAC、Opus)取代,若非项目需求,建议考虑使用更新的音频处理方案。 - 高通芯片平台通常已有完善的音频支持,添加第三方编解码库时需确保不会与现有系统模块冲突。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值