void zylonite_enable_lcd_pins(void) { mhn_mfp_set_configs(zylonite_lcd_pins, ARRAY_SIZE(zylonite_lcd_pins)); if (lcd_id & 0x20) { /* OLED/VGA/QVGA panel */ mhn_gpio_set_direction(MFP_L_DD_17, GPIO_DIR_OUT); mhn_gpio_set_direction(MFP_L_VSYNC, GPIO_DIR_OUT); if(lcd_id & 0x01) { /* REV1.2 Lead_free panel */ mhn_gpio_set_level(MFP_L_DD_17, GPIO_LEVEL_LOW); #ifdef CONFIG_FB_PXA_LCD_QVGA /* force L_V_SYNC (MODE) HIGH */ mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_HIGH); #endif #ifdef CONFIG_FB_PXA_LCD_VGA /* force L_V_SYNC (MODE) LOW */ mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_LOW); #endif } else { /* REV1.1 Lead panel */ mhn_mfp_set_afds(MFP_L_BIAS, MFP_AF0, MFP_DS01X); mhn_gpio_set_direction(MFP_L_BIAS, GPIO_DIR_OUT); mhn_gpio_set_level(MFP_L_BIAS, GPIO_LEVEL_LOW); mhn_gpio_set_level(MFP_L_DD_17, GPIO_LEVEL_LOW); #ifdef CONFIG_FB_PXA_LCD_QVGA /* force L_V_SYNC (MODE) LOW */ mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_LOW); #endif #ifdef CONFIG_FB_PXA_LCD_VGA /* force L_V_SYNC (MODE) HIGH */ mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_HIGH); #endif } } }
static void zylonite_irda_transceiver_mode(struct device *dev, int mode) { unsigned long flags; static int irda_mfp_init = 0; if (!irda_mfp_init) { printk(KERN_INFO "zylonite_irda_transceiver_mode: init\n"); mhn_mfp_set_afds(MFP_CIR_ON_PWM, MFP_AF0, MFP_DS03X); mhn_mfp_set_afds(MFP_IR_SHDN_N_GPIO, MFP_AF0, MFP_DS03X); mhn_gpio_set_direction(MFP_CIR_ON_PWM, GPIO_DIR_OUT); mhn_gpio_set_direction(MFP_IR_SHDN_N_GPIO, GPIO_DIR_OUT); mhn_gpio_set_level(MFP_CIR_ON_PWM, 0); mhn_gpio_set_level(MFP_IR_SHDN_N_GPIO, 1); irda_mfp_init = 1; } local_irq_save(flags); if (mode & IR_SIRMODE) { printk(KERN_INFO "zylonite_irda_transceiver_mode: SIR\n"); mhn_gpio_set_level(MFP_CIR_ON_PWM, 0); mhn_gpio_set_level(MFP_IR_SHDN_N_GPIO, 0); } else if (mode & IR_FIRMODE) { /* do not support FIR */ } if (mode & IR_OFF) { printk(KERN_INFO "zylonite_irda_transceiver_mode: OFF\n"); mhn_gpio_set_level(MFP_CIR_ON_PWM, 0); mhn_gpio_set_level(MFP_IR_SHDN_N_GPIO, 1); } local_irq_restore(flags); }
void zylonite_enable_lcd_smart_pins(void) { mhn_mfp_set_configs(zylonite_lcd_smart_pins, ARRAY_SIZE(zylonite_lcd_smart_pins)); mhn_gpio_set_direction(MFP_L_DD_17, GPIO_DIR_OUT); mhn_gpio_set_direction(MFP_L_VSYNC, GPIO_DIR_OUT); mhn_gpio_set_level(MFP_L_DD_17, GPIO_LEVEL_HIGH); mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_LOW); }
void zylonite_enable_u2d_pins(void) { #if defined(CONFIG_PXA300) mhn_gpio_set_direction(MFP_UTMI_SWITCH, GPIO_DIR_OUT); mhn_gpio_set_level(MFP_UTMI_SWITCH, GPIO_LEVEL_HIGH); mhn_gpio_set_direction(MFP_UTMI_TEST_EN, GPIO_DIR_OUT); mhn_gpio_set_level(MFP_UTMI_TEST_EN, GPIO_LEVEL_LOW); #elif defined(CONFIG_PXA310) mhn_gpio_set_direction(MFP_ULPI_RESET, GPIO_DIR_OUT); mhn_gpio_set_level(MFP_ULPI_RESET, GPIO_LEVEL_HIGH); mhn_mfp_set_afds(MFP_PIN_ULPI_STP, 0, 0); mhn_mfp_set_afds(MFP_PIN_ULPI_DIR, 0, 0); mhn_mfp_set_afds(MFP_PIN_ULPI_NXT, 0, 0); #endif mhn_mfp_set_configs(zylonite_u2d_pins, ARRAY_SIZE(zylonite_u2d_pins)); }
static void pxafb_detect_lcd_panel(void) { unsigned int id = 0, i; uint32_t lcd_detect_saved_mfpr[NUM_LCD_DETECT_PINS]; /* save the original MFP settings */ for (i = 0; i < NUM_LCD_DETECT_PINS; i++) lcd_detect_saved_mfpr[i] = MFP_REG(lcd_detect_pins[i]); for (i = 0; i < NUM_LCD_DETECT_PINS; i++) MFP_REG(lcd_detect_pins[i]) = lcd_detect_pins_mfpr[i]; MFP_REG(lcd_detect_pins[i - 1]); /* set detect pins as gpio input */ for (i = 0; i < 7;i++){ mhn_gpio_set_direction(lcd_detect_pins[i], GPIO_DIR_IN); } /* get LCD ID */ id = 0; id = (mhn_gpio_get_level(lcd_detect_pins[LCD_L_VSYNC]) << 0) | (mhn_gpio_get_level(lcd_detect_pins[LCD_L_CS]) << 1) | (mhn_gpio_get_level(lcd_detect_pins[LCD_L_FCLK]) << 2) | (mhn_gpio_get_level(lcd_detect_pins[LCD_L_LCLK]) << 3) | (mhn_gpio_get_level(lcd_detect_pins[LCD_L_BIAS]) << 4) | (mhn_gpio_get_level(lcd_detect_pins[LCD_L_DD_16]) << 5); /* lcd id, flush out bit 1 */ lcd_id = id & 0x3D; /* lcd orientation, portrait or landscape */ lcd_orient = mhn_gpio_get_level(lcd_detect_pins[LCD_L_DD_17]); for (i = 0; i < NUM_LCD_DETECT_PINS; i++) MFP_REG(lcd_detect_pins[i]) = lcd_detect_saved_mfpr[i]; MFP_REG(lcd_detect_pins[i - 1]); }
static int zylonite_mci_init(struct device *dev, irqreturn_t (*zylonite_detect_int)(int, void *, struct pt_regs *), void *data) { int err; struct platform_device *pdev = to_platform_device(dev); /* * setup GPIO for Zylonite MMC controller */ if (pdev->id == 0) { zylonite_enable_mmc1_pins(); #ifndef CONFIG_PXA3xx_MMC2 /* set direction of CD/WP to IN */ mhn_gpio_set_direction(MFP_MMC_CD_0_GPIO, GPIO_DIR_IN); mhn_gpio_set_direction(MFP_MMC_WP_0_N_GPIO, GPIO_DIR_IN); /* CD is configured to Falling/Rising Edge detect */ mhn_gpio_set_falling_edge_detect(MFP_MMC_CD_0_GPIO, 1); mhn_gpio_set_rising_edge_detect (MFP_MMC_CD_0_GPIO, 1); err = request_irq(MMC1_CD0, zylonite_detect_int, 0, "MMC card detect slot 1", data); if (err) { printk(KERN_ERR "MMC/SD: can't request MMC card detect" " IRQ for slot 1\n"); return -1; } set_irq_type(MMC1_CD0, IRQT_BOTHEDGE); #else /* set direction of CD/WP to IN */ mhn_gpio_set_direction(MFP_MMC_CD_1_GPIO, GPIO_DIR_IN); mhn_gpio_set_direction(MFP_MMC_WP_1_N_GPIO, GPIO_DIR_IN); /* CD is configured to Falling/Rising Edge detect */ mhn_gpio_set_falling_edge_detect(MFP_MMC_CD_1_GPIO, 1); mhn_gpio_set_rising_edge_detect (MFP_MMC_CD_1_GPIO, 1); err = request_irq(MMC1_CD1, zylonite_detect_int, 0, "MMC card detect slot 2", data); if (err) { printk(KERN_ERR "MMC/SD: can't request MMC card detect" " IRQ for slot 2\n"); return -1; } set_irq_type(MMC1_CD1, IRQT_BOTHEDGE); #endif } #ifdef CONFIG_PXA310_MMC3 /* 3d MMC/SD slot on Monahans LV */ else if (pdev->id == 1) { zylonite_enable_mmc3_pins(); /* set direction of CD/WP to IN */ mhn_gpio_set_direction(MFP_MMC_CD_3_GPIO, GPIO_DIR_IN); mhn_gpio_set_direction(MFP_MMC_WP_3_N_GPIO, GPIO_DIR_IN); /* CD is configured to Falling/Rising Edge detect */ mhn_gpio_set_falling_edge_detect(MFP_MMC_CD_3_GPIO, 1); mhn_gpio_set_rising_edge_detect (MFP_MMC_CD_3_GPIO, 1); err = request_irq(MMC1_CD3, zylonite_detect_int, 0, "MMC card detect slot 3", data); if (err) { printk(KERN_ERR "MMC/SD: can't request MMC card detect" "IRQ for slot 3\n"); return -1; } set_irq_type(MMC1_CD3, IRQT_BOTHEDGE); } #endif return 0; }
static void zylonite_backlight_power(int on) { /* MFP for MFP_BACKLIGHT_PWM is supposed to be configured */ mhn_gpio_set_direction(MFP_BACKLIGHT_PWM, GPIO_DIR_OUT); mhn_gpio_set_level(MFP_BACKLIGHT_PWM, on); }
void zylonite_enable_gpio_exp_pins(void) { mhn_mfp_set_configs(gpio_exp_pins, ARRAY_SIZE(gpio_exp_pins)); mhn_gpio_set_direction(MFP_GPIO_EXP_0_N, GPIO_DIR_IN); mhn_gpio_set_direction(MFP_GPIO_EXP_1_N, GPIO_DIR_IN); }
int mcam_init(p_camera_context_t camera_context) { int status = 0; #ifdef DEBUG_PARAM_CHECK /* parameter check */ if (camera_context->sensor_type > CAMERA_TYPE_MAX) return -EINVAL; /* check the function dispatch table according to the sensor type */ if (!camera_context->camera_functions) return -EINVAL; if (!camera_context->camera_functions->init || !camera_context->camera_functions->deinit || !camera_context->camera_functions->set_capture_format || !camera_context->camera_functions->start_capture || !camera_context->camera_functions->stop_capture) return -EINVAL; #endif /* initialize some camera used parameters */ camera_context->capture_input_width = 0; camera_context->capture_input_height = 0; camera_context->capture_output_width = 0; camera_context->capture_output_height = 0; camera_context->capture_input_format = CAMERA_IMAGE_FORMAT_MAX + 1; camera_context->capture_output_format = CAMERA_IMAGE_FORMAT_MAX + 1; camera_context->fifo0_transfer_size = 0; camera_context->fifo1_transfer_size = 0; camera_context->fifo2_transfer_size = 0; camera_context->fifo3_transfer_size = 0; camera_context->video_fifo0_transfer_size = 0; camera_context->video_fifo1_transfer_size = 0; camera_context->video_fifo2_transfer_size = 0; camera_context->still_fifo0_transfer_size = 0; camera_context->still_fifo1_transfer_size = 0; camera_context->still_fifo2_transfer_size = 0; camera_context->frame_buffer_number = 0; camera_context->video_capture_buffer_queue.head = NULL; camera_context->video_capture_buffer_queue.tail = NULL; camera_context->still_capture_buffer_queue.head = NULL; camera_context->still_capture_buffer_queue.tail = NULL; camera_context->psu_enable = 0; camera_context->cgu_enable = 0; camera_context->ssu_scale = CI_SSU_SCALE_DISABLE; camera_context->cmu_usage = CI_CMU_DISABLE; camera_context->dma_running = 0; /* MFP pins init */ zylonite_enable_cif_pins(); /* UTMI_SWITCH must be set to low and * the UTMI_TEST_EN should be set to output (low) */ mhn_gpio_set_direction(MFP_UTMI_SWITCH, GPIO_DIR_OUT); mhn_gpio_set_direction(MFP_UTMI_TEST_EN, GPIO_DIR_OUT); mhn_gpio_set_level(MFP_UTMI_SWITCH, GPIO_LEVEL_LOW); mhn_gpio_set_level(MFP_UTMI_TEST_EN, GPIO_LEVEL_HIGH); /* set two gpio pin direction as output * to control the power of two sensors. */ mhn_gpio_set_direction(MFP_CIF_HI_PWDN_GPI0, GPIO_DIR_OUT); mhn_gpio_set_direction(MFP_CIF_LO_PWDN_GPI0, GPIO_DIR_OUT); /* set two gpio pin output as HI to power off two sensors. */ mhn_gpio_set_level(MFP_CIF_HI_PWDN_GPI0, GPIO_LEVEL_HIGH); mhn_gpio_set_level(MFP_CIF_LO_PWDN_GPI0, GPIO_LEVEL_HIGH); /* capture interface init */ ci_init(); /* sensor init */ status = camera_context->camera_functions->init(camera_context); if (status) { goto camera_init_err; } /* set frame rate */ mcam_set_capture_frame_rate(camera_context); return 0; camera_init_err: mcam_deinit(camera_context); return -EIO; }