Re: [PATCH 3/3] usb: typec: tipd: name TPS_REG_POWER_STATUS field masks

From: Heikki Krogerus

Date: Mon May 18 2026 - 06:39:15 EST


On Wed, May 13, 2026 at 11:58:50PM +0530, Radhey Shyam Pandey wrote:
> Define named masks for Power Status fields (connection and source/sink)
> and reuse them consistently for both field extraction and value
> construction. This avoids raw bit usage, keeps the definitions aligned.
> No functional change.
>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xxxxxxx>

Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>

> ---
> drivers/usb/typec/tipd/tps6598x.h | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/typec/tipd/tps6598x.h b/drivers/usb/typec/tipd/tps6598x.h
> index 03edbb77bbd6..d4140f4da5bb 100644
> --- a/drivers/usb/typec/tipd/tps6598x.h
> +++ b/drivers/usb/typec/tipd/tps6598x.h
> @@ -142,9 +142,13 @@
> #define TPS_SYSTEM_POWER_STATE_S4 0x04
> #define TPS_SYSTEM_POWER_STATE_S5 0x05
>
> -/* TPS_REG_POWER_STATUS bits */
> -#define TPS_POWER_STATUS_CONNECTION(x) TPS_FIELD_GET(BIT(0), (x))
> -#define TPS_POWER_STATUS_SOURCESINK(x) TPS_FIELD_GET(BIT(1), (x))
> +/* TPS_REG_POWER_STATUS bits (masks shared by TPS_FIELD_GET accessors and FIELD_PREP) */
> +#define TPS_POWER_STATUS_CONNECTION_MASK BIT(0)
> +#define TPS_POWER_STATUS_SOURCESINK_MASK BIT(1)
> +#define TPS_POWER_STATUS_CONNECTION(x) \
> + TPS_FIELD_GET(TPS_POWER_STATUS_CONNECTION_MASK, (x))
> +#define TPS_POWER_STATUS_SOURCESINK(x) \
> + TPS_FIELD_GET(TPS_POWER_STATUS_SOURCESINK_MASK, (x))
> #define TPS_POWER_STATUS_BC12_DET(x) TPS_FIELD_GET(BIT(2), (x))
>
> #define TPS_POWER_STATUS_TYPEC_CURRENT_MASK GENMASK(3, 2)
> --
> 2.44.4

--
heikki