Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4533060rwl; Tue, 28 Mar 2023 08:07:19 -0700 (PDT) X-Google-Smtp-Source: AKy350ax7yfyoeQg378Jo4ErezLfoKsSTwMy0/2crhsEjoIXbtdLUIjIckbZDoHHi2Sn1NfFoZW7 X-Received: by 2002:a17:906:f0d7:b0:930:123:8cc8 with SMTP id dk23-20020a170906f0d700b0093001238cc8mr17155064ejb.21.1680016039607; Tue, 28 Mar 2023 08:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680016039; cv=none; d=google.com; s=arc-20160816; b=fNPcCn9SUM+wz69iajmNQd/bAEX6AMryLnfZdVEE6p1OHoC0nQNQPj7Sj0t+S7v8MB ixNX+ozh4Dee0KHq5rsEbnwurFGDBiOhJXW4Zl4tbjbhVfYGzVceOUipuzmcYk59c7S5 39SgohbT9HyTcSXzcHZzAddGDzRK4BL78eTNtkpLw0RLhfLC3CiIBevoJm52W1UUvAPo zcrmhRTLIAhHPoWPH/m5MCxj3E4jXCA8QQCUrPRXjyxA/sXObOFswcGQddogZrpvyOz7 fj9jEnNISoyFZdS8q8he3/OJmASssJ5b/uDWh0aO8hdp/h7QvXYlfAuHB1MrRI4OzuM8 wwhw== 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=rfc+TC6H1PlSlxFpFQCACZ1XBg01+cDV6KBw8cNxn8g=; b=HuzeoqZ9EnKTyrbf1A8v3FRjegEnbo9sqmaFCY+XGokgad8iJXnmKMnUSUzZvDJq/k vWwOeyd9SjfLWTcZUW+C1Cri/6ZOK3ronGqzuXMlBnIiHONAEDIy/ZX8VgGqLcPK6qIr RnYomt8TmKm7Tu07sHVo74LKpTMgvWmtbrUV26Dmk9mWNEdhlGKMHrtEfDg3E0h7tpqt dSfk/RVNSY3S1gksThloAubDwmj46aKu7nMI1FDQuSgoHGccFKQTn5ceYRnPdDJPj4G2 GT7YRKC84twghiQjlAUQSFoZqQAxkOpIZqJ/Uvo+ux71+V0i1gOR4pY11d/L5uwoRDTS BtFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=OSxGGIhx; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bj13-20020a170906b04d00b0092606831159si28459207ejb.413.2023.03.28.08.06.51; Tue, 28 Mar 2023 08:07:19 -0700 (PDT) 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=OSxGGIhx; 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 S233829AbjC1PFM (ORCPT + 99 others); Tue, 28 Mar 2023 11:05:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbjC1PFL (ORCPT ); Tue, 28 Mar 2023 11:05:11 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF29EEC4E for ; Tue, 28 Mar 2023 08:03:53 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id l8-20020a05600c1d0800b003ef6708bbf6so5637448wms.5 for ; Tue, 28 Mar 2023 08:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1680015819; 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=rfc+TC6H1PlSlxFpFQCACZ1XBg01+cDV6KBw8cNxn8g=; b=OSxGGIhx4Vg56wUYCQ8KPg1Tn15IEXVy/NE8SBWMkUB+t1fVYmTGzMzAm3e0QMWpo0 mFD0OFqbk4JF9UVuu1sLUF9zcmjB200QemNxXvwGQEWJ+cauUTiF/NLLKfW5i33tr9x6 IOZxSnymHZ0Q/vqSBEr0C5QY/RNWiyhS/ANwMlBW0A5f3aJCb4j1shzwZfnt9/a/74ip 3jcHt6CYFKkvo2t90KcW6wjsCdbRg5eCxBDIYkx6nE5tIToF27jJ4c5ldWacSZfKOc8o RN93a69cFu2mrGGIzqa41H/UwG4OSbxPV53X/65FGZ+17LkXm8VynWqRWAKAOmCdv+la c+rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680015819; 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=rfc+TC6H1PlSlxFpFQCACZ1XBg01+cDV6KBw8cNxn8g=; b=m93ALOIyhEE6ll5z/6TKNle8aTQgLqTs2VnjEhzQ64PMdTPAyLEV4pGBjACZOo5jr+ 4Mpr1zSCXRCzefclbvqJtwbZpaxf0zkdXo6z72jNCwpQTpR7e/y2YWOlV8OII1ftFJpF 4CH2nrpfhiDueLQE/tFOSzj9mnENWPar//h6xDnm1a2q0tQX8Eu77X2y3iPeZs8Gqbm5 28MKGxhGdo/NfJ8Z7AJhc5RgnTf/Ic1vKJgY5oxP2/W0hssUaCrR76BgaMB1XEp/mPZF peGVikBKG5xe8Y1lR5TUP8XD72j+zp3jAI4iswyf7bg0vw7ddRoEaVZ39ibauORKop+R I69w== X-Gm-Message-State: AAQBX9cl2PcQIow2UpzPIKygnOPUiUMVRUF+NUFPK8qnVcNdBJjB61Re M4u39pScbf/DjxeMGupUJgDH0Q== X-Received: by 2002:a1c:7714:0:b0:3ed:ea48:cd92 with SMTP id t20-20020a1c7714000000b003edea48cd92mr5643697wmi.15.1680015819441; Tue, 28 Mar 2023 08:03:39 -0700 (PDT) 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 a2-20020a05600c224200b003ee63fe5203sm17429293wmm.36.2023.03.28.08.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 08:03:39 -0700 (PDT) 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 v2 3/3] hwmon: (pmbus/core): Notify regulator events Date: Tue, 28 Mar 2023 17:03:35 +0200 Message-Id: <20230328150335.90238-3-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230328150335.90238-1-Naresh.Solanki@9elements.com> References: <20230328150335.90238-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Notify regulator events in PMBus irq handler. Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus_core.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 509bc0ef1706..86cc8001a788 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -3159,11 +3159,29 @@ static int pmbus_regulator_register(struct pmbus_data *data) return 0; } + +static int pmbus_regulator_notify(struct pmbus_data *data, int page, int event) +{ + int j; + + for (j = 0; j < data->info->num_regulators; j++) { + if (page == rdev_get_id(data->rdevs[j])) { + regulator_notifier_call_chain(data->rdevs[j], event, NULL); + break; + } + } + return 0; +} #else static int pmbus_regulator_register(struct pmbus_data *data) { return 0; } + +static int pmbus_regulator_notify(struct pmbus_data *data, int page, int event) +{ + return 0; +} #endif static int pmbus_write_smbalert_mask(struct i2c_client *client, u8 page, u8 reg, u8 val) @@ -3178,9 +3196,13 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata) int i, status, event; mutex_lock(&data->update_lock); - for (i = 0; i < data->info->pages; i++) + for (i = 0; i < data->info->pages; i++) { _pmbus_get_flags(data, i, &status, &event, true); + if (event) + pmbus_regulator_notify(data, i, event); + } + pmbus_clear_faults(client); mutex_unlock(&data->update_lock); -- 2.39.1