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

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

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

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

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

示例1: adv7180_probe

static int adv7180_probe(struct i2c_client *client,			 const struct i2c_device_id *id){	struct adv7180_state *state;	struct v4l2_subdev *sd;	int ret;	/* Check if the adapter supports the needed features */	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))		return -EIO;	v4l_info(client, "chip found @ 0x%02x (%s)/n",		 client->addr, client->adapter->name);	state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);	if (state == NULL)		return -ENOMEM;	state->irq = client->irq;	mutex_init(&state->mutex);	state->autodetect = true;	state->powered = true;	state->input = 0;	sd = &state->sd;	v4l2_i2c_subdev_init(sd, client, &adv7180_ops);	ret = adv7180_init_controls(state);	if (ret)		goto err_unreg_subdev;	ret = init_device(client, state);	if (ret)		goto err_free_ctrl;	ret = v4l2_async_register_subdev(sd);	if (ret)		goto err_free_irq;	return 0;err_free_irq:	if (state->irq > 0)		free_irq(client->irq, state);err_free_ctrl:	adv7180_exit_controls(state);err_unreg_subdev:	mutex_destroy(&state->mutex);	return ret;}
开发者ID:kvaster,项目名称:linux_media,代码行数:48,


示例2: mt9v011_probe

static int mt9v011_probe(struct i2c_client *c,			 const struct i2c_device_id *id){	u16 version;	struct mt9v011 *core;	struct v4l2_subdev *sd;	/* Check if the adapter supports the needed features */	if (!i2c_check_functionality(c->adapter,	     I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))		return -EIO;	core = kzalloc(sizeof(struct mt9v011), GFP_KERNEL);	if (!core)		return -ENOMEM;	sd = &core->sd;	v4l2_i2c_subdev_init(sd, c, &mt9v011_ops);	/* Check if the sensor is really a MT9V011 */	version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION);	if ((version != MT9V011_VERSION) &&	    (version != MT9V011_REV_B_VERSION)) {		v4l2_info(sd, "*** unknown micron chip detected (0x%04x)./n",			  version);		kfree(core);		return -EINVAL;	}	core->global_gain = 0x0024;	core->exposure = 0x01fc;	core->width  = 640;	core->height = 480;	core->xtal = 27000000;	/* Hz */	if (c->dev.platform_data) {		struct mt9v011_platform_data *pdata = c->dev.platform_data;		core->xtal = pdata->xtal;		v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz/n",			core->xtal / 1000000, (core->xtal / 1000) % 1000);	}	v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)/n",		 c->addr << 1, c->adapter->name, version);	return 0;}
开发者ID:125radheyshyam,项目名称:linux,代码行数:48,


示例3: msm_sensor_v4l2_probe

int32_t msm_sensor_v4l2_probe(struct msm_sensor_ctrl_t *s_ctrl,	const struct msm_camera_sensor_info *info,	struct v4l2_subdev *sdev, struct msm_sensor_ctrl *s){	int32_t rc = 0;	rc = s_ctrl->func_tbl->sensor_probe(s_ctrl, info, s);	if (rc < 0)		return rc;	s_ctrl->sensor_v4l2_subdev = sdev;	v4l2_i2c_subdev_init(s_ctrl->sensor_v4l2_subdev,		s_ctrl->sensor_i2c_client->client,		s_ctrl->sensor_v4l2_subdev_ops);	s_ctrl->sensor_v4l2_subdev->dev_priv = (void *) s_ctrl;	return rc;}
开发者ID:desalesouche,项目名称:kernel_huawei,代码行数:16,


示例4: cs53l32a_probe

static int cs53l32a_probe(struct i2c_client *client,			  const struct i2c_device_id *id){	struct v4l2_subdev *sd;	int i;	/* Check if the adapter supports the needed features */	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))		return -EIO;	if (!id)		strlcpy(client->name, "cs53l32a", sizeof(client->name));	v4l_info(client, "chip found @ 0x%x (%s)/n",			client->addr << 1, client->adapter->name);	sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);	if (sd == NULL)		return -ENOMEM;	v4l2_i2c_subdev_init(sd, client, &cs53l32a_ops);	for (i = 1; i <= 7; i++) {		u8 v = cs53l32a_read(sd, i);		v4l2_dbg(1, debug, sd, "Read Reg %d %02x/n", i, v);	}	/* Set cs53l32a internal register for Adaptec 2010/2410 setup */	cs53l32a_write(sd, 0x01, (u8) 0x21);	cs53l32a_write(sd, 0x02, (u8) 0x29);	cs53l32a_write(sd, 0x03, (u8) 0x30);	cs53l32a_write(sd, 0x04, (u8) 0x00);	cs53l32a_write(sd, 0x05, (u8) 0x00);	cs53l32a_write(sd, 0x06, (u8) 0x00);	cs53l32a_write(sd, 0x07, (u8) 0x00);	/* Display results, should be 0x21,0x29,0x30,0x00,0x00,0x00,0x00 */	for (i = 1; i <= 7; i++) {		u8 v = cs53l32a_read(sd, i);		v4l2_dbg(1, debug, sd, "Read Reg %d %02x/n", i, v);	}	return 0;}
开发者ID:mecke,项目名称:linux-2.6,代码行数:46,


