usb: typec: tipd: name TPS_REG_POWER_STATUS field masks

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.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Link: https://patch.msgid.link/fdf373fd9d98ba68c72cfa9e89b4e9bddf06aea8.1779214249.git.radhey.shyam.pandey@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Radhey Shyam Pandey 2026-05-19 23:49:56 +05:30 committed by Greg Kroah-Hartman
parent c6cd2ebca2
commit 8c4871a4fa

View File

@ -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)