From patchwork Mon Jan 7 15:04:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Zeng X-Patchwork-Id: 10750731 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8F8B746 for ; Mon, 7 Jan 2019 15:32:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97F541FF2D for ; Mon, 7 Jan 2019 15:32:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BE9428433; Mon, 7 Jan 2019 15:32:56 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 CDFFD1FF2D for ; Mon, 7 Jan 2019 15:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727612AbfAGPcz (ORCPT ); Mon, 7 Jan 2019 10:32:55 -0500 Received: from asrmicro.com ([210.13.118.86]:22955 "EHLO spam.asrmicro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727226AbfAGPcz (ORCPT ); Mon, 7 Jan 2019 10:32:55 -0500 X-Greylist: delayed 1581 seconds by postgrey-1.27 at vger.kernel.org; Mon, 07 Jan 2019 10:32:54 EST Received: from spam.asrmicro.com (localhost [127.0.0.2] (may be forged)) by spam.asrmicro.com with ESMTP id x07F68ZS004027 for ; Mon, 7 Jan 2019 23:06:08 +0800 (GMT-8) (envelope-from yizeng@asrmicro.com) Received: from mail2012.asrmicro.com (mail2012.asrmicro.com [10.1.24.123]) by spam.asrmicro.com with ESMTP id x07F4Z8D003374; Mon, 7 Jan 2019 23:04:35 +0800 (GMT-8) (envelope-from yizeng@asrmicro.com) Received: from localhost (10.1.166.151) by mail2012.asrmicro.com (10.1.24.123) with Microsoft SMTP Server (TLS) id 15.0.847.32; Mon, 7 Jan 2019 23:05:00 +0800 From: Yi Zeng To: , , , , CC: Yi Zeng Subject: [PATCH] thermal: of-thermal: support to select governor in dts for thermal zone Date: Mon, 7 Jan 2019 23:04:39 +0800 Message-ID: <1546873479-20415-1-git-send-email-yizeng@asrmicro.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.1.166.151] X-ClientProxiedBy: mail2012.asrmicro.com (10.1.24.123) To mail2012.asrmicro.com (10.1.24.123) X-DNSRBL: X-MAIL: spam.asrmicro.com x07F4Z8D003374 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add the governor property parsing that defined in thermal zone node in dts. If define the governor property for one thermal zone, for example, governor = "step_wise", then parse and register the thermal zone will find and set the right governor, except the only choice of default governor. Signed-off-by: Yi Zeng --- drivers/thermal/of-thermal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 4bfdb4a..f9368f4 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -1024,6 +1024,7 @@ int __init of_parse_thermal_zones(void) struct thermal_zone_params *tzp; int i, mask = 0; u32 prop; + const char *name; tz = thermal_of_build_thermal_zone(child); if (IS_ERR(tz)) { @@ -1049,6 +1050,10 @@ int __init of_parse_thermal_zones(void) if (!of_property_read_u32(child, "sustainable-power", &prop)) tzp->sustainable_power = prop; + if (!of_property_read_string(child, "governor", &name)) + strncpy(tzp->governor_name, name, + THERMAL_NAME_LENGTH); + for (i = 0; i < tz->ntrips; i++) mask |= 1 << i;