Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6222653pxv; Thu, 29 Jul 2021 09:11:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOMw6bdJKRzGl+AmPj5eJ/0XZquxUZLTsjWIUMqG8DQOphcpz9p16z6qn5l6uYdU7vDL6y X-Received: by 2002:a92:cc85:: with SMTP id x5mr4414157ilo.266.1627575112688; Thu, 29 Jul 2021 09:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627575112; cv=none; d=google.com; s=arc-20160816; b=SII5Uu2b1dj+ERA4da6fDMo788IhKvEmoLuQ8ig0oqMlRizWt69VQc2cX0BJAk+e54 v/xCZ8y49iHepvFYFqumF0lgWaaOdrKkz3OdQevgVyBHkqqgfujl7x+c6zp2C5cStG7H 8AaxbjV2DB11en5nyhv0WKZEMS4l4HmvEaP4Jw4YBWJZP6TpLh5D3FfpqeBLO+FcP4++ 4H8GuikAvie+37CYmQaMKHPVTFkihUd1eFnaQ7W5Lg3GAtN0dX0iFWQJSLRZOKbcGMJM cAojh2vPBZeV2g7XS94qoG7PsEPQxoKJoGosQiTmMSCNoPTd6/Eoa4eyvFAvipWrqLcJ gJyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=684D+tUhb8kWZJlJkAUj3eMSfCCLGDabE9LfoZT1q9s=; b=pstZZCbV4gg2kqbw5cfVNNxFlMepqXGXsYFazi7csBAczXEl9BtqgDUHYQDk9fToSq BNvuCEWuAHCajxv7OIRnOANKtx21rTqyf7M9j3X3vq14KsRLQdLShHGDSTQpojgSJy0+ wxfbRi0rPucIFr3q2PiUnkygtsf6g5DLlyWfgiSN5m3IkfoYDIntOjqJWm6Hc7z+0UwW o0kigFWI4WWVGr0ecyZNngHZWpEGxSlyl5kZwvVw1C/Wb4JQWWJQ++kzBZQsa5IKiesu b/iMP+rZve5ugR2E4pasJRDmQt5huartdLGQLJlsxyuys/SY4UkjszRCrY4q4JRTYYf0 ucfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w21si3746442jah.86.2021.07.29.09.11.39; Thu, 29 Jul 2021 09:11:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229485AbhG2QKu (ORCPT + 99 others); Thu, 29 Jul 2021 12:10:50 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:44638 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232951AbhG2QIY (ORCPT ); Thu, 29 Jul 2021 12:08:24 -0400 X-UUID: 345792b1281a4c648a2d62ac9c720d2f-20210730 X-UUID: 345792b1281a4c648a2d62ac9c720d2f-20210730 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1695897104; Fri, 30 Jul 2021 00:08:18 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Jul 2021 00:08:16 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 30 Jul 2021 00:08:16 +0800 From: Hector Yuan To: , , , "Rafael J. Wysocki" , Viresh Kumar , Rob Herring , CC: , , Subject: [PATCH v13] cpufreq: mediatek-hw: Add support for Mediatek cpufreq HW driver Date: Fri, 30 Jul 2021 00:08:09 +0800 Message-ID: <1627574891-26514-1-git-send-email-hector.yuan@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The CPUfreq HW present in some Mediatek chipsets offloads the steps necessary for changing the frequency of CPUs. The driver implements the cpufreq driver interface for this hardware engine. From v12 to v13, there are two modifications. 1. Move related_cpus function to common place, so all performance-domain cpufreq driver can refer. 2. Make cpu resource init to each policy rather than per-cpu From v11 to v12, there are two modifications. 1. Based on patchset[1], align binding with scmi for performance domain(latest version). 2. Shrink binding example wording. From v8 to v9, there are three more modifications. 1. Based on patchset[2], align binding with scmi for performance domain. 2. Add the CPUFREQ fast switch function support and define DVFS latency. 3. Based on patchser[3], add energy model API parameter for mW. From v7 to v8, there are three more patches based on patchset v8[4]. This patchset is about to register power table to Energy model for EAS and thermal usage. 1. EM CPU power table - Register energy model table for EAS and thermal cooling device usage. - Read the coresponding LUT for power table. 2. SVS initialization - The SVS(Smart Voltage Scaling) engine is a hardware which is used to calculate optimized voltage values for CPU power domain. DVFS driver could apply those optimized voltage values to reduce power consumption. - Driver will polling if HW engine is done for SVS initialization. After that, driver will read power table and register it to EAS. - CPUs must be in power on state when doing SVS. Use pm_qos to block cpu-idle state for SVS initializing. 3. Cooling device flag - Add cooling device flag for thermal [1] https://lore.kernel.org/linux-devicetree/20210517155458.1016707-1-sudeep.holla@arm.com/ [2] https://lore.kernel.org/lkml/20201116181356.804590-1-sudeep.holla@arm.com/ [3] https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=c250d50fe2ce627ca9805d9c8ac11cbbf922a4a6 [4] https://lkml.org/lkml/2020/9/23/384 Hector.Yuan (2): dt-bindings: cpufreq: add bindings for MediaTek cpufreq HW cpufreq: mediatek-hw: Add support for CPUFREQ HW .../bindings/cpufreq/cpufreq-mediatek-hw.yaml | 70 ++++ drivers/cpufreq/Kconfig.arm | 12 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/mediatek-cpufreq-hw.c | 357 ++++++++++++++++++++ include/linux/cpufreq.h | 39 +++ 5 files changed, 479 insertions(+) create mode 100644 Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml create mode 100644 drivers/cpufreq/mediatek-cpufreq-hw.c