From patchwork Mon Oct 17 08:08:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 9378691 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 9AD5D6075E for ; Mon, 17 Oct 2016 08:24:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E32828FDD for ; Mon, 17 Oct 2016 08:24:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82C1528FDF; Mon, 17 Oct 2016 08:24: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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 6762D28FDD for ; Mon, 17 Oct 2016 08:24:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758713AbcJQIYY (ORCPT ); Mon, 17 Oct 2016 04:24:24 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:33189 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757584AbcJQIYX (ORCPT ); Mon, 17 Oct 2016 04:24:23 -0400 Received: by mail-pa0-f65.google.com with SMTP id hh10so8984334pac.0 for ; Mon, 17 Oct 2016 01:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=TD4ImD3YmGcD4zym0YdEReLj5pU1wghfq4uS1ABAlRI=; b=ZzHKrnfJuyvjO6Wnq77FhdUdtB7jxhgCyPmNtxp9IBrVkmfPFNOrOJSjyvjlm4AAmB w/QFaeUqZsLS7Z1VYHzn8Ol0zq5+ZPQtHXmryaZvzoCNpb2WQPhxOVG7LTncFSl836C1 FfTAfxeUtwgzsV55wG8FJflA6KUc8m2Zv7x8JQ7WhLdrP7O+gynz8Jo0Zdd5hMCEqL+8 RqznU0Jdh5bl0sL0pCpqV3/LQ2bQXZCCCITbq2BgtVtOaeBZ+FGMsypXfdQmU2A9W7B8 XrO25ASSyxuHoBrSO1h2v9KdAyMfm4QBfBH9GXh5vvfxS9+pRa0k/BdZoRjpRrbZeTGS e6eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=TD4ImD3YmGcD4zym0YdEReLj5pU1wghfq4uS1ABAlRI=; b=bZjaJVz+msQ6RupngE2LLlBMl4sIzaGYb2/LEMkpEMpjBv89JpaFcIMkA+4mnuYbIH TLGMXDiHrT1IFTN9QDC3NwNkDtVsghkO8L7ahhRvpneGcrW+2NrKY0KJdKNcVGIAQsbs Cb6kf3aFL8l4hB5CfA9KSpDEw4TWSKBOrqrC1FoZo5ZLDAHj+ufux0fVhegI6LXm2ypX icPsJoQt+Z1H+wj5xgrUCgXr4gSTs+MEsGjOVYlSz5K8vsu2v9AM/SaVqPCF8kJlpAYu kDTxN2wfrV4N+Q2d55gUTnq9jksdWJ06tHryIZIC7l9XBi6FhBSY7HZL+Fjzcqh5Yosg lq/A== X-Gm-Message-State: AA6/9RkkRShvsU0w7ih8Y84T1WhhO+m+DWMOBRPAq3W1BC5S0pRZtrmuwV7n/A5zkhDIlw== X-Received: by 10.66.4.231 with SMTP id n7mr20593608pan.96.1476691775017; Mon, 17 Oct 2016 01:09:35 -0700 (PDT) Received: from aurora.jms.id.au ([2403:480:11:8000:3197:364c:400d:6421]) by smtp.gmail.com with ESMTPSA id f67sm45603537pfg.18.2016.10.17.01.09.30 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 17 Oct 2016 01:09:34 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 17 Oct 2016 18:39:25 +1030 From: Joel Stanley To: linux@roeck-us.net, jdelvare@suse.com Cc: Yi Li , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] hwmon: (adm1275) Enable adm1278 VOUT sampling Date: Mon, 17 Oct 2016 18:38:53 +1030 Message-Id: <20161017080853.7627-1-joel@jms.id.au> X-Mailer: git-send-email 2.9.3 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 From: Yi Li The adm1278 can optionally monitor the VOUT pin. This functioanltiy is not enabled at reset, so PMON_CONFIG needs to be modified in order to enable it. Signed-off-by: Yi Li Signed-off-by: Joel Stanley --- v2: Return an error when unable to enable VOUT monitoring as suggestd by Guenter drivers/hwmon/pmbus/adm1275.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c index 3baa4f4a8c5e..9940849351a1 100644 --- a/drivers/hwmon/pmbus/adm1275.c +++ b/drivers/hwmon/pmbus/adm1275.c @@ -499,15 +499,27 @@ static int adm1275_probe(struct i2c_client *client, pindex = 2; tindex = 3; - info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT; + info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT | + PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT; + + /* By default when reset VOUT is not enabled */ + if (!(config & ADM1278_VOUT_EN)) { + config |= ADM1278_VOUT_EN; + ret = i2c_smbus_write_byte_data(client, + ADM1275_PMON_CONFIG, + config); + if (ret < 0) { + dev_err(&client->dev, + "Failed to enable VOUT monitoring\n"); + return -ENODEV; + } + } + if (config & ADM1278_TEMP1_EN) info->func[0] |= PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; if (config & ADM1278_VIN_EN) info->func[0] |= PMBUS_HAVE_VIN; - if (config & ADM1278_VOUT_EN) - info->func[0] |= - PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT; break; case adm1293: case adm1294: