From patchwork Sun Apr 14 21:58:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Adamski X-Patchwork-Id: 10899995 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93BD717E0 for ; Sun, 14 Apr 2019 21:58:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EC3F28789 for ; Sun, 14 Apr 2019 21:58:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7261928880; Sun, 14 Apr 2019 21:58:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09D7628789 for ; Sun, 14 Apr 2019 21:58:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726233AbfDNV6F (ORCPT ); Sun, 14 Apr 2019 17:58:05 -0400 Received: from mail-eopbgr30115.outbound.protection.outlook.com ([40.107.3.115]:56925 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725829AbfDNV6F (ORCPT ); Sun, 14 Apr 2019 17:58:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=odl8RsI8fJVdSYE3fASZ0QvkUAS1tnW2h7eu4bXbeSE=; b=cYy/FssY7BJCMK8R0Tf0XNUdqxQo7aDKIPbflAndzYlUwmSGFb0CCivBEe/zqoEpi3K6bssmkRzGBpA9nJcnxUJJ70cAsrEKrWeTKeDLjZkZ6TJ+c7/GBj+6Ugf7KcyZ+zOb+lpZ8Dt/GCDKYljsEALSoMDyB1c0xgeWFKfvgOY= Received: from HE1PR07MB3337.eurprd07.prod.outlook.com (10.170.247.12) by HE1PR07MB4297.eurprd07.prod.outlook.com (20.176.166.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.8; Sun, 14 Apr 2019 21:58:02 +0000 Received: from HE1PR07MB3337.eurprd07.prod.outlook.com ([fe80::cd23:d96f:5d94:cee6]) by HE1PR07MB3337.eurprd07.prod.outlook.com ([fe80::cd23:d96f:5d94:cee6%7]) with mapi id 15.20.1813.009; Sun, 14 Apr 2019 21:58:02 +0000 From: "Adamski, Krzysztof (Nokia - PL/Wroclaw)" To: Guenter Roeck , Jean Delvare CC: "linux-hwmon@vger.kernel.org" , "Sverdlin, Alexander (Nokia - DE/Ulm)" Subject: [PATCH v3 0/4] pmbus: extend configurability via sysfs Thread-Topic: [PATCH v3 0/4] pmbus: extend configurability via sysfs Thread-Index: AQHU8w0hu83uBtZGLEGiubZy09LFaw== Date: Sun, 14 Apr 2019 21:58:02 +0000 Message-ID: Accept-Language: pl-PL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR02CA0109.eurprd02.prod.outlook.com (2603:10a6:7:29::38) To HE1PR07MB3337.eurprd07.prod.outlook.com (2603:10a6:7:2d::12) authentication-results: spf=none (sender IP is ) smtp.mailfrom=krzysztof.adamski@nokia.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [131.228.2.9] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fe9b9677-8619-436e-3431-08d6c12443ab x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:HE1PR07MB4297; x-ms-traffictypediagnostic: HE1PR07MB4297: x-microsoft-antispam-prvs: x-forefront-prvs: 00073DB75F x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(136003)(396003)(366004)(39860400002)(376002)(346002)(189003)(199004)(316002)(7736002)(2616005)(6506007)(386003)(102836004)(5660300002)(107886003)(6116002)(3846002)(476003)(71200400001)(66066001)(71190400001)(305945005)(99286004)(2906002)(486006)(52116002)(14444005)(86362001)(256004)(6512007)(4326008)(81166006)(6436002)(53936002)(105586002)(6486002)(81156014)(36756003)(26005)(97736004)(106356001)(110136005)(54906003)(186003)(8936002)(478600001)(25786009)(68736007)(8676002)(14454004);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR07MB4297;H:HE1PR07MB3337.eurprd07.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nokia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: oJtJAJuCepEgIMA871ayCEm7TsiYfkKNoD/K0j/LfoXE1Lz07ULxdEC2cgo/N9MHBoJCgDHAlRJsl82B5fdTlM3VZf4fyAVDdKVzWlTqpyAcXM61M/KKlDh5VVNYrA5aSfE7Cte9CnxUzSteUpEjUejoZVPXJdNfDlRl4xy8yfL4+4hVS9z32/ZfG+Q/loOfkCIeaio580RX7F2eYVJVF32/+WK8to45VodTwZVflE88rfnuILI4TDa5UY0/aly+if5mSjFe+a2qWOIuMGvK3/ZboteAzyzsoU10Gwx//F6hUziHq4u6UCCc77qW0HjoRO4UaNkGggAfGFlpy5d0vIGyItMc2hyRk6V/67Rz37dCl/HCneN95PZDTxoNCaeQWvgC8+p9to6YpEgJ7cHdCqUEFFEKa2TcAeMXmATCmPw= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe9b9677-8619-436e-3431-08d6c12443ab X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Apr 2019 21:58:02.0592 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB4297 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, This patch series extends pmbus core for two specific use cases we have: - First three patches allows lm25066 driver to set number of samples for average values (by controlling manufacturer specific SAMPLES_FOR_AVG register). It is useful to be able to set this register when using any of the *_average registers, especially since the default value means we are averaging 1 sample which isn't that useful. - Third patch exports m, b, R coefficients so that they can be adjusted by user space. We can't use default coefficients values and in order to achieve high accuracy, we calibrate them per unit so using device-tree or similar concepts (which are generally shared by all board of the same type) to store them is not an option too. Also, using device-tree (the only was to influence coeffs now) might not be possible on some architectures (like on x86, for example). Thus, we export it so that the logic of loading proper coeffs can be implemented in user space instead. v3 changes: - split ABI docs with the actual implementation - better error handling in lm25066 implementation - numeric permissions - only add samples attributes for page 0 v2 changes: - PMBUS_VIRT_* registers used instead of custom sysfs groups for configuring samples for average - coeffs are only exported as sysfs attirbutes if the format used is "direct" - fixed memory allocation issue in coeffs patch Krzysztof Adamski (4): pmbus: introduce PMBUS_VIRT_*_SAMPLES registers hwmon: Document the samples attributes lm25066: support SAMPLES_FOR_AVG register pmbus_core: export coefficients via sysfs Documentation/hwmon/sysfs-interface | 18 +++ drivers/hwmon/pmbus/lm25066.c | 17 ++- drivers/hwmon/pmbus/pmbus.h | 15 ++ drivers/hwmon/pmbus/pmbus_core.c | 214 +++++++++++++++++++++++++++- 4 files changed, 261 insertions(+), 3 deletions(-)