Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp711992pxb; Wed, 8 Sep 2021 10:29:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYAL7MlsSSH6ej0hWwbsfMzcQiBd94PdkaenqBxnzVTU220NMkP5XhQJUhZrAmKOjI82kX X-Received: by 2002:a05:6e02:102c:: with SMTP id o12mr754883ilj.312.1631122186616; Wed, 08 Sep 2021 10:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631122186; cv=none; d=google.com; s=arc-20160816; b=JuC0n7rxGtw2Eq4/eMAL5k+VYUht1nMo+SCONeBTrxPwDfMopIZ6K8BQ0qzKfmR3sj uMG4hn4gbxrHUpdowmmlmnDU2QAq8ap+oSR7EEj0eX/bNaHhysOvNGqjqAmc5JhtcEyl 73GUQpUnaWOzs+oMi6ysTmtVKGpd0vKgPmxPmFF4qo0SGnOe8Kvp2G1pHmTxCwGE9Gl/ r0JO+vTKlnVMNl/TuEDuKo85IDw6IoSIQndONLw/yNr+nuYn66BYolURh7LK6MwuwmMc ZGdYv4Bjro7ov330w2YS5FrJmj9DNialHUTs1EZk2ZrvWcBHf78LyEVcfVmi0zkzXPfF CLVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=4XKdvSYZEc0HyuDNpvzkF/dZKs9ksLCy0lwtrH4FrWU=; b=dlhmTUIi4jxJ6o3gD9vGfIiuJfnp8UmfU/CIbHvXrz/C5SZJG3qXkarylp5BaxLhQE JGDQ5Le0JjL2tSsEnTFbjBJkX+tRN8G9d+Dvedsp5eUTZeC+wE19Kb/No3A264wIh8j8 NgfbD9zabjcS/i7QuB5r6p5YT1y4OAoMXZ5h7nTQScGKqi+22aakVygOPvhn34yxTCKR WYxBIbwilc2GFpmnQrYUAqKx64gTL6hUtRZd91Qq8ACIuXCjG3Dq29vVtxCvGeeVjMIV fv3xQ6L+RbdPieKMDDelEU4hfCi9Att7GuF1H56Zxu0KmmsBaZi9AZjcn64an+QB7fZy qR7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q128si2934282ioq.111.2021.09.08.10.29.20; Wed, 08 Sep 2021 10:29:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352463AbhIHR3h (ORCPT + 99 others); Wed, 8 Sep 2021 13:29:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:60558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbhIHR3g (ORCPT ); Wed, 8 Sep 2021 13:29:36 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3C68961157; Wed, 8 Sep 2021 17:28:21 +0000 (UTC) Date: Wed, 8 Sep 2021 18:31:49 +0100 From: Jonathan Cameron To: Fabrice Gasnier Cc: William Breathitt Gray , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v16 02/14] counter: stm32-timer-cnt: Provide defines for slave mode selection Message-ID: <20210908183149.468e60ac@jic23-huawei> In-Reply-To: References: X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 31 Aug 2021 15:40:37 +0200 Fabrice Gasnier wrote: > On 8/27/21 5:47 AM, William Breathitt Gray wrote: > > The STM32 timer permits configuration of the counter encoder mode via > > the slave mode control register (SMCR) slave mode selection (SMS) bits. > > This patch provides preprocessor defines for the supported encoder > > modes. > > > > Cc: Fabrice Gasnier > > Signed-off-by: William Breathitt Gray > > --- > > drivers/counter/stm32-timer-cnt.c | 16 ++++++++-------- > > include/linux/mfd/stm32-timers.h | 4 ++++ > > 2 files changed, 12 insertions(+), 8 deletions(-) > > Hi William, > > You can add my: > Reviewed-by: Fabrice Gasnier Applied. Thanks, J > > Thanks, > Fabrice > > > > > diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c > > index 3fb0debd7425..1fbc46f4ee66 100644 > > --- a/drivers/counter/stm32-timer-cnt.c > > +++ b/drivers/counter/stm32-timer-cnt.c > > @@ -93,16 +93,16 @@ static int stm32_count_function_get(struct counter_device *counter, > > regmap_read(priv->regmap, TIM_SMCR, &smcr); > > > > switch (smcr & TIM_SMCR_SMS) { > > - case 0: > > + case TIM_SMCR_SMS_SLAVE_MODE_DISABLED: > > *function = STM32_COUNT_SLAVE_MODE_DISABLED; > > return 0; > > - case 1: > > + case TIM_SMCR_SMS_ENCODER_MODE_1: > > *function = STM32_COUNT_ENCODER_MODE_1; > > return 0; > > - case 2: > > + case TIM_SMCR_SMS_ENCODER_MODE_2: > > *function = STM32_COUNT_ENCODER_MODE_2; > > return 0; > > - case 3: > > + case TIM_SMCR_SMS_ENCODER_MODE_3: > > *function = STM32_COUNT_ENCODER_MODE_3; > > return 0; > > default: > > @@ -119,16 +119,16 @@ static int stm32_count_function_set(struct counter_device *counter, > > > > switch (function) { > > case STM32_COUNT_SLAVE_MODE_DISABLED: > > - sms = 0; > > + sms = TIM_SMCR_SMS_SLAVE_MODE_DISABLED; > > break; > > case STM32_COUNT_ENCODER_MODE_1: > > - sms = 1; > > + sms = TIM_SMCR_SMS_ENCODER_MODE_1; > > break; > > case STM32_COUNT_ENCODER_MODE_2: > > - sms = 2; > > + sms = TIM_SMCR_SMS_ENCODER_MODE_2; > > break; > > case STM32_COUNT_ENCODER_MODE_3: > > - sms = 3; > > + sms = TIM_SMCR_SMS_ENCODER_MODE_3; > > break; > > default: > > return -EINVAL; > > diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h > > index f8db83aedb2b..5f5c43fd69dd 100644 > > --- a/include/linux/mfd/stm32-timers.h > > +++ b/include/linux/mfd/stm32-timers.h > > @@ -82,6 +82,10 @@ > > #define MAX_TIM_ICPSC 0x3 > > #define TIM_CR2_MMS_SHIFT 4 > > #define TIM_CR2_MMS2_SHIFT 20 > > +#define TIM_SMCR_SMS_SLAVE_MODE_DISABLED 0 /* counts on internal clock when CEN=1 */ > > +#define TIM_SMCR_SMS_ENCODER_MODE_1 1 /* counts TI1FP1 edges, depending on TI2FP2 level */ > > +#define TIM_SMCR_SMS_ENCODER_MODE_2 2 /* counts TI2FP2 edges, depending on TI1FP1 level */ > > +#define TIM_SMCR_SMS_ENCODER_MODE_3 3 /* counts on both TI1FP1 and TI2FP2 edges */ > > #define TIM_SMCR_TS_SHIFT 4 > > #define TIM_BDTR_BKF_MASK 0xF > > #define TIM_BDTR_BKF_SHIFT(x) (16 + (x) * 4) > >