From patchwork Wed Jun 5 16:17:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 10977283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F9692D47 for ; Wed, 5 Jun 2019 16:30:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FD9120223 for ; Wed, 5 Jun 2019 16:30:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 343452881A; Wed, 5 Jun 2019 16:30:23 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 D185520223 for ; Wed, 5 Jun 2019 16:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728707AbfFEQaW (ORCPT ); Wed, 5 Jun 2019 12:30:22 -0400 Received: from sed198n136.SEDSystems.ca ([198.169.180.136]:25447 "EHLO sed198n136.sedsystems.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbfFEQaW (ORCPT ); Wed, 5 Jun 2019 12:30:22 -0400 X-Greylist: delayed 756 seconds by postgrey-1.27 at vger.kernel.org; Wed, 05 Jun 2019 12:30:21 EDT Received: from barney.sedsystems.ca (barney [198.169.180.121]) by sed198n136.sedsystems.ca with ESMTP id x55GHQSb002324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 5 Jun 2019 10:17:26 -0600 (CST) Received: from SED.RFC1918.192.168.sedsystems.ca (eng1n65.eng.sedsystems.ca [172.21.1.65]) by barney.sedsystems.ca (8.14.7/8.14.4) with ESMTP id x55GHOOd057650 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 5 Jun 2019 10:17:26 -0600 From: Robert Hancock To: linux-hwmon@vger.kernel.org Cc: linux@roeck-us.net, jdelvare@suse.com, Robert Hancock Subject: [PATCH 1/3] hwmon: (pmbus) Add paged support for VIN, IIN, PIN parameters Date: Wed, 5 Jun 2019 10:17:12 -0600 Message-Id: <1559751434-19879-2-git-send-email-hancock@sedsystems.ca> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1559751434-19879-1-git-send-email-hancock@sedsystems.ca> References: <1559751434-19879-1-git-send-email-hancock@sedsystems.ca> X-Scanned-By: MIMEDefang 2.64 on 198.169.180.136 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 Previously the VIN, IIN and PIN parameters were marked as non-paged, however on the IRPS5401 these parameters are present on multiple pages. Add the paged flag for these parameters so they can be detected properly on such chips. Signed-off-by: Robert Hancock --- drivers/hwmon/pmbus/pmbus_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index ef7ee90..6e3aaf1 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1395,6 +1395,7 @@ static int pmbus_add_sensor_attrs(struct i2c_client *client, .reg = PMBUS_READ_VIN, .class = PSC_VOLTAGE_IN, .label = "vin", + .paged = true, .func = PMBUS_HAVE_VIN, .sfunc = PMBUS_HAVE_STATUS_INPUT, .sbase = PB_STATUS_INPUT_BASE, @@ -1499,6 +1500,7 @@ static int pmbus_add_sensor_attrs(struct i2c_client *client, .reg = PMBUS_READ_IIN, .class = PSC_CURRENT_IN, .label = "iin", + .paged = true, .func = PMBUS_HAVE_IIN, .sfunc = PMBUS_HAVE_STATUS_INPUT, .sbase = PB_STATUS_INPUT_BASE, @@ -1584,6 +1586,7 @@ static int pmbus_add_sensor_attrs(struct i2c_client *client, .reg = PMBUS_READ_PIN, .class = PSC_POWER, .label = "pin", + .paged = true, .func = PMBUS_HAVE_PIN, .sfunc = PMBUS_HAVE_STATUS_INPUT, .sbase = PB_STATUS_INPUT_BASE, From patchwork Wed Jun 5 16:17:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 10977285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F030176 for ; Wed, 5 Jun 2019 16:30:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E32A220223 for ; Wed, 5 Jun 2019 16:30:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D797F287D2; Wed, 5 Jun 2019 16:30:23 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 72B8720223 for ; Wed, 5 Jun 2019 16:30:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728708AbfFEQaX (ORCPT ); Wed, 5 Jun 2019 12:30:23 -0400 Received: from sed198n136.SEDSystems.ca ([198.169.180.136]:25447 "EHLO sed198n136.sedsystems.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbfFEQaX (ORCPT ); Wed, 5 Jun 2019 12:30:23 -0400 X-Greylist: delayed 756 seconds by postgrey-1.27 at vger.kernel.org; Wed, 05 Jun 2019 12:30:21 EDT Received: from barney.sedsystems.ca (barney [198.169.180.121]) by sed198n136.sedsystems.ca with ESMTP id x55GHRvG024679 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 5 Jun 2019 10:17:27 -0600 (CST) Received: from SED.RFC1918.192.168.sedsystems.ca (eng1n65.eng.sedsystems.ca [172.21.1.65]) by barney.sedsystems.ca (8.14.7/8.14.4) with ESMTP id x55GHOOe057650 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 5 Jun 2019 10:17:26 -0600 From: Robert Hancock To: linux-hwmon@vger.kernel.org Cc: linux@roeck-us.net, jdelvare@suse.com, Robert Hancock Subject: [PATCH 2/3] hwmon: (pmbus) Add paged VIN, IIN, PIN, temp detection support Date: Wed, 5 Jun 2019 10:17:13 -0600 Message-Id: <1559751434-19879-3-git-send-email-hancock@sedsystems.ca> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1559751434-19879-1-git-send-email-hancock@sedsystems.ca> References: <1559751434-19879-1-git-send-email-hancock@sedsystems.ca> X-Scanned-By: MIMEDefang 2.64 on 198.169.180.136 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 Add support for detecting multi-paged VIN, IIN, PIN and temperature parameters to the generic detection code in pmbus_find_sensor_groups. Paged VIN, IIN and PIN parameters were just added to the pmbus core, and temperature parameters could already be paged but were not auto-detected as such. Signed-off-by: Robert Hancock --- drivers/hwmon/pmbus/pmbus.c | 46 ++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c index c0bc43d..970322f 100644 --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c @@ -29,17 +29,8 @@ static void pmbus_find_sensor_groups(struct i2c_client *client, int page; /* Sensors detected on page 0 only */ - if (pmbus_check_word_register(client, 0, PMBUS_READ_VIN)) - info->func[0] |= PMBUS_HAVE_VIN; if (pmbus_check_word_register(client, 0, PMBUS_READ_VCAP)) info->func[0] |= PMBUS_HAVE_VCAP; - if (pmbus_check_word_register(client, 0, PMBUS_READ_IIN)) - info->func[0] |= PMBUS_HAVE_IIN; - if (pmbus_check_word_register(client, 0, PMBUS_READ_PIN)) - info->func[0] |= PMBUS_HAVE_PIN; - if (info->func[0] - && pmbus_check_byte_register(client, 0, PMBUS_STATUS_INPUT)) - info->func[0] |= PMBUS_HAVE_STATUS_INPUT; if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_12) && pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_1)) { info->func[0] |= PMBUS_HAVE_FAN12; @@ -52,20 +43,19 @@ static void pmbus_find_sensor_groups(struct i2c_client *client, if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34)) info->func[0] |= PMBUS_HAVE_STATUS_FAN34; } - if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) - info->func[0] |= PMBUS_HAVE_TEMP; - if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2)) - info->func[0] |= PMBUS_HAVE_TEMP2; - if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3)) - info->func[0] |= PMBUS_HAVE_TEMP3; - if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 - | PMBUS_HAVE_TEMP3) - && pmbus_check_byte_register(client, 0, - PMBUS_STATUS_TEMPERATURE)) - info->func[0] |= PMBUS_HAVE_STATUS_TEMP; /* Sensors detected on all pages */ for (page = 0; page < info->pages; page++) { + if (pmbus_check_word_register(client, page, PMBUS_READ_VIN)) + info->func[page] |= PMBUS_HAVE_VIN; + if (pmbus_check_word_register(client, page, PMBUS_READ_IIN)) + info->func[page] |= PMBUS_HAVE_IIN; + if (pmbus_check_word_register(client, page, PMBUS_READ_PIN)) + info->func[page] |= PMBUS_HAVE_PIN; + if (info->func[page] & (PMBUS_HAVE_VIN | PMBUS_HAVE_IIN + | PMBUS_HAVE_PIN) && + pmbus_check_byte_register(client, page, PMBUS_STATUS_INPUT)) + info->func[page] |= PMBUS_HAVE_STATUS_INPUT; if (pmbus_check_word_register(client, page, PMBUS_READ_VOUT)) { info->func[page] |= PMBUS_HAVE_VOUT; if (pmbus_check_byte_register(client, page, @@ -74,12 +64,26 @@ static void pmbus_find_sensor_groups(struct i2c_client *client, } if (pmbus_check_word_register(client, page, PMBUS_READ_IOUT)) { info->func[page] |= PMBUS_HAVE_IOUT; - if (pmbus_check_byte_register(client, 0, + if (pmbus_check_byte_register(client, page, PMBUS_STATUS_IOUT)) info->func[page] |= PMBUS_HAVE_STATUS_IOUT; } if (pmbus_check_word_register(client, page, PMBUS_READ_POUT)) info->func[page] |= PMBUS_HAVE_POUT; + if (pmbus_check_word_register(client, page, + PMBUS_READ_TEMPERATURE_1)) + info->func[page] |= PMBUS_HAVE_TEMP; + if (pmbus_check_word_register(client, page, + PMBUS_READ_TEMPERATURE_2)) + info->func[page] |= PMBUS_HAVE_TEMP2; + if (pmbus_check_word_register(client, page, + PMBUS_READ_TEMPERATURE_3)) + info->func[page] |= PMBUS_HAVE_TEMP3; + if (info->func[page] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 + | PMBUS_HAVE_TEMP3) && + pmbus_check_byte_register(client, page, + PMBUS_STATUS_TEMPERATURE)) + info->func[page] |= PMBUS_HAVE_STATUS_TEMP; } } From patchwork Wed Jun 5 16:17:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 10977281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C3B2576 for ; Wed, 5 Jun 2019 16:30:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B422020223 for ; Wed, 5 Jun 2019 16:30:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A862D287DC; Wed, 5 Jun 2019 16:30:22 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 50AF028786 for ; Wed, 5 Jun 2019 16:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728702AbfFEQaW (ORCPT ); Wed, 5 Jun 2019 12:30:22 -0400 Received: from sed198n136.SEDSystems.ca ([198.169.180.136]:25447 "EHLO sed198n136.sedsystems.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbfFEQaW (ORCPT ); Wed, 5 Jun 2019 12:30:22 -0400 X-Greylist: delayed 756 seconds by postgrey-1.27 at vger.kernel.org; Wed, 05 Jun 2019 12:30:21 EDT Received: from barney.sedsystems.ca (barney [198.169.180.121]) by sed198n136.sedsystems.ca with ESMTP id x55GHZ4r019362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 5 Jun 2019 10:17:35 -0600 (CST) Received: from SED.RFC1918.192.168.sedsystems.ca (eng1n65.eng.sedsystems.ca [172.21.1.65]) by barney.sedsystems.ca (8.14.7/8.14.4) with ESMTP id x55GHOOf057650 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 5 Jun 2019 10:17:27 -0600 From: Robert Hancock To: linux-hwmon@vger.kernel.org Cc: linux@roeck-us.net, jdelvare@suse.com, Robert Hancock Subject: [PATCH 3/3] hwmon: (pmbus) add support for Infineon IRPS5401 Date: Wed, 5 Jun 2019 10:17:14 -0600 Message-Id: <1559751434-19879-4-git-send-email-hancock@sedsystems.ca> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1559751434-19879-1-git-send-email-hancock@sedsystems.ca> References: <1559751434-19879-1-git-send-email-hancock@sedsystems.ca> X-Scanned-By: MIMEDefang 2.64 on 198.169.180.136 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 Add detection support for the Infineon IRPS5401 PMIC. This chip has 5 pages corresponding to 4 switching outputs and one linear (LDO) output. Signed-off-by: Robert Hancock --- drivers/hwmon/pmbus/pmbus.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c index 970322f..158d61e 100644 --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c @@ -191,6 +191,10 @@ static int pmbus_probe(struct i2c_client *client, return pmbus_do_probe(client, id, info); } +static const struct pmbus_device_info pmbus_info_five = { + .pages = 5, + .flags = 0 +}; static const struct pmbus_device_info pmbus_info_one = { .pages = 1, .flags = 0 @@ -214,6 +218,7 @@ static int pmbus_probe(struct i2c_client *client, {"dps460", (kernel_ulong_t)&pmbus_info_one_skip}, {"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip}, {"dps800", (kernel_ulong_t)&pmbus_info_one_skip}, + {"irps5401", (kernel_ulong_t)&pmbus_info_five}, {"mdt040", (kernel_ulong_t)&pmbus_info_one}, {"ncp4200", (kernel_ulong_t)&pmbus_info_one}, {"ncp4208", (kernel_ulong_t)&pmbus_info_one},