示例5: adp1653_probe

static int adp1653_probe(struct i2c_client *client,			 const struct i2c_device_id *devid){	struct adp1653_flash *flash;	int ret;	flash = devm_kzalloc(&client->dev, sizeof(*flash), GFP_KERNEL);	if (flash == NULL)		return -ENOMEM;	if (client->dev.of_node) {		ret = adp1653_of_init(client, flash, client->dev.of_node);		if (ret)			return ret;	} else {		if (!client->dev.platform_data) {			dev_err(&client->dev,				"Neither DT not platform data provided/n");			return -EINVAL;		}		flash->platform_data = client->dev.platform_data;	}	mutex_init(&flash->power_lock);	v4l2_i2c_subdev_init(&flash->subdev, client, &adp1653_ops);	flash->subdev.internal_ops = &adp1653_internal_ops;	flash->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;	ret = adp1653_init_controls(flash);	if (ret)		goto free_and_quit;	ret = media_entity_pads_init(&flash->subdev.entity, 0, NULL);	if (ret < 0)		goto free_and_quit;	flash->subdev.entity.function = MEDIA_ENT_F_FLASH;	return 0;free_and_quit:	dev_err(&client->dev, "adp1653: failed to register device/n");	v4l2_ctrl_handler_free(&flash->ctrls);	return ret;}
开发者ID:020gzh,项目名称:linux,代码行数:46,


示例6: tea6415c_probe

/* this function is called by i2c_probe */static int tea6415c_probe(struct i2c_client *client,			  const struct i2c_device_id *id){	struct v4l2_subdev *sd;	/* let's see whether this adapter can support what we need */	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_BYTE))		return 0;	v4l_info(client, "chip found @ 0x%x (%s)/n",			client->addr << 1, client->adapter->name);	sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);	if (sd == NULL)		return -ENOMEM;	v4l2_i2c_subdev_init(sd, client, &tea6415c_ops);	return 0;}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:18,


示例7: gc0329_probe

/* * i2c_driver function */static int gc0329_probe(struct i2c_client *client,			const struct i2c_device_id *did){	struct gc0329_priv *priv;	struct soc_camera_device *icd	= client->dev.platform_data;	struct soc_camera_link *icl;	int ret;	if (!icd) {		dev_err(&client->dev, "Missing soc-camera data!/n");		return -EINVAL;	}	icl = to_soc_camera_link(icd);	if (!icl) {		dev_err(&client->dev, "Missing platform_data for driver/n");		return -EINVAL;	}	priv = kzalloc(sizeof(struct gc0329_priv), GFP_KERNEL);	if (!priv) {		dev_err(&client->dev, "Failed to allocate private data!/n");		return -ENOMEM;	}	v4l2_i2c_subdev_init(&priv->subdev, client, &gc0329_subdev_ops);	icd->ops = &gc0329_ops;	ret = gc0329_video_probe(icd, client);	if (ret < 0) {		goto err_probe;	}#ifdef DEBUG_EN	sysfs_create_group(&client->dev.kobj, &dev_attr_group);#endif	return 0;err_probe:	icd->ops = NULL;	kfree(priv);	return ret;}
开发者ID:zp8001,项目名称:STUDY_4.0.3,代码行数:49,


示例8: adv7180_probe

static int adv7180_probe(struct i2c_client *client,			 const struct i2c_device_id *id){	struct adv7180_state *state;	struct v4l2_subdev *sd;	int ret;	/* Check if the adapter supports the needed features */	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))		return -EIO;	v4l_info(client, "chip found @ 0x%02x (%s)/n",		 client->addr, client->adapter->name);	state = kzalloc(sizeof(struct adv7180_state), GFP_KERNEL);	if (state == NULL) {		ret = -ENOMEM;		goto err;	}	state->irq = client->irq;	INIT_WORK(&state->work, adv7180_work);	mutex_init(&state->mutex);	state->autodetect = true;	state->input = 0;	sd = &state->sd;	v4l2_i2c_subdev_init(sd, client, &adv7180_ops);	ret = adv7180_init_controls(state);	if (ret)		goto err_unreg_subdev;	ret = init_device(client, state);	if (ret)		goto err_free_ctrl;	return 0;err_free_ctrl:	adv7180_exit_controls(state);err_unreg_subdev:	mutex_destroy(&state->mutex);	v4l2_device_unregister_subdev(sd);	kfree(state);err:	printk(KERN_ERR KBUILD_MODNAME ": Failed to probe: %d/n", ret);	return ret;}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:46,


示例9: 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,


示例10: 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,


示例11: ths7303_probe

static int ths7303_probe(struct i2c_client *client,			const struct i2c_device_id *id){	struct v4l2_subdev *sd;	v4l2_std_id std_id = V4L2_STD_NTSC;	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))		return -ENODEV;	v4l_info(client, "chip found @ 0x%x (%s)/n",			client->addr << 1, client->adapter->name);	sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);	if (sd == NULL)		return -ENOMEM;	v4l2_i2c_subdev_init(sd, client, &ths7303_ops);	return ths7303_setvalue(sd, std_id);}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:20,


