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 DB66CEDEC4D for ; Wed, 13 Sep 2023 14:01:34 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uO0ZLSD3oPOtVqVvY63eDO9RTH3pKuiKXobIYDKs1bc=; b=VeDQm2KtMZ03fB KM8ru5CEl1voV7DQ1HmMWKfu4hzBjqeHWNjMM5/8N8o4g6y+lMh14dn5oebsQa4W5EoQEDwSYZk+R teTk0u9lB9iBTLGXJidUNEey+JceNlSv0ns1vNNSRGQX4vo1e72iVSA0vYkqEtaR8Ra9Xl7XX6PPi 5VAeXOlpIXrnAyDXUw2M1XVNAth5g509Lt7mVCtQPtmXAZnF2UlcWNDmWmRYfFFJcmv+r+hLGQIcZ basvBfPjbxewYDSoQKZv/18QfeXXtyf8CSd5F2P9Q8/M1nefmwJ86K8ML370REub3w1I8btFarPzs TEw27Lmohd9gvU7yfRqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgQQW-0064zL-1K; Wed, 13 Sep 2023 14:01:08 +0000 Received: from madras.collabora.co.uk ([46.235.227.172]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgQQO-0064wS-2x; Wed, 13 Sep 2023 14:01:06 +0000 Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id E9F4F66072F4; Wed, 13 Sep 2023 15:00:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694613656; bh=zNzJow6Gn0s5lcUUXuQqO24RP3fvno10hjXXk/5ytb8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=FPqf764XjDlDRzXc/WCOeWXB4U20gfHRMvI6TON8Gs4r+ajqG8jZEPliH+tqp739t AmUQcmBxv0PLHPufVTN4dMA2v7XewK5vkxZVCr+ix7x4+i5ZncJUawBsS7tn/HGers vVY49DopN+HNZMAaFKAcCdOtkPE4V4fdDZeqHvich/1Im7yGbJDvqk+iMEcYfIsReA YN194QBwHPoVvBOly6accH+GGNaVgqYuulaEguwqNbzZ8vZXOZSJcPLOH7wioscrfg 1A7iIE6WkdTHaztNlDDHj6XMCkRKzgqIaycBaVaEENST/L0swdLSW5Qn24x2a2JB62 Op5YCsPMelVAA== Message-ID: <0fd097fd-9fdb-9001-cddb-7a396fde28bb@collabora.com> Date: Wed, 13 Sep 2023 16:00:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH] i2c: mt65xx: allow optional pmic clock Content-Language: en-US To: Daniel Golle , Qii Wang , Andi Shyti , Matthias Brugger , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Cc: =?UTF-8?B?6YOt5bCP5qGl?= References: <3bf827929a44c17bfb1bf1000b143c02ce26a929.1693102324.git.daniel@makrotopia.org> From: AngeloGioacchino Del Regno In-Reply-To: <3bf827929a44c17bfb1bf1000b143c02ce26a929.1693102324.git.daniel@makrotopia.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230913_070101_123560_FB279543 X-CRM114-Status: GOOD ( 25.35 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Il 27/08/23 04:13, Daniel Golle ha scritto: > Using the I2C host controller on the MT7981 SoC requires 4 clocks to > be enabled. One of them, the pmic clk, is only enabled in case > 'mediatek,have-pmic' is also set which has other consequences which > are not desired in this case. > > Allow defining a pmic clk even in case the 'mediatek,have-pmic' propterty > is not present and the bus is not used to connect to a pmic, but may > still require to enable the pmic clock. > > Signed-off-by: Daniel Golle > --- > drivers/i2c/busses/i2c-mt65xx.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c > index 1a9b5a068ef1b..a8b5719c33729 100644 > --- a/drivers/i2c/busses/i2c-mt65xx.c > +++ b/drivers/i2c/busses/i2c-mt65xx.c > @@ -1442,15 +1442,19 @@ static int mtk_i2c_probe(struct platform_device *pdev) > if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk)) > return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk); > > + i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = devm_clk_get_optional(&pdev->dev, "pmic"); > + if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk)) { > + dev_err(&pdev->dev, "cannot get pmic clock\n"); > + return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk); > + } > + > if (i2c->have_pmic) { ...but you're not changing speed_clk if !i2c->have_pmic, I'm not sure that this will work correctly. Perhaps you wanted to also set speed_clk if the clock is present? if (IS_ERR...) { error handling } else if (clk is present) speed_clk = I2C_MT65XX_CLK_PMIC; if (have_pmic && !clk_is_present) error Regards, Angelo > - i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = devm_clk_get(&pdev->dev, "pmic"); > - if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk)) { > + if (!i2c->clocks[I2C_MT65XX_CLK_PMIC].clk) { > dev_err(&pdev->dev, "cannot get pmic clock\n"); > - return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk); > + return -ENODEV; > } > speed_clk = I2C_MT65XX_CLK_PMIC; > } else { > - i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = NULL; > speed_clk = I2C_MT65XX_CLK_MAIN; > } > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel