Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1264505lfc; Wed, 1 Jun 2022 13:31:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9KSbP2i209IjMEi09BDofWDO1H5n8SMU5BqASBM0mKW2l/7IRCkfbbsNt7nS/nP2AUBvt X-Received: by 2002:a63:d218:0:b0:3fb:355:2262 with SMTP id a24-20020a63d218000000b003fb03552262mr1027179pgg.294.1654115496151; Wed, 01 Jun 2022 13:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654115496; cv=none; d=google.com; s=arc-20160816; b=L7zMloufuYbrEsfz6MhUVHFgPs1lVGB0XJcLEtnL3hKYuVKvdIrgQ2nRBevnIsHh/C op7e/rjM9lbKrbGGkTKZAGvSqmwGDvodO8jUi7fNeBBWlyAYgEJC1/bJldHJVF6BAh1k MGTYFdp2gAtJ+IfI4Ng8Iuj5BDlHSxX3UwxW9wUd8Pup3gp3VUmru/dz+Sg1uZg+0XeU XfslM42bDsq5KBkxrfAx3WT8/YG9yAV+BA7p2L9tP5e23r98K0dsGsF/S0ovgRTCcr10 ga9YOX6GtUsKvfEHSulkav7k8xXarYHHE2nvP6Ln15zsge914VosJhJFey3f2CyZ8fYW vmNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NcY+/RHrHOgS2GNME8uvnAPvcP1euOHTrg8mlxIo820=; b=KPJPvXKqa2KOV3PSYBM/l658Wth9konvG9J8bsb5ACgl89lGOx8A3XR0asmnGjRrBv G8V+tmaDM5EWJzimi78e7Leu5OMf9Mvv/f2tJhiQKC7cOShn9DyhjkFMdoKgpIepWXLA qWeXUE9SFS5cJDMWpjMryPVaHoWv1gY8mM57JzQ2A3aTNYcPW7KqNPaUGQ1tyV/KGx1g /E2GvtUhBnQJ7ZwtYdPRjgr6zxp9QMSo1E44+b5f3xCqEa1iRzl3t0zLC+zxy578YpCd FHul27vfA33qZvoNdNggiYY2rwJB66MtMCVzC9maEtFmB6xNMyMEyFvxKCZuHUbJVy7F bX8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=kYtSXHpt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s15-20020a170902a50f00b0015a7e9bbe73si3120289plq.425.2022.06.01.13.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:31:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=kYtSXHpt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 31A2026EE8F; Wed, 1 Jun 2022 12:40:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347058AbiEaSbd (ORCPT + 99 others); Tue, 31 May 2022 14:31:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347060AbiEaSb2 (ORCPT ); Tue, 31 May 2022 14:31:28 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4D1769496; Tue, 31 May 2022 11:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1654021888; x=1685557888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=NcY+/RHrHOgS2GNME8uvnAPvcP1euOHTrg8mlxIo820=; b=kYtSXHptzVChWU6vewXWlcVVjFcfFc9hmo0al+TEmUa1wlUc9iqxHhJd hthojrZ2HIvhW78zIrIMqiIiBzckyzCks/gGgaY5BpPToLkfDEznf83y+ k6RxtHxNM7wz+ZxaorHaqD41ExiE3RRh3BrwYSGVEiNQ0SuDz05wlKRrF U=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 31 May 2022 11:31:27 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 11:31:27 -0700 Received: from nalasex01b.na.qualcomm.com (10.47.209.197) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 31 May 2022 11:31:26 -0700 Received: from codeaurora.org (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 31 May 2022 11:31:24 -0700 From: Manaf Meethalavalappu Pallikunhi To: Sebastian Reichel CC: , , , Subbaraman Narayanamurthy , Manaf Meethalavalappu Pallikunhi Subject: [RESEND 2/2] power_supply: Use of-thermal cdev registration API Date: Wed, 1 Jun 2022 00:00:54 +0530 Message-ID: <20220531183054.6476-2-quic_manafm@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220531183054.6476-1-quic_manafm@quicinc.com> References: <20220531183054.6476-1-quic_manafm@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 With thermal frameworks of-thermal interface, thermal zone parameters can be defined in devicetree. This includes cooling device mitigation levels for a thermal zone. To take advantage of this, cooling device should use the thermal_of_cooling_device_register API to register a cooling device. Use thermal_of_cooling_device_register API to register the power supply cooling device. This enables power supply cooling device be included in the thermal zone parameter in devicetree. Signed-off-by: Manaf Meethalavalappu Pallikunhi --- drivers/power/supply/power_supply_core.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 74623c4977db..4593450920a4 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -1157,9 +1157,15 @@ static int psy_register_cooler(struct power_supply *psy) for (i = 0; i < psy->desc->num_properties; i++) { if (psy->desc->properties[i] == POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT) { - psy->tcd = thermal_cooling_device_register( - (char *)psy->desc->name, - psy, &psy_tcd_ops); + if (psy->dev.parent) + psy->tcd = thermal_of_cooling_device_register( + dev_of_node(psy->dev.parent), + (char *)psy->desc->name, + psy, &psy_tcd_ops); + else + psy->tcd = thermal_cooling_device_register( + (char *)psy->desc->name, + psy, &psy_tcd_ops); return PTR_ERR_OR_ZERO(psy->tcd); } }