示例12: as3645a_probe

static int as3645a_probe(struct i2c_client *client,			 const struct i2c_device_id *devid){	struct as3645a *flash;	int ret;	if (client->dev.platform_data == NULL)		return -ENODEV;	flash = kzalloc(sizeof(*flash), GFP_KERNEL);	if (flash == NULL)		return -ENOMEM;	flash->pdata = client->dev.platform_data;	v4l2_i2c_subdev_init(&flash->subdev, client, &as3645a_ops);	flash->subdev.internal_ops = &as3645a_internal_ops;	flash->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;	ret = as3645a_init_controls(flash);	if (ret < 0)		goto done;	ret = media_entity_init(&flash->subdev.entity, 0, NULL, 0);	if (ret < 0)		goto done;	flash->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;	mutex_init(&flash->power_lock);	flash->led_mode = V4L2_FLASH_LED_MODE_NONE;done:	if (ret < 0) {		v4l2_ctrl_handler_free(&flash->ctrls);		kfree(flash);	}	return ret;}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:41,


示例13: hm5040_probe

static int hm5040_probe(struct i2c_client *client,                        const struct i2c_device_id *id){    struct hm5040_device *dev;    int ret;    dev = kzalloc(sizeof(*dev), GFP_KERNEL);    if (!dev) {        dev_err(&client->dev, "out of memory/n");        return -ENOMEM;    }    pr_info("%s/n", __func__);    mutex_init(&dev->input_lock);    dev->fmt_idx = 0;    v4l2_i2c_subdev_init(&(dev->sd), client, &hm5040_ops);    if (client->dev.platform_data) {        ret = hm5040_s_config(&dev->sd, client->irq,                              client->dev.platform_data);        if (ret)            goto out_free;    }    dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;    dev->pad.flags = MEDIA_PAD_FL_SOURCE;    dev->format.code = V4L2_MBUS_FMT_SGRBG10_1X10;    dev->sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;    dev->vcm_driver = &hm5040_vcm_ops;    ret = media_entity_init(&dev->sd.entity, 1, &dev->pad, 0);    if (ret)        hm5040_remove(client);    return ret;out_free:    v4l2_device_unregister_subdev(&dev->sd);    kfree(dev);    return ret;}
开发者ID:yutokt,项目名称:android_kernel_intel_anzhen4,代码行数:41,


示例14: msm_actuator_create_subdevice

int32_t msm_actuator_create_subdevice(struct msm_actuator_ctrl_t *a_ctrl,	struct i2c_board_info const *board_info,	struct v4l2_subdev *sdev){	int32_t rc = 0;	LINFO("%s called/n", __func__);	/* Store the sub device in actuator structure */	a_ctrl->sdev = sdev;	/* Assign name for sub device */	snprintf(sdev->name, sizeof(sdev->name), "%s", board_info->type);	/* Initialize sub device */	v4l2_i2c_subdev_init(sdev,		a_ctrl->i2c_client.client,		a_ctrl->act_v4l2_subdev_ops);	return rc;}
开发者ID:faux123,项目名称:pantech_vega_racer_2_kernel,代码行数:21,


示例15: lm3646_subdev_init

static int lm3646_subdev_init(struct lm3646_flash *flash){	struct i2c_client *client = to_i2c_client(flash->dev);	int rval;	v4l2_i2c_subdev_init(&flash->subdev_led, client, &lm3646_ops);	flash->subdev_led.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;	strcpy(flash->subdev_led.name, LM3646_NAME);	rval = lm3646_init_controls(flash);	if (rval)		goto err_out;	rval = media_entity_init(&flash->subdev_led.entity, 0, NULL, 0);	if (rval < 0)		goto err_out;	flash->subdev_led.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;	return rval;err_out:	v4l2_ctrl_handler_free(&flash->ctrls_led);	return rval;}
开发者ID:168519,项目名称:linux,代码行数:21,


示例16: msm_ois_i2c_probe

