From patchwork Fri Apr 21 19:08:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 9693567 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 782A56038D for ; Fri, 21 Apr 2017 19:08:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B73726785 for ; Fri, 21 Apr 2017 19:08:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6021526E4E; Fri, 21 Apr 2017 19:08:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 186EF26785 for ; Fri, 21 Apr 2017 19:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424542AbdDUTIY (ORCPT ); Fri, 21 Apr 2017 15:08:24 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:49324 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424477AbdDUTIX (ORCPT ); Fri, 21 Apr 2017 15:08:23 -0400 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id DBD228446E; Sat, 22 Apr 2017 07:08:20 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1492801700; bh=ybMHU0DcIjUWfPoZx3RqBbd+zKZ+RqYWAO8GvCQxJXU=; h=From:To:Cc:Subject:Date; b=ucubRr1WII+UxSCONaJQt4Hj/UXlTztNyH7kMLiovXnx0+z1c2Cd8Pk5wxqyi15XA ZLZ3bPSG3/fBd2dVJ/fuBykLV4+sTL2rVaTRaNVhPgkRsfJaTm/s26Ou/E2lg2I+8B RK0Ig+M5+ECNPtcx/Vp/WZHoU2RRznrFh1wM2Iqw= Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 7, 9061) id ; Sat, 22 Apr 2017 07:08:17 +1200 Received: from chrisp-dl.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by smtp (Postfix) with ESMTP id 4F2DD13EEDE; Sat, 22 Apr 2017 07:08:15 +1200 (NZST) Received: by chrisp-dl.atlnz.lc (Postfix, from userid 1030) id 5BAF71E1DDA; Sat, 22 Apr 2017 07:08:14 +1200 (NZST) From: Chris Packham To: linux@roeck-us.net, linux-hwmon@vger.kernel.org Cc: Chris Packham , Jean Delvare , linux-kernel@vger.kernel.org Subject: [PATCH] hwmon: (adt7475) set start bit in probe Date: Sat, 22 Apr 2017 07:08:09 +1200 Message-Id: <20170421190810.30628-1-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.11.0.24.ge6920cf Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ADT7475 and ADT7476 have the STRT bit cleared by default[1]. Before any monitoring activities the STRT bit needs to be set. Logically this needs to happen before any of the sensors are read so the probe() function seems the best place for it. [1] - https://www.onsemi.com/pub/Collateral/ADT7475-D.PDF Signed-off-by: Chris Packham --- drivers/hwmon/adt7475.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index fcfa48222145..c803e3c5fcd4 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -59,6 +59,8 @@ #define REG_VENDID 0x3E #define REG_DEVID2 0x3F +#define REG_CONFIG1 0x40 + #define REG_STATUS1 0x41 #define REG_STATUS2 0x42 @@ -1371,6 +1373,17 @@ static int adt7475_probe(struct i2c_client *client, for (i = 0; i < ADT7475_PWM_COUNT; i++) adt7475_read_pwm(client, i); + /* Start monitoring */ + switch (chip) { + case adt7475: + case adt7476: + i2c_smbus_write_byte_data(client, REG_CONFIG1, + adt7475_read(REG_CONFIG1) | 0x01); + break; + default: + break; + } + ret = sysfs_create_group(&client->dev.kobj, &adt7475_attr_group); if (ret) return ret;