Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp243928imn; Wed, 27 Jul 2022 22:09:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sM1Q3szZitgLH7meHbymR+fDrt2eFq6MpPn8U0KlFpLcTTWWt44zTzNAWdyfwb72WC7J+A X-Received: by 2002:a17:907:724d:b0:72f:2366:be86 with SMTP id ds13-20020a170907724d00b0072f2366be86mr21006935ejc.146.1658984941466; Wed, 27 Jul 2022 22:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658984941; cv=none; d=google.com; s=arc-20160816; b=Lumi8NQrDiL9AqAz+oO0GMoqCJEQURO6QP8l4WEBw0iTtqduE2LZzVZA2zJ2ZKSg/s pNuPbpcrUXj4LwVvuiEdgo5Zr7aCCcopdu+QIDFixuJgroQLWPhWBNnRilgCU6OqKQvc dTkDkEwbiaUwmdRIuhJK2UOXFSQLZHdUZ2IfyPfivkBjwy4tly2h9itpVLvOIEIY+MTY BW1SWVgcJMtxLDdeHqrbTR0zh2S/sem06I4voyjbLn1b52lVXsPAAozoXrsyVDfTpOOU dtS7Qnt+U/Qnm2HTfde5BnplDWhbC9aMnSrSxD488kAVS7UABP6GzgmnafEOyEVu8Oxg xzNg== 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=dIU+0kp3XN3YAPMWZ5u0JzDJny+Q5/T546hhxY9/MfE=; b=VXsI4/JdCMrDmgY3nq9gfgUpP5ivSQCHyVZzdwODlwyoYsoHRpKGbqIklGI86cKwa5 X3xJU6Z4M+z79KnpLfvF0U/i2BoLDNnx2aGYsaAmgyB8d6w1a2G61rRzjrCiwIjTnHPn KveJ5iWZaGkNdBi0UK02lu63YL2eNTF0GIqdnZdsuH2VT1DW3K987WO5bOFfsKtFzxpx CvCv1BaKWfKml1cTHiEGO2XKO8X5LfjXtb1PM+BNEr5yNnQJC/cfhsLbl+7EG2XsV7Cf iVrMB2NN8ZXX1Me/xilPlVhuJL7Zha6H+bRxsR3acYJjxN5uYXRqbHiEkuW8UOA8X+f5 YMOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A3sLGIAm; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a17090658c500b0072b2e31d066si23076369ejs.642.2022.07.27.22.08.36; Wed, 27 Jul 2022 22:09:01 -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=@chromium.org header.s=google header.b=A3sLGIAm; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbiG1Etm (ORCPT + 99 others); Thu, 28 Jul 2022 00:49:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230180AbiG1Eti (ORCPT ); Thu, 28 Jul 2022 00:49:38 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0B8758B40 for ; Wed, 27 Jul 2022 21:49:37 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 12so639564pga.1 for ; Wed, 27 Jul 2022 21:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dIU+0kp3XN3YAPMWZ5u0JzDJny+Q5/T546hhxY9/MfE=; b=A3sLGIAmpGd9lKIDOhhq2hO5j80ogagK4XK4GFtQnARt4AIiSbaTzZIev/8/RK64dm IoPap9nhtD+S410RMzgKbqmbyRJch/aDkX+U2Mbo3tGqrioZ4UdbR2Dky3+NMXqYuhCl BChxx+YrgUl2Fgl1eZB2jV7hWmHzxKVSnT07A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dIU+0kp3XN3YAPMWZ5u0JzDJny+Q5/T546hhxY9/MfE=; b=edt1sfnbjsGHMh5PLqB5OAwziR7bqgWIjh2ef4GbhYXaqWR6A1ZTs6KTKEY+tZptT1 3EAOMiega+hkZHE4/E74IMotGhLVboUJLpnkkT+c/nGHQzPteX1Ssgxr2gdSGGAb4b9o tBs7uvAgGeZSfEJ8a4eHQlrxGxis0Mtw+6k9sRFBYJuda8Xai52jt5wzomzFX8i2FGf9 7N4HQ6OPshoiBsJCFPRgF+eelUIA0DpnoryYHYSdY1E4Re1CGTMJTGjO2uvPQPFdKSck opz5q1oo8TuZ+xH05zPYqIBs6thEufG1UHjS74efrxkIr8RR/YtaWGpWYJr31hTKcOb5 ANFw== X-Gm-Message-State: AJIora/M8Sp3fJSQMFL2BF9pFptEhXxOx5rE2PGAIUjvWp0TCb1G8cxI AQYuo9o5VNK7Z5rt5XboGdX+CA== X-Received: by 2002:a63:e80e:0:b0:419:d02c:fc8b with SMTP id s14-20020a63e80e000000b00419d02cfc8bmr21198632pgh.385.1658983777433; Wed, 27 Jul 2022 21:49:37 -0700 (PDT) Received: from dlunevwfh.roam.corp.google.com (n122-107-196-14.sbr2.nsw.optusnet.com.au. [122.107.196.14]) by smtp.gmail.com with ESMTPSA id u8-20020a1709026e0800b001640aad2f71sm14530251plk.180.2022.07.27.21.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 21:49:37 -0700 (PDT) From: Daniil Lunev To: Adrian Hunter , Bart Van Assche Cc: Daniil Lunev , Alim Akhtar , Avri Altman , Bean Huo , Daejun Park , Greg Kroah-Hartman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH] ufs: core: print capabilities in controller's sysfs node Date: Thu, 28 Jul 2022 14:49:25 +1000 Message-Id: <20220728144710.1.Id612b86fd30936dfd4c456b3341547c15cecf321@changeid> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Allows userspace to check supported by the controller/device functionality, e.g. write booster. Signed-off-by: Daniil Lunev --- drivers/ufs/core/ufs-sysfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c index 0a088b47d5570..b0c294c367519 100644 --- a/drivers/ufs/core/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -254,6 +254,14 @@ static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr, return res < 0 ? res : count; } +static ssize_t caps_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + + return sysfs_emit(buf, "0x%08llx\n", hba->caps); +} + static DEVICE_ATTR_RW(rpm_lvl); static DEVICE_ATTR_RO(rpm_target_dev_state); static DEVICE_ATTR_RO(rpm_target_link_state); @@ -262,6 +270,7 @@ static DEVICE_ATTR_RO(spm_target_dev_state); static DEVICE_ATTR_RO(spm_target_link_state); static DEVICE_ATTR_RW(auto_hibern8); static DEVICE_ATTR_RW(wb_on); +static DEVICE_ATTR_RO(caps); static struct attribute *ufs_sysfs_ufshcd_attrs[] = { &dev_attr_rpm_lvl.attr, @@ -272,6 +281,7 @@ static struct attribute *ufs_sysfs_ufshcd_attrs[] = { &dev_attr_spm_target_link_state.attr, &dev_attr_auto_hibern8.attr, &dev_attr_wb_on.attr, + &dev_attr_caps.attr, NULL }; -- 2.31.0