static int32_t msm_ois_i2c_probe(struct i2c_client *client,                                 const struct i2c_device_id *id){    int rc = 0;    struct msm_ois_ctrl_t *act_ctrl_t = NULL;    pr_err("Enter/n");    if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {        pr_err("i2c_check_functionality failed/n");        goto probe_failure;    }    act_ctrl_t = (struct msm_ois_ctrl_t *)(id->driver_data);    CDBG("client = %x/n", (unsigned int) client);    act_ctrl_t->i2c_client.client = client;    /* Set device type as I2C */    act_ctrl_t->act_device_type = MSM_CAMERA_I2C_DEVICE;    act_ctrl_t->i2c_client.i2c_func_tbl = &msm_sensor_qup_func_tbl;    /* Assign name for sub device */    snprintf(act_ctrl_t->msm_sd.sd.name, sizeof(act_ctrl_t->msm_sd.sd.name),             "%s", act_ctrl_t->i2c_driver->driver.name);    /* Initialize sub device */    v4l2_i2c_subdev_init(&act_ctrl_t->msm_sd.sd,                         act_ctrl_t->i2c_client.client,                         act_ctrl_t->act_v4l2_subdev_ops);    v4l2_set_subdevdata(&act_ctrl_t->msm_sd.sd, act_ctrl_t);    act_ctrl_t->msm_sd.sd.internal_ops = &msm_ois_internal_ops;    act_ctrl_t->msm_sd.sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;    media_entity_init(&act_ctrl_t->msm_sd.sd.entity, 0, NULL, 0);    act_ctrl_t->msm_sd.sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;    act_ctrl_t->msm_sd.sd.entity.group_id = MSM_CAMERA_SUBDEV_OIS;    msm_sd_register(&act_ctrl_t->msm_sd);    CDBG("succeeded/n");    pr_err("Exit/n");probe_failure:    return rc;}
开发者ID:adyjl,项目名称:DORIMANX_LG_STOCK_LP_KERNEL,代码行数:40,


示例17: cs5345_probe

static int cs5345_probe(struct i2c_client *client,			const struct i2c_device_id *id){	struct v4l2_subdev *sd;	/* Check if the adapter supports the needed features */	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))		return -EIO;	v4l_info(client, "chip found @ 0x%x (%s)/n",			client->addr << 1, client->adapter->name);	sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);	if (sd == NULL)		return -ENOMEM;	v4l2_i2c_subdev_init(sd, client, &cs5345_ops);	cs5345_write(sd, 0x02, 0x00);	cs5345_write(sd, 0x04, 0x01);	cs5345_write(sd, 0x09, 0x01);	return 0;}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:22,


示例18: adp1653_probe

static int adp1653_probe(struct i2c_client *client,			 const struct i2c_device_id *devid){	struct adp1653_flash *flash;	int ret;	/* we couldn't work without platform data */	if (client->dev.platform_data == NULL)		return -ENODEV;	flash = kzalloc(sizeof(*flash), GFP_KERNEL);	if (flash == NULL)		return -ENOMEM;	flash->platform_data = client->dev.platform_data;	mutex_init(&flash->power_lock);	v4l2_i2c_subdev_init(&flash->subdev, client, &adp1653_ops);	flash->subdev.internal_ops = &adp1653_internal_ops;	flash->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;	ret = adp1653_init_controls(flash);	if (ret)		goto free_and_quit;	ret = media_entity_init(&flash->subdev.entity, 0, NULL, 0);	if (ret < 0)		goto free_and_quit;	flash->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;	return 0;free_and_quit:	v4l2_ctrl_handler_free(&flash->ctrls);	kfree(flash);	return ret;}
开发者ID:AirShark,项目名称:android_kernel_lenovo_redhookbay,代码行数:39,


示例19: sr130pc10_probe

/* * sr130pc10_probe * Fetching platform data is being done with s_config subdev call. * In probe routine, we just register subdev device */static int sr130pc10_probe(struct i2c_client *client,		const struct i2c_device_id *id){	struct sr130pc10_state *state = NULL;	struct v4l2_subdev *sd = NULL;	cam_dbg("E/n");	state = kzalloc(sizeof(struct sr130pc10_state), GFP_KERNEL);	if (state == NULL)		return -ENOMEM;	sd = &state->sd;	strcpy(sd->name, SR130PC10_DRIVER_NAME);	/* Registering subdev */	v4l2_i2c_subdev_init(sd, client, &sr130pc10_ops);	cam_dbg("probed!!/n");	return 0;}
开发者ID:Sk8tr419,项目名称:linux_kernel_sgh-i777,代码行数:27,


示例20: lm3560_subdev_init

