Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp42697ybz; Tue, 21 Apr 2020 14:51:46 -0700 (PDT) X-Google-Smtp-Source: APiQypJTc5UYSOHyorRn8cySwhekvYvlw0J/IfrsoN6Uf+weweTOCVJiM0VZQa3T4U8psA/XoBTr X-Received: by 2002:a17:907:9484:: with SMTP id dm4mr23726760ejc.240.1587505906002; Tue, 21 Apr 2020 14:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587505905; cv=none; d=google.com; s=arc-20160816; b=CZRASKNE2ADugUtT7rRSABU+MB9N4gxlO8jZgJ0V/2NCNP6yvT94xZAR436e0jyJCH 7qdWsSTUaN3MeCBGg7jZyIMOXXGS6yxTKIHJMUiCt4FlDmRH4aqu10ewzuCBzX47uh/J aC+cpxt7tCCi0bld0An9GYaK9UerJUgFrfZDgUI0m9TqEbbYPDGHnoCO7Gz3a3a98oAp 1B+UosWe0pNcsHu5u9E9AkjJ9GDCoNKiQhpnzN49b1YIF+vj6H8LOtvj9hBHYmu7kuHd y/7RQ69uDQk2esihP1j7eJ6UGKehhOmt/uxJ8AvXrgVlsAAPrr8KrAhnGfzppZ5Lxr5n 1sCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2yzyRCRM1JTzGVNdEOj/hvqYfw/tAgv8E0JZ5mXdHgU=; b=WxAbFviB9vj9+yxqnFfb/G5dIhzC/3ad14WNKxWGd8zOJkva1NwfaxrgeRu+rfsPSX XqLBkWzk9d3GpdQRkXKPKWkIxDvoeo7gSJxnld7umiJLwJZm+2jpZj4xTw7DnJ215nzA 3xa14rMZ1aeT9xyOO7rw3iGhV0YsFY6yTOQuR49kGyxNpCSAd6aAPsy6z+NyDQH2jpzR p63ugtixSm5DVI9+OkkWjA9yz2p1nz+rfoPeSxdjsabHYF0yulWPoGaLLa7aR8DT5CnF 8GyqwRl/rMXtLQ9oxh4niUrAJbw3bWMuz+YRv2iHxM7dr3l1urqL+XJIa7l7JYyiOSOC 9MzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U8SD7483; spf=pass (google.com: 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oz15si2413480ejb.24.2020.04.21.14.51.23; Tue, 21 Apr 2020 14:51:45 -0700 (PDT) Received-SPF: pass (google.com: 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=@gmail.com header.s=20161025 header.b=U8SD7483; spf=pass (google.com: 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726321AbgDUVtZ (ORCPT + 99 others); Tue, 21 Apr 2020 17:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726116AbgDUVtX (ORCPT ); Tue, 21 Apr 2020 17:49:23 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB0C0C0610D5; Tue, 21 Apr 2020 14:49:21 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id j26so383337ots.0; Tue, 21 Apr 2020 14:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2yzyRCRM1JTzGVNdEOj/hvqYfw/tAgv8E0JZ5mXdHgU=; b=U8SD7483h8M7WoucT/ZyR05SFeL89407PaSNinyNDuXq1J4Xkkl8gxgvTWcN/BoVsn psfRsAQmoy+JCRIrqX39ef7GaTIzKSTemyfkNbIjTJG2m2llqbL07cDnhJlKQF2i258G HDuE8EGsvjn4QT5k6lXKY1Prg6CxUfPUc75f3PlY+MwqVwowV+QyCkiB4XxbRRnZ06lc C1ha6CpYk3qryaHDBQDBVxcxSHcKTcws+wqMqHSkV5zJXkJRqHsEOrWU0G7WiE980pwu NJxyThDRiz8DGl1PhBYDgRzPc5+FI8WoglvfwX/c+R4GIHjbiALhFlJydi4aoO1KcUHe kGEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2yzyRCRM1JTzGVNdEOj/hvqYfw/tAgv8E0JZ5mXdHgU=; b=Au+A/RqL7xWzKn1TW6pWa4uy47c/QDVpEYTJziu+wMnz/3OcqVmRhEHgU1qoi3txrn zMHBnfNsrhYO7HJrLmJm7FhjR696em7jbv+Sd70RHq0FTSdvvsHkEdKgNssQodtl996p BqasJb929MZMJMCOREA4j8vKYc5FhyhCLVfPMCBcPJPaDbirROlZo/3eIP5sBfcQCTzg TFNk3a5j8V2MgcE7OrTCaSrFjR9uZJiW+MJuGpzrxhVIA0iMAZTjQucjNRNWwYgvMwzh A6vYI1UFgc76+AVHYuYk/Tj1Y8OI5ewuX5yNoN2DrBEux7H5JsxrzdJVHycf2oQJFf3T zcgw== X-Gm-Message-State: AGi0Pua2gDuRhV010Zu5xQc6aDxYOwyrA8IWZqHykUa7TQ9UoPBSJ/xD GBPpptiyMWmgoAlu+dLzhy+bZmAfTFE= X-Received: by 2002:a9d:19e8:: with SMTP id k95mr14761361otk.132.1587505760915; Tue, 21 Apr 2020 14:49:20 -0700 (PDT) Received: from raspberrypi (99-189-78-97.lightspeed.austtx.sbcglobal.net. [99.189.78.97]) by smtp.gmail.com with ESMTPSA id e92sm1045115otb.61.2020.04.21.14.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 14:49:20 -0700 (PDT) Date: Tue, 21 Apr 2020 16:49:17 -0500 From: Grant Peltier To: Guenter Roeck Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, adam.vaughn.xh@renesas.com, grant.peltier.jg@renesas.com Subject: Re: [PATCH 1/2] hwmon: (pmbus/isl68137) add debugfs config and black box endpoints Message-ID: <20200421214917.GA28170@raspberrypi> References: <203a7cd37dd95a0127cc06de14986721ab621e93.1587408025.git.grantpeltier93@gmail.com> <20200421185851.GA95204@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200421185851.GA95204@roeck-us.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 21, 2020 at 11:58:51AM -0700, Guenter Roeck wrote: > Normally this is emulated for such controllers. I don't recall seeing > such a need before. The code below duplicates similar code in > i2c_smbus_xfer_emulated(), which is much more sophisticated. > Are you sure this is needed ? Can you point me to an affected > controller ? > > > +static s32 raa_smbus_read40(const struct i2c_client *client, u8 command, > > + unsigned char *data) > > +{ > > + int status; > > + unsigned char msgbuf[1]; > > + struct i2c_msg msg[2] = { > > + { > > + .addr = client->addr, > > + .flags = client->flags, > > + .len = 1, > > + .buf = msgbuf, > > + }, > > + { > > + .addr = client->addr, > > + .flags = client->flags | I2C_M_RD, > > + .len = 5, > > + .buf = data, > > + }, > > + }; > > + > > + msgbuf[0] = command; > > + status = i2c_transfer(client->adapter, msg, 2); > > + if (status != 2) > > + return status; > > i2c_transfer() can return 1 if only one of the two messages was sent. > > > + return 0; > > +} I have been using BCM2835 for most of my testing. I originally tried using i2c_smbus_read_block_data() but that was returning errors. However, from your email, I went back and tried i2c_smbus_read_i2c_block_data() and that appears to be working so I will switch to that instead. > > + > > +/** > > + * Helper function required since linux SMBus implementation does not currently > > + * (v5.6) support the SMBus 3.0 "Read 32" protocol > > + */ > > +static s32 raa_dmpvr2_smbus_read32(const struct i2c_client *client, u8 command, > > + unsigned char *data) > > +{ > > + int status; > > + unsigned char msgbuf[1]; > > + struct i2c_msg msg[2] = { > > + { > > + .addr = client->addr, > > + .flags = client->flags, > > + .len = 1, > > + .buf = msgbuf, > > + }, > > + { > > + .addr = client->addr, > > + .flags = client->flags | I2C_M_RD, > > + .len = 4, > > + .buf = data, > > + }, > > + }; > > + > > + msgbuf[0] = command; > > + status = i2c_transfer(client->adapter, msg, 2); > > + if (status != 2) > > + return status; > > + return 0; > > +} > > Maybe it would be worthwhile to consider implementing it ? > I could add these functions to i2c-core-smbus instead if that is desired. However, I am unsure if it would be proper to only partially update the SMBus implementation to match the 3.0 spec. Is there perhaps a better forum to discuss adding all of the 3.0 changes?