Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp321388ybh; Wed, 11 Mar 2020 01:41:21 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv+pkv4OiO4NVtMwFkZTpOYuhaztClK33TPdm6I7LJRU84SVbZVipV8MtOtGBkwBmbL/mqq X-Received: by 2002:aca:5208:: with SMTP id g8mr1079359oib.169.1583916081464; Wed, 11 Mar 2020 01:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583916081; cv=none; d=google.com; s=arc-20160816; b=AcTalvMdEVhwjLvywudKexZjB7/ysYmpw/d3UxvJ5xBbvoGJvD1vPlfFUbOFErevfg Ziw0nphpDgeRZUzlRE3i+++k4WT3TaOYHJ1H8HYJRZvK6fgNb2IRrAGJvPpuHEChbKJv 6PkU6sIITOIgPYxYh0Q873O6b9rBnoFCw+1hsyQITxzD9TGdVS348GhoAPuH8ujMtzJo YxfSocd9cofrBfvHFGRMhTt1DFpq/RVBDZEXGhv/SYORRmSLMrpn6SfGBjbSnSWaP+YL YWV5wHMxlHh+9xo85tAMYZnkk9XQhixgr3zqI2UvBtNRSpcl5PzEsCkGf7ebspaIoH1D ryMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=VP0mUXXXtm4rYPS4Kh9OxWyAaGe1NfEoLA4hU1hXAwA=; b=a28Je7rWOiqTFPyscskGn4r/ku2LyQ6+/ws7g2dMy/QjHIzsr+2yLfr4x8V3TQJKW+ tFlnQDINK4NEWHRxOI5kLkinRUwszjWSDt9sYyhYnSjKktL9Xk0gv2CZUz6yQzyHpPPC 8BsdEenYKLLbK/AJLWw3HJeB90untoLH1uBkNBNCEIv0jAnivq3QMKCuCZrXIvOTVFN3 Cvg11Qbk3Kfv0gKkAov7zUrtTjT9GBL/Fh3oP/zwUvEZHjLJ/aM7Mx+hdSwgbOrtiaeQ VrF7z0kBxGLgAd5yC2qzRR8xMuik9+aJcnxr3w1Axy6zOxJIa4t6u1xWF0jYRqlkcU5J mNZw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si1180246ots.134.2020.03.11.01.41.09; Wed, 11 Mar 2020 01:41:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728653AbgCKIks (ORCPT + 99 others); Wed, 11 Mar 2020 04:40:48 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:32756 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726934AbgCKIks (ORCPT ); Wed, 11 Mar 2020 04:40:48 -0400 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02B8dgfO004402; Wed, 11 Mar 2020 04:40:40 -0400 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com with ESMTP id 2yp9x3bwfv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Mar 2020 04:40:40 -0400 Received: from ASHBMBX9.ad.analog.com (ashbmbx9.ad.analog.com [10.64.17.10]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 02B8edhk032271 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Wed, 11 Mar 2020 04:40:39 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Wed, 11 Mar 2020 04:40:38 -0400 Received: from zeus.spd.analog.com (10.64.82.11) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.1.1779.2 via Frontend Transport; Wed, 11 Mar 2020 04:40:38 -0400 Received: from ben-Latitude-E6540.ad.analog.com ([10.48.65.231]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 02B8eSGJ028151; Wed, 11 Mar 2020 04:40:35 -0400 From: Beniamin Bia To: CC: , , , , , , Dragos Bogdan , Beniamin Bia Subject: [PATCH 2/4] iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R Date: Wed, 11 Mar 2020 10:43:26 +0200 Message-ID: <20200311084328.17680-2-beniamin.bia@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200311084328.17680-1-beniamin.bia@analog.com> References: <20200311084328.17680-1-beniamin.bia@analog.com> MIME-Version: 1.0 Content-Type: text/plain X-ADIRoutedOnPrem: True X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-11_02:2020-03-10,2020-03-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=1 adultscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1011 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003110056 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dragos Bogdan When CONVST signal is generated internally, IIO_CHAN_INFO_RAW can be made available for AD7091R for single reads. This patch enables it and makes supporting more devices by this driver easier. Signed-off-by: Dragos Bogdan Signed-off-by: Beniamin Bia --- drivers/iio/adc/ad7476.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 32e857dfec9c..3b48073dd62d 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -29,6 +29,8 @@ struct ad7476_state; struct ad7476_chip_info { unsigned int int_vref_uv; struct iio_chan_spec channel[2]; + /* channels used when convst gpio is defined */ + struct iio_chan_spec convst_channel[2]; void (*reset)(struct ad7476_state *); }; @@ -109,6 +111,8 @@ static int ad7476_scan_direct(struct ad7476_state *st) { int ret; + ad7091_convst(st); + ret = spi_sync(st->spi, &st->msg); if (ret) return ret; @@ -176,6 +180,8 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, #define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits), \ BIT(IIO_CHAN_INFO_RAW)) #define AD7091R_CHAN(bits) _AD7476_CHAN((bits), 16 - (bits), 0) +#define AD7091R_CONVST_CHAN(bits) _AD7476_CHAN((bits), 16 - (bits), \ + BIT(IIO_CHAN_INFO_RAW)) #define ADS786X_CHAN(bits) _AD7476_CHAN((bits), 12 - (bits), \ BIT(IIO_CHAN_INFO_RAW)) @@ -183,6 +189,8 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { [ID_AD7091R] = { .channel[0] = AD7091R_CHAN(12), .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + .convst_channel[0] = AD7091R_CONVST_CHAN(12), + .convst_channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), .reset = ad7091_reset, }, [ID_AD7276] = { @@ -288,6 +296,9 @@ static int ad7476_probe(struct spi_device *spi) indio_dev->channels = st->chip_info->channel; indio_dev->num_channels = 2; indio_dev->info = &ad7476_info; + + if (st->convst_gpio && st->chip_info->convst_channel) + indio_dev->channels = st->chip_info->convst_channel; /* Setup default message */ st->xfer.rx_buf = &st->data; -- 2.17.1