From patchwork Wed May 24 16:23:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 98615 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp38088vqr; Wed, 24 May 2023 09:37:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ69t2c1k0ei5JvPRfEC4aHEYxGUy+wckc5T7p2a1J9ZHmbh43W9sGUWQ3gVSNyrlw6rdpwT X-Received: by 2002:a17:90b:38ce:b0:250:9e7b:2798 with SMTP id nn14-20020a17090b38ce00b002509e7b2798mr16264812pjb.18.1684946260894; Wed, 24 May 2023 09:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684946260; cv=none; d=google.com; s=arc-20160816; b=Cglq7NRV63ycuqB911XLLbJ8AwHYtJxEfJsr5OwoSOxBwFqEf64656tSkJSdYT7YU8 AsbVYT08j+pwgy3w9xKdlMZzJJ0ghlDRNuvO4DmO1cAzdzPJrC4wS0WycUmWAW3GLDEV xiUHGBzyslVkmOY9TSL2E2p4n8CknTJ4ckC+Yn6WdO1dK+8Y6yLlHJafWBNFa4gTVWDM BgNdYEfUUmwfYghWP6bhR4MP8loYi0ms7dy007Dp0ivLrGVACTVbGoSwwz7jO83luc4B wnizwuquBZW6gQW0+6xHMqd6UjL+TUiV+TwNMlOQWoCf4cuF3d2WFV+4h4iFOG2OYawF 0seA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rcZFua0EILx4UgL94m890/UaW7590iqXfYJZcRYRhjI=; b=W017oTfr5MhvKXVBN4dZHpiPtk3kWW7I+0KbihHTE2e/2r+IMaQwGr6w3LpCPGumd3 Jh6/agy4Hysinzcd56DrdYHnDKtOhD74TYjNfRFu6QCmyxTJklmPmUUbyB9mrSQX6l1C xORr2yH3npBbu/4NNjLyCCKg5i84sY7+C8+0CPgG4VJdXMhWprxpN0TokhoLfJa0JYLh hS+10paLerA3MNIA7SIa0ZxvFokkGoavhMI5JQgOvynSeeJWTKJ4aug+6EQxT+CX5zNj EqvJ4KUW6wxJA5gHYC6YhDnqrSeUqaCf6ivH7VVHs2BPl3clsRjtiKRGkDJiD2ANDWl4 Knyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=EgcdO6RX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a17090a4a1700b0024b011026aesi1595292pjh.76.2023.05.24.09.37.27; Wed, 24 May 2023 09:37:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=EgcdO6RX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234345AbjEXQXm (ORCPT + 99 others); Wed, 24 May 2023 12:23:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233790AbjEXQXi (ORCPT ); Wed, 24 May 2023 12:23:38 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA97F1A1; Wed, 24 May 2023 09:23:33 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-96f7bf29550so165694766b.3; Wed, 24 May 2023 09:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684945412; x=1687537412; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rcZFua0EILx4UgL94m890/UaW7590iqXfYJZcRYRhjI=; b=EgcdO6RXFPfL6eBdltvYTZUiOyGda0B1gegV+CvUUfOfBC5zfmPe2jHKJyOK9cKVts iqfyyS6/5rcO3RyLjmPJqkLVU1O0jis+c06TZwWZvUaJVtoaLX5TC9sJ4ypVevPWprod ycTTRDKB2UQxxpaFXMShAZUtXLGv39DWLlePdPx+zVQbhZ5C629Tgvpo5K+3KdzpDX6q AwQ2Ltb8v1sfZiCEXMo0Q3FUVzY8LHCcHVQ+cU+G2lQ4f/rkIj2O7g9JLnMGVWUFGh2S E5SVdSO60oLZ3hvw7NTTTlH6X/pOB8+VbxrVvesQQVI8tCFbamlSfwTg9bNb/tPyviZV NrIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684945412; x=1687537412; 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=rcZFua0EILx4UgL94m890/UaW7590iqXfYJZcRYRhjI=; b=bH/4uaeKjgXqcGRKAWqHENHhvTrJc7dKuJMNiunLdWhczD/Ozs3JjmkIdOqgVzWhOg CwJOeM1CWcfZNo+x5seDjyLIFFp/ykNpEzboWjtu3oRKtGRXk5kCuZNilJVW2VZGzFMK hng3bMQqvTG6zASAIR/nxBVsbYf+U3FlMm0xxkVQihAaYJdsTa6WK2V2F3IETX+vcCKg aw8q4cQxBIoa/cUwgiRvmg5V0T5PcyhtJkkLMg/Tv4MwsmcB3aRbuaelaukdeP0ZGqfs o4O+q8zIkApMGO45xdM6b6GOQhAHtcFHFlLQDKAd3tbl9EwbZ2B75SJXktID0fd1Q+11 iCRQ== X-Gm-Message-State: AC+VfDzoPvZBruccCQg1dyYnRSKuGR8gBy0WO75BrkkMe3PQV52a70Nz rR/rgUcsM/zBYTDgUaW+H9A= X-Received: by 2002:a17:907:8a03:b0:96f:912e:5ec4 with SMTP id sc3-20020a1709078a0300b0096f912e5ec4mr16215583ejc.16.1684945411968; Wed, 24 May 2023 09:23:31 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id p19-20020a170906229300b0096f5b48fe43sm5913793eja.47.2023.05.24.09.23.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 09:23:31 -0700 (PDT) From: Robert Marko To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, ilia.lin@kernel.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org Cc: ansuelsmth@gmail.com, Robert Marko Subject: [PATCH v2 1/4] soc: qcom: socinfo: move SMEM item struct and defines to a header Date: Wed, 24 May 2023 18:23:26 +0200 Message-Id: <20230524162329.819770-1-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766794210473063057?= X-GMAIL-MSGID: =?utf-8?q?1766794210473063057?= Move SMEM item struct and related defines to a header in order to be able to reuse them in the SMEM driver instead of duplicating them. Signed-off-by: Robert Marko --- drivers/soc/qcom/socinfo.c | 67 +----------------------------- include/linux/soc/qcom/socinfo.h | 70 ++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 66 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 c2e4a57dd666..ee6bbf76d941 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 @@ -126,64 +118,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; - /* Version 17 */ - __le32 oem_variant; -}; -#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..d1cbc49a2a2d --- /dev/null +++ b/include/linux/soc/qcom/socinfo.h @@ -0,0 +1,70 @@ +/* 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; + /* Version 17 */ + __le32 oem_variant; +}; + +#endif From patchwork Wed May 24 16:23:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 98617 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp45439vqr; Wed, 24 May 2023 09:51:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61WevcVztif1uLGVTnRH6wyOK5Dzgiivm8dt+tRsOYHO2XyigXT8cca8h60XauCSCvxYdY X-Received: by 2002:a17:903:2283:b0:1af:c7f8:b329 with SMTP id b3-20020a170903228300b001afc7f8b329mr7466158plh.24.1684947068188; Wed, 24 May 2023 09:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684947068; cv=none; d=google.com; s=arc-20160816; b=jOGlNVjJjJ8ak/s/rY0pvhS/Ln5ckUrk6ueuZ2ahMwFLuBdhhWmq/7F/wGzMK4QK/C G6zAVR1ezGCJ6TG4brBNOva49ADWDeV2rTTRzt/vNpqq2UvzhFI3xUNqRdpGDrGKkJIn robRRONFOVeaYNMApqd2ucTKkDwHXE8HlrWPOvs+ZVKSnj+rYIjfZbIp8eIZOe7FpOGM aFaWdEN0ngsx84ipv2kGzMqfwkR2Iqii753pvGx5fwrgjYwnHGmKDi5eSmD0Opfm1CEN ChDRcEPjLErPoqxO71UoxHpYm+U6fJrbE3bObH+v6tF4I8qUbvwKqCyafXg4gC57M49I ZFYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3/ycEJUTtAvi7GqgpK2zlFsLIGEJyRG8499TbrV7bF8=; b=0or7Yhth8GvV12dG7pdk14PJzLZ+WtHInbJVn0Q5TduPNv+j2oc+8XpjzqzzbP8tO7 4xbcKBQU32M7DCEr58vgwmcfzUwCg0M5lbKTbyoLDAYlun79crg0P2zCEFvPJ1m95U4o b2qJUTiFg643pTQ/pOwXnJdcVRnJL2uppJe8N95KKNm54Yg8EwK4F0E+dMeOVR7b0FTi AIvwpin9a4Fcm5iPg5RZSjBUG9hS2yvBP9/4kdvw8Em/fuJtyKAapwO1yyj5tsmuGm5B YV8fRSQPArDhmNU8gx0n92TSEIvxlfLQ4zCr9d0Rwh1zuIYMB2ktVVuKKkStDVgLIh9y uGaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AtJCedqw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a17090311c600b001ac893fa8dasi1704361plh.144.2023.05.24.09.50.55; Wed, 24 May 2023 09:51:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AtJCedqw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234200AbjEXQXp (ORCPT + 99 others); Wed, 24 May 2023 12:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234659AbjEXQXi (ORCPT ); Wed, 24 May 2023 12:23:38 -0400 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 DAC3912F; Wed, 24 May 2023 09:23:34 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-510bcd2d6b8so31010a12.0; Wed, 24 May 2023 09:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684945413; x=1687537413; 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=3/ycEJUTtAvi7GqgpK2zlFsLIGEJyRG8499TbrV7bF8=; b=AtJCedqw7nCCBMw/v9uxTNYD5Zg9FPuoDc4lUvqOiF4tI/xA5h/bg9eoiNEZF3zZZS NaNjRKQ5iiaCXB24tQ+xgnGgSvXsGDdGOzQgUoqqsN3WYanzIt7bpXbMofpXF+jZXWmn aLvCrfz3NYQ4k3jAZ8FizXMLfds2/V9DyFWTXP26a00qY2g9xa+vN43uzepu34uGml6C 6odowDAVKse38OmYmGXKaJy9djuJDZ0ftIUYg4jA69dVghto746pYwCIETg8rspSMqPU pGrNg6ycDX2SQGorD4NmWozexz7uAFKYVnqcBEV2lkqm7iriWF4/SeGGXj11rdTnUtAp RI9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684945413; x=1687537413; 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=3/ycEJUTtAvi7GqgpK2zlFsLIGEJyRG8499TbrV7bF8=; b=hn5i42675+4gL5QVx4vciS6yCqY1tkVOJ/HgLG2vn3Y8pBFQVkwnAXSseI0OkBdPLO LHS/rqJRK8PXgJWrZHyiUzrObPO1b/f9VVFHbyndXm5LTt4/WrT9IPEuxVwBCLNyfEf7 MHlYYcW+cY8kB5EMGE5Djnz2uJ6RYKW59SHui+1jgbKJAHWawj/BJTs42bakGQxqztyb g99/1AgkWOFd+mHetkWuePwFpOV8cscuK21tRYa1SmystNDTbmrOmP6+4NVaAuca9wyv GBsBpcrdVQYYYUc07uqvWGMuDFiFiIw+rxsCzh3A8AU5pvxO2RgC4nIuVDnWDMMXw/tu Rr3A== X-Gm-Message-State: AC+VfDzmfcBIwAhOjZM3RSX0Q5NXMPdZ0uhdlbCtDWwLrkCvSZOrYAJx kaGlHLSrNaO85+eLo7wzlvo= X-Received: by 2002:a17:907:d9f:b0:973:84b0:b077 with SMTP id go31-20020a1709070d9f00b0097384b0b077mr2792885ejc.33.1684945413244; Wed, 24 May 2023 09:23:33 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id p19-20020a170906229300b0096f5b48fe43sm5913793eja.47.2023.05.24.09.23.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 09:23:32 -0700 (PDT) From: Robert Marko To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, ilia.lin@kernel.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org Cc: ansuelsmth@gmail.com, Robert Marko Subject: [PATCH v2 2/4] soc: qcom: smem: introduce qcom_smem_get_msm_id() Date: Wed, 24 May 2023 18:23:27 +0200 Message-Id: <20230524162329.819770-2-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230524162329.819770-1-robimarko@gmail.com> References: <20230524162329.819770-1-robimarko@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766795056729263073?= X-GMAIL-MSGID: =?utf-8?q?1766795056729263073?= Introduce a helper to return the SoC SMEM ID, which is used to identify the exact SoC model as there may be differences in the same SoC family. Currently, cpufreq-nvmem does this completely in the driver and there has been more interest expresed for other drivers to use this information so lets expose a common helper to prevent redoing it in individual drivers since this field is present on every SMEM table version. Signed-off-by: Robert Marko --- drivers/soc/qcom/smem.c | 19 +++++++++++++++++++ include/linux/soc/qcom/smem.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 6be7ea93c78c..0d6ba9bce8cb 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -14,6 +14,7 @@ #include #include #include +#include /* * The Qualcomm shared memory system is a allocate only heap structure that @@ -772,6 +773,24 @@ phys_addr_t qcom_smem_virt_to_phys(void *p) } EXPORT_SYMBOL(qcom_smem_virt_to_phys); +/** + * qcom_smem_get_msm_id() - return the SoC ID + * + * Look up SoC ID from HW/SW build ID and return it. + */ +int qcom_smem_get_msm_id(void) +{ + size_t len; + struct socinfo *info; + + info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, &len); + if (IS_ERR(info)) + return PTR_ERR(info); + + return __le32_to_cpu(info->id); +} +EXPORT_SYMBOL(qcom_smem_get_msm_id); + static int qcom_smem_get_sbl_version(struct qcom_smem *smem) { struct smem_header *header; diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h index 86e1b358688a..6448607239e6 100644 --- a/include/linux/soc/qcom/smem.h +++ b/include/linux/soc/qcom/smem.h @@ -11,4 +11,6 @@ int qcom_smem_get_free_space(unsigned host); phys_addr_t qcom_smem_virt_to_phys(void *p); +int qcom_smem_get_msm_id(void); + #endif From patchwork Wed May 24 16:23:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 98620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp47361vqr; Wed, 24 May 2023 09:54:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5V5nM16grdIBNmgfybt+bqy2CgciPMRjLd9xFTWD4SVdF9HPMGoeJSOxayJTmIA8utZLrS X-Received: by 2002:a05:6a00:1746:b0:64f:49ee:1a61 with SMTP id j6-20020a056a00174600b0064f49ee1a61mr4717675pfc.34.1684947271697; Wed, 24 May 2023 09:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684947271; cv=none; d=google.com; s=arc-20160816; b=AGZODKeOLF+o5WGPV6zpE3f72rt6pLQRFYDiMchaqcO7U4xXtJVvErFxEq1hX1VZXZ wrW+SC/c14wwh8kABf2jj1BFeT08wcyBDquYQQxBP5SPh6Epc47AkP0l/195QI5zFp9L BrjJLlG6jVHT8uEkAVbOp1l2F0i7GcK2WVV1yswkUMKhjFbmS9ofbQszmFZgJNLQKGpu HyCGaM14FPqcoFFPtvq1FB1FvtoUsBRMBIcTqb+PMQ1G2KdWKtCd8lKq5mQqIlWurif6 TFP88gOm3DK43VrHgVHokux9px0CfFNQucVjnhE4+SsZE00aFiMswKEzSS4+GTIeUide fFPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OpOWhP8DxFONC41kTCdHjaq2c0kscoG17qr+mKyv86Y=; b=VR6nXpln4z6hloXGDJH653Y90lL+mwyxbyEFBhU2LysZVAEw7x/MNLCc1NaGN9CYv8 IDKeU4dXbLLU2QmrwlSciy7JLf7mx7JBuCEBJXmkEUiRLt9uFvev0oKPF41Rr/kf4hQW EQQ2gePuFA6cMwJGhDo9b/RjwKfQNfxig7KpyiA1ZzuJU2JlQPiCua+JUwnZu7e0ODSv Axhs/c4eIvFUFytdM+g4Kpk0sa0Q8etnQeOLsLpiOOPZzxC1of/Axccs3BrMGA0YWHpJ LghO/UwR3Z8tSy6Z1nwYGTxpRtoU+AjjE1xLnxuY2zn1iPbtGslKgmtvhqL4EKM6UrNA nzGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UItT9vYr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 193-20020a6218ca000000b006467de1cbc8si2014480pfy.226.2023.05.24.09.54.19; Wed, 24 May 2023 09:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UItT9vYr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234790AbjEXQXu (ORCPT + 99 others); Wed, 24 May 2023 12:23:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjEXQXj (ORCPT ); Wed, 24 May 2023 12:23:39 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F3831AC; Wed, 24 May 2023 09:23:36 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-96fffe11714so191986366b.0; Wed, 24 May 2023 09:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684945414; x=1687537414; 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=OpOWhP8DxFONC41kTCdHjaq2c0kscoG17qr+mKyv86Y=; b=UItT9vYrEv/kfnpRB7ymoq0pbO0X+WFATR5duxybpApV0VslX3wEkhOt49PvRhdhyH u2wxN4RUq3UCMP+DOzHnZKVbrzBvh5CxrBoaAGHuE2X1s5Zjk/bXJXHQL1b+oEmzwbjf IbqXXFCzyy9KqgOeiDV2WwpPmZImQmC69uZoIZJWAzdyxvC+d6bQsMYVVbgMIOUp+Q9C tFtcaIJM7ucEQHYRswFkiIlHepIYbL49QO+qVBRXOU3mjkJzdaZ+R8xA35cwTCC58T8G llrimVok27IyOFYUYic1L0tnKYI1lTbNHi0K4FHrB8mh1jGoA8z5Vk3x90WV4gGNzDZo Jr4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684945414; x=1687537414; 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=OpOWhP8DxFONC41kTCdHjaq2c0kscoG17qr+mKyv86Y=; b=gO9/VbgN5SVnXWS/dFqCFusIQUWRhCWW/ZzpuWZN9IWYBvU/LCUoWGY3klbKmaiC89 HVYF4ygQ1r35NUPNG8oqe/22HhNtFXtoPkqNyduzp0YxJtLXqIBQ4NaODG2vsagnafZZ hSSAckvWK8TgkraSV5iWoljIkLxqXWZvLnXdSsFfwe+0UsW16Q5ZGE9MqeXt9p9ZYb53 E4yHaxpHxQO8fJNbaUNrnLs7tFhImkdBxOnVl6eC6kY856rnt/wB22v1WRQ5qzXq1tPT WnYQDK+SqulmC9eG8FtBRYkHVrDGncunmfEYrR7eQOk/i6RrvQQFabd3qR5blULAen2M FFFQ== X-Gm-Message-State: AC+VfDxkxpQa/buPmoWOmGmoLviQqCybQNlAklhJrFuQjncah7FVXxRj AG0JR3DpOTjnPl4eVs3E0NU= X-Received: by 2002:a17:907:9494:b0:96a:30b5:cfb0 with SMTP id dm20-20020a170907949400b0096a30b5cfb0mr16826339ejc.22.1684945414459; Wed, 24 May 2023 09:23:34 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id p19-20020a170906229300b0096f5b48fe43sm5913793eja.47.2023.05.24.09.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 09:23:34 -0700 (PDT) From: Robert Marko To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, ilia.lin@kernel.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org Cc: ansuelsmth@gmail.com, Robert Marko , Bjorn Andersson Subject: [PATCH v2 3/4] cpufreq: qcom-nvmem: use SoC ID-s from bindings Date: Wed, 24 May 2023 18:23:28 +0200 Message-Id: <20230524162329.819770-3-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230524162329.819770-1-robimarko@gmail.com> References: <20230524162329.819770-1-robimarko@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766795270020308774?= X-GMAIL-MSGID: =?utf-8?q?1766795270020308774?= 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 Reviewed-by: Bjorn Andersson Acked-by: Viresh Kumar --- 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 a577586b23be..60e99be2d3db 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -31,12 +31,7 @@ #define MSM_ID_SMEM 137 -enum _msm_id { - MSM8996V3 = 0xF6ul, - APQ8096V3 = 0x123ul, - MSM8996SG = 0x131ul, - APQ8096SG = 0x138ul, -}; +#include enum _msm8996_version { MSM8996_V3, @@ -154,12 +149,12 @@ static enum _msm8996_version qcom_cpufreq_get_msm_id(void) msm_id++; switch ((enum _msm_id)*msm_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 Wed May 24 16:23:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 98621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp47473vqr; Wed, 24 May 2023 09:54:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5MYEk9EqLnc7WqRVZSO8GN2Bvoq98gYQWsPSOZjSGvEkvxMQSabJ8GoEjzW2tnJwJ+N07Y X-Received: by 2002:a05:6a21:6811:b0:e9:5b0a:deff with SMTP id wr17-20020a056a21681100b000e95b0adeffmr16614733pzb.22.1684947288196; Wed, 24 May 2023 09:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684947288; cv=none; d=google.com; s=arc-20160816; b=Fd+X5FA329tsiS7ebCURi0Zg0OdjC5TboMPZI+JoxaNPonUiDdI2PBFf+XniiHG+Ax mRcE8N9woPCaL3JSem1BSiG9gz/9fe8Zvs3s15Q+4Rv1koSZGcGHC997TJSkBji1lTXY lNyLqX5g+qA2Ui+0hKyVKpIazEAmTBo6xuloqiNpZxyeQzgA6JPCO0V1851JEzGjVsTm 6SjKB/4q/1esVkjdm9ssksaN0Ru7RTKm2G2+aToXF+9GaCSvaddGHkvy5pBZJCQdeRPT zBn41OeWiSbeNYjI57ku54x8f+S9GI4nCUDWvIIQChqE0u9Ce4hAfp/6Tm/GK0aWeK3s jiVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=utXuBuOV4BNhpTKyYQ/PC8Nvs5FwMBOaU9WF5xMzoa4=; b=sk4xuh9MPjQXnhgKtmQiomKYn+Niy3+eL00ei2HDWEdpaugok7M4kfuOgx4BHJX+Oy hpAa9RX3ummCm6j12oYKwB3BdcqkOnm0gXKfwLg4Azj8MAqwaZbGccUle6x9psppwcMa 23FK8kLjP0m3ld2Cf6uaKLmz0/aIY2OPnEac92TcmTN81Rpq5J0qKThC0B0RJvVLQWgQ lbt1fAsJVKWkScVZYmvFqexJxWIom6jKcvJ2P5aqtJtN1VFmNxhWH6yhJW5jqJu6kfXN eRjLmhyxK0zHDLOqFafCbi7xDWJjV1qqax6usqOcEYpdCzmKdGUg+HGrI9T9iies8inN Wg/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=EaXQVjYZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n24-20020a638f18000000b0052132a8e4e3si8687535pgd.510.2023.05.24.09.54.34; Wed, 24 May 2023 09:54:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=EaXQVjYZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235164AbjEXQXs (ORCPT + 99 others); Wed, 24 May 2023 12:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbjEXQXk (ORCPT ); Wed, 24 May 2023 12:23:40 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCD2EE9; Wed, 24 May 2023 09:23:37 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-96f683e8855so164346866b.2; Wed, 24 May 2023 09:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684945416; x=1687537416; 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=utXuBuOV4BNhpTKyYQ/PC8Nvs5FwMBOaU9WF5xMzoa4=; b=EaXQVjYZpCwsP7gl6z2uzhDQD334YQJXgKyj6QjjAmPRDcEszws+8sHWOWgzsW8e+0 vE69lzFF93Cls7JebgARoZo/O9GmfjmwRHOYHrq9ORx/RVTqhep6nEXNlk8L0FVua0P5 eBPZtpZ0bGVkTy7GJeg1VQpYLgkBkljpTafg40iIT0iQF5QNHUqGJqgIGjdaZZtDkmTb t3oiKUSX7xAwpdGUksLgYcaWHFG4He6FO5uVM53yvo57HAWT8Mn+Q+qeTXMjDUKJroDM n8RRcUhh4Mt20aaamJX/gTv+7ZIqGgzn4c6JcpdzTS6rFhM32z1WetXKJapEQb6Jfejm Swmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684945416; x=1687537416; 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=utXuBuOV4BNhpTKyYQ/PC8Nvs5FwMBOaU9WF5xMzoa4=; b=E7uFYaQtI2Zninylbx60ITjpuHLNgn8eTNEkIOpnQg5dZetkGdOuhdP2C4Us0N26RC kHL4N2DYobHch01fH39izAGa3h5Yb6CPtzDBpLIGaavybsjw51uDZnYUdmjiVto21ooh brWer32sfsgodPaOFuhmnOfn2MdfnAg+xcMj3ZjePq2i8LzM7Ag/9YJSn2pNACF3JcIO NBdlLKRgaQMzdo41NKDTNv9bCZ0TqbJaT5UFyPQA1tojTeszpBK2peTyxFKzaxHjSFDd u3gJddfeUpVXLEcqHQ1z3xxl66ZHPsH0NqQQD35DQBEd6VGqvxFykHJVgY2XIUOTv5Mk 1gsg== X-Gm-Message-State: AC+VfDyClVB0sISqbN+FLRPPRtk1WtI30n9itAtk46AKdZ+5BEI+Bk9h /ifGoowdOvYGLLlnBRRn8is= X-Received: by 2002:a17:907:2ce5:b0:96a:52e:5379 with SMTP id hz5-20020a1709072ce500b0096a052e5379mr17116756ejc.63.1684945415775; Wed, 24 May 2023 09:23:35 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id p19-20020a170906229300b0096f5b48fe43sm5913793eja.47.2023.05.24.09.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 09:23:35 -0700 (PDT) From: Robert Marko To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, ilia.lin@kernel.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org Cc: ansuelsmth@gmail.com, Robert Marko Subject: [PATCH v2 4/4] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID Date: Wed, 24 May 2023 18:23:29 +0200 Message-Id: <20230524162329.819770-4-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230524162329.819770-1-robimarko@gmail.com> References: <20230524162329.819770-1-robimarko@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766795287606548405?= X-GMAIL-MSGID: =?utf-8?q?1766795287606548405?= Now that SMEM exports a helper to get the SMEM SoC ID lets utilize it. Currently qcom_cpufreq_get_msm_id() is encoding the returned SMEM SoC ID into an enum, however there is no reason to do so and we can just match directly on the SMEM SoC ID as returned by qcom_smem_get_msm_id(). Signed-off-by: Robert Marko Acked-by: Viresh Kumar --- Changes in v2: * Utilize helper exported by SMEM instead of refactoring qcom_cpufreq_get_msm_id() --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 55 +++++----------------------- 1 file changed, 9 insertions(+), 46 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index 60e99be2d3db..4293e2888797 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -29,16 +29,8 @@ #include #include -#define MSM_ID_SMEM 137 - #include -enum _msm8996_version { - MSM8996_V3, - MSM8996_SG, - NUM_OF_MSM8996_VERSIONS, -}; - struct qcom_cpufreq_drv; struct qcom_cpufreq_match_data { @@ -135,60 +127,31 @@ 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) -{ - size_t len; - u32 *msm_id; - enum _msm8996_version version; - - msm_id = qcom_smem_get(QCOM_SMEM_HOST_ANY, MSM_ID_SMEM, &len); - if (IS_ERR(msm_id)) - 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) { - 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; -} - static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev, struct nvmem_cell *speedbin_nvmem, char **pvs_name, 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_smem_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: