Now that the channel identifiers are passed through 'void *mssg' in mbox_send_message(), this driver needs to know the message format the mailbox controller expects. In order to not introduce a build dependency on the mailbox controller message format, I chose to use here a temporary 'unsigned int msg[2]' instead of 'struct exynos_mbox_msg'. Will switch to the message format struct after both drivers get in Linus's tree. Description and change log below. Thanks! ta Alive Clock and Power Manager (ACPM) Message Protocol is defined for the purpose of communication between the ACPM firmware and masters (AP, AOC, ...). ACPM firmware operates on the Active Power Management (APM) module that handles overall power activities. This protocol driver provides the interface for all the client drivers making use of the features offered by the APM. Add ACPM protocol support. Changes in v6: - Kconfig: s/depends on EXYNOS_MBOX/depends on MAILBOX, build time dependency. - exynos-acpm-pmic: constify tx buf, make acpm_chan_id unsigned int, u32 cmd[4] instead of u32 *cmd on function params. - exynos-acpm: - drop acpm_memcpy_{from,to}io32 wrappers of __io{read, write}32_copy. Right now unailgned accesses can not happen because the only protocol implemented (PMIC), uses on stack u32 buffers. - constify xfer to make it clear that the caller keeps ownership and must ensure it is valid memory through the entire xfer time. - rework acpm_get_by_phandle() and use try_module_get and device links. With the device links, when acpm is unbind, its consumers are unbind first. Thus the acpm drvdata will be destroyed after there are no consumers alive, there's no need for kref. try_module_get() is used because we'd like to be able to delete the acpm module only when there are no consumers left. - make 'struct acpm_xfer' private (move it in drivers/firmware/samsung/exynos-acpm.h). Get rid of 'struct acpm_msg' and use 'const u32 *txcmd' - bindings: add Krzysztof's R-b tag - Link to v5: https://lore.kernel.org/r/20241220-gs101-acpm-v5-0-4f26b7fb3f5f@xxxxxxxxxx Changes in v5: - depends on: - Link: https://lore.kernel.org/all/20241220-acpm-v4-upstream-mbox-v6-0-a6942806e52a@xxxxxxxxxx/ - it uses the newly introduced mbox_request_channel_by_args() API - dt-bindings: - drop redundant binding word from the commit subject - remove extra blank line and update example with by complying to #mbox-cells = <0>; - drop Krzysztof's R-b tag as the example was updated. - driver: - channel identifiers are discovered at runtime, use mbox_request_channel_by_args() instead of specifying them in DT. - don't call mbox_free_channel() for PTR_ERR or NULL channels. - introduce common method to init xfer - rename guard name from __EXYNOS_ACPM_MFD_H__ to __EXYNOS_ACPM_PMIC_H__ - stop exporting devm_acpm_get_by_phandle(). We'll export the symbol once a client is introduced. - rebase on top of v6.13-rc3 - Link to v4: https://lore.kernel.org/r/20241212-b4-acpm-v4-upstream-firmware-v4-0-3f18ca64f1b9@xxxxxxxxxx Changes in v4: - rename bindings filename based on compatible - bindings: drop nodename - bindings: drop mboxes description - bindings: remove initdata-base prop, and define it based on compatible - bindings: move additionalProperties after the required block - bindings: drop firmware node from examples - bindings: drop unused label in examples - bindings: rename node to power-management - driver: switch 2 macros to inline functions for readability - driver: add checl to avoid shift overflow on these inline functions - driver: use ktime_to_ms(ktime_get()) to record ktime - driver: use the default non-relaxed IO accessors - driver: remove atomic handling - driver: remove stray of_match_ptr() - driver: move header in include/linux/firmware - driver: make sure to, from are 32-bit aligned and count is a 32bit quantity before calling __{ioread, write}32_copy - driver: reject IRQ channels (not supported yet_ at the top of do_xfer, instead of when waiting for response. Changes in v3: - decouple the mailbox controller driver from the ACPM protocol driver - address Krzysztof's eview comments - add ACPM PMIC protocol helpers v2: https://lore.kernel.org/linux-arm-kernel/20241017163649.3007062-1-tudor.ambarus@xxxxxxxxxx/ v1: https://lore.kernel.org/linux-arm-kernel/20241004165301.1979527-1-tudor.ambarus@xxxxxxxxxx/ Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx> --- Tudor Ambarus (3): dt-bindings: firmware: add google,gs101-acpm-ipc firmware: add Exynos ACPM protocol driver MAINTAINERS: add entry for the Samsung Exynos ACPM mailbox protocol .../bindings/firmware/google,gs101-acpm-ipc.yaml | 50 ++ MAINTAINERS | 10 + drivers/firmware/Kconfig | 1 + drivers/firmware/Makefile | 1 + drivers/firmware/samsung/Kconfig | 14 + drivers/firmware/samsung/Makefile | 4 + drivers/firmware/samsung/exynos-acpm-pmic.c | 229 ++++++ drivers/firmware/samsung/exynos-acpm-pmic.h | 29 + drivers/firmware/samsung/exynos-acpm.c | 767 +++++++++++++++++++++ drivers/firmware/samsung/exynos-acpm.h | 23 + .../linux/firmware/samsung/exynos-acpm-protocol.h | 49 ++ 11 files changed, 1177 insertions(+) --- base-commit: 5bc55a333a2f7316b58edc7573e8e893f7acb532 change-id: 20241220-gs101-acpm-047922ab4654 Best regards, -- Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>