static int lm3560_subdev_init(struct lm3560_flash *flash,			      enum lm3560_led_id led_no, char *led_name){	struct i2c_client *client = to_i2c_client(flash->dev);	int rval;	v4l2_i2c_subdev_init(&flash->subdev_led[led_no], client, &lm3560_ops);	flash->subdev_led[led_no].flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;	strcpy(flash->subdev_led[led_no].name, led_name);	rval = lm3560_init_controls(flash, led_no);	if (rval)		goto err_out;	rval = media_entity_init(&flash->subdev_led[led_no].entity, 0, NULL, 0);	if (rval < 0)		goto err_out;	flash->subdev_led[led_no].entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;	return rval;err_out:	v4l2_ctrl_handler_free(&flash->ctrls_led[led_no]);	return rval;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:23,


示例21: sensor_3h7_probe

int sensor_3h7_probe(struct i2c_client *client,	const struct i2c_device_id *id){	int ret = 0;	struct fimc_is_core *core;	struct v4l2_subdev *subdev_module;	struct fimc_is_module_enum *module;	struct fimc_is_device_sensor *device;	struct sensor_open_extended *ext;	BUG_ON(!fimc_is_dev);	core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev);	if (!core) {		err("core device is not yet probed");		return -EPROBE_DEFER;	}	device = &core->sensor[SENSOR_S5K3H7_INSTANCE];	subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);	if (!subdev_module) {		err("subdev_module is NULL");		ret = -ENOMEM;		goto p_err;	}	module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)];	atomic_inc(&core->resourcemgr.rsccount_module);	module->id = SENSOR_NAME_S5K3H7;	module->subdev = subdev_module;	module->device = SENSOR_S5K3H7_INSTANCE;	module->client = client;	module->active_width = 3248;	module->active_height = 2438;	module->pixel_width = module->active_width + 16;	module->pixel_height = module->active_height + 10;	module->max_framerate = 30;	module->position = SENSOR_POSITION_REAR;	module->setfile_name = "setfile_3h7.bin";	module->cfgs = ARRAY_SIZE(config_3h7);	module->cfg = config_3h7;	module->ops = NULL;	module->private_data = NULL;	ext = &module->ext;	ext->mipi_lane_num = 4;	ext->I2CSclk = I2C_L0;	ext->sensor_con.product_name = 0;	ext->sensor_con.peri_type = SE_I2C;	ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0;	ext->sensor_con.peri_setting.i2c.slave_address = 0x20;	ext->sensor_con.peri_setting.i2c.speed = 400000;	ext->actuator_con.product_name = ACTUATOR_NAME_AK7343;	ext->actuator_con.peri_type = SE_I2C;	ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0;	ext->flash_con.product_name = FLADRV_NAME_KTD267;	ext->flash_con.peri_type = SE_GPIO;	ext->flash_con.peri_setting.gpio.first_gpio_port_no = 17;	ext->flash_con.peri_setting.gpio.second_gpio_port_no = 16;	ext->from_con.product_name = FROMDRV_NAME_NOTHING;	ext->companion_con.product_name = COMPANION_NAME_NOTHING;#ifdef DEFAULT_S5K3H7_DRIVING	v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops);#else	v4l2_subdev_init(subdev_module, &subdev_ops);#endif	v4l2_set_subdevdata(subdev_module, module);	v4l2_set_subdev_hostdata(subdev_module, device);	snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id);p_err:	info("%s(%d)/n", __func__, ret);	return ret;}
开发者ID:Fevax,项目名称:kernel_samsung_exynos5422,代码行数:81,


示例22: adv7180_probe

static __devinit int adv7180_probe(struct i2c_client *client,			const struct i2c_device_id *id){	struct adv7180_state *state;	struct v4l2_subdev *sd;	int ret;	/*                                                   */	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))		return -EIO;	v4l_info(client, "chip found @ 0x%02x (%s)/n",			client->addr << 1, client->adapter->name);	state = kzalloc(sizeof(struct adv7180_state), GFP_KERNEL);	if (state == NULL) {		ret = -ENOMEM;		goto err;	}	state->irq = client->irq;	INIT_WORK(&state->work, adv7180_work);	mutex_init(&state->mutex);	state->autodetect = true;	sd = &state->sd;	v4l2_i2c_subdev_init(sd, client, &adv7180_ops);	/*                    */	/*                      */	ret = i2c_smbus_write_byte_data(client, ADV7180_INPUT_CONTROL_REG,		ADV7180_INPUT_CONTROL_AD_PAL_BG_NTSC_J_SECAM);	if (ret < 0)		goto err_unreg_subdev;	ret = i2c_smbus_write_byte_data(client, ADV7180_AUTODETECT_ENABLE_REG,		ADV7180_AUTODETECT_DEFAULT);	if (ret < 0)		goto err_unreg_subdev;	/*                           */	ret = i2c_smbus_write_byte_data(client,		ADV7180_EXTENDED_OUTPUT_CONTROL_REG,		ADV7180_EXTENDED_OUTPUT_CONTROL_NTSCDIS);	if (ret < 0)		goto err_unreg_subdev;	/*                   */	__adv7180_status(client, NULL, &state->curr_norm);	/*                         */	if (state->irq > 0) {		ret = request_irq(state->irq, adv7180_irq, 0, DRIVER_NAME,			state);		if (ret)			goto err_unreg_subdev;		ret = i2c_smbus_write_byte_data(client, ADV7180_ADI_CTRL_REG,			ADV7180_ADI_CTRL_IRQ_SPACE);		if (ret < 0)			goto err_unreg_subdev;		/*                                           */		ret = i2c_smbus_write_byte_data(client, ADV7180_ICONF1_ADI,			ADV7180_ICONF1_ACTIVE_LOW | ADV7180_ICONF1_PSYNC_ONLY);		if (ret < 0)			goto err_unreg_subdev;		ret = i2c_smbus_write_byte_data(client, ADV7180_IMR1_ADI, 0);		if (ret < 0)			goto err_unreg_subdev;		ret = i2c_smbus_write_byte_data(client, ADV7180_IMR2_ADI, 0);		if (ret < 0)			goto err_unreg_subdev;		/*                                        */		ret = i2c_smbus_write_byte_data(client, ADV7180_IMR3_ADI,			ADV7180_IRQ3_AD_CHANGE);		if (ret < 0)			goto err_unreg_subdev;		ret = i2c_smbus_write_byte_data(client, ADV7180_IMR4_ADI, 0);		if (ret < 0)			goto err_unreg_subdev;		ret = i2c_smbus_write_byte_data(client, ADV7180_ADI_CTRL_REG,			0);		if (ret < 0)			goto err_unreg_subdev;	}	return 0;err_unreg_subdev:	mutex_destroy(&state->mutex);	v4l2_device_unregister_subdev(sd);	kfree(state);err:	printk(KERN_ERR DRIVER_NAME ": Failed to probe: %d/n", ret);	return ret;//.........这里部分代码省略.........
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:101,


