Re: [PATCH v1 1/9] mfd: Add core driver for Nuvoton NCT6694

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, resending this email in plain text format.

Dear Marc,

Thank you for your comments.
I'll add the nct6694_free_handler() function in the next patch.

Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> 於 2024年10月24日 週四 下午5:12寫道:
>
> On 24.10.2024 16:59:14, Ming Yu wrote:
> > The Nuvoton NCT6694 is a peripheral expander with 16 GPIO chips,
> > 6 I2C controllers, 2 CANfd controllers, 2 Watchdog timers, ADC,
> > PWM, and RTC.
> >
> > This driver implements USB device functionality and shares the
> > chip's peripherals as a child device.
> >
> > Each child device can use the USB functions nct6694_read_msg()
> > and nct6694_write_msg() to issue a command. They can also register
> > a handler function that will be called when the USB device receives
> > its interrupt pipe.
> >
> > Signed-off-by: Ming Yu <tmyu0@xxxxxxxxxxx>
> > ---
> >  MAINTAINERS                 |   7 +
> >  drivers/mfd/Kconfig         |  10 +
> >  drivers/mfd/Makefile        |   2 +
> >  drivers/mfd/nct6694.c       | 394 ++++++++++++++++++++++++++++++++++++
> >  include/linux/mfd/nct6694.h | 168 +++++++++++++++
> >  5 files changed, 581 insertions(+)
> >  create mode 100644 drivers/mfd/nct6694.c
> >  create mode 100644 include/linux/mfd/nct6694.h
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index e9659a5a7fb3..30157ca95cf3 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -16434,6 +16434,13 @@ F:   drivers/nubus/
> >  F:   include/linux/nubus.h
> >  F:   include/uapi/linux/nubus.h
> >
> > +NUVOTON NCT6694 MFD DRIVER
> > +M:   Ming Yu <tmyu0@xxxxxxxxxxx>
> > +L:   linux-kernel@xxxxxxxxxxxxxxx
> > +S:   Supported
> > +F:   drivers/mfd/nct6694.c
> > +F:   include/linux/mfd/nct6694.h
> > +
> >  NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER
> >  M:   Antonino Daplas <adaplas@xxxxxxxxx>
> >  L:   linux-fbdev@xxxxxxxxxxxxxxx
> > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > index f9325bcce1b9..da2600958697 100644
> > --- a/drivers/mfd/Kconfig
> > +++ b/drivers/mfd/Kconfig
> > @@ -546,6 +546,16 @@ config MFD_MX25_TSADC
> >         i.MX25 processors. They consist of a conversion queue for general
> >         purpose ADC and a queue for Touchscreens.
> >
> > +config MFD_NCT6694
> > +     tristate "Nuvoton NCT6694 support"
> > +     select MFD_CORE
> > +     depends on USB
> > +     help
> > +       This adds support for Nuvoton USB device NCT6694 sharing peripherals
> > +       This includes the USB devcie driver and core APIs.
> > +       Additional drivers must be enabled in order to use the functionality
> > +       of the device.
> > +
> >  config MFD_HI6421_PMIC
> >       tristate "HiSilicon Hi6421 PMU/Codec IC"
> >       depends on OF
> > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > index 2a9f91e81af8..2cf816d67d03 100644
> > --- a/drivers/mfd/Makefile
> > +++ b/drivers/mfd/Makefile
> > @@ -116,6 +116,8 @@ obj-$(CONFIG_TWL6040_CORE)        += twl6040.o
> >
> >  obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o
> >
> > +obj-$(CONFIG_MFD_NCT6694)    += nct6694.o
> > +
> >  obj-$(CONFIG_MFD_MC13XXX)    += mc13xxx-core.o
> >  obj-$(CONFIG_MFD_MC13XXX_SPI)        += mc13xxx-spi.o
> >  obj-$(CONFIG_MFD_MC13XXX_I2C)        += mc13xxx-i2c.o
> > diff --git a/drivers/mfd/nct6694.c b/drivers/mfd/nct6694.c
> > new file mode 100644
> > index 000000000000..9838c7be0b98
> > --- /dev/null
> > +++ b/drivers/mfd/nct6694.c
> > @@ -0,0 +1,394 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Nuvoton NCT6694 MFD driver based on USB interface.
> > + *
> > + * Copyright (C) 2024 Nuvoton Technology Corp.
> > + */
> > +
> > +#include <linux/io.h>
> > +#include <linux/usb.h>
> > +#include <linux/slab.h>
> > +#include <linux/kernel.h>
> > +#include <linux/module.h>
> > +#include <linux/mfd/core.h>
> > +#include <linux/mfd/nct6694.h>
> > +
> > +#define DRVNAME "nct6694-usb_mfd"
> > +
> > +#define MFD_DEV_SIMPLE(_name)                \
> > +{                                    \
> > +     .name = NCT6694_DEV_##_name,    \
> > +}                                    \
> > +
> > +#define MFD_DEV_WITH_ID(_name, _id)  \
> > +{                                    \
> > +     .name = NCT6694_DEV_##_name,    \
> > +     .id = _id,                      \
> > +}
> > +
> > +/* MFD device resources */
> > +static const struct mfd_cell nct6694_dev[] = {
> > +     MFD_DEV_WITH_ID(GPIO, 0x0),
> > +     MFD_DEV_WITH_ID(GPIO, 0x1),
> > +     MFD_DEV_WITH_ID(GPIO, 0x2),
> > +     MFD_DEV_WITH_ID(GPIO, 0x3),
> > +     MFD_DEV_WITH_ID(GPIO, 0x4),
> > +     MFD_DEV_WITH_ID(GPIO, 0x5),
> > +     MFD_DEV_WITH_ID(GPIO, 0x6),
> > +     MFD_DEV_WITH_ID(GPIO, 0x7),
> > +     MFD_DEV_WITH_ID(GPIO, 0x8),
> > +     MFD_DEV_WITH_ID(GPIO, 0x9),
> > +     MFD_DEV_WITH_ID(GPIO, 0xA),
> > +     MFD_DEV_WITH_ID(GPIO, 0xB),
> > +     MFD_DEV_WITH_ID(GPIO, 0xC),
> > +     MFD_DEV_WITH_ID(GPIO, 0xD),
> > +     MFD_DEV_WITH_ID(GPIO, 0xE),
> > +     MFD_DEV_WITH_ID(GPIO, 0xF),
> > +
> > +     MFD_DEV_WITH_ID(I2C, 0x0),
> > +     MFD_DEV_WITH_ID(I2C, 0x1),
> > +     MFD_DEV_WITH_ID(I2C, 0x2),
> > +     MFD_DEV_WITH_ID(I2C, 0x3),
> > +     MFD_DEV_WITH_ID(I2C, 0x4),
> > +     MFD_DEV_WITH_ID(I2C, 0x5),
> > +
> > +     MFD_DEV_WITH_ID(CAN, 0x0),
> > +     MFD_DEV_WITH_ID(CAN, 0x1),
> > +
> > +     MFD_DEV_WITH_ID(WDT, 0x0),
> > +     MFD_DEV_WITH_ID(WDT, 0x1),
> > +
> > +     MFD_DEV_SIMPLE(IIO),
> > +     MFD_DEV_SIMPLE(HWMON),
> > +     MFD_DEV_SIMPLE(PWM),
> > +     MFD_DEV_SIMPLE(RTC),
> > +};
> > +
> > +int nct6694_register_handler(struct nct6694 *nct6694, int irq_bit,
> > +                          void (*handler)(void *), void *private_data)
> > +{
> > +     struct nct6694_handler_entry *entry;
> > +     unsigned long flags;
> > +
> > +     entry = kmalloc(sizeof(*entry), GFP_KERNEL);
> > +     if (!entry)
> > +             return -ENOMEM;
> > +
> > +     entry->irq_bit = irq_bit;
> > +     entry->handler = handler;
> > +     entry->private_data = private_data;
> > +
> > +     spin_lock_irqsave(&nct6694->lock, flags);
> > +     list_add_tail(&entry->list, &nct6694->handler_list);
> > +     spin_unlock_irqrestore(&nct6694->lock, flags);
> > +
> > +     return 0;
> > +}
> > +EXPORT_SYMBOL(nct6694_register_handler);
>
> Where's the corresponding nct6694_free_handler() function?
>
> Marc
>
> --
> Pengutronix e.K.                 | Marc Kleine-Budde          |
> Embedded Linux                   | https://www.pengutronix.de |
> Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
> Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux