当前位置: 首页>>代码示例>>C++>>正文


C++ i2c_unregister_device函数代码示例

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


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

示例1: max8997_i2c_probe

static int max8997_i2c_probe(struct i2c_client *i2c,
			    const struct i2c_device_id *id)
{
	struct max8997_dev *max8997;
	struct max8997_platform_data *pdata = i2c->dev.platform_data;
	int ret = 0;

	max8997 = kzalloc(sizeof(struct max8997_dev), GFP_KERNEL);
	if (max8997 == NULL)
		return -ENOMEM;

	i2c_set_clientdata(i2c, max8997);
	max8997->dev = &i2c->dev;
	max8997->i2c = i2c;
	max8997->type = id->driver_data;
	max8997->irq = i2c->irq;

	if (!pdata)
		goto err;

	max8997->irq_base = pdata->irq_base;
	max8997->ono = pdata->ono;
	max8997->wakeup = pdata->wakeup;

	mutex_init(&max8997->iolock);

	max8997->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC);
	i2c_set_clientdata(max8997->rtc, max8997);
	max8997->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
	i2c_set_clientdata(max8997->haptic, max8997);
	max8997->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
	i2c_set_clientdata(max8997->muic, max8997);

	pm_runtime_set_active(max8997->dev);

	max8997_irq_init(max8997);

	mfd_add_devices(max8997->dev, -1, max8997_devs,
			ARRAY_SIZE(max8997_devs),
			NULL, 0);

	/*
	 * TODO: enable others (flash, muic, rtc, battery, ...) and
	 * check the return value
	 */

	if (ret < 0)
		goto err_mfd;

	return ret;

err_mfd:
	mfd_remove_devices(max8997->dev);
	i2c_unregister_device(max8997->muic);
	i2c_unregister_device(max8997->haptic);
	i2c_unregister_device(max8997->rtc);
err:
	kfree(max8997);
	return ret;
}
开发者ID:303750856,项目名称:linux-3.1,代码行数:60,代码来源:max8997.c

示例2: tegra_camera_disable

static void tegra_camera_disable(struct nvhost_device *ndev)
{
	struct i2c_adapter *adapter;

	gpio_set_value_cansleep(TEGRA_CAMERA_GPIO_PMU, 0);
	gpio_set_value(TEGRA_CAMERA_GPIO_VI_GP3, 0);
	gpio_set_value(TEGRA_CAMERA_GPIO_CAM_PWR_EN, 0);

	gpio_free(TEGRA_CAMERA_GPIO_PMU);
	gpio_free(TEGRA_CAMERA_GPIO_VI_GP3);
	gpio_free(TEGRA_CAMERA_GPIO_CAM_PWR_EN);

	adapter = i2c_get_adapter(TEGRA_CAMERA_I2C_ADAPTER_ID);
	BUG_ON(!adapter);
	i2c_unregister_device(port_switch);
	i2c_unregister_device(port_expander);
	i2c_put_adapter(adapter);

	BUG_ON(!regulator);
	regulator_disable(regulator);
	regulator_put(regulator);
	regulator = NULL;

	/* Turn off relevant clocks. */
	clk_disable(clk_vi);
	clk_disable(clk_vi_sensor);
	clk_disable(clk_csi);
	clk_disable(clk_isp);
	clk_disable(clk_csus);
}
开发者ID:Kernelhacker,项目名称:2.6.38.3-Adam,代码行数:30,代码来源:board-seaboard-sensors.c

示例3: em28xx_dvb_fini

