int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) { struct omap_dss_hdmi_data *priv = dssdev->data; int r = 0; DSSDBG("ENTER hdmi_display_enable\n"); mutex_lock(&hdmi.lock); if (dssdev->manager == NULL) { DSSERR("failed to enable display: no manager\n"); r = -ENODEV; goto err0; } hdmi.ip_data.hpd_gpio = priv->hpd_gpio; r = omap_dss_start_device(dssdev); if (r) { DSSERR("failed to start device\n"); goto err0; } if (dssdev->platform_enable) { r = dssdev->platform_enable(dssdev); if (r) { DSSERR("failed to enable GPIO's\n"); goto err1; } } r = hdmi_power_on(dssdev); if (r) { DSSERR("failed to power on device\n"); goto err2; } mutex_unlock(&hdmi.lock); return 0; err2: if (dssdev->platform_disable) dssdev->platform_disable(dssdev); err1: omap_dss_stop_device(dssdev); err0: mutex_unlock(&hdmi.lock); return r; }
// TODO: this is a temp debug solution //extern void hdmi_cable_fake_plug_in(void); //extern int hdmi_drv_init(void); static void process_dbg_opt(const char *opt) { if (0 == strncmp(opt, "on", 2)) { hdmi_power_on(); } else if (0 == strncmp(opt, "off", 3)) { hdmi_power_off(); } else if(0 == strncmp(opt, "suspend", 7)) { hdmi_suspend(); } else if(0 == strncmp(opt, "resume", 6)) { hdmi_resume(); } else if(0 == strncmp(opt, "colorbar", 8)) { } else if(0 == strncmp(opt, "ldooff", 6)) { } else if (0 == strncmp(opt, "log:", 3)) { if (0 == strncmp(opt + 9, "on", 2)) { hdmi_log_enable(true); } else if (0 == strncmp(opt + 9, "off", 3)) { hdmi_log_enable(false); } else { goto Error; } } else { goto Error; } return; Error: printk("[hdmitx] parse command error!\n\n%s", STR_HELP); }
void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev) { struct hdmi_cm cm; cm = hdmi_get_code(&dssdev->panel.timings); hdmi.code = cm.code; hdmi.mode = cm.mode; if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { int r; hdmi_power_off(dssdev); r = hdmi_power_on(dssdev); if (r) DSSERR("failed to power on device\n"); } }
int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) { struct omap_dss_output *out = dssdev->output; int r = 0; DSSDBG("ENTER hdmi_display_enable\n"); mutex_lock(&hdmi.lock); if (out == NULL || out->manager == NULL) { DSSERR("failed to enable display: no output/manager\n"); r = -ENODEV; goto err0; } hdmi.ip_data.hpd_gpio = hdmi.hpd_gpio; r = omap_dss_start_device(dssdev); if (r) { DSSERR("failed to start device\n"); goto err0; } r = hdmi_power_on(dssdev); if (r) { DSSERR("failed to power on device\n"); goto err1; } mutex_unlock(&hdmi.lock); return 0; err1: omap_dss_stop_device(dssdev); err0: mutex_unlock(&hdmi.lock); return r; }
int board_private_init(void) { unsigned int signature = 0; /* If want adjust core voltage, please enable two line below */ /* act8600_output_set(1,0x1a); soft_reset(); */ /*add board privater gpio here ,it while be called by boot_main to nitialization*/ hdmi_power_on(); /*Check the recovery signature,if exist,skip the charge_detect func.*/ signature = cpm_get_scrpad(); if ((signature == RECOVERY_SIGNATURE) || (signature == RECOVERY_SIGNATURE_SEC)) { if (signature == RECOVERY_SIGNATURE_SEC) cpm_set_scrpad(0); #if defined(CONFIG_XBOOT_LOW_BATTERY_DETECT) goto skip_chgdet; #endif } #if defined(CONFIG_XBOOT_LOW_BATTERY_DETECT) /*Usb Cable detection ,If connected ,then do charge else skip it*/ //if(charge_detect()){ if(charge_detect()&&(low_battery_detect())){ charge_logo_display(); } skip_chgdet: /*Before Enter the system,check the battery status, If low battery,then Enter the hibernate mode */ while(low_battery_detect() && !charge_detect()){ low_battery_warning(); jz_pm_do_hibernate(); } #endif }
// TODO: this is a temp debug solution static void process_dbg_opt(const char *opt) { if (0) { } else if (0 == strncmp(opt, "on", 2)) { hdmi_power_on(); } else if (0 == strncmp(opt, "off", 3)) { hdmi_power_off(); } else if (0 == strncmp(opt, "suspend", 7)) { hdmi_suspend(); } else if (0 == strncmp(opt, "resume", 6)) { hdmi_resume(); } else if (0 == strncmp(opt, "colorbar", 8)) { } else if (0 == strncmp(opt, "ldooff", 6)) { } else if (0 == strncmp(opt, "log:", 4)) { if (0 == strncmp(opt + 4, "on", 2)) { hdmi_log_enable(true); } else if (0 == strncmp(opt + 4, "off", 3)) { hdmi_log_enable(false); } else { goto Error; } } else if (0 == strncmp(opt, "fakecablein:", 12)) { if (0 == strncmp(opt + 12, "enable", 6)) { hdmi_cable_fake_plug_in(); } else if (0 == strncmp(opt + 12, "disable", 7)) { hdmi_cable_fake_plug_out(); } else { goto Error; } } else if (0 == strncmp(opt, "hdmimmp:", 8)) { if (0 == strncmp(opt + 8, "on", 2)) { hdmi_mmp_enable(1); } else if (0 == strncmp(opt + 8, "off", 3)) { hdmi_mmp_enable(0); } else if (0 == strncmp(opt + 8, "img", 3)) { hdmi_mmp_enable(7); } else { goto Error; } } else if (0 == strncmp(opt, "hdmireg", 7)) { ext_disp_diagnose(); } else if (0 == strncmp(opt, "enablehwc:", 10)) { if (0 == strncmp(opt + 10, "on", 2)) { hdmi_hwc_enable(1); } else if (0 == strncmp(opt + 10, "off", 3)) { hdmi_hwc_enable(0); } } else if (0 == strncmp(opt, "I2S1:", 5)) { #ifdef GPIO_MHL_I2S_OUT_WS_PIN if (0 == strncmp(opt + 5, "on", 2)) { printk("[hdmi][Debug] Enable I2S1 \n"); mt_set_gpio_mode(GPIO_MHL_I2S_OUT_WS_PIN, GPIO_MODE_01); mt_set_gpio_mode(GPIO_MHL_I2S_OUT_CK_PIN, GPIO_MODE_01); mt_set_gpio_mode(GPIO_MHL_I2S_OUT_DAT_PIN, GPIO_MODE_01); } else if (0 == strncmp(opt + 5, "off", 3)) { printk("[hdmi][Debug] Disable I2S1 \n"); mt_set_gpio_mode(GPIO_MHL_I2S_OUT_WS_PIN, GPIO_MODE_02); mt_set_gpio_mode(GPIO_MHL_I2S_OUT_CK_PIN, GPIO_MODE_01); mt_set_gpio_mode(GPIO_MHL_I2S_OUT_DAT_PIN, GPIO_MODE_02); } #endif } else if (0 == strncmp(opt, "I2SEnable:", 10)) { if (0 == strncmp(opt + 10, "1", 1)) { I2S_Enable = 1; } else if (0 == strncmp(opt + 10, "0", 1)) { I2S_Enable = 0; } } else if (0 == strncmp(opt, "DPI_IO_DRIVING:", 15)) { if (0 == strncmp(opt + 15, "4", 1)) { MASKREG32(DISPSYS_IO_DRIVING, 0x3C00, 0x0000); } else if (0 == strncmp(opt + 15, "8", 1)) { MASKREG32(DISPSYS_IO_DRIVING, 0x3C00, 0x1400); } else if (0 == strncmp(opt + 15, "12", 2)) { MASKREG32(DISPSYS_IO_DRIVING, 0x3C00, 0x2800); } else if (0 == strncmp(opt + 15, "16", 2)) { MASKREG32(DISPSYS_IO_DRIVING, 0x3C00, 0x3C00); } } else if (0 == strncmp(opt, "DPI_DUMP:", 9)) { if (ddp_modules_driver[DISP_MODULE_DPI]->dump_info != NULL) { ddp_modules_driver[DISP_MODULE_DPI]->dump_info(DISP_MODULE_DPI, 1); } } else if (0 == strncmp(opt, "forceon", 7)) { hdmi_force_on(false); } else { goto Error; } return; Error: printk("[hdmitx] parse command error!\n\n%s", STR_HELP); }
// TODO: this is a temp debug solution //extern void hdmi_cable_fake_plug_in(void); //extern int hdmi_drv_init(void); static void process_dbg_opt(const char *opt) { if (0) { } #if defined(CONFIG_MTK_HDMI_SUPPORT) else if (0 == strncmp(opt, "on", 2)) { hdmi_power_on(); } else if (0 == strncmp(opt, "off", 3)) { hdmi_power_off(); } else if (0 == strncmp(opt, "suspend", 7)) { hdmi_suspend(); } else if (0 == strncmp(opt, "resume", 6)) { hdmi_resume(); } else if (0 == strncmp(opt, "colorbar", 8)) { } else if (0 == strncmp(opt, "ldooff", 6)) { } else if (0 == strncmp(opt, "log:", 4)) { if (0 == strncmp(opt + 4, "on", 2)) { hdmi_log_enable(true); } else if (0 == strncmp(opt + 4, "off", 3)) { hdmi_log_enable(false); } else { goto Error; } } else if (0 == strncmp(opt, "fakecablein:", 12)) { if (0 == strncmp(opt + 12, "enable", 6)) { hdmi_cable_fake_plug_in(); } else if (0 == strncmp(opt + 12, "disable", 7)) { hdmi_cable_fake_plug_out(); } else { goto Error; } } else if (0 == strncmp(opt, "force_res:", 10)) { char *p = (char *)opt + 10; unsigned int res = (unsigned int) simple_strtoul(p, &p, 16); hdmi_force_resolution(res); } #endif else if (0 == strncmp(opt, "hdmimmp:", 8)) { if (0 == strncmp(opt + 8, "on", 2)) { hdmi_mmp_enable(1); } else if (0 == strncmp(opt + 8, "off", 3)) { hdmi_mmp_enable(0); } else if (0 == strncmp(opt + 8, "img", 3)) { hdmi_mmp_enable(7); } else { goto Error; } } else if (0 == strncmp(opt, "hdmireg", 7)) { ext_disp_diagnose(); } else if (0 == strncmp(opt, "enablehwc:", 10)) { if (0 == strncmp(opt + 10, "on", 2)) { hdmi_hwc_enable(1); } else if (0 == strncmp(opt + 10, "off", 3)) { hdmi_hwc_enable(0); } } else { goto Error; } return; Error: printk("[hdmitx] parse command error!\n\n%s", STR_HELP); }
void egl_server_platform_display(uint32_t win, KHRN_IMAGE_T *image, uint32_t cb_arg) { #ifdef DISPLAY_IS_BROKEN egl_callback(cb_arg); #else uint32_t display_width, display_height, display_zoom; VC_RECT_T dr; VC_IMAGE_T vc_image; khrn_image_fill_vcimage(image, &vc_image); if (vc_image.type == VC_IMAGE_RGBX32) vc_image.type = VC_IMAGE_RGBA32; /* XXX scalerlib can't handle it! */ #ifdef ARTS_AUTOMATION arts_display_hook(&vc_image); #endif #ifdef BLOOM VC_IMAGE_T *bloom_image; vc_image.width &= ~63; vc_image.height &= ~63; bloom_i = (bloom_i + 1) % 3; #endif if (!inited) { inited = 1; dispmanx_init(); display = dispmanx_display_open(display_num); #ifdef BLOOM vcos_assert(bloom_handle == 0); bloom_result[0] = vc_image_parmalloc(vc_image.type, "Bloom result", vc_image.width / 4, vc_image.height / 4); bloom_result[1] = vc_image_parmalloc(vc_image.type, "Bloom result", vc_image.width / 4, vc_image.height / 4); bloom_result[2] = vc_image_parmalloc(vc_image.type, "Bloom result", vc_image.width / 4, vc_image.height / 4); bloom_handle = vcbloom_genbloom(bloom_result[0]->type, vc_image.type, 25, /*0,1*/7, 29, 1, 4, 1, 0, 0); bloom_tmp = malloc(vcbloom_calctmpbuffersize(bloom_handle, bloom_result[0], &vc_image)); vcos_assert(bloom_handle != 0 && bloom_tmp != 0 && bloom_result[0] != 0 && bloom_result[1] != 0 && bloom_result[2] != 0); #endif } #ifdef BLOOM vc_image_lock(&vc_image, &vc_image); vclib_obtain_VRF(1); vcbloom_do(bloom_handle, bloom_result[bloom_i], &vc_image, bloom_tmp); vclib_release_VRF(); vc_image_unlock(&vc_image); bloom_image = bloom_result[bloom_i]; #endif #ifdef ALWAYS_HDMI frame++; //hdmi_hotplug_checker(NULL); if (display_num == 0) { #if 0 dispmanx_display_close(display); vcos_assert(display_num == 0); display_num = 2; HDMI_RES_T hdmi_res = {HDMI_RES_GROUP_DMT, /*HDMI_DMT_SWXGAP_60*//*HDMI_DMT_SWXGAP_RB*/HDMI_DMT_UXGA_60}; hdmi_hotplug_checker(NULL); //_vasm("bkpt"); hdmi_power_on(HDMI_MODE_DVI/*HDMI*/, hdmi_res, display_num); vcos_sleep(1000); #endif HDMI_RES_T best_res = {HDMI_RES_GROUP_DMT, HDMI_DMT_SWXGAP_60/*HDMI_DMT_SWXGAP_RB*/}; HDMI_MODE_T mode = HDMI_MODE_HDMI; if (1/*hdmi_get_mode() != VC_HDMI_UNPLUGGED*/) { int32_t hdmi_support; //int result = hdmi_supported_modes(&mode, &preferred_res, cea_modes, dmt_modes); //assert(result == 0); get_hdmi_best_mode(&mode, &hdmi_support, &best_res.group, &best_res.mode); #ifdef HDMI_14_3D best_res.group = HDMI_RES_GROUP_CEA; best_res.mode = HDMI_CEA_1080p60; #endif dispmanx_display_close(display); uint32_t frame_rate, interlaced; hdmi_get_screen_size(best_res, &hdmi_width, &hdmi_height, &frame_rate, &interlaced); hdmi_power_on(mode, best_res, 2); vcos_sleep(100); display_num = 2; while ((display = dispmanx_display_open(display_num)) == 0) { vcos_sleep(1000); _vasm("bkpt"); } #ifdef HDMI_14_3D { /* Set the info frame to enable 3D using half-height, full-width packed signals */ //uint8_t info_frame[HDMI_NUM_PACKET_BYTES] = {0x00, 0x03, 0x0c, 0x00, 0x40, 0x60, }; /* Set the info frame to enable 3D using full-height, half-width packed signals */ uint8_t info_frame[HDMI_NUM_PACKET_BYTES] = {0x00, 0x03, 0x0c, 0x00, 0x40, 0x80, 0x00, }; hdmi_set_infoframe(HDMI_INFOFRAME_VS, info_frame, /*5*/ 6); } #endif } } else { if (0/*hdmi_get_mode() == VC_HDMI_UNPLUGGED*/) { dispmanx_display_close(display); display_num = 0; display = dispmanx_display_open(display_num); } } #endif #ifdef PRESSING_E_PUTS_IT_ON_HDMI if (game_button_pressed(GAME_KEY_E)) { dispmanx_display_close(display); display_num ^= 2; display = dispmanx_display_open(display_num); } #endif #ifdef __VIDEOCORE4__ if (display_num) { display_width = hdmi_width; display_height = hdmi_height; display_zoom = 1; } else { display_width = 800; display_height = 480; display_zoom = 0; } #else display_width = display_num ? 1280 : 800; display_height = display_num ? 720 : 480; display_zoom = display_num ? 1 : 0; #endif DISPMANX_UPDATE_HANDLE_T update = dispmanx_update_start(0); remove_element(update, win); if (display) { uint32_t w,h; DISPMANX_ALPHA_T alpha = {DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS, 255, 0}; w = vc_image.width; h = vc_image.height; #ifdef KHRN_SIMPLE_MULTISAMPLE w /= 2; h /= 2; #endif if (display_zoom) { float zoom0 = (float)display_width / (float)w; float zoom1 = (float)display_height / (float)h; if (zoom0 < zoom1) { w = (int)(w * zoom0); h = (int)(h * zoom0); } else { w = (int)(w * zoom1); h = (int)(h * zoom1); } } dr.x = ((display_width - (UNPACK_NATIVE_WINDOW_N(win) * w)) >> 1) + (UNPACK_NATIVE_WINDOW_I(win) * w); dr.width = w; //VC_RECT_T sr = {0, 0, image->width<<8, image->height<<8}; if (h > display_height) { dr.y = 0; dr.height = display_height; } else { dr.y = display_height - h >> 1; dr.height = h; } #ifdef BLOOM add_element(dispmanx_element_add(update, display, 0, &dr, &vc_image, 0, DISPMANX_PROTECTION_NONE, &alpha, 0/*clamp*/, flip_it(&vc_image) ? DISPMANX_FLIP_VERT : DISPMANX_NO_ROTATE), win); if (bloom_amount) { alpha.opacity = bloom_amount; add_element(dispmanx_element_add(update, display, 0, &dr, bloom_image, 0, DISPMANX_PROTECTION_NONE, &alpha, 0/*clamp*/, DISPMANX_NO_ROTATE), win); } #else add_element(dispmanx_element_add(update, display, 0, &dr, &vc_image, 0, DISPMANX_PROTECTION_NONE, &alpha, 0/*clamp*/, flip_it(&vc_image) ? DISPMANX_FLIP_VERT : DISPMANX_NO_ROTATE), win); #endif } dispmanx_update_submit(update, our_callback, (void *)cb_arg); #endif }
// TODO: this is a temp debug solution //extern void hdmi_cable_fake_plug_in(void); //extern int hdmi_drv_init(void); static void process_dbg_opt(const char *opt) { if(0) { } #if defined(MTK_HDMI_SUPPORT) else if (0 == strncmp(opt, "on", 2)) { hdmi_power_on(); } else if (0 == strncmp(opt, "off", 3)) { hdmi_power_off(); } else if(0 == strncmp(opt, "suspend", 7)) { hdmi_suspend(); } else if(0 == strncmp(opt, "resume", 6)) { hdmi_resume(); } else if(0 == strncmp(opt, "colorbar", 8)) { } else if(0 == strncmp(opt, "ldooff", 6)) { } else if (0 == strncmp(opt, "log:", 4)) { if (0 == strncmp(opt + 4, "on", 2)) { hdmi_log_enable(true); } else if (0 == strncmp(opt + 4, "off", 3)) { hdmi_log_enable(false); } else { goto Error; } } else if(0 == strncmp(opt, "fakecablein:", 12)) { if (0 == strncmp(opt + 12, "enable", 6)) { hdmi_cable_fake_plug_in( ); } else if (0 == strncmp(opt + 12, "disable", 7)) { hdmi_cable_fake_plug_out( ); } else { goto Error; } } #endif else { goto Error; } return; Error: printk("[hdmitx] parse command error!\n\n%s", STR_HELP); }
// TODO: this is a temp debug solution //extern void hdmi_cable_fake_plug_in(void); //extern int hdmi_drv_init(void); static void process_dbg_opt(const char *opt) { if (0) { } #if defined(MTK_HDMI_SUPPORT) else if (0 == strncmp(opt, "on", 2)) { hdmi_power_on(); } else if (0 == strncmp(opt, "off", 3)) { hdmi_power_off(); } else if (0 == strncmp(opt, "suspend", 7)) { hdmi_suspend(); } else if (0 == strncmp(opt, "resume", 6)) { hdmi_resume(); } else if (0 == strncmp(opt, "colorbar", 8)) { } else if (0 == strncmp(opt, "ldooff", 6)) { } else if (0 == strncmp(opt, "log:", 4)) { if (0 == strncmp(opt + 4, "on", 2)) { hdmi_log_enable(true); } else if (0 == strncmp(opt + 4, "off", 3)) { hdmi_log_enable(false); } else { goto Error; } } else if (0 == strncmp(opt, "fakecablein:", 12)) { if (0 == strncmp(opt + 12, "enable", 6)) { hdmi_cable_fake_plug_in(); } else if (0 == strncmp(opt + 12, "disable", 7)) { hdmi_cable_fake_plug_out(); } else { goto Error; } } #endif else if (0 == strncmp(opt, "hdmimmp:", 8)) { if (0 == strncmp(opt + 8, "on", 2)) { hdmi_mmp_enable(1); } else if (0 == strncmp(opt + 8, "off", 3)) { hdmi_mmp_enable(0); } else if (0 == strncmp(opt + 8, "img", 3)) { hdmi_mmp_enable(7); } else if (0 == strncmp(opt + 8, "init", 4)) { init_hdmi_mmp_events(); } else { goto Error; } } else if (0 == strncmp(opt, "imgscale:", 9)) { char *p = (char *)opt + 9; unsigned int level = (unsigned int) simple_strtoul(p, &p, 3); if (level) { if (level > 10) { level = 10; } if (level < 1) { level = 1; } mmp_image_scale = level; printk("[hdmitx] imgscale set to %d\n", mmp_image_scale); } else { goto Error; } } else { goto Error; } return; Error: printk("[hdmitx] parse command error!\n\n%s", STR_HELP); }