devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Tony Huang <tonyhuang.sunplus@gmail.com>
Cc: robh+dt@kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, derek.kiernan@xilinx.com,
	dragan.cvetic@xilinx.com, arnd@arndb.de, tony.huang@sunplus.com,
	wells.lu@sunplus.com
Subject: Re: [PATCH v5 2/2] misc: Add iop driver for Sunplus SP7021
Date: Fri, 24 Dec 2021 10:30:24 +0100	[thread overview]
Message-ID: <YcWTME5BAkH9Z9cZ@kroah.com> (raw)
In-Reply-To: <75e44cae76b74b16c1e178d2d6bb18a332179bc9.1640332430.git.tonyhuang.sunplus@gmail.com>

On Fri, Dec 24, 2021 at 04:35:56PM +0800, Tony Huang wrote:
> IOP (IO Processor) embedded inside SP7021 which is used as
> Processor for I/O control, RTC wake-up and cooperation with
> CPU & PMC in power management purpose.
> The IOP core is DQ8051, so also named IOP8051,
> it supports dedicated JTAG debug pins which share with SP7021.
> In standby mode operation, the power spec reach 400uA.
> 
> Signed-off-by: Tony Huang <tonyhuang.sunplus@gmail.com>
> ---
> Changes in v5:
>  - Modify sysfs read/write function.
>  - Added gpio pin for 8051 wake up linux kernel. 
> 
>  Documentation/ABI/testing/sysfs-platform-soc@B |  18 +
>  MAINTAINERS                                    |   2 +
>  drivers/misc/Kconfig                           |  12 +
>  drivers/misc/Makefile                          |   1 +
>  drivers/misc/sunplus_iop.c                     | 481 +++++++++++++++++++++++++
>  5 files changed, 514 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-platform-soc@B
>  create mode 100644 drivers/misc/sunplus_iop.c
> 
> diff --git a/Documentation/ABI/testing/sysfs-platform-soc@B b/Documentation/ABI/testing/sysfs-platform-soc@B
> new file mode 100644
> index 0000000..b0c54b5
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-platform-soc@B
> @@ -0,0 +1,18 @@
> +What:		/sys/devices/platform/soc@B/9c000400.iop/sp_iop_mailbox
> +Date:		December 2021
> +KernelVersion:	5.15

5.15 was alread released, this can not be added to older kernels.

> +Contact:	Tony Huang <tonyhuang.sunplus@gmail.com>
> +Description:
> +		Show 8051 mailbox data.
> +
> +What:		/sys/devices/platform/soc@B/9c000400.iop/sp_iop_mode
> +Date:		December 2021
> +KernelVersion:	5.15
> +Contact:	Tony Huang <tonyhuang.sunplus@gmail.com>
> +Description:
> +		Operation mode of IOP is switched to standby mode by writing
> +		"1" to sysfs.
> +		Operation mode of IOP is switched to normal mode by writing
> +		"0" to sysfs.

You are not documenting what reading these sysfs files show.  Remember,
sysfs is "one value per file" and it looks like you are printing out
many values in the same file:

> +static ssize_t sp_iop_mailbox_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct sp_iop *iop = dev_get_drvdata(dev);
> +	struct regs_iop *p_iop_reg = (struct regs_iop *)iop->iop_regs;
> +	unsigned int MB0, MB1, MB2;
> +
> +	MB0 = readl(&p_iop_reg->iop_data0);
> +	MB1 = readl(&p_iop_reg->iop_data1);
> +	MB2 = readl(&p_iop_reg->iop_data2);
> +	return sprintf(buf, "MB0:0x%x MB1:0x%x MB2:0x%x\n", MB0, MB1, MB2);

That is a very odd "single value".

Also please use sysfs_emit().

> +static ssize_t sp_iop_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct sp_iop *iop = dev_get_drvdata(dev);
> +
> +	if (iop->mode == 0)
> +		return sprintf(buf, "normal code\n");
> +	else
> +		return sprintf(buf, "standby code\n");

2 words?



  reply	other threads:[~2021-12-24  9:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-24  8:35 [PATCH v5 0/2] Add iop driver for Sunplus SP7021 Tony Huang
2021-12-24  8:35 ` [PATCH v5 1/2] dt-binding: misc: Add iop yaml file " Tony Huang
2021-12-27 16:43   ` Rob Herring
2021-12-29  1:57     ` Tony Huang 黃懷厚
2021-12-24  8:35 ` [PATCH v5 2/2] misc: Add iop driver " Tony Huang
2021-12-24  9:30   ` Greg KH [this message]
2021-12-26 11:29   ` kernel test robot

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=YcWTME5BAkH9Z9cZ@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=derek.kiernan@xilinx.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dragan.cvetic@xilinx.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tony.huang@sunplus.com \
    --cc=tonyhuang.sunplus@gmail.com \
    --cc=wells.lu@sunplus.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;
as well as URLs for NNTP newsgroup(s).