s32_t pwrctrl_timer_delay (u32_t time) { u32_t uDecValue = (u32_t)(time * PWRCTRL_SLICE_CLK) / PWRCTRL_SLICE_UNIT_CONV; u32_t uCurValue, uTargValue; /* 读Timer的当前计数值 */ uCurValue = pwrctrl_get_slice_time(); PWC_TRACE(PWC_LOG_DEBUG, "Current TIME Value1 = 0x%x\n", uCurValue, 0, 0, 0, 0, 0); /* 求Timer的递减目标值 */ if (uDecValue <= uCurValue) { uTargValue = uCurValue - uDecValue; } else { uTargValue = PWRCTRL_SLICETIMER_XLOAD - (uDecValue - uCurValue); } /* 读取,并比较 */ for (;;) { uCurValue = pwrctrl_get_slice_time(); if (uCurValue <= uTargValue) { PWC_TRACE(PWC_LOG_DEBUG, "Curent,TIME Value2 = 0x%x\n", uCurValue, 0, 0, 0, 0, 0); break; } } return RET_OK; }
/***************************************************************************** 函 数 名 : pwrctrl_mntn_show 功能描述 : test init 输入参数 : 无 输出参数 : 无 返 回 值 : s32_t 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年8月31日 作 者 : 刘永富 56193 修改内容 : 新生成函数 *****************************************************************************/ s32_t pwrctrl_mntn_show(void_t) { PWC_TRACE(PWC_LOG_ERROR, "exc vaddr: %x, paddr: %x \n", (s32_t)g_stAcpuPwcExcLog, EXCH_ACPU_CORE_PWC_ADDR, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "sleep cnt: %x, slice: %x \n", (s32_t)(g_stAcpuPwcExcLog->core0.SlpCnt), (s32_t)(g_stAcpuPwcExcLog->core0.SlpMgrSTm), 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "wake cnt: %x, slice: %x \n", (s32_t)(g_stAcpuPwcExcLog->core0.WkCnt), (s32_t)(g_stAcpuPwcExcLog->core0.WkMgrSTm), 0, 0, 0, 0); }
void pwrctrl_print_switch_set(unsigned int flag,int mode) { /*bit模式*/ if(0 == mode) { PWC_TRACE(PWC_LOG_INFO, "pwrctrl_print_switch_set,old value:0x%x\n",g_ulpwrctrl_print_switch,0,0,0,0,0); g_ulpwrctrl_print_switch |= (1<<flag); PWC_TRACE(PWC_LOG_INFO, "pwrctrl_print_switch_set,new value:0x%x\n",g_ulpwrctrl_print_switch,0,0,0,0,0); } else/*一次设置模式*/ { g_ulpwrctrl_print_switch = flag; } }
static void pwc_snapshot_button(struct pwc_device *pdev, int down) { if (down) { PWC_TRACE("Snapshot button pressed.\n"); } else { PWC_TRACE("Snapshot button released.\n"); } #ifdef CONFIG_USB_PWC_INPUT_EVDEV if (pdev->button_dev) { input_report_key(pdev->button_dev, KEY_CAMERA, down); input_sync(pdev->button_dev); } #endif }
int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int pixfmt, int frames, int *compression, int send_to_cam) { int ret, size; PWC_DEBUG_FLOW("set_video_mode(%dx%d @ %d, pixfmt %08x).\n", width, height, frames, pixfmt); size = pwc_get_size(pdev, width, height); PWC_TRACE("decode_size = %d.\n", size); if (DEVICE_USE_CODEC1(pdev->type)) { ret = set_video_mode_Nala(pdev, size, pixfmt, frames, compression, send_to_cam); } else if (DEVICE_USE_CODEC3(pdev->type)) { ret = set_video_mode_Kiara(pdev, size, pixfmt, frames, compression, send_to_cam); } else { ret = set_video_mode_Timon(pdev, size, pixfmt, frames, compression, send_to_cam); } if (ret < 0) { PWC_ERROR("Failed to set video mode %s@%d fps; return code = %d\n", size2name[size], frames, ret); return ret; } pdev->frame_total_size = pdev->frame_size + pdev->frame_header_size + pdev->frame_trailer_size; PWC_DEBUG_SIZE("Set resolution to %dx%d\n", pdev->width, pdev->height); return 0; }
s32_t __init pwrctrl_common_initial ( void_t ) { /*lint -e553*/ #if 1/*(FEATURE_POWER_DRV == FEATURE_ON)*/ /*lint +e553*/ local_t u32_t startTm=0; u32_t tmpTm = 0; g_stAcpuPwcExcLog = (PWRCTRL_ACPU_EXC_LOG_STRU *)(EXCH_ACPU_CORE_PWC_ADDR_V); pwrctrl_write_reg32(IO_ADDRESS(EXCH_A_CORE_POWRCTRL_CONV_ADDR), EXCH_ACPU_CORE_PWC_ADDR); #if 0 g_stMcuLogExt = (PWC_MCU_EXC_LOG_STRU *)ioremap(pwrctrl_read_reg32(MEMORY_AXI_MCU_LOG_ADDR), 0x1000); #endif /*保存SLICE TIMER 基地址*/ #if defined(CHIP_BB_HI6210) /*B020 Modify*/ #else pwrctrl_write_reg32(PWRCTRL_ACPU_ASM_SLICE_BAK_ADDR, IO_ADDRESS(SOC_AO_SCTRL_SC_SLICER_COUNT0_ADDR(SOC_SC_ON_BASE_ADDR))); #endif wake_lock_init(&g_ulTstwakelock,WAKE_LOCK_SUSPEND,"pwrctrl_tst"); pwrctrl_sleep_initial(); pwrctrl_sleep_mgr_sleep_init(); if(RET_OK != pwrctrl_is_func_on(PWC_SWITCH_ASLEEP)) { wake_lock(&g_ulTstwakelock); PWC_TRACE(PWC_LOG_MAX, "MCU: pwc_common_initial,msleep not support!\r\n",0,0,0,0,0,0); } else { /*lint*/ } /* 低功耗初始化完成*/ PWC_TRACE(PWC_LOG_MAX, "ACPU: Enter pwrctrl initial routing! \n",0,0,0,0,0,0); register_reboot_notifier(&pm_reboot_nb); pwrctrl_write_reg32(IO_ADDRESS(MEMORY_AXI_SEC_CORE_BOOT_TEST_ADDR), 0); printk("sec core boot test addr:0x%x\n", MEMORY_AXI_SEC_CORE_BOOT_TEST_ADDR); #endif g_pwc_init_flag = PWRCTRL_INIT_FLAG; return RET_OK; }
u32_t pwrctrl_read_reg32 ( u32_t ulRegAddr ) { if (0 != (ulRegAddr & 0x03))/* not 4byte aligned */ { PWC_TRACE(PWC_LOG_MAX, "pwrctrl_read_reg32 Address: 0x%x not aligned.\r\n", (int)ulRegAddr,0,0,0,0,0); return 0; } return *(volatile u32_t *)ulRegAddr; }
s32_t pwrctrl_check_irq_pending_status ( void_t ) { u32_t i, j; u32_t pendings32_tNum = ACPU_GIC_MAX_NUM; u32_t gicIcdIsprRegValue = 0; u32_t key = 0; local_irq_save(key); for (i = 0; i < ACPU_GIC_ICDABR_NUM; i++) { gicIcdIsprRegValue = PWRCTRL_GET_GIC_STATUS(i); if (0 == gicIcdIsprRegValue) { continue; } else { for (j = 0; j < sizeof(u32_t); j++) { if ((gicIcdIsprRegValue & (1 << j))) { pendings32_tNum = ((i * sizeof(u32_t)) + j); PWC_TRACE(PWC_LOG_DEBUG, "GIC Pending %d ... \n", pendings32_tNum, 0, 0, 0, 0, 0); } } } } local_irq_restore(key); /*忽略Com ARM内置DEBUG模块的通道发送请求中断*/ if (((ACPU_COMMTX_CORE0 <= pendings32_tNum) && (ACPU_COMMTX_CORE3 >= pendings32_tNum)) \ || (ACPU_GIC_MAX_NUM == pendings32_tNum)) { return PWRCTRL_TRUE; } else { PWC_TRACE(PWC_LOG_DEBUG, "Can't sleep: GIC Pending %d ... \n", pendings32_tNum, 0, 0, 0, 0, 0); return PWRCTRL_FALSE; } }
s32_t pwrctrl_write_reg32( u32_t ulRegAddr, u32_t ulRegVal) { if (0 != (ulRegAddr & 0x03))/* not 4byte aligned */ { PWC_TRACE(PWC_LOG_MAX, "pwrctrl_write_reg32 Address: 0x%x not aligned.\r\n", (int)ulRegAddr,0,0,0,0,0); return RET_ERR; } *(volatile u32_t *)ulRegAddr = ulRegVal; return RET_OK; }
s32_t pwrctrl_clr_bits (u32_t ulRegAddr, u32_t ulMask) { if (0 != (ulRegAddr & 0x03))/* not 4byte aligned */ { PWC_TRACE(PWC_LOG_MAX, "pwrctrl_clr_bits Address: 0x%x not aligned.\r\n", (int)ulRegAddr,0,0,0,0,0); return RET_ERR; } pwrctrl_write_reg32(ulRegAddr, pwrctrl_read_reg32(ulRegAddr)&(~ulMask)); return RET_OK; }
void_t pwrctrl_log_mem(u8_t* info, void_t* addr, u32_t size) { u32_t idx; if(!info || !addr) { PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_log_mem: null parameters.", 0, 0, 0, 0, 0, 0); return ; } PWC_TRACE(PWC_LOG_INFO, "%s, 0x%ux, %u", info, (u32_t)addr, size, 0, 0, 0); for(idx = 0; idx < size; idx = idx + 16) { PWC_TRACE(PWC_LOG_INFO, " 0x%.8X: 0x%.8X 0x%.8X 0x%.8X 0x%.8X ", (int)addr + idx, *(int*)((int)addr + idx), *(int*)((int)addr + idx + 0x4), *(int*)((int)addr + idx + 0x8), *(int*)((int)addr + idx + 0xC), 0); } }
/************************************************************************* 函 数 名 : pwrctrl_cpunumbermax_notify 功能描述 : qos cpunumbermax回调处理函数 输入参数 : 设定的CPU个数 输出参数 : 无 返 回 值 : 无 修改记录 : ************************************************************************/ int pwrctrl_cpunumbermax_notify (struct notifier_block *b, unsigned long cpumax, void *v) { int cpu = num_possible_cpus(); PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_cpunumbermax_notify %lu,%d\n",cpumax,cpu); /*读SC判断qos特性是否打开,没有打开return ERROR */ if((cpumax<= num_possible_cpus())&&(cpumax>=1)) { pwrctrl_cpunumbermax_handle((u32_t)cpumax); } else { PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_cpunumbermax erro fail:%lu\n",cpumax); } return 0; }
s32_t pwrctrl_mem_show( u32_t addr ) { u32_t *addrV=0; addrV = (u32_t *)ioremap(addr, 0x1000); PWC_TRACE(PWC_LOG_ERROR, "0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x \r\n", \ addr, *(addrV++), *(addrV++), *(addrV++), *(addrV++), 0); PWC_TRACE(PWC_LOG_ERROR, "0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x \r\n", \ (addr+0x10), *(addrV++), *(addrV++), *(addrV++), *(addrV++), 0); PWC_TRACE(PWC_LOG_ERROR, "0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x \r\n", \ (addr+0x20), *(addrV++), *(addrV++), *(addrV++), *(addrV++), 0); PWC_TRACE(PWC_LOG_ERROR, "0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x \r\n", \ (addr+0x30), *(addrV++), *(addrV++), *(addrV++), *(addrV++), 0); iounmap(addrV); return RET_OK; }
static int set_video_mode_Kiara(struct pwc_device *pdev, int size, int pixfmt, int frames, int *compression, int send_to_cam) { const struct Kiara_table_entry *pChoose = NULL; int fps, ret = 0; if (size >= PSZ_MAX || *compression < 0 || *compression > 3) return -EINVAL; if (frames < 5) frames = 5; else if (size == PSZ_VGA && frames > 15) frames = 15; else if (frames > 30) frames = 30; fps = (frames / 5) - 1; /* Find a supported framerate with progressively higher compression */ while (*compression <= 3) { pChoose = &Kiara_table[size][fps][*compression]; if (pChoose->alternate != 0) break; (*compression)++; } if (pChoose == NULL || pChoose->alternate == 0) return -ENOENT; /* Not supported. */ /* Firmware bug: video endpoint is 5, but commands are sent to endpoint 4 */ if (send_to_cam) ret = send_video_command(pdev, 4, pChoose->mode, 12); if (ret < 0) return ret; if (pChoose->bandlength > 0 && pixfmt == V4L2_PIX_FMT_YUV420) pwc_dec23_init(pdev, pChoose->mode); /* All set and go */ pdev->pixfmt = pixfmt; pdev->vframes = (fps + 1) * 5; pdev->valternate = pChoose->alternate; pdev->width = pwc_image_sizes[size][0]; pdev->height = pwc_image_sizes[size][1]; pdev->vbandlength = pChoose->bandlength; if (pdev->vbandlength > 0) pdev->frame_size = (pdev->vbandlength * pdev->height) / 4; else pdev->frame_size = (pdev->width * pdev->height * 12) / 8; PWC_TRACE("frame_size=%d, vframes=%d, vsize=%d, vbandlength=%d\n", pdev->frame_size, pdev->vframes, size, pdev->vbandlength); return 0; }
/************************************************************************* 函 数 名 : pwrctrl_hotplug_qosdev_register 功能描述 : cpu qos设备创建及回调notify函数注册 输入参数 : 无 输出参数 : 无 返 回 值 : OK/ERROR,设备注册成功或者失败 修改记录 : ************************************************************************/ int pwrctrl_hotplug_qosdev_register ( void ) { if((pm_qos_add_notifier(PM_QOS_CPU_NUMBER_LOCK, &cpu_numberlock_notifier) < 0) \ || (pm_qos_add_notifier(PM_QOS_CPU_NUMBER_MAX, &cpu_maxnumber_notifier) < 0) \ || (pm_qos_add_notifier(PM_QOS_CPU_NUMBER_MIN, &cpu_minnumber_notifier) < 0)) { return RET_ERR; } PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_hotplug_qosdev_register sucess\n"); return 0; }
/************************************************************************* 函 数 名 : pwrctrl_hotplug_qosdev_unregister 功能描述 : A 输入参数 : 无 输出参数 : 无 返 回 值 : 无 修改记录 : ************************************************************************/ s32_t pwrctrl_hotplug_qosdev_unregister ( void ) { /*去注册cpu_number_lock qos notify 回调函数*/ if((pm_qos_remove_notifier(PM_QOS_CPU_NUMBER_LOCK, &cpu_numberlock_notifier) < 0) \ || (pm_qos_remove_notifier(PM_QOS_CPU_NUMBER_MAX, &cpu_maxnumber_notifier) < 0) \ || (pm_qos_remove_notifier(PM_QOS_CPU_NUMBER_MIN, &cpu_minnumber_notifier) < 0)) { return RET_ERR; } PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_hotplug_qosdev_unregister sucess\n"); return 0; }
/************************************************************************* 函 数 名 : pwrctrl_cpunumberlock_notify 功能描述 : qos cpunumberlock回调处理函数 输入参数 : 设定的CPU个数 输出参数 : 无 返 回 值 : 无 修改记录 : ************************************************************************/ int pwrctrl_cpunumberlock_notify (struct notifier_block *b, unsigned long cpulock, void *v) { /*读SC判断qos特性是否打开,没有打开return ERROR */ if(cpulock<= num_possible_cpus()) { pwrctrl_cpunumberlock_handle((u32_t)cpulock); } else { PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_cpunumberlock erro fail:%lu\n",cpulock); } return 0; }
/************************************************************************* 函 数 名 : pwrctrl_cpunumbermin_notify 功能描述 : qos cpunumbermin回调处理函数 输入参数 : 设定的CPU个数 输出参数 : 无 返 回 值 : 无 修改记录 : ************************************************************************/ int pwrctrl_cpunumbermin_notify (struct notifier_block *b, unsigned long cpumin, void *v) { /*读SC判断qos特性是否打开,没有打开return ERROR */ if((cpumin<= num_possible_cpus())&&(cpumin>=1)) { pwrctrl_cpunumbermin_handle((u32_t)cpumin); } else { PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_cpunumbermin fail:%lu\n",cpumin); } return 0; }
static int __init usb_pwc_init(void) { int i; #ifdef CONFIG_USB_PWC_DEBUG PWC_INFO("Philips webcam module version " PWC_VERSION " loaded.\n"); PWC_INFO("Supports Philips PCA645/646, PCVC675/680/690, PCVC720[40]/730/740/750 & PCVC830/840.\n"); PWC_INFO("Also supports the Askey VC010, various Logitech Quickcams, Samsung MPC-C10 and MPC-C30,\n"); PWC_INFO("the Creative WebCam 5 & Pro Ex, SOTEC Afina Eye and Visionite VCS-UC300 and VCS-UM100.\n"); if (pwc_trace >= 0) { PWC_DEBUG_MODULE("Trace options: 0x%04x\n", pwc_trace); } #endif if (fps) { if (fps < 4 || fps > 30) { PWC_ERROR("Framerate out of bounds (4-30).\n"); return -EINVAL; } default_fps = fps; PWC_DEBUG_MODULE("Default framerate set to %d.\n", default_fps); } if (leds[0] >= 0) led_on = leds[0]; if (leds[1] >= 0) led_off = leds[1]; /* Big device node whoopla. Basically, it allows you to assign a device node (/dev/videoX) to a camera, based on its type & serial number. The format is [type[.serialnumber]:]node. Any camera that isn't matched by these rules gets the next available free device node. */ for (i = 0; i < MAX_DEV_HINTS; i++) { char *s, *colon, *dot; /* This loop also initializes the array */ device_hint[i].pdev = NULL; s = dev_hint[i]; if (s != NULL && *s != '\0') { device_hint[i].type = -1; /* wildcard */ strcpy(device_hint[i].serial_number, "*"); /* parse string: chop at ':' & '/' */ colon = dot = s; while (*colon != '\0' && *colon != ':') colon++; while (*dot != '\0' && *dot != '.') dot++; /* Few sanity checks */ if (*dot != '\0' && dot > colon) { PWC_ERROR("Malformed camera hint: the colon must be after the dot.\n"); return -EINVAL; } if (*colon == '\0') { /* No colon */ if (*dot != '\0') { PWC_ERROR("Malformed camera hint: no colon + device node given.\n"); return -EINVAL; } else { /* No type or serial number specified, just a number. */ device_hint[i].device_node = simple_strtol(s, NULL, 10); } } else { /* There's a colon, so we have at least a type and a device node */ device_hint[i].type = simple_strtol(s, NULL, 10); device_hint[i].device_node = simple_strtol(colon + 1, NULL, 10); if (*dot != '\0') { /* There's a serial number as well */ int k; dot++; k = 0; while (*dot != ':' && k < 29) { device_hint[i].serial_number[k++] = *dot; dot++; } device_hint[i].serial_number[k] = '\0'; } } PWC_TRACE("device_hint[%d]:\n", i); PWC_TRACE(" type : %d\n", device_hint[i].type); PWC_TRACE(" serial# : %s\n", device_hint[i].serial_number); PWC_TRACE(" node : %d\n", device_hint[i].device_node); } else device_hint[i].type = 0; /* not filled */ } /* ..for MAX_DEV_HINTS */ PWC_DEBUG_PROBE("Registering driver at address 0x%p.\n", &pwc_driver); return usb_register(&pwc_driver); }
s32_t pwrctrl_sleep_mgr_get_next_schedule_time( u32_t ulAllTimer, u32_t *pTimerID, u32_t *pNextScheduleTime) { u32_t ulTimerValue = 0; u32_t i = 0; u32_t ulState = 0; u32_t ulTimclk = 0; u32_t ulCount = 0; u32_t ulTimerId = PWRCTRL_MAX_TIME; u32_t ulNextScheduleTime = PWRCTRL_MAX_TIME; if ((PWRCTRL_TRUE != ulAllTimer) && (PWRCTRL_FALSE != ulAllTimer)) { (int)PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_sleep_mgr_get_next_scheduletime: ulAllTimer[%x] is err\n", ulAllTimer,0, 0, 0, 0, 0); return (s32_t)RET_ERR; } if (NULL == pTimerID) { (int)PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_sleep_mgr_get_next_scheduletime: pTimerID is null\n", 0,0, 0, 0, 0, 0); return (s32_t)RET_ERR; } if (NULL == pNextScheduleTime) { (int)PWC_TRACE(PWC_LOG_ERROR, "pwrctrl_sleep_mgr_get_next_scheduletime: pNextScheduleTime is null\n", 0,0, 0, 0, 0, 0); return (s32_t)RET_ERR; } for (i = 0; i < PWRCTRL_ACPU_TIMER_TOTAL_NUM; i++) { ulTimerValue = 0; ulState = pwrctrl_get_timer_active(i); /*if the timer is disable*/ if (PWRCTRL_FALSE == ulState) { /*do nothing,see next timer*/ continue; } /*get the TIMCLK from SC .spc2.0 is 19.2M*/ /*时钟源频率*/ ulTimclk = pwrctrl_get_timer_clk(i); /*get the timer div*/ /*分频因子*/ /*ulDIV = pwrctrl_get_timer_div(g_ulPWRCTRLTimerAddr[i]);*/ /*get the timer count*/ /*获得剩余计数值*/ ulCount = pwrctrl_get_timer_cnt(i); /*calc the remain time, unit is ms */ ulTimerValue = (ulCount * PWRCTRL_THOUSAND_TIME) / (ulTimclk / PWRCTRL_THOUSAND_TIME); if (ulNextScheduleTime > ulTimerValue) { ulNextScheduleTime = ulTimerValue; ulTimerId = i; } } /*BBP TIMER IS TRANSLATE INTO TIMER*/ /*output the next schedule*/ *pNextScheduleTime = ulNextScheduleTime; *pTimerID = ulTimerId; PRINT_PWC_DBG(PWC_SWITCH_CPUIDLE, "the timerID is %d, the left time is %d[ms]\n", ulTimerId,ulNextScheduleTime, 0, 0, 0, 0); /*Log timer id and timer value to Exc space.*/ return (s32_t)RET_OK; }
s32_t pwrctrl_mcu_debug_info_show( void_t ) { int i; PWC_TRACE(PWC_LOG_ERROR, "Current slice: 0x%x \r\n", pwrctrl_get_slice_time()); for(i = 0; i < PERI_SLEEP_STATE_MAX; i++) { PWC_TRACE(PWC_LOG_ERROR, "############# SYSTEM ######## \r\n", 0, 0, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "sleep cnt: 0x%x, wake cnt: 0x%x \r\n", \ g_stMcuLogExt->peri[i].SleepCount, g_stMcuLogExt->peri[i].WakeCount, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "sleep slice: 0x%x, wake slice: 0x%x, \r\n", \ g_stMcuLogExt->peri[i].SleepSliceTime, g_stMcuLogExt->peri[i].WakeSliceTime, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "wake src: 0x%x, 0x%x, \r\n", \ g_stMcuLogExt->peri[i].wakesrc0, g_stMcuLogExt->peri[i].wakesrc1, 0, 0, 0, 0); } PWC_TRACE(PWC_LOG_ERROR, "############# C core ########### \r\n", 0, 0, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "sleep cnt: 0x%x, wake cnt: 0x%x \r\n", \ g_stMcuLogExt->ccpu.SleepCount, g_stMcuLogExt->ccpu.WakeCount, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "sleep slice: 0x%x, wake slice: 0x%x, \r\n", \ g_stMcuLogExt->ccpu.SleepSliceTime, g_stMcuLogExt->ccpu.WakeSliceTime, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "WFI wait fail cnt: 0x%x, wfi wait fail slice:0x%x, \r\n", \ g_stMcuLogExt->ccpu.WfiFailCount, g_stMcuLogExt->ccpu.WfiFailSliceTime, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "wake src: 0x%x, 0x%x, \r\n", \ g_stMcuLogExt->ccpu.wakesrc0, g_stMcuLogExt->ccpu.wakesrc1, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "############# A core ###### \r\n", 0, 0, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "sleep cnt: 0x%x, wake cnt: 0x%x \r\n", \ g_stMcuLogExt->acpu0.SleepCount, g_stMcuLogExt->acpu0.WakeCount, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "sleep slice: 0x%x, wake slice: 0x%x, \r\n", \ g_stMcuLogExt->acpu0.SleepSliceTime, g_stMcuLogExt->acpu0.WakeSliceTime, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "WFI wait fail cnt: 0x%x, wfi wait fail slice:0x%x, \r\n", \ g_stMcuLogExt->acpu0.WfiFailCount, g_stMcuLogExt->acpu0.WfiFailSliceTime, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "wake src: 0x%x, 0x%x, \r\n", \ g_stMcuLogExt->acpu0.wakesrc0, g_stMcuLogExt->acpu0.wakesrc1, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "IPC wake status: 0x%x, \r\n", \ g_stMcuLogExt->acpu0.wakesrcIPC, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "############# HIFI ######## \r\n", 0, 0, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "sleep cnt: 0x%x, wake cnt: 0x%x \r\n", \ g_stMcuLogExt->hifi.SleepCount, g_stMcuLogExt->hifi.WakeCount, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "sleep slice: 0x%x, wake slice: 0x%x, \r\n", \ g_stMcuLogExt->hifi.SleepSliceTime, g_stMcuLogExt->hifi.WakeSliceTime, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "WFI wait fail cnt: 0x%x, wfi wait fail slice:0x%x, \r\n", \ g_stMcuLogExt->hifi.WfiFailCount, g_stMcuLogExt->hifi.WfiFailSliceTime, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_ERROR, "wake src: 0x%x, 0x%x, \r\n", \ g_stMcuLogExt->hifi.wakesrc0, g_stMcuLogExt->hifi.wakesrc1, 0, 0, 0, 0); return RET_OK; }
static void pwc_frame_complete(struct pwc_device *pdev) { struct pwc_frame_buf *fbuf = pdev->fill_buf; /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus frames on the USB wire after an exposure change. This conditition is however detected in the cam and a bit is set in the header. */ if (pdev->type == 730) { unsigned char *ptr = (unsigned char *)fbuf->data; if (ptr[1] == 1 && ptr[0] & 0x10) { PWC_TRACE("Hyundai CMOS sensor bug. Dropping frame.\n"); pdev->drop_frames += 2; } if ((ptr[0] ^ pdev->vmirror) & 0x01) { pwc_snapshot_button(pdev, ptr[0] & 0x01); } if ((ptr[0] ^ pdev->vmirror) & 0x02) { if (ptr[0] & 0x02) PWC_TRACE("Image is mirrored.\n"); else PWC_TRACE("Image is normal.\n"); } pdev->vmirror = ptr[0] & 0x03; /* Sometimes the trailer of the 730 is still sent as a 4 byte packet after a short frame; this condition is filtered out specifically. A 4 byte frame doesn't make sense anyway. So we get either this sequence: drop_bit set -> 4 byte frame -> short frame -> good frame Or this one: drop_bit set -> short frame -> good frame So we drop either 3 or 2 frames in all! */ if (fbuf->filled == 4) pdev->drop_frames++; } else if (pdev->type == 740 || pdev->type == 720) { unsigned char *ptr = (unsigned char *)fbuf->data; if ((ptr[0] ^ pdev->vmirror) & 0x01) { pwc_snapshot_button(pdev, ptr[0] & 0x01); } pdev->vmirror = ptr[0] & 0x03; } /* In case we were instructed to drop the frame, do so silently. */ if (pdev->drop_frames > 0) { pdev->drop_frames--; } else { /* Check for underflow first */ if (fbuf->filled < pdev->frame_total_size) { PWC_DEBUG_FLOW("Frame buffer underflow (%d bytes);" " discarded.\n", fbuf->filled); } else { fbuf->vb.field = V4L2_FIELD_NONE; fbuf->vb.sequence = pdev->vframe_count; vb2_buffer_done(&fbuf->vb.vb2_buf, VB2_BUF_STATE_DONE); pdev->fill_buf = NULL; pdev->vsync = 0; } } /* !drop_frames */ pdev->vframe_count++; }
s32_t pwrctrl_debug_info_show( void_t ) { PWC_TRACE(PWC_LOG_MAX, "################################ A核 core0 ############################\n", 0, 0, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_MAX, "睡眠次数: 0x%x, 唤醒次数: 0x%x \n", \ g_stAcpuPwcExcLog->core0.SlpCnt, g_stAcpuPwcExcLog->core0.WkCnt, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_MAX, "睡眠开始时间:0x%x, 睡眠时间:0x%x, 唤醒时间:0x%x , 唤醒结束时间:0x%x \n", \ g_stAcpuPwcExcLog->core0.SlpMgrSTm, g_stAcpuPwcExcLog->core0.SlpSTm, \ g_stAcpuPwcExcLog->core0.WkSTm, g_stAcpuPwcExcLog->core0.WkMgrSTm, 0, 0); #if 0 PWC_TRACE(PWC_LOG_MAX, "################################ A核 core1 ############################\n", 0, 0, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_MAX, "睡眠次数: 0x%x, 唤醒次数: 0x%x \n", \ g_stAcpuPwcExcLog->core1.SlpCnt, g_stAcpuPwcExcLog->core1.WkCnt, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_MAX, "睡眠开始时间:0x%x, 睡眠时间:0x%x, 唤醒时间:0x%x , 唤醒结束时间:0x%x \n", \ g_stAcpuPwcExcLog->core1.SlpMgrSTm, g_stAcpuPwcExcLog->core1.SlpSTm, \ g_stAcpuPwcExcLog->core1.WkSTm, g_stAcpuPwcExcLog->core1.WkMgrSTm, 0, 0); PWC_TRACE(PWC_LOG_MAX, "################################ A核 core2 ############################\n", 0, 0, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_MAX, "睡眠次数: 0x%x, 唤醒次数: 0x%x \n", \ g_stAcpuPwcExcLog->core2.SlpCnt, g_stAcpuPwcExcLog->core2.WkCnt, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_MAX, "睡眠开始时间:0x%x, 睡眠时间:0x%x, 唤醒时间:0x%x , 唤醒结束时间:0x%x \n", \ g_stAcpuPwcExcLog->core2.SlpMgrSTm, g_stAcpuPwcExcLog->core2.SlpSTm, \ g_stAcpuPwcExcLog->core2.WkSTm, g_stAcpuPwcExcLog->core2.WkMgrSTm, 0, 0); PWC_TRACE(PWC_LOG_MAX, "################################ A核 core3 ############################\n", 0, 0, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_MAX, "睡眠次数: 0x%x, 唤醒次数: 0x%x \n", \ g_stAcpuPwcExcLog->core3.SlpCnt, g_stAcpuPwcExcLog->core3.WkCnt, 0, 0, 0, 0); PWC_TRACE(PWC_LOG_MAX, "睡眠开始时间:0x%x, 睡眠时间:0x%x, 唤醒时间:0x%x , 唤醒结束时间:0x%x \n", \ g_stAcpuPwcExcLog->core3.SlpMgrSTm, g_stAcpuPwcExcLog->core3.SlpSTm, \ g_stAcpuPwcExcLog->core3.WkSTm, g_stAcpuPwcExcLog->core3.WkMgrSTm, 0, 0); #endif return RET_OK; }