From patchwork Thu Jul 21 14:55:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 9241631 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 757A2602F0 for ; Thu, 21 Jul 2016 12:56:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67C8C27E71 for ; Thu, 21 Jul 2016 12:56:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BCF426242; Thu, 21 Jul 2016 12:56:46 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 C53F326242 for ; Thu, 21 Jul 2016 12:56:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752175AbcGUM4p (ORCPT ); Thu, 21 Jul 2016 08:56:45 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:43973 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752385AbcGUM4p (ORCPT ); Thu, 21 Jul 2016 08:56:45 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from vadimp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Jul 2016 15:56:37 +0300 Received: from r-mgtswh-226.mtr.labs.mlnx. (r-mgtswh-226.mtr.labs.mlnx [10.209.1.51]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id u6LCuYtP019564; Thu, 21 Jul 2016 15:56:34 +0300 From: Vadim Pasternak To: linux@roeck-us.net Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, jiri@resnulli.us, Vadim Pasternak Subject: [patch] Disable PMBus status check for DPS400 PSU controller Date: Thu, 21 Jul 2016 14:55:53 +0000 Message-Id: <1469112953-77032-1-git-send-email-vadimp@mellanox.com> X-Mailer: git-send-email 2.1.4 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 pmbus/dps400: disable PMBus status check through platform data structure to provide support for PSU DPS-460, DPS-800 from Delta Electronics, INC and for SGD009 from Acbel Polytech, INC. These devices do not support the STATUS_CML register, and reports communication error in response to this command. For this reason for these controllers, the status register check is disabled. Signed-off-by: Vadim Pasternak Reviewed-by: Jiri Pirko --- drivers/hwmon/pmbus/pmbus.c | 16 ++++++++++++++++ drivers/hwmon/pmbus/pmbus_core.c | 3 +++ 2 files changed, 19 insertions(+) diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c index 0a74991..44c736a 100644 --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "pmbus.h" /* @@ -167,14 +168,26 @@ static int pmbus_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct pmbus_driver_info *info; + struct pmbus_platform_data *pdata = NULL; + struct device *dev = &client->dev; info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), GFP_KERNEL); if (!info) return -ENOMEM; + if (!strcmp(id->name, "dps460") || !strcmp(id->name, "dps460") || + !strcmp(id->name, "sgd009")) { + pdata = kzalloc(sizeof(struct pmbus_platform_data), GFP_KERNEL); + if (!pdata) { + kfree(info); + return -ENOMEM; + } + pdata->flags = PMBUS_SKIP_STATUS_CHECK; + } info->pages = id->driver_data; info->identify = pmbus_identify; + dev->platform_data = pdata; return pmbus_do_probe(client, id, info); } @@ -199,6 +212,9 @@ static const struct i2c_device_id pmbus_id[] = { {"tps544c20", 1}, {"tps544c25", 1}, {"udt020", 1}, + {"dps460", 1}, + {"dps800", 1}, + {"sgd009", 1}, {} }; diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index ba59eae..3d98070 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1931,8 +1931,11 @@ EXPORT_SYMBOL_GPL(pmbus_do_probe); int pmbus_do_remove(struct i2c_client *client) { struct pmbus_data *data = i2c_get_clientdata(client); + const struct pmbus_platform_data *pdata = + dev_get_platdata(&client->dev); hwmon_device_unregister(data->hwmon_dev); kfree(data->group.attrs); + kfree(pdata); return 0; } EXPORT_SYMBOL_GPL(pmbus_do_remove);