Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp761911pxk; Wed, 9 Sep 2020 19:30:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTZDrldkAgVFqydLPvaC1MwgBiIjAqXw/B/1rC/CLHhPefi/kP1nI5PI1WLqCae0iDI7Tr X-Received: by 2002:a50:a693:: with SMTP id e19mr6900706edc.205.1599705032698; Wed, 09 Sep 2020 19:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599705032; cv=none; d=google.com; s=arc-20160816; b=vDt0GNH1LrZOHNjxoqUgtxThOXGXEsp6BzYkw2MDkUWkBwtmt//DJn7WzEY9hIZHMs 9nSjenwzhdmgaaHJ1pWf1s6J57rx1VlXsadKYVbpgA7bWHyzO0Hq8qnBbSLkYNZyax/e zWPDmu6PMNsGFWkW0R4T2deVpQf/BLbs3SLsBOSZASk6LcRohFObQhizx2AHbkrWKkCg B3IXD7fr2loYceaL0JLa9GyV1DO57kUNARAzNaqW9YHtJEoiYs0G0PqJvbiu/Salfj60 91PXTWUDBPiQ0wRRfcI32PYLxhrB8xTAao4Tjtb3DJ9HtPyN1QrYgqcMKEPMLbh5XFDG vLhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=czynTSoQR8aIdTOVXc0g2LHocKM0BXA9TRAb/a5XiJw=; b=r+00RBbRkTZlZaHa2epQbqjUV3MYoM2rlUoHU/KC89r1D5dKNR8Gt+nH3p+zxKnJF3 zDZbjiSLLsR4ZWTGEbMRIzRYldEATILF/GvG0vYwXZmirTUE3XFyYzhAaCR3miGXviPx reQINnvL8vX8RtB9bbDHqGPSiSlsJrX7HzO1b8Zefpexi52VxWYeofvFAk+0Qblr6gzr d9hwHk7y28yvZIf7w7eaDDH67g9LR8xjk/mYN5CRX+V6aYvHwfNywpzd9qnfye806hfy UnJomz5MzxJRs25nh0d2Ttykq+igETgMiMP0HjaDpYQQnXvw3xPirY3gf7fLQt4IkXR4 R7cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="qYqMY/9i"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id df26si2707782edb.486.2020.09.09.19.30.10; Wed, 09 Sep 2020 19:30:32 -0700 (PDT) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b="qYqMY/9i"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbgIJC3b (ORCPT + 99 others); Wed, 9 Sep 2020 22:29:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729449AbgIJC06 (ORCPT ); Wed, 9 Sep 2020 22:26:58 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C91BC0613ED; Wed, 9 Sep 2020 19:26:57 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id u126so4447081oif.13; Wed, 09 Sep 2020 19:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=czynTSoQR8aIdTOVXc0g2LHocKM0BXA9TRAb/a5XiJw=; b=qYqMY/9ih2OwAN/LzfIuv4PW7CNc568H0JC2PHiBFHG5lX7DXx4SJfjA6MU6E9QaIq Qu/AGKeWOZv84jmdcFQ/Dld/ttlppIJxSBwGQjrHvWetcObSAc1MOq2luvVG6MJMEmLc MumFKf32HAZJWcOAah8dLf8MsxVg1osg3L3gCgAVnTuSISWw6MVGmL7orXg9/3l89Uj9 uezVSjyoGO02Jlp/p3JlDQE46NTqUcrF0RKihk12N3zXOJFIH5C0xZVvhzg9GGmu5LBG XUtWfa0a9Pp7GY3UDC38w5UYFf32sOSIq5RXArFQLMsCkOrTHkm0LARbVVmxWASOhkaf ubAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=czynTSoQR8aIdTOVXc0g2LHocKM0BXA9TRAb/a5XiJw=; b=Z6DbgZs/gqrJ6wV484d+1DT9JP0iYgLIWKO0KLhMHrtXBcH0cKrj0oxC6/j5lArvNw +3N7/U3VpNQmqizPILrE/c32KhfQJ/f7ksx38E/yjKGpiICuD1w5UBrPzjduwaMAP3TO vwDeAit0EeEmuuUMDaNSgItG8fNIteq61v1GofBrpPObgEChBxNfPoUQQYmKfGM/yEwY wNQtoZdUs3+Z3eLYrmV8LAkgqJS+VP+q8j57Oa0JmjZLbnz9SJKD9Mud8K9WF4wEbE8v z8KLWgjJCG6SHisivFlVq9g6w07F2XP2DDui18WRqjR412gOvzIKjqU3+H2o15dVKJ+R iVVw== X-Gm-Message-State: AOAM533I1xzS+EAArsazS3Xs4vpkYtsONsqny+x3V7qHY9O34IQqRCFO vQPFI9/Vj1aaM5pQyFjEtg4Olhz14BQ= X-Received: by 2002:a54:4e95:: with SMTP id c21mr2319903oiy.118.1599704816446; Wed, 09 Sep 2020 19:26:56 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 187sm726618oie.42.2020.09.09.19.26.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Sep 2020 19:26:55 -0700 (PDT) Subject: Re: [PATCH v2] hwmon: (pmbus) Expose PEC debugfs attribute To: Andrew Jeffery , linux-hwmon@vger.kernel.org Cc: jdelvare@suse.com, linux-kernel@vger.kernel.org References: <20200910021106.2958382-1-andrew@aj.id.au> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARAQABzTJHdWVudGVyIFJv ZWNrIChM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5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <06000105-9438-6803-1ef9-0bfec7c09360@roeck-us.net> Date: Wed, 9 Sep 2020 19:26:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200910021106.2958382-1-andrew@aj.id.au> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/9/20 7:11 PM, Andrew Jeffery wrote: > Enable runtime debug control of whether the PEC byte is exchanged with > the PMBus device. > > Some manufacturers have asked for the PEC to be disabled as part of > debugging driver communication issues with devices. > > Signed-off-by: Andrew Jeffery Applied. Thanks, Guenter > --- > drivers/hwmon/pmbus/pmbus_core.c | 39 ++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c > index 44535add3a4a..9e7d5f7f0cd0 100644 > --- a/drivers/hwmon/pmbus/pmbus_core.c > +++ b/drivers/hwmon/pmbus/pmbus_core.c > @@ -2346,6 +2346,42 @@ static int pmbus_debugfs_get_status(void *data, u64 *val) > DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugfs_get_status, > NULL, "0x%04llx\n"); > > +static int pmbus_debugfs_get_pec(void *data, u64 *val) > +{ > + struct i2c_client *client = data; > + > + *val = !!(client->flags & I2C_CLIENT_PEC); > + > + return 0; > +} > + > +static int pmbus_debugfs_set_pec(void *data, u64 val) > +{ > + int rc; > + struct i2c_client *client = data; > + > + if (!val) { > + client->flags &= ~I2C_CLIENT_PEC; > + return 0; > + } > + > + if (val != 1) > + return -EINVAL; > + > + rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY); > + if (rc < 0) > + return rc; > + > + if (!(rc & PB_CAPABILITY_ERROR_CHECK)) > + return -EOPNOTSUPP; > + > + client->flags |= I2C_CLIENT_PEC; > + > + return 0; > +} > +DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec, > + pmbus_debugfs_set_pec, "%1llu\n"); > + > static int pmbus_init_debugfs(struct i2c_client *client, > struct pmbus_data *data) > { > @@ -2374,6 +2410,9 @@ static int pmbus_init_debugfs(struct i2c_client *client, > if (!entries) > return -ENOMEM; > > + debugfs_create_file("pec", 0664, data->debugfs, client, > + &pmbus_debugfs_ops_pec); > + > for (i = 0; i < data->info->pages; ++i) { > /* Check accessibility of status register if it's not page 0 */ > if (!i || pmbus_check_status_register(client, i)) { >