From patchwork Tue Nov 22 13:50:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 24386 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2209035wrr; Tue, 22 Nov 2022 05:50:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4BmdJbofYrNpXbix75LFUIXbc21Xjdn2x09GXdyV4WwL27/8/YSIyz4vTNCpVMviZ/7c88 X-Received: by 2002:a17:903:22c4:b0:171:5092:4d12 with SMTP id y4-20020a17090322c400b0017150924d12mr4388471plg.107.1669125056096; Tue, 22 Nov 2022 05:50:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669125056; cv=none; d=google.com; s=arc-20160816; b=pfIFZS/Q5uBFE1HZDeAsqsNJkRdNufu5iOn0Y347K6X+uOqGt3usZsuTXXiSM424TG DWZGg3RZdO5LTMdUY6aL2YiTKoYkdfZRylgb+PMjLLwhNj8pA4UrxA4XnrJtHOmtZpMp +itXDzzjZ6IgHGsZ1kAquFL/JLVnyr+oPezLDqXDm3K4if+sHm4LVlF+7oEOWeU9bERV XoBgtNzUlfAWBxD5XXiT9hb8FLGoMX4gPoeHL88LxGHjersBdFF6I+ULRiyIpXUtKQe8 Mqrd7eEpTYaaGWDfwtjmgp/3fAOwAzGlxNgWSmobS4YeWQ3LS1V6U1o3/NL8SeyWuYfY 8veQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=EdIBdMp3AF8wTlK3ZbNuetiQCTdvpib+4RwLHSff3bA=; b=XvU8Hx+vDl76BDB7wtSRFxFQd/JkbPIsQg7ppNu2myznlYP9PSeJG0P2lfw+8lhBtD /ZOkHjCZ1v5xncuyZrkKhF6UwZFQiwleAJL8xkWTdeDzKATrgxXnaruIl0TeSxUH5GhC +p4Aa0lDI5YmJs8eKN2OVGlCSwFPoKTz0bP+V7suwM2DvuB6vpmHBEy7wqZxwkH6RS9b 4S7tZxlVvp3vVLB5I4o50cn2u2IHLA7jZ8Yccf1d0EvCjF5W+mBnFLOIDmUxn5iWkxJI 2D82xIEWDhqYlhEK5mRpo9Z05+kQZ+jXnzlu02SNuB9msLmvvygRgLqzTGXyzyF8CmMf GtRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b="GN/GT8YI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a17090301cc00b001781cf050b6si15856301plh.14.2022.11.22.05.50.34; Tue, 22 Nov 2022 05:50:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b="GN/GT8YI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233888AbiKVNuX (ORCPT + 99 others); Tue, 22 Nov 2022 08:50:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233877AbiKVNuW (ORCPT ); Tue, 22 Nov 2022 08:50:22 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ABED58BCB for ; Tue, 22 Nov 2022 05:50:21 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id d1so12687021wrs.12 for ; Tue, 22 Nov 2022 05:50:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=EdIBdMp3AF8wTlK3ZbNuetiQCTdvpib+4RwLHSff3bA=; b=GN/GT8YILFMtDw5idbTOaq2XJbwgf6oXfIo2soaWOry1aPf21P6EDi9ZwKuq37Md8q fXZWjBqFPGIoHQCgLx3D6g7uvZgBsyAwPqaA8EcegQe0selfqywQK3anBFfTIrIXSjPn phay0RKVim38t/PhkOC4FTtp1FjHen6wo3/0XchM3teFVKRmyjsaWIBxRIcfN2ZuhWFK Q8S0ydBjRYfO/XogKok8ci/5BKfcIJOgyL195jvEsbMkUrUoPDhTfGDf4l8TH5lxszTK wo063b0zsp1+rZVB3G8B/E8ORIua4lonZHpMASho2r2SfwMDFwfFtEcbkDkEwTjrMsaG 9NGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EdIBdMp3AF8wTlK3ZbNuetiQCTdvpib+4RwLHSff3bA=; b=eyjQoXog7NDljIMJPD+9cu9QWxH5luDV6Kje+owfB3EGj5RA2v8CNscvWdU9kdVq4U ub5pEOBhstdQh0QLNxBptr+hhkztwiU0HrHTaA8878B8Rgc/jyr8SVd32RDGu/EOyHPd NyiV1OM7DbxejhzAnLOUW4C1etpiNUXW6W+sWJV3RKsOoJh7PE1dfiDfYOLK40/INiH1 7/Q/QoxQoBBe62p/7BqTrdWXwGaMhg6IhNUz8udifMWDU/z83EFM/eFQ0XA4g4RKbo2/ 6VqWa8wq/sEypsD3t2/gIJQkySQKAOXaNyfrQgvrqAkHtGqElfat4vDgiatKIhNAHpvY kiIg== X-Gm-Message-State: ANoB5pn96fH84Fnor1CVY0Gb4/9kJ1HdfLbMVxMM5L5vYfBANXU03/1k 6AZMhP5zARxpugdg8XQllIeOyw== X-Received: by 2002:a05:6000:12c3:b0:236:8130:56e7 with SMTP id l3-20020a05600012c300b00236813056e7mr13930808wrx.309.1669125019603; Tue, 22 Nov 2022 05:50:19 -0800 (PST) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id n17-20020a05600c465100b003cf483ee8e0sm19947254wmo.24.2022.11.22.05.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 05:50:19 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare Cc: broonie@kernel.org, Naresh Solanki , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] hwmon: (pmbus/core): Update regulator flag map Date: Tue, 22 Nov 2022 14:50:11 +0100 Message-Id: <20221122135014.3504094-1-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750196602412194045?= X-GMAIL-MSGID: =?utf-8?q?1750204474727661015?= Add regulator flag map for PMBUS status byte & status input. Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus_core.c | 52 +++++++++++++++++--------------- 1 file changed, 28 insertions(+), 24 deletions(-) base-commit: 2c71b3246ec3246522e8cb7c8191dc7a5d62cc70 diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 20ca26e19db7..08f96e2b4837 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -2756,26 +2756,47 @@ static const struct pmbus_regulator_status_category pmbus_regulator_flag_map[] = .reg = PMBUS_STATUS_VOUT, .bits = (const struct pmbus_regulator_status_assoc[]) { { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN }, - { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE }, + { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE }, { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN }, - { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_REGULATION_OUT }, + { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_REGULATION_OUT }, { }, }, }, { .func = PMBUS_HAVE_STATUS_IOUT, .reg = PMBUS_STATUS_IOUT, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_IOUT_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN }, - { PB_IOUT_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT }, - { PB_IOUT_OC_LV_FAULT, REGULATOR_ERROR_OVER_CURRENT }, + { PB_IOUT_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN }, + { PB_IOUT_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT }, + { PB_IOUT_OC_LV_FAULT, REGULATOR_ERROR_OVER_CURRENT }, + { PB_POUT_OP_FAULT, REGULATOR_ERROR_OVER_CURRENT }, { }, }, }, { .func = PMBUS_HAVE_STATUS_TEMP, .reg = PMBUS_STATUS_TEMPERATURE, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_TEMP_OT_WARNING, REGULATOR_ERROR_OVER_TEMP_WARN }, - { PB_TEMP_OT_FAULT, REGULATOR_ERROR_OVER_TEMP }, + { PB_TEMP_OT_WARNING, REGULATOR_ERROR_OVER_TEMP_WARN }, + { PB_TEMP_OT_FAULT, REGULATOR_ERROR_OVER_TEMP }, + { }, + }, + }, { + .func = -1, + .reg = PMBUS_STATUS_BYTE, + .bits = (const struct pmbus_regulator_status_assoc[]) { + { PB_STATUS_IOUT_OC, REGULATOR_ERROR_OVER_CURRENT }, + { PB_STATUS_VOUT_OV, REGULATOR_ERROR_REGULATION_OUT }, + { PB_STATUS_VIN_UV, REGULATOR_ERROR_UNDER_VOLTAGE }, + { PB_STATUS_NONE_ABOVE, REGULATOR_ERROR_FAIL }, + { }, + }, + }, { + .func = PMBUS_HAVE_STATUS_INPUT, + .reg = PMBUS_STATUS_INPUT, + .bits = (const struct pmbus_regulator_status_assoc[]) { + { PB_IIN_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT }, + { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_OVER_VOLTAGE_WARN }, + { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN }, + { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE }, { }, }, }, @@ -2834,23 +2855,6 @@ static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned if (status & PB_STATUS_POWER_GOOD_N) *flags |= REGULATOR_ERROR_REGULATION_OUT; } - /* - * Unlike most other status bits, PB_STATUS_{IOUT_OC,VOUT_OV} are - * defined strictly as fault indicators (not warnings). - */ - if (status & PB_STATUS_IOUT_OC) - *flags |= REGULATOR_ERROR_OVER_CURRENT; - if (status & PB_STATUS_VOUT_OV) - *flags |= REGULATOR_ERROR_REGULATION_OUT; - - /* - * If we haven't discovered any thermal faults or warnings via - * PMBUS_STATUS_TEMPERATURE, map PB_STATUS_TEMPERATURE to a warning as - * a (conservative) best-effort interpretation. - */ - if (!(*flags & (REGULATOR_ERROR_OVER_TEMP | REGULATOR_ERROR_OVER_TEMP_WARN)) && - (status & PB_STATUS_TEMPERATURE)) - *flags |= REGULATOR_ERROR_OVER_TEMP_WARN; return 0; } From patchwork Tue Nov 22 13:50:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 24387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2209574wrr; Tue, 22 Nov 2022 05:52:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf69u8FHOCurDoS01GHDghRQSlrFqzEls/hjwv2u9K/7VOoZTcwN8hBqpKIPFfE9jVTb6H9E X-Received: by 2002:a17:902:ce06:b0:188:fd3f:cb06 with SMTP id k6-20020a170902ce0600b00188fd3fcb06mr3989178plg.23.1669125131719; Tue, 22 Nov 2022 05:52:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669125131; cv=none; d=google.com; s=arc-20160816; b=wXtdEy+B3j5Z7K5o2rXm1jbf3kSjPN9U6FhQse5tkvWbeddf69WpjBDC8Kkcen6S6+ 2t7pZ7oNq/YoYINjE+8tT6BixyXPnlyv3hKepnbEIzdIOrJfqTzC19rGMZH7wd6wT8jg BOzgC9B4IrggR7zFRB9H40BtKZLPBJ0Ac+kndFfHlkTyc1gt/SbbbFuzl81XEFga8xBo zmxFk34Xwc1qIXMfqeLUelGSxSXELKaMgcbUOMQ5+DuKfSjMWLnls7KgLAsjjo6prxUU QUGf4UaMK6B4XDAbg84RLxAVhnPKxthV2gA4MA2nYpI8Ss5Copf9mCRhzvxccQHi4p85 2hfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c2zr/3LnDgZvKq+c4XGc3H/8wNdt4pUTOlQ5WTUoXqY=; b=iFlZ+uaup4DmzAei1pjrBVGB68EBFVp1eWcQ3axZuvIWugGd89A+s5aP8AHqeqhExh 0+ybp2QAYNzN+D5E00u3yjnbj0QTZVAuVOT/o5ql3FdAsTxG8igQIDFdz7QjOswPKTox TyBcoQiAtoAAsvVRyK+4Mz2QcFNfTTc4xL9xNMc3FthPzl+vC6G7OLM5yVbdipNljUzl 8JDq+k6quB8XaNRVkYGMXU0EhA5Rr6qczaTaLmWpbLK4UiZHAAQg5gFe1gePiGB/6EZx t8SbUdWx4VZP2vUzEl9RxWZRo/N9Py68p+eHLLbEHRYeAxrxgEViTMTLabMdiCjhmfp6 pk0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=T7dOFALU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m3-20020a170902db0300b001868277386dsi15955669plx.192.2022.11.22.05.51.57; Tue, 22 Nov 2022 05:52:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=T7dOFALU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233894AbiKVNuZ (ORCPT + 99 others); Tue, 22 Nov 2022 08:50:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233885AbiKVNuX (ORCPT ); Tue, 22 Nov 2022 08:50:23 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1375B5E9C1 for ; Tue, 22 Nov 2022 05:50:22 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id l14so5922316wrw.13 for ; Tue, 22 Nov 2022 05:50:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c2zr/3LnDgZvKq+c4XGc3H/8wNdt4pUTOlQ5WTUoXqY=; b=T7dOFALULTJ7RCXwLpoc1ogo/zlyXJl7R9/WAcrl+IfjgWx1F8u61ctPcVbDoRJ3QA FuP+WQYnARMSSKbzN5/VPyK9acoyqr9JvKIS4Dkvc/ChB8EZW/csYzC+KOsI0Z8po1hB 0v7A8uljgjn/SkY8n4ZkcUIvwgl1Glp+xJkutNjjckyuGfHZoVgIE9KUnagMtYJMzV8X D7fSNeFNIpOW078i568ez0JJujhFkMmnJY9NEpioN7GQrdBtsh3nFGMV68ifDqDM2uqJ FCv1UjucOER1x+qZK+awD438DbM5symYMP5QW6fFIlEU2MY0aepVYk71l3M7JdyiXrnq M0ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c2zr/3LnDgZvKq+c4XGc3H/8wNdt4pUTOlQ5WTUoXqY=; b=XcaXXwpwYBzZUvjaQJzeEJmaJmuAjNW8xEGpWdONCQxXmFT7dpGeaBkU4T7i3EexOx FbAF4+UxjRkqr+6p5BkliCMDvvQN8O67pR0iIij3Y8GgSAil2auzNO6mDxMQDycW/uui oFVLUSeaC8DTII8r5rpZ94rT/QVlY9Pj9/R5zJllYzpTodwB6f72Ozmqjl+OIAYAaR3B SKQE3gqCZv4K5FINJs5IhwUsvtDYX8QliYKEZDtwx21My8ApSysUaKEI6z5716Geu765 KkCe9gNaL8M2M/1LqzuRV6M2/qV+muXXIpFXNm2TLsugH+BBXyGGKlX7cMCHhNwavCP6 eT8w== X-Gm-Message-State: ANoB5plGFw4SyKx7n1Y6s+Vg2UYkVGTDOLuK4HPHn5tpKCASXamwIXKE eu05lE2y76bofXLQ7zRCNw0tz4KZCWSs4TmL X-Received: by 2002:adf:d0ca:0:b0:236:8ead:4871 with SMTP id z10-20020adfd0ca000000b002368ead4871mr14371511wrh.498.1669125020593; Tue, 22 Nov 2022 05:50:20 -0800 (PST) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id n17-20020a05600c465100b003cf483ee8e0sm19947254wmo.24.2022.11.22.05.50.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 05:50:20 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare Cc: broonie@kernel.org, Patrick Rudolph , Naresh Solanki , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] hwmon: (pmbus/core): Add events to regulator flag map Date: Tue, 22 Nov 2022 14:50:12 +0100 Message-Id: <20221122135014.3504094-2-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221122135014.3504094-1-Naresh.Solanki@9elements.com> References: <20221122135014.3504094-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750204554077387167?= X-GMAIL-MSGID: =?utf-8?q?1750204554077387167?= From: Patrick Rudolph Add regulator events corresponding to regulator error in regulator flag map. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus_core.c | 68 ++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 08f96e2b4837..7d7d10039987 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -2738,9 +2738,9 @@ static int pmbus_regulator_disable(struct regulator_dev *rdev) return _pmbus_regulator_on_off(rdev, 0); } -/* A PMBus status flag and the corresponding REGULATOR_ERROR_* flag */ +/* A PMBus status flag and the corresponding REGULATOR_ERROR_* and REGULATOR_EVENTS_* flag */ struct pmbus_regulator_status_assoc { - int pflag, rflag; + int pflag, rflag, eflag; }; /* PMBus->regulator bit mappings for a PMBus status register */ @@ -2755,48 +2755,76 @@ static const struct pmbus_regulator_status_category pmbus_regulator_flag_map[] = .func = PMBUS_HAVE_STATUS_VOUT, .reg = PMBUS_STATUS_VOUT, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN }, - { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE }, - { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN }, - { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_REGULATION_OUT }, + { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN, + REGULATOR_EVENT_UNDER_VOLTAGE_WARN }, + { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE, + REGULATOR_EVENT_UNDER_VOLTAGE }, + { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN, + REGULATOR_EVENT_OVER_VOLTAGE_WARN }, + { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_REGULATION_OUT, + REGULATOR_EVENT_OVER_VOLTAGE_WARN }, { }, }, }, { .func = PMBUS_HAVE_STATUS_IOUT, .reg = PMBUS_STATUS_IOUT, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_IOUT_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN }, - { PB_IOUT_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT }, - { PB_IOUT_OC_LV_FAULT, REGULATOR_ERROR_OVER_CURRENT }, - { PB_POUT_OP_FAULT, REGULATOR_ERROR_OVER_CURRENT }, + { PB_IOUT_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN, + REGULATOR_EVENT_OVER_CURRENT_WARN }, + { PB_IOUT_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, + { PB_IOUT_OC_LV_FAULT, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, + { PB_POUT_OP_FAULT, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, { }, }, }, { .func = PMBUS_HAVE_STATUS_TEMP, .reg = PMBUS_STATUS_TEMPERATURE, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_TEMP_OT_WARNING, REGULATOR_ERROR_OVER_TEMP_WARN }, - { PB_TEMP_OT_FAULT, REGULATOR_ERROR_OVER_TEMP }, + { PB_TEMP_OT_WARNING, REGULATOR_ERROR_OVER_TEMP_WARN, + REGULATOR_EVENT_OVER_TEMP_WARN }, + { PB_TEMP_OT_FAULT, REGULATOR_ERROR_OVER_TEMP, + REGULATOR_EVENT_OVER_TEMP }, { }, }, }, { .func = -1, .reg = PMBUS_STATUS_BYTE, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_STATUS_IOUT_OC, REGULATOR_ERROR_OVER_CURRENT }, - { PB_STATUS_VOUT_OV, REGULATOR_ERROR_REGULATION_OUT }, - { PB_STATUS_VIN_UV, REGULATOR_ERROR_UNDER_VOLTAGE }, - { PB_STATUS_NONE_ABOVE, REGULATOR_ERROR_FAIL }, + { PB_STATUS_IOUT_OC, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, + { PB_STATUS_VOUT_OV, REGULATOR_ERROR_OVER_VOLTAGE_WARN, + REGULATOR_EVENT_OVER_VOLTAGE_WARN }, + { PB_STATUS_VIN_UV, REGULATOR_ERROR_UNDER_VOLTAGE, + REGULATOR_EVENT_UNDER_VOLTAGE }, + { PB_STATUS_OFF, 0, + REGULATOR_EVENT_DISABLE }, + { PB_STATUS_NONE_ABOVE, REGULATOR_ERROR_FAIL, + REGULATOR_EVENT_FAIL }, + { }, + }, + }, { + .func = -1, + .reg = PMBUS_STATUS_WORD, + .bits = (const struct pmbus_regulator_status_assoc[]) { + { PB_STATUS_POWER_GOOD_N, 0, + REGULATOR_EVENT_REGULATION_OUT }, { }, }, }, { .func = PMBUS_HAVE_STATUS_INPUT, .reg = PMBUS_STATUS_INPUT, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_IIN_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT }, - { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_OVER_VOLTAGE_WARN }, - { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN }, - { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE }, + { PB_IIN_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, + { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_OVER_VOLTAGE_WARN, + REGULATOR_EVENT_OVER_VOLTAGE_WARN }, + { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN, + REGULATOR_EVENT_OVER_VOLTAGE_WARN }, + { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE, + REGULATOR_EVENT_UNDER_VOLTAGE }, { }, }, }, From patchwork Tue Nov 22 13:50:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 24388 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2209631wrr; Tue, 22 Nov 2022 05:52:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf4fQsXHoLmTXNx1D+DQ9E7xTD5tDEeBtP4vGmw9K9vtjXvCpQp75XX9AICSgxGBg7HE2T9g X-Received: by 2002:a17:902:b286:b0:186:9cce:c4d with SMTP id u6-20020a170902b28600b001869cce0c4dmr17273339plr.103.1669125140528; Tue, 22 Nov 2022 05:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669125140; cv=none; d=google.com; s=arc-20160816; b=RQnJ4MnUO8TSnb5n1JNvFEJfvy/bo/5r59QkrQeRTXgtmvqcD2yQJIX7HZAAAMpwfP iClu2FgjOjAEiofX5jRnUs4CeQi+sMAnMA7qFKso64uV7q0QknbOgqvqJ/AXian7WvRk Ver8Kd4MfPYC4tonWbnVFaJ/4N7cRiU92v94A5QpC3fv34EIJFYvDrDnYhHAQ2545uS5 lSck6ZIDIPZxut/mJm+anPTOXDsSDVxclnx0Sf0z9makAi5GOs9bFtxXHsFmcTTHdq/2 1YgsQlxSO8+KuyvHU4f8XWvmRcTqXhywfnHVdS7AYEGxLewLEUph7uzimDsAlEoxbpGA EUig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=anPtCF5gBJhBr5uCnQB81OM8p3Xz5Q/bnswXpaOxfac=; b=RtzgkCnP3CL3LNH9bSzQ7yA43v9xMI3Lyojj4anAL3OCaykoYyPc3j12GzhLmevMuR I6smP9Fr3yiRvNpMnvp5JLLdcZe2P/amPp2one+83sRlAZoxBkAAJxy7zbsBqwLcacM5 EGEhFFOXncS1m4ZbA2lAaSTphNSpAN5n9vxifGPKOuU8jJzPVLjSDFhcfIxhXiOJa1W6 rq4dNQ8DGJq854qEXOlsL91ulYOR1Oc1prsU4XQb5Qzl0XDRkiyArttmV7Q7d+hTh4kH bObUGBmqIlok8cVpYQERRYfPF5chOYwhzcFBrMECXl+5tcUq20s3rq3mnR4UX1EFNIdg gWAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=IZnvrEAH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020aa788c7000000b0056d568dc21dsi15224403pff.153.2022.11.22.05.52.06; Tue, 22 Nov 2022 05:52:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=IZnvrEAH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233899AbiKVNu1 (ORCPT + 99 others); Tue, 22 Nov 2022 08:50:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233892AbiKVNuY (ORCPT ); Tue, 22 Nov 2022 08:50:24 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39E8857B66 for ; Tue, 22 Nov 2022 05:50:23 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id g12so24765676wrs.10 for ; Tue, 22 Nov 2022 05:50:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=anPtCF5gBJhBr5uCnQB81OM8p3Xz5Q/bnswXpaOxfac=; b=IZnvrEAHpQbFCVb2X0xMbyK7M7glhqm5TW4CNLb88tUcFT4xnnmYnCaQdSBG3kYszw 3E9+xksP9YbojeVUxrEuyNfjYAYuXR8lBpXurT1jFeEAAngAeiSpQ+ZWU3fxJffSvUmM WzkHEYpdekadPwBgliW/B7/tcPDCfEex5os5247I60frjYPm/ruJqpwt8PGPYVEpgHO6 4aZEb+uiqb0BCp1v/tpfcaWkhLNZVx4EiKt5sO+vlmZKXfkgDYzCKaJnVlFbaPNVkgY9 r4Ae/OZdQ3qRmQFYhKSGrWFD2DEYKag626eq9vpF9+LrVk/YwgaOf38xuKST6H3wqiTF L38Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=anPtCF5gBJhBr5uCnQB81OM8p3Xz5Q/bnswXpaOxfac=; b=KXDG3lUa0BNKv0mX8a0J+gQunOmRAqlPEiN0N2JUJykpbLRWqo+JS5haACHDT1df6M +517I5r8+kJHGtxu8YFHFeRuiTXTuTlkOzqDoAGZ8FUasTQ1T5cr47FsCGSz1kDvJKQD i+htF8hGrhU0lnTJtSB7adFWwpl0yJKlPw2jUZtW8f5PJeH8vW9MfDIB4G7KswCakZfS 4OJscjwvzB+PKlKW5L5PT8WAWdUkmUmAwNOLRWXPsaLZLwmYONY7jCruXXP6zYpwMiww mDLsk0cSRwOxvzvCFORiMJLErWzKEjFtbWo4dUoP7vZwwB6xpaI9xypMBR1d4pKLEnM9 8LdQ== X-Gm-Message-State: ANoB5plkLSWOB3NBJyArVg9VUPJDYDbU/q61JY+H5dDULDTXCVZ5eWHc H11DiBs8z/262dB/pFMIQYG0Og== X-Received: by 2002:adf:eb8a:0:b0:22e:31b2:ecb9 with SMTP id t10-20020adfeb8a000000b0022e31b2ecb9mr14552775wrn.693.1669125021741; Tue, 22 Nov 2022 05:50:21 -0800 (PST) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id n17-20020a05600c465100b003cf483ee8e0sm19947254wmo.24.2022.11.22.05.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 05:50:21 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare Cc: broonie@kernel.org, Patrick Rudolph , Naresh Solanki , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] hwmon: (pmbus/core): Implement IRQ support Date: Tue, 22 Nov 2022 14:50:13 +0100 Message-Id: <20221122135014.3504094-3-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221122135014.3504094-1-Naresh.Solanki@9elements.com> References: <20221122135014.3504094-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750204563667473344?= X-GMAIL-MSGID: =?utf-8?q?1750204563667473344?= From: Patrick Rudolph Implement IRQ support to monitor PMBUS regulator events. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus.h | 2 +- drivers/hwmon/pmbus/pmbus_core.c | 151 ++++++++++++++++++++++++++++--- 2 files changed, 140 insertions(+), 13 deletions(-) diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h index 10fb17879f8e..6b2e6cf93b19 100644 --- a/drivers/hwmon/pmbus/pmbus.h +++ b/drivers/hwmon/pmbus/pmbus.h @@ -26,7 +26,7 @@ enum pmbus_regs { PMBUS_CAPABILITY = 0x19, PMBUS_QUERY = 0x1A, - + PMBUS_SMBALERT_MASK = 0x1B, PMBUS_VOUT_MODE = 0x20, PMBUS_VOUT_COMMAND = 0x21, PMBUS_VOUT_TRIM = 0x22, diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 7d7d10039987..0c0d9419e72a 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -3033,13 +3033,107 @@ const struct regulator_ops pmbus_regulator_ops = { }; EXPORT_SYMBOL_NS_GPL(pmbus_regulator_ops, PMBUS); -static int pmbus_regulator_register(struct pmbus_data *data) +static int pmbus_write_smbalert_mask(struct i2c_client *client, u8 page, u8 reg, u8 val) { - struct device *dev = data->dev; + return pmbus_write_word_data(client, page, PMBUS_SMBALERT_MASK, reg | (val << 8)); +} + +static int pmbus_irq_subhandler(struct i2c_client *client, struct regulator_err_state *stat, + unsigned long *dev_mask) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + u8 page = rdev_get_id(stat->rdev); + const struct pmbus_regulator_status_category *cat; + const struct pmbus_regulator_status_assoc *bit; + int status, i; + int func = data->info->func[page]; + + stat->notifs = 0; + stat->errors = 0; + + for (i = 0; i < ARRAY_SIZE(pmbus_regulator_flag_map); i++) { + cat = &pmbus_regulator_flag_map[i]; + if (!(func & cat->func)) + continue; + + status = _pmbus_read_byte_data(client, page, cat->reg); + if (status < 0) { + mutex_unlock(&data->update_lock); + return status; + } + + for (bit = cat->bits; bit->pflag; bit++) { + if (status & bit->pflag) { + stat->notifs |= bit->eflag; + stat->errors |= bit->rflag; + } + } + } + + return 0; +} + +static int pmbus_fault_handler(int irq, struct regulator_irq_data *rid, unsigned long *dev_mask) +{ + struct regulator_err_state *stat; + struct pmbus_data *data; + struct device *dev; + struct i2c_client *client; + int status; + u8 page; + int i; + + *dev_mask = 0; + rid->opaque = 0; + + for (i = 0; i < rid->num_states; i++) { + stat = &rid->states[i]; + dev = rdev_get_dev(stat->rdev); + client = to_i2c_client(dev->parent); + data = i2c_get_clientdata(client); + page = rdev_get_id(stat->rdev); + + mutex_lock(&data->update_lock); + status = pmbus_irq_subhandler(client, stat, dev_mask); + if (status < 0) { + mutex_unlock(&data->update_lock); + return REGULATOR_FAILED_RETRY; + } + + status = pmbus_read_status_byte(client, page); + if (status < 0) { + mutex_unlock(&data->update_lock); + return REGULATOR_FAILED_RETRY; + } + + if (status & ~(PB_STATUS_OFF | PB_STATUS_BUSY)) + pmbus_clear_fault_page(client, page); + mutex_unlock(&data->update_lock); + } + + return REGULATOR_ERROR_CLEARED; +} + +static int pmbus_regulator_register(struct i2c_client *client, struct pmbus_data *data) +{ + struct device *dev = &client->dev; const struct pmbus_driver_info *info = data->info; const struct pmbus_platform_data *pdata = dev_get_platdata(dev); - struct regulator_dev *rdev; - int i; + const struct pmbus_regulator_status_category *cat; + const struct pmbus_regulator_status_assoc *bit; + int func; + struct regulator_dev **rdevs; + struct regulator_irq_desc pmbus_notif = { + .name = "pmbus-irq", + .map_event = pmbus_fault_handler, + }; + void *irq_helper; + int i, j, err, errs; + u8 mask; + + rdevs = devm_kzalloc(dev, sizeof(*rdevs) * info->num_regulators, GFP_KERNEL); + if (!rdevs) + return -ENOMEM; for (i = 0; i < info->num_regulators; i++) { struct regulator_config config = { }; @@ -3050,18 +3144,51 @@ static int pmbus_regulator_register(struct pmbus_data *data) if (pdata && pdata->reg_init_data) config.init_data = &pdata->reg_init_data[i]; - rdev = devm_regulator_register(dev, &info->reg_desc[i], - &config); - if (IS_ERR(rdev)) - return dev_err_probe(dev, PTR_ERR(rdev), - "Failed to register %s regulator\n", - info->reg_desc[i].name); + rdevs[i] = devm_regulator_register(dev, &info->reg_desc[i], &config); + if (IS_ERR(rdevs[i])) { + dev_err(dev, "Failed to register %s regulator\n", + info->reg_desc[i].name); + return PTR_ERR(rdevs[i]); + } + } + + if (client->irq > 0) { + pmbus_notif.data = rdevs; + errs = 0; + for (i = 0; i < data->info->pages; i++) { + func = data->info->func[i]; + + for (j = 0; j < ARRAY_SIZE(pmbus_regulator_flag_map); j++) { + cat = &pmbus_regulator_flag_map[i]; + if (!(func & cat->func)) + continue; + mask = 0; + for (bit = cat->bits; bit->pflag; bit++) { + errs |= bit->rflag; + mask |= bit->pflag; + } + err = pmbus_write_smbalert_mask(client, i, cat->reg, ~mask); + if (err) + dev_err(dev, "Failed to set smbalert for reg 0x%02x\n", + cat->reg); + } + + } + + /* Register notifiers - can fail if IRQ is not given */ + irq_helper = devm_regulator_irq_helper(dev, &pmbus_notif, client->irq, 0, errs, + NULL, &rdevs[0], info->num_regulators); + if (IS_ERR(irq_helper)) { + if (PTR_ERR(irq_helper) == -EPROBE_DEFER) + return -EPROBE_DEFER; + dev_warn(dev, "IRQ disabled %pe\n", irq_helper); + } } return 0; } #else -static int pmbus_regulator_register(struct pmbus_data *data) +static int pmbus_regulator_register(struct i2c_client *client, struct pmbus_data *data) { return 0; } @@ -3425,7 +3552,7 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info) return PTR_ERR(data->hwmon_dev); } - ret = pmbus_regulator_register(data); + ret = pmbus_regulator_register(client, data); if (ret) return ret;