示例23: sensor_4h5_probe

int sensor_4h5_probe(struct i2c_client *client,	const struct i2c_device_id *id){	int ret = 0;	struct fimc_is_core *core;	struct v4l2_subdev *subdev_module;	struct fimc_is_module_enum *module;	struct fimc_is_device_sensor *device;	struct sensor_open_extended *ext;	BUG_ON(!fimc_is_dev);	core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev);	if (!core) {		err("core device is not yet probed");		return -EPROBE_DEFER;	}	device = &core->sensor[SENSOR_S5K4H5_INSTANCE];	subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);	if (!subdev_module) {		err("subdev_module is NULL");		ret = -ENOMEM;		goto p_err;	}	module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)];	atomic_inc(&core->resourcemgr.rsccount_module);	clear_bit(FIMC_IS_MODULE_GPIO_ON, &module->state);	module->sensor_id = SENSOR_NAME_S5K4H5;	module->subdev = subdev_module;	module->device = SENSOR_S5K4H5_INSTANCE;	module->ops = NULL;	module->client = client;	module->active_width = 3264;	module->active_height = 2448;	module->pixel_width = module->active_width + 16;	module->pixel_height = module->active_height + 10;	module->max_framerate = 120;	module->position = SENSOR_POSITION_REAR;	module->mode = CSI_MODE_CH0_ONLY;	module->lanes = CSI_DATA_LANES_4;	module->bitwidth = 10;	module->sensor_maker = "SLSI";	module->sensor_name = "S5K4H5";	module->setfile_name = "setfile_4h5.bin";	module->cfgs = ARRAY_SIZE(config_4h5);	module->cfg = config_4h5;	module->ops = NULL;	module->private_data = NULL;	ext = &module->ext;	ext->mipi_lane_num = module->lanes;	ext->I2CSclk = I2C_L0;	ext->sensor_con.product_name = 0;	ext->sensor_con.peri_type = SE_I2C;	ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0;	ext->sensor_con.peri_setting.i2c.slave_address = 0x6E;	ext->sensor_con.peri_setting.i2c.speed = 400000;	ext->actuator_con.product_name = ACTUATOR_NAME_DW9804;	ext->actuator_con.peri_type = SE_I2C;	ext->actuator_con.peri_setting.i2c.channel		= SENSOR_CONTROL_I2C0;	ext->flash_con.product_name = FLADRV_NAME_RT5033;	ext->flash_con.peri_type = SE_GPIO;	ext->flash_con.peri_setting.gpio.first_gpio_port_no = 8;	ext->flash_con.peri_setting.gpio.second_gpio_port_no = 6;	/* ext->from_con.product_name = FROMDRV_NAME_W25Q80BW; */	ext->from_con.product_name = FROMDRV_NAME_NOTHING;	ext->mclk = 0;	ext->mipi_lane_num = 0;	ext->mipi_speed = 0;	ext->fast_open_sensor = 0;	ext->self_calibration_mode = 0;	ext->I2CSclk = I2C_L0;	ext->preprocessor_con.product_name = PREPROCESSOR_NAME_NOTHING;	if (client) {		v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops);	} else {		v4l2_subdev_init(subdev_module, &subdev_ops);	}	v4l2_set_subdevdata(subdev_module, module);	v4l2_set_subdev_hostdata(subdev_module, device);	snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id);p_err:	probe_info("%s(%d)/n", __func__, ret);	return ret;}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:97,


示例24: db8131m_probe

