From nobody Mon Feb 9 12:25:03 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1F1C3D666D for ; Tue, 20 Jan 2026 09:28:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768901308; cv=none; b=JDK8WzQh/SfkmYqgDtwKZdLgczCt8wk73ayJgaRlGyeGKBVWHaU5oqRU9YyVeHLKLWf3PqoW2JHD7CzReDgzcaeGWOOYn2q13AOw5E6nlbsvczjnpJblFL5C6g88LJAVhaVGXjvZ+tWghZJjET6Kni3V2a8jZ8aCfkAIZ5sLyRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768901308; c=relaxed/simple; bh=QMqioJoP80Iu3/5uGtxuCFsLXp9UlfrL0fqbcQmIhZs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HnVKC5O3exD3yMrqz0IxVuVohvXTs1YveBBSzoyHescmqQYyiZO01Fh8WPsF359Bc8cf13iGq1OEIMEQyjr/3jwLYQq8Vt/cbVNUSMoBs4GgwLfDzQoOQpcdE+Sxa9pqTYwkSQVVQcyZHhHOaQadZvWMHWfqTXMQiiAGFsShSk0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=od+Wp3ma; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="od+Wp3ma" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 485104E421A9; Tue, 20 Jan 2026 09:28:24 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 1F625606AB; Tue, 20 Jan 2026 09:28:24 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B35D510B68378; Tue, 20 Jan 2026 10:28:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768901303; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=jc6Cz28LDEeuob4AY0w3tlBij8P56e1G48BsjZWXPos=; b=od+Wp3maJgYXGKdoZr3NVTPJPcB3dHL6xN9MvjtZyVmJ2BbcYiYiqQbNhB3jQ1BTRwx+E1 2ig10LrHGWjus9Wo9KceMyqUwFoQs2fxsYlhwzHQlYr1mwXj82JYAsUPOUclTURZUOJ+i3 5NPk7G8KSbVuW72bPKSrrQv3kZc73Ril0p2/FxTgQOZUp0QrYU4MTlIIPukAnjpEopLneE dMnAJI5EjdtXBmtvgjMQITokW3JWuaLP3x8feKBtJrYof0ZOOp96xw0zYkoFSU0sqqiWAd GSu+s2ju6MP0TaeyJR97aHQPy709PSTendbERGbVQlDYb9l12tnfee1SsiKVdA== From: =?utf-8?q?Beno=C3=AEt_Monin?= Date: Tue, 20 Jan 2026 10:28:03 +0100 Subject: [PATCH v5 3/6] i2c: designware: Add dedicated algorithm for AMD NAVI Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260120-i2c-dw-v5-3-0e34d6d9455c@bootlin.com> References: <20260120-i2c-dw-v5-0-0e34d6d9455c@bootlin.com> In-Reply-To: <20260120-i2c-dw-v5-0-0e34d6d9455c@bootlin.com> To: Andi Shyti , Mika Westerberg , Andy Shevchenko , Jan Dabros , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: Thomas Petazzoni , Gregory CLEMENT , =?utf-8?q?Th=C3=A9o_Lebrun?= , Tawfik Bayouk , Vladimir Kondratiev , Dmitry Guzman , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, =?utf-8?q?Beno=C3=AEt_Monin?= X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Apart from runtime PM, there is nothing in common between i2c_dw_xfer() and amd_i2c_dw_xfer_quirk(), so give AMD NAVI controller its own algorithm instead of calling the quirk from i2c_dw_xfer(). Add runtime PM handling to amd_i2c_dw_xfer_quirk() and a dedicated i2c_algorithm for AMD NAVI controllers. The adapter algorithm is set during probe based on the device model. This way we avoid checking for the device model at the start of every transfer. Reviewed-by: Andy Shevchenko Signed-off-by: Beno=C3=AEt Monin --- drivers/i2c/busses/i2c-designware-master.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busse= s/i2c-designware-master.c index 4493568e2fa3..f247cf323207 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -361,6 +361,10 @@ static int amd_i2c_dw_xfer_quirk(struct i2c_adapter *a= dap, struct i2c_msg *msgs, u8 *tx_buf; unsigned int val; =20 + ACQUIRE(pm_runtime_active_auto_try, pm)(dev->dev); + if (ACQUIRE_ERR(pm_runtime_active_auto_try, &pm)) + return -ENXIO; + /* * In order to enable the interrupt for UCSI i.e. AMD NAVI GPU card, * it is mandatory to set the right value in specific register @@ -820,14 +824,6 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg m= sgs[], int num) =20 pm_runtime_get_sync(dev->dev); =20 - switch (dev->flags & MODEL_MASK) { - case MODEL_AMD_NAVI_GPU: - ret =3D amd_i2c_dw_xfer_quirk(adap, msgs, num); - goto done_nolock; - default: - break; - } - reinit_completion(&dev->cmd_complete); dev->msgs =3D msgs; dev->msgs_num =3D num; @@ -917,6 +913,11 @@ static const struct i2c_algorithm i2c_dw_algo =3D { .functionality =3D i2c_dw_func, }; =20 +static const struct i2c_algorithm amd_i2c_dw_algo =3D { + .xfer =3D amd_i2c_dw_xfer_quirk, + .functionality =3D i2c_dw_func, +}; + static const struct i2c_adapter_quirks i2c_dw_quirks =3D { .flags =3D I2C_AQ_NO_ZERO_LEN, }; @@ -1052,7 +1053,10 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev) scnprintf(adap->name, sizeof(adap->name), "Synopsys DesignWare I2C adapter"); adap->retries =3D 3; - adap->algo =3D &i2c_dw_algo; + if ((dev->flags & MODEL_MASK) =3D=3D MODEL_AMD_NAVI_GPU) + adap->algo =3D &amd_i2c_dw_algo; + else + adap->algo =3D &i2c_dw_algo; adap->quirks =3D &i2c_dw_quirks; adap->dev.parent =3D dev->dev; i2c_set_adapdata(adap, dev); --=20 2.52.0