Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Intel BayTrail PMIC I2C bus semaphore implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (c) 2014, Intel Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/iosf_mbi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "i2c-designware-core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	unsigned long long shared_host = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	acpi_handle handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	if (!dev || !dev->dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	handle = ACPI_HANDLE(dev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	if (!handle)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	if (!shared_host)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	if (!iosf_mbi_available())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		return -EPROBE_DEFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	dev_info(dev->dev, "I2C bus managed by PUNIT\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	dev->acquire_lock = iosf_mbi_block_punit_i2c_access;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	dev->release_lock = iosf_mbi_unblock_punit_i2c_access;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	dev->shared_with_punit = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }