From patchwork Thu Nov 17 18:40:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 21871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp562250wrr; Thu, 17 Nov 2022 10:41:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf5+qzmcTFXIRw5UKB5fDNOq33VdW1xQw3k3x1jgPMaao/Za+Jwf7epgpi3ErExwD4A0rk9m X-Received: by 2002:a05:6402:5299:b0:461:7291:79c1 with SMTP id en25-20020a056402529900b00461729179c1mr3399063edb.68.1668710513974; Thu, 17 Nov 2022 10:41:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668710513; cv=none; d=google.com; s=arc-20160816; b=PO4bp6Y7r24qmBU8OTu53rt+6kiX49vYP1dA4vRUudlS76a1QtfgjMzeIi+6swG4Pw 05u/Dghr5NXM2sQj5RxcHbkv5qPazPQiuAjzowvvGrkRHUy1HGmmCE2+9ysErLarEplI T/i4PDuk5jApHUvkzCcBZ86gnLQy7jyY4luTZKeNT/rmECa4LdSDtO2gngVA7zGDSQEl 8gDIUVkKkMOpEEIrv4JhRkBwg+eoOuT2iqlAdePzqdoBokj0Sp5lK9qdeaFarWBXpvdU j/RywXYUzuBiD3IiZvMCPAqI0AfQ0wFoUMwtE1Mc7D8rKSq0W3sTcyXofE6/r+6DpBN7 EQ4Q== 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=Abu7MuicKWdhbXi7GeZMoVbyzQG5Uo0La/ux0RfbuPM=; b=zSJnZDxNjIvJYiELdDG6l2/+tjUf0AL02dJR99mkvhS0y+ySqyKN0lr3RquQDaAWEZ 6kwCNsIgXohC9V8M11LfErnC7un5ZtYgk0X8a9sN9YVd3n1nUxnW48Vqp3Lhe/VU+2Vk fbDleYysyTzUvvXrZuTAZzRmL0ah7BcdImG91M6Wt315+ZhGtvFSafypkUwxYzGWaxF1 Iix/xR9QtyAJZhOUnstAup3wlXVegGPGHfAyoQKDobItwk0wx+KihJENVhq8XsmuWXBG ghDfNaRH4CzxFaW7qprbxLvCmV7ELQs4m3Bh4HUhsmYCyACHtL8EUGtm9ECcPjwxKV4H fI2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=YDeXI5kY; 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 b14-20020a056402138e00b0046790cd90acsi1283102edv.95.2022.11.17.10.41.28; Thu, 17 Nov 2022 10:41:53 -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=YDeXI5kY; 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 S240671AbiKQSlI (ORCPT + 99 others); Thu, 17 Nov 2022 13:41:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240619AbiKQSlB (ORCPT ); Thu, 17 Nov 2022 13:41:01 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92F7386A44 for ; Thu, 17 Nov 2022 10:41:00 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id g12so5288287wrs.10 for ; Thu, 17 Nov 2022 10:41:00 -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=Abu7MuicKWdhbXi7GeZMoVbyzQG5Uo0La/ux0RfbuPM=; b=YDeXI5kYTHzKyCnnUgdV7IVVA0MucRAImCFhTJ/nwvWMKpCsclRLd57uGjViSpuyQf 5QS4Wd1qesZDqdBbrRY5Iff+m7iYHJbx4HOLcmL9U2OkdPpZk5nVJuPUr2PoQ8TIpyue RNqbifCCzsB7C63G8iIqkylN6Z4HEomyuk1eT20SZmugCvHrHGCQ5r4yilwjmzcMMDz/ R3E5Grib1eWxFNghcw/0TgUNUxbPAtnh4JybDJ8KJ4Dwl/1dq2RHGE6VfOdgXeacd7wr SgxVfFblUmv7USAor2fSMsX78gaK1ZNJRaFIeaaG64N6hS247rS1GHlSv+rr+uyznqLy q06g== 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=Abu7MuicKWdhbXi7GeZMoVbyzQG5Uo0La/ux0RfbuPM=; b=6VrtNvZWWFDQVMbWfK3lP5+NWoQwmUuw1FplDp+9TwGYt6JCktoA/nCt1jDCVxr5bn dJK9xmQ3x0UmlPvDYeMW4KxTUoom2Eu2lvJ6tk1KhvtflRV7wtL09IcxJGCP1GKvJomt pfS+0VS9OkLIZltavb02rtS9Y5ARKeS12m7lIph7qH+TUiOnQ9hYLz7/oltHj2ICPxtV wUzmoMz9xe26g1Z9rYbMOjnTmwqeVIDOp76BHEeSguA/aDRDpiSpRd9JB8/1HumdHMew NmOt9TalgPvWFXe1XguJyoVpcroFFkxdWuVS4Gti5sr5odYpwsVbvliarmisGb2ZAkoM MBLg== X-Gm-Message-State: ANoB5pm+koZ8MZcT4f+YBq2xRT10T91qUXuQb/BJ7CZRbQzWniDYj6/E NAj6qFW/hzVFAPtkfOmwb/MEEA== X-Received: by 2002:adf:e603:0:b0:241:bd28:51f7 with SMTP id p3-20020adfe603000000b00241bd2851f7mr912788wrm.246.1668710459042; Thu, 17 Nov 2022 10:40:59 -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 fc18-20020a05600c525200b003c71358a42dsm8801370wmb.18.2022.11.17.10.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:40:58 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare Cc: Patrick Rudolph , Naresh Solanki , linux-kernel@vger.kernel.org Subject: [PATCH] pmbus core: Add power good support Date: Thu, 17 Nov 2022 19:40:22 +0100 Message-Id: <20221117184022.1808508-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 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?1749769795976998079?= X-GMAIL-MSGID: =?utf-8?q?1749769795976998079?= From: Patrick Rudolph Update error flags with regulation out if regulator is on & power good status bit is set Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) base-commit: 27fea302952d8c90cafbdbee96bafeca03544401 diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 7ec04934747e..20ca26e19db7 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -2827,9 +2827,13 @@ static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned if (status < 0) return status; - if (pmbus_regulator_is_enabled(rdev) && (status & PB_STATUS_OFF)) - *flags |= REGULATOR_ERROR_FAIL; + if (pmbus_regulator_is_enabled(rdev)) { + if (status & PB_STATUS_OFF) + *flags |= REGULATOR_ERROR_FAIL; + 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).