static void config_ppi(void) { bfin_write_PPI_DELAY(PPI_DELAY_VALUE); bfin_write_PPI_COUNT(LCD_X_RES-1); /* 0x10 -> PORT_CFG -> 2 or 3 frame syncs */ bfin_write_PPI_CONTROL((PPI_CONFIG_VALUE|0x10) & (~POLS)); }
static void config_ppi(void) { bfin_write_PPI_DELAY(PPI_DELAY_VALUE); bfin_write_PPI_COUNT(LCD_X_RES-1); bfin_write_PPI_CONTROL((PPI_CONFIG_VALUE|0x10) & (~POLS)); }
/* * FUNCTION NAME: ppifcd_reg_reset * * INPUTS/OUTPUTS: * in_idev - device number , other unavailable. * VALUE RETURNED: * void * * FUNCTION(S) CALLED: * * GLOBAL VARIABLES REFERENCED: * * GLOBAL VARIABLES MODIFIED: NIL * * DESCRIPTION: Reset PPI to initialization state. * * CAUTION: */ void ppifcd_reg_reset(ppi_device_t *pdev) { /* Do some initializaion stuff here based on the defined Camera Module so we don't have to use ioctls */ bfin_clear_PPI_STATUS(); bfin_write_PPI_CONTROL(pdev->ppi_control & ~PORT_EN); bfin_write_PPI_DELAY(pdev->ppi_delay); bfin_write_PPI_COUNT(pdev->pixel_per_line - 1); bfin_write_PPI_FRAME(pdev->lines_per_frame); return; }
static int ppi_init(void) { /* Request peripheral pins for PPI */ peripheral_request_list(ppi_pins, DRIVER_NAME); /* No delay between frame sync and read */ bfin_write_PPI_DELAY(0); /* Read one sample per frame sync (the number given for COUNT is always one less than the desired count) */ bfin_write_PPI_COUNT(3); bfin_write_PPI_STATUS(0); /* PPI control mode (assert on falling edge, 14 data bits, general purpose rx with 1 frame sync */ bfin_write_PPI_CONTROL(PPI_MODE); return 0; }
/* * FUNCTION NAME: ppi_ioctl * * INPUTS/OUTPUTS: * in_inode - Description of openned file. * in_filp - Description of openned file. * in_cmd - Command passed into ioctl system call. * in/out_arg - It is parameters which is specified by last command * * RETURN: * 0 OK * -EINVAL Invalid * * FUNCTION(S) CALLED: * * GLOBAL VARIABLES REFERENCED: ppiinfo * * GLOBAL VARIABLES MODIFIED: NIL * * DESCRIPTION: * * CAUTION: */ static int ppi_ioctl(struct inode *inode, struct file *filp, uint cmd, unsigned long arg) { u_long value; ppi_device_t *pdev = filp->private_data; switch (cmd) { case CMD_PPI_SET_PIXELS_PER_LINE: { pr_debug("ppi_ioctl: CMD_PPI_SET_PIXELS_PER_LINE\n"); pdev->pixel_per_line = (unsigned short)arg; bfin_write_PPI_COUNT(pdev->pixel_per_line - 1); break; } case CMD_PPI_SET_LINES_PER_FRAME: { pr_debug("ppi_ioctl: CMD_PPI_SET_LINES_PER_FRAME\n"); pdev->lines_per_frame = (unsigned short)arg; bfin_write_PPI_FRAME(pdev->lines_per_frame); break; } case CMD_PPI_SET_PPICONTROL_REG: { pr_debug("ppi_ioctl: CMD_PPI_SET_PPICONTROL_REG\n"); pdev->ppi_control = ((unsigned short)arg) & ~PORT_EN; bfin_write_PPI_CONTROL(pdev->ppi_control); break; } case CMD_PPI_SET_PPIDEALY_REG: { pr_debug("ppi_ioctl: CMD_PPI_SET_PPIDEALY_REG\n"); pdev->ppi_delay = (unsigned short)arg; bfin_write_PPI_DELAY(pdev->ppi_delay); break; } case CMD_SET_TRIGGER_GPIO: { pr_debug("ppi_ioctl: CMD_SET_TRIGGER_GPIO\n"); pdev->ppi_trigger_gpio = (unsigned short)arg; if (pdev->ppi_trigger_gpio == NO_TRIGGER) { break; } if (gpio_request(pdev->ppi_trigger_gpio, PPI_DEVNAME)) { printk(KERN_ERR"Requesting GPIO %d faild\n", pdev->ppi_trigger_gpio); return -EFAULT; } gpio_direction_output(pdev->ppi_trigger_gpio, 0); break; } case CMD_PPI_GET_ALLCONFIG: { break; } case CMD_PPI_GET_SYSTEMCLOCK: { value = get_sclk(); pr_debug ("ppi_ioctl: CMD_PPI_GET_SYSTEMCLOCK SCLK: %d \n", (int)value); copy_to_user((unsigned long *)arg, &value, sizeof(unsigned long)); break; } default: return -EINVAL; } return 0; }