您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ v4l2_ctrl_new_std函数代码示例

51自学网 2021-06-03 09:29:29
  C++
这篇教程C++ v4l2_ctrl_new_std函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中v4l2_ctrl_new_std函数的典型用法代码示例。如果您正苦于以下问题:C++ v4l2_ctrl_new_std函数的具体用法?C++ v4l2_ctrl_new_std怎么用?C++ v4l2_ctrl_new_std使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了v4l2_ctrl_new_std函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gsc_ctrls_create

int gsc_ctrls_create(struct gsc_ctx *ctx){	if (ctx->ctrls_rdy) {		pr_err("Control handler of this context was created already");		return 0;	}	v4l2_ctrl_handler_init(&ctx->ctrl_handler, GSC_MAX_CTRL_NUM);	ctx->gsc_ctrls.rotate = v4l2_ctrl_new_std(&ctx->ctrl_handler,				&gsc_ctrl_ops, V4L2_CID_ROTATE, 0, 270, 90, 0);	ctx->gsc_ctrls.hflip = v4l2_ctrl_new_std(&ctx->ctrl_handler,				&gsc_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0);	ctx->gsc_ctrls.vflip = v4l2_ctrl_new_std(&ctx->ctrl_handler,				&gsc_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0);	ctx->gsc_ctrls.global_alpha = v4l2_ctrl_new_std(&ctx->ctrl_handler,			&gsc_ctrl_ops, V4L2_CID_ALPHA_COMPONENT, 0, 255, 1, 0);	ctx->ctrls_rdy = ctx->ctrl_handler.error == 0;	if (ctx->ctrl_handler.error) {		int err = ctx->ctrl_handler.error;		v4l2_ctrl_handler_free(&ctx->ctrl_handler);		pr_err("Failed to create G-Scaler control handlers");		return err;	}	return 0;}
开发者ID:ezequielgarcia,项目名称:linux,代码行数:29,


示例2: adv748x_afe_init_controls

static int adv748x_afe_init_controls(struct adv748x_afe *afe){	struct adv748x_state *state = adv748x_afe_to_state(afe);	v4l2_ctrl_handler_init(&afe->ctrl_hdl, 5);	/* Use our mutex for the controls */	afe->ctrl_hdl.lock = &state->mutex;	v4l2_ctrl_new_std(&afe->ctrl_hdl, &adv748x_afe_ctrl_ops,			  V4L2_CID_BRIGHTNESS, ADV748X_SDP_BRI_MIN,			  ADV748X_SDP_BRI_MAX, 1, ADV748X_SDP_BRI_DEF);	v4l2_ctrl_new_std(&afe->ctrl_hdl, &adv748x_afe_ctrl_ops,			  V4L2_CID_CONTRAST, ADV748X_SDP_CON_MIN,			  ADV748X_SDP_CON_MAX, 1, ADV748X_SDP_CON_DEF);	v4l2_ctrl_new_std(&afe->ctrl_hdl, &adv748x_afe_ctrl_ops,			  V4L2_CID_SATURATION, ADV748X_SDP_SAT_MIN,			  ADV748X_SDP_SAT_MAX, 1, ADV748X_SDP_SAT_DEF);	v4l2_ctrl_new_std(&afe->ctrl_hdl, &adv748x_afe_ctrl_ops,			  V4L2_CID_HUE, ADV748X_SDP_HUE_MIN,			  ADV748X_SDP_HUE_MAX, 1, ADV748X_SDP_HUE_DEF);	v4l2_ctrl_new_std_menu_items(&afe->ctrl_hdl, &adv748x_afe_ctrl_ops,				     V4L2_CID_TEST_PATTERN,				     ARRAY_SIZE(afe_ctrl_frp_menu) - 1,				     0, 0, afe_ctrl_frp_menu);	afe->sd.ctrl_handler = &afe->ctrl_hdl;	if (afe->ctrl_hdl.error) {		v4l2_ctrl_handler_free(&afe->ctrl_hdl);		return afe->ctrl_hdl.error;	}	return v4l2_ctrl_handler_setup(&afe->ctrl_hdl);}
开发者ID:SantoshShilimkar,项目名称:linux,代码行数:35,


示例3: g2d_setup_ctrls

static int g2d_setup_ctrls(struct g2d_ctx *ctx){	struct g2d_dev *dev = ctx->dev;	v4l2_ctrl_handler_init(&ctx->ctrl_handler, 3);	ctx->ctrl_hflip = v4l2_ctrl_new_std(&ctx->ctrl_handler, &g2d_ctrl_ops,						V4L2_CID_HFLIP, 0, 1, 1, 0);	ctx->ctrl_vflip = v4l2_ctrl_new_std(&ctx->ctrl_handler, &g2d_ctrl_ops,						V4L2_CID_VFLIP, 0, 1, 1, 0);	v4l2_ctrl_new_std_menu(		&ctx->ctrl_handler,		&g2d_ctrl_ops,		V4L2_CID_COLORFX,		V4L2_COLORFX_NEGATIVE,		~((1 << V4L2_COLORFX_NONE) | (1 << V4L2_COLORFX_NEGATIVE)),		V4L2_COLORFX_NONE);	if (ctx->ctrl_handler.error) {		int err = ctx->ctrl_handler.error;		v4l2_err(&dev->v4l2_dev, "g2d_setup_ctrls failed/n");		v4l2_ctrl_handler_free(&ctx->ctrl_handler);		return err;	}	v4l2_ctrl_cluster(2, &ctx->ctrl_hflip);	return 0;}
开发者ID:7799,项目名称:linux,代码行数:31,


示例4: ov7660_init_controls

int ov7660_init_controls(struct sd *sd){	struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler;	sd->gspca_dev.vdev.ctrl_handler = hdl;	v4l2_ctrl_handler_init(hdl, 6);	v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_AUTO_WHITE_BALANCE,			  0, 1, 1, 1);	v4l2_ctrl_new_std_menu(hdl, &ov7660_ctrl_ops,			  V4L2_CID_EXPOSURE_AUTO, 1, 0, V4L2_EXPOSURE_AUTO);	sd->autogain = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops,					 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);	sd->gain = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_GAIN, 0,				     255, 1, OV7660_DEFAULT_GAIN);	sd->hflip = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_HFLIP,				      0, 1, 1, 0);	sd->vflip = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_VFLIP,				      0, 1, 1, 0);	if (hdl->error) {		pr_err("Could not initialize controls/n");		return hdl->error;	}	v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false);	v4l2_ctrl_cluster(2, &sd->hflip);	return 0;}
开发者ID:020gzh,项目名称:linux,代码行数:32,


示例5: adv7180_init_controls

