public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Abdel Alkuor <alkuor@gmail.com>
Cc: krzysztof.kozlowski+dt@linaro.org, bryan.odonoghue@linaro.org,
	gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, ryan.eleceng@gmail.com,
	robh+dt@kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org, Abdel Alkuor <abdelalkuor@geotab.com>
Subject: Re: [PATCH v10 8/9] USB: typec: tps6598x: Add power status trace for tps25750
Date: Tue, 10 Oct 2023 08:58:51 +0300	[thread overview]
Message-ID: <ZSToG8oKLKZiV8zf@kuha.fi.intel.com> (raw)
In-Reply-To: <20231003155842.57313-9-alkuor@gmail.com>

On Tue, Oct 03, 2023 at 11:58:41AM -0400, Abdel Alkuor wrote:
> From: Abdel Alkuor <abdelalkuor@geotab.com>
> 
> tps25750 power status register is a subset of tps6598x power status
> register.
> 
> Signed-off-by: Abdel Alkuor <abdelalkuor@geotab.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> Changes in v10:
>   - Move 0013-USB-typec-tps6598x-Add-power-status-trace-for-tps257.patch to patch 8
>   - Remove power status trace prototype from device data
> Changes in v9:
>   - Move of_device_id to its original place
>   - Move device data structs to the top of of_device_id
>   - Use device_get_match_data to get device data
> Changes in v8:
>   - Populate of_device_id with device data
>   - Change tps->cb to tps->data
>   - Assign matched data to tps data
> Changes in v7:
>   - Add driver name to commit subject
>   - Create tps25750 interrupt handler
> Changes in v6:
>   - Create tipd callbacks factory 
> Changes in v5:
>   - Incorporating tps25750 into tps6598x driver
>  drivers/usb/typec/tipd/core.c     |  1 +
>  drivers/usb/typec/tipd/tps6598x.h | 19 ++++++++++++++++++
>  drivers/usb/typec/tipd/trace.h    | 33 +++++++++++++++++++++++++++++++
>  3 files changed, 53 insertions(+)
> 
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index e0ff6fc9f256..7bdf1ef5dd1a 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -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,
>  };
>  
> diff --git a/drivers/usb/typec/tipd/tps6598x.h b/drivers/usb/typec/tipd/tps6598x.h
> index f86b5e96efba..01609bf509e4 100644
> --- a/drivers/usb/typec/tipd/tps6598x.h
> +++ b/drivers/usb/typec/tipd/tps6598x.h
> @@ -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)
> diff --git a/drivers/usb/typec/tipd/trace.h b/drivers/usb/typec/tipd/trace.h
> index 28725234a2d8..739b0a2a867d 100644
> --- a/drivers/usb/typec/tipd/trace.h
> +++ b/drivers/usb/typec/tipd/trace.h
> @@ -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),
> -- 
> 2.34.1

-- 
heikki

  reply	other threads:[~2023-10-10  5:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 15:58 [PATCH v10 00/14] Add TPS25750 USB type-C PD controller support Abdel Alkuor
2023-10-03 15:58 ` [PATCH v10 1/9] dt-bindings: usb: tps6598x: Add tps25750 Abdel Alkuor
2023-10-03 15:58 ` [PATCH v10 2/9] USB: typec: tsp6598x: Add cmd timeout and response delay Abdel Alkuor
2023-10-03 15:58 ` [PATCH v10 3/9] USB: typec: tps6598x: Add patch mode to tps6598x Abdel Alkuor
2023-10-03 15:58 ` [PATCH v10 4/9] USB: typec: tps6598x: Refactor tps6598x port registration Abdel Alkuor
2023-10-03 15:58 ` [PATCH v10 5/9] USB: typec: tps6598x: Add device data to of_device_id Abdel Alkuor
2023-10-10  5:55   ` Heikki Krogerus
2023-10-03 15:58 ` [PATCH v10 6/9] USB: typec: tps6598x: Add TPS25750 support Abdel Alkuor
2023-10-10  5:57   ` Heikki Krogerus
2023-10-03 15:58 ` [PATCH v10 7/9] USB: typec: tps6598x: Add trace for tps25750 irq Abdel Alkuor
2023-10-10  5:58   ` Heikki Krogerus
2023-10-03 15:58 ` [PATCH v10 8/9] USB: typec: tps6598x: Add power status trace for tps25750 Abdel Alkuor
2023-10-10  5:58   ` Heikki Krogerus [this message]
2023-10-03 15:58 ` [PATCH v10 9/9] USB: typec: tps6598x: Add " Abdel Alkuor
2023-10-10  5:59   ` Heikki Krogerus
2023-10-10  7:02 ` [PATCH v10 00/14] Add TPS25750 USB type-C PD controller support Greg KH
2023-10-10 11:09   ` Abdel Alkuor
2023-10-10 11:21     ` Greg KH

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=ZSToG8oKLKZiV8zf@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=abdelalkuor@geotab.com \
    --cc=alkuor@gmail.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=ryan.eleceng@gmail.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