Re: [PATCH 2/2] drivers: hwmon: max31827: Add debugfs support

From: Nuno Sá
Date: Wed May 22 2024 - 09:11:05 EST


On Wed, 2024-05-22 at 15:39 +0300, Radu Sabau wrote:
> Add debugfs support by creating directory in sys-fs which includes
> debugfs specific files used for configuring the device by
> preference.
>
> Signed-off-b: Radu Sabau <radu.sabau@xxxxxxxxxx>
> ---
>  Documentation/hwmon/max31827.rst |  25 ++++
>  drivers/hwmon/max31827.c         | 202 ++++++++++++++++++++++++++++++-
>  2 files changed, 225 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/hwmon/max31827.rst b/Documentation/hwmon/max31827.rst
> index 9c11a9518c67..940310be6075 100644
> --- a/Documentation/hwmon/max31827.rst
> +++ b/Documentation/hwmon/max31827.rst
> @@ -142,3 +142,28 @@ usage (+33% for both write and reads) in normal conditions.
>  Since this operation implies there will be an extra delay to each
>  transaction, PEC can be disabled or enabled through sysfs.
>  Just write 1  to the "pec" file for enabling PEC and 0 for disabling it.
> +
> +DebugFs entries
> +---------------
> +
> +The chip also has a configuration register where each bit stands for a specific
> +functionality to be configured. Hence as one would like to have access to these
> +features, we give access to them in debugfs.
> +
> +.. warning:: The debugfs interface is subject to change without notice
> +             and is only available when the kernel is compiled with
> +             ``CONFIG_DEBUG_FS`` defined.
> +
> +``/sys/kernel/debug/max31827/``
> +contains the following attributes:
> +
> +==============  ===============================================================
> +alarm_polarity  Write 1 for ALARM pin active state is low, 0 otherwise
> +comp_int        Set to 1 if OT and UT status bits are in interrupt mode
> +fault_queue     Number of consecutive temperature faults until OT and UT faults
> +                are indicated in status bits
> +pec_error       Set to 1 if PEC Enable bit is set, 0 otherwise
> +resolution      2-bit value that select the conversion resolution, please see
> +                datasheet for corresponding values
> +timeout         Write 1 do disable bus timeout, 0 otherwise

>From the description, the above really don't look like they belong into a debug
interface...

- Nuno Sá
>