Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2886714pxb; Fri, 12 Feb 2021 04:08:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHNkDUCHXecCwPRA9c9YUQgukyvhGfo3+fbQ4ODktAcpv5UMjMaTV2YRCIFJBNc1C2NYCi X-Received: by 2002:a17:906:7191:: with SMTP id h17mr2794557ejk.54.1613131713747; Fri, 12 Feb 2021 04:08:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613131713; cv=none; d=google.com; s=arc-20160816; b=GC7uHYqBeTB36oeilCB02+1q3HANLRPOwZwYuHHkKZl6JRLqKR7YJasUlH4cSJ0g3K uuP8cWZ+krsfwSnBxwzLo0hb530O/sOSSEapVTMq1BSbqeenkkQCyX5TNIceGLKY05pM yZSH4C/d3ALPwHAto+6OKfypJT0jJ2ozIkduEqiuWQWfOyHPvZ1SU0y6e5qJxDzOocw/ b/904HScvBuBsLOVGpqycef1UOX4Yggm0oYce+Vq0/dXZr0z3IZZO1n+bfGvxrykTfxb q0H/TWPlhxe18d8Bt8jYKl97k5PKNEfjg9iytoSVlu4lpMmoxUcts7/PFlJUFgmR3M8f Wj7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=AjVbGx7KTCh0dyimrIwEEFXasJxn0ADAktPvjNmYumM=; b=rsLVyLOt8Keqne6rQ/99GS75nw4QDeGXHzx71tsCmzw2xEneF+2mO/BOLTrPZyhVsv 6ZHLqf8tK4rZ90tRzqw/hKrxBhh+mP95p0LtTmeaWkwAzN57nfGPcLX2GE4SeoteNOVu dI5Xf6pRHaotb9kv6kLf+llbZvOJ0Q8QNQ+1GsTN3vtRT/o8jW81cyqWVRKLEi4WiRW/ YyPuPo64IyKhpYGGKhDRpaID3pyZvuIugxqPjaf4ktosOUytH8N2oWHGYzdmQBuklvBy NejbcQxJuQmaiqPXiWvH+kGDLFCk5aDB00LyxZ/joSGMTq7+0s/5sYTN3Vb28ubJlYN2 XaYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gy24si6112059ejb.484.2021.02.12.04.08.10; Fri, 12 Feb 2021 04:08:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231229AbhBLMFo (ORCPT + 99 others); Fri, 12 Feb 2021 07:05:44 -0500 Received: from honk.sigxcpu.org ([24.134.29.49]:47052 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbhBLMFV (ORCPT ); Fri, 12 Feb 2021 07:05:21 -0500 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 903B0FB03; Fri, 12 Feb 2021 13:04:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tTQevExgCqMb; Fri, 12 Feb 2021 13:04:34 +0100 (CET) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 866B14188B; Fri, 12 Feb 2021 13:04:33 +0100 (CET) From: =?UTF-8?q?Guido=20G=C3=BCnther?= To: Heikki Krogerus , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH v2 0/4] usb: typec: tps6598x: Add IRQ flag and register tracing Date: Fri, 12 Feb 2021 13:04:29 +0100 Message-Id: X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds tracing events for the chips IRQ and registers that are useful to figure out the current data and power status. This came about since diagnosing why a certain usb-c hub or dp-alt-mode adapter fails is hard with the information in /sys/class/typec alone since this does not have a timeline of events (and we don't want every typec user having to also buy a PD analyzer). With this series debugging these kinds of things starts to become fun: # echo 1 > /sys/kernel/debug/tracing/events/tps6598x/enable # cat /sys/kernel/debug/tracing/trace_pipe irq/79-0-003f-526 [003] .... 512.717871: tps6598x_irq: event1=PLUG_EVENT|DATA_STATUS_UPDATE|STATUS_UPDATE, event2= irq/79-0-003f-526 [003] .... 512.722408: tps6598x_status: conn: conn-Ra, pp_5v0: off, pp_hv: off, pp_ext: off, pp_cable: off, pwr-src: vin-3p3, vbus: vSafe0V, usb-host: no, legacy: no, flags: PLUG_PRESENT|PORTROLE|DATAROLE irq/79-0-003f-526 [003] .... 512.727127: tps6598x_data_status: DATA_CONNECTION|USB2_CONNECTION|USB3_CONNECTION irq/79-0-003f-526 [003] .... 512.769571: tps6598x_irq: event1=PP_SWITCH_CHANGED|STATUS_UPDATE, event2= irq/79-0-003f-526 [003] .... 512.773380: tps6598x_status: conn: conn-Ra, pp_5v0: out, pp_hv: off, pp_ext: off, pp_cable: in, pwr-src: vin-3p3, vbus: vSafe0V, usb-host: no, legacy: no, flags: PLUG_PRESENT|PORTROLE|DATAROLE|VCONN irq/79-0-003f-526 [003] .... 512.872450: tps6598x_irq: event1=POWER_STATUS_UPDATE|PD_STATUS_UPDATE, event2= irq/79-0-003f-526 [003] .... 512.876311: tps6598x_status: conn: conn-Ra, pp_5v0: out, pp_hv: off, pp_ext: off, pp_cable: in, pwr-src: vin-3p3, vbus: vSafe0V, usb-host: no, legacy: no, flags: PLUG_PRESENT|PORTROLE|DATAROLE|VCONN irq/79-0-003f-526 [003] .... 512.880237: tps6598x_power_status: conn: 1, pwr-role: source, typec: usb, bc: sdp irq/79-0-003f-526 [003] .... 513.072682: tps6598x_irq: event1=STATUS_UPDATE, event2= irq/79-0-003f-526 [003] .... 513.076390: tps6598x_status: conn: conn-Ra, pp_5v0: out, pp_hv: off, pp_ext: off, pp_cable: in, pwr-src: vin-3p3, vbus: vSafe5V, usb-host: no, legacy: no, flags: PLUG_PRESENT|PORTROLE|DATAROLE|VCONN irq/79-0-003f-526 [003] .... 513.090676: tps6598x_irq: event1=ERROR_CANNOT_PROVIDE_PWR, event2= irq/79-0-003f-526 [003] .... 513.094368: tps6598x_status: conn: conn-Ra, pp_5v0: out, pp_hv: off, pp_ext: off, pp_cable: in, pwr-src: vin-3p3, vbus: vSafe5V, usb-host: no, legacy: no, flags: PLUG_PRESENT|PORTROLE|DATAROLE|VCONN irq/79-0-003f-526 [003] .... 513.109606: tps6598x_irq: event1=NEW_CONTRACT_AS_PROVIDER|POWER_STATUS_UPDATE|STATUS_UPDATE|SRC_TRANSITION, event2= irq/79-0-003f-526 [003] .... 513.113777: tps6598x_status: conn: conn-Ra, pp_5v0: out, pp_hv: off, pp_ext: off, pp_cable: in, pwr-src: vin-3p3, vbus: pd, usb-host: no, legacy: no, flags: PLUG_PRESENT|PORTROLE|DATAROLE|VCONN irq/79-0-003f-526 [003] .... 513.117475: tps6598x_power_status: conn: 1, pwr-role: source, typec: pd, bc: sdp irq/79-0-003f-526 [003] .... 513.137469: tps6598x_irq: event1=VDM_RECEIVED, event2= irq/79-0-003f-526 [003] .... 513.141570: tps6598x_status: conn: conn-Ra, pp_5v0: out, pp_hv: off, pp_ext: off, pp_cable: in, pwr-src: vin-3p3, vbus: pd, usb-host: no, legacy: no, flags: PLUG_PRESENT|PORTROLE|DATAROLE|VCONN irq/79-0-003f-526 [003] .... 513.281926: tps6598x_irq: event1=VDM_RECEIVED, event2= irq/79-0-003f-526 [003] .... 513.285638: tps6598x_status: conn: conn-Ra, pp_5v0: out, pp_hv: off, pp_ext: off, pp_cable: in, pwr-src: vin-3p3, vbus: pd, usb-host: no, legacy: no, flags: PLUG_PRESENT|PORTROLE|DATAROLE|VCONN irq/79-0-003f-526 [003] .... 513.300515: tps6598x_irq: event1=VDM_RECEIVED|DATA_STATUS_UPDATE, event2= irq/79-0-003f-526 [003] .... 513.304226: tps6598x_status: conn: conn-Ra, pp_5v0: out, pp_hv: off, pp_ext: off, pp_cable: in, pwr-src: vin-3p3, vbus: pd, usb-host: no, legacy: no, flags: PLUG_PRESENT|PORTROLE|DATAROLE|VCONN irq/79-0-003f-526 [003] .... 513.308302: tps6598x_data_status: DATA_CONNECTION|USB2_CONNECTION|USB3_CONNECTION|DP_CONNECTION, DP pinout D It should not impose any problems for firmwares that don't have IRQs for the registers enabled. The trace will then just be missing those events. Patch is against next-20210210. changes from v1: - Fix issues on 32bit arches and missing include spotted by kbuild (build testes on mips) Guido Günther (4): usb: typec: tps6598x: Add trace event for IRQ events usb: typec: tps6598x: Add trace event for status register usb: typec: tps6598x: Add trace event for power status register usb: typec: tps6598x: Add trace event for data status drivers/usb/typec/Makefile | 3 + drivers/usb/typec/tps6598x.c | 66 ++++--- drivers/usb/typec/tps6598x.h | 185 +++++++++++++++++++ drivers/usb/typec/tps6598x_trace.h | 283 +++++++++++++++++++++++++++++ 4 files changed, 511 insertions(+), 26 deletions(-) create mode 100644 drivers/usb/typec/tps6598x.h create mode 100644 drivers/usb/typec/tps6598x_trace.h -- 2.30.0