static int em28xx_dvb_fini(struct em28xx *dev)
{
	struct em28xx_dvb *dvb;
	struct i2c_client *client;

	if (dev->is_audio_only) {
		/* Shouldn't initialize IR for this interface */
		return 0;
	}

	if (!dev->board.has_dvb) {
		/* This device does not support the extension */
		return 0;
	}

	if (!dev->dvb)
		return 0;

	em28xx_info("Closing DVB extension");

	dvb = dev->dvb;
	client = dvb->i2c_client_tuner;

	em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);

	if (dev->disconnected) {
		/* We cannot tell the device to sleep
		 * once it has been unplugged. */
		if (dvb->fe[0]) {
			prevent_sleep(&dvb->fe[0]->ops);
			dvb->fe[0]->exit = DVB_FE_DEVICE_REMOVED;
		}
		if (dvb->fe[1]) {
			prevent_sleep(&dvb->fe[1]->ops);
			dvb->fe[1]->exit = DVB_FE_DEVICE_REMOVED;
		}
	}

	/* remove I2C tuner */
	if (client) {
		module_put(client->dev.driver->owner);
		i2c_unregister_device(client);
	}

	/* remove I2C demod */
	client = dvb->i2c_client_demod;
	if (client) {
		module_put(client->dev.driver->owner);
		i2c_unregister_device(client);
	}

	em28xx_unregister_dvb(dvb);
	kfree(dvb);
	dev->dvb = NULL;
	kref_put(&dev->ref, em28xx_free_device);

	return 0;
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:58,代码来源:em28xx-dvb.c

示例4: atomisp_unregister_acpi_devices

/*
 * In BTY, ACPI enumination will register all the camera i2c devices
 * which will cause v4l2_i2c_new_subdev_board() failed called in atomisp
 * driver.
 * Here we unregister the devices registered by ACPI
 */
static void atomisp_unregister_acpi_devices(struct atomisp_platform_data *pdata)
{
	const char *subdev_name[] = {
		"3-0053",	/* FFRD8 lm3554 */
		"4-0036",	/* ov2722 */
		"4-0010",	/* imx1xx Sensor*/
		"4-0053",	/* FFRD10 lm3554 */
		"4-0054",	/* imx1xx EEPROM*/
		"4-000c",	/* imx1xx driver*/
		"2-0053",	/* byt-crv2 lm3554*/
		"2-0063",	/* byt-crv2 lm3642*/
		"2-0010",	/* imx1xx driver*/
		"2-0036",	/* ov2722 driver*/
		"2-003c",	/* gc2235 driver*/
		"2-0010",	/* CHT OV5693 */
		"4-003c",	/* CHT AP1302 */
		"1-0053",	/* CHT lm3554 */
		"4-001f",	/* CHT m10mo */
#if 0
		"INTCF0B:00",	/* From ACPI ov2722 */
		"INTCF1A:00",	/* From ACPI imx175 */
		"INTCF1C:00",	/* From ACPI lm3554 */
#endif
	};
	struct device *dev;
	struct i2c_client *client;
	struct i2c_board_info board_info;
	int i;
	/* search by device name */
	for (i = 0; i < ARRAY_SIZE(subdev_name); i++) {
		dev = bus_find_device_by_name(&i2c_bus_type, NULL,
					      subdev_name[i]);
		if (dev) {
			client = to_i2c_client(dev);
			board_info.flags = client->flags;
			board_info.addr = client->addr;
			board_info.irq = client->irq;
			strlcpy(board_info.type, client->name,
				sizeof(client->name));
			i2c_unregister_device(client);
		}
	}
#if 0
	/* search by client name */
	for (i = 0; i < ARRAY_SIZE(subdev_name); i++) {
		client = i2c_find_client_by_name(subdev_name[i]);
		if (client) {
			board_info.flags = client->flags;
			board_info.addr = client->addr;
			board_info.irq = client->irq;
			strlcpy(board_info.type, client->name,
				sizeof(client->name));
			i2c_unregister_device(client);
		}
	}
#endif
}
开发者ID:NicholasPace,项目名称:android_kernel_asus_moorefield-stock,代码行数:63,代码来源:platform_camera.c

示例5: chromeos_laptop_exit

static void __exit chromeos_laptop_exit(void)
{
	if (als)
		i2c_unregister_device(als);
	if (tp)
		i2c_unregister_device(tp);
	if (ts)
		i2c_unregister_device(ts);
}
开发者ID:03199618,项目名称:linux,代码行数:9,代码来源:chromeos_laptop.c

示例6: max77693_i2c_remove

static int max77693_i2c_remove(struct i2c_client *i2c)
{
	struct max77693_dev *max77693 = i2c_get_clientdata(i2c);

	mfd_remove_devices(max77693->dev);
	i2c_unregister_device(max77693->muic);
	i2c_unregister_device(max77693->haptic);

	return 0;
}
开发者ID:AllenWeb,项目名称:linux,代码行数:10,代码来源:max77693.c

