0001
0002
0003
0004
0005
0006 #include <linux/device.h>
0007 #include <linux/acpi.h>
0008 #include <linux/i2c.h>
0009 #include <linux/interrupt.h>
0010
0011 #include <asm/iosf_mbi.h>
0012
0013 #include "i2c-designware-core.h"
0014
0015 int i2c_dw_baytrail_probe_lock_support(struct dw_i2c_dev *dev)
0016 {
0017 acpi_status status;
0018 unsigned long long shared_host = 0;
0019 acpi_handle handle;
0020
0021 if (!dev)
0022 return -ENODEV;
0023
0024 handle = ACPI_HANDLE(dev->dev);
0025 if (!handle)
0026 return -ENODEV;
0027
0028 status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
0029 if (ACPI_FAILURE(status))
0030 return -ENODEV;
0031
0032 if (!shared_host)
0033 return -ENODEV;
0034
0035 if (!iosf_mbi_available())
0036 return -EPROBE_DEFER;
0037
0038 dev_info(dev->dev, "I2C bus managed by PUNIT\n");
0039 dev->acquire_lock = iosf_mbi_block_punit_i2c_access;
0040 dev->release_lock = iosf_mbi_unblock_punit_i2c_access;
0041 dev->shared_with_punit = true;
0042
0043 return 0;
0044 }