/* * db8131m_probe * Fetching platform data is being done with s_config subdev call. * In probe routine, we just register subdev device */static int db8131m_probe(struct i2c_client *client,		const struct i2c_device_id *id){	struct db8131m_state *state = NULL;	struct v4l2_subdev *sd = NULL;	struct db8131m_platform_data *pdata = NULL;	cam_dbg("E/n");	state = kzalloc(sizeof(struct db8131m_state), GFP_KERNEL);	if (state == NULL)		return -ENOMEM;	sd = &state->sd;	strcpy(sd->name, DB8131M_DRIVER_NAME);	state->initialized = 0;	state->req_fps = state->set_fps = 8;	state->sensor_mode = SENSOR_CAMERA;	pdata = client->dev.platform_data;	if (!pdata) {		cam_err("no platform data/n");		return -ENODEV;	}	/* Registering subdev */	v4l2_i2c_subdev_init(sd, client, &db8131m_ops);	/*	 * Assign default format and resolution	 * Use configured default information in platform data	 * or without them, use default information in driver	 */	if (!(pdata->default_width && pdata->default_height)) {		state->preview_frmsizes.width = DEFAULT_PREVIEW_WIDTH;		state->preview_frmsizes.height = DEFAULT_PREVIEW_HEIGHT;	} else {		state->preview_frmsizes.width = pdata->default_width;		state->preview_frmsizes.height = pdata->default_height;	}	state->capture_frmsizes.width = DEFAULT_CAPTURE_WIDTH;	state->capture_frmsizes.height = DEFAULT_CAPTURE_HEIGHT;	cam_dbg("preview_width: %d , preview_height: %d, "	"capture_width: %d, capture_height: %d",	state->preview_frmsizes.width, state->preview_frmsizes.height,	state->capture_frmsizes.width, state->capture_frmsizes.height);	state->req_fmt.width = state->preview_frmsizes.width;	state->req_fmt.height = state->preview_frmsizes.height;	if (!pdata->pixelformat)		state->req_fmt.pixelformat = VT_DEFAULT_FMT;	else		state->req_fmt.pixelformat = pdata->pixelformat;	cam_dbg("probed!!/n");	return 0;}
开发者ID:AndreiLux,项目名称:Perseus-S3,代码行数:66,


示例25: sensor_3l2_probe

int sensor_3l2_probe(struct i2c_client *client,	const struct i2c_device_id *id){	int ret = 0;	struct fimc_is_core *core;	struct v4l2_subdev *subdev_module;	struct fimc_is_module_enum *module;	struct fimc_is_device_sensor *device;	struct sensor_open_extended *ext;	BUG_ON(!fimc_is_dev);	core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev);	if (!core) {		err("core device is not yet probed");		return -EPROBE_DEFER;	}	device = &core->sensor[SENSOR_S5K3L2_INSTANCE];	subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);	if (!subdev_module) {		err("subdev_module is NULL");		ret = -ENOMEM;		goto p_err;	}	module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)];	atomic_inc(&core->resourcemgr.rsccount_module);	module->id = SENSOR_NAME_S5K3L2;	module->subdev = subdev_module;	module->device = SENSOR_S5K3L2_INSTANCE;	module->client = client;	module->active_width = 4128;	module->active_height = 3096;	module->margin_left = 8;	module->margin_right = 8;	module->margin_top = 6;	module->margin_bottom = 4;	module->pixel_width = module->active_width + 16;	module->pixel_height = module->active_height + 10;	module->max_framerate = 120;	module->position = SENSOR_POSITION_REAR;	module->mode = CSI_MODE_CH0_ONLY;	module->lanes = CSI_DATA_LANES_4;	module->sensor_maker = "SLSI";	module->sensor_name = "S5K3L2";	module->setfile_name = "setfile_3l2.bin";	module->cfgs = ARRAY_SIZE(config_3l2);	module->cfg = config_3l2;	module->ops = NULL;	module->private_data = NULL;#ifdef CONFIG_OF	module->power_setpin = sensor_3l2_power_setpin;#endif	ext = &module->ext;	ext->mipi_lane_num = module->lanes;	ext->I2CSclk = I2C_L0;	ext->sensor_con.product_name = SENSOR_NAME_S5K3L2;	ext->sensor_con.peri_type = SE_I2C;	ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0;	ext->sensor_con.peri_setting.i2c.slave_address = 0x5A;	ext->sensor_con.peri_setting.i2c.speed = 400000;	ext->actuator_con.product_name = ACTUATOR_NAME_DW9804;	ext->actuator_con.peri_type = SE_I2C;	ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1;	ext->actuator_con.peri_setting.i2c.slave_address = 0x18;	ext->actuator_con.peri_setting.i2c.speed = 400000;	/* Flash is not working now, it will define agian after solving kernel panic*/	ext->flash_con.product_name = FLADRV_NAME_RT5033;	ext->flash_con.peri_type = SE_GPIO;	ext->flash_con.peri_setting.gpio.first_gpio_port_no = 1;	ext->flash_con.peri_setting.gpio.second_gpio_port_no = 2;	ext->from_con.product_name = FROMDRV_NAME_NOTHING;	ext->companion_con.product_name = COMPANION_NAME_NOTHING;	if (client)		v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops);	else		v4l2_subdev_init(subdev_module, &subdev_ops);	v4l2_set_subdevdata(subdev_module, module);	v4l2_set_subdev_hostdata(subdev_module, device);	snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id);p_err:	info("%s(%d)/n", __func__, ret);	return ret;}
开发者ID:BigBot96,项目名称:android_kernel_samsung_gts2wifi,代码行数:94,


示例26: adv7180_probe