示例7: max77828_i2c_remove

static int max77828_i2c_remove(struct i2c_client *i2c)
{
	struct max77828_dev *max77828 = i2c_get_clientdata(i2c);

	mfd_remove_devices(max77828->dev);
	i2c_unregister_device(max77828->muic);
	i2c_unregister_device(max77828->led);
	kfree(max77828);

	return 0;
}
开发者ID:MikeForeskin,项目名称:Vindicator-S6-MM,代码行数:11,代码来源:max77828.c

示例8: sfe4001_fini

static void sfe4001_fini(struct efx_nic *efx)
{
	struct falcon_board *board = falcon_board(efx);

	EFX_INFO(efx, "%s\n", __func__);

	device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg);
	sfe4001_poweroff(efx);
	i2c_unregister_device(board->ioexp_client);
	i2c_unregister_device(board->hwmon_client);
}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:11,代码来源:falcon_boards.c

示例9: max8997_i2c_remove

static int max8997_i2c_remove(struct i2c_client *i2c)
{
	struct max8997_dev *max8997 = i2c_get_clientdata(i2c);

	mfd_remove_devices(max8997->dev);
	i2c_unregister_device(max8997->muic);
	i2c_unregister_device(max8997->haptic);
	i2c_unregister_device(max8997->rtc);
	kfree(max8997);

	return 0;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:12,代码来源:max8997.c

示例10: max77693_i2c_remove

static int max77693_i2c_remove(struct i2c_client *i2c)
{
	struct max77693_dev *max77693 = i2c_get_clientdata(i2c);

	mfd_remove_devices(max77693->dev);
	i2c_unregister_device(max77693->muic);
	i2c_unregister_device(max77693->haptic);
	max77693_irq_exit(max77693);
	mutex_destroy(&max77693->iolock);
	kfree(max77693);

	return 0;
}
开发者ID:andi34,项目名称:Dhollmen_Kernel,代码行数:13,代码来源:max77693.c

示例11: stmhdmi_i2c_disconnect

static void stmhdmi_i2c_disconnect(struct stm_hdmi *hdmi)
{
  if(hdmi->edid_client)
  {
    i2c_unregister_device(hdmi->edid_client);
    hdmi->edid_client = 0;
  }
  if(hdmi->eddc_segment_reg_client)
  {
    i2c_unregister_device(hdmi->eddc_segment_reg_client);
    hdmi->eddc_segment_reg_client = 0;
  }
}
开发者ID:Audioniek,项目名称:Fortis-4G,代码行数:13,代码来源:hdmikthread.c

示例12: cx18_i2c_register

int cx18_i2c_register(struct cx18 *cx, unsigned idx)
{
	struct i2c_board_info info;
	struct i2c_client *c;
	u8 id, bus;
	int i;

	CX18_DEBUG_I2C("i2c client register\n");
	if (idx >= ARRAY_SIZE(hw_driverids) || hw_driverids[idx] == 0)
		return -1;
	id = hw_driverids[idx];
	bus = hw_bus[idx];
	memset(&info, 0, sizeof(info));
	strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
	info.addr = hw_addrs[idx];
	for (i = 0; i < I2C_CLIENTS_MAX; i++)
		if (cx->i2c_clients[i] == NULL)
			break;

	if (i == I2C_CLIENTS_MAX) {
		CX18_ERR("insufficient room for new I2C client!\n");
		return -ENOMEM;
	}

	if (id != I2C_DRIVERID_TUNER) {
		c = i2c_new_device(&cx->i2c_adap[bus], &info);
		if (c->driver == NULL)
			i2c_unregister_device(c);
		else
			cx->i2c_clients[i] = c;
		return cx->i2c_clients[i] ? 0 : -ENODEV;
	}

	/* special tuner handling */
	c = i2c_new_probed_device(&cx->i2c_adap[1], &info, cx->card_i2c->radio);
	if (c && c->driver == NULL)
		i2c_unregister_device(c);
	else if (c)
		cx->i2c_clients[i++] = c;
	c = i2c_new_probed_device(&cx->i2c_adap[1], &info, cx->card_i2c->demod);
	if (c && c->driver == NULL)
		i2c_unregister_device(c);
	else if (c)
		cx->i2c_clients[i++] = c;
	c = i2c_new_probed_device(&cx->i2c_adap[1], &info, cx->card_i2c->tv);
	if (c && c->driver == NULL)
		i2c_unregister_device(c);
	else if (c)
		cx->i2c_clients[i++] = c;
	return 0;
}
开发者ID:mikuhatsune001,项目名称:linux-2.6,代码行数:51,代码来源:cx18-i2c.c

示例13: sfe4001_init

/* This board uses an I2C expander to provider power to the PHY, which needs to
 * be turned on before the PHY can be used.
 * Context: Process context, rtnl lock held
 */
static int sfe4001_init(struct efx_nic *efx)
{
	struct falcon_board *board = falcon_board(efx);
	int rc;

#if defined(CONFIG_SENSORS_LM90) || defined(CONFIG_SENSORS_LM90_MODULE)
	board->hwmon_client =
		i2c_new_device(&board->i2c_adap, &sfe4001_hwmon_info);
#else
	board->hwmon_client =
		i2c_new_dummy(&board->i2c_adap, sfe4001_hwmon_info.addr);
#endif
	if (!board->hwmon_client)
		return -EIO;

	/* Raise board/PHY high limit from 85 to 90 degrees Celsius */
	rc = i2c_smbus_write_byte_data(board->hwmon_client,
				       MAX664X_REG_WLHO, 90);
	if (rc)
		goto fail_hwmon;

	board->ioexp_client = i2c_new_dummy(&board->i2c_adap, PCA9539);
	if (!board->ioexp_client) {
		rc = -EIO;
		goto fail_hwmon;
	}

	if (efx->phy_mode & PHY_MODE_SPECIAL) {
		/* PHY won't generate a 156.25 MHz clock and MAC stats fetch
		 * will fail. */
		falcon_stop_nic_stats(efx);
	}
	rc = sfe4001_poweron(efx);
	if (rc)
		goto fail_ioexp;

	rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg);
	if (rc)
		goto fail_on;

	EFX_INFO(efx, "PHY is powered on\n");
	return 0;

fail_on:
	sfe4001_poweroff(efx);
fail_ioexp:
	i2c_unregister_device(board->ioexp_client);
fail_hwmon:
	i2c_unregister_device(board->hwmon_client);
	return rc;
}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:55,代码来源:falcon_boards.c

示例14: ms6_wdt_exit

static void __exit ms6_wdt_exit(void)
{
	if(ms6_data.client) {
		i2c_del_driver(&ms6_wdt_driver);
		i2c_unregister_device(ms6_data.client);
	}
}
开发者ID:laudarch,项目名称:simcom-linux-kernel,代码行数:7,代码来源:ms6_wdt.c

示例15: smsi2c_unregister

void smsi2c_unregister(void)
{
	//need to save smsdev and check for null
	
	if (g_smsi2c_device) {
#ifdef SMS_RK_TS
		/*********************
		* stop rk ts interface
		* smsi2c_ts_feed(void *, NULL, NULL);
		************************/
		rk29_hsadc_stop_transmit();
		rk_ts_callback_setup(NULL, NULL, NULL);
#endif
#if 1 //wood, ++, @20140916
		free_irq(gpio_to_irq(host_i2c_intr_pin), g_smsi2c_device);
		gpio_free(host_i2c_intr_pin);
#endif
		if (g_smsi2c_device->coredev) {
			//need to save smsdev and check for null
			smscore_unregister_device(g_smsi2c_device->coredev);
			g_smsi2c_device->coredev = NULL;
		}
		i2c_unregister_device(g_smsi2c_device->client);
		i2c_put_adapter(g_smsi2c_device->adap);
		kfree(g_smsi2c_device);
		g_smsi2c_device = NULL; 
	}

}
开发者ID:iuncuim,项目名称:A476_V1B_5.1_kernel,代码行数:29,代码来源:smsi2c.c


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