/** * vpbe_set_output - Set output * @vpbe_dev - vpbe device ptr * @index - index of output * * Set vpbe output to the output specified by the index */ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) { struct encoder_config_info *curr_enc_info = vpbe_current_encoder_info(vpbe_dev); struct vpbe_config *cfg = vpbe_dev->cfg; struct venc_platform_data *venc_device = vpbe_dev->venc_device; enum v4l2_mbus_pixelcode if_params; int enc_out_index; int sd_index; int ret = 0; if (index >= cfg->num_outputs) return -EINVAL; mutex_lock(&vpbe_dev->lock); sd_index = vpbe_dev->current_sd_index; enc_out_index = cfg->outputs[index].output.index; /* * Currently we switch the encoder based on output selected * by the application. If media controller is implemented later * there is will be an API added to setup_link between venc * and external encoder. So in that case below comparison always * match and encoder will not be switched. But if application * chose not to use media controller, then this provides current * way of switching encoder at the venc output. */ if (strcmp(curr_enc_info->module_name, cfg->outputs[index].subdev_name)) { /* Need to switch the encoder at the output */ sd_index = vpbe_find_encoder_sd_index(cfg, index); if (sd_index < 0) { ret = -EINVAL; goto out; } if_params = cfg->outputs[index].if_params; venc_device->setup_if_config(if_params); if (ret) goto out; } /* Set output at the encoder */ ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, s_routing, 0, enc_out_index, 0); if (ret) goto out; /* * It is assumed that venc or extenal encoder will set a default * mode in the sub device. For external encoder or LCD pannel output, * we also need to set up the lcd port for the required mode. So setup * the lcd port for the default mode that is configured in the board * arch/arm/mach-davinci/board-dm355-evm.setup file for the external * encoder. */ ret = vpbe_get_mode_info(vpbe_dev, cfg->outputs[index].default_mode, index); if (!ret) { struct osd_s
/** * vpbe_set_output - Set output * @vpbe_dev - vpbe device ptr * @index - index of output * * Set vpbe output to the output specified by the index */ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) { struct vpbe_display_config *vpbe_config = vpbe_dev->cfg; struct encoder_config_info *curr_enc_info = vpbe_current_encoder_info(vpbe_dev); int ret = 0, enc_out_index = 0, sd_index; int lcd_index = 0; enum v4l2_mbus_pixelcode if_params; if (index >= vpbe_config->num_outputs) return -EINVAL; mutex_lock(&vpbe_dev->lock); sd_index = vpbe_dev->current_sd_index; enc_out_index = vpbe_config->outputs[index].output.index; /* * Currently we switch the encoder based on output selected * by the application. If media controller is implemented later * there is will be an API added to setup_link between venc * and external encoder. So in that case below comparison always * match and encoder will not be switched. But if application * chose not to use media controller, then this provides current * way of switching encoder at the venc output. */ if (strcmp(curr_enc_info->module_name, vpbe_config->outputs[index].subdev_name)) { /* Need to switch the encoder at the output */ sd_index = vpbe_find_encoder_sd_index(vpbe_config, index); if (sd_index < 0) { ret = -EINVAL; goto out; } } if_params = vpbe_config->outputs[index].if_params; venc_device->setup_if_config(if_params); if (!ret) venc_device->if_params = if_params; /* VENC dac selection only if it is non-lcd case */ lcd_index = vpbe_config->num_outputs - venc_device->num_lcd_outputs; if (vpbe_config->outputs[index].output.index < lcd_index) { /* Set output at the encoder */ ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, s_routing, 0, enc_out_index, 0); if (ret) goto out; } /* * It is assumed that venc or extenal encoder will set a default * mode in the sub device. For external encoder or LCD pannel output, * we also need to set up the lcd port for the required mode. So setup * the lcd port for the default mode that is configured in the board * arch/arm/mach-davinci/board-dm355-evm.setup file for the external * encoder. */ ret = vpbe_get_mode_info(vpbe_dev, vpbe_config->outputs[index].default_mode, index); /* * set the lcd controller output for the given mode. For internal dac * outputs, this wouldn't do anything. */ if (!ret) { ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], core, ioctl, VENC_CONFIGURE, &vpbe_dev->current_timings); if (!ret) { osd_device->ops.set_left_margin(osd_device, vpbe_dev->current_timings.left_margin); osd_device->ops.set_top_margin(osd_device, vpbe_dev->current_timings.upper_margin); vpbe_dev->current_sd_index = sd_index; vpbe_dev->current_out_index = index; } } out: mutex_unlock(&vpbe_dev->lock); return ret; }