Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3051838yba; Sat, 18 May 2019 08:21:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjTB8f9kb8b3UGu2JiqOhay++28n8jUhJJzh6BMKiHxut+o4Rsm18exwuEEltnoCkJdISF X-Received: by 2002:a17:902:a407:: with SMTP id p7mr29691037plq.41.1558192892657; Sat, 18 May 2019 08:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558192892; cv=none; d=google.com; s=arc-20160816; b=S+H1PiqiCI6hGrsmHBSEn/6fdsEFVKKZMxLNsgAvQjw9GpATzIW6DQFS0Fw79D79/I KcPeA/6MYXBye1jdOMMZQoXIzJto2oM1YpyNh67ZTuzvDKQ7CCx3j43mIw1vVmR4jUVn l2MOITj6+7EsENjCQhUATSAYVQwTYZGDpA4iABuyUjZSKnpTzhF+nBoRSIGCV6TgWbff O9YbVU6kGIJPKgDcrNsn2p7366TY7FFYjUH6CVgHsMIe1zGkKur4bkMhvUsFpilj9dqy bD8SkjTorayxDLfaQvGtWMkp64RvTIGWiPeyHA5CPO4LchnfEuAgLQiP9XRQiHFWaLho Kvgw== 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=6u3X6JEeYv8n9VOFbLs2WV/Yh9CTZ0Z5vGJLFEl2QPE=; b=Peuk3g4Djb1FDvaUQn8pCxo8gSCnaMU+eq5uAGvXEbQAgkJjFxPADc6r5YEQxA6/ol HbDUoP4YYf76erY7qikNxsiqi2NSZYpPw0xqXI15XiyJDOmRXtNSt0xXAuDUb/GqvZKU 2XLLrmoQDO4piH0OTUY2+xgNwSqwV5H633f7NBidZImfaq7NOmMgQa4wr4PhkckAUgCd buBRmP22NVPmip8gT363fs5R0Opx9gSCXQiTf7PXmDBArYK8q6EHZAYokaNUDx4z2El1 EcaMtfTgqx2G3bj/faGSAupCtF3515pfeLcNHcW3fsWs0iOQlhP0mHEkZmFeB7Tye5Cv IJuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oXbas6dl; 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 v71si11608233pgd.552.2019.05.18.08.21.17; Sat, 18 May 2019 08:21:32 -0700 (PDT) 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=oXbas6dl; 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 S1729527AbfERKYo (ORCPT + 99 others); Sat, 18 May 2019 06:24:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:40152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729489AbfERKYo (ORCPT ); Sat, 18 May 2019 06:24:44 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (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 3054D2087E; Sat, 18 May 2019 10:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558175083; bh=ibvW7SwyQ3CtG0/rGvBYo/iCT1Uk227T0d/UHdaBThQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oXbas6dlXC+mwnFsb8eD64SpoU/zr0mteOpjUPoZJs2BnIldcs30PSe+KBUpm3gTp jsmYkIE8pBR8SMQAG+O1Y59CNL0hp0pv8piqJthfoN0R4aPbnRT4BCAA15CqPdZhbc gHs/UeC7QMEbBTAfZlVFDIn3DNjUX9m2XjK+XUQo= Date: Sat, 18 May 2019 11:24:37 +0100 From: Jonathan Cameron To: Beniamin Bia Cc: , , , , , , , , , , , Subject: Re: [PATCH 5/5] iio: adc: ad7606: Add debug mode for ad7616 Message-ID: <20190518112437.0ec3d0e8@archlinux> In-Reply-To: <20190516143208.19294-5-beniamin.bia@analog.com> References: <20190516143208.19294-1-beniamin.bia@analog.com> <20190516143208.19294-5-beniamin.bia@analog.com> X-Mailer: Claws Mail 3.17.3 (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 Thu, 16 May 2019 17:32:08 +0300 Beniamin Bia wrote: > Support for register access was added for spi devices. > > Signed-off-by: Beniamin Bia Looks fine. For my reference please add Acked-by: Jonathan Cameron > --- > drivers/iio/adc/ad7606.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c > index f77df3efe43f..b03bdce4fd4e 100644 > --- a/drivers/iio/adc/ad7606.c > +++ b/drivers/iio/adc/ad7606.c > @@ -134,6 +134,30 @@ static int ad7606_spi_write_mask(struct ad7606_state *st, > return ad7606_spi_reg_write(st, addr, readval); > } > > +static int ad7606_reg_access(struct iio_dev *indio_dev, > + unsigned int reg, > + unsigned int writeval, > + unsigned int *readval) > +{ > + struct ad7606_state *st = iio_priv(indio_dev); > + int ret; > + > + mutex_lock(&st->lock); > + if (readval) { > + ret = ad7606_spi_reg_read(st, reg); > + if (ret < 0) > + goto err_unlock; > + *readval = ret; > + ret = 0; > + } else { > + ret = ad7606_spi_reg_write(st, reg, writeval); > + } > +err_unlock: > + mutex_unlock(&st->lock); > + > + return ret; > +} > + > static int ad7606_read_samples(struct ad7606_state *st) > { > unsigned int num = st->chip_info->num_channels; > @@ -645,6 +669,7 @@ static const struct iio_info ad7606_info_no_os_or_range = { > static const struct iio_info ad7606_info_os_and_range = { > .read_raw = &ad7606_read_raw, > .write_raw = &ad7606_write_raw, > + .debugfs_reg_access = &ad7606_reg_access, > .attrs = &ad7606_attribute_group_os_and_range, > .validate_trigger = &ad7606_validate_trigger, > };