Request the BSI RX, TX and ERR interrupts using level high
triggering instead of rising edge triggering. If an interrupt
is edge triggered, then its interrupt handler will be called upon
enabling the interrupt if it physically triggered while it was
disabled in software. This leads to unexpected interrupt
handler calls in the qpnp-bsi driver when the following sequence
occurs: BIF transaction using interrupts (IRQs enabled), BIF
transaction using polling (IRQs disabled), BIF transaction to
enter interrupt mode bus state (IRQs enabled).
Switching the interrupts to use level triggering fixes the issue
because any interrupt physically triggered during a polling
transaction with the BSI interrupts disabled will be ignored by
the irq framework.
Change-Id: I57a6fb6f75af14970b5a186009ec506e240c151d
Signed-off-by: David Collins <collinsd@codeaurora.org>
Add a function to the bif-core driver which provides a means to
write new BIF data objects into the non-volatile memory (NVM)
of a BIF slave. Also add functions which can be used to
overwrite or delete an existing BIF object.
Change-Id: I6cd48409c696bd60a4d52b0fac8782c58d744df1
Signed-off-by: David Collins <collinsd@codeaurora.org>
Update the BIF slave matching criteria so that BIF consumer
drivers can find BIF slaves which contain BIF objects of a
certain type. Also add functions which allow consumers to get
handles for the BIF objects which match specified search
criteria.
Change-Id: Ice7042ecb3829db8f5601d91940c5f7bef383d3d
Signed-off-by: David Collins <collinsd@codeaurora.org>
Add support for reading and writing the non-volatile memory (NVM)
of BIF slaves.
Change-Id: Ie422ec57327102584bab2b039a733505320b065b
Signed-off-by: David Collins <collinsd@codeaurora.org>
Add support in the bif-core driver for enabling and disabling
automatic task triggering for specified tasks. One example of
auto task triggering is the periodic polling method employed by
the BIF slave temperature function to check for high or low
temperature conditions.
Change-Id: If01071debd430c084be344549ecf2e8b281d4e05
Signed-off-by: David Collins <collinsd@codeaurora.org>
Add a length check in the non-volatile memory (NVM) BIF object
parsing function so that it does not attempt to read past the
end of the NVM address space of the BIF slave.
Change-Id: Iafd40e61e7ca0bfa2e2be95c294a0e17d5cf515c
Signed-off-by: David Collins <collinsd@codeaurora.org>
Move functions calls which clear PMIC BSI hardware errors and
reset IRQ flags to immediately before BIF transmit calls. This
ensures that the BSI RX and TX blocks are in the correct state
before errors are cleared.
Change-Id: Id266f076968d48484a9366274d30e8ff6f47dc23
Signed-off-by: David Collins <collinsd@codeaurora.org>
When performing a BIF slave register read of a single register
there is no need to specify a burst read length of 1. All reads
are assumed to be of length 1 unless specified otherwise.
Therefore, remove the redundant RBL1 BIF bus command.
Change-Id: I000637a4bec5f6d2c9b48fa848c63779745b662a
Signed-off-by: David Collins <collinsd@codeaurora.org>
The value QPNP_BSI_MAX_TRANSMIT_CYCLES is used to define the
timeout interval when sending or receiving BIF data words.
The MIPI-BIF specification allows for some skew in the length
of bits received from a slave. A '1' can take up to 3.5 tau_bif
and a '0' can take up to 1.5 tau_bif. Therefore, the maximum word
transmission time can be calculated as follows.
max-transmission-time =
= n(1)_max * t(1)_max + (17 - n(1)_max) * t(0)_max + t(stop)_min
= 8 * 3.5 tau_bif + 9 * 1.5 tau_bif + 4.5 tau_bif
= 46 tau_bif
Change QPNP_BSI_MAX_TRANSMIT_CYCLES to 46 in order to match the
value calculated from the MIPI-BIF specification.
Change-Id: Ibb199b54c99cc2de29ae54f6f891a667a30213b2
Signed-off-by: David Collins <collinsd@codeaurora.org>
Fall back and use time-invariant individual transactions for BIF
slave register read and write operations if high level read or
write controller callback functions fail.
Change-Id: Ieaf479717383719dc1f5b94cc4be72f2e8901127
Signed-off-by: David Collins <collinsd@codeaurora.org>
Ensure that BIF data of secondary slaves is parsed when selecting
the secondary slaves based on a BIF secondary slave object read
out of the primary slave.
Change-Id: Id0daceb37c5c052fd149cd7f8015bb54e5b425fb
Signed-off-by: David Collins <collinsd@codeaurora.org>
Modify the bif_ctrl_register() function so that the bus state is
changed to master-disabled if no BIF slaves are detected. This
can save power when a smart battery pack is not connected.
Change-Id: Ie50203240f10d09656f41e0feab9971bf265e161
Signed-off-by: David Collins <collinsd@codeaurora.org>
Disable the BSI PMIC peripheral when the bus state is changed
to master-disabled. This can be used to save power when no
smart battery pack is detect.
Change-Id: Ic0ce8c11153a6bfa32e4661bf8d791265ebf4f95
Signed-off-by: David Collins <collinsd@codeaurora.org>
Support multiple voltage ADC device instance. Clients
need to register with the voltage ADC using the device
consumer name used to associate with the corresponding
phandle of the VADC. Clients receive the device instance
which is to be used everytime an ADC request is made.
This change involves changing the interface to issue
ADC request and the corresponding clients changes.
Change-Id: If0557bc657fecd172a8cf960900ee93b4bce37f8
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Add a BIF controller driver which is able to interact with the
BSI (battery serial interface) module found within QPNP compliant
PMIC devices.
Change-Id: I6d63da38e3e7e2b41ee29e75a861123ad3ce3c75
Signed-off-by: David Collins <collinsd@codeaurora.org>
Add a BIF framework which implements core features of the MIPI
(Mobile Industry Processor Interace) BIF (Battery Interface)
specification. MIPI-BIF defines an interface which can be used
to communicate with smart battery packs.
BIF controller drivers register with the BIF framework and
implement hardware specific features. BIF consumers can make use
of an extensive API to communicate with BIF slaves present on a
BIF bus.
Change-Id: Id640344aadf878a49e93b12b16a5ecb181dd5aeb
Signed-off-by: David Collins <collinsd@codeaurora.org>