static int adv7180_init_controls(struct adv7180_state *state){	v4l2_ctrl_handler_init(&state->ctrl_hdl, 4);	v4l2_ctrl_new_std(&state->ctrl_hdl, &adv7180_ctrl_ops,			  V4L2_CID_BRIGHTNESS, ADV7180_BRI_MIN,			  ADV7180_BRI_MAX, 1, ADV7180_BRI_DEF);	v4l2_ctrl_new_std(&state->ctrl_hdl, &adv7180_ctrl_ops,			  V4L2_CID_CONTRAST, ADV7180_CON_MIN,			  ADV7180_CON_MAX, 1, ADV7180_CON_DEF);	v4l2_ctrl_new_std(&state->ctrl_hdl, &adv7180_ctrl_ops,			  V4L2_CID_SATURATION, ADV7180_SAT_MIN,			  ADV7180_SAT_MAX, 1, ADV7180_SAT_DEF);	v4l2_ctrl_new_std(&state->ctrl_hdl, &adv7180_ctrl_ops,			  V4L2_CID_HUE, ADV7180_HUE_MIN,			  ADV7180_HUE_MAX, 1, ADV7180_HUE_DEF);	v4l2_ctrl_new_custom(&state->ctrl_hdl, &adv7180_ctrl_fast_switch, NULL);	state->sd.ctrl_handler = &state->ctrl_hdl;	if (state->ctrl_hdl.error) {		int err = state->ctrl_hdl.error;		v4l2_ctrl_handler_free(&state->ctrl_hdl);		return err;	}	v4l2_ctrl_handler_setup(&state->ctrl_hdl);	return 0;}
开发者ID:020gzh,项目名称:linux,代码行数:29,


示例6: s5k83a_init_controls

int s5k83a_init_controls(struct sd *sd){	struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler;	sd->gspca_dev.vdev.ctrl_handler = hdl;	v4l2_ctrl_handler_init(hdl, 6);	v4l2_ctrl_new_std(hdl, &s5k83a_ctrl_ops, V4L2_CID_BRIGHTNESS,			  0, 255, 1, S5K83A_DEFAULT_BRIGHTNESS);	v4l2_ctrl_new_std(hdl, &s5k83a_ctrl_ops, V4L2_CID_EXPOSURE,			  0, S5K83A_MAXIMUM_EXPOSURE, 1,			  S5K83A_DEFAULT_EXPOSURE);	v4l2_ctrl_new_std(hdl, &s5k83a_ctrl_ops, V4L2_CID_GAIN,			  0, 255, 1, S5K83A_DEFAULT_GAIN);	sd->hflip = v4l2_ctrl_new_std(hdl, &s5k83a_ctrl_ops, V4L2_CID_HFLIP,				      0, 1, 1, 0);	sd->vflip = v4l2_ctrl_new_std(hdl, &s5k83a_ctrl_ops, V4L2_CID_VFLIP,				      0, 1, 1, 0);	if (hdl->error) {		pr_err("Could not initialize controls/n");		return hdl->error;	}	v4l2_ctrl_cluster(2, &sd->hflip);	return 0;}
开发者ID:stsp,项目名称:BeholdT8,代码行数:31,


示例7: m5mols_init_controls

/* * m5mols_init_controls - initialization using v4l2_ctrl. */static int m5mols_init_controls(struct m5mols_info *info){	struct v4l2_subdev *sd = &info->sd;	struct i2c_client *client = v4l2_get_subdevdata(sd);	u16 max_ex_mon;	int ret;	/* check minimum & maximum of M5MOLS controls */	ret = i2c_r16_ae(sd, CAT3_MAX_GAIN_MON, (u32 *)&max_ex_mon);	if (ret)		return ret;	/* set the controls using v4l2 control frameworks */	v4l2_ctrl_handler_init(&info->handle, 9);	info->colorfx = v4l2_ctrl_new_std_menu(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_COLORFX,			9, 1, V4L2_COLORFX_NONE);	info->autoexposure = v4l2_ctrl_new_std_menu(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_EXPOSURE_AUTO,			1, 0, V4L2_EXPOSURE_AUTO);	info->exposure = v4l2_ctrl_new_std(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_EXPOSURE,			0, max_ex_mon, 1, (int)max_ex_mon/2);	info->autofocus = v4l2_ctrl_new_std(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_FOCUS_AUTO,			0, 1, 1, 0);	info->autowb = v4l2_ctrl_new_std(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_AUTO_WHITE_BALANCE,			0, 1, 1, 1);	info->saturation = v4l2_ctrl_new_std(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_SATURATION,			0, 6, 1, 3);	info->zoom = v4l2_ctrl_new_std(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_ZOOM_ABSOLUTE,			0, 70, 1, 0);	info->jpeg_size = v4l2_ctrl_new_custom(&info->handle,			&ctrl_private[0],			NULL);	info->encoded_size = v4l2_ctrl_new_custom(&info->handle,			&ctrl_private[1],			NULL);	sd->ctrl_handler = &info->handle;	if (info->handle.error) {		dev_err(&client->dev, "Failed to init controls, %d/n", ret);		v4l2_ctrl_handler_free(&info->handle);		return info->handle.error;	}	v4l2_ctrl_cluster(2, &info->autoexposure);	/* If above ctrl value is not good image, so it is better that not set */	v4l2_ctrl_handler_setup(&info->handle);	return 0;}
开发者ID:bs771,项目名称:android_kernel_samsung_manta,代码行数:60,


示例8: wpf_init_controls

static int wpf_init_controls(struct vsp1_rwpf *wpf){	struct vsp1_device *vsp1 = wpf->entity.vsp1;	unsigned int num_flip_ctrls;	spin_lock_init(&wpf->flip.lock);	if (wpf->entity.index != 0) {		/* Only WPF0 supports flipping. */		num_flip_ctrls = 0;	} else if (vsp1->info->features & VSP1_HAS_WPF_HFLIP) {		/* When horizontal flip is supported the WPF implements two		 * controls (horizontal flip and vertical flip).		 */		num_flip_ctrls = 2;	} else if (vsp1->info->features & VSP1_HAS_WPF_VFLIP) {		/* When only vertical flip is supported the WPF implements a		 * single control (vertical flip).		 */		num_flip_ctrls = 1;	} else {		/* Otherwise flipping is not supported. */		num_flip_ctrls = 0;	}	vsp1_rwpf_init_ctrls(wpf, num_flip_ctrls);	if (num_flip_ctrls >= 1) {		wpf->flip.ctrls[WPF_CTRL_VFLIP] =			v4l2_ctrl_new_std(&wpf->ctrls, &vsp1_wpf_ctrl_ops,					  V4L2_CID_VFLIP, 0, 1, 1, 0);	}	if (num_flip_ctrls == 2) {		wpf->flip.ctrls[WPF_CTRL_HFLIP] =			v4l2_ctrl_new_std(&wpf->ctrls, &vsp1_wpf_ctrl_ops,					  V4L2_CID_HFLIP, 0, 1, 1, 0);		v4l2_ctrl_cluster(2, wpf->flip.ctrls);	}	if (wpf->ctrls.error) {		dev_err(vsp1->dev, "wpf%u: failed to initialize controls/n",			wpf->entity.index);		return wpf->ctrls.error;	}	return 0;}
开发者ID:AK101111,项目名称:linux,代码行数:49,


示例9: fmr2_tea_ext_init

static int fmr2_tea_ext_init(struct snd_tea575x *tea){	struct fmr2 *fmr2 = tea->private_data;	if (inb(fmr2->io) & FMR2_HASVOL) {		fmr2->volume = v4l2_ctrl_new_std(&tea->ctrl_handler, &fmr2_ctrl_ops, V4L2_CID_AUDIO_VOLUME, 0, 68, 2, 56);		fmr2->balance = v4l2_ctrl_new_std(&tea->ctrl_handler, &fmr2_ctrl_ops, V4L2_CID_AUDIO_BALANCE, -68, 68, 2, 0);		if (tea->ctrl_handler.error) {			printk(KERN_ERR "radio-sf16fmr2: can't initialize controls/n");			return tea->ctrl_handler.error;		}	}	return 0;}
开发者ID:kprog,项目名称:linux,代码行数:15,


示例10: ivtv_gpio_init

int ivtv_gpio_init(struct ivtv *itv){	u16 pin = 0;	if (itv->card->xceive_pin)		pin = 1 << itv->card->xceive_pin;	if ((itv->card->gpio_init.direction | pin) == 0)		return 0;	IVTV_DEBUG_INFO("GPIO initial dir: %08x out: %08x/n",		   read_reg(IVTV_REG_GPIO_DIR), read_reg(IVTV_REG_GPIO_OUT));	/* init output data then direction */	write_reg(itv->card->gpio_init.initial_value | pin, IVTV_REG_GPIO_OUT);	write_reg(itv->card->gpio_init.direction | pin, IVTV_REG_GPIO_DIR);	v4l2_subdev_init(&itv->sd_gpio, &subdev_ops);	snprintf(itv->sd_gpio.name, sizeof(itv->sd_gpio.name), "%s-gpio", itv->v4l2_dev.name);	itv->sd_gpio.grp_id = IVTV_HW_GPIO;	v4l2_ctrl_handler_init(&itv->hdl_gpio, 1);	v4l2_ctrl_new_std(&itv->hdl_gpio, &gpio_ctrl_ops,			V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0);	if (itv->hdl_gpio.error)		return itv->hdl_gpio.error;	itv->sd_gpio.ctrl_handler = &itv->hdl_gpio;	v4l2_ctrl_handler_setup(&itv->hdl_gpio);	return v4l2_device_register_subdev(&itv->v4l2_dev, &itv->sd_gpio);}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:28,


示例11: trust_initialize

static int trust_initialize(struct radio_isa_card *isa){	struct trust *tr = container_of(isa, struct trust, isa);	tr->ioval = 0xf;	write_i2c(tr, 2, TDA7318_ADDR, 0x80);	/* speaker att. LF = 0 dB */	write_i2c(tr, 2, TDA7318_ADDR, 0xa0);	/* speaker att. RF = 0 dB */	write_i2c(tr, 2, TDA7318_ADDR, 0xc0);	/* speaker att. LR = 0 dB */	write_i2c(tr, 2, TDA7318_ADDR, 0xe0);	/* speaker att. RR = 0 dB */	write_i2c(tr, 2, TDA7318_ADDR, 0x40);	/* stereo 1 input, gain = 18.75 dB */	v4l2_ctrl_new_std(&isa->hdl, &trust_ctrl_ops,				V4L2_CID_AUDIO_BASS, 0, 15, 1, 8);	v4l2_ctrl_new_std(&isa->hdl, &trust_ctrl_ops,				V4L2_CID_AUDIO_TREBLE, 0, 15, 1, 8);	return isa->hdl.error;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:17,


示例12: m5mols_init_controls

static int m5mols_init_controls(struct m5mols_info *info){	struct v4l2_subdev *sd = &info->sd;	u16 max_exposure;	u16 step_zoom;	int ret;	/* Determine value's range & step of controls for various FW version */	ret = m5mols_read_u16(sd, AE_MAX_GAIN_MON, &max_exposure);	if (!ret)		step_zoom = is_manufacturer(info, REG_SAMSUNG_OPTICS) ? 31 : 1;	if (ret)		return ret;	v4l2_ctrl_handler_init(&info->handle, 6);	info->autowb = v4l2_ctrl_new_std(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_AUTO_WHITE_BALANCE,			0, 1, 1, 0);	info->saturation = v4l2_ctrl_new_std(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_SATURATION,			1, 5, 1, 3);	info->zoom = v4l2_ctrl_new_std(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_ZOOM_ABSOLUTE,			1, 70, step_zoom, 1);	info->exposure = v4l2_ctrl_new_std(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_EXPOSURE,			0, max_exposure, 1, (int)max_exposure/2);	info->colorfx = v4l2_ctrl_new_std_menu(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_COLORFX,			4, (1 << V4L2_COLORFX_BW), V4L2_COLORFX_NONE);	info->autoexposure = v4l2_ctrl_new_std_menu(&info->handle,			&m5mols_ctrl_ops, V4L2_CID_EXPOSURE_AUTO,			1, 0, V4L2_EXPOSURE_MANUAL);	sd->ctrl_handler = &info->handle;	if (info->handle.error) {		v4l2_err(sd, "Failed to initialize controls: %d/n", ret);		v4l2_ctrl_handler_free(&info->handle);		return info->handle.error;	}	v4l2_ctrl_cluster(2, &info->autoexposure);	return 0;}
开发者ID:303750856,项目名称:linux-3.1,代码行数:45,


示例13: devm_kzalloc

struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index){	struct v4l2_subdev *subdev;	struct vsp1_rwpf *rpf;	int ret;	rpf = devm_kzalloc(vsp1->dev, sizeof(*rpf), GFP_KERNEL);	if (rpf == NULL)		return ERR_PTR(-ENOMEM);	rpf->ops = &rpf_vdev_ops;	rpf->max_width = RPF_MAX_WIDTH;	rpf->max_height = RPF_MAX_HEIGHT;	rpf->entity.type = VSP1_ENTITY_RPF;	rpf->entity.index = index;	ret = vsp1_entity_init(vsp1, &rpf->entity, 2);	if (ret < 0)		return ERR_PTR(ret);	/* Initialize the V4L2 subdev. */	subdev = &rpf->entity.subdev;	v4l2_subdev_init(subdev, &rpf_ops);	subdev->entity.ops = &vsp1->media_ops;	subdev->internal_ops = &vsp1_subdev_internal_ops;	snprintf(subdev->name, sizeof(subdev->name), "%s rpf.%u",		 dev_name(vsp1->dev), index);	v4l2_set_subdevdata(subdev, rpf);	subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;	vsp1_entity_init_formats(subdev, NULL);	/* Initialize the control handler. */	v4l2_ctrl_handler_init(&rpf->ctrls, 1);	rpf->alpha = v4l2_ctrl_new_std(&rpf->ctrls, &rpf_ctrl_ops,				       V4L2_CID_ALPHA_COMPONENT,				       0, 255, 1, 255);	rpf->entity.subdev.ctrl_handler = &rpf->ctrls;	if (rpf->ctrls.error) {		dev_err(vsp1->dev, "rpf%u: failed to initialize controls/n",			index);		ret = rpf->ctrls.error;		goto error;	}	return rpf;error:	vsp1_entity_destroy(&rpf->entity);	return ERR_PTR(ret);}
开发者ID:020gzh,项目名称:linux,代码行数:56,


