From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13210C4332F for ; Wed, 8 Nov 2023 06:46:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r9li7MpEWrwWeUmJP+9hLFiw/Pk4PIEoZDMjI5k/Tvk=; b=IKZzM6KailJ3c+ 3Uk400ymysEiuVekX0Tae/OuSXVeGZ6cmlZeubwi4qnILfxPkF6J0nFMbZWYYbTvc400EXZibo8mz D2JbP+Zj+evzVDfsXYbfGX8No5LdsUyjqj8ArfAo3vQneiQf4pjoVRddKEH8Vvd9J2AfmcKXS2/cp iczU0YXelC6pLmNkrDGEypllrPAeFhBFGeZUAtiDY38qB/1eT7GBsNRPCPnCQqC9wQUt1d2CFn89g NXZyHdtOZ7mFQ8L893NSG58fYn0jfjvOTa1bdMcCrxzGHgmDv6D4JwboKRbeKxfBish+0rEq1f7Bu sDfei0HZpEEKtwsGwhoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0cKP-0036iG-1c; Wed, 08 Nov 2023 06:46:17 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0cKM-0036hF-1w for linux-arm-kernel@lists.infradead.org; Wed, 08 Nov 2023 06:46:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1699425974; x=1730961974; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eHyC+WKiJDNkxkLk2QwSxP5pCxTyil4D3ANVe1z8QDg=; b=NphI+bBERzJs/I1BknD+PZsdFOR6M7dA4+BPKwR5642wUMCON5+k3XOh 4XQ1e7cnIdDPlCT6Q9+QfpNJsKS5ahQ5MKE2N+OMsYACbNHyuPQ6gaB/E EQcQqs41ji1V3wnwt+Fukjy1lkoEszlGhtS3pI/L351nZP1G7LC51i7sZ JP6gFJr3/VAaT85uoen8ZiRxFz1YJRm1F4h41ajyXYAUZBkawk4J1APRG RLW/CI6sPgWyaoPejCnaNabKuNxVqu6WzvRxP+ugoNB3FxIhPnyFJOnCx d69P+82oTgBKmSoBnvGz2KwTzyWZikAWENMfAOVOIRqSfiho+6oFMBTQc g==; X-IronPort-AV: E=Sophos;i="6.03,285,1694728800"; d="scan'208";a="33864469" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 08 Nov 2023 07:46:11 +0100 Received: from steina-w.localnet (steina-w.tq-net.de [10.123.53.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id C163328007F; Wed, 8 Nov 2023 07:46:10 +0100 (CET) From: Alexander Stein To: Andi Shyti Cc: Dong Aisheng , Shawn Guo , Sascha Hauer , Fabio Estevam , Wolfram Sang , Alexander Sverdlin , Pengutronix Kernel Team , NXP Linux Team , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v7 1/1] i2c: lpi2c: use clk notifier for rate changes Date: Wed, 08 Nov 2023 07:46:12 +0100 Message-ID: <22082032.EfDdHjke4D@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20231107212049.csimqzzvim5uecpa@zenone.zhora.eu> References: <20231107141201.623482-1-alexander.stein@ew.tq-group.com> <20231107212049.csimqzzvim5uecpa@zenone.zhora.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_224615_030576_F0ECAC49 X-CRM114-Status: GOOD ( 15.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Andi, Am Dienstag, 7. November 2023, 22:20:49 CET schrieb Andi Shyti: > Hi Alexander, > = > is it my mail client not working or is is your patch that has > gone through something terribly bad? I can't see anything obviously wrong. Can you elaborate? Thanks Alexander > Andi > = > On Tue, Nov 07, 2023 at 03:12:01PM +0100, Alexander Stein wrote: > > * CLKLO =3D I2C_CLK_RATIO * CLKHI, SETHOLD =3D CLKHI, DATAVD =3D CLKHI/= 2 */ > > = > > static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) > > { > > = > > @@ -207,7 +224,7 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct > > *lpi2c_imx)> = > > lpi2c_imx_set_mode(lpi2c_imx); > > = > > - clk_rate =3D clk_get_rate(lpi2c_imx->clks[0].clk); > > + clk_rate =3D atomic_read(&lpi2c_imx->rate_per); > > = > > if (!clk_rate) > > = > > return -EINVAL; > > = > > @@ -590,6 +607,27 @@ static int lpi2c_imx_probe(struct platform_device > > *pdev)> = > > if (ret) > > = > > return ret; > > = > > + lpi2c_imx->clk_change_nb.notifier_call =3D lpi2c_imx_clk_change_cb; > > + ret =3D devm_clk_notifier_register(&pdev->dev, lpi2c_imx->clks[0].clk, > > + &lpi2c_imx->clk_change_nb); > > + if (ret) > > + return dev_err_probe(&pdev->dev, ret, > > + "can't register peripheral clock = notifier\n"); > > + /* > > + * Lock the clock rate to avoid rate change between clk_get_rate() = and > > + * atomic_set() > > + */ > > + ret =3D clk_rate_exclusive_get(lpi2c_imx->clks[0].clk); > > + if (ret) > > + return dev_err_probe(&pdev->dev, ret, > > + "can't lock I2C peripheral clock = rate\n"); > > + > > + atomic_set(&lpi2c_imx->rate_per, clk_get_rate(lpi2c_imx- >clks[0].clk)); > > + clk_rate_exclusive_put(lpi2c_imx->clks[0].clk); > > + if (!atomic_read(&lpi2c_imx->rate_per)) > > + return dev_err_probe(&pdev->dev, -EINVAL, > > + "can't get I2C peripheral clock = rate\n"); > > + > > = > > pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT); > > pm_runtime_use_autosuspend(&pdev->dev); > > pm_runtime_get_noresume(&pdev->dev); -- = TQ-Systems GmbH | M=FChlstra=DFe 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht M=FCnchen, HRB 105018 Gesch=E4ftsf=FChrer: Detlef Schneider, R=FCdiger Stahl, Stefan Schneider http://www.tq-group.com/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel