Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp751740pxb; Sat, 18 Sep 2021 17:30:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/lSceFLZX6HuqXDjz5rgZgfy0IFX+vTaL2ZvxkPCjrYBEIuLwlBETkQGfeIuwFDdqxN2A X-Received: by 2002:a05:6402:14c4:: with SMTP id f4mr21554320edx.358.1632011417649; Sat, 18 Sep 2021 17:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632011417; cv=none; d=google.com; s=arc-20160816; b=buW8j9kONXxVZ4wu7L/Sx+/hcUro8kdl7U0/eRDrh748P/JkowPzxg3jb2nQtBnzFB xF4D6PPFxi1hD4UR96mShBBQvfDAZboQFssud+QH3QEBThPD35cik+wyVZJ4MXzRw/PX gCOUYfM0eCOg8aKvTRM0CJmRwNidvMDI0MFl2QaomOfWN4pUnxCpidUyYL+EwEuZPDtb Mw2I1qWtFu/PmC/J+xSqhyyOjDk40CFgkxLd3mlpLavHoMZ2tR9ukfLwVE08skLqgBXr T/+wj5Dlz6tbuC4Ud4v7b9HrpOfWTW56Uc4zq7riiQCjRsaTuFK13GrphV5btDXuHv2j OhZQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=aMQfqmJ3dKPGxspm3ASGg7int5qQFUsrLE46xAC0S2k=; b=yupq1At5JIa7sJ4fB+XRTwhoXxCAT5mT4oifMHNfGv77RZG4PCTgIIA7KqHwhMInPM DHUyS8DipR+LPyzuxpilc3CSI4jwOjbnr3739kaMRiAfWbzbAENkCCiVN1xsuZ0+UyN/ IZRv6rlxhbig+TDm+6nUXnFMWFPJJAW1PC60xjcDrfbL3MaM2UkHiR8YAj9rlD4tUPnV WfKRnicW/7UhhFyWlOmgLR3DSlAq2w1o5sLa1XDznxI4WZxV3D1QvRoW8YXKpkMR23Tr jZ6q0LEqmZZhcICFmdqhFomJiCf0YggjFjd86IC/2jFmbc/8sVTLDAu2J0bbH2F0hQnR OGRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b="L61ikF//"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=lnYzo8od; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si4445041eja.257.2021.09.18.17.29.54; Sat, 18 Sep 2021 17:30:17 -0700 (PDT) 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; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b="L61ikF//"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=lnYzo8od; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239755AbhIRMMh (ORCPT + 99 others); Sat, 18 Sep 2021 08:12:37 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:34667 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236620AbhIRMLq (ORCPT ); Sat, 18 Sep 2021 08:11:46 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id BBCC8580A8B; Sat, 18 Sep 2021 08:10:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sat, 18 Sep 2021 08:10:02 -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=aMQfqmJ3dKPGx spm3ASGg7int5qQFUsrLE46xAC0S2k=; b=L61ikF//r9bmQ0GNivc+4qcq+m6zA HJ7MtvS1ncS5FWMaSPSYHje7Qqy87fMn4uPuv4wgGsnTg9D3SVeFzpYcDva2z8/P xzg6gEBfyYyTOCIuJ2F/brtYAmKwugnQ5S1ihnCzUhieBBJclGfzZVCNfvMfJ3ZJ eJjVZ/219IC+v1oZ24I2OVIMp2OAzz7O87PkmAKe2nK20uP6FsqAeTUGsRTqGs2v OVVrtA9+v+ZM5DMwGcByFv5MgPvszkVWpPRKq/VSHBpInrvOkgHN/XHgZrU4zfXk xIt510mFNCy49inGrlPkcEeiyAe2IOWheoOpjXSwflfkWnTuk9ZX5SmIg== 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=aMQfqmJ3dKPGxspm3ASGg7int5qQFUsrLE46xAC0S2k=; b=lnYzo8od vQRfUpxvNiXFaR5s96VlzC6oHdQTlhAJWLeud0wMp4Ywih4i0l0fw2QEKON1TlVv drqFBRJQewi4BuzcZmS8mfUv91Xx6pza0NarW0KtLeduaGGIMmaU+LTFK2e9oaEd Z6HXmK/xs1DJON5eAVI+2XV1pti2f0mFkIzKWcVlGs2TgnApJF8eT4pyPCBcUSum U5LVBZCcXfPhb7eXX6/FmgfHCVowxL0a+mRNd5YoqRPGrGfkZ4EPqjAw09s9Slqk lq5+QkcHUnxgB0i1Ny8r9glhB+2FjPgXC0f1VQqOsjZZuhAegENyE19o1u7L2Fj3 coJv3SO5SwwQFw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudehkedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 18 Sep 2021 08:10:00 -0400 (EDT) From: Sven Peter To: Heikki Krogerus Cc: Sven Peter , Greg Kroah-Hartman , =?UTF-8?q?Guido=20G=C3=BCnther?= , "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: [RFT PATCH 5/9] usb: typec: tipd: Allow to configure irq bits Date: Sat, 18 Sep 2021 14:09:30 +0200 Message-Id: <20210918120934.28252-6-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210918120934.28252-1-sven@svenpeter.dev> References: <20210918120934.28252-1-sven@svenpeter.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Apple variant of the TI TPS6598x chip uses different interrupt numbers. Prepare for that by allowing those to be configured depending on the compatible. Signed-off-by: Sven Peter --- drivers/usb/typec/tipd/core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 4a6d66250fef..d191e7435018 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -80,6 +80,10 @@ static const char *const modes[] = { struct tps6598x_hw { bool use_int1; bool use_int2; + unsigned int irq_power_status_update; + unsigned int irq_data_status_update; + unsigned int irq_plug_event; + void (*irq_trace)(u64 event1, u64 event2); }; static const struct tps6598x_hw ti_tps6598x_data; @@ -431,7 +435,7 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data) dev_err(tps->dev, "%s: failed to read events\n", __func__); goto err_unlock; } - trace_tps6598x_irq(event1, event2); + tps->hw->irq_trace(event1, event2); event = event1 | event2; if (!event) @@ -444,7 +448,7 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data) } trace_tps6598x_status(status); - if (event & TPS_REG_INT_POWER_STATUS_UPDATE) { + if (event & tps->hw->irq_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); @@ -453,7 +457,7 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data) trace_tps6598x_power_status(pwr_status); } - if (event & TPS_REG_INT_DATA_STATUS_UPDATE) { + if (event & tps->hw->irq_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); @@ -463,7 +467,7 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data) } /* Handle plug insert or removal */ - if (event & TPS_REG_INT_PLUG_EVENT) { + if (event & tps->hw->irq_plug_event) { if (status & TPS_STATUS_PLUG_PRESENT) { ret = tps6598x_connect(tps, status); if (ret) @@ -760,6 +764,10 @@ static int tps6598x_remove(struct i2c_client *client) static const struct tps6598x_hw ti_tps6598x_data = { .use_int1 = true, .use_int2 = true, + .irq_power_status_update = TPS_REG_INT_POWER_STATUS_UPDATE, + .irq_data_status_update = TPS_REG_INT_DATA_STATUS_UPDATE, + .irq_plug_event = TPS_REG_INT_PLUG_EVENT, + .irq_trace = trace_tps6598x_irq, }; static const struct of_device_id tps6598x_of_match[] = { -- 2.25.1