From patchwork Sat Jan 21 11:29:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 645511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DCF7C38141 for ; Sat, 21 Jan 2023 11:29:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229814AbjAUL34 (ORCPT ); Sat, 21 Jan 2023 06:29:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjAUL3x (ORCPT ); Sat, 21 Jan 2023 06:29:53 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16EF93B3DC; Sat, 21 Jan 2023 03:29:51 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id y11so9450891edd.6; Sat, 21 Jan 2023 03:29:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=tQtA9gnXbHiCVZ0cdHgz61/mVXx++tAhOoDuPrap8Z8=; b=IrfWZ6nnGNuKzRQyWZxpXbc/uAwXN43BQn8gO3yrJq2u3+D/z8GgtpgGunHjw7ig5o pbJ8RLv0KPCELe3aZpmvWDkSnx0R2vaOT0K8hMNZ9qONHT+Nz6pquv5j0JNGDSx0jLb8 mlntWNQt3gvIbnQrVG+p6iOGnxyARi05vZnjC6aiPspZReA/kCrUlRI7scCaXJB9TdXO 0RftYK4T6hdaTXHH86j+ZHaJtPB5WYueVscMBR3jz0io+Jof3qcYptT8dxBw762lYnTy d7+T8gctiDul0KmQVJ1s8ShAo9X5HKbNCHSIB7qGXhlkDl1vLVlMn2EobIfVzYXPGntD U2Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tQtA9gnXbHiCVZ0cdHgz61/mVXx++tAhOoDuPrap8Z8=; b=rI7//64ZdgKn9b1XfLm9YzUkJmDRBi9kQFbHZ7X62/V0g82KhIpSn3HQELIufuuOOI Q0mOkb3uOAgh49RkObKaV8z4X7A0yzY7yAusZmywN7qHz8fesYRz7N+1WXWxNpG75hPL 4ePwNtZ3PvTEtEJ8/SEI8ImP8tVody0j3pXjUAoCKhmCBxVZs+xWthxsiDY249GPupRD ogDzOgmeodk3Jd9OeLFP6uBN6Mkxxl8FOxNsJMdYzvG17/2EFm0jpQDiAOYhWIHgbDsn 3IZ5ozmiRiQfYb+tjxXLoC9zd9bngUFFypz9sS6EmYf9V+W++KQoik2azptFGeSeTMFz 5mpg== X-Gm-Message-State: AFqh2kqoVFpQ242MUI6HF3jS+SRKTXmPnP++e7x2++oJOVMu6ww/RUK6 TGxgx3HtrHvYko9qMbGowx4= X-Google-Smtp-Source: AMrXdXtMK0T0DTiO6dazvK4Gi14KKO6u4xEFwf3TbeONxFRnhsCY1K0ZzvDUaYtLmDLP9uhEZrVYRQ== X-Received: by 2002:a05:6402:2055:b0:479:6c4f:40df with SMTP id bc21-20020a056402205500b004796c4f40dfmr16794615edb.18.1674300589520; Sat, 21 Jan 2023 03:29:49 -0800 (PST) Received: from fedora.. ([188.252.220.152]) by smtp.googlemail.com with ESMTPSA id d26-20020a056402401a00b0046c7c3755a7sm5152151eda.17.2023.01.21.03.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 03:29:48 -0800 (PST) From: Robert Marko To: ilia.lin@kernel.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Robert Marko Subject: [PATCH 1/4] soc: qcom: socinfo: move SMEM item struct and defines to a header Date: Sat, 21 Jan 2023 12:29:44 +0100 Message-Id: <20230121112947.53433-1-robimarko@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Move SMEM item struct and related defines to a header in order to be able to reuse them in the Qualcomm NVMEM CPUFreq driver instead of duplicating them. Signed-off-by: Robert Marko --- drivers/soc/qcom/socinfo.c | 65 +----------------------------- include/linux/soc/qcom/socinfo.h | 68 ++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 64 deletions(-) create mode 100644 include/linux/soc/qcom/socinfo.h diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 3b970a80f3aa..5919f863f369 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -32,15 +33,6 @@ #define qcom_board_id(id) QCOM_ID_ ## id, __stringify(id) #define qcom_board_id_named(id, name) QCOM_ID_ ## id, (name) -#define SMEM_SOCINFO_BUILD_ID_LENGTH 32 -#define SMEM_SOCINFO_CHIP_ID_LENGTH 32 - -/* - * SMEM item id, used to acquire handles to respective - * SMEM region. - */ -#define SMEM_HW_SW_BUILD_ID 137 - #ifdef CONFIG_DEBUG_FS #define SMEM_IMAGE_VERSION_BLOCKS_COUNT 32 #define SMEM_IMAGE_VERSION_SIZE 4096 @@ -121,62 +113,7 @@ static const char *const pmic_models[] = { [58] = "PM8450", [65] = "PM8010", }; -#endif /* CONFIG_DEBUG_FS */ - -/* Socinfo SMEM item structure */ -struct socinfo { - __le32 fmt; - __le32 id; - __le32 ver; - char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH]; - /* Version 2 */ - __le32 raw_id; - __le32 raw_ver; - /* Version 3 */ - __le32 hw_plat; - /* Version 4 */ - __le32 plat_ver; - /* Version 5 */ - __le32 accessory_chip; - /* Version 6 */ - __le32 hw_plat_subtype; - /* Version 7 */ - __le32 pmic_model; - __le32 pmic_die_rev; - /* Version 8 */ - __le32 pmic_model_1; - __le32 pmic_die_rev_1; - __le32 pmic_model_2; - __le32 pmic_die_rev_2; - /* Version 9 */ - __le32 foundry_id; - /* Version 10 */ - __le32 serial_num; - /* Version 11 */ - __le32 num_pmics; - __le32 pmic_array_offset; - /* Version 12 */ - __le32 chip_family; - __le32 raw_device_family; - __le32 raw_device_num; - /* Version 13 */ - __le32 nproduct_id; - char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH]; - /* Version 14 */ - __le32 num_clusters; - __le32 ncluster_array_offset; - __le32 num_defective_parts; - __le32 ndefective_parts_array_offset; - /* Version 15 */ - __le32 nmodem_supported; - /* Version 16 */ - __le32 feature_code; - __le32 pcode; - __le32 npartnamemap_offset; - __le32 nnum_partname_mapping; -}; -#ifdef CONFIG_DEBUG_FS struct socinfo_params { u32 raw_device_family; u32 hw_plat_subtype; diff --git a/include/linux/soc/qcom/socinfo.h b/include/linux/soc/qcom/socinfo.h new file mode 100644 index 000000000000..6a175d635617 --- /dev/null +++ b/include/linux/soc/qcom/socinfo.h @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __QCOM_SOCINFO_H__ +#define __QCOM_SOCINFO_H__ + +/* + * SMEM item id, used to acquire handles to respective + * SMEM region. + */ +#define SMEM_HW_SW_BUILD_ID 137 + +#define SMEM_SOCINFO_BUILD_ID_LENGTH 32 +#define SMEM_SOCINFO_CHIP_ID_LENGTH 32 + +/* Socinfo SMEM item structure */ +struct socinfo { + __le32 fmt; + __le32 id; + __le32 ver; + char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH]; + /* Version 2 */ + __le32 raw_id; + __le32 raw_ver; + /* Version 3 */ + __le32 hw_plat; + /* Version 4 */ + __le32 plat_ver; + /* Version 5 */ + __le32 accessory_chip; + /* Version 6 */ + __le32 hw_plat_subtype; + /* Version 7 */ + __le32 pmic_model; + __le32 pmic_die_rev; + /* Version 8 */ + __le32 pmic_model_1; + __le32 pmic_die_rev_1; + __le32 pmic_model_2; + __le32 pmic_die_rev_2; + /* Version 9 */ + __le32 foundry_id; + /* Version 10 */ + __le32 serial_num; + /* Version 11 */ + __le32 num_pmics; + __le32 pmic_array_offset; + /* Version 12 */ + __le32 chip_family; + __le32 raw_device_family; + __le32 raw_device_num; + /* Version 13 */ + __le32 nproduct_id; + char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH]; + /* Version 14 */ + __le32 num_clusters; + __le32 ncluster_array_offset; + __le32 num_defective_parts; + __le32 ndefective_parts_array_offset; + /* Version 15 */ + __le32 nmodem_supported; + /* Version 16 */ + __le32 feature_code; + __le32 pcode; + __le32 npartnamemap_offset; + __le32 nnum_partname_mapping; +}; + +#endif From patchwork Sat Jan 21 11:29:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 645327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0AFAC27C76 for ; Sat, 21 Jan 2023 11:29:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229815AbjAUL35 (ORCPT ); Sat, 21 Jan 2023 06:29:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbjAUL3y (ORCPT ); Sat, 21 Jan 2023 06:29:54 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28C813BDB8; Sat, 21 Jan 2023 03:29:52 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id z11so9565654ede.1; Sat, 21 Jan 2023 03:29:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=A5mKLuXoQEg2LlBl5cTmg4HRlZTc66MypE0lBCnDK2k=; b=hWNgPQHz5DT7YEs2CEn+12uqj+eFooNyCxxghHL4SZmuyF0iu+57QAVH/Lk+D76xeg 8XlVNXk06vM/WiAd77+E5EvvQLJlChV0Wac1eI5Sk1aDbcJpVFJz0jF+4rU0e5SuQuT2 WXZqtJfRha3gwgs+E7V2/dvQo6nEE1GhHzXuxE8xmMotoYXFPs4+urJxI0AILPZ8VNE1 QMJSgNK57306oL4oEP9U/cDs/qDC7zVOh6vCJ8OTz1/LO+2F3cvT69LjPnpvSInWc9WO fB++rE16bcZRb3ZviM0WJQLk5hFoxMXXgyAFf1Q1HzHV83TxcIz3otCZQW6jzKZ33r0o /C2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=A5mKLuXoQEg2LlBl5cTmg4HRlZTc66MypE0lBCnDK2k=; b=1r4GW9D2tzsOtnU6RXdDz8QP0kiijb3q0jFMG2iXUYbBTdQkYSsysrNK2cdwpave9O sEXgP9zC3UJikp7P1lqoyKy+SxsCh/t1U6sJAQaSujEO4pJb3WvxXaR3ZEh4WXUuGbJn FVZdF3btAesRfp2c2rUchDyrXt3b0YL6SbRLAA82I1CDL/4WBRnlTPA8XlYIX+Vk+JZY 5djohUPDE/a4Ngat4ydEuLMZeQU+oQJrLPYfGV7DOnWTpsZJVjlq5Vz1FI0xeqbfg+Vp wWXCw1Lytf93mZtjTqv2UACFN3CEU+t5yHcpjPVhlwL2/xjlzypQDjJuhXHtaTfT8Fo1 p22w== X-Gm-Message-State: AFqh2kp1sl5uPuG0EenzohnvQOIIYCq6uZrxfiBzaP8z6ziDrj2lU6pc YQjV0Kw7Ja97jMO1R1OoJh4= X-Google-Smtp-Source: AMrXdXsh7ggzctLoccLy3vZx8Sz0N2IZzlexzElftxpuKcFvoijh7wdY9JKsoJZgD946kAVA8b4sZg== X-Received: by 2002:aa7:c9c5:0:b0:49e:f591:d8d2 with SMTP id i5-20020aa7c9c5000000b0049ef591d8d2mr3997269edt.16.1674300590690; Sat, 21 Jan 2023 03:29:50 -0800 (PST) Received: from fedora.. ([188.252.220.152]) by smtp.googlemail.com with ESMTPSA id d26-20020a056402401a00b0046c7c3755a7sm5152151eda.17.2023.01.21.03.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 03:29:50 -0800 (PST) From: Robert Marko To: ilia.lin@kernel.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Robert Marko Subject: [PATCH 2/4] cpufreq: qcom-nvmem: reuse socinfo SMEM item struct Date: Sat, 21 Jan 2023 12:29:45 +0100 Message-Id: <20230121112947.53433-2-robimarko@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230121112947.53433-1-robimarko@gmail.com> References: <20230121112947.53433-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Now that socinfo SMEM item struct and defines have been moved to a header so we can utilize that instead. Now the SMEM value can be accesed directly, there is no need for defining the ID for the SMEM request as well. Signed-off-by: Robert Marko Reviewed-by: Bjorn Andersson --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index a577586b23be..c0a7841a56c1 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -28,8 +28,7 @@ #include #include #include - -#define MSM_ID_SMEM 137 +#include enum _msm_id { MSM8996V3 = 0xF6ul, @@ -143,17 +142,14 @@ static void get_krait_bin_format_b(struct device *cpu_dev, static enum _msm8996_version qcom_cpufreq_get_msm_id(void) { size_t len; - u32 *msm_id; + struct socinfo *info; enum _msm8996_version version; - msm_id = qcom_smem_get(QCOM_SMEM_HOST_ANY, MSM_ID_SMEM, &len); - if (IS_ERR(msm_id)) + info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, &len); + if (IS_ERR(info)) return NUM_OF_MSM8996_VERSIONS; - /* The first 4 bytes are format, next to them is the actual msm-id */ - msm_id++; - - switch ((enum _msm_id)*msm_id) { + switch (info->id) { case MSM8996V3: case APQ8096V3: version = MSM8996_V3; From patchwork Sat Jan 21 11:29:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 645326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 606D8C5320B for ; Sat, 21 Jan 2023 11:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229523AbjAUL36 (ORCPT ); Sat, 21 Jan 2023 06:29:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbjAUL3y (ORCPT ); Sat, 21 Jan 2023 06:29:54 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 455673D91E; Sat, 21 Jan 2023 03:29:53 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id mg12so19934375ejc.5; Sat, 21 Jan 2023 03:29:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=APNLiKmbt8JWMBZWCLrn0Q41j8dsCsL0653AwgPsFDA=; b=g1UzDz1rMz/aM52AgBjc3ucmXLS+TBgaPsQES6XJz7DWT4VKzPfjlknwi4AXGEwbhQ tFX0r02QSxf6CnmsdRQCnAH+Y8xP7FB+b0x7Hj4KXHJWjmgKw/iZCYIcltpw5UhC6CLV TKqS+7TEWZX9x653IPLzRAbNMeW9CLGbl89PfEbHS4w5xiYIWnMHMzDknz3YAupITNZw 3zlIFYRfyGVlexcI8grFSdVKHv/hK481UzVIbV25x7Zm06f8aNq+0kNbc3EruZLc5QkC +YHXcWsLPBeHNl11RjQ89dIsEe3OSJMo8PyjDRvz6aK2B8fv6ON6XG61vUC1Zk/RzoF7 pvhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=APNLiKmbt8JWMBZWCLrn0Q41j8dsCsL0653AwgPsFDA=; b=Y6Y89EvCu4Vo9VZo8Jg6/WZjfGYCSShhAGBLSBLDJ2sTdmsBKs/Zjszl3fCClu6NJC pB0aKTNICkAu8kwbNHFp0QF+9z19eTLr/eyGNaSz5vLie/2ebi7khzWMXDWVT+waObEq L6MELexn75LmLs3+WlbVkCYXq8e5GhiEcmYFF/ArXv3nDnWhR1uWw06IvO/qdhIyrZPz CdqUDbNidMYohZwYTkzG7GfJLoXI8pF+X8BeIcwXx2rIEd25af0LAwheoMjRTkhgN+w6 mdUi8YsKpjOZcajNdsuNJ/g1Ua4AHQTdkQlBlmz6jgUmkOpDhGF3GjUWtqbbwn0Q2N76 LcTw== X-Gm-Message-State: AFqh2kp9fbzIOk7Q5CDQ3S8WoDPFwSFhqZLuaioSHPZ2oCM15hFmd7WC jDBcvzz+dMudD3XMHDxWrs0= X-Google-Smtp-Source: AMrXdXvvXTupPobSVzZSXlsGrSw071RkVOjTM5EO22JRbV8ArGldH8Ps6I9uHpDJa3iZACtgQr6GYg== X-Received: by 2002:a17:906:78a:b0:86e:7683:4213 with SMTP id l10-20020a170906078a00b0086e76834213mr19743279ejc.42.1674300591806; Sat, 21 Jan 2023 03:29:51 -0800 (PST) Received: from fedora.. ([188.252.220.152]) by smtp.googlemail.com with ESMTPSA id d26-20020a056402401a00b0046c7c3755a7sm5152151eda.17.2023.01.21.03.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 03:29:51 -0800 (PST) From: Robert Marko To: ilia.lin@kernel.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Robert Marko Subject: [PATCH 3/4] cpufreq: qcom-nvmem: use SoC ID-s from bindings Date: Sat, 21 Jan 2023 12:29:46 +0100 Message-Id: <20230121112947.53433-3-robimarko@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230121112947.53433-1-robimarko@gmail.com> References: <20230121112947.53433-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org SMEM SoC ID-s are now stored in DT bindings so lets use those instead of defining them in the driver again. Signed-off-by: Robert Marko Reviewed-by: Konrad Dybcio --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index c0a7841a56c1..da55d2e1925a 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -30,12 +30,7 @@ #include #include -enum _msm_id { - MSM8996V3 = 0xF6ul, - APQ8096V3 = 0x123ul, - MSM8996SG = 0x131ul, - APQ8096SG = 0x138ul, -}; +#include enum _msm8996_version { MSM8996_V3, @@ -150,12 +145,12 @@ static enum _msm8996_version qcom_cpufreq_get_msm_id(void) return NUM_OF_MSM8996_VERSIONS; switch (info->id) { - case MSM8996V3: - case APQ8096V3: + case QCOM_ID_MSM8996: + case QCOM_ID_APQ8096: version = MSM8996_V3; break; - case MSM8996SG: - case APQ8096SG: + case QCOM_ID_MSM8996SG: + case QCOM_ID_APQ8096SG: version = MSM8996_SG; break; default: From patchwork Sat Jan 21 11:29:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 645510 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12485C38141 for ; Sat, 21 Jan 2023 11:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229773AbjAUL37 (ORCPT ); Sat, 21 Jan 2023 06:29:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbjAUL34 (ORCPT ); Sat, 21 Jan 2023 06:29:56 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61E343E098; Sat, 21 Jan 2023 03:29:54 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id b4so9601421edf.0; Sat, 21 Jan 2023 03:29:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=hAzkTMFTURCBIwS+2F7U3D+gzMtPsw23R5CfBmpjqS8=; b=Zzg50d2ng+fh9mPVnpQbbDtTySnGNyO/jedqCs2/Es98lpd3YFECRzPHFHhqssXw7v wIqC6YOgD8p2Ol8JWzMkhF+2OUcTasBby7X9TPwEcwPvBTGDcKaHBz901k8ZBJY9Lkrr AJAypfRxKTTagvA6dwbAPqn+a1wde9QExRkbxKIqoo0oLw3laDAJ6yPDOkg18poZYh5J u2c/z0xRFEqG+WltV5GNGQZ3dQ89AMsYgPQTmvwC5Vak7DAj2nLZtmUYrKguVNRNoDRB hxzyIGQLaHjyByErHUP1UAjYXMQd1+2UaXe6bIDVbCeyDIHSzOj/QGMLor7kSjLscI6f BRsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=hAzkTMFTURCBIwS+2F7U3D+gzMtPsw23R5CfBmpjqS8=; b=ZuummYeFuGFRHPTGkPid7RT6tOhJ94LTgBoBKU/8Gmkoa45142ekKRBDzGFmUwMMnY TXRADkL4bnjFMGl8KuJ9qdMiv+d5zJ8W4Ue+wvpzyYiRcOtN9Na0vTtc7zPN+KqMNQ7H 616jb2qRqqVnTspl7Irkzma2KSA8+4rHY8SIksaphE22hVRK/Q43I4kE+CDDavdrhvGw CDPZEFpClSIiXHXowq47ctlM0BmFqsz4oGbFiLYIMd7e14oqCeh5Xf+/6f7i6xUUxo+2 o32xmTI6telKZz+fVhd8BhG3WPDXRwg/2qxUdUQEQ++CvpeQj/Vhs1cTXMHyVq7iJr2G i6YA== X-Gm-Message-State: AFqh2kr6yQ83fa5twlAhoGmChyYjRJrpAALlmY7FDaZ46rRkis9+FURp 6k1xhDw3U2tAuI7WWl6McbXgRuVHLCnoTA== X-Google-Smtp-Source: AMrXdXuHC+RuV0isDZSh49wKfLwS2hWhJfDrCuWw5+VVR5nn1OzQFOoDtd762ssGkJ3eM3ZbRIU2gw== X-Received: by 2002:a05:6402:43cf:b0:49b:b1ab:f216 with SMTP id p15-20020a05640243cf00b0049bb1abf216mr20175430edc.11.1674300592949; Sat, 21 Jan 2023 03:29:52 -0800 (PST) Received: from fedora.. ([188.252.220.152]) by smtp.googlemail.com with ESMTPSA id d26-20020a056402401a00b0046c7c3755a7sm5152151eda.17.2023.01.21.03.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 03:29:52 -0800 (PST) From: Robert Marko To: ilia.lin@kernel.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Robert Marko Subject: [PATCH 4/4] cpufreq: qcom-nvmem: make qcom_cpufreq_get_msm_id() return the SoC ID Date: Sat, 21 Jan 2023 12:29:47 +0100 Message-Id: <20230121112947.53433-4-robimarko@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230121112947.53433-1-robimarko@gmail.com> References: <20230121112947.53433-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Currently, qcom_cpufreq_get_msm_id() does not simply return the SoC ID after getting it via SMEM call but instead uses an enum to encode the matched SMEM ID to 2 variants of MSM8996 which are then used in qcom_cpufreq_kryo_name_version() to set the supported version. This prevents qcom_cpufreq_get_msm_id() from being universal and its doing more than its name suggests, so lets make it just return the SoC ID directly which allows matching directly on the SoC ID and removes the need for msm8996_version enum which simplifies the driver. It also allows reusing the qcom_cpufreq_get_msm_id() for new SoC-s. Signed-off-by: Robert Marko Reviewed-by: Bjorn Andersson --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 44 ++++++++-------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index da55d2e1925a..9deaf9521d6d 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -32,12 +32,6 @@ #include -enum _msm8996_version { - MSM8996_V3, - MSM8996_SG, - NUM_OF_MSM8996_VERSIONS, -}; - struct qcom_cpufreq_drv; struct qcom_cpufreq_match_data { @@ -134,30 +128,16 @@ static void get_krait_bin_format_b(struct device *cpu_dev, dev_dbg(cpu_dev, "PVS version: %d\n", *pvs_ver); } -static enum _msm8996_version qcom_cpufreq_get_msm_id(void) +static int qcom_cpufreq_get_msm_id(void) { size_t len; struct socinfo *info; - enum _msm8996_version version; info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, &len); if (IS_ERR(info)) - return NUM_OF_MSM8996_VERSIONS; + return PTR_ERR(info); - switch (info->id) { - case QCOM_ID_MSM8996: - case QCOM_ID_APQ8096: - version = MSM8996_V3; - break; - case QCOM_ID_MSM8996SG: - case QCOM_ID_APQ8096SG: - version = MSM8996_SG; - break; - default: - version = NUM_OF_MSM8996_VERSIONS; - } - - return version; + return info->id; } static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev, @@ -166,25 +146,25 @@ static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev, struct qcom_cpufreq_drv *drv) { size_t len; + int msm_id; u8 *speedbin; - enum _msm8996_version msm8996_version; *pvs_name = NULL; - msm8996_version = qcom_cpufreq_get_msm_id(); - if (NUM_OF_MSM8996_VERSIONS == msm8996_version) { - dev_err(cpu_dev, "Not Snapdragon 820/821!"); - return -ENODEV; - } + msm_id = qcom_cpufreq_get_msm_id(); + if (msm_id < 0) + return msm_id; speedbin = nvmem_cell_read(speedbin_nvmem, &len); if (IS_ERR(speedbin)) return PTR_ERR(speedbin); - switch (msm8996_version) { - case MSM8996_V3: + switch (msm_id) { + case QCOM_ID_MSM8996: + case QCOM_ID_APQ8096: drv->versions = 1 << (unsigned int)(*speedbin); break; - case MSM8996_SG: + case QCOM_ID_MSM8996SG: + case QCOM_ID_APQ8096SG: drv->versions = 1 << ((unsigned int)(*speedbin) + 4); break; default: