mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiho Chu <jiho.chu@samsung.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: arnd@arndb.de, ogabbay@kernel.org,
	krzysztof.kozlowski@linaro.org, broonie@kernel.org,
	linux-kernel@vger.kernel.org, yelini.jeong@samsung.com,
	myungjoo.ham@samsung.com
Subject: Re: [PATCH v2 01/13] trinity: Add base driver
Date: Mon, 19 Sep 2022 11:00:40 +0900	[thread overview]
Message-ID: <20220919110040.80b06ab4aa7460ad02c3246e@samsung.com> (raw)
In-Reply-To: <Yyb0a96poEWZUe1y@kroah.com>

On Sun, 18 Sep 2022 12:35:23 +0200
Greg KH <gregkh@linuxfoundation.org> wrote:

> On Sat, Sep 17, 2022 at 04:23:44PM +0900, Jiho Chu wrote:
> > It contains the base codes for trinity driver. Minimal codes to load and
> > probe device is provided. The Trinity Family is controlled by the
> > Memory-Mapped Registers, the register addresses and offsets are
> > described. And user api interfaces are presented to control device under
> > ioctl manner.
> 
> Where is the documentation for how the userspace api works?  And where
> is a link to the userspace code that talks to these devices?  That
> belongs here in this commit changelog text please.
> 

Hi, Greg
Thanks for your review.

The user space library is published in:
https://review.tizen.org/gerrit/gitweb?p=platform/adaptation/npu/trix-engine.git;a=summary

It needs to login to tizen, access guide is:
https://docs.tizen.org/platform/get-started/open-source-project/

And, this information will be included in commit log.

> > +config TRINITY
> > +	bool "Samsung Neural Processing Unit"
> > +	depends on HAS_IOMEM
> > +	depends on HAS_DMA
> > +	help
> > +	  Select this option to enable driver support for Samsung
> > +	  Neural Processing Unit (NPU).
> > +
> > +	  This driver works as a base driver of the other drivers
> > +	  for Trinity device family.
> > +
> > +	  This option should be enabled to support Trinity
> > +	  Vision 2 (TRIV2), and Trinity Audio (TRIA).
> > +
> > +config TRINITY_VISION2
> > +	tristate "Samsung NPU Trinity Vision 2"
> > +	depends on TRINITY
> > +	help
> > +	  Select this option to enable driver support for a Samsung
> > +	  Neural Processing Unit (NPU), Trinity Vision 2.
> > +
> > +	  This driver enables userspace system library to access the
> > +	  device via /dev/triv2-N.
> 
> Why do you have 2 Kconfig entries for only a single driver?  Please just
> make it one.
> 

OK. It'll be merged.


> > diff --git a/drivers/misc/trinity/Makefile b/drivers/misc/trinity/Makefile
> > new file mode 100644
> > index 000000000000..a8e5697d6d85
> > --- /dev/null
> > +++ b/drivers/misc/trinity/Makefile
> > @@ -0,0 +1,7 @@
> > +# SPDX-License-Identifier: GPL-2.0-only
> > +
> > +obj-$(CONFIG_TRINITY_VISION2) += trinity_vision2.o
> > +
> > +trinity-y := trinity.o
> > +
> > +trinity_vision2-objs := $(trinity-y) trinity_vision2_drv.o
> > diff --git a/drivers/misc/trinity/trinity.c b/drivers/misc/trinity/trinity.c
> > new file mode 100644
> > index 000000000000..1704eecfc439
> > --- /dev/null
> > +++ b/drivers/misc/trinity/trinity.c
> > @@ -0,0 +1,225 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Base device driver for Samsung NPU Trinity device family
> > + *
> > + * Copyright (C) 2020-2022 Samsung Electronics
> > + * Copyright (C) 2020 Dongju Chae <dongju.chae@samsung.com>
> > + * Copyright (C) 2020 Wook Song <wook16.song@samsung.com>
> > + * Copyright (C) 2022 MyungJoo Ham <myungjoo.ham@samsung.com>
> > + * Copyright (C) 2022 Yelin Jeong <yelini.jeong@samsung.com>
> > + * Copyright (C) 2022 Jiho Chu <jiho.chu@samsung.com>
> > + */
> > +
> > +#include <linux/of_address.h>
> > +
> > +#include "trinity_common.h"
> > +
> > +#define TRINITY_PADDR_BASE (0x0)
> > +
> > +static DEFINE_IDA(dev_nrs);
> > +static DEFINE_IDA(model_ids);
> > +
> > +/**
> > + * trinity_release() - A common callback for close() in file_operations for a
> > + *		Trinity	device node. If there are device-specific data to be
> > + *		cleaned-up, it is required to clean them up before invoke this
> > + *		callback.
> > + *
> > + * @inode: Inode to be closed
> > + * @file: File to be closed
> > + *
> > + * Returns 0 on success. Otherwise, returns negative error.
> > + */
> > +int trinity_release(struct inode *inode, struct file *file)
> > +{
> > +	return 0;
> 
> If a callback does nothing, odds are it is not needed at all.  Please
> just remove.
> 
> And why is this a global function?
> 
> 

Thanks. All empty functions will be removed.

> > +
> > +	/* get reg info for MMREG_BASE */
> > +	for (i = 0; i < TRINITY_MAX_MMREGS; i++) {
> > +		struct resource mmreg;
> > +
> > +		err = of_address_to_resource(np, i, &mmreg);
> > +		if (err < 0) {
> > +			dev_err(dev, "failed to get %d-th mmreg info", i);
> > +			goto err_cleanup;
> > +		}
> > +
> > +		drv->mmreg_vaddr[i] = devm_ioremap_resource(dev, &mmreg);
> > +		if (IS_ERR(drv->mmreg_vaddr[i])) {
> > +			dev_err(dev,
> > +				"failed to remap %d-th mmreg resource info", i);
> > +			err = PTR_ERR(drv->mmreg_vaddr[i]);
> > +			goto err_cleanup;
> > +		}
> > +		drv->mmreg_paddr[i] = mmreg.start;
> > +	}
> > +
> > +	/** get a TOPS property */
> 
> Why the odd "**" in comments?
> 
> thanks,
> 
> greg k-h
> 

It fixed.
Thanks for checking that. 

Thanks.
Jiho Chu





  reply	other threads:[~2022-09-19  2:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220917072357epcas1p3fea7d947782d9ce58d91249533e0c1f7@epcas1p3.samsung.com>
2022-09-17  7:23 ` [PATCH v2 00/13] Samsung Trinity NPU device driver-v2 Jiho Chu
     [not found]   ` <CGME20220917072357epcas1p17b277154f0d020435417450fa0337906@epcas1p1.samsung.com>
2022-09-17  7:23     ` [PATCH v2 01/13] trinity: Add base driver Jiho Chu
2022-09-17  7:41       ` Arnd Bergmann
2022-09-17 14:49         ` Jiho Chu
2022-09-22 13:56           ` Arnd Bergmann
2022-09-23 15:09             ` Jiho Chu
2022-09-19  4:26         ` Jiho Chu
2022-09-18 10:35       ` Greg KH
2022-09-19  2:00         ` Jiho Chu [this message]
     [not found]         ` <CGME20220917072357epcas1p17b277154f0d020435417450fa0337906@epcms1p1>
2022-09-19  2:57           ` MyungJoo Ham
     [not found]   ` <CGME20220917072357epcas1p1bc8d924080c5dabafee1db779369078d@epcas1p1.samsung.com>
2022-09-17  7:23     ` [PATCH v2 02/13] tirnity: Add memory module Jiho Chu
     [not found]   ` <CGME20220917072357epcas1p4a5b3939adbe5e24c11bd2541f76f23f6@epcas1p4.samsung.com>
2022-09-17  7:23     ` [PATCH v2 03/13] trinity: Add IDU feature Jiho Chu
     [not found]   ` <CGME20220917072357epcas1p378e13844913c3c80acd183ddd59de456@epcas1p3.samsung.com>
2022-09-17  7:23     ` [PATCH v2 04/13] trinity: Add schduler module Jiho Chu
     [not found]   ` <CGME20220917072357epcas1p2735d98b043e2382aba1173c6b52af81a@epcas1p2.samsung.com>
2022-09-17  7:23     ` [PATCH v2 05/13] trinity: Add debugfs module Jiho Chu
     [not found]   ` <CGME20220917072357epcas1p2ec70909280eee82b0db5ad454247daf8@epcas1p2.samsung.com>
2022-09-17  7:23     ` [PATCH v2 06/13] trinity: add statistics module Jiho Chu
     [not found]   ` <CGME20220917072357epcas1p485a1cdcb71cc01274db1c8d00aec197c@epcas1p4.samsung.com>
2022-09-17  7:23     ` [PATCH v2 07/13] trinity: Add sysfs module Jiho Chu
2022-09-18 10:33       ` Greg KH
2022-09-19  6:44         ` Jiho Chu
     [not found]   ` <CGME20220917072358epcas1p14543c842bdf0b6f719d4e0d2ed3bf33c@epcas1p1.samsung.com>
2022-09-17  7:23     ` [PATCH v2 08/13] trinity: Add ioctl feature Jiho Chu
     [not found]   ` <CGME20220917072358epcas1p2ae33a31333089ea7b10844e42e14323b@epcas1p2.samsung.com>
2022-09-17  7:23     ` [PATCH v2 09/13] trinity: Add request and pm feature Jiho Chu
     [not found]   ` <CGME20220917072358epcas1p14997459c7add27bf7b4e9333cbf21b72@epcas1p1.samsung.com>
2022-09-17  7:23     ` [PATCH v2 10/13] trinity: Add profile module Jiho Chu
     [not found]   ` <CGME20220917072358epcas1p4e110e2025c90d78fad2182ec5cd66eb7@epcas1p4.samsung.com>
2022-09-17  7:23     ` [PATCH v2 11/13] trinity: Add trace module Jiho Chu
     [not found]   ` <CGME20220917072358epcas1p30b24a99cbf5a0ae7175efc794c5d218d@epcas1p3.samsung.com>
2022-09-17  7:23     ` [PATCH v2 12/13] MAINTAINERS: add TRINITY driver Jiho Chu
     [not found]   ` <CGME20220917072358epcas1p15d18d4cf27694f894332f975bb971bef@epcas1p1.samsung.com>
2022-09-17  7:23     ` [PATCH v2 13/13] dt-bindings: arm: Add Samsung Trinity bindings Jiho Chu
2022-09-21 18:42       ` Krzysztof Kozlowski
2022-09-22  2:20         ` Jiho Chu

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=20220919110040.80b06ab4aa7460ad02c3246e@samsung.com \
    --to=jiho.chu@samsung.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=ogabbay@kernel.org \
    --cc=yelini.jeong@samsung.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

all inboxes | Powered by JetHome®