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


C++ ACPI_HANDLE函数代码示例

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

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


示例16: set_dflt_pwr_limit

static void set_dflt_pwr_limit(struct iwl_trans *trans, struct pci_dev *pdev)
{
	acpi_handle pxsx_handle;
	acpi_handle handle;
	struct acpi_buffer splx = {ACPI_ALLOCATE_BUFFER, NULL};
	acpi_status status;

	pxsx_handle = ACPI_HANDLE(&pdev->dev);
	if (!pxsx_handle) {
		IWL_ERR(trans, "Could not retrieve root port ACPI handle");
		return;
	}

	/* Get the method's handle */
	status = acpi_get_handle(pxsx_handle, (acpi_string)SPL_METHOD, &handle);
	if (ACPI_FAILURE(status)) {
		IWL_DEBUG_INFO(trans, "SPL method not found");
		return;
	}

	/* Call SPLC with no arguments */
	status = acpi_evaluate_object(handle, NULL, NULL, &splx);
	if (ACPI_FAILURE(status)) {
		IWL_ERR(trans, "SPLC invocation failed (0x%x)", status);
		return;
	}

	trans->dflt_pwr_limit = splx_get_pwr_limit(trans, splx.pointer);
	IWL_DEBUG_INFO(trans, "Default power limit set to %lld",
		       trans->dflt_pwr_limit);
	kfree(splx.pointer);
}
开发者ID:houlixin,项目名称:BBB-TISDK,代码行数:32,代码来源:drv.c


示例17: dw_i2c_acpi_params

static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
			       u16 *hcnt, u16 *lcnt, u32 *sda_hold)
{
	struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER };
	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
	union acpi_object *obj;

	if (dmi_check_system(dw_i2c_no_acpi_params))
		return;

	if (ACPI_FAILURE(acpi_evaluate_object(handle, method, NULL, &buf)))
		return;

	obj = (union acpi_object *)buf.pointer;
	if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 3) {
		const union acpi_object *objs = obj->package.elements;

		*hcnt = (u16)objs[0].integer.value;
		*lcnt = (u16)objs[1].integer.value;
		if (sda_hold)
			*sda_hold = (u32)objs[2].integer.value;
	}

	kfree(buf.pointer);
}
开发者ID:DenisLug,项目名称:mptcp,代码行数:25,代码来源:i2c-designware-platdrv.c


示例18: amdgpu_atpx_get_client_id

/**
 * amdgpu_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 enum vga_switcheroo_client_id amdgpu_atpx_get_client_id(struct pci_dev *pdev)
{
	if (amdgpu_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev))
		return VGA_SWITCHEROO_IGD;
	else
		return VGA_SWITCHEROO_DIS;
}
开发者ID:ryoon,项目名称:linux,代码行数:15,代码来源:amdgpu_atpx_handler.c


示例19: ACPI_HANDLE

struct nhlt_acpi_table *skl_nhlt_init(struct device *dev)
{
	acpi_handle handle;
	union acpi_object *obj;
	struct nhlt_resource_desc  *nhlt_ptr = NULL;
	struct nhlt_acpi_table *nhlt_table = NULL;

	handle = ACPI_HANDLE(dev);
	if (!handle) {
		dev_err(dev, "Didn't find ACPI_HANDLE\n");
		return NULL;
	}

	obj = acpi_evaluate_dsm(handle, &osc_guid, 1, 1, NULL);
	if (obj && obj->type == ACPI_TYPE_BUFFER) {
		nhlt_ptr = (struct nhlt_resource_desc  *)obj->buffer.pointer;
		nhlt_table = (struct nhlt_acpi_table *)
				memremap(nhlt_ptr->min_addr, nhlt_ptr->length,
				MEMREMAP_WB);
		ACPI_FREE(obj);
		if (nhlt_table && (strncmp(nhlt_table->header.signature,
					NHLT_ACPI_HEADER_SIG,
					strlen(NHLT_ACPI_HEADER_SIG)) != 0)) {
			memunmap(nhlt_table);
			dev_err(dev, "NHLT ACPI header signature incorrect\n");
			return NULL;
		}
		return nhlt_table;
	}

	dev_err(dev, "device specific method to extract NHLT blob failed\n");
	return NULL;
}
开发者ID:val2k,项目名称:linux,代码行数:33,代码来源:skl-nhlt.c


示例20: i2c_dw_eval_lock_support

int i2c_dw_eval_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) {
        dev_info(dev->dev, "I2C bus managed by PUNIT\n");
        dev->acquire_lock = baytrail_i2c_acquire;
        dev->release_lock = baytrail_i2c_release;
        dev->pm_runtime_disabled = true;
    }

    if (!iosf_mbi_available())
        return -EPROBE_DEFER;

    return 0;
}
开发者ID:krizhanovsky,项目名称:linux,代码行数:29,代码来源:i2c-designware-baytrail.c



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