From patchwork Mon Jan 14 16:34:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155551 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3857298jaa; Mon, 14 Jan 2019 08:35:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN4E6oLrrYLHN67BZt5UqVliofgwn6hQ90Xis48Aql0sb6bV6JUeLZKrzGj/dGj1Yi+m+Swy X-Received: by 2002:a65:4049:: with SMTP id h9mr23206461pgp.304.1547483756373; Mon, 14 Jan 2019 08:35:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547483756; cv=none; d=google.com; s=arc-20160816; b=KVeY4DcP1kvOl9+xhf5mFWYtcITEU6pdNkcH6blcMcD47Tz14IODiOU6j771jzbr/V R5bBC9OCpI4x8cTqx5Zud9L18GvKlkexOxq0ako9R56oL7ajlXFLdSA8yjJZVjBEmba+ UP3J8LuGC9+J4dnV8Q9d5OXumoaxzobgm8TO8h8Ft5U388adabB3tlChuTvNCUp5AnWt cUT8Ib2Jw/pZPalo7JLk+h/dfomty3jEKHHbjHFIcbQTK1P1XZJWjYg4dbWqmHht+YX+ TKB1/p+ABZXd7EysyIlZSH+hwSGwgtsNcvtMnxsMzl20yp3ubCC7C2A+5HgJhXxJgnE0 JUAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=B3U4dJNDxXU77aqEF/bd0F2FU2BzXMK0qQTt7fghjFA=; b=wHW7gGMbI/QFyAibNxKZL+qyYNef4syVNfOnXk5YXQfxzEN6e70blNXoEoHf/zLEZO k6htqYsTsHwOTEoLvsXAaseVgSYLzj3cS7V5P+P1Kwn+DOrr3DznxTeB21fEnUkAvhP6 d5SvefvdXEewei0DdRumQCkGiLVZAD+7SuHEJ11ctRef6MzUrmX3h/flnJOFRhAGx05Q mfvPykYuG1V4joGACGbQQc3UJ0Ez8HcrIy6SaqUQhJV9vTLScJViD5B+1V+Ze6olhx7w tbU/SqN0iG7oKphxytTCusPOT5rCBa5L86sE/jS/vqJBh1Nj/zvvjLS69ne1jMihUt51 l0Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B4M5RU4V; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t74si694417pgc.150.2019.01.14.08.35.56; Mon, 14 Jan 2019 08:35:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B4M5RU4V; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726759AbfANQfz (ORCPT + 11 others); Mon, 14 Jan 2019 11:35:55 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55671 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbfANQfz (ORCPT ); Mon, 14 Jan 2019 11:35:55 -0500 Received: by mail-wm1-f65.google.com with SMTP id y139so191659wmc.5 for ; Mon, 14 Jan 2019 08:35:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=B3U4dJNDxXU77aqEF/bd0F2FU2BzXMK0qQTt7fghjFA=; b=B4M5RU4V6n94aCrZUAH4F+wWJFxlWEjftqPmqqs9uGUOVv7uhSwYIroen676tDJlF5 hkQX2V22SJAdhYFTVYGk4RrPtxQGztGimctR6XBW5mrHdmQq0U/kYn+0S82kNAwq1FcA d9EtaVmC32Cva3n6CAu1Q77AuJ4mCqKHe7K0E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=B3U4dJNDxXU77aqEF/bd0F2FU2BzXMK0qQTt7fghjFA=; b=HqaYsixm6oaM/jJ7tG4lw7DcXecNwXeM7iBnf3Z6LWOzEo+V1bsRLz4j1LDg1SMxua y52OUSyY1LgjqJ0z53wWhCqXi2GvBPTaDaA1w16mfnFeOUSUybepOc46bF0Ot5cd/jf1 js4TdcceF7+pdFzAdRwm0PjIEo83op2YiVODQEmQ2XxMeeR6Grb1yVbSpecJjx8tc/3Y t6L59u/etjad+CHFqI6MgvI98aRROP1B42yZynJEizKY2Rn6U5u/XL+VP7jAZCI/9Jve E/eYs/GlyYuIo6j8kg2VTcxtynZ/nQxkB/F6f5MYmPcVetltbGUNmn6MxgIuVrrKU3Eu /ijA== X-Gm-Message-State: AJcUukc9t+EIrljUPfMlwkakyS2X14KlOmHEDQGVyBPCz6rpHUjupk3X H4whnFQaZbx9x4G7DTr7Hkn81g== X-Received: by 2002:a1c:aa0f:: with SMTP id t15mr12308049wme.108.1547483753190; Mon, 14 Jan 2019 08:35:53 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id w12sm65168974wrr.23.2019.01.14.08.35.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:35:52 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, "Rafael J. Wysocki" , linux-pm@vger.kernel.org Subject: [PATCH v1 01/10] cpufreq: Add thermal_cooling_device pointer to struct cpufreq_policy Date: Mon, 14 Jan 2019 22:04:53 +0530 Message-Id: <168294311714f269b1050bcbf5d3324eae0808f2.1547481320.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Several cpufreq drivers register themselves as thermal cooling devices. Adding a pointer to struct cpufreq_policy removes the need for them to store this pointer in a private data structure. We can then auto-register the cpufreq driver as a thermal cooling device from cpufreq core code. Signed-off-by: Amit Kucheria --- include/linux/cpufreq.h | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index c86d6d8bdfed..7d0cf54125fa 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -95,6 +95,11 @@ struct cpufreq_policy { struct cpufreq_frequency_table *freq_table; enum cpufreq_table_sorting freq_table_sorted; +#ifdef CONFIG_CPU_THERMAL + /* Pointer to the cooling device if used for thermal mitigation */ + struct thermal_cooling_device *cooldev; +#endif + struct list_head policy_list; struct kobject kobj; struct completion kobj_unregister; From patchwork Mon Jan 14 16:34:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155552 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3857985jaa; Mon, 14 Jan 2019 08:36:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN5sJQZLxzn0cDEJhckUyiA/6cspzhywMgEcf+Djm0O3Fbn+YV2LhrbrOWjSiclcFWKWF5nS X-Received: by 2002:a63:31cc:: with SMTP id x195mr23815229pgx.52.1547483794298; Mon, 14 Jan 2019 08:36:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547483794; cv=none; d=google.com; s=arc-20160816; b=utPrypcc/i3R05cp/94GFCdYGy2AlZCNESU1uPs5D/VMGQNXAM9N96Kjt6jm11VESQ 7LedWQ7eIgiWple/8xobHmqfZOAgSYkDmzh2HD0ck8I15q8rBJCPuqMKGSXmYm63iCqk /YYRBa09hzVUOfQJWMmP/512QGfpOHspizpblSxkiaGAzizCMMDHshJ4Qk7uEW+8hUiG XOLJMaIhTdgcjS/XXdbPh8p055Wa45nbjbSTk9VfoE6ocmlk3JPnJakiVjdi0Nx8gQMZ oFnucLPXpwJRpU833dkMIxhFJMuNXmNlHTqy9U4BxNMYvGYGuZ5cWFxknL9n5tmqzWMA sBEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=raje0KyJSfgQ1XlDTxNcMYQ5pbNyRq5aHVfsy61nUJY=; b=P5Z7mIcymk1e1EIMz5ttmqeMqDOx0FYfL8iMc+8FuPiAuBhWF6oIiDLisuq/COH8Me pXoL7nLlFXVAyl02w2i1QPyKTW56wezBxWyEvPHP7/1YH9Avhs8ppxemRPbIQ56C06i3 csXKvrLIzaE7DF/ZzRCcgPHU3nmxp5p1p3fOB5g2R9RK7MUDDAEJwOsOwKoV4XmTv+yJ KtwHafg5no0Nhx0Q20KZdZJdaos1qrK2eNIllPGhV3UXdU+Y+jB7BGVNuV7X+h+HiR4d mPTGERu0ZAiQPiwOqaZuSYj5L+vgl4JDq9S/aJtTI+iCy62nfSJ/lLbGlgXb7XcTQ6uV fa1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cD1FRQJ9; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si772851pfc.76.2019.01.14.08.36.34; Mon, 14 Jan 2019 08:36:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cD1FRQJ9; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbfANQgd (ORCPT + 11 others); Mon, 14 Jan 2019 11:36:33 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39576 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726656AbfANQgd (ORCPT ); Mon, 14 Jan 2019 11:36:33 -0500 Received: by mail-wr1-f65.google.com with SMTP id t27so23633195wra.6 for ; Mon, 14 Jan 2019 08:36:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=raje0KyJSfgQ1XlDTxNcMYQ5pbNyRq5aHVfsy61nUJY=; b=cD1FRQJ9YR5b0pY9h+iFZO5Qu66uT5l+f3/g0UlwezD4Nm21Mr0qEp89AKa8ZCsduo qnnMSZQEbjrf82PDdkpbDOvX+VURzTsa8nMTXJtSDk/ojD90Y2odKyIyd6wES5/N9zki qXNFRjl+o64wM5WEZ+3BYizUFbMV/ZZ056DnU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=raje0KyJSfgQ1XlDTxNcMYQ5pbNyRq5aHVfsy61nUJY=; b=UNDQ5szKBNjckPUgk/8LJy8rC8z3Vcuy0lsytUTK42FAoW6FzSNzIrinzpSxkYjWuS x6pTUVK2fJpQ5hdQ0TYtGq3iueKDrkaEphVehs5II84/5Tiu4AQ9Xdzpw30oMRXnB4wq xMqR+AvrOK9h9AyKGYCVAPns1dNLp/+DZth5/vkUTAW/MOcKM1Ohxb9wQKXsnUAZz9W+ lig5m1VwlXWIDjwqjpbDfo5liaTNRux/zDHjP2vP4wokD+c6Rkqj/IjThpVKgSHgPNLc rAmGy2zwtdPv0EadgyQzNZ9mBfyoI3YvOQH+nQ0zRktmwmu2bC5qvH7DmBU4H+LfzQlP XQGg== X-Gm-Message-State: AJcUukdt2EkqHLDh86OIqPn6K2WpkCchGiYlMPLjqjXnHrdRk7x7HORh NN+x+dA+7AhSmJlqah5Knt4LFg== X-Received: by 2002:adf:f091:: with SMTP id n17mr22754144wro.292.1547483791612; Mon, 14 Jan 2019 08:36:31 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id o82sm26166937wmo.29.2019.01.14.08.36.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:36:30 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, "Rafael J. Wysocki" , linux-pm@vger.kernel.org Subject: [PATCH v1 02/10] cpufreq: Add a flag to auto-register a cooling device Date: Mon, 14 Jan 2019 22:04:54 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org All cpufreq drivers do similar things to register as a cooling device. Provide a cpufreq driver flag so drivers can just ask the cpufreq core to register the cooling device on their behalf. This allows us to get rid of duplicated code in the drivers. Suggested-by: Stephen Boyd Suggested-by: Viresh Kumar Signed-off-by: Amit Kucheria --- drivers/cpufreq/cpufreq.c | 17 +++++++++++++++++ include/linux/cpufreq.h | 6 ++++++ 2 files changed, 23 insertions(+) -- 2.17.1 Reviewed-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6f23ebb395f1..cd6e750d3d82 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -30,6 +30,7 @@ #include #include #include +#include static LIST_HEAD(cpufreq_policy_list); @@ -1318,6 +1319,14 @@ static int cpufreq_online(unsigned int cpu) if (cpufreq_driver->ready) cpufreq_driver->ready(policy); +#ifdef CONFIG_CPU_THERMAL + if (cpufreq_driver->flags & CPUFREQ_AUTO_REGISTER_COOLING_DEV) { + struct thermal_cooling_device **cdev = &policy->cooldev; + + *cdev = of_cpufreq_cooling_register(policy); + } +#endif + pr_debug("initialization complete\n"); return 0; @@ -1411,6 +1420,14 @@ static int cpufreq_offline(unsigned int cpu) if (has_target()) cpufreq_exit_governor(policy); +#ifdef CONFIG_CPU_THERMAL + if (cpufreq_driver->flags & CPUFREQ_AUTO_REGISTER_COOLING_DEV) { + struct thermal_cooling_device **cdev = &policy->cooldev; + + cpufreq_cooling_unregister(*cdev); + } +#endif + /* * Perform the ->exit() even during light-weight tear-down, * since this is a core component, and is essential for the diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 7d0cf54125fa..70ad02088825 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -390,6 +390,12 @@ struct cpufreq_driver { */ #define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING (1 << 6) +/* + * Set by drivers that want the core to automatically register the cpufreq + * driver as a thermal cooling device + */ +#define CPUFREQ_AUTO_REGISTER_COOLING_DEV (1 << 7) + int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); From patchwork Mon Jan 14 16:34:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155553 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3858590jaa; Mon, 14 Jan 2019 08:37:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN6dLlmogc7+iFOS9VB3L29pg7JJg/u609XkVmd0XIKEWng6oCVZQHp+CSUsFVbOsKpeseI8 X-Received: by 2002:a62:16d6:: with SMTP id 205mr26055188pfw.256.1547483830347; Mon, 14 Jan 2019 08:37:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547483830; cv=none; d=google.com; s=arc-20160816; b=D1N4Zs1difXMgAbGyH+aLaOWi4U1Vc6kbZ9lEmpDUrK1/JhTo/N/ppQxhGiP2KQ7Kf hptS8Etu4o1veVc3qjZB05dcvPBpTeHEwHO/zkLaz4uHSb6sLwmdZp+oBtpTCZq+LMk3 +PkqO3rt7J2YE5GsXC3xbkOrtx7XWOpzbxID7zAYT4UgGGecwIgeGz++NTYjFIued3hu Vv7k8fnZcUa7L6Dw4rK9ITUvSlWVM1/Eu9I5Tb1J9K0fyVxQgHimUDShpWsAuEndIL4o qkvCIlQCX9X4FZj5VVvydPWs3aIqluFrAAlzcD9f9B7QfhlcMvM6Q4fHnJXyOGDsBSsb /mXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=l9DFr+fvRp4XNuqC48f1qHOGOAXrzlsaBjEr2TKjUhQ=; b=Tyf3GLzefUN25aUJynKAjrfi3OBHroUiULdYoe/4GkjB7LhnLKs6ZUJ5I30nyDcUTJ tXQU6sJWt+Uy2tNaoL0pWnr1c+Jt9M/zT+03kvWfIqWvF28eWOzbVaNWYOcAlqDZa95Q x9Z+FJxRqQ0RaI1sKsNykGVIkY/K5zhou3G4AMr6IhseP4E0OorVnlIiQCFnieAtKeSx tI089vS52HOAdO0I/l9RqBnaS+XXctFCXwOvYN2fDbMLCKCASSwqnaTPCPKYjiHrchhO QUtZYVK9aoq/TXxTwtDDUabOTIhaARrH8sOUmMcUbBZgKg4dw++k7uNWDZwfxDgxVxfk 2z3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGUVocul; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az11si683520plb.386.2019.01.14.08.37.10; Mon, 14 Jan 2019 08:37:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGUVocul; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726678AbfANQhJ (ORCPT + 11 others); Mon, 14 Jan 2019 11:37:09 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52503 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbfANQhJ (ORCPT ); Mon, 14 Jan 2019 11:37:09 -0500 Received: by mail-wm1-f68.google.com with SMTP id m1so223289wml.2 for ; Mon, 14 Jan 2019 08:37:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=l9DFr+fvRp4XNuqC48f1qHOGOAXrzlsaBjEr2TKjUhQ=; b=YGUVoculVhQysuFRCsbNQIiuVYcvjY66Xe4LX7+xPF4IZ0rwm+fSRC1vVJOXzj2Uvb f+U8eciraYxPS23uQq3cV+ESE8UN/YkgMGzPPe2JLu+IVaU3VADFmzv8VnRv2LsO3G52 JdjSynt3qW7rv7JphYeUlgzo3OwuufWD8DXdc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=l9DFr+fvRp4XNuqC48f1qHOGOAXrzlsaBjEr2TKjUhQ=; b=fsjXBdbKD6haFqwbx8NflOgf8OSZxDvOBojJILJBRLq16Tr846sg9awUg1tP/WLeiE qN9QQVerMjikMLb9IxzWa796fsZt1M1f+3amw0H6gvMgCZWsXdmm/NxMduI3h9TsgA6Q r3awMWogWyVYQ9PtVP3wmOZka5HF9vurvMNUneD8BpP2UIjY0HCoc7cwcxkrJIcPTIG2 wiyyDaHzYSZ6Q2s+omMsrH/acG72mOD1U51GhYmk1YCfZee7z5ScF054ZP76j/Zddjpn r/pEBOY5cBUzqCVvVIyefi3TutFI0rvbeTGd7d4PadbdpyB4ZXZQMDMo8Qv/GX82galH NyiA== X-Gm-Message-State: AJcUukdjZfWM8Ut2pN1hXJN/tk4tFwCMeP7F0XfqJOWOQt8QkZ9EeWHi iD1oGfaOywduGBipDHyuTXmO+w== X-Received: by 2002:a1c:400b:: with SMTP id n11mr12940185wma.85.1547483826284; Mon, 14 Jan 2019 08:37:06 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id h16sm152392640wrb.62.2019.01.14.08.37.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:37:05 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, "Rafael J. Wysocki" , linux-pm@vger.kernel.org Subject: [PATCH v1 03/10] cpufreq: Replace open-coded << with BIT() Date: Mon, 14 Jan 2019 22:04:55 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Minor clean-up to use BIT() and keep checkpatch happy. Clean up the comment formatting while we're at it to make it easier to read. Signed-off-by: Amit Kucheria --- include/linux/cpufreq.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) -- 2.17.1 Reviewed-by: Stephen Boyd diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 70ad02088825..ea303dfd5f05 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -351,14 +351,15 @@ struct cpufreq_driver { }; /* flags */ -#define CPUFREQ_STICKY (1 << 0) /* driver isn't removed even if - all ->init() calls failed */ -#define CPUFREQ_CONST_LOOPS (1 << 1) /* loops_per_jiffy or other - kernel "constants" aren't - affected by frequency - transitions */ -#define CPUFREQ_PM_NO_WARN (1 << 2) /* don't warn on suspend/resume - speed mismatches */ + +/* driver isn't removed even if all ->init() calls failed */ +#define CPUFREQ_STICKY BIT(0) + +/* loops_per_jiffy or other kernel "constants" aren't affected by frequency transitions */ +#define CPUFREQ_CONST_LOOPS BIT(1) + +/* don't warn on suspend/resume speed mismatches */ +#define CPUFREQ_PM_NO_WARN BIT(2) /* * This should be set by platforms having multiple clock-domains, i.e. @@ -366,14 +367,14 @@ struct cpufreq_driver { * be created in cpu/cpu/cpufreq/ directory and so they can use the same * governor with different tunables for different clusters. */ -#define CPUFREQ_HAVE_GOVERNOR_PER_POLICY (1 << 3) +#define CPUFREQ_HAVE_GOVERNOR_PER_POLICY BIT(3) /* * Driver will do POSTCHANGE notifications from outside of their ->target() * routine and so must set cpufreq_driver->flags with this flag, so that core * can handle them specially. */ -#define CPUFREQ_ASYNC_NOTIFICATION (1 << 4) +#define CPUFREQ_ASYNC_NOTIFICATION BIT(4) /* * Set by drivers which want cpufreq core to check if CPU is running at a @@ -382,19 +383,19 @@ struct cpufreq_driver { * from the table. And if that fails, we will stop further boot process by * issuing a BUG_ON(). */ -#define CPUFREQ_NEED_INITIAL_FREQ_CHECK (1 << 5) +#define CPUFREQ_NEED_INITIAL_FREQ_CHECK BIT(5) /* * Set by drivers to disallow use of governors with "dynamic_switching" flag * set. */ -#define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING (1 << 6) +#define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING BIT(6) /* * Set by drivers that want the core to automatically register the cpufreq * driver as a thermal cooling device */ -#define CPUFREQ_AUTO_REGISTER_COOLING_DEV (1 << 7) +#define CPUFREQ_AUTO_REGISTER_COOLING_DEV BIT(7) int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); From patchwork Mon Jan 14 16:35:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155558 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3864137jaa; Mon, 14 Jan 2019 08:42:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN6gl6ohzeZpnSf/8wzVTKTgXtmJhywrr9xwPJ+pZ4g6cukfqVsgKs4XGyNM3ZtUKChoHbMj X-Received: by 2002:a62:9683:: with SMTP id s3mr26061909pfk.60.1547484161557; Mon, 14 Jan 2019 08:42:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547484161; cv=none; d=google.com; s=arc-20160816; b=TyAR+iyGs/HI9YUaKkSrJvAYEQL5nt5gpuHaubbpiHhOIkbxCsKq2Y56RJW9a2q9sS +gPqDNWattHXTECIly9rG/v39vpoSdkkeuQW3KpJLziyTigtL7KNq/69Ws+rj8pT6Rwg ZhJDtcFg9hGsJ+Xv8k1/TstMxyqxKxw5dcHIvbCcOCJP2g7pM14I7pmwL7Zax8bYRckK uM4q0wWxMHm9ihOcu8j0XLJyO7u4aYVFaYr+cI9TN4k8QgWHZ+j3wt162TNIKDqN+h9/ NT8GP9TGCUCqTEJRZdmdrFEjiWCD57F1ONjfAWv66HLQizHPhMWTWXnj+y/OTG45gAwI /fhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=T0qbmuuRPxDVtPya/S7z9HnIzaHUQLSLFndkXz9dAlg=; b=eWis/hqFp4xtmF4JLMm/uE9kt9i2e16EndJaVX5oheT9PJaivEwf5Kl5HwOCRGUpA+ qxsuWeIjTs8Kqa++By9x08nmIrlJq3/H2GMA4LyDJeebBWhmN2w+oO20mE77H9IKNdtw 1PTH3/wtxpq/GAwfVa0xJebrXMKA9wFMkpkkZ4IboxkUy5C7KjZR9exOM3wvd5Qs91TD G6TLPtSKM7HOVGaN89WgP90T3j3TbBQGvd6y8B5NKSmQzkILGPmJg/GPG/m9M84R+J/z gSLv+qR233spXPQZ70Q+oQUPISaOy621VGlACNX173IQPshYcxSR4y6vrsSVJSWnKbUG 5izw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hUR5lnVQ; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si735235pgd.228.2019.01.14.08.42.41; Mon, 14 Jan 2019 08:42:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hUR5lnVQ; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726765AbfANQmk (ORCPT + 11 others); Mon, 14 Jan 2019 11:42:40 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34242 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbfANQmk (ORCPT ); Mon, 14 Jan 2019 11:42:40 -0500 Received: by mail-wr1-f65.google.com with SMTP id j2so23757751wrw.1 for ; Mon, 14 Jan 2019 08:42:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=T0qbmuuRPxDVtPya/S7z9HnIzaHUQLSLFndkXz9dAlg=; b=hUR5lnVQxUsyQqZ4Em0vpOTZK9O9zFAw0JABe/OkS6Qpz/WFaSndphU2Parq875aPr gs1kgLl0WEYPvYB/8xZBtnZqUkSqFKvjMuXBwn05KtYpaLI30C5Nt2ytaQk+t4kIOCi0 f9tgxnuO7EZX7EmA1UgdESuBqgvbuMFcq86HA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=T0qbmuuRPxDVtPya/S7z9HnIzaHUQLSLFndkXz9dAlg=; b=rbRVRDa3qu4DweoVsHvm9UBBI/6e50UFKd3Pa+KQEiDYBg27SqrjZRZAHV9w9+fAKE /yJbYwTrkJGXDnm7MGvDk0PBmr9PSvXtfi6UR+UG9rjYtgGaJ/sz8vrNDw2B9kjrLmTN nx8mQXc4XQzP4y75geM4HEdTbyjWsT1Lr2qNN02g3AjzpuHrQLkcaDB2478pC/P/9vgX PN6SqXz1Cg4HjpUcVkq2AVSAGwjTcOo6neqMez7R5Cuv0Yp1w9XiLjwCFTiwrfYZIu/Q kp9r81l4gdPPRVSgb04p9SxXtF36EOA/nwHSqvj4UY7AkUl0UmXT+TAtMSg6RHWQVVsn 748g== X-Gm-Message-State: AJcUukc+qGLfRNKkcVG/TVmsWy2MjM/eyWNDqg1K4nVdJeF39Q4yLuys SKxCQsN1nc5WQfbewhakZ/buXw== X-Received: by 2002:adf:92a4:: with SMTP id 33mr24707627wrn.11.1547484158818; Mon, 14 Jan 2019 08:42:38 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id h17sm70359262wrt.59.2019.01.14.08.42.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:42:38 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, "Rafael J. Wysocki" , Tang Yuantian , linux-pm@vger.kernel.org Subject: [PATCH v1 08/10] cpufreq: qoriq: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:05:00 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use the CPUFREQ_AUTO_REGISTER_COOLING_DEV flag to allow cpufreq core to automatically register as a thermal cooling device. This allows removal of boiler plate code from the driver. Signed-off-by: Amit Kucheria --- drivers/cpufreq/qoriq-cpufreq.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c index 3d773f64b4df..b206e6cb55f0 100644 --- a/drivers/cpufreq/qoriq-cpufreq.c +++ b/drivers/cpufreq/qoriq-cpufreq.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -31,7 +30,6 @@ struct cpu_data { struct clk **pclk; struct cpufreq_frequency_table *table; - struct thermal_cooling_device *cdev; }; /* @@ -239,7 +237,6 @@ static int qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy) { struct cpu_data *data = policy->driver_data; - cpufreq_cooling_unregister(data->cdev); kfree(data->pclk); kfree(data->table); kfree(data); @@ -258,23 +255,15 @@ static int qoriq_cpufreq_target(struct cpufreq_policy *policy, return clk_set_parent(policy->clk, parent); } - -static void qoriq_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct cpu_data *cpud = policy->driver_data; - - cpud->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver qoriq_cpufreq_driver = { .name = "qoriq_cpufreq", - .flags = CPUFREQ_CONST_LOOPS, + .flags = CPUFREQ_CONST_LOOPS | + CPUFREQ_AUTO_REGISTER_COOLING_DEV, .init = qoriq_cpufreq_cpu_init, .exit = qoriq_cpufreq_cpu_exit, .verify = cpufreq_generic_frequency_table_verify, .target_index = qoriq_cpufreq_target, .get = cpufreq_generic_get, - .ready = qoriq_cpufreq_ready, .attr = cpufreq_generic_attr, }; From patchwork Mon Jan 14 16:35:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155559 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3864695jaa; Mon, 14 Jan 2019 08:43:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN5/eVBQXbIu+nx4si/IaIktckhCsm4uUPPqma7ZMV6f70eTonavRIUUGJ3hTN7lX1X/hDc3 X-Received: by 2002:a63:160d:: with SMTP id w13mr24177003pgl.43.1547484194807; Mon, 14 Jan 2019 08:43:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547484194; cv=none; d=google.com; s=arc-20160816; b=JEiaz4aG/b3YbIeTc/C0Wbu8NfHOFEpGaxu/BOHUmVC3q82VwLpfDSREyMnh12gsfZ zX6God9RGtT644MJ7nGZ1v1W93il2gVJC/v7WAgCBOdLhlFAz+PqHrci1P9cZGsAyVM2 ykCTgN3Qze9UVATVfaKjUECpe0PxlxxQay0YfuZBKUTDPN7AUWEX3zspQOtJWwBv3zsb G7jwoj48WhIRQi1FaDH62/EcFA+F9N37bYVEcec+jRgd90C9VPyFwZOfcCS+sQYW0R0N KpNc0QVw9EAv68lA6nubd9Othc1AXpq6Vvza47Ih8cZOwZZVlL/YfLHAfxfNSUaNFASm MArQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=mDodrn+SCjmkCblcpvbM4z/vNhnHCT5BvbpgksmUkgc=; b=XBQ4rsApJgYu1nGJN18mQH0yWCyiAC9U/31u4xTYTny3AXtDPjlzApWsyJ1pnSmx9W anZ2Mo1qlXnikGgfnT9CfiaV5+Ea9MxR4R4qHFSNMtidjHMS4swISHDmo2W2+MhS3Jtv kxoRfOO52iu+cmDXXcG8bOtmk+MuWx3XFzprOlysLbiBiDSNLEX/uph2+IEDrxY9dwRm pabRf6JgNOzfWXuHXoYlKYjjxJSmYbY54CMnI/oAn4NAXD30h3hsEe1EWTaWHq82mtpF Qq1sHxWq/jq4pCejtXS6D0TBZ6kiJKMYomvcqwn8GnDRlHioWZmySMq9puPzMEgNoOYK RAIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fhy70gTL; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f90si677898plb.362.2019.01.14.08.43.14; Mon, 14 Jan 2019 08:43:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fhy70gTL; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726779AbfANQnO (ORCPT + 11 others); Mon, 14 Jan 2019 11:43:14 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33005 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726724AbfANQnN (ORCPT ); Mon, 14 Jan 2019 11:43:13 -0500 Received: by mail-wr1-f66.google.com with SMTP id c14so23769209wrr.0 for ; Mon, 14 Jan 2019 08:43:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=mDodrn+SCjmkCblcpvbM4z/vNhnHCT5BvbpgksmUkgc=; b=Fhy70gTL0OMX9xMLnahPm61C2gyyRa/Xm4VRechtSjnkGyMbcPSkmfRt3cnQNNqQQ7 8fc921xreoiDTRnUNG8vNvQGRtCba0fQmxktSO/vqXw2OhKGxHwXekV7VUmqX6pZRXgW A7SLloAtz9L09a9i5Yvv0XYBV2Ma17qDbQuVQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=mDodrn+SCjmkCblcpvbM4z/vNhnHCT5BvbpgksmUkgc=; b=sbzAoe9SCY3VyCb72z2C/GnX/pe9GVG83KTdFQyffP80zzEzFvFmHCcpz12bOCrKKe qEor3KzkzkxSzmSmbgwJAPU+UaiXFO9aj0//id2Ub3RQCwULAZzSM35HvglyrJngUrxn UZKF9h48pWetvZU166fmLClxWYjMXIgvN17LHIWp0SlQqEWiod7nD+55+4wbRl15EkA0 eYIVPb3KVW9oqTGwJqbopP7AkXI44ILcN1egKU3Fvqf8oeRFJTW2X2SIVP5q384vvX5C JCEjwzpjU2u58OsBnprPKz5QGpu87QFbZOnoSBMD4yjVcrOZXCLZbngFKXBpqBndmPbD YZBQ== X-Gm-Message-State: AJcUukcYpd5/nkjAmLEonbKaNEqQzBM/c1QzAQ2VmHmxlZiTAfqoVntI QoZrO6nnOuW2EHDQYZ80WJz63XqXkUU3sQ== X-Received: by 2002:a5d:45d0:: with SMTP id b16mr23989728wrs.86.1547484192218; Mon, 14 Jan 2019 08:43:12 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id s132sm12237023wmf.28.2019.01.14.08.43.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:43:11 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, Sudeep Holla , "Rafael J. Wysocki" , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v1 09/10] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:05:01 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use the CPUFREQ_AUTO_REGISTER_COOLING_DEV flag to allow cpufreq core to automatically register as a thermal cooling device. This allows removal of boiler plate code from the driver. Signed-off-by: Amit Kucheria --- drivers/cpufreq/scmi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 50b1551ba894..f062a84a1175 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -22,7 +21,6 @@ struct scmi_data { int domain_id; struct device *cpu_dev; - struct thermal_cooling_device *cdev; }; static const struct scmi_handle *handle; @@ -185,7 +183,6 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) { struct scmi_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); kfree(priv); dev_pm_opp_cpumask_remove_table(policy->related_cpus); @@ -193,17 +190,11 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void scmi_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct scmi_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver scmi_cpufreq_driver = { .name = "scmi", .flags = CPUFREQ_STICKY | CPUFREQ_HAVE_GOVERNOR_PER_POLICY | - CPUFREQ_NEED_INITIAL_FREQ_CHECK, + CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_AUTO_REGISTER_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .attr = cpufreq_generic_attr, .target_index = scmi_cpufreq_set_target, @@ -211,7 +202,6 @@ static struct cpufreq_driver scmi_cpufreq_driver = { .get = scmi_cpufreq_get_rate, .init = scmi_cpufreq_init, .exit = scmi_cpufreq_exit, - .ready = scmi_cpufreq_ready, }; static int scmi_cpufreq_probe(struct scmi_device *sdev) From patchwork Mon Jan 14 16:35:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155560 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3864981jaa; Mon, 14 Jan 2019 08:43:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN70klPpXglFWbVKkx5VVobKX4+ftlcvqPK2YnNQUBtVwZ7tGO5rIyKxcwx2zIOCnRL8FKGy X-Received: by 2002:a63:61c8:: with SMTP id v191mr23866979pgb.242.1547484212358; Mon, 14 Jan 2019 08:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547484212; cv=none; d=google.com; s=arc-20160816; b=H3mSjuG4UVxNtRb8B/636sRWKBqWNzZ50Mw91J+7/HrCzGVfOnf1nVRh5aaHMEawTr Me6ZDjbx1H4sUUJgG1nUBko6od0tnnuonR9f1Iq76JvchkqTg/7GGSgw7w465VSuUYks f6IKkA/GXXQzkdzwFVfLkHnGGI+mzGbAgbP9GewGD2fxfcX7MrGNE/BGYEhdHUGYjG5B g200rMRs8Fq1xxZrwc2MpO+zy+EU1J5fRRMFVQvJBGZIiQmlQqWg/g4e4y/4bpRCK0Hu HLcPNUfWNSeLW5d+7b+j96ILyBwDSgh5phwFIUWZ97Ho/srWldR+RXMPVel+qiQoVZW9 1ILw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=8jUWUXinqrIEk2wbCrHnyISvXX2O3vcX46RGBCRFza8=; b=i679NcoCpEHNrvjsvo4TFIsa7XbihX7KP9pEg+hSdEewViAybNYDw5ZNCPmoj3HWIW soop8QZz3WensYHk9EpyoWl+T8+T7gFUv8fjeDdJJ2DB6dzlXwre2IJ8VsaDacdwIPjR ACY7TjK2cukWXEZN7bnposY8e7Kv6Qu2TWe++PKo2AiOhuwjgQ10j2JT8l5tEq+beCbo njD8d35DlejqoyimKtLmMi7giTu8c4eigGDrK0NuMHbb1qxPPx74iyT5NwOT0ba+WgdO /m6mqqL6VMwoIElphgW8uDGqwC0+Wi2i4Vr0x3+eShBF2g097q7oLf4z9z9hIPQ4lEoi emCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CZRSEX9x; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13si682044pgi.531.2019.01.14.08.43.32; Mon, 14 Jan 2019 08:43:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CZRSEX9x; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726786AbfANQnb (ORCPT + 11 others); Mon, 14 Jan 2019 11:43:31 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40561 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726942AbfANQna (ORCPT ); Mon, 14 Jan 2019 11:43:30 -0500 Received: by mail-wr1-f65.google.com with SMTP id p4so23672543wrt.7 for ; Mon, 14 Jan 2019 08:43:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=8jUWUXinqrIEk2wbCrHnyISvXX2O3vcX46RGBCRFza8=; b=CZRSEX9xhalKjgqG4U+P2MSdMyDo7y7Xr/ytxGZM78A+F/9DrRIo/KhQWHyj5c1d9U i7GpifF0VdNNm1c/Ky6ueBZzsUWSqv1swnoeLzzbJJIe6CwwmAHNO2t6g0/JRxI3QeEk 0VHkhylq59Tre+6qsnnEjgjbSOedrDEZjKMFM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=8jUWUXinqrIEk2wbCrHnyISvXX2O3vcX46RGBCRFza8=; b=ZBoeonYm8B/2dDfWyoDiR+QY64EPjSW/DJuG0Q89rtSruqfqjAufslT46Xg4PWK5mW Y5DJuaQNOblw519LfcjbtxLvoZAg9taGgy68hUTiMGSuhvm+RbI1QCyNF01Dv3DKuTyc dpmfsJB3WDLiHprsfn8lnsHzcFSJM7qnZabxYAv30vKxDrTjJaVxes8Aqb1naW83G9g4 C+emTtWpzkdJ7ob+4FfXbWXALnITW5tA9SoHkqZK76HgzTYsD1j+Vt15aCnLPaM5h9dk DrnxJU83YpT0igqv6NZFOdKkVZVj9z4AvpEGBhqPm5MLEYFz5ojt/V9ivg2vLr//kYyS xiqg== X-Gm-Message-State: AJcUukfldi3vG/xQvsAAdSN3QFO6qWlcCX4rcir9Su7YLuaL/vtkXlc+ xM30RycTqsCJx7TLTxa3jxRm4w== X-Received: by 2002:adf:80cf:: with SMTP id 73mr25037001wrl.57.1547484208974; Mon, 14 Jan 2019 08:43:28 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id f10sm7842762wmb.35.2019.01.14.08.43.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:43:28 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, Sudeep Holla , "Rafael J. Wysocki" , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v1 10/10] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:05:02 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use the CPUFREQ_AUTO_REGISTER_COOLING_DEV flag to allow cpufreq core to automatically register as a thermal cooling device. This allows removal of boiler plate code from the driver. Signed-off-by: Amit Kucheria --- drivers/cpufreq/scpi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c index 87a98ec77773..c01c63a342c9 100644 --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -34,7 +33,6 @@ struct scpi_data { struct clk *clk; struct device *cpu_dev; - struct thermal_cooling_device *cdev; }; static struct scpi_ops *scpi_ops; @@ -186,7 +184,6 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) { struct scpi_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); clk_put(priv->clk); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); kfree(priv); @@ -195,23 +192,16 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void scpi_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct scpi_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver scpi_cpufreq_driver = { .name = "scpi-cpufreq", .flags = CPUFREQ_STICKY | CPUFREQ_HAVE_GOVERNOR_PER_POLICY | - CPUFREQ_NEED_INITIAL_FREQ_CHECK, + CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_AUTO_REGISTER_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .attr = cpufreq_generic_attr, .get = scpi_cpufreq_get_rate, .init = scpi_cpufreq_init, .exit = scpi_cpufreq_exit, - .ready = scpi_cpufreq_ready, .target_index = scpi_cpufreq_set_target, };