public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Ron Li <xiangrongl@nvidia.com>
Cc: vadimp@nvidia.com, Hans de Goede <hdegoede@redhat.com>,
	 davthompson@nvidia.com, asmaa@nvidia.com,
	 platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] mlxbf-bootctl: Supports RTC battery status read and clear
Date: Wed, 15 Jan 2025 16:18:14 +0200 (EET)	[thread overview]
Message-ID: <b16a4f13-7572-0e99-d8bb-d758b019a31a@linux.intel.com> (raw)
In-Reply-To: <20250114232724.48492-1-xiangrongl@nvidia.com>

Hi,

In the subject:

Supports -> Support

On Tue, 14 Jan 2025, Ron Li wrote:

> Enable read and clear of the RTC battery low voltage status bit from user space.
> 
> Signed-off-by: Xiangrong Li <xiangrongl@nvidia.com>
> Reviewed-by: David Thompson <davthompson@nvidia.com>
> ---
>  drivers/platform/mellanox/mlxbf-bootctl.c | 20 ++++++++++++++++++++
>  drivers/platform/mellanox/mlxbf-bootctl.h |  5 +++++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/drivers/platform/mellanox/mlxbf-bootctl.c b/drivers/platform/mellanox/mlxbf-bootctl.c
> index c5b36837e694..bc31061f779c 100644
> --- a/drivers/platform/mellanox/mlxbf-bootctl.c
> +++ b/drivers/platform/mellanox/mlxbf-bootctl.c
> @@ -91,6 +91,7 @@ static const char * const mlxbf_rsh_log_level[] = {
>  static DEFINE_MUTEX(icm_ops_lock);
>  static DEFINE_MUTEX(os_up_lock);
>  static DEFINE_MUTEX(mfg_ops_lock);
> +static DEFINE_MUTEX(rtc_ops_lock);
>  
>  /*
>   * Objects are stored within the MFG partition per type.
> @@ -489,6 +490,23 @@ static ssize_t large_icm_store(struct device *dev,
>  	return res.a0 ? -EPERM : count;
>  }
>  
> +static ssize_t rtc_battery_show(struct device *dev,
> +				struct device_attribute *attr,
> +				char *buf)
> +{
> +	struct arm_smccc_res res;
> +
> +	mutex_lock(&rtc_ops_lock);
> +	arm_smccc_smc(MLNX_HANDLE_GET_RTC_LOW_BATT, 0, 0, 0, 0,
> +		      0, 0, 0, &res);
> +	mutex_unlock(&rtc_ops_lock);
> +
> +	if (res.a0)
> +		return -EPERM;
> +
> +	return sysfs_emit(buf, "0x%lx\n", res.a1);
> +}
> +
>  static ssize_t os_up_store(struct device *dev,
>  			   struct device_attribute *attr,
>  			   const char *buf, size_t count)
> @@ -906,6 +924,7 @@ static DEVICE_ATTR_RW(sn);
>  static DEVICE_ATTR_RW(uuid);
>  static DEVICE_ATTR_RW(rev);
>  static DEVICE_ATTR_WO(mfg_lock);
> +static DEVICE_ATTR_RO(rtc_battery);
>  
>  static struct attribute *mlxbf_bootctl_attrs[] = {
>  	&dev_attr_post_reset_wdog.attr,
> @@ -925,6 +944,7 @@ static struct attribute *mlxbf_bootctl_attrs[] = {
>  	&dev_attr_uuid.attr,
>  	&dev_attr_rev.attr,
>  	&dev_attr_mfg_lock.attr,
> +	&dev_attr_rtc_battery.attr,
>  	NULL
>  };
>  
> diff --git a/drivers/platform/mellanox/mlxbf-bootctl.h b/drivers/platform/mellanox/mlxbf-bootctl.h
> index 1299750a8661..90bbbdc65879 100644
> --- a/drivers/platform/mellanox/mlxbf-bootctl.h
> +++ b/drivers/platform/mellanox/mlxbf-bootctl.h
> @@ -103,6 +103,11 @@
>   */
>  #define MLNX_HANDLE_OS_UP    0x82000014
>  
> +/*
> + * SMC function ID to get and clear the RTC low voltage bit
> + */
> +#define MLNX_HANDLE_GET_RTC_LOW_BATT   0x82000023
> +
>  /* SMC function IDs for SiP Service queries */
>  #define MLXBF_BOOTCTL_SIP_SVC_CALL_COUNT	0x8200ff00
>  #define MLXBF_BOOTCTL_SIP_SVC_UID		0x8200ff01

This change is missing Documentation/ABI for the new sysfs entry.
Please add the documentation and resubmit as v2.

-- 
 i.


      reply	other threads:[~2025-01-15 14:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 23:27 [PATCH v1] mlxbf-bootctl: Supports RTC battery status read and clear Ron Li
2025-01-15 14:18 ` Ilpo Järvinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b16a4f13-7572-0e99-d8bb-d758b019a31a@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=asmaa@nvidia.com \
    --cc=davthompson@nvidia.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=vadimp@nvidia.com \
    --cc=xiangrongl@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox