From: Lee Jones <lee@kernel.org>
To: "André Draszik" <andre.draszik@linaro.org>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Srinivas Kandagatla <srini@kernel.org>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Peter Griffin <peter.griffin@linaro.org>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
Will McVicker <willmcvicker@google.com>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v9 4/6] mfd: max77759: add Maxim MAX77759 core mfd driver
Date: Thu, 8 May 2025 15:02:59 +0100 [thread overview]
Message-ID: <20250508140259.GN3865826@google.com> (raw)
In-Reply-To: <20250430-max77759-mfd-v9-4-639763e23598@linaro.org>
On Wed, 30 Apr 2025, André Draszik wrote:
> The Maxim MAX77759 is a companion PMIC for USB Type-C applications and
> includes Battery Charger, Fuel Gauge, temperature sensors, USB Type-C
> Port Controller (TCPC), NVMEM, and a GPIO expander.
>
> Fuel Gauge and TCPC have separate and independent I2C addresses,
> register maps, and interrupt lines and are therefore excluded from the
> MFD core device driver here.
>
> The GPIO and NVMEM interfaces are accessed via specific commands to the
> built-in microprocessor. This driver implements an API that client
> drivers can use for accessing those.
>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
>
> ---
> v6: really use postinc
>
> v5:
> * update all (I hope) of Lee's comments:
> * file header C comment (not C++)
> * drop references to 'MFD'
> * extra indent register bit definitions
> * make 'struct max77759' public
> * drop comments that were used for visual separation only
> * drop MAX77759_*_REG_LAST_REGISTER defines
> * add comments to regmap ranges
> * use longer lines
> * sort local variable in reverse christmas tree order
> * update comments in max77759_maxq_command()
> * drop BUILD_BUG_ON()
> * use dev_err() in max77759_maxq_command()
> * reflow max77759_create_i2c_subdev() slightly and update error messages
> * drop useless comment in max77759_add_chained_maxq()
> * reflow max77759_probe()
> * consistent upper-/lower-case in messages
>
> v4:
> * add missing build_bug.h include
> * update an irq chip comment
> * fix a whitespace in register definitions
>
> v2:
> * add kernel doc for max77759_maxq_command() and related structs
> * fix an msec / usec typo
> * add missing error handling of devm_mutex_init() (Christophe)
> * align sentinel in max77759_of_id[] with max77759_i2c_id[]
> (Christophe)
> * some tidy-ups in max77759_maxq_command() (Christophe)
>
> max77759 Lee's updates
> ---
> MAINTAINERS | 2 +
> drivers/mfd/Kconfig | 20 ++
> drivers/mfd/Makefile | 1 +
> drivers/mfd/max77759.c | 690 +++++++++++++++++++++++++++++++++++++++++++
> include/linux/mfd/max77759.h | 165 +++++++++++
> 5 files changed, 878 insertions(+)
This looks okay to me now.
I assume the other patches depend on this one?
[...]
> diff --git a/drivers/mfd/max77759.c b/drivers/mfd/max77759.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..15723ac3ef49771eafd5c2e9984abc550eec7aa1
> --- /dev/null
> +++ b/drivers/mfd/max77759.c
> @@ -0,0 +1,690 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright 2020 Google Inc
> + * Copyright 2025 Linaro Ltd.
> + *
> + * Core driver for Maxim MAX77759 companion PMIC for USB Type-C
> + */
[...]
> +int max77759_maxq_command(struct max77759 *max77759,
> + const struct max77759_maxq_command *cmd,
> + struct max77759_maxq_response *rsp)
> +{
> + DEFINE_FLEX(struct max77759_maxq_response, _rsp, rsp, length, 1);
> + struct device *dev = regmap_get_device(max77759->regmap_maxq);
> + static const unsigned int timeout_ms = 200;
> + int ret;
> +
> + if (cmd->length > MAX77759_MAXQ_OPCODE_MAXLENGTH)
> + return -EINVAL;
> +
> + /*
> + * As a convenience for API users when issuing simple commands, rsp is
> + * allowed to be NULL. In that case we need a temporary here to write
> + * the response to, as we need to verify that the command was indeed
> + * completed correctly.
> + */
> + if (!rsp)
> + rsp = _rsp;
> +
> + if (!rsp->length || rsp->length > MAX77759_MAXQ_OPCODE_MAXLENGTH)
> + return -EINVAL;
> +
> + guard(mutex)(&max77759->maxq_lock);
> +
> + reinit_completion(&max77759->cmd_done);
> +
> + /*
> + * MaxQ latches the message when the DATAOUT32 register is written. If
> + * cmd->length is shorter we still need to write 0 to it.
> + */
> + ret = regmap_bulk_write(max77759->regmap_maxq,
> + MAX77759_MAXQ_REG_AP_DATAOUT0, cmd->cmd,
> + cmd->length);
> + if (!ret && cmd->length < MAX77759_MAXQ_OPCODE_MAXLENGTH)
> + ret = regmap_write(max77759->regmap_maxq,
> + MAX77759_MAXQ_REG_AP_DATAOUT32, 0);
> + if (ret) {
> + dev_err(dev, "writing command failed: %d\n", ret);
> + return ret;
> + }
> +
> + /* wait for response from MaxQ */
If you have to respin this patch, please s/wait/Wait/.
If not, please send a subsequent patch.
--
Lee Jones [李琼斯]
next prev parent reply other threads:[~2025-05-08 14:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 9:03 [PATCH v9 0/6] Maxim Integrated MAX77759 PMIC MFD-based drivers André Draszik
2025-04-30 9:03 ` [PATCH v9 1/6] dt-bindings: gpio: add max77759 binding André Draszik
2025-04-30 10:50 ` Rob Herring (Arm)
2025-04-30 9:03 ` [PATCH v9 2/6] dt-bindings: nvmem: " André Draszik
2025-04-30 10:50 ` Rob Herring (Arm)
2025-04-30 9:03 ` [PATCH v9 3/6] dt-bindings: mfd: " André Draszik
2025-04-30 9:03 ` [PATCH v9 4/6] mfd: max77759: add Maxim MAX77759 core mfd driver André Draszik
2025-05-08 14:02 ` Lee Jones [this message]
2025-05-09 6:45 ` André Draszik
2025-04-30 9:03 ` [PATCH v9 5/6] gpio: max77759: add Maxim MAX77759 gpio driver André Draszik
2025-05-13 9:20 ` Linus Walleij
2025-05-13 9:34 ` Lee Jones
2025-05-13 22:00 ` Linus Walleij
2025-04-30 9:03 ` [PATCH v9 6/6] nvmem: max77759: add Maxim MAX77759 NVMEM driver André Draszik
2025-05-09 11:58 ` Srinivas Kandagatla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250508140259.GN3865826@google.com \
--to=lee@kernel.org \
--cc=andre.draszik@linaro.org \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=kernel-team@android.com \
--cc=krzk+dt@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=srini@kernel.org \
--cc=tudor.ambarus@linaro.org \
--cc=willmcvicker@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.