static int adv7180_probe(struct i2c_client *client,			 const struct i2c_device_id *id){	struct adv7180_state *state;	struct v4l2_subdev *sd;	int ret;	/* Check if the adapter supports the needed features */	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))		return -EIO;	v4l_info(client, "chip found @ 0x%02x (%s)/n",		 client->addr, client->adapter->name);	state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);	if (state == NULL)		return -ENOMEM;	state->client = client;	state->field = V4L2_FIELD_INTERLACED;	state->chip_info = (struct adv7180_chip_info *)id->driver_data;	if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) {		state->csi_client = i2c_new_dummy(client->adapter,				ADV7180_DEFAULT_CSI_I2C_ADDR);		if (!state->csi_client)			return -ENOMEM;	}	if (state->chip_info->flags & ADV7180_FLAG_I2P) {		state->vpp_client = i2c_new_dummy(client->adapter,				ADV7180_DEFAULT_VPP_I2C_ADDR);		if (!state->vpp_client) {			ret = -ENOMEM;			goto err_unregister_csi_client;		}	}	state->irq = client->irq;	mutex_init(&state->mutex);	state->autodetect = true;	if (state->chip_info->flags & ADV7180_FLAG_RESET_POWERED)		state->powered = true;	else		state->powered = false;	state->input = 0;	sd = &state->sd;	v4l2_i2c_subdev_init(sd, client, &adv7180_ops);	sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE;	ret = adv7180_init_controls(state);	if (ret)		goto err_unregister_vpp_client;	state->pad.flags = MEDIA_PAD_FL_SOURCE;	sd->entity.flags |= MEDIA_ENT_F_ATV_DECODER;	ret = media_entity_pads_init(&sd->entity, 1, &state->pad);	if (ret)		goto err_free_ctrl;	ret = init_device(state);	if (ret)		goto err_media_entity_cleanup;	if (state->irq) {		ret = request_threaded_irq(client->irq, NULL, adv7180_irq,					   IRQF_ONESHOT | IRQF_TRIGGER_FALLING,					   KBUILD_MODNAME, state);		if (ret)			goto err_media_entity_cleanup;	}	ret = v4l2_async_register_subdev(sd);	if (ret)		goto err_free_irq;	return 0;err_free_irq:	if (state->irq > 0)		free_irq(client->irq, state);err_media_entity_cleanup:	media_entity_cleanup(&sd->entity);err_free_ctrl:	adv7180_exit_controls(state);err_unregister_vpp_client:	if (state->chip_info->flags & ADV7180_FLAG_I2P)		i2c_unregister_device(state->vpp_client);err_unregister_csi_client:	if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2)		i2c_unregister_device(state->csi_client);	mutex_destroy(&state->mutex);	return ret;}
开发者ID:020gzh,项目名称:linux,代码行数:94,


示例27: sensor_4e5_probe

int sensor_4e5_probe(struct i2c_client *client,	const struct i2c_device_id *id){	int ret = 0;	struct fimc_is_core *core;	struct v4l2_subdev *subdev_module;	struct fimc_is_module_enum *module;	struct fimc_is_device_sensor *device;	struct sensor_open_extended *ext;	BUG_ON(!fimc_is_dev);	core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev);	if (!core) {		err("core device is not yet probed");		return -EPROBE_DEFER;	}	device = &core->sensor[SENSOR_S5K4E5_INSTANCE];	subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);	if (!subdev_module) {		err("subdev_module is NULL");		ret = -ENOMEM;		goto p_err;	}	module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)];	atomic_inc(&core->resourcemgr.rsccount_module);	module->id = SENSOR_NAME_S5K4E5;	module->subdev = subdev_module;	module->device = SENSOR_S5K4E5_INSTANCE;	module->client = client;	module->pixel_width = 2560 + 16;	module->pixel_height = 1920 + 10;	module->active_width = 2560;	module->active_height = 1920;	module->max_framerate = 30;	module->position = SENSOR_POSITION_REAR;	module->mode = CSI_MODE_CH0_ONLY;	module->lanes = CSI_DATA_LANES_4;	module->sensor_maker = "SLSI";	module->sensor_name = "S5K4E5";	module->setfile_name = "setfile_4e5.bin";	module->cfgs = 0;	module->cfg = NULL;	module->ops = NULL;	module->private_data = NULL;	ext = &module->ext;	ext->mipi_lane_num = module->lanes;	ext->I2CSclk = I2C_L0;	ext->sensor_con.product_name = 0;	ext->actuator_con.product_name = ACTUATOR_NAME_DWXXXX;	ext->actuator_con.peri_type = SE_I2C;	ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1;	ext->flash_con.product_name = FLADRV_NAME_KTD267;	ext->flash_con.peri_type = SE_GPIO;	ext->flash_con.peri_setting.gpio.first_gpio_port_no = 17;	ext->flash_con.peri_setting.gpio.second_gpio_port_no = 16;	ext->from_con.product_name = FROMDRV_NAME_NOTHING;	ext->companion_con.product_name = COMPANION_NAME_NOTHING;	if (client)		v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops);	else		v4l2_subdev_init(subdev_module, &subdev_ops);	v4l2_set_subdevdata(subdev_module, module);	v4l2_set_subdev_hostdata(subdev_module, device);	snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id);p_err:	info("%s(%d)/n", __func__, ret);	return ret;}
开发者ID:bynarie,项目名称:android_kernel_samsung_gts210wifi,代码行数:81,



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


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