Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3301166imm; Tue, 17 Jul 2018 02:25:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfbS3ChzYZ7wOaBVxTrme3e2pjVbs/5zJVajSIzhK+bw+2GsdG9iiBOn/Xsr2dHreJpp++D X-Received: by 2002:a17:902:8347:: with SMTP id z7-v6mr882636pln.290.1531819553406; Tue, 17 Jul 2018 02:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531819553; cv=none; d=google.com; s=arc-20160816; b=ID9h+DjYlJnhv8YiOQ/PTNZLsCWEbaS429U2elm2QqMq43oN9ie+qnUEzVE9no3X/R IaU6xV2WvF6Povj9RJEkTp1F7RF4XvZM06357GMB+b3388oFNGyaytWEUE2TQf31or1j z7lV3ww8yXmjNsTs+e+DrNPJSndvt/rYkKYgMacZ8bUNKZCuwLqYRlQS52Mc365TWaaB uv8/E7UzeyfdpZXZVLsYr86/dkoF6IowdFTGwMr1Wv4Szuaj7QncZH6lkoFVwkmf16x+ 9eLOiClYl98/aIA1xdluYxeei2ukyng2K27d4hwVe8eZ0KlrEPWBplqGhvu4KxilLGkE ZoWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=c+N6yquO9w2DF1gaQeR513z1riV3LBKXGGfVf4zzASA=; b=x/4bQmYFd+am/gSs9JLUFTyXSlyyL+xDbtby1D1DEO+64wEZTSwDPAbZWa+I7kKXJu 3v4IaHgSYZ1WY/P7Y4zN68816IroVBpHfr3iFMY9EDsSsC4pAE1zhlKYMVUvOcxRnmVW EaTIAex4Rf5aUT5gLhm6JfOpydoiwcIxumBhvpMJZ3F8MvbKjTHG8T3yNI28ruO4q/9u UlfgzW8chwBtIr9BQBusQEKRa8gQwO52iUhV7i3OUauq2bFB16uwvWvDuGrlXnuVWPVx Cm9+4MFa5x7BpxBspkOwnkR9ImoRxdBWIj2Z7On4sciWVROpp0rRLpbG3kjF9u80aEdW LksQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BXq68SnU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10-v6si439041plo.326.2018.07.17.02.25.37; Tue, 17 Jul 2018 02:25:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BXq68SnU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729661AbeGQJ4e (ORCPT + 99 others); Tue, 17 Jul 2018 05:56:34 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37032 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728349AbeGQJ4d (ORCPT ); Tue, 17 Jul 2018 05:56:33 -0400 Received: by mail-lj1-f193.google.com with SMTP id v9-v6so383049ljk.4 for ; Tue, 17 Jul 2018 02:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c+N6yquO9w2DF1gaQeR513z1riV3LBKXGGfVf4zzASA=; b=BXq68SnUJOnOs2E3Xj1LOTuyoB7rn2SZRNlhVaburIer3dDA2VqM2QoDh/8tZjttU5 pBae0a8NdD3d2wcXg7Kjb9oDAImxGNv4pRuDjG42QdBVF5b3azorCBHZpn97QswB77RZ x5mimfFRevLYUnkM5m90GAEX3ElsPdHESRK0awJIFAX7tJOVG1SRwVSccW/Zfp4QppiQ yE2i1u2sX6x7l/vbYVvmUrQZH2mo36HelPfXWsVf3fhC01EjS+mIBTvdboPbzt+3SOj7 1s8/WrXpyrVDFcoOYLIS9yk4m3ZFMyg58x7KwwKBBqQ5+ke2HK9ibfZznPNNS+927kpH Rlhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c+N6yquO9w2DF1gaQeR513z1riV3LBKXGGfVf4zzASA=; b=RUAxKfrtox3K42JBp/qVz7h9TC5sIhZEJ5FVZ3uIUyDzQJG50fwRjjJbf0Ud+mmz0o +5Isg6yNKuiIPUvu492DH0SCIq0GaU8AYoHWQ22TyO1V35K4fwP3U1ZWaG5x5XuiQId6 fpGVZtKloa79ClGD3UJ4qDZA1LpFBXvjJBG1EKE8dJYP5Mo8vsX56fBkMfP7jtvtTFkx UAfEnWUF9ONeKMcaWKOg557f8h7dSxWean1XKg9JWQdpU56qC3M395zpRI1Nlo2hROKb 3IydmdDXTP/riy1Jot+7aXR237K+efDzrPLiokoZeXL6Ej/1EsiXJ7+CVJgPgEUf5brc X2Dg== X-Gm-Message-State: AOUpUlFskJRL/GIcM8QRGJo+U+YN6ByhCcoXYOVztnpMV/Eugdq6pT5j rMuKmHf12CFBV5Sbnuy7NO0= X-Received: by 2002:a2e:84c6:: with SMTP id q6-v6mr856197ljh.65.1531819492464; Tue, 17 Jul 2018 02:24:52 -0700 (PDT) Received: from linux.local ([5.166.218.73]) by smtp.gmail.com with ESMTPSA id l1-v6sm94224lji.41.2018.07.17.02.24.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jul 2018 02:24:51 -0700 (PDT) From: Serge Semin To: jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com Cc: Sergey.Semin@t-platforms.ru, linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, Serge Semin Subject: [PATCH v2 0/4] ntb: idt: Add hwmon temperature sensor interface Date: Tue, 17 Jul 2018 12:24:33 +0300 Message-Id: <20180717092437.18918-1-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180714115834.3350-1-fancer.lancer@gmail.com> References: <20180714115834.3350-1-fancer.lancer@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IDT PCIe-switches are equipped with an embedded temperature sensor. It works within the range [0; 127.5]C with a resolution of 0.5C. It can be used to monitor the chip core temperature so to have prevent it from possible overheating. It might be very topical for the chip, since it gets heated like in hell especially if ASPM isn't enabled. Other than the current sampled temperatur, the sensor interface exposes history registors with lowest and highest measured temperature, thresholds and alarm IRQs enabled/disable bits, ADC/filter settings. The device manual states that the switch is able to generate a msi interrupt on PCIe upstreams if the temperature crosses one of three configurable thresholds. But in practice we discovered that the enable/disable threshold IRQs bits interface is very broken (see the third patch commit message), so it can't be used to create the hwmon alarm interface. As the result we had to remove the already available temperature sensor IRQ handler and disable the corresponding interrupt. Current version of the driver provides following standard hwmon sysfs files: temperature input, lowest and highest measured temperature with possibility to reset the history, temperature offset. The rest of the nodes can't be safely implemented for the chip due to the described issues. Changelog v2: - Add "select HWMON" to the NTB_IDT kconfig Signed-off-by: Serge Semin Serge Semin (4): ntb: idt: Alter temperature read method ntb: idt: Add basic hwmon sysfs interface ntb: idt: Discard temperature sensor IRQ handler ntb: idt: Alter the driver info comments drivers/ntb/hw/idt/Kconfig | 4 +- drivers/ntb/hw/idt/ntb_hw_idt.c | 317 ++++++++++++++++++++++++++++++++++------ drivers/ntb/hw/idt/ntb_hw_idt.h | 87 ++++++++++- 3 files changed, 353 insertions(+), 55 deletions(-) -- 2.12.0