From nobody Mon Feb 9 19:16:06 2026 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25F022236F0 for ; Thu, 19 Dec 2024 11:34:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734608062; cv=none; b=CYTU0uZCuXjOB+AKCNRTZa7NCzhceixMLG9oNJtbb7AhuAakCeRJFdQJzJqmmO8DjyKrQMcqEblxLCJo3KzQLQp0pIWR0Pjbdoiy75jcHVhRiXCHyZADAitGytRZ7lRdey7XgdNmQ2L+1u31ULpUYF3TVv9yrhdeAgvdGHJJgZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734608062; c=relaxed/simple; bh=3mBOIBYImMmGpOa/n4wEq/aik5PFltgR59Pw0RfEG3s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BtHkALq0XZMKzJkrA6tCq4m08COnlXy/xB0WQXqiceaTwF2JBYdsFW8j/XiftWMdyIPmaFSmQiE0gR8urGmoQyd0JpWFYCpHOA5VIw42g1QEmClliSnXRfUCrc2ynXwAC68yaIgyAK/o2DG3dIb6Aut6scTMI87wjJatr07+bQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ERH8mbOm; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ERH8mbOm" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-216728b1836so5703335ad.0 for ; Thu, 19 Dec 2024 03:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734608060; x=1735212860; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Sk1QPolGn/nUdbf7OB1vt7Xy/ZysEgNs8FEJCCCn++k=; b=ERH8mbOmuELfH4387M6y4xBrUP5gy510f5nYlGr4mCMM1/yZNRm4XDLm/kIVtT1188 cRxr1rT6jVIZtju+NkYRaia5PtTIIMsRVdSvI5eiA65cxHTneNqtXdYe58NcymuaoY5n 8X1c1gr3Yj50Ch7XzVjr1BmSqg8J+p4G4f5mI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734608060; x=1735212860; 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=Sk1QPolGn/nUdbf7OB1vt7Xy/ZysEgNs8FEJCCCn++k=; b=m5bzdQb1KSVlMkJD4Q0UNYuhtB157rR0XRf6FTom9fz7lXm1askMyf+Op31K63mcPd AgVk7dAV5uPvy/BWzDQjBHspBMVpdBLLOYIKKtN/IJJjIYcWKtlYwQNyzgdmEHu3lHuZ 1B6Glruj6uI86E5XhKFtGoZDWEb3mF1YjkzXf+gcptIfc2vBR6ta6miPqiymj2P42gUz PjG9YEqtwJPakFbre6jvs9CrIiUZHE/JsqCrlCFXT4gy7b9p39Q1vPXt+IPMwytJJoEh z0PVUsOZDHh4JdTYRrt2Q5DXjcp5dFhAmSyi0OzOg3+nBr2iz9wEE8EGbHj9vO2MHujo gjfw== X-Forwarded-Encrypted: i=1; AJvYcCViuInETLMAnWFL6vy0nkpFQETJ86MPUNqYCBw0TexBkwH1jVqKFyJJF154uhRZBs/yIAC6rDNI7LthDBE=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3k3gCE9zzFlTpKHFOQ592XyPAxOVlMsOjFl8VKetHY+UQzXU7 b6tL2+OK0IrlHPdjOmttAA53TAvntrKQmgwdGwsq17eX5nmvOGyxIbeTociHAQ== X-Gm-Gg: ASbGncveJqr+sBlhX2JjNXfWrLC+3eOUWgZ52joRfoJY/hpZZhTrKxIE2tUcs3JVBSi WBKF7lNsz1pCJsZVXixhwd8TenAS7HASsbnMK5FibrYI2CE2G+LvIVuW8soyjRDAOKcNb8C/XyD t8sy/xIe2ASgP0gOCpEpyUMP3DAibImST+tAwU7kT1Ha4zKCaqVWOyuwoa8MR4CJcKOU3H90xoT 0CkgHGySkQVriVlb/6aof51BJ3w/PhaCajZchIJVQ1HEmwiSHZrOAa+PFCMmRt3INPhUZu/UZ7E X-Google-Smtp-Source: AGHT+IHjcIqLiZw2eED/D9V3yl8u83INLOhWzncyRqB0BE96XxrVo1TlRtGkvCpfaEG7ZGHJSJ/hhQ== X-Received: by 2002:a17:902:dac6:b0:216:1ec6:9888 with SMTP id d9443c01a7336-218d72368afmr93453945ad.33.1734608060271; Thu, 19 Dec 2024 03:34:20 -0800 (PST) Received: from fshao-p620.tpe.corp.google.com ([2401:fa00:1:10:e7f2:d393:53b5:6874]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dca025d1sm10375935ad.254.2024.12.19.03.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 03:34:19 -0800 (PST) From: Fei Shao To: AngeloGioacchino Del Regno , Matthias Brugger Cc: Fei Shao , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH] soc: mediatek: mtk-socinfo: Restructure SoC attribute information Date: Thu, 19 Dec 2024 19:33:50 +0800 Message-ID: <20241219113411.3999355-1-fshao@chromium.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" So far, the MediaTek socinfo driver populates the SoC information as follows: - family: "MediaTek" - machine: " ()" e.g., "Kompanio 1380 (MT8195)" - soc_id: This approach has some drawbacks: 1. "soc_id" can be used for showing the SoC name (e.g. "MT8195"), while it's currently unused. 2. The newer socinfo API automatically populates the "machine" attribute with the model name from board DTS if unspecified, which we may want to preserve if possible. 3. "machine" combines the marketing name and SoC name, making it trickier to parse. Ideally, the marketing name and SoC name should be in separate attributes so userspace to utilize them as needed. 4. There's no guarantee that the marketing name will be announced along with the SoC name. If either is undetermined, the current design will result in a malformed "machine" output. This is observed on some newer MediaTek platforms, where the marketing name is still undetermined but the SoC information needs to be settled for device registration and validation before launch. To address these points, this commit proposes a new theme to display the SoC information: - family: "MediaTek " e.g., "MediaTek Kompanio 1380" - machine: "" (auto-populated) e.g., "Acer Tomato (rev1) board" - soc_id: "" e.g., "MT8195" Moreover, if the marketing name is not provided, the driver displays "MediaTek" in the "family" attribute instead, consistent with the previous behavior. Restructure the way driver populates the SoC information as described above. Note that Mediatek-based Chromebooks are the primary consumers of this socinfo driver, and Google has prepared corresponding userspace changes to comply with this update, so the impact to userspace is controlled. Signed-off-by: Fei Shao --- drivers/soc/mediatek/mtk-socinfo.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/soc/mediatek/mtk-socinfo.c b/drivers/soc/mediatek/mtk-= socinfo.c index 123b12cd2543..b9dbc90d7814 100644 --- a/drivers/soc/mediatek/mtk-socinfo.c +++ b/drivers/soc/mediatek/mtk-socinfo.c @@ -62,17 +62,24 @@ static struct socinfo_data socinfo_data_table[] =3D { static int mtk_socinfo_create_socinfo_node(struct mtk_socinfo *mtk_socinfo= p) { struct soc_device_attribute *attrs; - static char machine[30] =3D {0}; + struct socinfo_data *data =3D mtk_socinfop->socinfo_data; static const char *soc_manufacturer =3D "MediaTek"; =20 attrs =3D devm_kzalloc(mtk_socinfop->dev, sizeof(*attrs), GFP_KERNEL); if (!attrs) return -ENOMEM; =20 - snprintf(machine, sizeof(machine), "%s (%s)", mtk_socinfop->socinfo_data-= >marketing_name, - mtk_socinfop->socinfo_data->soc_name); - attrs->family =3D soc_manufacturer; - attrs->machine =3D machine; + if (data->marketing_name !=3D NULL && data->marketing_name[0] !=3D '\0') + attrs->family =3D devm_kasprintf(mtk_socinfop->dev, GFP_KERNEL, "MediaTe= k %s", + data->marketing_name); + else + attrs->family =3D soc_manufacturer; + + attrs->soc_id =3D data->soc_name; + /* + * The "machine" field will be populated automatically with the model + * name from board DTS (if available). + **/ =20 mtk_socinfop->soc_dev =3D soc_device_register(attrs); if (IS_ERR(mtk_socinfop->soc_dev)) --=20 2.47.1.613.gc27f4b7a9f-goog