From patchwork Wed Jun 19 10:11:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13703625 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 64A8BC27C53 for ; Wed, 19 Jun 2024 10:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=eHeUArdSKpP0gigzpdr9jDKMc/RdHGYl+hgWmyzctFg=; b=A/4Fnk9L3vw1xDfjgml5o4nonB Q99s59wr7bKT3WlHFOPxwfENLnS2ta0lwyGAhOYGhdYB3/j7x0J99qhqzU+WlvzCUEmru1C+jwoX6 0LuP6XX8ojXhHTP1vfwp36sYFqEnrYa6wacNFOa/qqYkZ+TCdfvEjqa/2tTeoDi61plJfK311RD2c QLKF8Mf6m+y5UqvVWv+NyHMcQFaM9L8S+2NTZkrRrJAewxXuyZd0MwnwIpUArEGDZDXsB34RhYkkm Cmq3LQfRmPXMfmXTL/Kzx8o7QW5qT/7b2Om3ZF2Cfp8aC5nZUFVgHHFhLMeSEG8QaCkvGIvsnaNQz m3Z+VoeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJsJ5-00000000jeG-0kmM; Wed, 19 Jun 2024 10:12:47 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJsIX-00000000jSg-3B0J for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 10:12:29 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2ebe6495aedso60727821fa.0 for ; Wed, 19 Jun 2024 03:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1718791932; x=1719396732; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eHeUArdSKpP0gigzpdr9jDKMc/RdHGYl+hgWmyzctFg=; b=dc0fdIFlnNlxCSJoV8MoK/904zS5Z1W05AUNmUm+Kc8IlGxfUcR+Ot+JWbfnH7A+cx x/MPasjy+fZXEfw5xhZeZ+Kg7/Zq9kwBs/gJ4hVXk5psPZHrgXng0gWKUO4WUfDeAijM CaJzb6EDURvSqwFu2gaGt2nuaeGG0D40mFeMZlOBPwGSP59LvG3pYjlSIXqC8J8OkxGd EA86KZS6GOluhChsFlvfKN/7cC7ROM3yZpXzLZmFL+SOHo6DsyiRz19m/BTJFrw8UDw7 j/M6NYFugPctTNInICAnI0YMV4nKhrRF5hPozurBH3Y2d4TorsC/N3TRQ6dYFnZ1jP9x wmvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718791932; x=1719396732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eHeUArdSKpP0gigzpdr9jDKMc/RdHGYl+hgWmyzctFg=; b=u3GpiNR6MGKfz4Yw+JZfY7k4jRsTpz4agPPBoxcTlRUS1Ht4f+yH1BxFCqYyJODUA9 w3KBstgKxqkQAPmLP0ACIcu8w47KLi8YPKltCz6cCkuTRl1OnxEYxrrbMNG0zWNDy5sc FtREl7nx44/IMFBJt8d8WWA8NqiyICYlNiwakPAIxbE4qjXRogJKKrG9Ifs5JTPymFu1 pMYxoWRBF8XQCezh7kVBh7jX+BSX9pLCq3oj2LXewBF3LJww7wj1C6J2uAhcF5T1AIdC tBtR4++pxPW+xhF4T5KJpYdOXD/zYdA6rSkA1aXYYJ2n9odS8RY4R5RH+lC5UmVJBpNp iKWA== X-Forwarded-Encrypted: i=1; AJvYcCWhd74M2nGhURyvsoOgJB3ywSosIVwVUPghGBZ2Y8CTFoNQDumn2C8qZOOuLcqSnfrn7SPjnwJvb6nTvbauR08OYsDrtlxl+4rmtctQSxnvRe/UeXQ= X-Gm-Message-State: AOJu0Yz04Wi2is0HbFT9iAhBlsI87wn79sEnA481GP7pvt/0VWO1xI1A Cn3GMwMzGsoVvXL0yYM6IE+VbkofY4siSASaHmt8QNWBOk61pY+/8syhRB1McMo= X-Google-Smtp-Source: AGHT+IGyBLZDsIe+RLHY2gT0ffX4UdQ+4/orS3dRcY6M6qSnO9AgKtn+LaqX7vFTMoagllxCj9bhpg== X-Received: by 2002:a19:c205:0:b0:52c:aa0f:622d with SMTP id 2adb3069b0e04-52ccaa37500mr1184800e87.30.1718791931979; Wed, 19 Jun 2024 03:12:11 -0700 (PDT) Received: from localhost (p509153eb.dip0.t-ipconnect.de. [80.145.83.235]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422f602e802sm224164165e9.11.2024.06.19.03.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 03:12:11 -0700 (PDT) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Fabrice Gasnier , William Breathitt Gray , Lee Jones , Maxime Coquelin , Alexandre Torgue Cc: linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Thorsten Scherer Subject: [PATCH v2 3/5] counter: stm32-timer-cnt: Use TIM_DIER_CCxIE(x) instead of TIM_DIER_CCxIE(x) Date: Wed, 19 Jun 2024 12:11:44 +0200 Message-ID: <126bd153a03f39e42645573eecf44ffab5354fc7.1718791090.git.u.kleine-koenig@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1691; i=u.kleine-koenig@baylibre.com; h=from:subject:message-id; bh=ls4kxFHqkBG+kx3WnRXHImWHnlbY3kjK18Z2TnMQLqo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBmcq7mxkltqOid2paUGt3syPB6S0GwVABYwtite mZw5LibI4+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZnKu5gAKCRCPgPtYfRL+ ThvbCACIw0IFO0iRtD++sN85YjotjckPff1mDVwNLBVaYqLdD/VtfYCUK2skkHC67BNifelJo3I G2/mOes1u137ttN4EbhqeW5MG9RqBa19yYwx31nH8RvOUywSbqyhYfdgeuDqtr/A1NDvL6eOnjU U9uwZf7FjLh4mnnTehhIJJoGBFAKprGxIbVI7QjjBJiP0/WEB0U/GF85mbSjXauaQBq5Iw2yynC DEczOF7dcKrtl1IzqBaF08lPGfHzGpX0WUbX064/snRbhcVXQ5ruP93BFjUM+67ecHXsEymcTHy dTqkyaIFtvIUw3HjwSHexHs0tMC4xNcCb6dgUX0okdcKZ6W3 X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_031227_807154_899791EB X-CRM114-Status: GOOD ( 17.30 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These two defines have the same purpose and this change doesn't introduce any differences in drivers/counter/stm32-timer-cnt.o. The only difference between the two is that TIM_DIER_CC_IE(1) == TIM_DIER_CC2IE while TIM_DIER_CCxIE(1) == TIM_DIER_CC1IE . That makes it necessary to have an explicit "+ 1" in the user code, but IMHO this is a good thing as this is the code locatation that "knows" that for software channel 1 you have to use TIM_DIER_CC2IE (because software guys start counting at 0, while the relevant hardware designer started at 1). Signed-off-by: Uwe Kleine-König Acked-by: William Breathitt Gray --- drivers/counter/stm32-timer-cnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c index 0664ef969f79..186e73d6ccb4 100644 --- a/drivers/counter/stm32-timer-cnt.c +++ b/drivers/counter/stm32-timer-cnt.c @@ -465,7 +465,7 @@ static int stm32_count_events_configure(struct counter_device *counter) ret = stm32_count_capture_configure(counter, event_node->channel, true); if (ret) return ret; - dier |= TIM_DIER_CC_IE(event_node->channel); + dier |= TIM_DIER_CCxIE(event_node->channel + 1); break; default: /* should never reach this path */ @@ -478,7 +478,7 @@ static int stm32_count_events_configure(struct counter_device *counter) /* check for disabled capture events */ for (i = 0 ; i < priv->nchannels; i++) { - if (!(dier & TIM_DIER_CC_IE(i))) { + if (!(dier & TIM_DIER_CCxIE(i + 1))) { ret = stm32_count_capture_configure(counter, i, false); if (ret) return ret;