當前位置: 首頁>>代碼示例>>C++>>正文


C++ ACPI_HANDLE函數代碼示例

本文整理匯總了C++中ACPI_HANDLE函數的典型用法代碼示例。如果您正苦於以下問題:C++ ACPI_HANDLE函數的具體用法?C++ ACPI_HANDLE怎麽用?C++ ACPI_HANDLE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ACPI_HANDLE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: xgene_enet_reset

static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
{
	struct device *dev = &pdata->pdev->dev;

	if (!xgene_ring_mgr_init(pdata))
		return -ENODEV;

	if (dev->of_node) {
		clk_prepare_enable(pdata->clk);
		udelay(5);
		clk_disable_unprepare(pdata->clk);
		udelay(5);
		clk_prepare_enable(pdata->clk);
		udelay(5);
	} else {
#ifdef CONFIG_ACPI
		if (acpi_has_method(ACPI_HANDLE(&pdata->pdev->dev), "_RST")) {
			acpi_evaluate_object(ACPI_HANDLE(&pdata->pdev->dev),
					     "_RST", NULL, NULL);
		} else if (acpi_has_method(ACPI_HANDLE(&pdata->pdev->dev),
					   "_INI")) {
			acpi_evaluate_object(ACPI_HANDLE(&pdata->pdev->dev),
					     "_INI", NULL, NULL);
		}
#endif
	}

	xgene_enet_ecc_init(pdata);
	xgene_enet_config_ring_if_assoc(pdata);

	return 0;
}
開發者ID:AK101111,項目名稱:linux,代碼行數:32,代碼來源:xgene_enet_xgmac.c

示例2: intel_mid_gps_probe

static int intel_mid_gps_probe(struct platform_device *pdev)
{
	struct intel_mid_gps_platform_data *pdata = NULL;
	int ret = 0;

	pr_info("%s probe called\n", dev_name(&pdev->dev));

	if (ACPI_HANDLE(&pdev->dev)) {
		/* create a new platform data that will be
		   populated with gpio data from ACPI table */
		unsigned long long port;
		pdata = kzalloc(sizeof(struct intel_mid_gps_platform_data),
			GFP_KERNEL);

		if (!pdata)
			return -ENOMEM;

		pdata->gpio_reset = acpi_get_gpio_by_name(&pdev->dev,"RSET", NULL);
		pdata->gpio_enable = acpi_get_gpio_by_name(&pdev->dev,"ENAB", NULL);
		pdata->gpio_hostwake = acpi_get_gpio_by_name(&pdev->dev,"HSTW", NULL);

		pr_info("%s enable: %d, reset: %d, hostwake: %d\n", __func__,
			pdata->gpio_enable, pdata->gpio_reset, pdata->gpio_hostwake);

		if (ACPI_FAILURE(acpi_evaluate_integer((acpi_handle)ACPI_HANDLE(&pdev->dev),
						       "UART", NULL, &port)))
			dev_err(&pdev->dev, "Error evaluating acpi table, no HSU port\n");
		else {
			pdata->hsu_port = (unsigned int)port;
			pr_info("GPS HSU port read from ACPI = %d\n", pdata->hsu_port);
		}

		platform_set_drvdata(pdev, pdata);
	} else {
		platform_set_drvdata(pdev, pdev->dev.platform_data);
	}

	ret = intel_mid_gps_init(pdev);

	if (ret) {
		dev_err(&pdev->dev, "Failed to initalize %s\n",
			dev_name(&pdev->dev));

		if (ACPI_HANDLE(&pdev->dev))
			kfree(pdata);
	}
	return ret;
}
開發者ID:matheusgcdj,項目名稱:android_kernel_asus_T00F,代碼行數:48,代碼來源:intel_mid_gps.c

示例3: acpi_processor_stop

static int acpi_processor_stop(struct device *dev)
{
	struct acpi_device *device;
	struct acpi_processor *pr;

	if (acpi_bus_get_device(ACPI_HANDLE(dev), &device))
		return 0;

	acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
				   acpi_processor_notify);

	pr = acpi_driver_data(device);
	if (!pr)
		return 0;

	acpi_processor_power_exit(pr);

	if (pr->cdev) {
		sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
		sysfs_remove_link(&pr->cdev->device.kobj, "device");
		thermal_cooling_device_unregister(pr->cdev);
		pr->cdev = NULL;
	}
	return 0;
}
開發者ID:bjayesh,項目名稱:chandra,代碼行數:25,代碼來源:processor_driver.c

示例4: intel_vbtn_probe

static int intel_vbtn_probe(struct platform_device *device)
{
    acpi_handle handle = ACPI_HANDLE(&device->dev);
    struct intel_vbtn_priv *priv;
    acpi_status status;
    int err;

    status = acpi_evaluate_object(handle, "VBDL", NULL, NULL);
    if (ACPI_FAILURE(status)) {
        dev_warn(&device->dev, "failed to read Intel Virtual Button driver\n");
        return -ENODEV;
    }

    priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL);
    if (!priv)
        return -ENOMEM;
    dev_set_drvdata(&device->dev, priv);

    err = intel_vbtn_input_setup(device);
    if (err) {
        pr_err("Failed to setup Intel Virtual Button\n");
        return err;
    }

    status = acpi_install_notify_handler(handle,
                                         ACPI_DEVICE_NOTIFY,
                                         notify_handler,
                                         device);
    if (ACPI_FAILURE(status))
        return -EBUSY;

    return 0;
}
開發者ID:kdave,項目名稱:btrfs-devel,代碼行數:33,代碼來源:intel-vbtn.c

示例5: acpi_i2c_install_space_handler

int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
{
	acpi_handle handle = ACPI_HANDLE(adapter->dev.parent);
	struct acpi_i2c_handler_data *data;
	acpi_status status;

	if (!handle)
		return -ENODEV;

	data = kzalloc(sizeof(struct acpi_i2c_handler_data),
			    GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	data->adapter = adapter;
	status = acpi_bus_attach_private_data(handle, (void *)data);
	if (ACPI_FAILURE(status)) {
		kfree(data);
		return -ENOMEM;
	}

	status = acpi_install_address_space_handler(handle,
				ACPI_ADR_SPACE_GSBUS,
				&acpi_i2c_space_handler,
				NULL,
				data);
	if (ACPI_FAILURE(status)) {
		dev_err(&adapter->dev, "Error installing i2c space handler\n");
		acpi_bus_detach_private_data(handle);
		kfree(data);
		return -ENOMEM;
	}

	return 0;
}
開發者ID:mikuhatsune001,項目名稱:linux2.6.32,代碼行數:35,代碼來源:i2c-acpi.c

示例6: radeon_atpx_get_client_id

/**
 * radeon_atpx_get_client_id - get the client id
 *
 * @pdev: pci device
 *
 * look up whether we are the integrated or discrete GPU (all asics).
 * Returns the client id.
 */
static int radeon_atpx_get_client_id(struct pci_dev *pdev)
{
	if (radeon_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev))
		return VGA_SWITCHEROO_IGD;
	else
		return VGA_SWITCHEROO_DIS;
}
開發者ID:McPrapor,項目名稱:kernel_misu,代碼行數:15,代碼來源:radeon_atpx_handler.c

示例7: ACPI_HANDLE

/**
 * acpi_dev_pm_get_node - Get ACPI device node for the given physical device.
 * @dev: Device to get the ACPI node for.
 */
struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
{
	acpi_handle handle = ACPI_HANDLE(dev);
	struct acpi_device *adev;

	return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL;
}
開發者ID:DecimalMan,項目名稱:linux-misc,代碼行數:11,代碼來源:device_pm.c

示例8: intel_dsm_pci_probe

static bool intel_dsm_pci_probe(struct pci_dev *pdev)
{
	acpi_handle dhandle, intel_handle;
	acpi_status status;
	int ret;

	dhandle = ACPI_HANDLE(&pdev->dev);
	if (!dhandle)
		return false;

	status = acpi_get_handle(dhandle, "_DSM", &intel_handle);
	if (ACPI_FAILURE(status)) {
		DRM_DEBUG_KMS("no _DSM method for intel device\n");
		return false;
	}

	ret = intel_dsm(dhandle, INTEL_DSM_FN_SUPPORTED_FUNCTIONS);
	if (ret < 0) {
		DRM_DEBUG_KMS("failed to get supported _DSM functions\n");
		return false;
	}

	intel_dsm_priv.dhandle = dhandle;

	intel_dsm_platform_mux_info();
	return true;
}
開發者ID:electrikjesus,項目名稱:kernel_intel-uefi,代碼行數:27,代碼來源:intel_acpi.c

示例9: i2c_dw_probe_lock_support

int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
{
	acpi_status status;
	unsigned long long shared_host = 0;
	acpi_handle handle;

	if (!dev || !dev->dev)
		return 0;

	handle = ACPI_HANDLE(dev->dev);
	if (!handle)
		return 0;

	status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
	if (ACPI_FAILURE(status))
		return 0;

	if (!shared_host)
		return 0;

	if (!iosf_mbi_available())
		return -EPROBE_DEFER;

	dev_info(dev->dev, "I2C bus managed by PUNIT\n");
	dev->acquire_lock = baytrail_i2c_acquire;
	dev->release_lock = baytrail_i2c_release;
	dev->pm_disabled = true;

	pm_qos_add_request(&dev->pm_qos, PM_QOS_CPU_DMA_LATENCY,
			   PM_QOS_DEFAULT_VALUE);

	return 0;
}
開發者ID:Lyude,項目名稱:linux,代碼行數:33,代碼來源:i2c-designware-baytrail.c

示例10: xgene_mdio_reset

static int xgene_mdio_reset(struct xgene_mdio_pdata *pdata)
{
	int ret;

	if (pdata->dev->of_node) {
		clk_prepare_enable(pdata->clk);
		udelay(5);
		clk_disable_unprepare(pdata->clk);
		udelay(5);
		clk_prepare_enable(pdata->clk);
		udelay(5);
	} else {
#ifdef CONFIG_ACPI
		acpi_evaluate_object(ACPI_HANDLE(pdata->dev),
				     "_RST", NULL, NULL);
#endif
	}

	ret = xgene_enet_ecc_init(pdata);
	if (ret) {
		if (pdata->dev->of_node)
			clk_disable_unprepare(pdata->clk);
		return ret;
	}
	xgene_gmac_reset(pdata);

	return 0;
}
開發者ID:AlexShiLucky,項目名稱:linux,代碼行數:28,代碼來源:mdio-xgene.c

示例11: cm3218_acpi_get_cpm_info

/**
 * cm3218_acpi_get_cpm_info() - Get CPM object from ACPI
 * @client	pointer of struct i2c_client.
 * @obj_name	pointer of ACPI object name.
 * @count	maximum size of return array.
 * @vals	pointer of array for return elements.
 *
 * Convert ACPI CPM table to array. Special thanks to Srinivas Pandruvada
 * for his help implementing this routine.
 *
 * Return: -ENODEV for fail.  Otherwise is number of elements.
 */
static int cm3218_acpi_get_cpm_info(struct i2c_client *client, char *obj_name,
							int count, u64 *vals)
{
	acpi_handle handle;
	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
	int i;
	acpi_status status;
	union acpi_object *cpm = NULL;

	handle = ACPI_HANDLE(&client->dev);
	if (!handle)
		return -ENODEV;

	status = acpi_evaluate_object(handle, obj_name, NULL, &buffer);
	if (ACPI_FAILURE(status)) {
		dev_err(&client->dev, "object %s not found\n", obj_name);
		return -ENODEV;
	}

	cpm = buffer.pointer;
	for (i = 0; i < cpm->package.count && i < count; ++i) {
		union acpi_object *elem;

		elem = &(cpm->package.elements[i]);
		vals[i] = elem->integer.value;
	}

	kfree(buffer.pointer);

	return i;
}
開發者ID:hadess,項目名稱:cm3218,代碼行數:43,代碼來源:cm3218.c

示例12: intel_crc_pmic_opregion_probe

static int intel_crc_pmic_opregion_probe(struct platform_device *pdev)
{
	struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
	return intel_pmic_install_opregion_handler(&pdev->dev,
			ACPI_HANDLE(pdev->dev.parent), pmic->regmap,
			&intel_crc_pmic_opregion_data);
}
開發者ID:AlexShiLucky,項目名稱:linux,代碼行數:7,代碼來源:intel_pmic_crc.c

示例13: meh_show

static int meh_show(struct seq_file *seqfp, void *p) {
	struct pci_dev *pdev = NULL;

	while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
		struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
		acpi_handle handle;

#ifdef ACPI_HANDLE
		/* since Linux 3.8 */
		handle = ACPI_HANDLE(&pdev->dev);
#else
		/* removed since Linux 3.13 */
		handle = DEVICE_ACPI_HANDLE(&pdev->dev);
#endif
		seq_printf(seqfp, "%s ", dev_name(&pdev->dev));
		seq_printf(seqfp, "%06x ", pdev->class);
		if (handle) {
			acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
			seq_printf(seqfp, "%s\n", (char *)buf.pointer);
		} else {
			seq_printf(seqfp, "\n");
		}
	}
	return 0;
}
開發者ID:wmealing,項目名稱:acpi-stuff,代碼行數:25,代碼來源:acpi_dump_info.c

示例14: rfkill_gpio_probe

static int rfkill_gpio_probe(struct platform_device *pdev)
{
	struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
	struct rfkill_gpio_data *rfkill;
	struct gpio_desc *gpio;
	int ret;

	rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
	if (!rfkill)
		return -ENOMEM;

	if (ACPI_HANDLE(&pdev->dev)) {
		ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
		if (ret)
			return ret;
	} else if (pdata) {
		rfkill->name = pdata->name;
		rfkill->type = pdata->type;
	} else {
		return -ENODEV;
	}

	rfkill->clk = devm_clk_get(&pdev->dev, NULL);

	gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW);
	if (IS_ERR(gpio))
		return PTR_ERR(gpio);

	rfkill->reset_gpio = gpio;

	gpio = devm_gpiod_get_optional(&pdev->dev, "shutdown", GPIOD_OUT_LOW);
	if (IS_ERR(gpio))
		return PTR_ERR(gpio);

	rfkill->shutdown_gpio = gpio;

	/* Make sure at-least one of the GPIO is defined and that
	 * a name is specified for this instance
	 */
	if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) {
		dev_err(&pdev->dev, "invalid platform data\n");
		return -EINVAL;
	}

	rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev,
					  rfkill->type, &rfkill_gpio_ops,
					  rfkill);
	if (!rfkill->rfkill_dev)
		return -ENOMEM;

	ret = rfkill_register(rfkill->rfkill_dev);
	if (ret < 0)
		return ret;

	platform_set_drvdata(pdev, rfkill);

	dev_info(&pdev->dev, "%s device registered.\n", rfkill->name);

	return 0;
}
開發者ID:a2hojsjsjs,項目名稱:linux,代碼行數:60,代碼來源:rfkill-gpio.c

示例15: detect_tablet_mode

static void detect_tablet_mode(struct platform_device *device)
{
	const char *chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE);
	struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
	acpi_handle handle = ACPI_HANDLE(&device->dev);
	struct acpi_buffer vgbs_output = { ACPI_ALLOCATE_BUFFER, NULL };
	union acpi_object *obj;
	acpi_status status;
	int m;

	if (!(chassis_type && strcmp(chassis_type, "31") == 0))
		goto out;

	status = acpi_evaluate_object(handle, "VGBS", NULL, &vgbs_output);
	if (ACPI_FAILURE(status))
		goto out;

	obj = vgbs_output.pointer;
	if (!(obj && obj->type == ACPI_TYPE_INTEGER))
		goto out;

	m = !(obj->integer.value & TABLET_MODE_FLAG);
	input_report_switch(priv->input_dev, SW_TABLET_MODE, m);
	m = (obj->integer.value & DOCK_MODE_FLAG) ? 1 : 0;
	input_report_switch(priv->input_dev, SW_DOCK, m);
out:
	kfree(vgbs_output.pointer);
}
開發者ID:AlexShiLucky,項目名稱:linux,代碼行數:28,代碼來源:intel-vbtn.c


注:本文中的ACPI_HANDLE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。