From patchwork Tue Sep 28 15:54:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12523165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D643C433FE for ; Tue, 28 Sep 2021 15:55:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D27061206 for ; Tue, 28 Sep 2021 15:55:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241721AbhI1P5C (ORCPT ); Tue, 28 Sep 2021 11:57:02 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:46195 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241514AbhI1P5B (ORCPT ); Tue, 28 Sep 2021 11:57:01 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 96434580C24; Tue, 28 Sep 2021 11:55:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 28 Sep 2021 11:55:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=iEV8ydA3V+61q tB26+TqR77mGD10Kt8vZjivysugJU8=; b=c840B/y/OheuY+uzVpRWr2ruwIsGU u0fBoBA4X8SlpwbKvewW12BOwG1F3SMjhMd0rHgO/xGe5KhHhEur5/jBjgNv1yk4 P5S1z5+5XqiEXKN7FF1YqbWWufxy8t7xJOVKU5N/LxPTdd27c0rTfptmbPdzFjZM +VAOnMVh+J+KLYCUQ6oKDC2zWDJxrJWhIbxUxCvXx5nnLdqJKBiphF0/thpvzs/x lCzZ3PQ++eECks2ZWLFBCJ8+/hH70XnSPkm92XdOqi5FZAu98kmgGLC9oKnYk+Jx CE77sOa8fvvskWVORnsT3OIVt0XqzqdnR8PnhQUNRPKDoyfLbPvf89UUA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=iEV8ydA3V+61qtB26+TqR77mGD10Kt8vZjivysugJU8=; b=FtcsFRij Q3Lg9OHHPijQAI7s7PoFKB0jpabNPhqlYuSrFMCj1es6vGmbgPjiFvuTOVmox3xN JOeS/qit3k1O7YS7O5IPUbmKUwXGAFN8lyIzlniylDrjJD1ljU17V0lv6uQGPJIN duy7QDy0rnuDNVzxu+FbjdXUdvcgR9EHcjv8UgJp3rHKkeAHKd/jRINaO10aZusE ihlSXotvJwc2GlZQTjRoObeL9OZx/zwFqwUCvYfYaED2tiURQhb/MeU1xckuplNa S1gySrd60kluOij0QVvMhfaZGCj+MYgN8BTjc0WDfIY97xHL9a/HpebrzxSH/SnD Ok9QW8g3NcqdBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudektddgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Sep 2021 11:55:19 -0400 (EDT) From: Sven Peter To: Heikki Krogerus , Greg Kroah-Hartman , "Bryan O'Donoghue" Cc: Sven Peter , =?utf-8?q?Guido_G=C3=BCnther?= , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Hector Martin , Mohamed Mediouni , Stan Skowronek , Mark Kettenis , Alexander Graf , Alyssa Rosenzweig , Rob Herring , devicetree@vger.kernel.org, Rob Herring Subject: [PATCH v3 1/6] dt-bindings: usb: tps6598x: Add Apple CD321x compatible Date: Tue, 28 Sep 2021 17:54:57 +0200 Message-Id: <20210928155502.71372-2-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210928155502.71372-1-sven@svenpeter.dev> References: <20210928155502.71372-1-sven@svenpeter.dev> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org A variant of the TI TPS 6598x Type-C Port Switch and Power Delivery controller known as Apple CD321x is present on boards with Apple SoCs such as the M1. Add its compatible to the device tree binding. Reviewed-by: Alyssa Rosenzweig Acked-by: Rob Herring Signed-off-by: Sven Peter --- no changes since v2 changes since v1: - added robh's ack and alyssa's rb Documentation/devicetree/bindings/usb/ti,tps6598x.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ti,tps6598x.yaml b/Documentation/devicetree/bindings/usb/ti,tps6598x.yaml index f6819bf2a3b5..a4c53b1f1af3 100644 --- a/Documentation/devicetree/bindings/usb/ti,tps6598x.yaml +++ b/Documentation/devicetree/bindings/usb/ti,tps6598x.yaml @@ -12,10 +12,14 @@ maintainers: description: | Texas Instruments 6598x Type-C Port Switch and Power Delivery controller + A variant of this controller known as Apple CD321x or Apple ACE is also + present on hardware with Apple SoCs such as the M1. + properties: compatible: enum: - ti,tps6598x + - apple,cd321x reg: maxItems: 1 From patchwork Tue Sep 28 15:54:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12523167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1F5CC433F5 for ; Tue, 28 Sep 2021 15:55:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 814A660F0F for ; Tue, 28 Sep 2021 15:55:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241709AbhI1P5G (ORCPT ); Tue, 28 Sep 2021 11:57:06 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:45115 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241707AbhI1P5D (ORCPT ); Tue, 28 Sep 2021 11:57:03 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 95EEF580C25; Tue, 28 Sep 2021 11:55:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 28 Sep 2021 11:55:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=7k99brYKXgcXO k4IW+ax4xDIyMEk6c+A5uHjFIDw/WY=; b=R6Og6MxoACYgoi1Dgevqz7tNurMFY PmWF4if7NR1vuffnn411k3qJCoty6BRBrKm0DB4sDATlQ0q0p6XNw4fu6+vusFNV 6cXOkmwhtXSqDo88V7W3OULwn+6TozRswrgrJ94Ck4689j4TdzvLhRKH21xlTa6/ 5kJSXGdCxRk3ALfHyNfm00NaPdUDwCe30QW16nbU/J+hmyNQJb9wqhnhutX2hnwk cUgp5h3KNe5hvVh1VGZ9wQqtUre+O4lwbTBJiJQyvAW4A7C6LPiMTU+oWgofUqBW XcdMFrFu0/Igf1gJaaWPo1GxGvqKVa64umI8DwZLCjIdn3W/peg5cC20Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=7k99brYKXgcXOk4IW+ax4xDIyMEk6c+A5uHjFIDw/WY=; b=T3Se15m9 TfjdsglZi38E+ki1N9RrKqPEr943fIj0ts1Tb7o7pkvwyg4IR3Y7T4pmA2qFUbEz leOdBXj6LrrjsQ4esmtAf1vgcCZAw+rGG7jHF5COz7AP2eVf2GAPjy4nCGpx+CRA ESDNN6Z0Sl2CmwPriCs2pJ0imsHUi++371FQPcCc4Ko5E2TGR2BSGcquq3gCgdHP ySvpPk0OiZ+F8JzuC1s9AYwNIGZPKM5S4+d7aWp5o+rak8AAO1sww+DKSOuSYyo+ FOSg8wtKpnjFC31bCBRaISSPBPC1oxViNeRYMhZyFrxH/Wy+qi1Xd+NZ1suwDtEb 3xm9MW+mx1p10g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudektddgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Sep 2021 11:55:21 -0400 (EDT) From: Sven Peter To: Heikki Krogerus Cc: Sven Peter , Greg Kroah-Hartman , =?utf-8?q?Guido_G=C3=BCnth?= =?utf-8?q?er?= , "Bryan O'Donoghue" , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Hector Martin , Mohamed Mediouni , Stan Skowronek , Mark Kettenis , Alexander Graf , Alyssa Rosenzweig Subject: [PATCH v3 2/6] usb: typec: tipd: Split interrupt handler Date: Tue, 28 Sep 2021 17:54:58 +0200 Message-Id: <20210928155502.71372-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210928155502.71372-1-sven@svenpeter.dev> References: <20210928155502.71372-1-sven@svenpeter.dev> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Split the handlers for the individual interrupts into their own functions to prepare for adding a second interrupt handler for the Apple CD321x chips Signed-off-by: Sven Peter Reviewed-by: Heikki Krogerus --- no changes since v2 changes since v1: - new commit since Heikki suggested to add a separate irq handler for the cd321x variant drivers/usb/typec/tipd/core.c | 96 ++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 31 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 93e56291f0cf..172715c6c238 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -404,13 +404,69 @@ static const struct typec_operations tps6598x_ops = { .pr_set = tps6598x_pr_set, }; +static bool tps6598x_read_status(struct tps6598x *tps, u32 *status) +{ + int ret; + + ret = tps6598x_read32(tps, TPS_REG_STATUS, status); + if (ret) { + dev_err(tps->dev, "%s: failed to read status\n", __func__); + return false; + } + trace_tps6598x_status(*status); + + return true; +} + +static bool tps6598x_read_data_status(struct tps6598x *tps) +{ + u32 data_status; + int ret; + + ret = tps6598x_read32(tps, TPS_REG_DATA_STATUS, &data_status); + if (ret < 0) { + dev_err(tps->dev, "failed to read data status: %d\n", ret); + return false; + } + trace_tps6598x_data_status(data_status); + + return true; +} + +static bool tps6598x_read_power_status(struct tps6598x *tps) +{ + u16 pwr_status; + int ret; + + ret = tps6598x_read16(tps, TPS_REG_POWER_STATUS, &pwr_status); + if (ret < 0) { + dev_err(tps->dev, "failed to read power status: %d\n", ret); + return false; + } + trace_tps6598x_power_status(pwr_status); + + return true; +} + +static void tps6598x_handle_plug_event(struct tps6598x *tps, u32 status) +{ + int ret; + + if (status & TPS_STATUS_PLUG_PRESENT) { + ret = tps6598x_connect(tps, status); + if (ret) + dev_err(tps->dev, "failed to register partner\n"); + } else { + tps6598x_disconnect(tps, status); + } +} + static irqreturn_t tps6598x_interrupt(int irq, void *data) { struct tps6598x *tps = data; u64 event1; u64 event2; - u32 status, data_status; - u16 pwr_status; + u32 status; int ret; mutex_lock(&tps->lock); @@ -423,42 +479,20 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data) } trace_tps6598x_irq(event1, event2); - ret = tps6598x_read32(tps, TPS_REG_STATUS, &status); - if (ret) { - dev_err(tps->dev, "%s: failed to read status\n", __func__); + if (!tps6598x_read_status(tps, &status)) goto err_clear_ints; - } - trace_tps6598x_status(status); - if ((event1 | event2) & TPS_REG_INT_POWER_STATUS_UPDATE) { - ret = tps6598x_read16(tps, TPS_REG_POWER_STATUS, &pwr_status); - if (ret < 0) { - dev_err(tps->dev, "failed to read power status: %d\n", ret); + if ((event1 | event2) & TPS_REG_INT_POWER_STATUS_UPDATE) + if (!tps6598x_read_power_status(tps)) goto err_clear_ints; - } - trace_tps6598x_power_status(pwr_status); - } - if ((event1 | event2) & TPS_REG_INT_DATA_STATUS_UPDATE) { - ret = tps6598x_read32(tps, TPS_REG_DATA_STATUS, &data_status); - if (ret < 0) { - dev_err(tps->dev, "failed to read data status: %d\n", ret); + if ((event1 | event2) & TPS_REG_INT_DATA_STATUS_UPDATE) + if (!tps6598x_read_data_status(tps)) goto err_clear_ints; - } - trace_tps6598x_data_status(data_status); - } /* Handle plug insert or removal */ - if ((event1 | event2) & TPS_REG_INT_PLUG_EVENT) { - if (status & TPS_STATUS_PLUG_PRESENT) { - ret = tps6598x_connect(tps, status); - if (ret) - dev_err(tps->dev, - "failed to register partner\n"); - } else { - tps6598x_disconnect(tps, status); - } - } + if ((event1 | event2) & TPS_REG_INT_PLUG_EVENT) + tps6598x_handle_plug_event(tps, status); err_clear_ints: tps6598x_write64(tps, TPS_REG_INT_CLEAR1, event1); From patchwork Tue Sep 28 15:54:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12523169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72406C433FE for ; Tue, 28 Sep 2021 15:55:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5970A6108E for ; Tue, 28 Sep 2021 15:55:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241750AbhI1P5H (ORCPT ); Tue, 28 Sep 2021 11:57:07 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:58429 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241729AbhI1P5F (ORCPT ); Tue, 28 Sep 2021 11:57:05 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 9D8FC580C23; Tue, 28 Sep 2021 11:55:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 28 Sep 2021 11:55:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=l7l2ToDgnvybd Ml4obXc3cfMQHrVz6bhWaTvDSMxSUA=; b=Pdm5zUeMOXG2d//6NoexJqLVpWWZ7 UEx+yCZcGbXJeiFPAvdH+mLUcas6ME/Y/fiDGm+dENyqBhzvbm7kvqmy77lY+Oag bktIPzzaoJcbUkBQBUqS03DESeWRMmdCBaUFLS1zaeoR4sYl59aDZ+3KkoP/Ubtz vig+RIGAkMz6AlFRP+gMOqW9J260CCuPB5WUThXehqDLRjG+raMp5qm+t7vr++wk c9ep3dSzHB6YuLvJwNd7o2t3jgLjulOPVgG2JRxBx7uhxYq3dQfkdAq0ncplmJNt OtgIalpC7hkMf0wo1GbMnvdNJBCZ5MTL2RkAJP+QnFZ9dmM94yBZYf6Ug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=l7l2ToDgnvybdMl4obXc3cfMQHrVz6bhWaTvDSMxSUA=; b=NJZFzXVy lmpJBSH1b3ou1HW2vjXZ+6AgQTV2nOf85QihyEAYsWbg5gUlTC+P1jWVPScjp1tt aTwYiXBo+VVplF5fsaYvFsMr80ZiG/ez/1ewf58Tp8TXiRV+FcnBZM8fcruDvvAt eOz+g8LCQTusP4IZoxTFv+MbEkSWPNpiByF7LcQc+KC6erwz1VwAwwLFVXgKB3YT cfiMLEaXaJPLlpYK9r/1eEf3fnReopNA81g/K4d/bD0+C3eQhmlTrMBep5H53jFa CFnBhj/sMyoTUlGEIeFp0Apff4GMyj6I7Fb+PbmtxgHMra6JSmN072k+YmlVci5R 8WusdL+ZP3j04g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudektddgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Sep 2021 11:55:23 -0400 (EDT) From: Sven Peter To: Heikki Krogerus Cc: Sven Peter , Greg Kroah-Hartman , =?utf-8?q?Guido_G=C3=BCnth?= =?utf-8?q?er?= , "Bryan O'Donoghue" , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Hector Martin , Mohamed Mediouni , Stan Skowronek , Mark Kettenis , Alexander Graf , Alyssa Rosenzweig Subject: [PATCH v3 3/6] usb: typec: tipd: Add short-circuit for no irqs Date: Tue, 28 Sep 2021 17:54:59 +0200 Message-Id: <20210928155502.71372-4-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210928155502.71372-1-sven@svenpeter.dev> References: <20210928155502.71372-1-sven@svenpeter.dev> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If no interrupts are set in IntEventX directly skip to the end of the interrupt handler and return IRQ_NONE instead of IRQ_HANDLED. This possibly allows to detect spurious interrupts if the i2c bus is fast enough. Reviewed-by: Heikki Krogerus Signed-off-by: Sven Peter --- no changes since v2 changes since v1: - added Heikki's r-b - s/event/(event1 | event2)/ drivers/usb/typec/tipd/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 172715c6c238..e785e4aa2d4b 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -479,6 +479,9 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data) } trace_tps6598x_irq(event1, event2); + if (!(event1 | event2)) + goto err_unlock; + if (!tps6598x_read_status(tps, &status)) goto err_clear_ints; @@ -501,7 +504,9 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data) err_unlock: mutex_unlock(&tps->lock); - return IRQ_HANDLED; + if (event1 | event2) + return IRQ_HANDLED; + return IRQ_NONE; } static int tps6598x_check_mode(struct tps6598x *tps) From patchwork Tue Sep 28 15:55:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12523171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C9B4C433F5 for ; Tue, 28 Sep 2021 15:55:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 562B461246 for ; Tue, 28 Sep 2021 15:55:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241747AbhI1P5I (ORCPT ); Tue, 28 Sep 2021 11:57:08 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:45441 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241514AbhI1P5H (ORCPT ); Tue, 28 Sep 2021 11:57:07 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id AB5F2580C26; Tue, 28 Sep 2021 11:55:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 28 Sep 2021 11:55:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=IueQwOh9v4zKy b6Va+q1/CEW/hQ9FLWn6vvvFuy7EE0=; b=ebZd8gjz6YD9apnchz3CRR3bs9UCQ UQ5x4YIq7wrg1ia+QTtnO6DNTqRxVQKX8hZ+K0T7RWXDdhhyqEButukKflbK4vS4 LhMUkZbm/ncsnSpDvQxv5vDF6N670xVaqllb+6fBh95xqGGpUO/dqh54tIyxUUnr ssEFnNxAghQqsjmxLKvpjAs3kBrS7pxPApYELq/weh1k26LwrFJe+VLenlvSncGm FEhUvz3SFcGfMzxlkMzwAk08DWWKlqin3KxS1+ww9pn0shekuGP2jjkhyuy5gEwa BV3IZGJxBZAvFZqS3gGMe7rUzXkmq2B67uvR/QTH02vtMyvLlB2MU5X6A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=IueQwOh9v4zKyb6Va+q1/CEW/hQ9FLWn6vvvFuy7EE0=; b=F1O/wjIT /lCwBkl97tOPOYfCzdzpOvxqQWMEkhOf0Xj37NRyHIaa7dgW09t9o/lTXFT5XMe8 zvusRt/qWbqMyY772YeQNzxleOnWSWGbDx39S1cHiT6bZ90ZXaFBX/Fa6wfbZqRU NDmfXTetQZvGq3yDhhcvpdjGuNFoNs2qu9BY0rrpEn46I5tEzA3QhzcOFji38ubJ se1rAcq8RFlSaUxCsFOCi/GQa+780OQBIoeAIVk2rPaLu0vrV9YuK3rmSqC9M1H3 v6855QMEwNM94y2K/jK9sDLL0AZBRzZVtVHlJk3qbYBWXZuX12PLTHquR6biX6JR X/bJIq3QcV6msw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudektddgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Sep 2021 11:55:25 -0400 (EDT) From: Sven Peter To: Heikki Krogerus Cc: Sven Peter , Greg Kroah-Hartman , =?utf-8?q?Guido_G=C3=BCnth?= =?utf-8?q?er?= , "Bryan O'Donoghue" , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Hector Martin , Mohamed Mediouni , Stan Skowronek , Mark Kettenis , Alexander Graf , Alyssa Rosenzweig Subject: [PATCH v3 4/6] usb: typec: tipd: Add support for Apple CD321X Date: Tue, 28 Sep 2021 17:55:00 +0200 Message-Id: <20210928155502.71372-5-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210928155502.71372-1-sven@svenpeter.dev> References: <20210928155502.71372-1-sven@svenpeter.dev> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Apple CD321x chips are a variant of the TI TPS 6598x chips. The major differences are the changed interrupt numbers and the concurrent connection to the SMC which we must not disturb. Signed-off-by: Sven Peter Reviewed-by: Heikki Krogerus --- changes since v2: - switched from of_device_get_match_data to of_device_is_compatible as suggested by Heikki - replace "int ret = 0" with "int ret" in cd321x_interrupt since ret doesn't need to be initialized changes since v1: - new commit since Heikki suggested to just add a separate irq handler drivers/usb/typec/tipd/core.c | 63 ++++++++++++++++++++++++++++++- drivers/usb/typec/tipd/tps6598x.h | 6 +++ drivers/usb/typec/tipd/trace.h | 23 +++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index e785e4aa2d4b..cc4a154eabcb 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -461,6 +462,51 @@ static void tps6598x_handle_plug_event(struct tps6598x *tps, u32 status) } } +static irqreturn_t cd321x_interrupt(int irq, void *data) +{ + struct tps6598x *tps = data; + u64 event; + u32 status; + int ret; + + mutex_lock(&tps->lock); + + ret = tps6598x_read64(tps, TPS_REG_INT_EVENT1, &event); + if (ret) { + dev_err(tps->dev, "%s: failed to read events\n", __func__); + goto err_unlock; + } + trace_cd321x_irq(event); + + if (!event) + goto err_unlock; + + if (!tps6598x_read_status(tps, &status)) + goto err_clear_ints; + + if (event & APPLE_CD_REG_INT_POWER_STATUS_UPDATE) + if (!tps6598x_read_power_status(tps)) + goto err_clear_ints; + + if (event & APPLE_CD_REG_INT_DATA_STATUS_UPDATE) + if (!tps6598x_read_data_status(tps)) + goto err_clear_ints; + + /* Handle plug insert or removal */ + if (event & APPLE_CD_REG_INT_PLUG_EVENT) + tps6598x_handle_plug_event(tps, status); + +err_clear_ints: + tps6598x_write64(tps, TPS_REG_INT_CLEAR1, event); + +err_unlock: + mutex_unlock(&tps->lock); + + if (event) + return IRQ_HANDLED; + return IRQ_NONE; +} + static irqreturn_t tps6598x_interrupt(int irq, void *data) { struct tps6598x *tps = data; @@ -620,6 +666,8 @@ static int devm_tps6598_psy_register(struct tps6598x *tps) static int tps6598x_probe(struct i2c_client *client) { + irq_handler_t irq_handler = tps6598x_interrupt; + struct device_node *np = client->dev.of_node; struct typec_capability typec_cap = { }; struct tps6598x *tps; struct fwnode_handle *fwnode; @@ -658,6 +706,18 @@ static int tps6598x_probe(struct i2c_client *client) if (ret) return ret; + if (np && of_device_is_compatible(np, "apple,cd321x")) { + /* CD321X chips have all interrupts masked initially */ + ret = tps6598x_write64(tps, TPS_REG_INT_MASK1, + APPLE_CD_REG_INT_POWER_STATUS_UPDATE | + APPLE_CD_REG_INT_DATA_STATUS_UPDATE | + APPLE_CD_REG_INT_PLUG_EVENT); + if (ret) + return ret; + + irq_handler = cd321x_interrupt; + } + ret = tps6598x_read32(tps, TPS_REG_STATUS, &status); if (ret < 0) return ret; @@ -739,7 +799,7 @@ static int tps6598x_probe(struct i2c_client *client) } ret = devm_request_threaded_irq(&client->dev, client->irq, NULL, - tps6598x_interrupt, + irq_handler, IRQF_SHARED | IRQF_ONESHOT, dev_name(&client->dev), tps); if (ret) { @@ -773,6 +833,7 @@ static int tps6598x_remove(struct i2c_client *client) static const struct of_device_id tps6598x_of_match[] = { { .compatible = "ti,tps6598x", }, + { .compatible = "apple,cd321x", }, {} }; MODULE_DEVICE_TABLE(of, tps6598x_of_match); diff --git a/drivers/usb/typec/tipd/tps6598x.h b/drivers/usb/typec/tipd/tps6598x.h index 003a577be216..e13b16419843 100644 --- a/drivers/usb/typec/tipd/tps6598x.h +++ b/drivers/usb/typec/tipd/tps6598x.h @@ -129,6 +129,12 @@ #define TPS_REG_INT_HARD_RESET BIT(1) #define TPS_REG_INT_PD_SOFT_RESET BIT(0) +/* Apple-specific TPS_REG_INT_* bits */ +#define APPLE_CD_REG_INT_DATA_STATUS_UPDATE BIT(10) +#define APPLE_CD_REG_INT_POWER_STATUS_UPDATE BIT(9) +#define APPLE_CD_REG_INT_STATUS_UPDATE BIT(8) +#define APPLE_CD_REG_INT_PLUG_EVENT BIT(1) + /* 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)) diff --git a/drivers/usb/typec/tipd/trace.h b/drivers/usb/typec/tipd/trace.h index 5d09d6f78930..12cad1bde7cc 100644 --- a/drivers/usb/typec/tipd/trace.h +++ b/drivers/usb/typec/tipd/trace.h @@ -67,6 +67,13 @@ { TPS_REG_INT_USER_VID_ALT_MODE_ATTN_VDM, "USER_VID_ALT_MODE_ATTN_VDM" }, \ { TPS_REG_INT_USER_VID_ALT_MODE_OTHER_VDM, "USER_VID_ALT_MODE_OTHER_VDM" }) +#define show_cd321x_irq_flags(flags) \ + __print_flags_u64(flags, "|", \ + { APPLE_CD_REG_INT_PLUG_EVENT, "PLUG_EVENT" }, \ + { APPLE_CD_REG_INT_POWER_STATUS_UPDATE, "POWER_STATUS_UPDATE" }, \ + { APPLE_CD_REG_INT_DATA_STATUS_UPDATE, "DATA_STATUS_UPDATE" }, \ + { APPLE_CD_REG_INT_STATUS_UPDATE, "STATUS_UPDATE" }) + #define TPS6598X_STATUS_FLAGS_MASK (GENMASK(31, 0) ^ (TPS_STATUS_CONN_STATE_MASK | \ TPS_STATUS_PP_5V0_SWITCH_MASK | \ TPS_STATUS_PP_HV_SWITCH_MASK | \ @@ -207,6 +214,22 @@ TRACE_EVENT(tps6598x_irq, show_irq_flags(__entry->event2)) ); +TRACE_EVENT(cd321x_irq, + TP_PROTO(u64 event), + TP_ARGS(event), + + TP_STRUCT__entry( + __field(u64, event) + ), + + TP_fast_assign( + __entry->event = event; + ), + + TP_printk("event=%s", + show_cd321x_irq_flags(__entry->event)) +); + TRACE_EVENT(tps6598x_status, TP_PROTO(u32 status), TP_ARGS(status), From patchwork Tue Sep 28 15:55:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12523173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF5D3C433FE for ; Tue, 28 Sep 2021 15:55:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 970B261246 for ; Tue, 28 Sep 2021 15:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241765AbhI1P5P (ORCPT ); Tue, 28 Sep 2021 11:57:15 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:41283 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241752AbhI1P5J (ORCPT ); Tue, 28 Sep 2021 11:57:09 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 0E32D580C24; Tue, 28 Sep 2021 11:55:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 28 Sep 2021 11:55:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=el0Ghx2FjFtB4 v+opko3bnJzQlzA9KABqsDUbou/TtY=; b=I7UAbzZ3uh71zZ7uUS0v7/Z69Ny9/ huTi+jRTKuimbrf6Zqw2lcuOos+Ta7kCbGakC73cAhcMOhbWwbwkrwSdf7ucAX7I MbGAwywOTUVPrwjErFB/Umlgm1mWXvxB0/aqXX9SmwBSxNYHidtA9m9yMyxLvUep Zl7Ej14YoU6LYPYCfrZrPXc2gBDNCSHn7OtlyolZ2yQCxfcSdYB4KAPDrplGgi1r yh9wxdleMMFufoGHEfU0SBA6AjouGo0khdZqNbPdvvYc6EtF0xg/fPYGRaoWxr9i 02P8ApbS59noGswzc8C1+fieJbGFCqeBabMu7ZHnxEjmqWB5yGeuIuX7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=el0Ghx2FjFtB4v+opko3bnJzQlzA9KABqsDUbou/TtY=; b=M6uFW5QP m8Hl7PSrrhy9khl60+ww6srTpdd1GDJtVDR2m092eud/XOi+IJaWGgM/K3ZSoEpg 0TXFjeYPOV84U4veVqTCLX+btrTo/zaZk7uiqdl5sCyxuKRlCF97OxTC+N549ApN TkByzwNybAE+sLfVjVVH+MgkEVNNHhhQHRqCzCWom9umgEZIB/MVnG4riVRa0g3x yyxPOOJVLCZ8ey3637ddRWc4m0uew4JcngkaobWgm2ms1VZmjGmRfqnPw5Jn4VWW ark6WpNaphOeTxPRsJ9PQ4s8MjmBeGb5kt5D8pkCSP2N8rPNa7l8DSzKYYEVJgSj YxaTkq/xEWxpeQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudektddgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Sep 2021 11:55:27 -0400 (EDT) From: Sven Peter To: Heikki Krogerus Cc: Sven Peter , Greg Kroah-Hartman , =?utf-8?q?Guido_G=C3=BCnth?= =?utf-8?q?er?= , "Bryan O'Donoghue" , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Hector Martin , Mohamed Mediouni , Stan Skowronek , Mark Kettenis , Alexander Graf , Alyssa Rosenzweig Subject: [PATCH v3 5/6] usb: typec: tipd: Switch CD321X power state to S0 Date: Tue, 28 Sep 2021 17:55:01 +0200 Message-Id: <20210928155502.71372-6-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210928155502.71372-1-sven@svenpeter.dev> References: <20210928155502.71372-1-sven@svenpeter.dev> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The Apple CD321x comes up in a low-power state after boot. Usually, the bootloader will already power it up to S0 but let's do it here as well in case that didn't happen. Reviewed-by: Alyssa Rosenzweig Suggested-by: Stan Skowronek Signed-off-by: Sven Peter Reviewed-by: Heikki Krogerus --- no changes since v2 changes since v1: - dropped the supports_spss flag and only call this for the Apple chip - added Alyssa's r-b drivers/usb/typec/tipd/core.c | 37 +++++++++++++++++++++++++++++++ drivers/usb/typec/tipd/tps6598x.h | 6 +++++ 2 files changed, 43 insertions(+) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index cc4a154eabcb..c74fc9ae1686 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -30,6 +30,7 @@ #define TPS_REG_INT_MASK2 0x17 #define TPS_REG_INT_CLEAR1 0x18 #define TPS_REG_INT_CLEAR2 0x19 +#define TPS_REG_SYSTEM_POWER_STATE 0x20 #define TPS_REG_STATUS 0x1a #define TPS_REG_SYSTEM_CONF 0x28 #define TPS_REG_CTRL_CONF 0x29 @@ -152,6 +153,11 @@ static int tps6598x_block_write(struct tps6598x *tps, u8 reg, return regmap_raw_write(tps->regmap, reg, data, len + 1); } +static inline int tps6598x_read8(struct tps6598x *tps, u8 reg, u8 *val) +{ + return tps6598x_block_read(tps, reg, val, sizeof(u8)); +} + static inline int tps6598x_read16(struct tps6598x *tps, u8 reg, u16 *val) { return tps6598x_block_read(tps, reg, val, sizeof(u16)); @@ -635,6 +641,32 @@ static int tps6598x_psy_get_prop(struct power_supply *psy, return ret; } +static int cd321x_switch_power_state(struct tps6598x *tps, u8 target_state) +{ + u8 state; + int ret; + + ret = tps6598x_read8(tps, TPS_REG_SYSTEM_POWER_STATE, &state); + if (ret) + return ret; + + if (state == target_state) + return 0; + + ret = tps6598x_exec_cmd(tps, "SPSS", sizeof(u8), &target_state, 0, NULL); + if (ret) + return ret; + + ret = tps6598x_read8(tps, TPS_REG_SYSTEM_POWER_STATE, &state); + if (ret) + return ret; + + if (state != target_state) + return -EINVAL; + + return 0; +} + static int devm_tps6598_psy_register(struct tps6598x *tps) { struct power_supply_config psy_cfg = {}; @@ -707,6 +739,11 @@ static int tps6598x_probe(struct i2c_client *client) return ret; if (np && of_device_is_compatible(np, "apple,cd321x")) { + /* Switch CD321X chips to the correct system power state */ + ret = cd321x_switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0); + if (ret) + return ret; + /* CD321X chips have all interrupts masked initially */ ret = tps6598x_write64(tps, TPS_REG_INT_MASK1, APPLE_CD_REG_INT_POWER_STATUS_UPDATE | diff --git a/drivers/usb/typec/tipd/tps6598x.h b/drivers/usb/typec/tipd/tps6598x.h index e13b16419843..3dae84c524fb 100644 --- a/drivers/usb/typec/tipd/tps6598x.h +++ b/drivers/usb/typec/tipd/tps6598x.h @@ -135,6 +135,12 @@ #define APPLE_CD_REG_INT_STATUS_UPDATE BIT(8) #define APPLE_CD_REG_INT_PLUG_EVENT BIT(1) +/* TPS_REG_SYSTEM_POWER_STATE states */ +#define TPS_SYSTEM_POWER_STATE_S0 0x00 +#define TPS_SYSTEM_POWER_STATE_S3 0x03 +#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)) From patchwork Tue Sep 28 15:55:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12523175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3827C433F5 for ; Tue, 28 Sep 2021 15:55:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B83E460F0F for ; Tue, 28 Sep 2021 15:55:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241776AbhI1P5Q (ORCPT ); Tue, 28 Sep 2021 11:57:16 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:55821 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241729AbhI1P5M (ORCPT ); Tue, 28 Sep 2021 11:57:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 5BDD8580C2C; Tue, 28 Sep 2021 11:55:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 28 Sep 2021 11:55:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=tioV3w1us2lR+ k7Bn3CrlkUcCREi0bHyi5Rh0GFTTMY=; b=acOT0Vy30SAM0oxpv/aisxLns3l1t BJo13UWxgqRnHR+Es2BHozcf970I7jkdnuFHcYcJg6gcfv2aA7MCbBw5X1qQUVTe QPSRz0pPh0R2nJ3UwwbQ0EqCA4wQE+Sr4QZCbljutZpZ3UDB8sz/Rwe7TNCfQE63 LmUghPmwuyb2IEs1+cbDt9B5CWRs+iat3W0n9iVDOWLjWPG83+RW9fsb16814RRE qjpm6uUVVuoDDm4fN2CCjMuQJsRN+WPDCmg1d773xtgX6GiWpYgV+PW5GWMEXdfx s+FvhRPSjLfXJnX9LGoO6Rn0MRQ7+etC3M3OUrp0jlCEfzjqczrIkoJtg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=tioV3w1us2lR+k7Bn3CrlkUcCREi0bHyi5Rh0GFTTMY=; b=dtFI6iEt 3uwRWSnuw6VUc8ZScaqU0RvrZSq2BQlN3ifMGqia9s0laL4T07rgaNWflru+hWeR Ux6yNFVo/LNq2X02RRpV2bJiAnbHSIk6fYwg+fAebCqLcQfx0sezbhjxds+cYAtQ RU+q+1oYSH+u0XPxjGdI646DxQvOdGgf309dXL6w/ysMLXIUtkmfpr0R5fAVQqFM MEZsyjrXqPiT1XnuDJjhsXwKokK1VL3O0mClvi/pHzzt+oz7ROFmGwGF1exugosw OqL2vh4wB2zPIGmlPmjxytTKm8dNDplJJ7fWfREfajogOxXq7Vt2S69XdC61a8+Q Zvmvxvbc/DpKww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudektddgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Sep 2021 11:55:30 -0400 (EDT) From: Sven Peter To: Heikki Krogerus Cc: Sven Peter , Greg Kroah-Hartman , =?utf-8?q?Guido_G=C3=BCnth?= =?utf-8?q?er?= , "Bryan O'Donoghue" , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Hector Martin , Mohamed Mediouni , Stan Skowronek , Mark Kettenis , Alexander Graf , Alyssa Rosenzweig Subject: [PATCH v3 6/6] usb: typec: tipd: Remove FIXME about testing with I2C_FUNC_I2C Date: Tue, 28 Sep 2021 17:55:02 +0200 Message-Id: <20210928155502.71372-7-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210928155502.71372-1-sven@svenpeter.dev> References: <20210928155502.71372-1-sven@svenpeter.dev> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The Apple i2c bus uses I2C_FUNC_I2C and I've tested this quite extensivly in the past days. Remove the FIXME about that testing :-) Reviewed-by: Alyssa Rosenzweig Reviewed-by: Heikki Krogerus Signed-off-by: Sven Peter --- no changes sinve v2 changes since v1: - added r-b tags drivers/usb/typec/tipd/core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index c74fc9ae1686..4e1a31f88c2a 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -726,9 +726,6 @@ static int tps6598x_probe(struct i2c_client *client) /* * Checking can the adapter handle SMBus protocol. If it can not, the * driver needs to take care of block reads separately. - * - * FIXME: Testing with I2C_FUNC_I2C. regmap-i2c uses I2C protocol - * unconditionally if the adapter has I2C_FUNC_I2C set. */ if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) tps->i2c_protocol = true;