Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp865409pxu; Fri, 4 Dec 2020 18:43:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVWHzx0F7mDx+PYu72ZjYxXv5k2JrTezZ10iMNys6DIABMzXs9e2qUyuEwc8MnW2erOqij X-Received: by 2002:a17:907:a8a:: with SMTP id by10mr9666782ejc.423.1607136239246; Fri, 04 Dec 2020 18:43:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607136239; cv=none; d=google.com; s=arc-20160816; b=NuC6qNABcFTKz+DC59EMk6snJ3cDdq/lrCW6UR39VR+1lOvnXc4ZrV6RBekcOY+Slw JVzf8DffpHr2mwIc43uXf6TZ8YFq8Fra5RQqpDEYDWhWmxSpi78Za1cLu0MMz1Hdfhee /cQaUMfFt6k7OagAhVf+Wm35JrSY68guRxQevlQeM7R7sllgCGDcrJSMfRewZ2FF4kVz zywMDvezCz1bn7ZN6olA9D8Ar/tI4x7DLqXYc2gEneCk792htN5FMWkLUSljSeJ8H9+E RwOnhaLtW9iaBWXzcSok/DkHxj5qpIKjkbbXanZJ26Wm2EaX5iS/OdNiEG9sNz3TeNWn 6YSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=VpL6ilhWl28xj+mOvN/2XQm+MRfnZFZ/gWmiQfUvW5Y=; b=q71lzVjOr4n5YFehM2oukcxQrnICoIkVZurbWZBFYvuuNtfxkaKPvdVTcMdMYrWOP4 CoGRe5MmGqv0JxGBiT72+08YzYOcUP6MGHH6MNzmBZ+UMweXVoRuX1/SkcYmjny/sLBH Y87PB53k/0gV6PTBuz9Z6+Wtn9GDT0k8lCtGTm5Ezd1Yw1xm8o8RSuw7zGnQJ1Y7DTgE FCnw3WFCHhzu25Wgb4AEsywNbrZcn6tS3eLJzPMRVkJZuTwuy3iKVaRVNkFtt4IrX93k HRzX6pPd84NAKQ69FlJN946+LS+UY3JhCdb/OUDgTwj/bMcKjgGbN1gbt7dUbWA3jjpj 1wjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq14si4702458edb.516.2020.12.04.18.43.37; Fri, 04 Dec 2020 18:43:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728404AbgLECkn (ORCPT + 99 others); Fri, 4 Dec 2020 21:40:43 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:43884 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725300AbgLECkn (ORCPT ); Fri, 4 Dec 2020 21:40:43 -0500 X-UUID: 727a67e07e1b48fdb5e8dbb87bd9d090-20201205 X-UUID: 727a67e07e1b48fdb5e8dbb87bd9d090-20201205 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1144447061; Sat, 05 Dec 2020 10:39:41 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 5 Dec 2020 10:39:37 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 5 Dec 2020 10:39:36 +0800 From: Stanley Chu To: , , , , CC: , , , , , , , , , , , , , , , , , Stanley Chu Subject: [PATCH v4 7/8] scsi: ufs: Introduce event_notify variant function Date: Sat, 5 Dec 2020 10:39:37 +0800 Message-ID: <20201205023938.13848-8-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201205023938.13848-1-stanley.chu@mediatek.com> References: <20201205023938.13848-1-stanley.chu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce event_notify variant function to allow vendor to get notification of important events and connect to any proprietary debugging facilities. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 1a7d31849511..6e72c0543c7b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4480,6 +4480,8 @@ void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val) e->val[e->pos] = val; e->tstamp[e->pos] = ktime_get(); e->pos = (e->pos + 1) % UFS_EVENT_HIST_LENGTH; + + ufshcd_vops_event_notify(hba, id, &val); } EXPORT_SYMBOL_GPL(ufshcd_update_evt_hist); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index b55a71c10fa6..8c44929bed53 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -319,6 +319,7 @@ struct ufs_pwr_mode_info { * @phy_initialization: used to initialize phys * @device_reset: called to issue a reset pulse on the UFS device * @program_key: program or evict an inline encryption key + * @event_notify: called to notify important events */ struct ufs_hba_variant_ops { const char *name; @@ -353,6 +354,8 @@ struct ufs_hba_variant_ops { void *data); int (*program_key)(struct ufs_hba *hba, const union ufs_crypto_cfg_entry *cfg, int slot); + void (*event_notify)(struct ufs_hba *hba, + enum ufs_event_type evt, void *data); }; /* clock gating state */ @@ -1100,6 +1103,14 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, return 0; } +static inline void ufshcd_vops_event_notify(struct ufs_hba *hba, + enum ufs_event_type evt, + void *data) +{ + if (hba->vops && hba->vops->event_notify) + hba->vops->event_notify(hba, evt, data); +} + static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on, enum ufs_notify_change_status status) { -- 2.18.0