Commit e5d4a413 authored by Abdel Alkuor's avatar Abdel Alkuor Committed by Greg Kroah-Hartman

USB: typec: tps6598x: Add power status trace for tps25750

tps25750 power status register is a subset of tps6598x power status
register.
Signed-off-by: default avatarAbdel Alkuor <abdelalkuor@geotab.com>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20231003155842.57313-9-alkuor@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0aaa6d16
......@@ -1411,6 +1411,7 @@ static const struct tipd_data tps6598x_data = {
static const struct tipd_data tps25750_data = {
.irq_handler = tps25750_interrupt,
.register_port = tps25750_register_port,
.trace_power_status = trace_tps25750_power_status,
.apply_patch = tps25750_apply_patch,
};
......
......@@ -161,6 +161,25 @@
#define TPS_POWER_STATUS_BC12_STATUS_CDP 2
#define TPS_POWER_STATUS_BC12_STATUS_DCP 3
/* TPS25750_REG_POWER_STATUS bits */
#define TPS25750_POWER_STATUS_CHARGER_DETECT_STATUS_MASK GENMASK(7, 4)
#define TPS25750_POWER_STATUS_CHARGER_DETECT_STATUS(p) \
TPS_FIELD_GET(TPS25750_POWER_STATUS_CHARGER_DETECT_STATUS_MASK, (p))
#define TPS25750_POWER_STATUS_CHARGER_ADVERTISE_STATUS_MASK GENMASK(9, 8)
#define TPS25750_POWER_STATUS_CHARGER_ADVERTISE_STATUS(p) \
TPS_FIELD_GET(TPS25750_POWER_STATUS_CHARGER_ADVERTISE_STATUS_MASK, (p))
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_DISABLED 0
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_IN_PROGRESS 1
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_NONE 2
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_SPD 3
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_BC_1_2_CPD 4
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_BC_1_2_DPD 5
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_DIV_1_DCP 6
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_DIV_2_DCP 7
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_DIV_3_DCP 8
#define TPS25750_POWER_STATUS_CHARGER_DET_STATUS_1_2V_DCP 9
/* TPS_REG_DATA_STATUS bits */
#define TPS_DATA_STATUS_DATA_CONNECTION BIT(0)
#define TPS_DATA_STATUS_UPSIDE_DOWN BIT(1)
......
......@@ -166,6 +166,19 @@
{ TPS_POWER_STATUS_BC12_STATUS_CDP, "cdp" }, \
{ TPS_POWER_STATUS_BC12_STATUS_SDP, "sdp" })
#define show_tps25750_power_status_charger_detect_status(power_status) \
__print_symbolic(TPS25750_POWER_STATUS_CHARGER_DETECT_STATUS(power_status), \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_DISABLED, "disabled"}, \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_IN_PROGRESS, "in progress"}, \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_NONE, "none"}, \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_SPD, "spd"}, \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_BC_1_2_CPD, "cpd"}, \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_BC_1_2_DPD, "dpd"}, \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_DIV_1_DCP, "divider 1 dcp"}, \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_DIV_2_DCP, "divider 2 dcp"}, \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_DIV_3_DCP, "divider 3 dpc"}, \
{ TPS25750_POWER_STATUS_CHARGER_DET_STATUS_1_2V_DCP, "1.2V dpc"})
#define TPS_DATA_STATUS_FLAGS_MASK (GENMASK(31, 0) ^ (TPS_DATA_STATUS_DP_PIN_ASSIGNMENT_MASK | \
TPS_DATA_STATUS_TBT_CABLE_SPEED_MASK | \
TPS_DATA_STATUS_TBT_CABLE_GEN_MASK))
......@@ -299,6 +312,26 @@ TRACE_EVENT(tps6598x_power_status,
)
);
TRACE_EVENT(tps25750_power_status,
TP_PROTO(u16 power_status),
TP_ARGS(power_status),
TP_STRUCT__entry(
__field(u16, power_status)
),
TP_fast_assign(
__entry->power_status = power_status;
),
TP_printk("conn: %d, pwr-role: %s, typec: %s, charger detect: %s",
!!TPS_POWER_STATUS_CONNECTION(__entry->power_status),
show_power_status_source_sink(__entry->power_status),
show_power_status_typec_status(__entry->power_status),
show_tps25750_power_status_charger_detect_status(__entry->power_status)
)
);
TRACE_EVENT(tps6598x_data_status,
TP_PROTO(u32 data_status),
TP_ARGS(data_status),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment