Lines Matching +full:have +full:- +full:pmic
1 // SPDX-License-Identifier: GPL-2.0-only
3 * IOSF-SB MailBox Interface Driver
6 * The IOSF-SB is a fabric bus available on Atom based SOC's that uses a
44 return -ENODEV; in iosf_mbi_pci_read_mdr()
64 dev_err(&mbi_pdev->dev, "PCI config access failed with %d\n", result); in iosf_mbi_pci_read_mdr()
73 return -ENODEV; in iosf_mbi_pci_write_mdr()
93 dev_err(&mbi_pdev->dev, "PCI config access failed with %d\n", result); in iosf_mbi_pci_write_mdr()
106 return -EPERM; in iosf_mbi_read()
129 return -EPERM; in iosf_mbi_write()
153 return -EPERM; in iosf_mbi_modify()
184 /* Mbi isn't hot-pluggable. No remove routine is provided */ in iosf_mbi_available()
190 **************** P-Unit/kernel shared I2C bus arbitration ****************
192 * Some Bay Trail and Cherry Trail devices have the P-Unit and us (the kernel)
193 * share a single I2C bus to the PMIC. Below are helpers to arbitrate the
194 * accesses between the kernel and the P-Unit.
196 * See arch/x86/include/asm/iosf_mbi.h for kernel-doc text for each function.
216 /* Wait for any I2C PMIC accesses from in kernel drivers to finish. */ in iosf_mbi_punit_acquire()
226 * the PMIC, other then block in kernel accesses to the PMIC. in iosf_mbi_punit_acquire()
238 iosf_mbi_pmic_punit_access_count--; in iosf_mbi_punit_release()
254 dev_err(&mbi_pdev->dev, "Error P-Unit semaphore read failed\n"); in iosf_mbi_get_sem()
266 dev_err(&mbi_pdev->dev, "Error P-Unit semaphore reset failed\n"); in iosf_mbi_reset_semaphore()
275 * This function blocks P-Unit accesses to the PMIC I2C bus, so that kernel
276 * I2C code, such as e.g. a fuel-gauge driver, can access it safely.
279 * already blocked P-Unit accesses because it wants them blocked over multiple
280 * i2c-transfers, for e.g. read-modify-write of an I2C client register.
282 * To allow safe PMIC i2c bus accesses this function takes the following steps:
284 * 1) Some code sends request to the P-Unit which make it access the PMIC
285 * I2C bus. Testing has shown that the P-Unit does not check its internal
286 * PMIC bus semaphore for these requests. Callers of these requests call
287 * iosf_mbi_punit_acquire()/_release() around their P-Unit accesses, these
295 * 3) Some code makes such P-Unit requests from atomic contexts where it
298 * needing P-Unit resources from atomic context to acquire them before
299 * we take control over the PMIC I2C bus.
301 * 4) When CPU cores enter C6 or C7 the P-Unit needs to talk to the PMIC
302 * if this happens while the kernel itself is accessing the PMIC I2C bus
307 * 5) The P-Unit has a PMIC bus semaphore which we can request to stop
308 * autonomous P-Unit tasks from accessing the PMIC I2C bus while we hold it.
319 return -ENXIO; in iosf_mbi_block_punit_i2c_access()
338 * requires the P-Unit to talk to the PMIC and if this happens while in iosf_mbi_block_punit_i2c_access()
347 dev_err(&mbi_pdev->dev, "Error P-Unit semaphore request failed\n"); in iosf_mbi_block_punit_i2c_access()
358 dev_dbg(&mbi_pdev->dev, "P-Unit semaphore acquired after %ums\n", in iosf_mbi_block_punit_i2c_access()
359 jiffies_to_msecs(jiffies - start)); in iosf_mbi_block_punit_i2c_access()
366 ret = -ETIMEDOUT; in iosf_mbi_block_punit_i2c_access()
367 dev_err(&mbi_pdev->dev, "Error P-Unit semaphore timed out, resetting\n"); in iosf_mbi_block_punit_i2c_access()
371 dev_err(&mbi_pdev->dev, "P-Unit semaphore: %d\n", sem); in iosf_mbi_block_punit_i2c_access()
387 iosf_mbi_pmic_i2c_access_count--; in iosf_mbi_unblock_punit_i2c_access()
390 dev_dbg(&mbi_pdev->dev, "punit semaphore held for %ums\n", in iosf_mbi_unblock_punit_i2c_access()
391 jiffies_to_msecs(jiffies - iosf_mbi_sem_acquired)); in iosf_mbi_unblock_punit_i2c_access()
454 return -EACCES; in mcr_set()
483 /* mcr - initiates mailbox transaction */ in iosf_sideband_debug_init()
508 dev_err(&pdev->dev, "error: could not enable device\n"); in iosf_mbi_probe()
513 iosf_mbi_sem_address = dev_id->driver_data; in iosf_mbi_probe()