pick up bring up sensor1.0
1.pick up对比
pick up 也就是手机中的抬起亮屏。
物理陀螺仪版本的pick up 底层驱动pickup.c (陀螺仪辅助精度高)
虚拟陀螺仪版本的pick up 不使用陀螺仪,驱动文件 acc_pickup.c (没有陀螺仪辅助精度低)
移植三部分: HAL----Kernel----SCP
2.SCP
1.添加驱动文件
路径:
vendor/mediatek/proprietary/tinysys/freertos/source/middleware/contexthub/VIRT_Driver
2.添加编译环境(打开开关)
路径:
vendor/mediatek/proprietary/tinysys/freertos/source/project/CM4_A/平台/机型/ProjectConfig.mk
CFG_MOTION_SUPPORT = yes
CFG_PICKUP_SUPPORT = yes
CFG_WIN_ORIENTATION_SUPPORT = yes
路径:
vendor/mediatek/proprietary/tinysys/freertos/source/project/CM4_A/平台/platform/feature_config/chre.mk
######## pickup ########
ifeq ($(CFG_PICKUP_SUPPORT),yes)
C_FILES += $(SOURCE_DIR)/middleware/contexthub/VIRT_Driver/pickup.c
endif
注:编译过程中如果显示内存不够
路径:
vendor/mediatek/proprietary/tinysys/freertos/source/project/CM4_A/平台/platform/Setting.ini
pedometer:9600
pickup:9500
stationary:2898
3.修改底层数据上报方式
路径:vendor/mediatek/proprietary/tinysys/freertos/source/middleware/contexthub/contexthub_fw.c
static void initSensorReportingInfo(void)
{
....
sensorReportingMode[SENSOR_TYPE_PICK_UP_GESTURE] = onChange;
sensorAccurancyMode[SENSOR_TYPE_PICK_UP_GESTURE] = SENSOR_STATUS_ACCURACY_HIGH;
...
}
static void contextHubTransferOnChangeSensor(uint8_t mtk_type, const struct mtkActiveSensor *sensor)
{
...
case SENSOR_TYPE_PICK_UP_GESTURE:
dummy.value[0] = (int32_t)(sensor->buffer.single[numSamples].idata);
ret = contextHubSramFifoWrite(&dummy);
if (ret == SRAM_FIFO_FULL)
contextHubSramFifoRead();
break;
...
}
3.Kernel层设置
1.打开开关
路径1:
kernel-4.14/arch/arm64/configs/$project_defconfig
路径2:
kernel-4.14/arch/arm64/configs/$project_debug_defconfig
CONFIG_MTK_TILTDETECTHUB=y
CONFIG_MTK_PICKUPHUB=y
CONFIG_CUSTOM_KERNEL_SENSORHUB=y
2.修改上报方式
路径:
kernel-4.14/drivers/misc/mediatek/sensors-1.0/sensorHub/SCP_nanoHub/SCP_nanoHub.c
mSensorState[SENSOR_TYPE_PICK_UP_GESTURE].sensorType =
SENSOR_TYPE_PICK_UP_GESTURE;
mSensorState[SENSOR_TYPE_PICK_UP_GESTURE].rate = SENSOR_RATE_ONCHANGE;
mSensorState[SENSOR_TYPE_PICK_UP_GESTURE].timestamp_filter = false;
3.修改数据上报方式
路径:
kernel-4.14/drivers/misc/mediatek/sensors-1.0/situation/pickup_gesture/pickup_gesture.c
static int pickup_gesture_recv_data(struct data_unit_t *event,
void *reserved)
{
int err = 0;
if (event->flush_action == FLUSH_ACTION)
pr_debug("pickup_gesture do not support flush\n");
else if (event->flush_action == DATA_ACTION)
err = situation_data_report_t(ID_PICK_UP_GESTURE,
(uint32_t)event->data[0], (int64_t)event->time_stamp);
return err;
}
4.HAL层
1.修改sensor信息
路径:
vendor/mediatek/proprietary/hardware/sensor/sensors-1.0/SensorList.cpp
#ifdef CUSTOM_KERNEL_PICK_UP_SENSOR
memset(&sensor, 0, sizeof(struct sensor_t));
sensor.name = "XXXXXX";
sensor.vendor = "XXXXX";
sensor.version = PICK_UP_VERSION;
sensor.handle = ID_PICK_UP_GESTURE + ID_OFFSET;
sensor.type = XXXXXXXX;
sensor.maxRange = PICK_UP_RANGE;
sensor.resolution = PICK_UP_RESOLUTION;
sensor.power = PICK_UP_POWER;
sensor.minDelay = PICK_UP_MAXDELAY;
sensor.fifoReservedEventCount = PICK_UP_FIFO_RESERVE_COUNT;
sensor.fifoMaxEventCount = PICK_UP_FIFO_MAX_COUNT;
sensor.stringType = "XXXXXXX";
sensor.maxDelay = PICK_UP_MAXDELAY;
sensor.flags = SENSOR_FLAG_ON_CHANGE_MODE|SENSOR_FLAG_WAKE_UP;
mSensorList.push_back(sensor);
#endif
2.定义宏开关
路径:
device/xiaomi/机型/ProjectConfig.mk
CUSTOM_KERNEL_PICK_UP_SENSOR = yes
...
CUSTOM_KERNEL_WAKE_GESTURE_SENSOR = no
注:写的不对的地方请告知,欢迎指正。
|