Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1887489imu; Sat, 12 Jan 2019 09:52:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN4gOkf4RUNkd8jFayoDh4yZnqFbeE2zJAnLS93moxL35n5Nk188vQLOhsW6uQbmCcktttHh X-Received: by 2002:a63:ab08:: with SMTP id p8mr17192588pgf.87.1547315555586; Sat, 12 Jan 2019 09:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547315555; cv=none; d=google.com; s=arc-20160816; b=qfS0G1YL3TorejSrzbjQJp/qVrPg6c0Xyqlfb7umHNz2YSgPJ2PlW3TstsztpDnWgl MKZSyJjImLAfOxSaJxwWSyo91f8NAl+yNM2A/8B9z5QEm3321r4Uses19YOyzWcsgp68 HLc37eyzRpZ3otSNYon8IxJYB1PVjmafHRXoq/hOs8daM2g2RyJR1CG3BvGzo0htZD48 7nksRY7dydt4L2rzaLTY1iHMjGlxVK4uv3W/xqdECIYrmRI+YYXYgPzDt5ssZsboplLG srsQXa7wdbyST1Oxfml7uC2JrtJFMhONqliIizMvTsbP8P0Bs344J7lRELTLF31/tiKI 9q7w== 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=wpcbSVq8/PbhEHX6JlgG5YCjPeUSqCrMeEwvzHeIKNM=; b=IHKlpPOcq0tSD0X/r7cVYA5EhJuxuieGvaBodRM//UtXevm4l37kbkBnX/wZKYB5iq 0NGnynPzh3jCUkRdlb4IMR8DKa3S6dc24/Mh+8QBIjAERpSpeqlEYQsSFMKE+Sjdwlwu xoe9nqCS8+xVP49s+XCBdVOzzROCB23BMLoXiPns2NRsJhWkPcrkdCfJrPXOaISLMmnX MtMhLjtwkMK9lttVyoFLyIsFe67g3MKwMnsp2xSidObsJ48q6lQbRIcyI2BrB1ldn1Ii lMz5mAtiOGajaEkGO9/9UMWRjT64tGMlNNuF2ArsjKcotddbZiqeY9S6Ao97A0BFTQLs h1XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1PJCE0D6; 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 b5si3662826plr.355.2019.01.12.09.52.09; Sat, 12 Jan 2019 09:52:35 -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; dkim=pass header.i=@kernel.org header.s=default header.b=1PJCE0D6; 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 S1726478AbfALRC6 (ORCPT + 99 others); Sat, 12 Jan 2019 12:02:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:49092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726431AbfALRC6 (ORCPT ); Sat, 12 Jan 2019 12:02:58 -0500 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 EB9802084C; Sat, 12 Jan 2019 17:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547312577; bh=5/ODI8/PPQq1OJQJDtispd9AyGSlrSHuN0ar/3JzOLI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=1PJCE0D6N6jCmqtqUbZWBTAXZr6qg7EG52QS2cX5AS6vurHjOged0uTTOTKB7LvWX 9131bjqIXta0cBv2T/D80ol/YKAE0L8u9sSl4g9x6n5u5i+FvoCc299mIz4Kb591AQ lvm5maV0q3nnm1NefJ+LRDPg35AyrVAtGPOqAAWc= Date: Sat, 12 Jan 2019 17:02:52 +0000 From: Jonathan Cameron To: Jeremy Fertic Cc: Shreeya Patel , lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Staging: iio: adt7316: Add regmap support Message-ID: <20190112170252.56406302@archlinux> In-Reply-To: <20190105220413.GA3449@r2700x.localdomain> References: <20181223140224.10958-1-shreeya.patel23498@gmail.com> <20190105172037.7cc5006b@archlinux> <20190105220413.GA3449@r2700x.localdomain> 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 ... > > > diff --git a/drivers/staging/iio/addac/adt7316.h b/drivers/staging/iio/addac/adt7316.h > > > index fd7c5c92b599..2c72cf3f71cd 100644 > > > --- a/drivers/staging/iio/addac/adt7316.h > > > +++ b/drivers/staging/iio/addac/adt7316.h > > > @@ -11,16 +11,13 @@ > > > > > > #include > > > #include > > > +#include > > > > > > #define ADT7316_REG_MAX_ADDR 0x3F > > > > > > -struct adt7316_bus { > > > - void *client; > > > - int irq; > > > - int (*read)(void *client, u8 reg, u8 *data); > > > - int (*write)(void *client, u8 reg, u8 val); > > > - int (*multi_read)(void *client, u8 first_reg, u8 count, u8 *data); > > > - int (*multi_write)(void *client, u8 first_reg, u8 count, u8 *data); > > > +static const struct regmap_config adt7316_regmap_config = { > > > + .reg_bits = 8, > > > + .val_bits = 10, > > I wonder if val_bits should be 8. The driver can read and write 8, 10, > or 12 bit values. In the 10 and 12 bit cases, the driver currently > (including with this patch) does two separate reads or writes and expects > an 8 bit result from each. It then parses these two values to come up with > the 10 or 12 bit value. I don't think the logic for this calculation is > known to regmap, so with the current form of the patch, I think val_bits > should be 8. Maybe there is a better way to do it though? Good point. I would assume they should be 8 as well. > > I would have tested this but I couldn't get the patch to apply. Shreeya, > I think if you rebase against iio/testing that might take care of it. I > can then do some testing with v2. > Great. Jonathan > Jeremy