Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp130287ybz; Wed, 15 Apr 2020 05:55:30 -0700 (PDT) X-Google-Smtp-Source: APiQypIQW6KqMRE50KbRk4IDcxGrPPrBpIvJj2W+gsq1PjNVXMFvtzs3cd2rV0ICiNWG1MWgSfth X-Received: by 2002:aa7:db41:: with SMTP id n1mr24267296edt.260.1586955330131; Wed, 15 Apr 2020 05:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586955330; cv=none; d=google.com; s=arc-20160816; b=hR0bb0OFgUDq934YefJnK/dEBcDldDqkdM9yYNLLs6vPOKyRE63GKfB13FMd6Lvzc2 dO3utZEwmuRP3zs+qqIOJuQtapjq+fUGhScvFLxocWzjcyVWR7ex7JH3Tsl0F4ALc1Bi +TbgZQCEzjQKo8HncNP8V5YuYcfjJv6r6MwjnR7h7T9PaP8l7tVB0CaqqvuSW8Cpna1V /8hm53727nD9zqos8INM2/qqjRLRdT3+4UQWT4SwPj0Z0wiXZ44kXN96enoEMzka7Pzf 6yd79AccoFdb/7PAU3vDGi6Nf6LP/tkbHQb2f3dHReF/bU8SyWf3Nee0i403EJUdkxRe RqjQ== 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=r2fZcD01nV5+TZVMWzroIp/j74cRhVUlHjSqroee99A=; b=O/kifBa6TTTqe4mAQeRdrv26kNcebjkLZy1KL9zSA3rljI+Go1sS58z2VZ4Mj3KBHu SYHR2o+/x3SVLN0m/wI9/S1ZTujmbXEo0pY4zRuNupvTPRBNpr0qtcttfIi48CcM3U+t JJSOqsnamGJJzb6tAKPIsiD3zoOgrqC125Utb7ir64bz8mWzzlTc1MDLFcNunpeHQx/D 8jdrPrJ+WmOpfLc+A68dOJUNN1ACQ/0cN0wS8Z2INLuzjEaIbcjaPZPN1dB8+u6XP6L1 bJ4BiOKf9ctdRGxrxFwHtlF/PhrIp6T5RmUq0PlslZ/YBat1wwXNeEXzd1jeK957wgtC rbSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VUzuT9SH; spf=pass (google.com: best guess record for 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 w14si10374232eje.134.2020.04.15.05.55.05; Wed, 15 Apr 2020 05:55:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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=@kernel.org header.s=default header.b=VUzuT9SH; spf=pass (google.com: best guess record for 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 S2502532AbgDNRpQ (ORCPT + 99 others); Tue, 14 Apr 2020 13:45:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:54806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502469AbgDNRpK (ORCPT ); Tue, 14 Apr 2020 13:45:10 -0400 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 B69EF2074D; Tue, 14 Apr 2020 17:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586886309; bh=HQZivI+jgvAXZc13IOSnTDiTMKed8JrYsILOdJruhKA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VUzuT9SHxvVtrMoQe4Nk0GLtzrLNuuSj8q32jR+DJzJns3eNtCCIZH7LU69ucekxW rS9yz3vRvhSAYOnZ73YTDlWQMy44WZm2zHO+PrARQRatyrzT/bto09rF9aaFpfZ+Cd MECMB3/YtM3ac8bmSzJMC4vAhf8Y7RO9qrlkoNhY= Date: Tue, 14 Apr 2020 18:45:05 +0100 From: Jonathan Cameron To: Cc: , , , Subject: Re: [PATCH v2 1/2] iio: at91-sama5d2_adc: split at91_adc_current_chan_is_touch() helper Message-ID: <20200414184505.0cd39249@archlinux> In-Reply-To: <9315e9a7-0703-b119-ca32-69f0c2fcc7de@microchip.com> References: <20200304084219.20810-1-alexandru.ardelean@analog.com> <20200413180556.20638f3b@archlinux> <9315e9a7-0703-b119-ca32-69f0c2fcc7de@microchip.com> X-Mailer: Claws Mail 3.17.5 (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 Tue, 14 Apr 2020 12:22:45 +0000 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 ? I haven't tried yet :) > 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. > > Meanwhile, the code looks good for me, > > Reviewed-by: Eugen Hristev > > By the way, I do not know if my two pending patches on this driver will > conflict or not. As this is a long term rework patch at heart, there isn't any particular rush as long as we don't loose it forever! Thanks, Jonathan > > 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; > > >