All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Breathitt Gray <vilhelm.gray@gmail.com>
To: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Cc: jic23@kernel.org, kamel.bouhara@bootlin.com,
	gwendal@chromium.org, david@lechnology.com,
	linux-iio@vger.kernel.org, patrick.havelange@essensium.com,
	alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com,
	linux-kernel@vger.kernel.org, o.rempel@pengutronix.de,
	jarkko.nikula@linux.intel.com,
	Dan Carpenter <dan.carpenter@oracle.com>,
	kernel@pengutronix.de, fabrice.gasnier@st.com,
	syednwaris@gmail.com, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org, alexandre.torgue@st.com
Subject: Re: [Linux-stm32] [PATCH v16 03/14] counter: Internalize sysfs interface code
Date: Tue, 31 Aug 2021 23:55:53 +0900	[thread overview]
Message-ID: <YS5C+cr1TRhqkCkU@shinobu> (raw)
In-Reply-To: <YS452wJ+IHs9R0FC@shinobu>

[-- Attachment #1: Type: text/plain, Size: 5060 bytes --]

On Tue, Aug 31, 2021 at 11:16:59PM +0900, William Breathitt Gray wrote:
> On Tue, Aug 31, 2021 at 03:44:04PM +0200, Fabrice Gasnier wrote:
> > On 8/27/21 5:47 AM, William Breathitt Gray wrote:
> > > This is a reimplementation of the Generic Counter driver interface.
> > > There are no modifications to the Counter subsystem userspace interface,
> > > so existing userspace applications should continue to run seamlessly.
> > > 
> > > The purpose of this patch is to internalize the sysfs interface code
> > > among the various counter drivers into a shared module. Counter drivers
> > > pass and take data natively (i.e. u8, u64, etc.) and the shared counter
> > > module handles the translation between the sysfs interface and the
> > > device drivers. This guarantees a standard userspace interface for all
> > > counter drivers, and helps generalize the Generic Counter driver ABI in
> > > order to support the Generic Counter chrdev interface (introduced in a
> > > subsequent patch) without significant changes to the existing counter
> > > drivers.
> > > 
> > > Note, Counter device registration is the same as before: drivers
> > > populate a struct counter_device with components and callbacks, then
> > > pass the structure to the devm_counter_register function. However,
> > > what's different now is how the Counter subsystem code handles this
> > > registration internally.
> > > 
> > > Whereas before callbacks would interact directly with sysfs data, this
> > > interaction is now abstracted and instead callbacks interact with native
> > > C data types. The counter_comp structure forms the basis for Counter
> > > extensions.
> > > 
> > > The counter-sysfs.c file contains the code to parse through the
> > > counter_device structure and register the requested components and
> > > extensions. Attributes are created and populated based on type, with
> > > respective translation functions to handle the mapping between sysfs and
> > > the counter driver callbacks.
> > > 
> > > The translation performed for each attribute is straightforward: the
> > > attribute type and data is parsed from the counter_attribute structure,
> > > the respective counter driver read/write callback is called, and sysfs
> > > I/O is handled before or after the driver read/write function is called.
> > > 
> > > Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> > > Cc: Patrick Havelange <patrick.havelange@essensium.com>
> > > Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
> > > Cc: Fabrice Gasnier <fabrice.gasnier@st.com>
> > > Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> > > Cc: Alexandre Torgue <alexandre.torgue@st.com>
> > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
> > > Reviewed-by: David Lechner <david@lechnology.com>
> > > Tested-by: David Lechner <david@lechnology.com>
> > > Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
> > > ---
> > >  MAINTAINERS                             |    1 -
> > >  drivers/counter/104-quad-8.c            |  449 +++----
> > >  drivers/counter/Makefile                |    1 +
> > >  drivers/counter/counter-core.c          |  142 +++
> > >  drivers/counter/counter-sysfs.c         |  849 +++++++++++++
> > >  drivers/counter/counter-sysfs.h         |   13 +
> > >  drivers/counter/counter.c               | 1496 -----------------------
> > >  drivers/counter/ftm-quaddec.c           |   60 +-
> > >  drivers/counter/intel-qep.c             |  144 +--
> > >  drivers/counter/interrupt-cnt.c         |   62 +-
> > >  drivers/counter/microchip-tcb-capture.c |   91 +-
> > >  drivers/counter/stm32-lptimer-cnt.c     |  212 ++--
> > >  drivers/counter/stm32-timer-cnt.c       |  179 ++-
> > >  drivers/counter/ti-eqep.c               |  180 +--
> > >  include/linux/counter.h                 |  658 +++++-----
> > >  include/linux/counter_enum.h            |   45 -
> > >  16 files changed, 1949 insertions(+), 2633 deletions(-)
> > >  create mode 100644 drivers/counter/counter-core.c
> > >  create mode 100644 drivers/counter/counter-sysfs.c
> > >  create mode 100644 drivers/counter/counter-sysfs.h
> > >  delete mode 100644 drivers/counter/counter.c
> > >  delete mode 100644 include/linux/counter_enum.h
> > > 
> > 
> > Hi William,
> > 
> > For the STM32 drivers, you can add my:
> > Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> > 
> > Thanks,
> > Fabrice
> 
> Hello Fabrice,
> 
> I noticed the stm32-lptimer-cnt.c function_write() and action_write()
> callbacks do not appear to write the desired function/action
> configuration to the device. Would you check whether the device actually
> supports this functionality or if these callbacks should be removed from
> this driver.
> 
> Thanks,
> 
> William Breathitt Gray

Nevermind, I see that these configurations are sent to the device via
stm32_lptim_setup() when the counter is enabled. So that setup should be
fine after all.

Thanks,

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: William Breathitt Gray <vilhelm.gray@gmail.com>
To: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Cc: jic23@kernel.org, kamel.bouhara@bootlin.com,
	gwendal@chromium.org, david@lechnology.com,
	linux-iio@vger.kernel.org, patrick.havelange@essensium.com,
	alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com,
	linux-kernel@vger.kernel.org, o.rempel@pengutronix.de,
	jarkko.nikula@linux.intel.com,
	Dan Carpenter <dan.carpenter@oracle.com>,
	kernel@pengutronix.de, fabrice.gasnier@st.com,
	syednwaris@gmail.com, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org, alexandre.torgue@st.com
Subject: Re: [Linux-stm32] [PATCH v16 03/14] counter: Internalize sysfs interface code
Date: Tue, 31 Aug 2021 23:55:53 +0900	[thread overview]
Message-ID: <YS5C+cr1TRhqkCkU@shinobu> (raw)
In-Reply-To: <YS452wJ+IHs9R0FC@shinobu>


[-- Attachment #1.1: Type: text/plain, Size: 5060 bytes --]

On Tue, Aug 31, 2021 at 11:16:59PM +0900, William Breathitt Gray wrote:
> On Tue, Aug 31, 2021 at 03:44:04PM +0200, Fabrice Gasnier wrote:
> > On 8/27/21 5:47 AM, William Breathitt Gray wrote:
> > > This is a reimplementation of the Generic Counter driver interface.
> > > There are no modifications to the Counter subsystem userspace interface,
> > > so existing userspace applications should continue to run seamlessly.
> > > 
> > > The purpose of this patch is to internalize the sysfs interface code
> > > among the various counter drivers into a shared module. Counter drivers
> > > pass and take data natively (i.e. u8, u64, etc.) and the shared counter
> > > module handles the translation between the sysfs interface and the
> > > device drivers. This guarantees a standard userspace interface for all
> > > counter drivers, and helps generalize the Generic Counter driver ABI in
> > > order to support the Generic Counter chrdev interface (introduced in a
> > > subsequent patch) without significant changes to the existing counter
> > > drivers.
> > > 
> > > Note, Counter device registration is the same as before: drivers
> > > populate a struct counter_device with components and callbacks, then
> > > pass the structure to the devm_counter_register function. However,
> > > what's different now is how the Counter subsystem code handles this
> > > registration internally.
> > > 
> > > Whereas before callbacks would interact directly with sysfs data, this
> > > interaction is now abstracted and instead callbacks interact with native
> > > C data types. The counter_comp structure forms the basis for Counter
> > > extensions.
> > > 
> > > The counter-sysfs.c file contains the code to parse through the
> > > counter_device structure and register the requested components and
> > > extensions. Attributes are created and populated based on type, with
> > > respective translation functions to handle the mapping between sysfs and
> > > the counter driver callbacks.
> > > 
> > > The translation performed for each attribute is straightforward: the
> > > attribute type and data is parsed from the counter_attribute structure,
> > > the respective counter driver read/write callback is called, and sysfs
> > > I/O is handled before or after the driver read/write function is called.
> > > 
> > > Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> > > Cc: Patrick Havelange <patrick.havelange@essensium.com>
> > > Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
> > > Cc: Fabrice Gasnier <fabrice.gasnier@st.com>
> > > Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> > > Cc: Alexandre Torgue <alexandre.torgue@st.com>
> > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
> > > Reviewed-by: David Lechner <david@lechnology.com>
> > > Tested-by: David Lechner <david@lechnology.com>
> > > Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
> > > ---
> > >  MAINTAINERS                             |    1 -
> > >  drivers/counter/104-quad-8.c            |  449 +++----
> > >  drivers/counter/Makefile                |    1 +
> > >  drivers/counter/counter-core.c          |  142 +++
> > >  drivers/counter/counter-sysfs.c         |  849 +++++++++++++
> > >  drivers/counter/counter-sysfs.h         |   13 +
> > >  drivers/counter/counter.c               | 1496 -----------------------
> > >  drivers/counter/ftm-quaddec.c           |   60 +-
> > >  drivers/counter/intel-qep.c             |  144 +--
> > >  drivers/counter/interrupt-cnt.c         |   62 +-
> > >  drivers/counter/microchip-tcb-capture.c |   91 +-
> > >  drivers/counter/stm32-lptimer-cnt.c     |  212 ++--
> > >  drivers/counter/stm32-timer-cnt.c       |  179 ++-
> > >  drivers/counter/ti-eqep.c               |  180 +--
> > >  include/linux/counter.h                 |  658 +++++-----
> > >  include/linux/counter_enum.h            |   45 -
> > >  16 files changed, 1949 insertions(+), 2633 deletions(-)
> > >  create mode 100644 drivers/counter/counter-core.c
> > >  create mode 100644 drivers/counter/counter-sysfs.c
> > >  create mode 100644 drivers/counter/counter-sysfs.h
> > >  delete mode 100644 drivers/counter/counter.c
> > >  delete mode 100644 include/linux/counter_enum.h
> > > 
> > 
> > Hi William,
> > 
> > For the STM32 drivers, you can add my:
> > Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> > 
> > Thanks,
> > Fabrice
> 
> Hello Fabrice,
> 
> I noticed the stm32-lptimer-cnt.c function_write() and action_write()
> callbacks do not appear to write the desired function/action
> configuration to the device. Would you check whether the device actually
> supports this functionality or if these callbacks should be removed from
> this driver.
> 
> Thanks,
> 
> William Breathitt Gray

Nevermind, I see that these configurations are sent to the device via
stm32_lptim_setup() when the counter is enabled. So that setup should be
fine after all.

Thanks,

William Breathitt Gray

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-08-31 14:56 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27  3:47 [PATCH v16 00/14] Introduce the Counter character device interface William Breathitt Gray
2021-08-27  3:47 ` William Breathitt Gray
2021-08-27  3:47 ` [PATCH v16 01/14] counter: stm32-lptimer-cnt: Provide defines for clock polarities William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-08-31 13:38   ` Fabrice Gasnier
2021-08-31 13:38     ` Fabrice Gasnier
2021-09-08 17:31     ` Jonathan Cameron
2021-09-08 17:31       ` Jonathan Cameron
2021-08-27  3:47 ` [PATCH v16 02/14] counter: stm32-timer-cnt: Provide defines for slave mode selection William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-08-31 13:40   ` Fabrice Gasnier
2021-08-31 13:40     ` Fabrice Gasnier
2021-09-08 17:31     ` Jonathan Cameron
2021-09-08 17:31       ` Jonathan Cameron
2021-08-27  3:47 ` [PATCH v16 03/14] counter: Internalize sysfs interface code William Breathitt Gray
2021-08-27 14:09   ` kernel test robot
2021-08-28  4:56   ` kernel test robot
2021-08-31 13:44   ` [Linux-stm32] " Fabrice Gasnier
2021-08-31 14:16     ` William Breathitt Gray
2021-08-31 14:16       ` William Breathitt Gray
2021-08-31 14:55       ` William Breathitt Gray [this message]
2021-08-31 14:55         ` William Breathitt Gray
2021-09-08 17:44     ` Jonathan Cameron
2021-08-27  3:47 ` [PATCH v16 04/14] counter: Update counter.h comments to reflect sysfs internalization William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-09-08 17:46   ` Jonathan Cameron
2021-09-08 17:46     ` Jonathan Cameron
2021-08-27  3:47 ` [PATCH v16 05/14] docs: counter: Update " William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-09-08 17:48   ` Jonathan Cameron
2021-09-08 17:48     ` Jonathan Cameron
2021-08-27  3:47 ` [PATCH v16 06/14] counter: Move counter enums to uapi header William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-08-27  3:47 ` [PATCH v16 07/14] counter: Add character device interface William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-09-12 16:18   ` Jonathan Cameron
2021-09-12 16:18     ` Jonathan Cameron
2021-09-20 10:09     ` William Breathitt Gray
2021-09-20 10:09       ` William Breathitt Gray
2021-09-26 15:15       ` Jonathan Cameron
2021-09-26 15:15         ` Jonathan Cameron
2021-09-27 10:21         ` William Breathitt Gray
2021-09-27 10:21           ` William Breathitt Gray
2021-09-27 11:20           ` Jonathan Cameron
2021-09-27 11:20             ` Jonathan Cameron
2021-09-27 11:33             ` William Breathitt Gray
2021-09-27 11:33               ` William Breathitt Gray
2021-08-27  3:47 ` [PATCH v16 08/14] docs: counter: Document " William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-09-12 16:18   ` Jonathan Cameron
2021-09-12 16:18     ` Jonathan Cameron
2021-08-27  3:47 ` [PATCH v16 09/14] tools/counter: Create Counter tools William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-09-12 16:26   ` Jonathan Cameron
2021-09-12 16:26     ` Jonathan Cameron
2021-08-27  3:47 ` [PATCH v16 10/14] counter: Implement signalZ_action_component_id sysfs attribute William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-08-27  3:47 ` [PATCH v16 11/14] counter: Implement *_component_id sysfs attributes William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-08-27  3:47 ` [PATCH v16 12/14] counter: Implement events_queue_size sysfs attribute William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-08-27  3:47 ` [PATCH v16 13/14] counter: 104-quad-8: Replace mutex with spinlock William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-08-27  3:47 ` [PATCH v16 14/14] counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8 William Breathitt Gray
2021-08-27  3:47   ` William Breathitt Gray
2021-08-30 17:17 ` [PATCH v16 00/14] Introduce the Counter character device interface Jonathan Cameron
2021-08-30 17:17   ` Jonathan Cameron
2021-09-12 16:36   ` Jonathan Cameron
2021-09-12 16:36     ` Jonathan Cameron

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=YS5C+cr1TRhqkCkU@shinobu \
    --to=vilhelm.gray@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@st.com \
    --cc=dan.carpenter@oracle.com \
    --cc=david@lechnology.com \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=fabrice.gasnier@st.com \
    --cc=gwendal@chromium.org \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=kamel.bouhara@bootlin.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=o.rempel@pengutronix.de \
    --cc=patrick.havelange@essensium.com \
    --cc=syednwaris@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.