From patchwork Thu May 25 12:09:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 98991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp324235vqr; Thu, 25 May 2023 05:23:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/J0SfKd3iljPbR/3MaxPGBR3+O7ixqK5x8orvkU2ZWk5PHNPVq5ysGRKXHPV4r+RiONdf X-Received: by 2002:a05:6a00:9a3:b0:64d:2da5:4d2d with SMTP id u35-20020a056a0009a300b0064d2da54d2dmr8979802pfg.25.1685017400531; Thu, 25 May 2023 05:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685017400; cv=none; d=google.com; s=arc-20160816; b=U7updSjZyID3vO6pVLSGn7N3qLrH063jBVWTUgUPwGVT6RPDWYd0csViiw3WWn/fHq nRfAZAgscwcUXEIaZERD7Vc9HVKbAeXSrgWj4r46yRa37cZrpqRMh8jdiw+uttpOB2qt kObfQMaNXPUABAOtiudA1r588FphJiiixlsQ3GT4xUvyZChx4tfL9zuL59P2RG8zxZxZ 8bxtehk8nKffXw1gUVL33qXGzYiSZEsUdtDZpKyRWgU09ih+2kKGIrWNiHutR6oPC3q9 KFNG+24ZYt4sifZ6PK/mQQlkXhIvkSKDRJe5rPfHsFgmJVEk3NuxEe7K06NO3HqUIZrL G6ow== 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=a/9PBzi6CGfCQ/nQSAwflN+wrEe2752Gb3a2TYdr+prS9dophVWH6hN3RnygRcgXD6 iTLfbqtyfa/YsC0ZgIFUpjF8W3DrWxxyI0wPV0Y/aVnnhsoKcGHHLuHcRZJMHLHTrvVO PL3skZ0BaGWHIJZvwZKc4yMfLSVjIJLOeokYlOil18UqXkUxBZOSYA9a/dumXi4ucdNa dCecv/CerTvQnPSqKbFuZznuytk7r+5iT8Lsthrgp4M0eHW7fsaKNerBe3GU51vDWKuG qLdTKb9avjMpnb6ulH53L0gkaNsQ7vPonAAlzeIN/UAul9ED35yshuGyKaz+cKY2x25o /fKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=e51ZnOfJ; 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 bs71-20020a63284a000000b005349009f1desi1010786pgb.354.2023.05.25.05.23.07; Thu, 25 May 2023 05:23:20 -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=e51ZnOfJ; 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 S241148AbjEYMKN (ORCPT + 99 others); Thu, 25 May 2023 08:10:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240825AbjEYMKF (ORCPT ); Thu, 25 May 2023 08:10:05 -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 C05D6E7; Thu, 25 May 2023 05:10:01 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-96f6a9131fdso79529366b.1; Thu, 25 May 2023 05:10:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016600; x=1687608600; 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=e51ZnOfJ1t/HYqAKC9YQAQk0SSWNN6Gcf6eX15qnKverJ5v2wTq1XItzYrgvLb6Jlc nhS13CzXaongQ9ENjk2B1KGf3BvBL2Y0M6y9AlxFM4iysWL6uB9U25VP6lRXdjP5TbTk w2Ct2rt0kxCfGhR50mAp4HILAlPtkxTzsCi5xumrO/Pj/0Y2mkap5gqJyjiK9zj/0XBo 0xReVcHuBoxG9om06U1JiXltUSvNKtm+EWnDUNNtYHCiGVua/zsWiRI8bFRUJ8y4MODi Ss7ewqnkGgO68IVTpCqs4rJL5RTZuzncA2cPhTadyae4YsVGgLL5IIT91uDCAAgsdgaM l2HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016600; x=1687608600; 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=lvAwIzP4RsZXlposbj3n3VSqZvcQ0ewyq43P9BslIyqucnIyUTYfqlbReMQRf411sv AfZzO9j/mcqey+i8VhDga8ae3vxHIVMuJjKUfWpnss+hfeqAK0XB26iieeN5fsSMuIRk 4ywIKtNgBVo0loD+DyC4hjH+jmXb8OF2BARWWNXTSEOwzjTy1qd5kTexC5z41wjfMKO0 TRcAKk1kaiNLFiZsra+V9R5lPwMp+PR6Ucc+kNJn3tQTNHHyHN71njVgMtDhnJ5ah1/6 I7xKgVrbPXN96ucMga2HVdnWfDfrt+/OSsnI5W1a7fW6wK3ZNE5gFLEDTqHXmaPo6HpR DBdA== X-Gm-Message-State: AC+VfDySsFSSMnahpN7MUiD3+VKYVzEefuGtnH7qcDI0C/JI9NEUh5KB frVfwwa7zRzJTKdeskVdoPQ= X-Received: by 2002:a17:907:3185:b0:957:862a:9e6e with SMTP id xe5-20020a170907318500b00957862a9e6emr1104852ejb.73.1685016599901; Thu, 25 May 2023 05:09:59 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:09:59 -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 v3 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Date: Thu, 25 May 2023 14:09:52 +0200 Message-Id: <20230525120956.3095317-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?1766868805888064550?= X-GMAIL-MSGID: =?utf-8?q?1766868805888064550?= 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 Thu May 25 12:09:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 98988 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp318385vqr; Thu, 25 May 2023 05:14:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/Qn8FRFNrEIas7xu/q/qrd8MbrJCby3f/G3yyx9PBSPIdD081Hc/R+zTIbEd/UAC+xeEc X-Received: by 2002:a05:6a20:3d12:b0:10e:a8e6:35c5 with SMTP id y18-20020a056a203d1200b0010ea8e635c5mr4924111pzi.59.1685016865401; Thu, 25 May 2023 05:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685016865; cv=none; d=google.com; s=arc-20160816; b=vSN0PbzyR/6bqOXJcpd+R4+jxkYdqF3W9jeBCK6/nJLa/E58d/uMzrHHS0j2rSvfrR Hido6VUm4SY84SGZBguk3rNNiAc3mbHRlupewEWO3kK997HUJ0hOk+5JPaalHBPT8kDa wptp0XJ4/UByfFfPVryUCNC1GOOTNLZ4Hh3UDjcz6M0ajMWRLA0Tiwh2V9IAIOxcf2pG 605fSW53tBlYQJdfkVvZp6S66/EvcIqux0AnZdfKufm7BWP3Eht9lrvKZ1ROM+GRnT6D 8MA+48CF7c1rwld9SJK+oHSR1JCI7fUaYD2oHPKHcVFtJbsqovR32vuIB+aSkeMgHrFh 0dpg== 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=FqHt/Go8RthQVhVjmmrUcvTjDhA8Lt3EQbNyl9cwF7Y=; b=VMkmE9M8eAVG/ypyslO5iQShz9nAcisSweyIaQcYhYRD7pfywLs2napouBhuqmg5ew rLf56RhkwNJdphAZ/cF7bI6ywq7CheBX8KK+IL8g1A2u8rQzPpWs4267+lpkLaUaWXdk Qsc9PGqwlJdMMYQb9Q2z6vE9gNAbT9yPQBWYAJEr8w5wIf71Z8YU3i2nKbV5xk/83fwV kT2HXWMIzGhPEM9lw7xhoLvjk3lUU6Ew1AP6zIJKpna7PmpY6NEtX2VAtpjS0KuzoY58 QT7KsEWJcOlSm0g2LthD5hAlDGFrSO8G7JMO9oXqsnPahGOfSD3y1vbM1JV1ULgrC96h 11lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=S3GoNPHL; 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 h16-20020a633850000000b0053f0cdab820si1019932pgn.259.2023.05.25.05.14.09; Thu, 25 May 2023 05:14:25 -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=S3GoNPHL; 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 S241126AbjEYMKH (ORCPT + 99 others); Thu, 25 May 2023 08:10:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233431AbjEYMKF (ORCPT ); Thu, 25 May 2023 08:10:05 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 306CE10B; Thu, 25 May 2023 05:10:03 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-970028cfb6cso102191866b.1; Thu, 25 May 2023 05:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016601; x=1687608601; 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=FqHt/Go8RthQVhVjmmrUcvTjDhA8Lt3EQbNyl9cwF7Y=; b=S3GoNPHLbgYnGsdrSNuL6+UlC1JIuKVF9MpiMN4jRcFF7V/CzmwFAg2c9va1jd81Sd /Lrou9b+Vy6SKu6FUKz7LsdzGpe2YNdMgBnFVTksylJYs7emkgcB60VNp9KhLNwK87R8 KS4CxbGUd0VkbGEPhIhfDTDvWKyIU8jcEuooWSH5KuWmShhKustnKVr0lJv2ihAStIWY oC5EN5HBo751bZ+xiguCGBJISUX8p1mt5AsJihzbJF8fvY/BXB/WX3xwT/Sur1q2uRNz /gFSNjYti9J1c4fdUPk62Mgt4syJzcjTQu8TQfB9Oj6KdgvEHwJZvWtElGy7a1ekIJpk ZecA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016601; x=1687608601; 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=FqHt/Go8RthQVhVjmmrUcvTjDhA8Lt3EQbNyl9cwF7Y=; b=OZfvNTQbrXLketKx1ci0czCxK05e1L5L4/QGg8dv2mnxtfFeG6VKZcPrDekH/UsGz7 GZCxLplbF0vzIlwItCQfq7UP8lq4NK9tZt8N7r4K5W6qL8ZYuDCnPqdWJY3frJ5YNqZs SjgN58HBG1j6IFDT6Pe/kuRfQrAoVWsj3he5yjM3a5JN/hCYLEZxujKSiWPRY0YezYYn 9KFCcu0KUnOHkj1YOnCR0Jzm8ncSWjCzRrqluNCJWeUoeZPqKnINoCWx+bykb58eCDHU acdlcEzp7F+PWpzAeJBA5AhxG/8ZRa6OEAATo4Kh3NJCy8gn7pWHVzki4SYCFTLdPYrc /7sQ== X-Gm-Message-State: AC+VfDy838y6B25nvNdjPQDm6kLJcwuPLaFKhoQZuzCHr5XxCuNJkh3E o71ZSXPwnb2uqBd/P7AEx/JO5UiIuf68kg== X-Received: by 2002:a17:907:3da9:b0:966:7a0a:28ae with SMTP id he41-20020a1709073da900b009667a0a28aemr1581658ejc.22.1685016601102; Thu, 25 May 2023 05:10:01 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:10:00 -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 v3 2/5] soc: qcom: smem: Switch to EXPORT_SYMBOL_GPL() Date: Thu, 25 May 2023 14:09:53 +0200 Message-Id: <20230525120956.3095317-2-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525120956.3095317-1-robimarko@gmail.com> References: <20230525120956.3095317-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?1766868244787450813?= X-GMAIL-MSGID: =?utf-8?q?1766868244787450813?= SMEM has been GPL licensed from the start, and there is no reason to use EXPORT_SYMBOL() so switch to the GPL version. Signed-off-by: Robert Marko Reviewed-by: Konrad Dybcio Reviewed-by: Trilok Soni Reviewed-by: Trilok Soni --- drivers/soc/qcom/smem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 6be7ea93c78c..bc98520c4969 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -500,7 +500,7 @@ int qcom_smem_alloc(unsigned host, unsigned item, size_t size) return ret; } -EXPORT_SYMBOL(qcom_smem_alloc); +EXPORT_SYMBOL_GPL(qcom_smem_alloc); static void *qcom_smem_get_global(struct qcom_smem *smem, unsigned item, @@ -674,7 +674,7 @@ void *qcom_smem_get(unsigned host, unsigned item, size_t *size) return ptr; } -EXPORT_SYMBOL(qcom_smem_get); +EXPORT_SYMBOL_GPL(qcom_smem_get); /** * qcom_smem_get_free_space() - retrieve amount of free space in a partition @@ -719,7 +719,7 @@ int qcom_smem_get_free_space(unsigned host) return ret; } -EXPORT_SYMBOL(qcom_smem_get_free_space); +EXPORT_SYMBOL_GPL(qcom_smem_get_free_space); static bool addr_in_range(void __iomem *base, size_t size, void *addr) { @@ -770,7 +770,7 @@ phys_addr_t qcom_smem_virt_to_phys(void *p) return 0; } -EXPORT_SYMBOL(qcom_smem_virt_to_phys); +EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys); static int qcom_smem_get_sbl_version(struct qcom_smem *smem) { From patchwork Thu May 25 12:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 98993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp325337vqr; Thu, 25 May 2023 05:24:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MWT32tWF0eYDYORfgUflURyMWUi4watm71Moat4wgBwPU6yNTCUVNcyRuHav/V0a9M72k X-Received: by 2002:a17:902:d487:b0:1ae:8d2f:5a48 with SMTP id c7-20020a170902d48700b001ae8d2f5a48mr1451429plg.41.1685017493090; Thu, 25 May 2023 05:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685017493; cv=none; d=google.com; s=arc-20160816; b=wT1+CGu9rbki5xB7MJuRe4+c5wgOh4Zqo+SkGUardMdYbDaDFIyvAYYKAO3d/7KlgI QY7RjUD3ESzj0DwUN+kxGwsDyRFjdbQCcimB5Ys8GjffuqoeHIoB+daJzvqawzZCnC1m 9IY2o9s1KR3YEbr0dB4s/GtSzOKT9K4X+WYU7aFWFXJollsAj0tKz3byjTJhMFm0NHb5 LSGZePKc4UjRQAi6ZDtNHVtFm63ttvbTbtpwebQ2KLVqB7S0n88eh/f6GJGYpdkOCupk TBIu3KvqYEW7kxhnUQHVKxcbZeQ3uSum4mN6qPYYbvKzGjf3hWVtW+Cw7CoTUiW2KRkL Dw2w== 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=QpR8//zxRxGnU7TlHH6wfvPeUzP0bueyOOjz5my8OPQ=; b=FbU1DCxm+zATqnGbq2G1oIKu3uL8eqylS/5r4boBqsbRYtSzzTjeYpTjKHHflBsb2Z l7YAfQkGSOSjAEzySDS2E7MD+X4Ax1R52mTF1c3IgQzaEGNGrHg5m1GpXDHl453FKGFD /4SJXHb8Q01ioZTClGZO/RTUhnJwyvMCE0X0RcsFTiRmhBzpgK68HvmOfrdiKRIZSuwV WyMPiDyraeZY9anIpzveG7GiZvQddkoqRoCAucGwl1ShzMIYTIWXwYsp0xSejOoeOoYF 0mzhsb3AVj/58v+wR14anl6Gp3lReswfQadqMKcM0dD8EJ+A2UjA4Xm+Krme5AHoyOQJ fJCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=JyAUpP40; 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 x13-20020a170902b40d00b001a9baadecc0si1322443plr.160.2023.05.25.05.24.39; Thu, 25 May 2023 05:24:53 -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=JyAUpP40; 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 S241144AbjEYMKK (ORCPT + 99 others); Thu, 25 May 2023 08:10:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240814AbjEYMKF (ORCPT ); Thu, 25 May 2023 08:10:05 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24D0C12E; Thu, 25 May 2023 05:10:04 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-510eb3dbaaeso4019607a12.1; Thu, 25 May 2023 05:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016602; x=1687608602; 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=QpR8//zxRxGnU7TlHH6wfvPeUzP0bueyOOjz5my8OPQ=; b=JyAUpP40azFAgzu44H45xkrBVGgHg0wB8bsU3WOWhTNG+cQI0cMJ26LU3/XsvYfeK0 FKbYqDbwE4XY2vUOU2q/MjWBaMMiBbCXECzYx8cCZZbC91FfKzpuDOZvkF80oRHD46Yw t+29ULqtPSATjFy6mFjhdLxjG6LwcwA76Tq4hXapj+K7OAB2pac5qXgio8LT8Id7/uLb ApRCPk16QmrF19OQrOhYK9mIQ1GuN5XAtQasOySTutrUCjkJn1FzcrEvdHHeWmUB2JBx jPhU8HNxen/pQx0O50DIo8oz/qC0fq4M/TvIU/OVAEgYRYyHVPrymygIq2F4bgRAd7Hu 4Qbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016602; x=1687608602; 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=QpR8//zxRxGnU7TlHH6wfvPeUzP0bueyOOjz5my8OPQ=; b=YjWbXTnTEZUF1HRm55g8upgvcOWyeZIgOY3Lb070cahCg7pptXWdrvkS18fjtdwfld ElmZcmvjstmgA6Z1oxaT919Pf6OvkMVl8Dk22PaHtvHhGmy69DL1StZbMX5hiN25zC98 2m8PdQpAaNPjBZW5E9cF9gkyDcdNA4c6Q4M7g3mBod5Bd+8mrcZYyGcSJqXMI0Z4gBoV b+75WNeuC6DvsU/ianSLjdeD6enwUVnDL+KfdUES7CpOdTALemBVq+ZVDe7dZLy6yJUt sNPrLdozjYNahMgZcWpf4U8yrsoupsC5o46Oh3Fn5JwVq+QosbxHfcnwHRBrYG9ZJFsA e4lQ== X-Gm-Message-State: AC+VfDzGJMwEB2R6VdrOAFD3iqHZiHH2J4hs4uHIzZcTrQzWwtSDEVIR unemRQqnhjexwwUM9CrUM2Y3VM+1eemvwA== X-Received: by 2002:a17:906:9b95:b0:96f:1f79:c0a6 with SMTP id dd21-20020a1709069b9500b0096f1f79c0a6mr1186172ejc.70.1685016602362; Thu, 25 May 2023 05:10:02 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:10:01 -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 v3 3/5] soc: qcom: smem: introduce qcom_smem_get_msm_id() Date: Thu, 25 May 2023 14:09:54 +0200 Message-Id: <20230525120956.3095317-3-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525120956.3095317-1-robimarko@gmail.com> References: <20230525120956.3095317-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?1766868903077433404?= X-GMAIL-MSGID: =?utf-8?q?1766868903077433404?= 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 --- Changes in v3: * Change export to EXPORT_SYMBOL_GPL * Use an argument for returning SoC ID * Update kerneldoc --- drivers/soc/qcom/smem.c | 24 ++++++++++++++++++++++++ include/linux/soc/qcom/smem.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index bc98520c4969..185ed0da11a1 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,29 @@ phys_addr_t qcom_smem_virt_to_phys(void *p) } EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys); +/** + * qcom_smem_get_msm_id() - return the SoC ID + * @id: On success, we return the SoC ID here. + * + * Look up SoC ID from HW/SW build ID and return it. + * + * Return: 0 on success, negative errno on failure. + */ +int qcom_smem_get_msm_id(u32 *id) +{ + 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); + + *id = info->id; + + return 0; +} +EXPORT_SYMBOL_GPL(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..cb204ad6373c 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(u32 *id); + #endif From patchwork Thu May 25 12:09:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 98990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp322831vqr; Thu, 25 May 2023 05:21:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BEldrQzZZZObimKdwbXR6UD/gH/71NotwCzWknzFqXLViqf0AkrdSfAyYGTzc3i18kLLv X-Received: by 2002:a17:902:9a8c:b0:1ab:16d5:998 with SMTP id w12-20020a1709029a8c00b001ab16d50998mr1436682plp.26.1685017274906; Thu, 25 May 2023 05:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685017274; cv=none; d=google.com; s=arc-20160816; b=Fca86t6XAacpJXCxz7gakOXXjIplIW4T0oiD4MCGqO0M5kexpR8XRVar8dQRlHP4pA 1S3hrLKhEgWAvWnT5fjRDAVhLySYsrevqeT9M5WxDamlpEOiSFaH+xQ1Io+uk13TBzNc gt/MGsoik3+UmOlN5fKZKnhYZg/HtxwzJzqtWGdL0QWDigWXZ4QErVMi6JfdA1QWDgZO nfIaDf3rmVgMSld7t9uTCInm0b+bveso8x722JFnnCURoK01ftbTBmyYlZanS6oG773J mcGaeSJ+rysmtWCOX6775jQKfW7r1ml4IYkolgRLH4Q7Zeime6ipBG4pr/fiWH6Ljzpw 2lvw== 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=pwgUoZef6VPezwUS7qK6LVybsuD2fEOQMGBTppnWncfzVXXMGXMTQRJ2h7oqQugqdp 2+B6sniktZhgIUsyDiFnkHw5U783In2MQhqbSNSwraNrpXIUE1jSJ9oYNSEqx5vF/sXc v8E/slCYD6krgEMwzIzmtV0CHS7HDbX7o4Mbpl1pxD3MhtHZLdWhYLRQooGUSDHlNF5s CEKT7bg6nuAhO7m/BETy3K3pJCJz9nUBjMXuwo9kkh0W6Uo7J0MX82AqhRq+YqS6XCo7 SQBxT7ZR2tia9d2aSyWeoFP4KUUDD9YYJ8JrLuqSho7Rv6I/6+9BP6BIEc91k2apyB8o 3jrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=GOUtwfzP; 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 jc7-20020a17090325c700b001a6cf4b4d6dsi1046167plb.289.2023.05.25.05.21.01; Thu, 25 May 2023 05:21:14 -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=GOUtwfzP; 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 S241152AbjEYMKQ (ORCPT + 99 others); Thu, 25 May 2023 08:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240900AbjEYMKG (ORCPT ); Thu, 25 May 2023 08:10:06 -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 4324813A; Thu, 25 May 2023 05:10:05 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-96f683e8855so82446066b.2; Thu, 25 May 2023 05:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016604; x=1687608604; 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=GOUtwfzPxtELqg3Ri36VE60/4NTg/iDdprk4djIdIXaitecB7GeUQUitlaVHTKL3FG WvY9g097lOTq9vdGSb4bKKl2GAyda+Blrko6ZYKOpF+LCPzWieRXvRbpi5sHHs5uwzSR vJPf7S6U+DxcRKRxLMGPBX2DT6keND7DbBTs0THzj1YqW9IZVZAXbqg6FOvP2VLA7uim nCSoxfVTf/HhHidvPFjOg5IiXQZ+buZh59Ns1yzOtbo4dvguBXUTUfx2M6Arab3R4Avh lMW7pQce1DzjwBxycTv4lgNTeUjR5JDQfvlYDRyYWfYGG0WxkjF9Kx+5a/Xo2EE1T1q/ 4WXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016604; x=1687608604; 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=VobwFHxlTsEnQYlCfkcxftQFhuimHWrnnSCKajTFQEmBbJooz3jje1tq/thuGQdvU0 W73GAwnkMyEmvcDnAjhqQDMVJlcGoKITIUm5HCoc5CcVh6ax5uPyhSVnFFhEVV7VvdoS 1Ao7Ryi8a9VMiwAqEPsI3sTUWx2h+2wWrrI4J3kz4s4GgplBxssJJFD7x2IifdW80PVk R/VZhubSsHcVdIqpu+TV7qwuG0Wc5+R7k7vzRYuRydnqy9s7xRFXFzuPdw1nuzUK5bSQ mzXsSsbIiOXbuNhogWfkYd6AjUSpffcM27vcmWAU6hW3ztSzGwmEo5qgVI/IwzZD+kwV +8Xw== X-Gm-Message-State: AC+VfDxJo3SvkkIik1xgFCKfKf0mQe2qthPnFyzvz6zj6nmg63szL3Ih mny03eCptWnKEM6lZdJbPJI= X-Received: by 2002:a17:907:948f:b0:967:769e:a098 with SMTP id dm15-20020a170907948f00b00967769ea098mr1209262ejc.15.1685016603673; Thu, 25 May 2023 05:10:03 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:10:03 -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 v3 4/5] cpufreq: qcom-nvmem: use SoC ID-s from bindings Date: Thu, 25 May 2023 14:09:55 +0200 Message-Id: <20230525120956.3095317-4-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525120956.3095317-1-robimarko@gmail.com> References: <20230525120956.3095317-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?1766868674064780776?= X-GMAIL-MSGID: =?utf-8?q?1766868674064780776?= 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 Thu May 25 12:09:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 98994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp325700vqr; Thu, 25 May 2023 05:25:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5EaPLhjKUbLsXHg57fV2jFgL0KVJjd7qbekJo+7wXSTwuQaR/vqY3UuGV4KM8E/yJAgZ/M X-Received: by 2002:a17:90a:8ce:b0:24b:7618:2d16 with SMTP id 14-20020a17090a08ce00b0024b76182d16mr1722351pjn.31.1685017523593; Thu, 25 May 2023 05:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685017523; cv=none; d=google.com; s=arc-20160816; b=MqNA3/zovPWS1IS+iTJubBc3XWWBTHHmJb7p7jnTC2FFNAjcp2TncjHBHcwutWy2ay SyUls6f+e2tmVBvOAq0c3ju5yF+dHIDSOvocVeTmvi4ijDEtk7ag9dhLsupI2HhBRQQp csxzjzxQSuJ9rA0VWsb4ik4IbztoLZ6tGKieu/85Y+x1c4C/ljBQzrNChAjUeXz/f//7 s7w5U9k5ZpHApz9ymJJSDcxkhvZTzeSaskgR/Pq9iJ5LV8aSusENQkitXD9giM43UjoI Pbs4o7zPkUeuAJ1HLVd1H1i1fkfXaQEP9fX360j5s+EVhcVJZuoZrs95KSeR/NB3EKfV g8Lg== 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=KB+lfwPJ6+4o7RQeb0vcEyQtsD+Ddm0kRPNNohX3Hqg=; b=iCBVvUfj3o+XCuLONYzlFBYzL02wvdpnwqgxaHQQ2Yl0VsHyhBmmO/p24iA9gpHNKf 6z4KKzbvYNoisvUn/O4nMp+Dn9RWDNisaiBthZxIVTKrXPoKlwvh9TdePXllDFwpa8yk yyHk6FHhyDFM81BqZplZcX0ls6fl47CBHhwybBG/SILm6AwLEtSaONjTewKOJTNGvUfk 8Q3IlATUloaMf1/e0OqmqEh3vpTCqnKxhsbACxasDE2wVzcJAN1rvTo6AEglH++n+qdR +XdLdhKv0wT8/Fl2fC4A+SYohHrhRKk1+3uUsQvrT6vpJj7zvOtAFmqssibIeJv4J5Sa w7Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=aCPHY8Fs; 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 190-20020a6303c7000000b0053f18935d87si1026216pgd.784.2023.05.25.05.25.07; Thu, 25 May 2023 05:25:23 -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=aCPHY8Fs; 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 S241163AbjEYMKS (ORCPT + 99 others); Thu, 25 May 2023 08:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241125AbjEYMKH (ORCPT ); Thu, 25 May 2023 08:10:07 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A39049C; Thu, 25 May 2023 05:10:06 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-50bcb229adaso3994505a12.2; Thu, 25 May 2023 05:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016605; x=1687608605; 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=KB+lfwPJ6+4o7RQeb0vcEyQtsD+Ddm0kRPNNohX3Hqg=; b=aCPHY8Fs8pUtdIZyoS5xQc5KsAKrLdSygCXYe7EdcX7jFgGe4AnK2V0jHWkDWUMhmn 3ByfK1HqA+mP4Qjm849pr8uuOZcmhGLQmAb6BvYNag82EwrjeqdaguPE/ZpBbw4abXME 2TG8zAUVO0H/xET1u6qut9MwCC9GNbdNzzNFkJycJx7mn8pvjBy6lFlMAtKWaOWxa58O BC4alUtagV93NyVx3njWgKkqE2CC2/Ryht4CteXWfYs0oCHvckxiJEl8ag9Hgk7QVTTE Qz8EN6lcfUc/RKJqnyXM+GPjzX4gBVXgFgoIs2UMjbbz1r+XXTSkEwZRPcGaiG+TxiFO nT8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016605; x=1687608605; 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=KB+lfwPJ6+4o7RQeb0vcEyQtsD+Ddm0kRPNNohX3Hqg=; b=hjiNADUx0tK8XKfRsHuB+8t5CPKGatXyGFZWah0aZtQhyl6fISPrjb1HHZlEC4GIo9 9+yyudN2ZTuZc5WAYMqFLtvGUroq98yJ9cZrWCnYQpcCVh7mzenBzd6/3kWa4dwGyqx6 5tW2KpvodcF6PM74fTCHnyrdgb0DHekKrsu2soImDdva4NuzrjRb1F6EbeiV0GDu+Xpq DrhSdgmdyBopCSeN1uP2KcJZjihjnFr+ZdFzQCXynSTYr3mAKs7SADXSWMo0DyfoupT0 hll/soheyQELtqwkyrlkGn+omEEIeGryKsbtIZh+rtJFKHTbWAAmir9cBk+nN4sodsgz mH8w== X-Gm-Message-State: AC+VfDxa3/TA8xo8XF0tavo3r7h1EQtg0N1Zf4dUtveym5lJNr91Nsx3 n5/Ij2WGcCWW8OmgXAvItCQ= X-Received: by 2002:a17:906:6a2a:b0:961:be96:b0e6 with SMTP id qw42-20020a1709066a2a00b00961be96b0e6mr1631797ejc.68.1685016604848; Thu, 25 May 2023 05:10:04 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:10:04 -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 v3 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID Date: Thu, 25 May 2023 14:09:56 +0200 Message-Id: <20230525120956.3095317-5-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525120956.3095317-1-robimarko@gmail.com> References: <20230525120956.3095317-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?1766868934484826819?= X-GMAIL-MSGID: =?utf-8?q?1766868934484826819?= 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 v3: * Adapt to helper using argument now Changes in v2: * Utilize helper exported by SMEM instead of refactoring qcom_cpufreq_get_msm_id() --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 56 +++++----------------------- 1 file changed, 10 insertions(+), 46 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index 60e99be2d3db..ba001ebcba11 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,32 @@ 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; + u32 msm_id; u8 *speedbin; - enum _msm8996_version msm8996_version; + int ret; *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; - } + ret = qcom_smem_get_msm_id(&msm_id); + if (ret) + return ret; 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: