Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4499571pxb; Tue, 31 Aug 2021 06:44:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYvAhgKll8O3WGFB0LjJ0lFJngY5B+irvIs2rwROvH0Ibq17HpJ8JgWKPkG456wIahb+y6 X-Received: by 2002:a17:906:4cc1:: with SMTP id q1mr32115387ejt.415.1630417485551; Tue, 31 Aug 2021 06:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630417485; cv=none; d=google.com; s=arc-20160816; b=xB9/FovdcN3uL/9OFtnTCt94QFJbms1/t+Z7p9gDHJhSGXDRx9HSDnyxhy9dwZ9Gsh uJeKn2Zf54VOkzDKSOTNoShDyKYvYOuDWNnudz6knh97yYEvqyi0Cndq112Ur4a/ooII PenHF8aeRnfNmby1mBUNdabrQ4Hp/f0BAx0GVpugtF63YeNOUEbkaMl6lavZ1th8cmPe 3PhpbvMJsm+fsmCa3o1Uzl475KsCX1MK3s4kierCb7BigGQhDFP9Ijk7rRiggWaogvfX 4GUi4lHpyYbxzcEs7NLFCvrRKZNgxnftqq+bD4kz5gfZ5PxQvQAAFqFZqaK8XD27GAt8 Vz3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=xBK3pqlFL97RTUxttGzt1l2EgAMHJw/Nm5xYjtTYw7M=; b=bkx2yGqffAExhKFsFOnQRIKdfgjg+B8OcTg5+LdXn7XvKFdTRjNeti9DSGjHbrko31 EWb879CYLR52YB6aubGRysJFZFSU0akcC3gtQjGINwnb0LRogRZSvCz3t5uGCaNUBy1j yAYyMzrlIV93pLhMOgWiyhV2pz3OvbYuaeHvxI2128g20M0Tor9IVw+UZwOTg2Jp+34q ueapyDcSKIvl0jilsNjIONBpc0l6vVXuLNepZHewbbTu5XcUbcA0Zh4TaKEz7zyBhdOE DiFJlYl3BH2DvjsTz4REZCG6OdoZKXUnOpG+luei4yXc0CPR8WCJfmVsqKJGfn3xXUug iUww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=CrDRIxtC; 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=foss.st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ht14si11714273ejc.244.2021.08.31.06.44.19; Tue, 31 Aug 2021 06:44:45 -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; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=CrDRIxtC; 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=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237646AbhHaNmk (ORCPT + 99 others); Tue, 31 Aug 2021 09:42:40 -0400 Received: from mx07-00178001.pphosted.com ([185.132.182.106]:39998 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233789AbhHaNmj (ORCPT ); Tue, 31 Aug 2021 09:42:39 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 17V921ZZ014213; Tue, 31 Aug 2021 15:40:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=xBK3pqlFL97RTUxttGzt1l2EgAMHJw/Nm5xYjtTYw7M=; b=CrDRIxtCxVYJHaq/yc9f6cFjObY9OA1OZcmuFIQTXa0NYgzvrLvieOr8U77xZadenCsA Pe8oeqlvHKPF8gu317rlicl/gd5A6sbvoNW0Lc7111CX6mybEZ7V86+vo2FrespkfLuJ AxYoEATcJW2DdKvDkSgJ3o61HvATIQLDIW5/5Tn65aJ6EH0Q4GCNf6tkwVI2kc38R4fJ 2jF/vcSdGpSY45Qz8EsK9L3DMXh5JgpHCgNw2w7lPenjCe1hnFSpU+FKS3ycjxJqlO6y UVKvbSxw/tDbrXbh6JcZoMHxnSWHhRy2Ln8ENodH+PqHKnZtKjVKuRYP6u9ki6Uwof6A cg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 3asheh1hcb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 31 Aug 2021 15:40:40 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1B40410002A; Tue, 31 Aug 2021 15:40:40 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 0306424692E; Tue, 31 Aug 2021 15:40:40 +0200 (CEST) Received: from [10.211.11.146] (10.75.127.44) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 31 Aug 2021 15:40:38 +0200 Subject: Re: [PATCH v16 02/14] counter: stm32-timer-cnt: Provide defines for slave mode selection To: William Breathitt Gray , CC: , , , , , , , , , , , , , , , , References: From: Fabrice Gasnier Message-ID: Date: Tue, 31 Aug 2021 15:40:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-08-31_05,2021-08-31_01,2020-04-07_01 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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) >