Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1628246ybv; Thu, 6 Feb 2020 07:11:46 -0800 (PST) X-Google-Smtp-Source: APXvYqz9ecu+xAoDCIMHilTKDDTKi2aN6VXrOMgMm8kHnrwnkvJBoumE8kd2IdouhoLvJc0tfuHR X-Received: by 2002:a05:6808:50:: with SMTP id v16mr6906560oic.133.1581001906024; Thu, 06 Feb 2020 07:11:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581001906; cv=none; d=google.com; s=arc-20160816; b=aQxhLq8yTN81rbwFIJS6YViCestkD8UCOFzO+eQec45Ca0jFXeGAP690YA24HSxPM5 fWNeTGGwc+bxqeo5zZoOy+wwiwy+X2nOt1kEZWM+Hyh45fSB2ulBSg3xoBPzjPjllgny yESDsAMNY7RkbZv/JuUXT82LuTiJ3VCglagwuH/MsODE7TUZsoOR6dR2Kk9rwYGC42nU Dyk098wF/BeuewF1ryoCGobrbZ42M6hmfQ+BYuIqlBEQKECLnSwLPR2R7kYg0ELW4C32 p2Ryq2LvNwvbbarivi2j7Zr3fsJPglql9vLl8nWa6T4KRszyGEJGTiZTWoyrObYFDPOC 1Q4w== 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=xlumT45WER0BuBn36On++BVxjmgXC/cw+TuGbrICrmw=; b=hZfZ2d6tTMTqjHm+apj9lXCI6BP9u7WqbAemlK7WYMwjXJPGBZukFYbSGUNBkGuz3j CuR+HNU7UrMtDijY3TuDJmuZr25LBk3m+Me2Qbn2NiB2nhuByfRy8srEkerPYhjVNWBY /+bAEFq3jHnP4ptNQMcNwIc1L63W6Kmms0bTT4Y36UWtbeO63M5t+4AoZ99Rp0Rloc10 Ven/qKkYZZClz+a7Mosh3B1wn6pzAPUbR1CX6rHavPxOiWnJQG23eMt0NPshyr9iKxvu YW4Y5E3PdyvV7yv7VmBNnxQUG0NeHwTSSf8aUx7tJJRpsPIie0ynpwsowc5avhP6qd8u kcxw== 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 t3si2118772oth.247.2020.02.06.07.11.32; Thu, 06 Feb 2020 07:11:46 -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; 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 S1727594AbgBFPKH (ORCPT + 99 others); Thu, 6 Feb 2020 10:10:07 -0500 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:21762 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727579AbgBFPKE (ORCPT ); Thu, 6 Feb 2020 10:10:04 -0500 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 016F0MvK011983; Thu, 6 Feb 2020 10:09:43 -0500 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com with ESMTP id 2xyhm94w18-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Feb 2020 10:09:43 -0500 Received: from SCSQMBX11.ad.analog.com (scsqmbx11.ad.analog.com [10.77.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 016F9f25017984 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Thu, 6 Feb 2020 10:09:42 -0500 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by SCSQMBX11.ad.analog.com (10.77.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Thu, 6 Feb 2020 07:09:40 -0800 Received: from zeus.spd.analog.com (10.64.82.11) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.1.1779.2 via Frontend Transport; Thu, 6 Feb 2020 10:09:40 -0500 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 016F9VRX021605; Thu, 6 Feb 2020 10:09:36 -0500 From: Beniamin Bia To: CC: , , , , , , , , , , Beniamin Bia Subject: [PATCH v5 2/5] iio: amplifiers: ad8366: Add write_raw_get_fmt function Date: Thu, 6 Feb 2020 17:11:46 +0200 Message-ID: <20200206151149.32122-2-beniamin.bia@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200206151149.32122-1-beniamin.bia@analog.com> References: <20200206151149.32122-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-02-06_01:2020-02-06,2020-02-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 phishscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 suspectscore=1 bulkscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=892 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002060114 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch add write_raw_get_fmt function to specify conversion for hardware gain. Signed-off-by: Beniamin Bia --- Changes in v5: -nothing changed drivers/iio/amplifiers/ad8366.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c index 0176d3d8cc9c..95972ab60f42 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -180,9 +180,22 @@ static int ad8366_write_raw(struct iio_dev *indio_dev, return ret; } +static int ad8366_write_raw_get_fmt(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + long mask) +{ + switch (mask) { + case IIO_CHAN_INFO_HARDWAREGAIN: + return IIO_VAL_INT_PLUS_MICRO_DB; + default: + return -EINVAL; + } +} + static const struct iio_info ad8366_info = { .read_raw = &ad8366_read_raw, .write_raw = &ad8366_write_raw, + .write_raw_get_fmt = &ad8366_write_raw_get_fmt, }; #define AD8366_CHAN(_channel) { \ -- 2.17.1