Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3088844ybv; Sat, 15 Feb 2020 10:43:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwocGL0swJVeJ5ktx8CNfnR6+XuZ0HPNweEfWUZg/AA0Gu3G5opSdShxhNhF0Y3YK4xpikV X-Received: by 2002:a9d:2c2a:: with SMTP id f39mr6586708otb.301.1581792188309; Sat, 15 Feb 2020 10:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581792188; cv=none; d=google.com; s=arc-20160816; b=Trg5FzSrk9QfcyROgdqI6tmUFl87hleipfwApxCxy/6QPYw+e832AmWe+bJLMpz9xd YQreHdZd+HhyYKkBIy5zzkhApC+Tig0os/7kX5wD4TLrnwFVH2M+XsrJBmOWyWmzTvGR +macEK3VBDhw/2jCpagPQnkcm2aMkm0MP4BgRp0D30tNtyzf3T2N0Mq7CgmNolFSvMmp NufLE+Ar/xrqL3tHKQwb7MqSveWBd9r7cBDRFor7ek3I4AD/2DfXav98NJTW9Qsk80// jLKeD20X9YAKOOsHxutwU13TmLPNlUxUIaGOh5dW07hj9sI6cDAge2bGdr4cA+jj6RKc hnyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=NaSiZwyiNK2TAjbR618SsxcNHKjud3fdwiIe+PmoEcg=; b=nylYWg7S0nh8oX2q8RFzUHVIfCcEuZcAEAcxFvcFVpj8UE459hNiV2REZXXs5plaUW biiQ0GtSLBVR6ZV20BEpZ0JuWTCNNzedfCDuAGQFp9WhWG+5+tq3hGAAWlq1/2QdAipg EzcMy6W75cj2txc26CVwkakLWtHksjlFk3xJxD9DdRTv7SqRM5bJ0x//+x84AHKF/0KT E9ZIDeKAEzsEwYiw2u/MFEjyli5OWmDn780HtjX7+LbUY6pGo4s+rDngnchzw9BPDGlu eyXlm7dKjV4neL1Jz92Vb4KX+xl6VpIrWsUWP7TawUXrRh4Fgcz9F2PEG4WlQ9zjB7NS FSyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=djgmAQXj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id p22si4749228ota.43.2020.02.15.10.42.56; Sat, 15 Feb 2020 10:43:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=djgmAQXj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726318AbgBOSll (ORCPT + 99 others); Sat, 15 Feb 2020 13:41:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:37868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726233AbgBOSlk (ORCPT ); Sat, 15 Feb 2020 13:41:40 -0500 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 94AAC2072D; Sat, 15 Feb 2020 18:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581792100; bh=BjBazr4WmmuTjxM5m3H0niFodBZruveqbCGfq9sC65Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=djgmAQXjqo+MlqzTZc00spUUBrsvrHJZoZRFnHI9BzjfTLivfrp5FNipSdfQfqJLi BqANi0V7cfltMJT0voJbWwGrIDwFYflw/eT7iFq6/Z8C/njlTvZQT2zhYZc4DWPJlo m2oCHozWKKl/O/5UqGl+ElpKIcR14X8IyJDeTu7w= Date: Sat, 15 Feb 2020 18:41:35 +0000 From: Jonathan Cameron To: Fabrice Gasnier Cc: , , , , , , , , , , Subject: Re: [PATCH] iio: trigger: stm32-timer: disable master mode when stopping Message-ID: <20200215184135.10af9907@archlinux> In-Reply-To: <1581698795-437-1-git-send-email-fabrice.gasnier@st.com> References: <1581698795-437-1-git-send-email-fabrice.gasnier@st.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 14 Feb 2020 17:46:35 +0100 Fabrice Gasnier wrote: > Master mode should be disabled when stopping. This mainly impacts > possible other use-case after timer has been stopped. Currently, > master mode remains set (from start routine). > > Fixes: 6fb34812c2a2 ("iio: stm32 trigger: Add support for TRGO2 triggers") > > Signed-off-by: Fabrice Gasnier I 'think' this is tangential to the other changes to this driver recently and you seem to have prepared this against current mailine. Hence applied to the fixes-togreg branch of iio.git and marked for stable. Thanks, Jonathan > --- > drivers/iio/trigger/stm32-timer-trigger.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c > index 2e0d32a..2f82e8c 100644 > --- a/drivers/iio/trigger/stm32-timer-trigger.c > +++ b/drivers/iio/trigger/stm32-timer-trigger.c > @@ -161,7 +161,8 @@ static int stm32_timer_start(struct stm32_timer_trigger *priv, > return 0; > } > > -static void stm32_timer_stop(struct stm32_timer_trigger *priv) > +static void stm32_timer_stop(struct stm32_timer_trigger *priv, > + struct iio_trigger *trig) > { > u32 ccer, cr1; > > @@ -179,6 +180,12 @@ static void stm32_timer_stop(struct stm32_timer_trigger *priv) > regmap_write(priv->regmap, TIM_PSC, 0); > regmap_write(priv->regmap, TIM_ARR, 0); > > + /* Force disable master mode */ > + if (stm32_timer_is_trgo2_name(trig->name)) > + regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2, 0); > + else > + regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS, 0); > + > /* Make sure that registers are updated */ > regmap_update_bits(priv->regmap, TIM_EGR, TIM_EGR_UG, TIM_EGR_UG); > } > @@ -197,7 +204,7 @@ static ssize_t stm32_tt_store_frequency(struct device *dev, > return ret; > > if (freq == 0) { > - stm32_timer_stop(priv); > + stm32_timer_stop(priv, trig); > } else { > ret = stm32_timer_start(priv, trig, freq); > if (ret)