From: Greg KH <gregkh@linuxfoundation.org>
To: Julien Panis <jpanis@baylibre.com>
Cc: lee@kernel.org, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, corbet@lwn.net, arnd@arndb.de,
derek.kiernan@xilinx.com, dragan.cvetic@xilinx.com,
yi.l.liu@intel.com, jgg@ziepe.ca, razor@blackwall.org,
stephen@networkplumber.org, prabhakar.csengg@gmail.com,
contact@emersion.fr, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
sterzik@ti.com, u-kumar1@ti.com, eblanc@baylibre.com,
jneanne@baylibre.com
Subject: Re: [PATCH v5 4/4] misc: tps6594-pfsm: Add driver for TI TPS6594 PFSM
Date: Thu, 30 Mar 2023 10:35:11 +0200 [thread overview]
Message-ID: <ZCVJv-erahM_Jdug@kroah.com> (raw)
In-Reply-To: <20230330082006.11216-5-jpanis@baylibre.com>
On Thu, Mar 30, 2023 at 10:20:06AM +0200, Julien Panis wrote:
> This PFSM controls the operational modes of the PMIC:
> - STANDBY and LP_STANDBY,
> - ACTIVE state,
> - MCU_ONLY state,
> - RETENTION state, with or without DDR and/or GPIO retention.
> Depending on the current operational mode, some voltage domains
> remain energized while others can be off.
>
> This PFSM is also used to trigger a firmware update, and provides
> R/W access to device registers.
What userspace code uses these new ioctls? Do you have a pointer to it
anywhere?
> --- /dev/null
> +++ b/include/uapi/linux/tps6594_pfsm.h
> @@ -0,0 +1,45 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +/*
> + * Userspace ABI for TPS6594 PMIC Pre-configurable Finite State Machine
> + *
> + * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
> + */
> +
> +#ifndef __TPS6594_PFSM_H
> +#define __TPS6594_PFSM_H
> +
> +#include <linux/const.h>
> +#include <linux/ioctl.h>
> +#include <linux/types.h>
> +
> +/* PFSM state definitions */
> +enum pfsm_state {
> + PMIC_ACTIVE_STATE,
> + PMIC_MCU_ONLY_STATE,
> + PMIC_RETENTION_STATE
> +};
> +
> +/**
> + * struct pmic_state - PMIC state identification
> + * @state: PFSM destination state
> + * @options: options for destination state
> + */
> +struct pmic_state {
> + enum pfsm_state state;
> + __u8 options;
> +};
> +
> +/* Commands */
> +#define PMIC_BASE 'P'
> +
> +#define PMIC_GOTO_STANDBY _IO(PMIC_BASE, 0)
> +#define PMIC_GOTO_LP_STANDBY _IO(PMIC_BASE, 1)
> +#define PMIC_UPDATE_PGM _IO(PMIC_BASE, 2)
> +#define PMIC_SET_STATE _IOW(PMIC_BASE, 3, struct pmic_state)
> +
> +/* Options for destination state */
> +#define PMIC_GPIO_RETENTION _BITUL(0)
> +#define PMIC_DDR_RETENTION _BITUL(1)
> +#define PMIC_MCU_ONLY_STARTUP_DEST _BITUL(2)
Please read Documentation/driver-api/ioctl.rst which says:
* Bitfields and enums generally work as one would expect them to,
but some properties of them are implementation-defined, so it is
better to avoid them completely in ioctl interfaces.
For a brand-new ioctl interface, you did both of these unrecommended
things. Why set yourself for complexity when you do not need to?
thanks,
greg k-h
next prev parent reply other threads:[~2023-03-30 8:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 8:20 [PATCH v5 0/4] TI TPS6594 PMIC support (Core, ESM, PFSM) Julien Panis
2023-03-30 8:20 ` [PATCH v5 1/4] dt-bindings: mfd: Add TI TPS6594 PMIC Julien Panis
2023-03-30 8:40 ` Krzysztof Kozlowski
2023-03-30 14:25 ` Rob Herring
2023-03-30 8:20 ` [PATCH v5 2/4] mfd: tps6594: Add driver for " Julien Panis
2023-03-30 8:20 ` [PATCH v5 3/4] misc: tps6594-esm: Add driver for TI TPS6594 ESM Julien Panis
2023-03-30 8:20 ` [PATCH v5 4/4] misc: tps6594-pfsm: Add driver for TI TPS6594 PFSM Julien Panis
2023-03-30 8:35 ` Greg KH [this message]
2023-03-30 15:45 ` Julien Panis
2023-03-30 17:10 ` [PATCH v5 0/4] TI TPS6594 PMIC support (Core, ESM, PFSM) Lee Jones
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=ZCVJv-erahM_Jdug@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arnd@arndb.de \
--cc=contact@emersion.fr \
--cc=corbet@lwn.net \
--cc=derek.kiernan@xilinx.com \
--cc=devicetree@vger.kernel.org \
--cc=dragan.cvetic@xilinx.com \
--cc=eblanc@baylibre.com \
--cc=jgg@ziepe.ca \
--cc=jneanne@baylibre.com \
--cc=jpanis@baylibre.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=prabhakar.csengg@gmail.com \
--cc=razor@blackwall.org \
--cc=robh+dt@kernel.org \
--cc=stephen@networkplumber.org \
--cc=sterzik@ti.com \
--cc=u-kumar1@ti.com \
--cc=yi.l.liu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).