drm/modes: Fix drm_mode_vrefres() docs
[drm/drm-misc.git] / drivers / i2c / busses / i2c-designware-baytrail.c
blob45774aa47c28c65c510b523eddc08348de30cfd4
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Intel BayTrail PMIC I2C bus semaphore implementation
4 * Copyright (c) 2014, Intel Corporation.
5 */
6 #include <linux/device.h>
7 #include <linux/acpi.h>
8 #include <linux/i2c.h>
9 #include <linux/interrupt.h>
11 #include <asm/iosf_mbi.h>
13 #include "i2c-designware-core.h"
15 int i2c_dw_baytrail_probe_lock_support(struct dw_i2c_dev *dev)
17 acpi_status status;
18 unsigned long long shared_host = 0;
19 acpi_handle handle;
21 if (!dev)
22 return -ENODEV;
24 handle = ACPI_HANDLE(dev->dev);
25 if (!handle)
26 return -ENODEV;
28 status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
29 if (ACPI_FAILURE(status))
30 return -ENODEV;
32 if (!shared_host)
33 return -ENODEV;
35 if (!iosf_mbi_available())
36 return -EPROBE_DEFER;
38 dev_info(dev->dev, "I2C bus managed by PUNIT\n");
39 dev->acquire_lock = iosf_mbi_block_punit_i2c_access;
40 dev->release_lock = iosf_mbi_unblock_punit_i2c_access;
41 dev->shared_with_punit = true;
43 return 0;