From nobody Sat Nov 23 20:06:37 2024 Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (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 CC4FE18870C; Mon, 11 Nov 2024 11:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731323338; cv=none; b=JTQU2HX/xoNcQv/wlr55md6D7r7lEu+6ZKs4db9E3GewyIh5E10QzERqx2b0pjLFOYNT6hYpcLJHvp5k3IFreqtfvP1Mz0Toxe0O9Pr5LzUn9KzMloDmq5dLsGfm38O2BY5ZRrWLMNV0039dl7iy83Ae6JF4SXAMAak4TDtRpUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731323338; c=relaxed/simple; bh=W5uiWkO2cHCiM3fQ7VIpZPVLLeqxMqm5VHI2NmTnx6E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lCgJsi3jUD0+mJBye/jgzRSEgGM4y/Bf5wbbK42DuXWEm3qPsom8Yf0gBaZ6puWwvZLNRx94BhBLIGA7PNrYwsbtNKl+M39Nhb7XeG5lCCLp6p9gY9whPwZpMseg4iHORMY+YMZF/fcc29Z0Ki53xSlD2EOCtnXdMs4dpuYGuE0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=VTAL07pV; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="VTAL07pV" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=/I7aNJPYCLDXRn0sdCZcFtLMPgSoN8VrVDY69crr8c0=; b=VTAL07pVpv8KpTr11jbNiNBAtv D7CKYfmoKxRrhOB6TF6E1ZdnvFfqd5YWD1tkDeIOHBMh9VT85v3I9sdhR/SzMRrlxmcZ9NtMRTxUz sH1UXtJqR2n+zRfohNHC5IM6DrUKOKDl3xJv0fGE6UIxhDzll27me45Y6+3cObTlYiev/14fyEQZ6 PV6Mf7fBSaaCvXc5+/5pYUcPpSfmwc+/u1xzgc8IuayoWHxSxCkTBYF6a0pEiMSBTUDzpAZxEtd7/ CcSx0BR0gpuXiDPvjD2q1HgmimclvpUVG9JfqYeqNcXAwZRgnnjJiYp3jkO8VlCFHEsC0b4gji696 N7+g/Hrg==; Received: from sslproxy01.your-server.de ([78.46.139.224]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tAS19-0000ix-Tt; Mon, 11 Nov 2024 11:51:35 +0100 Received: from [185.17.218.86] (helo=zen.localdomain) by sslproxy01.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tAS19-000JnT-0u; Mon, 11 Nov 2024 11:51:35 +0100 From: Sean Nyekjaer Date: Mon, 11 Nov 2024 11:51:23 +0100 Subject: [PATCH 1/3] can: m_can: add deinit callback 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: <20241111-tcan-standby-v1-1-f9337ebaceea@geanix.com> References: <20241111-tcan-standby-v1-0-f9337ebaceea@geanix.com> In-Reply-To: <20241111-tcan-standby-v1-0-f9337ebaceea@geanix.com> To: Chandrasekar Ramakrishnan , Marc Kleine-Budde , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Nyekjaer X-Mailer: b4 0.14.2 X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27455/Mon Nov 11 10:58:33 2024) This is added in preparation for calling standby mode in the tcan4x5x driver or other users of m_can. For the tcan4x5x; If Vsup is 12V, standby mode will save 7-8mA, when the interface is down. Signed-off-by: Sean Nyekjaer --- drivers/net/can/m_can/m_can.c | 3 +++ drivers/net/can/m_can/m_can.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index a7b3bc439ae596527493a73d62b4b7a120ae4e49..a171ff860b7c6992846ae8d6156= 40a40b623e0cb 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1756,6 +1756,9 @@ static void m_can_stop(struct net_device *dev) =20 /* set the state as STOPPED */ cdev->can.state =3D CAN_STATE_STOPPED; + + if (cdev->ops->deinit) + cdev->ops->deinit(cdev); } =20 static int m_can_close(struct net_device *dev) diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h index 92b2bd8628e6b31370f4accbc2e28f3b2257a71d..6206535341a22a68d7c5570f619= e6c4d05e6fcf4 100644 --- a/drivers/net/can/m_can/m_can.h +++ b/drivers/net/can/m_can/m_can.h @@ -68,6 +68,7 @@ struct m_can_ops { int (*write_fifo)(struct m_can_classdev *cdev, int addr_offset, const void *val, size_t val_count); int (*init)(struct m_can_classdev *cdev); + int (*deinit)(struct m_can_classdev *cdev); }; =20 struct m_can_tx_op { --=20 2.46.2 From nobody Sat Nov 23 20:06:37 2024 Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (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 C74D614A4CC; Mon, 11 Nov 2024 11:08:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731323308; cv=none; b=grKbfBBINgUKPc0H0ynSBbZhPLjxIHAdrMjHUDsRKfDJw0DRE9uWvtRvI8oidkPaRTQlGGhNvhHVLkiOYNI6NTZzuTb4oxZE8JSYz3gm7PfHVPe08CYtETXQgBmYbpfgUfGu8q/1IBN7gwGo9OVvs5obiZDgKlU8FWrMavB7OSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731323308; c=relaxed/simple; bh=9F5FIbDQpURXJ1x90stQR6QbxkhyhyotTGUbPdFKoB8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c6C2TY9WDWlO3VbfMYkjKwWNF76KpDSkgmG+po8rjoXzKnb6dgOQ0jguyunj+mxVzdk7yQp2G9y7bfMg2w5kNsxgvXfAmD08PWOySXObm9vRMjH+loPgeFVKKdSiocTKXDjnd2MldWUwfBJvV4GzqqFc17wxMSmO4OEUGwLr01Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=x7S7psVH; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="x7S7psVH" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=DvC5hQ1OSCc0FQMMe3JrzERRMI88oW4kxWqQI1dAef8=; b=x7S7psVHR2vuunSxOoxJDv88Yf JSZr/QijTV3ofUEZLXW1lVqmHGd7C0Ee2dWVGsqXSh7pP7kg4OK7zveEvUXOZRHn6LM6/eD0TISzV +xxGk9NX5iZXOyAS/2l4B7I2GLhuGPR2c0xTZT9QYnkJOE15QuT9LfbWoO0MsiBa0F0GLWByb4nFX BeJ6jbUdfhMCaiAkZnbJifZA2Go+ScCFBaCVraUKwL5BrIPgEfZOqhqeIGsqSunvT4aLCxovmKjTz PBr1hyc0QgIyTDXOjjAFzngi8YWah7026s0AD0DkI/MZdQFxF/pZGyqQhIrKb6j7oJZeqIvEMjgDX G2UNggJg==; Received: from sslproxy01.your-server.de ([78.46.139.224]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tAS1A-0000iz-61; Mon, 11 Nov 2024 11:51:36 +0100 Received: from [185.17.218.86] (helo=zen.localdomain) by sslproxy01.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tAS19-000JnT-1h; Mon, 11 Nov 2024 11:51:35 +0100 From: Sean Nyekjaer Date: Mon, 11 Nov 2024 11:51:24 +0100 Subject: [PATCH 2/3] can: tcan4x5x: add deinit callback to set standby mode 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: <20241111-tcan-standby-v1-2-f9337ebaceea@geanix.com> References: <20241111-tcan-standby-v1-0-f9337ebaceea@geanix.com> In-Reply-To: <20241111-tcan-standby-v1-0-f9337ebaceea@geanix.com> To: Chandrasekar Ramakrishnan , Marc Kleine-Budde , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Nyekjaer X-Mailer: b4 0.14.2 X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27455/Mon Nov 11 10:58:33 2024) At Vsup 12V, standby mode will save 7-8mA, when the interface is down. Signed-off-by: Sean Nyekjaer --- drivers/net/can/m_can/tcan4x5x-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/= tcan4x5x-core.c index 2f73bf3abad889c222f15c39a3d43de1a1cf5fbb..c8336750cdc276b539dde7555b2= 510fba0d0da75 100644 --- a/drivers/net/can/m_can/tcan4x5x-core.c +++ b/drivers/net/can/m_can/tcan4x5x-core.c @@ -270,6 +270,17 @@ static int tcan4x5x_init(struct m_can_classdev *cdev) return ret; } =20 +static int tcan4x5x_deinit(struct m_can_classdev *cdev) +{ + struct tcan4x5x_priv *tcan4x5x =3D cdev_to_priv(cdev); + int ret =3D 0; + + ret =3D regmap_update_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG, + TCAN4X5X_MODE_SEL_MASK, TCAN4X5X_MODE_STANDBY); + + return ret; +}; + static int tcan4x5x_disable_wake(struct m_can_classdev *cdev) { struct tcan4x5x_priv *tcan4x5x =3D cdev_to_priv(cdev); @@ -359,6 +370,7 @@ static int tcan4x5x_get_gpios(struct m_can_classdev *cd= ev, =20 static const struct m_can_ops tcan4x5x_ops =3D { .init =3D tcan4x5x_init, + .deinit =3D tcan4x5x_deinit, .read_reg =3D tcan4x5x_read_reg, .write_reg =3D tcan4x5x_write_reg, .write_fifo =3D tcan4x5x_write_fifo, --=20 2.46.2 From nobody Sat Nov 23 20:06:37 2024 Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (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 81D49185920; Mon, 11 Nov 2024 11:08:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731323320; cv=none; b=C/WRdu0TndryzqGIHJRtNJ1yPJx5i/pch3BjMgRjKg7HCrLAZKVu3s/4j0MXG2QTxhYeppFmTN2O+Bhg8HjEpdr1oOYZtHxYCzI+e+l4azMIOLyqSuV6BHofV85FfCOqNdZfkqGu7bT9YbVP1u4Izz7EVDKNNm5e/buj7fqK2M0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731323320; c=relaxed/simple; bh=WKPt/yqlvCh6WXh/shxcRQ0bf/KslpLgjP8nAlAXJ2c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a981ZwsdK27nspZCkznOev1PftVPIwQKGjd36Bz66C/I+32q9lUOV+6t6fTmn7nUfwdr02SD25beMWfhtzqOnLVHv+RJaG+i7t9RILp4aI87hXCgU4xGBcAtU7tiDXlVVyEssxj/q/y2WXxAZxEC9h+q/IcZjU5Boe46jIy6gwc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=RjdPiKHr; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="RjdPiKHr" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=5G+2VudxYkgR5Q+WSydh4Dzc/KKgJNma63QxDjf6acI=; b=RjdPiKHrB+x4Q2dmA6Cdas0Szk kcqDjWgHmJAVm+l9mVs1OdtZ0kNvrCjqqqOq6STCZNiVxY6T99Ko+L2RvMOP5eBJgIQX5MeWOaqqk GwVGmD9G2NEkCnF2FLvNK0/Jf3trpi/XG+ZeK2g76f61UA/b8igp2RaIRUsv58NLjDwZz74F5GpK0 m1UZqGbNfH6CZQqfhqFn51WljFMEGkDgB2YeqmoXhxJZUuGfxfmyJKCAHvkHnG7xl6PxcPnGPIkaH J1HEXWb5P0a/8B/o/cAJvFifC8wXxLWaL+cnLMiEUsFeDRQFS/B+YYKVIm4yLbfzMvg5ZJXgY/tqT aaLra4Hg==; Received: from sslproxy01.your-server.de ([78.46.139.224]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tAS1A-0000j5-Cd; Mon, 11 Nov 2024 11:51:36 +0100 Received: from [185.17.218.86] (helo=zen.localdomain) by sslproxy01.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tAS19-000JnT-2U; Mon, 11 Nov 2024 11:51:35 +0100 From: Sean Nyekjaer Date: Mon, 11 Nov 2024 11:51:25 +0100 Subject: [PATCH 3/3] can: m_can: call deinit callback when going into suspend. 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: <20241111-tcan-standby-v1-3-f9337ebaceea@geanix.com> References: <20241111-tcan-standby-v1-0-f9337ebaceea@geanix.com> In-Reply-To: <20241111-tcan-standby-v1-0-f9337ebaceea@geanix.com> To: Chandrasekar Ramakrishnan , Marc Kleine-Budde , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Nyekjaer X-Mailer: b4 0.14.2 X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27455/Mon Nov 11 10:58:33 2024) m_can user like the tcan4x5x device, can go into standby mode. Low power RX mode is enabled to allow wake on can. Signed-off-by: Sean Nyekjaer --- drivers/net/can/m_can/m_can.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index a171ff860b7c6992846ae8d615640a40b623e0cb..d9f820b5609ea3e8a98dc8a9f4d= 9948c09aa85c6 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -2451,6 +2451,9 @@ int m_can_class_suspend(struct device *dev) if (cdev->pm_wake_source) { hrtimer_cancel(&cdev->hrtimer); m_can_write(cdev, M_CAN_IE, IR_RF0N); + + if (cdev->ops->deinit) + cdev->ops->deinit(cdev); } else { m_can_stop(ndev); } @@ -2490,6 +2493,10 @@ int m_can_class_resume(struct device *dev) * again. */ cdev->active_interrupts |=3D IR_RF0N | IR_TEFN; + + if (cdev->ops->init) + cdev->ops->init(cdev); + m_can_write(cdev, M_CAN_IE, cdev->active_interrupts); } else { ret =3D m_can_start(ndev); --=20 2.46.2