Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2310343rdb; Mon, 9 Oct 2023 22:59:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEof29WNbGC+T2rWP4wWueIFvmfoC/Ai52vmJ13js+EeRZviLx7yYSz/wGDZnNWSgg95km8 X-Received: by 2002:a17:902:9b8e:b0:1c3:3363:8aea with SMTP id y14-20020a1709029b8e00b001c333638aeamr13668080plp.61.1696917581533; Mon, 09 Oct 2023 22:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696917581; cv=none; d=google.com; s=arc-20160816; b=DrTqq2R2S5ltlIKAvNgcdMsF8FQ8ZTXy7JQDO6JZZuXVUqMRrZwVq4J7apOhnlrwJb tMkJpVX2VXD9/TC4vF3qMD5fQxS0Sne7sUOou350PZcfHplee0NkvDDf88KuL2q4MZ24 XRQuU565hbNMI8pM1qU5u//ySvhMPkibeBqMOlcw/lRwbHqazmSJYo2bY6Fa3ef66+T3 MclTn3IRGwxWT7Sz27iu215xYiQp7U9cAvdXJv6FgHTAPLmAvRf1drTPi3oBQRhvjW15 AWZy8MHU2dbegFZ/nWYpUcu9LWiXaVAbaYLKd0aG/76MzfR4yNXcxCs+o23RrgdKnXbL lEcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZkS7z4MBTZ8kOG8Gvrax0iriLHWX+UW0ZrQw32JEE6g=; fh=4FTxD8y/AkqrxGSds7He/tgcu1K8JroTMbxcGH2DVaw=; b=Uz/oFc5QkFyqxj9WPVwMZIkQTIOCSL8zbNgMoz1rauV2HsCq92R0GY3Obz7fEn9BvG dLB/5op13X4JUO243jmbH9XmJQyjnBBltlHKzePBRmsHxinpotkLkjurol+sjYFjI45F 1epPyBQ4ACoMuRFJ1TJmmtad0xZqZG4ADMXJHRFy3krtXZdVfJ2idzzLvrm/VmvuI5i2 /oHUnvsBNMCkbW+Jz6vA/raL9s7ptAewAg43S7C6h4EDuoHLZFmyiKuY/HLluJFh+R8a ZUeNDk87ER0aYtAdWUfUgLnTVqRx2C2HtHplEdmj4DU+w2j64KapS9P406AEwhy52Cp2 olCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z5ghSNgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id g17-20020a170902d1d100b001c6240dec44si10508178plb.389.2023.10.09.22.59.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 22:59:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z5ghSNgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A42E980C2E2E; Mon, 9 Oct 2023 22:59:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442175AbjJJF7B (ORCPT + 99 others); Tue, 10 Oct 2023 01:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442180AbjJJF66 (ORCPT ); Tue, 10 Oct 2023 01:58:58 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2E129F; Mon, 9 Oct 2023 22:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696917537; x=1728453537; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=0hvfx6b9dnQ2oV3bSyrplOZ5XbLFJIzuKxTSg1jyW7I=; b=Z5ghSNgHOe0fwQpclke0eG55LGFvVVzH7WzMRuh1fcpeNqYL85xxOhhr s7sV+uYrr39eSceAemw21U3/FCru1s5Zjs+GiR3aXJign0C9+nIP5YtkP 8EQbrTmh+YX7ntAi9t7GYuPh0Qprb8ElBDi6aHdD7Z6ZwBOit3DWfK7VC h8nyHs3KzZXhif8OjrrVdpPWULfA94elfZSwQMSzeUm/SbPMd7/vXI9CB jngYrebxJLor8IYsj/LlGoLXM6ZwtGUAKp6ZNNkCcIPWVz2QFj5UbAXgz gBW9QDwikKpOwtb8DtaL1YP3mugF+EgZk0SB6XfeG9nbu67DxdmUJkbHn w==; X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="2904072" X-IronPort-AV: E=Sophos;i="6.03,211,1694761200"; d="scan'208";a="2904072" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2023 22:58:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="1084639496" X-IronPort-AV: E=Sophos;i="6.03,211,1694761200"; d="scan'208";a="1084639496" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga005.fm.intel.com with SMTP; 09 Oct 2023 22:58:52 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 10 Oct 2023 08:58:51 +0300 Date: Tue, 10 Oct 2023 08:58:51 +0300 From: Heikki Krogerus To: Abdel Alkuor 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 Subject: Re: [PATCH v10 8/9] USB: typec: tps6598x: Add power status trace for tps25750 Message-ID: References: <20231003155842.57313-1-alkuor@gmail.com> <20231003155842.57313-9-alkuor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231003155842.57313-9-alkuor@gmail.com> X-Spam-Status: No, score=2.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 09 Oct 2023 22:59:38 -0700 (PDT) X-Spam-Level: ** On Tue, Oct 03, 2023 at 11:58:41AM -0400, Abdel Alkuor wrote: > From: Abdel Alkuor > > tps25750 power status register is a subset of tps6598x power status > register. > > Signed-off-by: Abdel Alkuor Reviewed-by: Heikki Krogerus > --- > 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