示例14: ov9640_probe

/* * i2c_driver function */static int ov9640_probe(struct i2c_client *client,			const struct i2c_device_id *did){	struct ov9640_priv *priv;	struct soc_camera_link *icl = soc_camera_i2c_to_link(client);	int ret;	if (!icl) {		dev_err(&client->dev, "Missing platform_data for driver/n");		return -EINVAL;	}	priv = kzalloc(sizeof(struct ov9640_priv), GFP_KERNEL);	if (!priv) {		dev_err(&client->dev,			"Failed to allocate memory for private data!/n");		return -ENOMEM;	}	v4l2_i2c_subdev_init(&priv->subdev, client, &ov9640_subdev_ops);	v4l2_ctrl_handler_init(&priv->hdl, 2);	v4l2_ctrl_new_std(&priv->hdl, &ov9640_ctrl_ops,			V4L2_CID_VFLIP, 0, 1, 1, 0);	v4l2_ctrl_new_std(&priv->hdl, &ov9640_ctrl_ops,			V4L2_CID_HFLIP, 0, 1, 1, 0);	priv->subdev.ctrl_handler = &priv->hdl;	if (priv->hdl.error) {		int err = priv->hdl.error;		kfree(priv);		return err;	}	ret = ov9640_video_probe(client);	if (ret) {		v4l2_ctrl_handler_free(&priv->hdl);		kfree(priv);	}	return ret;}
开发者ID:125radheyshyam,项目名称:linux,代码行数:46,


示例15: adp1653_init_controls

static int adp1653_init_controls(struct adp1653_flash *flash){	struct v4l2_ctrl *fault;	v4l2_ctrl_handler_init(&flash->ctrls, 9);	flash->led_mode =		v4l2_ctrl_new_std_menu(&flash->ctrls, &adp1653_ctrl_ops,				       V4L2_CID_FLASH_LED_MODE,				       V4L2_FLASH_LED_MODE_TORCH, ~0x7, 0);	v4l2_ctrl_new_std_menu(&flash->ctrls, &adp1653_ctrl_ops,			       V4L2_CID_FLASH_STROBE_SOURCE,			       V4L2_FLASH_STROBE_SOURCE_SOFTWARE, ~0x1, 0);	v4l2_ctrl_new_std(&flash->ctrls, &adp1653_ctrl_ops,			  V4L2_CID_FLASH_STROBE, 0, 0, 0, 0);	v4l2_ctrl_new_std(&flash->ctrls, &adp1653_ctrl_ops,			  V4L2_CID_FLASH_STROBE_STOP, 0, 0, 0, 0);	flash->flash_timeout =		v4l2_ctrl_new_std(&flash->ctrls, &adp1653_ctrl_ops,				  V4L2_CID_FLASH_TIMEOUT, TIMEOUT_MIN,				  flash->platform_data->max_flash_timeout,				  TIMEOUT_STEP,				  flash->platform_data->max_flash_timeout);	flash->flash_intensity =		v4l2_ctrl_new_std(&flash->ctrls, &adp1653_ctrl_ops,				  V4L2_CID_FLASH_INTENSITY,				  ADP1653_FLASH_INTENSITY_MIN,				  flash->platform_data->max_flash_intensity,				  1, flash->platform_data->max_flash_intensity);	flash->torch_intensity =		v4l2_ctrl_new_std(&flash->ctrls, &adp1653_ctrl_ops,				  V4L2_CID_FLASH_TORCH_INTENSITY,				  ADP1653_TORCH_INTENSITY_MIN,				  flash->platform_data->max_torch_intensity,				  ADP1653_FLASH_INTENSITY_STEP,				  flash->platform_data->max_torch_intensity);	flash->indicator_intensity =		v4l2_ctrl_new_std(&flash->ctrls, &adp1653_ctrl_ops,				  V4L2_CID_FLASH_INDICATOR_INTENSITY,				  ADP1653_INDICATOR_INTENSITY_MIN,				  flash->platform_data->max_indicator_intensity,				  ADP1653_INDICATOR_INTENSITY_STEP,				  ADP1653_INDICATOR_INTENSITY_MIN);	fault = v4l2_ctrl_new_std(&flash->ctrls, &adp1653_ctrl_ops,				  V4L2_CID_FLASH_FAULT, 0,				  V4L2_FLASH_FAULT_OVER_VOLTAGE				  | V4L2_FLASH_FAULT_OVER_TEMPERATURE				  | V4L2_FLASH_FAULT_SHORT_CIRCUIT, 0, 0);	if (flash->ctrls.error)		return flash->ctrls.error;	fault->flags |= V4L2_CTRL_FLAG_VOLATILE;	flash->subdev.ctrl_handler = &flash->ctrls;	return 0;}
开发者ID:AirShark,项目名称:android_kernel_lenovo_redhookbay,代码行数:57,


示例16: ov9640_probe

/* * i2c_driver function */static int ov9640_probe(struct i2c_client *client,			const struct i2c_device_id *did){	struct ov9640_priv *priv;	struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);	int ret;	if (!ssdd) {		dev_err(&client->dev, "Missing platform_data for driver/n");		return -EINVAL;	}	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);	if (!priv)		return -ENOMEM;	v4l2_i2c_subdev_init(&priv->subdev, client, &ov9640_subdev_ops);	v4l2_ctrl_handler_init(&priv->hdl, 2);	v4l2_ctrl_new_std(&priv->hdl, &ov9640_ctrl_ops,			V4L2_CID_VFLIP, 0, 1, 1, 0);	v4l2_ctrl_new_std(&priv->hdl, &ov9640_ctrl_ops,			V4L2_CID_HFLIP, 0, 1, 1, 0);	priv->subdev.ctrl_handler = &priv->hdl;	if (priv->hdl.error)		return priv->hdl.error;	priv->clk = v4l2_clk_get(&client->dev, "mclk");	if (IS_ERR(priv->clk)) {		ret = PTR_ERR(priv->clk);		goto eclkget;	}	ret = ov9640_video_probe(client);	if (ret) {		v4l2_clk_put(priv->clk);eclkget:		v4l2_ctrl_handler_free(&priv->hdl);	}	return ret;}
开发者ID:Lyude,项目名称:linux,代码行数:45,


示例17: lm3560_init_controls

static int lm3560_init_controls(struct lm3560_flash *flash,				enum lm3560_led_id led_no){	struct v4l2_ctrl *fault;	u32 max_flash_brt = flash->pdata->max_flash_brt[led_no];	u32 max_torch_brt = flash->pdata->max_torch_brt[led_no];	struct v4l2_ctrl_handler *hdl = &flash->ctrls_led[led_no];	const struct v4l2_ctrl_ops *ops = &lm3560_led_ctrl_ops[led_no];	v4l2_ctrl_handler_init(hdl, 8);	/* flash mode */	v4l2_ctrl_new_std_menu(hdl, ops, V4L2_CID_FLASH_LED_MODE,			       V4L2_FLASH_LED_MODE_TORCH, ~0x7,			       V4L2_FLASH_LED_MODE_NONE);	flash->led_mode = V4L2_FLASH_LED_MODE_NONE;	/* flash source */	v4l2_ctrl_new_std_menu(hdl, ops, V4L2_CID_FLASH_STROBE_SOURCE,			       0x1, ~0x3, V4L2_FLASH_STROBE_SOURCE_SOFTWARE);	/* flash strobe */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_STROBE, 0, 0, 0, 0);	/* flash strobe stop */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_STROBE_STOP, 0, 0, 0, 0);	/* flash strobe timeout */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_TIMEOUT,			  LM3560_FLASH_TOUT_MIN,			  flash->pdata->max_flash_timeout,			  LM3560_FLASH_TOUT_STEP,			  flash->pdata->max_flash_timeout);	/* flash brt */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_INTENSITY,			  LM3560_FLASH_BRT_MIN, max_flash_brt,			  LM3560_FLASH_BRT_STEP, max_flash_brt);	/* torch brt */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_TORCH_INTENSITY,			  LM3560_TORCH_BRT_MIN, max_torch_brt,			  LM3560_TORCH_BRT_STEP, max_torch_brt);	/* fault */	fault = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_FAULT, 0,				  V4L2_FLASH_FAULT_OVER_VOLTAGE				  | V4L2_FLASH_FAULT_OVER_TEMPERATURE				  | V4L2_FLASH_FAULT_SHORT_CIRCUIT				  | V4L2_FLASH_FAULT_TIMEOUT, 0, 0);	if (fault != NULL)		fault->flags |= V4L2_CTRL_FLAG_VOLATILE;	if (hdl->error)		return hdl->error;	flash->subdev_led[led_no].ctrl_handler = hdl;	return 0;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:59,


示例18: ad5823_init_controls

static int ad5823_init_controls(struct ad5823 *vcm){    struct v4l2_ctrl *ctrl;    v4l2_ctrl_handler_init(&vcm->ctrls, 1);    /* V4L2_CID_FOCUS_ABSOLUTE */    ctrl = v4l2_ctrl_new_std(&vcm->ctrls, &ad5823_ctrl_ops,                             V4L2_CID_FOCUS_ABSOLUTE, 0, (1<<16)-1, 1, 0x8000);    if (ctrl != NULL)        ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;    vcm->subdev.ctrl_handler = &vcm->ctrls;    return vcm->ctrls.error;}
开发者ID:dflow81,项目名称:android_kernel_samsung_goyawifi,代码行数:13,


示例19: bdisp_ctrls_create

static int bdisp_ctrls_create(struct bdisp_ctx *ctx){	if (ctx->ctrls_rdy)		return 0;	v4l2_ctrl_handler_init(&ctx->ctrl_handler, BDISP_MAX_CTRL_NUM);	ctx->bdisp_ctrls.hflip = v4l2_ctrl_new_std(&ctx->ctrl_handler,				&bdisp_c_ops, V4L2_CID_HFLIP, 0, 1, 1, 0);	ctx->bdisp_ctrls.vflip = v4l2_ctrl_new_std(&ctx->ctrl_handler,				&bdisp_c_ops, V4L2_CID_VFLIP, 0, 1, 1, 0);	if (ctx->ctrl_handler.error) {		int err = ctx->ctrl_handler.error;		v4l2_ctrl_handler_free(&ctx->ctrl_handler);		return err;	}	ctx->ctrls_rdy = true;	return 0;}
开发者ID:AK101111,项目名称:linux,代码行数:23,


示例20: lm3646_init_controls

static int lm3646_init_controls(struct lm3646_flash *flash){	struct v4l2_ctrl *fault;	struct v4l2_ctrl_handler *hdl = &flash->ctrls_led;	const struct v4l2_ctrl_ops *ops = &lm3646_led_ctrl_ops;	v4l2_ctrl_handler_init(hdl, 8);	/* flash mode */	v4l2_ctrl_new_std_menu(hdl, ops, V4L2_CID_FLASH_LED_MODE,			       V4L2_FLASH_LED_MODE_TORCH, ~0x7,			       V4L2_FLASH_LED_MODE_NONE);	/* flash source */	v4l2_ctrl_new_std_menu(hdl, ops, V4L2_CID_FLASH_STROBE_SOURCE,			       0x1, ~0x3, V4L2_FLASH_STROBE_SOURCE_SOFTWARE);	/* flash strobe */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_STROBE, 0, 0, 0, 0);	/* flash strobe stop */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_STROBE_STOP, 0, 0, 0, 0);	/* flash strobe timeout */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_TIMEOUT,			  LM3646_FLASH_TOUT_MIN,			  LM3646_FLASH_TOUT_MAX,			  LM3646_FLASH_TOUT_STEP, flash->pdata->flash_timeout);	/* max flash current */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_INTENSITY,			  LM3646_TOTAL_FLASH_BRT_MIN,			  LM3646_TOTAL_FLASH_BRT_MAX,			  LM3646_TOTAL_FLASH_BRT_STEP,			  LM3646_TOTAL_FLASH_BRT_MAX);	/* max torch current */	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_TORCH_INTENSITY,			  LM3646_TOTAL_TORCH_BRT_MIN,			  LM3646_TOTAL_TORCH_BRT_MAX,			  LM3646_TOTAL_TORCH_BRT_STEP,			  LM3646_TOTAL_TORCH_BRT_MAX);	/* fault */	fault = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_FAULT, 0,				  V4L2_FLASH_FAULT_OVER_VOLTAGE				  | V4L2_FLASH_FAULT_OVER_TEMPERATURE				  | V4L2_FLASH_FAULT_SHORT_CIRCUIT				  | V4L2_FLASH_FAULT_TIMEOUT, 0, 0);	if (fault != NULL)		fault->flags |= V4L2_CTRL_FLAG_VOLATILE;	if (hdl->error)		return hdl->error;	flash->subdev_led.ctrl_handler = hdl;	return 0;}
开发者ID:Anjali05,项目名称:linux,代码行数:56,


示例21: devm_kzalloc

struct vsp1_brx *vsp1_brx_create(struct vsp1_device *vsp1,				 enum vsp1_entity_type type){	struct vsp1_brx *brx;	unsigned int num_pads;	const char *name;	int ret;	brx = devm_kzalloc(vsp1->dev, sizeof(*brx), GFP_KERNEL);	if (brx == NULL)		return ERR_PTR(-ENOMEM);	brx->base = type == VSP1_ENTITY_BRU ? VI6_BRU_BASE : VI6_BRS_BASE;	brx->entity.ops = &brx_entity_ops;	brx->entity.type = type;	if (type == VSP1_ENTITY_BRU) {		num_pads = vsp1->info->num_bru_inputs + 1;		name = "bru";	} else {		num_pads = 3;		name = "brs";	}	ret = vsp1_entity_init(vsp1, &brx->entity, name, num_pads, &brx_ops,			       MEDIA_ENT_F_PROC_VIDEO_COMPOSER);	if (ret < 0)		return ERR_PTR(ret);	/* Initialize the control handler. */	v4l2_ctrl_handler_init(&brx->ctrls, 1);	v4l2_ctrl_new_std(&brx->ctrls, &brx_ctrl_ops, V4L2_CID_BG_COLOR,			  0, 0xffffff, 1, 0);	brx->bgcolor = 0;	brx->entity.subdev.ctrl_handler = &brx->ctrls;	if (brx->ctrls.error) {		dev_err(vsp1->dev, "%s: failed to initialize controls/n", name);		ret = brx->ctrls.error;		vsp1_entity_destroy(&brx->entity);		return ERR_PTR(ret);	}	return brx;}
开发者ID:Lyude,项目名称:linux,代码行数:47,


示例22: devm_kzalloc

struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1){	struct v4l2_subdev *subdev;	struct vsp1_bru *bru;	int ret;	bru = devm_kzalloc(vsp1->dev, sizeof(*bru), GFP_KERNEL);	if (bru == NULL)		return ERR_PTR(-ENOMEM);	bru->entity.type = VSP1_ENTITY_BRU;	ret = vsp1_entity_init(vsp1, &bru->entity,			       vsp1->info->num_bru_inputs + 1);	if (ret < 0)		return ERR_PTR(ret);	/* Initialize the V4L2 subdev. */	subdev = &bru->entity.subdev;	v4l2_subdev_init(subdev, &bru_ops);	subdev->entity.ops = &vsp1->media_ops;	subdev->internal_ops = &vsp1_subdev_internal_ops;	snprintf(subdev->name, sizeof(subdev->name), "%s bru",		 dev_name(vsp1->dev));	v4l2_set_subdevdata(subdev, bru);	subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;	vsp1_entity_init_formats(subdev, NULL);	/* Initialize the control handler. */	v4l2_ctrl_handler_init(&bru->ctrls, 1);	v4l2_ctrl_new_std(&bru->ctrls, &bru_ctrl_ops, V4L2_CID_BG_COLOR,			  0, 0xffffff, 1, 0);	bru->entity.subdev.ctrl_handler = &bru->ctrls;	if (bru->ctrls.error) {		dev_err(vsp1->dev, "bru: failed to initialize controls/n");		ret = bru->ctrls.error;		vsp1_entity_destroy(&bru->entity);		return ERR_PTR(ret);	}	return bru;}
开发者ID:020gzh,项目名称:linux,代码行数:46,


示例23: mtk_vcodec_enc_ctrls_setup

int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx){	const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;	struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;	v4l2_ctrl_handler_init(handler, MTK_MAX_CTRLS_HINT);	v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_BITRATE,			1, 4000000, 1, 4000000);	v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_B_FRAMES,			0, 2, 1, 0);	v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE,			0, 1, 1, 1);	v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_H264_MAX_QP,			0, 51, 1, 51);	v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_H264_I_PERIOD,			0, 65535, 1, 0);	v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_GOP_SIZE,			0, 65535, 1, 0);	v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE,			0, 1, 1, 0);	v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME,			0, 0, 0, 0);	v4l2_ctrl_new_std_menu(handler, ops,			V4L2_CID_MPEG_VIDEO_HEADER_MODE,			V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME,			0, V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE);	v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_PROFILE,			V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,			0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH);	v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL,			V4L2_MPEG_VIDEO_H264_LEVEL_4_2,			0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);	if (handler->error) {		mtk_v4l2_err("Init control handler fail %d",				handler->error);		return handler->error;	}	v4l2_ctrl_handler_setup(&ctx->ctrl_hdl);	return 0;}
开发者ID:avagin,项目名称:linux,代码行数:43,


示例24: rockchip_vpu_ctrls_setup

static int rockchip_vpu_ctrls_setup(struct rockchip_vpu_dev *vpu,				    struct rockchip_vpu_ctx *ctx){	v4l2_ctrl_handler_init(&ctx->ctrl_handler, 1);	if (vpu->variant->codec & RK_VPU_CODEC_JPEG) {		v4l2_ctrl_new_std(&ctx->ctrl_handler, &rockchip_vpu_ctrl_ops,				  V4L2_CID_JPEG_COMPRESSION_QUALITY,				  5, 100, 1, 50);		if (ctx->ctrl_handler.error) {			vpu_err("Adding JPEG control failed %d/n",				ctx->ctrl_handler.error);			v4l2_ctrl_handler_free(&ctx->ctrl_handler);			return ctx->ctrl_handler.error;		}	}	return v4l2_ctrl_handler_setup(&ctx->ctrl_handler);}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:18,


示例25: register_v4l2_device

static int register_v4l2_device(void){  int ret;  struct fmdev *fmdev = NULL;	struct video_device *radio = video_device_alloc();	if (!radio)	{		TROUT_PRINT("Could not allocate video_device");		return -EINVAL;	}	strlcpy(radio->name, DRIVER_NAME, sizeof(radio->name));	radio->fops = &trout_fops;	radio->release = video_device_release;	radio->ioctl_ops = &trout_ioctl_ops;	if (video_register_device(radio, VFL_TYPE_RADIO, -1))	{		TROUT_PRINT("Could not register video_device");		video_device_release(radio);	  return -EINVAL;	}  s_radio = radio;  fmdev = (struct fmdev *)kzalloc(sizeof(struct fmdev), GFP_KERNEL);  if (!fmdev)  {    TROUT_PRINT("Could not allocate fmdev");    return -EINVAL;  }  video_set_drvdata(radio, fmdev);  radio->ctrl_handler = &fmdev->ctrl_handler;  ret = v4l2_ctrl_handler_init(&fmdev->ctrl_handler, 1);  if (ret < 0)  {    TROUT_PRINT("Failed to int v4l2_ctrl_handler");    v4l2_ctrl_handler_free(&fmdev->ctrl_handler);    return -EINVAL;  }  v4l2_ctrl_new_std(&fmdev->ctrl_handler, &trout_ctrl_ops,      V4L2_CID_PRIVATE_FM_AUDIO, 0, 1, 1, 0);	TROUT_PRINT("Registered Trout FM Receiver.");	return 0;}
开发者ID:abgoyal,项目名称:alcatel_ot_4020D_kernel,代码行数:43,


