高通8x26 sensor manager 打开sensor

高通8x26平台通过adsp芯片管理sensor,开关sensor不是原来的IOContorl,而是通过sensor manager,下面根据QXDM log分析开关光感的流程,不包含代码分析,最好结合代码看下面流程,不然不好理解。还在研究中,不保证流程的正确性,还请高人指点。
1 sns_smgr_process_msg(SNS_SMGR_REPORT_REQ_V01)
  2 sns_smgr_proc_periodic_req_msg(SNS_SMGR_REPORT_ACTION_ADD_V01)
    3 sns_smgr_schedule_periodic_report()
      4 smgr_parse_report_request(SNS_SMGR_REPORT_REQ_V01)
        5 smgr_parse_periodic_report_item()
      6 smgr_parse_item_decimation(SNS_SMGR_DECIMATION_FILTER_V01)
      6 smgr_override_response_ack(SNS_SMGR_RESPONSE_ACK_MODIFIED_V01);
      4 smgr_schedule_report()
    5 sns_smgr_activate_report()
      6 sns_smgr_link_item_to_sensor()
        7 smgr_update_sensor_when_item_changed()
          8 smgr_update_max_frequencies()
          8 ??sns_smgr_schedule_sensor_event(1)不知道走没走
          8 smgr_mark_reports_for_flushing()
        9 sns_smgr_choose_odr()
          10 sns_smgr_get_adjacent_odrs()
    5 sns_smgr_check_rpts_for_md_update()
      6 sns_hw_power_rail_config()
        7 sns_hw_send_powerrail_msg()
            7 smgr_hw_pnoc_vote()
    3 sns_smgr_send_resp()
    3 smgr_flush_reports()
1 smgr_process_sensor_event(SENSOR_STATE_IDLE,c)
  2 smgr_process_sensor_event_internal(SENSOR_EVENT_WAKE_UP)
    3 sns_smgr_process_wake_up_event()
      4 sns_smgr_set_attr(SNS_DDF_SENSOR__ALL,SNS_DDF_ATTRIB_POWER_STATE,SNS_DDF_POWERSTATE_ACTIVE)
  2 smgr_process_sensor_event_internal(SENSOR_EVENT_WAKE_UP)
    3 sns_smgr_process_wake_up_event()
      4 sns_smgr_set_attr(SNS_DDF_SENSOR__ALL,SNS_DDF_ATTRIB_POWER_STATE,SNS_DDF_POWERSTATE_ACTIVE)
      4 sns_smgr_set_attr(SNS_DDF_SENSOR_PROXIMITY,SNS_DDF_ATTRIB_RANGE,0)
      4 sns_smgr_config_odr_lpf()里面用for循环对包含的sensor都处理,这里包含ALS和PROX
    5 sns_smgr_config_odr(SNS_DDF_SENSOR_PROXIMITY)
      6 sns_smgr_choose_odr()
        7 sns_smgr_get_adjacent_odrs()
    5 sns_smgr_config_odr(SNS_DDF_SENSOR_AMBIENT)
      6 sns_smgr_choose_odr()
        7 sns_smgr_get_adjacent_odrs()
      因为我这次打开的是ALS,所以这里odr != ddf_sensor_ptr->current_odr,要设置odr
      6 sns_smgr_set_attr(SNS_DDF_SENSOR_AMBIENT,SNS_DDF_ATTRIB_ODR,25)
      6 ??不知道SMGR_SENSOR_IS_SELF_SCHED(sensor_ptr)
    5 sns_smgr_update_odr(SNS_DDF_SENSOR_PROXIMITY)
    5 sns_smgr_update_sampling_setting(SNS_DDF_SENSOR_PROXIMITY)
    5 sns_smgr_update_odr(SNS_DDF_SENSOR_AMBIENT)
    5 sns_smgr_update_sampling_setting(SNS_DDF_SENSOR_AMBIENT)
      6 sns_smgr_compute_device_sampling_factor()
      6 sns_smgr_compute_depot_data_rate()
      6 sns_smgr_update_items_info()
      5 sns_smgr_schedule_next_event()
      6 sns_smgr_set_sensor_state()
  2 sns_smgr_check_rpts_for_md_update()
1 smgr_process_sensor_event(40,SENSOR_STATE_CONFIGURING,5)    
  2 smgr_process_sensor_event_internal(SENSOR_EVENT_CONFIG_FILTER_DONE)
    3 sns_smgr_process_config_filter_done_event()
      4 sns_smgr_register_into_scheduler()
    5 sns_smgr_plan_sampling_now()
      6 sns_os_sigs_post(SNS_SMGR_SENSOR_READ_FLAG);//之后sns_smgr_task()会处理这个sig
      4 sns_smgr_set_sensor_state(SENSOR_STATE_READY)
  2 sns_smgr_adjust_latency_node()

1 sns_smgr_task()有while(1) 作为MAIN TASK LOOP
  2 :收到SNS_SMGR_SENSOR_READ_FLAG设置
     SMGR_BIT_SET(sns_smgr.flags, SMGR_FLAGS_DATA_SAMPLING_B);
  2 检查SMGR_BIT_TEST(sns_smgr.flags, SMGR_FLAGS_DATA_SAMPLING_B)
     sns_smgr_sampling_cycle()
       3 sns_smgr_proc_sampling_schedule()
     4 smgr_get_data()
       返回SNS_DDF_PENDING
       3 sns_os_sigs_post(SNS_SMGR_SENSOR_READ_FLAG)//??通过此信号循环get data?
       3 sns_em_register_timer()//??通过此timer 循环get data ?
1.驱动程序执行timer,调用sns_ddf_smgr_notify_data()上报数据//何时开启的timer??
  2 sns_smgr_handle_new_sample()
    3 sns_smgr_ready_reports_list_add()
      4 sns_smgr_set_data_gathering_cycle_flag()//sns_smgr_task检查此flag

1 sns_smgr_task() while(1)检测到SMGR_BIT_TEST(sns_smgr.flags, SMGR_FLAGS_DATA_GATHERING_B)
  2 sns_smgr_data_gathering_cycle()
    3 sns_smgr_generate_periodic_report()
    3 sns_smgr_set_data_gathering_cycle_flag//??通过这循环get data ?

你可能感兴趣的:(驱动开发)