Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2512791ybz; Sun, 19 Apr 2020 03:11:08 -0700 (PDT) X-Google-Smtp-Source: APiQypIinAmCWcPXgPKyyM81VxUe50HztrBw+X8NjZDFx4QJVUhXlUP0CNkxDTPBsAz5i/tSCmli X-Received: by 2002:a17:907:40f2:: with SMTP id no2mr11118685ejb.41.1587291068531; Sun, 19 Apr 2020 03:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587291068; cv=none; d=google.com; s=arc-20160816; b=C9RLOZ0Wxw701ubcPqJOjoChFUffvuxjJ02uE5cKVMhF9ZOizeNU1HgNp7ubwsqe4Y AEuo2Q68htQFpS4mJ+PIXBBzJPd8KJdVFPIWskfMdAQbHga6W6THML2ZVGvjOf/Kpnvu drqnuX5q57PByeUdwqIx2E5Z8ETH9Tiq304GwX+gd/XDyHoSjINUj+YINg1nwibVQYwr pr6U2aKH/FcHPrYBR1NLbyr/kMrfr6vmXUW75oWiAyWU7H6gboIiBYasWulj30yAFE4C uD4cnTP9vMtggD2zitsiq+umslEQpYmYVAZWr2AHUGXLmW4q7Kv6GcbWdjQ+4pbxQf7i Reog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Ny4rHJjMl3wfaOQYN/P/n252VPZhaEACEVIVcG4Ahfk=; b=Ty1h54NR5Qn0qQeIL0IvyaPcdusUH41D0k5ZIdgTXEyE/0KmKfkzJqHj0UTtUeebes TQ507V8zKT2uzS/qEwccjH0OXF/Wmd4KKiUGhEkrFvb+ZiWuxiwiyaEH9QO6OTqepO90 KJoU/d20qw2DCmfDSM/NjsFt+5ZCwkpzJpVKyZp1sBz2Q6xB+xBt2356FgQdgkun54mv NWYf+StDqFtpBTfB+aLuXs9Oq6h87wn0hN7SendztylM8tbYyVQlhTfXj0FzcOhAEdd2 IQt20JD0ZosITvxo438YzYpR7U0YQLlOVZCMdqDYQdJ6FYjn+4Ptwqf4URDJs+EVWfLW GneA== 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=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c94si763069edf.446.2020.04.19.03.10.45; Sun, 19 Apr 2020 03:11:08 -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=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725987AbgDSKJX (ORCPT + 99 others); Sun, 19 Apr 2020 06:09:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:52772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbgDSKJX (ORCPT ); Sun, 19 Apr 2020 06:09:23 -0400 Received: from ROU-LT-M43218B.mchp-main.com (amontpellier-556-1-155-96.w109-210.abo.wanadoo.fr [109.210.131.96]) (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 9A6FD21841; Sun, 19 Apr 2020 10:09:18 +0000 (UTC) Date: Sun, 19 Apr 2020 12:09:43 +0200 From: ludovic.desroches@microchip.com To: Jonathan Cameron Cc: Eugen Hristev - M18282 , Alexandru Ardelean , "linux-iio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 1/2] iio: at91-sama5d2_adc: split at91_adc_current_chan_is_touch() helper Message-ID: <20200419100943.voa26ggjr4wa6uce@ROU-LT-M43218B.mchp-main.com> References: <20200304084219.20810-1-alexandru.ardelean@analog.com> <20200413180556.20638f3b@archlinux> <9315e9a7-0703-b119-ca32-69f0c2fcc7de@microchip.com> <20200415064352.yn7xkvjtsdcvnvni@ROU-LT-M43218B.mchp-main.com> <20200418185853.35b07a7d@archlinux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200418185853.35b07a7d@archlinux> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 18, 2020 at 06:58:53PM +0100, Jonathan Cameron wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Wed, 15 Apr 2020 08:43:52 +0200 > ludovic.desroches@microchip.com wrote: > > > On Tue, Apr 14, 2020 at 12:22:45PM +0000, Eugen Hristev - M18282 wrote: > > > On 13.04.2020 20:05, Jonathan Cameron wrote: > > > > On Wed, 4 Mar 2020 10:42:18 +0200 > > > > Alexandru Ardelean wrote: > > > > > > > >> This change moves the logic to check if the current channel is the > > > >> touchscreen channel to a separate helper. > > > >> This reduces some code duplication, but the main intent is to re-use this > > > >> in the next patches. > > > >> > > > >> Signed-off-by: Alexandru Ardelean > > > > Eugen / Ludovic, > > > > > > > > Have you had a chance to look at this series? > > > > > > Hi Jonathan, > > > > > > Does the patch apply correctly for you ? > > > > No issue on my side to apply them (v5.7-rc1 and next). > > > > > I will try to test it , if I manage to apply it. > > > I can only test the ADC though because at this moment I do not have a > > > touchscreen at disposal. > > > > Same here, not able to test the touchscreen but it doesn't seem very risky. > > > > > > > > Meanwhile, the code looks good for me, > > > > > > Reviewed-by: Eugen Hristev > > > > You can add mine as well: > > > > Reviewed-by: Ludovic Desroches > > For both of you - tags for both patches or just this one? Sorry both patches for me, I just replied to patch 2/2 to ease the collection of tags. Ludovic > > Thanks, > > Jonathan > > > > > Regards > > > > Ludovic > > > > > > > > By the way, I do not know if my two pending patches on this driver will > > > conflict or not. > > > > > > Eugen > > > > > > > > > > > Thanks, > > > > > > > > Jonathan > > > > > > > >> --- > > > >> > > > >> This patchset continues discussion: > > > >> https://lore.kernel.org/linux-iio/20191023082508.17583-1-alexandru.ardelean@analog.com/ > > > >> Apologies for the delay. > > > >> > > > >> Changelog v1 -> v2: > > > >> * added patch 'iio: at91-sama5d2_adc: split at91_adc_current_chan_is_touch() > > > >> helper' > > > >> * renamed at91_adc_buffer_postenable() -> at91_adc_buffer_preenable() > > > >> - at91_adc_buffer_postenable() - now just calls > > > >> iio_triggered_buffer_postenable() if the channel isn't the touchscreen > > > >> channel > > > >> * renamed at91_adc_buffer_predisable() -> at91_adc_buffer_postdisable() > > > >> - at91_adc_buffer_predisable() - now just calls > > > >> iio_triggered_buffer_predisable() if the channel isn't the touchscreen > > > >> channel > > > >> > > > >> drivers/iio/adc/at91-sama5d2_adc.c | 31 +++++++++++++++--------------- > > > >> 1 file changed, 15 insertions(+), 16 deletions(-) > > > >> > > > >> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c > > > >> index a5c7771227d5..f2a74c47c768 100644 > > > >> --- a/drivers/iio/adc/at91-sama5d2_adc.c > > > >> +++ b/drivers/iio/adc/at91-sama5d2_adc.c > > > >> @@ -873,18 +873,24 @@ static int at91_adc_dma_start(struct iio_dev *indio_dev) > > > >> return 0; > > > >> } > > > >> > > > >> +static bool at91_adc_current_chan_is_touch(struct iio_dev *indio_dev) > > > >> +{ > > > >> + struct at91_adc_state *st = iio_priv(indio_dev); > > > >> + > > > >> + return !!bitmap_subset(indio_dev->active_scan_mask, > > > >> + &st->touch_st.channels_bitmask, > > > >> + AT91_SAMA5D2_MAX_CHAN_IDX + 1); > > > >> +} > > > >> + > > > >> static int at91_adc_buffer_postenable(struct iio_dev *indio_dev) > > > >> { > > > >> int ret; > > > >> struct at91_adc_state *st = iio_priv(indio_dev); > > > >> > > > >> /* check if we are enabling triggered buffer or the touchscreen */ > > > >> - if (bitmap_subset(indio_dev->active_scan_mask, > > > >> - &st->touch_st.channels_bitmask, > > > >> - AT91_SAMA5D2_MAX_CHAN_IDX + 1)) { > > > >> - /* touchscreen enabling */ > > > >> + if (at91_adc_current_chan_is_touch(indio_dev)) > > > >> return at91_adc_configure_touch(st, true); > > > >> - } > > > >> + > > > >> /* if we are not in triggered mode, we cannot enable the buffer. */ > > > >> if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES)) > > > >> return -EINVAL; > > > >> @@ -906,12 +912,9 @@ static int at91_adc_buffer_predisable(struct iio_dev *indio_dev) > > > >> u8 bit; > > > >> > > > >> /* check if we are disabling triggered buffer or the touchscreen */ > > > >> - if (bitmap_subset(indio_dev->active_scan_mask, > > > >> - &st->touch_st.channels_bitmask, > > > >> - AT91_SAMA5D2_MAX_CHAN_IDX + 1)) { > > > >> - /* touchscreen disable */ > > > >> + if (at91_adc_current_chan_is_touch(indio_dev)) > > > >> return at91_adc_configure_touch(st, false); > > > >> - } > > > >> + > > > >> /* if we are not in triggered mode, nothing to do here */ > > > >> if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES)) > > > >> return -EINVAL; > > > >> @@ -1886,14 +1889,10 @@ static __maybe_unused int at91_adc_resume(struct device *dev) > > > >> return 0; > > > >> > > > >> /* check if we are enabling triggered buffer or the touchscreen */ > > > >> - if (bitmap_subset(indio_dev->active_scan_mask, > > > >> - &st->touch_st.channels_bitmask, > > > >> - AT91_SAMA5D2_MAX_CHAN_IDX + 1)) { > > > >> - /* touchscreen enabling */ > > > >> + if (at91_adc_current_chan_is_touch(indio_dev)) > > > >> return at91_adc_configure_touch(st, true); > > > >> - } else { > > > >> + else > > > >> return at91_adc_configure_trigger(st->trig, true); > > > >> - } > > > >> > > > >> /* not needed but more explicit */ > > > >> return 0; > > > > > > > >