示例26: devm_kzalloc

struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1){	struct vsp1_bru *bru;	int ret;	bru = devm_kzalloc(vsp1->dev, sizeof(*bru), GFP_KERNEL);	if (bru == NULL)		return ERR_PTR(-ENOMEM);	bru->entity.ops = &bru_entity_ops;	bru->entity.type = VSP1_ENTITY_BRU;	ret = vsp1_entity_init(vsp1, &bru->entity, "bru",			       vsp1->info->num_bru_inputs + 1, &bru_ops,			       MEDIA_ENT_F_PROC_VIDEO_COMPOSER);	if (ret < 0)		return ERR_PTR(ret);	/* Initialize the control handler. */	v4l2_ctrl_handler_init(&bru->ctrls, 1);	v4l2_ctrl_new_std(&bru->ctrls, &bru_ctrl_ops, V4L2_CID_BG_COLOR,			  0, 0xffffff, 1, 0);	bru->bgcolor = 0;	bru->entity.subdev.ctrl_handler = &bru->ctrls;	if (bru->ctrls.error) {		dev_err(vsp1->dev, "bru: failed to initialize controls/n");		ret = bru->ctrls.error;		vsp1_entity_destroy(&bru->entity);		return ERR_PTR(ret);	}	return bru;}
开发者ID:AshishNamdev,项目名称:linux,代码行数:36,


示例27: mt9m111_init_controls

int mt9m111_init_controls(struct sd *sd){	struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler;	sd->gspca_dev.vdev.ctrl_handler = hdl;	v4l2_ctrl_handler_init(hdl, 7);	sd->auto_white_bal = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops,					       V4L2_CID_AUTO_WHITE_BALANCE,					       0, 1, 1, 0);	sd->green_bal = v4l2_ctrl_new_custom(hdl, &mt9m111_greenbal_cfg, NULL);	sd->red_bal = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops,					V4L2_CID_RED_BALANCE, 0, 0x7ff, 1,					MT9M111_RED_GAIN_DEFAULT);	sd->blue_bal = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops,					V4L2_CID_BLUE_BALANCE, 0, 0x7ff, 1,					MT9M111_BLUE_GAIN_DEFAULT);	v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops, V4L2_CID_GAIN, 0,			  (INITIAL_MAX_GAIN - 1) * 2 * 2 * 2, 1,			  MT9M111_DEFAULT_GAIN);	sd->hflip = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops, V4L2_CID_HFLIP,				      0, 1, 1, 0);	sd->vflip = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops, V4L2_CID_VFLIP,				      0, 1, 1, 0);	if (hdl->error) {		pr_err("Could not initialize controls/n");		return hdl->error;	}	v4l2_ctrl_auto_cluster(4, &sd->auto_white_bal, 0, false);	v4l2_ctrl_cluster(2, &sd->hflip);	return 0;}
开发者ID:03199618,项目名称:linux,代码行数:37,


示例28: v4l2_flash_init_controls

static int v4l2_flash_init_controls(struct v4l2_flash *v4l2_flash,				struct v4l2_flash_config *flash_cfg){	struct v4l2_flash_ctrl_data *ctrl_init_data;	struct v4l2_ctrl *ctrl;	struct v4l2_ctrl_config *ctrl_cfg;	int i, ret, num_ctrls = 0;	v4l2_flash->ctrls = devm_kcalloc(v4l2_flash->sd.dev,					STROBE_SOURCE + 1,					sizeof(*v4l2_flash->ctrls),					GFP_KERNEL);	if (!v4l2_flash->ctrls)		return -ENOMEM;	/* allocate memory dynamically so as not to exceed stack frame size */	ctrl_init_data = kcalloc(NUM_FLASH_CTRLS, sizeof(*ctrl_init_data),					GFP_KERNEL);	if (!ctrl_init_data)		return -ENOMEM;	__fill_ctrl_init_data(v4l2_flash, flash_cfg, ctrl_init_data);	for (i = 0; i < NUM_FLASH_CTRLS; ++i)		if (ctrl_init_data[i].cid)			++num_ctrls;	v4l2_ctrl_handler_init(&v4l2_flash->hdl, num_ctrls);	for (i = 0; i < NUM_FLASH_CTRLS; ++i) {		ctrl_cfg = &ctrl_init_data[i].config;		if (!ctrl_init_data[i].cid)			continue;		if (ctrl_cfg->id == V4L2_CID_FLASH_LED_MODE ||		    ctrl_cfg->id == V4L2_CID_FLASH_STROBE_SOURCE)			ctrl = v4l2_ctrl_new_std_menu(&v4l2_flash->hdl,						&v4l2_flash_ctrl_ops,						ctrl_cfg->id,						ctrl_cfg->max,						ctrl_cfg->menu_skip_mask,						ctrl_cfg->def);		else			ctrl = v4l2_ctrl_new_std(&v4l2_flash->hdl,						&v4l2_flash_ctrl_ops,						ctrl_cfg->id,						ctrl_cfg->min,						ctrl_cfg->max,						ctrl_cfg->step,						ctrl_cfg->def);		if (ctrl)			ctrl->flags |= ctrl_cfg->flags;		if (i <= STROBE_SOURCE)			v4l2_flash->ctrls[i] = ctrl;	}	kfree(ctrl_init_data);	if (v4l2_flash->hdl.error) {		ret = v4l2_flash->hdl.error;		goto error_free_handler;	}	v4l2_ctrl_handler_setup(&v4l2_flash->hdl);	v4l2_flash->sd.ctrl_handler = &v4l2_flash->hdl;	return 0;error_free_handler:	v4l2_ctrl_handler_free(&v4l2_flash->hdl);	return ret;}
开发者ID:Lyude,项目名称:linux,代码行数:76,


示例29: pwc_init_controls

int pwc_init_controls(struct pwc_device *pdev){	struct v4l2_ctrl_handler *hdl;	struct v4l2_ctrl_config cfg;	int r, def;	hdl = &pdev->ctrl_handler;	r = v4l2_ctrl_handler_init(hdl, 20);	if (r)		return r;	/* Brightness, contrast, saturation, gamma */	r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, BRIGHTNESS_FORMATTER, &def);	if (r || def > 127)		def = 63;	pdev->brightness = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops,				V4L2_CID_BRIGHTNESS, 0, 127, 1, def);	r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, CONTRAST_FORMATTER, &def);	if (r || def > 63)		def = 31;	pdev->contrast = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops,				V4L2_CID_CONTRAST, 0, 63, 1, def);	if (pdev->type >= 675) {		if (pdev->type < 730)			pdev->saturation_fmt = SATURATION_MODE_FORMATTER2;		else			pdev->saturation_fmt = SATURATION_MODE_FORMATTER1;		r = pwc_get_s8_ctrl(pdev, GET_CHROM_CTL, pdev->saturation_fmt,				    &def);		if (r || def < -100 || def > 100)			def = 0;		pdev->saturation = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops,				      V4L2_CID_SATURATION, -100, 100, 1, def);	}	r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, GAMMA_FORMATTER, &def);	if (r || def > 31)		def = 15;	pdev->gamma = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops,				V4L2_CID_GAMMA, 0, 31, 1, def);	/* auto white balance, red gain, blue gain */	r = pwc_get_u8_ctrl(pdev, GET_CHROM_CTL, WB_MODE_FORMATTER, &def);	if (r || def > awb_auto)		def = awb_auto;	cfg = pwc_auto_white_balance_cfg;	cfg.name = v4l2_ctrl_get_name(cfg.id);	cfg.def = def;	pdev->auto_white_balance = v4l2_ctrl_new_custom(hdl, &cfg, NULL);	/* check auto controls to avoid NULL deref in v4l2_ctrl_auto_cluster */	if (!pdev->auto_white_balance)		return hdl->error;	r = pwc_get_u8_ctrl(pdev, GET_CHROM_CTL,			    PRESET_MANUAL_RED_GAIN_FORMATTER, &def);	if (r)		def = 127;	pdev->red_balance = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops,				V4L2_CID_RED_BALANCE, 0, 255, 1, def);	r = pwc_get_u8_ctrl(pdev, GET_CHROM_CTL,			    PRESET_MANUAL_BLUE_GAIN_FORMATTER, &def);	if (r)		def = 127;	pdev->blue_balance = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops,				V4L2_CID_BLUE_BALANCE, 0, 255, 1, def);	v4l2_ctrl_auto_cluster(3, &pdev->auto_white_balance, awb_manual, true);	/* autogain, gain */	r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, AGC_MODE_FORMATTER, &def);	if (r || (def != 0 && def != 0xff))		def = 0;	/* Note a register value if 0 means auto gain is on */	pdev->autogain = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops,				V4L2_CID_AUTOGAIN, 0, 1, 1, def == 0);	if (!pdev->autogain)		return hdl->error;	r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, PRESET_AGC_FORMATTER, &def);	if (r || def > 63)		def = 31;	pdev->gain = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops,				V4L2_CID_GAIN, 0, 63, 1, def);	/* auto exposure, exposure */	if (DEVICE_USE_CODEC2(pdev->type)) {		r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, SHUTTER_MODE_FORMATTER,				    &def);		if (r || (def != 0 && def != 0xff))			def = 0;		/*		 * def = 0 auto, def = ff manual		 * menu idx 0 = auto, idx 1 = manual		 */		pdev->exposure_auto = v4l2_ctrl_new_std_menu(hdl,					&pwc_ctrl_ops,					V4L2_CID_EXPOSURE_AUTO,//.........这里部分代码省略.........
开发者ID:03199618,项目名称:linux,代码行数:101,


示例30: si470x_usb_driver_probe

/* * si470x_usb_driver_probe - probe for the device */static int si470x_usb_driver_probe(struct usb_interface *intf,		const struct usb_device_id *id){	struct si470x_device *radio;	struct usb_host_interface *iface_desc;	struct usb_endpoint_descriptor *endpoint;	int i, int_end_size, retval = 0;	unsigned char version_warning = 0;	/* private data allocation and initialization */	radio = kzalloc(sizeof(struct si470x_device), GFP_KERNEL);	if (!radio) {		retval = -ENOMEM;		goto err_initial;	}	radio->usb_buf = kmalloc(MAX_REPORT_SIZE, GFP_KERNEL);	if (radio->usb_buf == NULL) {		retval = -ENOMEM;		goto err_radio;	}	radio->usbdev = interface_to_usbdev(intf);	radio->intf = intf;	radio->band = 1; /* Default to 76 - 108 MHz */	mutex_init(&radio->lock);	init_completion(&radio->completion);	iface_desc = intf->cur_altsetting;	/* Set up interrupt endpoint information. */	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {		endpoint = &iface_desc->endpoint[i].desc;		if (usb_endpoint_is_int_in(endpoint))			radio->int_in_endpoint = endpoint;	}	if (!radio->int_in_endpoint) {		dev_info(&intf->dev, "could not find interrupt in endpoint/n");		retval = -EIO;		goto err_usbbuf;	}	int_end_size = le16_to_cpu(radio->int_in_endpoint->wMaxPacketSize);	radio->int_in_buffer = kmalloc(int_end_size, GFP_KERNEL);	if (!radio->int_in_buffer) {		dev_info(&intf->dev, "could not allocate int_in_buffer");		retval = -ENOMEM;		goto err_usbbuf;	}	radio->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);	if (!radio->int_in_urb) {		retval = -ENOMEM;		goto err_intbuffer;	}	radio->v4l2_dev.release = si470x_usb_release;	/*	 * The si470x SiLabs reference design uses the same USB IDs as	 * 'Thanko's Raremono' si4734 based receiver. So check here which we	 * have: attempt to read the device ID from the si470x: the lower 12	 * bits should be 0x0242 for the si470x.	 *	 * We use this check to determine which device we are dealing with.	 */	if (id->idVendor == 0x10c4 && id->idProduct == 0x818a) {		retval = usb_control_msg(radio->usbdev,				usb_rcvctrlpipe(radio->usbdev, 0),				HID_REQ_GET_REPORT,				USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,				1, 2,				radio->usb_buf, 3, 500);		if (retval != 3 ||		    (get_unaligned_be16(&radio->usb_buf[1]) & 0xfff) != 0x0242) {			dev_info(&intf->dev, "this is not a si470x device./n");			retval = -ENODEV;			goto err_urb;		}	}	retval = v4l2_device_register(&intf->dev, &radio->v4l2_dev);	if (retval < 0) {		dev_err(&intf->dev, "couldn't register v4l2_device/n");		goto err_urb;	}	v4l2_ctrl_handler_init(&radio->hdl, 2);	v4l2_ctrl_new_std(&radio->hdl, &si470x_ctrl_ops,			  V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);	v4l2_ctrl_new_std(&radio->hdl, &si470x_ctrl_ops,			  V4L2_CID_AUDIO_VOLUME, 0, 15, 1, 15);	if (radio->hdl.error) {		retval = radio->hdl.error;		dev_err(&intf->dev, "couldn't register control/n");		goto err_dev;	}	radio->videodev = si470x_viddev_template;//.........这里部分代码省略.........
开发者ID:AshishNamdev,项目名称:linux,代码行数:101,



注:本文中的v4l2_ctrl_new_std函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ v4l2_dbg函数代码示例
C++ v4l2_ctrl_handler_init函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。