diff mbox series

[1/5] mfd: Add support for IO functions of AAEON devices

Message ID 20210525054149.1792-1-kunyang_fan@asus.com
State New
Headers show
Series [1/5] mfd: Add support for IO functions of AAEON devices | expand

Commit Message

aaeon.asus@gmail.com May 25, 2021, 5:41 a.m. UTC
From: Kunyang_Fan <kunyang_fan@asus.com>

This adds the supports for multiple IO functions of the
AAEON x86 devices and makes use of the WMI interface to
control the these IO devices including:

- GPIO
- LED
- Watchdog
- HWMON

It also adds the mfd child device drivers to support
the above IO functions.

Signed-off-by: Kunyang_Fan <kunyang_fan@asus.com>
---
 MAINTAINERS             | 12 +++++++
 drivers/mfd/Kconfig     | 12 +++++++
 drivers/mfd/Makefile    |  1 +
 drivers/mfd/mfd-aaeon.c | 77 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 102 insertions(+)
 create mode 100644 drivers/mfd/mfd-aaeon.c

Comments

Andy Shevchenko May 25, 2021, 8:01 a.m. UTC | #1
+Cc: Hans (dunno if it's something you would like to be informed of)

On Tue, May 25, 2021 at 8:42 AM <aaeon.asus@gmail.com> wrote:
>
> From: Kunyang_Fan <kunyang_fan@asus.com>
>
> This adds the supports for multiple IO functions of the
> AAEON x86 devices and makes use of the WMI interface to
> control the these IO devices including:
>
> - GPIO
> - LED
> - Watchdog
> - HWMON
>
> It also adds the mfd child device drivers to support
> the above IO functions.

Do I miss the cover letter?

...

> +config MFD_AAEON
> +       tristate "AAEON WMI MFD devices"
> +       depends on ASUS_WMI
> +       help
> +         Say yes here to support mltiple IO devices on Single Board Computers

multiple

> +         produced by AAEON.
> +
> +         This driver leverages the ASUS WMI interface to access device
> +         resources.

I'm wondering should it be some kind of WMI framework part to bridge
WMI parts to MFD or so?

...

> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.

Please, drop all these duplications in all files. SPDX is enough.

...

> +static int aaeon_wmi_probe(struct wmi_device *wdev, const void *context)
> +{
> +       struct aaeon_wmi_priv *priv;

       struct aaeon_wmi_priv *priv = context;

> +       if (!wmi_has_guid(AAEON_WMI_MGMT_GUID)) {
> +               dev_info(&wdev->dev, "AAEON Management GUID not found\n");
> +               return -ENODEV;
> +       }

Dead code?

> +       priv = (struct aaeon_wmi_priv *)context;

See above.

> +       dev_set_drvdata(&wdev->dev, priv);
> +
> +       return devm_mfd_add_devices(&wdev->dev, 0, priv->cells,
> +                                   priv->ncells, NULL, 0, NULL);
> +}

...

> +static struct wmi_driver aaeon_wmi_driver = {
> +       .driver = {
> +               .name = "mfd-aaeon",
> +       },
> +       .id_table = aaeon_wmi_id_table,
> +       .probe = aaeon_wmi_probe,
> +};

> +

Redundant blank line.

> +module_wmi_driver(aaeon_wmi_driver);
Krzysztof Kozlowski May 26, 2021, 12:05 p.m. UTC | #2
On Tue, 25 May 2021 at 01:42, <aaeon.asus@gmail.com> wrote:
>

> From: Kunyang_Fan <kunyang_fan@asus.com>

>

> This adds the supports for multiple IO functions of the

> AAEON x86 devices and makes use of the WMI interface to

> control the these IO devices including:

>

> - GPIO

> - LED

> - Watchdog

> - HWMON

>

> It also adds the mfd child device drivers to support

> the above IO functions.

>

> Signed-off-by: Kunyang_Fan <kunyang_fan@asus.com>

> ---

>  MAINTAINERS             | 12 +++++++

>  drivers/mfd/Kconfig     | 12 +++++++

>  drivers/mfd/Makefile    |  1 +

>  drivers/mfd/mfd-aaeon.c | 77 +++++++++++++++++++++++++++++++++++++++++


Please CC all required maintainers - you skipped several people. You
will get their list from scripts/get_maintainer.pl.

>  4 files changed, 102 insertions(+)

>  create mode 100644 drivers/mfd/mfd-aaeon.c

>

> diff --git a/MAINTAINERS b/MAINTAINERS

> index 1c19c1e2c970..49783dd44367 100644

> --- a/MAINTAINERS

> +++ b/MAINTAINERS

> @@ -257,6 +257,18 @@ W: http://www.adaptec.com/

>  F:     Documentation/scsi/aacraid.rst

>  F:     drivers/scsi/aacraid/

>

> +AAEON DEVICE DRIVER WITH WMI INTERFACE

> +M:     Edward Lin<edward1_lin@asus.com>


Missing space.

> +M:     Kunyang Fan <kunyang_fan@asus.com>

> +M:     Frank Hsieh <frank2_hsieh@asus.com>

> +M:     Jacob Wu <jacob_wu@asus.com>


Why do you need four maintainers? Did they contribute to the code? Are
they all going to provide reviews?

> +S:     Supported

> +F:     drivers/gpio/gpio-aaeon.c

> +F:     drivers/hwmon/hwmon-aaeon.c

> +F:     drivers/leds/leds-aaeon.c

> +F:     drivers/mfd/mfd-aaeon.c

> +F:     drivers/watchdog/wdt_aaeon.c

> +

>  ABI/API

>  L:     linux-api@vger.kernel.org

>  F:     include/linux/syscalls.h

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig

> index a37d7d171382..f172564eed0d 100644

> --- a/drivers/mfd/Kconfig

> +++ b/drivers/mfd/Kconfig

> @@ -2053,6 +2053,18 @@ config MFD_WCD934X

>           This driver provides common support WCD934x audio codec and its

>           associated Pin Controller, Soundwire Controller and Audio codec.

>

> +


No double blank lines.

> +config MFD_AAEON

> +       tristate "AAEON WMI MFD devices"

> +       depends on ASUS_WMI

> +       help

> +         Say yes here to support mltiple IO devices on Single Board Computers


Please run spellcheck on entire submission.

> +         produced by AAEON.

> +

> +         This driver leverages the ASUS WMI interface to access device

> +         resources.

> +

> +

>  menu "Multimedia Capabilities Port drivers"

>         depends on ARCH_SA1100

>

> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile

> index 9367a92f795a..36fff3d0da7e 100644

> --- a/drivers/mfd/Makefile

> +++ b/drivers/mfd/Makefile

> @@ -264,3 +264,4 @@ obj-$(CONFIG_MFD_ROHM_BD718XX)      += rohm-bd718x7.o

>  obj-$(CONFIG_MFD_STMFX)        += stmfx.o

>

>  obj-$(CONFIG_SGI_MFD_IOC3)     += ioc3.o

> +obj-$(CONFIG_MFD_AAEON)                += mfd-aaeon.o

> diff --git a/drivers/mfd/mfd-aaeon.c b/drivers/mfd/mfd-aaeon.c

> new file mode 100644

> index 000000000000..9d2efde53cad

> --- /dev/null

> +++ b/drivers/mfd/mfd-aaeon.c

> @@ -0,0 +1,77 @@

> +// SPDX-License-Identifier: GPL-2.0-or-later

> +/*

> + * UP Board main platform driver and FPGA configuration support

> + *

> + * Copyright (c) 2021, AAEON Ltd.

> + *

> + * Author: Kunyang_Fan <knuyang_fan@aaeon.com.tw>

> + *

> + * This program is free software; you can redistribute it and/or modify

> + * it under the terms of the GNU General Public License version 2 as

> + * published by the Free Software Foundation.


No need for GPL text since you use SPDX.

> + */

> +

> +#include <linux/acpi.h>

> +#include <linux/gpio.h>

> +#include <linux/kernel.h>

> +#include <linux/mfd/core.h>

> +#include <linux/module.h>

> +#include <linux/platform_device.h>

> +#include <linux/leds.h>

> +#include <linux/wmi.h>

> +

> +#define AAEON_WMI_MGMT_GUID      "97845ED0-4E6D-11DE-8A39-0800200C9A66"

> +

> +struct aaeon_wmi_priv {

> +       const struct mfd_cell *cells;

> +       size_t ncells;

> +};

> +

> +static const struct mfd_cell aaeon_mfd_cells[] = {

> +       { .name = "gpio-aaeon" },

> +       { .name = "hwmon-aaeon"},

> +       { .name = "leds-aaeon"},

> +       { .name = "wdt-aaeon"},

> +};

> +

> +static const struct aaeon_wmi_priv aaeon_wmi_priv_data = {

> +       .cells = aaeon_mfd_cells,

> +       .ncells = ARRAY_SIZE(aaeon_mfd_cells),

> +};

> +

> +static int aaeon_wmi_probe(struct wmi_device *wdev, const void *context)

> +{

> +       struct aaeon_wmi_priv *priv;

> +

> +       if (!wmi_has_guid(AAEON_WMI_MGMT_GUID)) {

> +               dev_info(&wdev->dev, "AAEON Management GUID not found\n");

> +               return -ENODEV;

> +       }

> +

> +


No double blank lines.

> +       priv = (struct aaeon_wmi_priv *)context;

> +       dev_set_drvdata(&wdev->dev, priv);


No, why do you need to store device ID table as private data?

Best regards,
Krzysztof
Krzysztof Kozlowski May 26, 2021, 12:06 p.m. UTC | #3
On Tue, 25 May 2021 at 04:43, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>

> On Tue, May 25, 2021 at 8:42 AM <aaeon.asus@gmail.com> wrote:

> >

> > From: Kunyang_Fan <kunyang_fan@asus.com>

> >

> > This patch add support for the GPIO pins whose control are

> > transported to BIOS through ASUS WMI interface.

> >

> > Signed-off-by: Kunyang_Fan <kunyang_fan@asus.com>

>

> Missed SoB of the submitter. Dunno if it's a critical issue.


Yes, it is. Every person touching patch, which includes sender, must
SoB it. This applies also to other patches in the series.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 1c19c1e2c970..49783dd44367 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -257,6 +257,18 @@  W:	http://www.adaptec.com/
 F:	Documentation/scsi/aacraid.rst
 F:	drivers/scsi/aacraid/
 
+AAEON DEVICE DRIVER WITH WMI INTERFACE
+M:	Edward Lin<edward1_lin@asus.com>
+M:	Kunyang Fan <kunyang_fan@asus.com>
+M:	Frank Hsieh <frank2_hsieh@asus.com>
+M:	Jacob Wu <jacob_wu@asus.com>
+S:	Supported
+F:	drivers/gpio/gpio-aaeon.c
+F:	drivers/hwmon/hwmon-aaeon.c
+F:	drivers/leds/leds-aaeon.c
+F:	drivers/mfd/mfd-aaeon.c
+F:	drivers/watchdog/wdt_aaeon.c
+
 ABI/API
 L:	linux-api@vger.kernel.org
 F:	include/linux/syscalls.h
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index a37d7d171382..f172564eed0d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -2053,6 +2053,18 @@  config MFD_WCD934X
 	  This driver provides common support WCD934x audio codec and its
 	  associated Pin Controller, Soundwire Controller and Audio codec.
 
+
+config MFD_AAEON
+	tristate "AAEON WMI MFD devices"
+	depends on ASUS_WMI
+	help
+	  Say yes here to support mltiple IO devices on Single Board Computers
+	  produced by AAEON.
+
+	  This driver leverages the ASUS WMI interface to access device
+	  resources.
+
+
 menu "Multimedia Capabilities Port drivers"
 	depends on ARCH_SA1100
 
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 9367a92f795a..36fff3d0da7e 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -264,3 +264,4 @@  obj-$(CONFIG_MFD_ROHM_BD718XX)	+= rohm-bd718x7.o
 obj-$(CONFIG_MFD_STMFX) 	+= stmfx.o
 
 obj-$(CONFIG_SGI_MFD_IOC3)	+= ioc3.o
+obj-$(CONFIG_MFD_AAEON)		+= mfd-aaeon.o
diff --git a/drivers/mfd/mfd-aaeon.c b/drivers/mfd/mfd-aaeon.c
new file mode 100644
index 000000000000..9d2efde53cad
--- /dev/null
+++ b/drivers/mfd/mfd-aaeon.c
@@ -0,0 +1,77 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * UP Board main platform driver and FPGA configuration support
+ *
+ * Copyright (c) 2021, AAEON Ltd.
+ *
+ * Author: Kunyang_Fan <knuyang_fan@aaeon.com.tw>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/gpio.h>
+#include <linux/kernel.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
+#include <linux/wmi.h>
+
+#define AAEON_WMI_MGMT_GUID      "97845ED0-4E6D-11DE-8A39-0800200C9A66"
+
+struct aaeon_wmi_priv {
+	const struct mfd_cell *cells;
+	size_t ncells;
+};
+
+static const struct mfd_cell aaeon_mfd_cells[] = {
+	{ .name = "gpio-aaeon" },
+	{ .name = "hwmon-aaeon"},
+	{ .name = "leds-aaeon"},
+	{ .name = "wdt-aaeon"},
+};
+
+static const struct aaeon_wmi_priv aaeon_wmi_priv_data = {
+	.cells = aaeon_mfd_cells,
+	.ncells = ARRAY_SIZE(aaeon_mfd_cells),
+};
+
+static int aaeon_wmi_probe(struct wmi_device *wdev, const void *context)
+{
+	struct aaeon_wmi_priv *priv;
+
+	if (!wmi_has_guid(AAEON_WMI_MGMT_GUID)) {
+		dev_info(&wdev->dev, "AAEON Management GUID not found\n");
+		return -ENODEV;
+	}
+
+
+	priv = (struct aaeon_wmi_priv *)context;
+	dev_set_drvdata(&wdev->dev, priv);
+
+	return devm_mfd_add_devices(&wdev->dev, 0, priv->cells,
+				    priv->ncells, NULL, 0, NULL);
+}
+
+static const struct wmi_device_id aaeon_wmi_id_table[] = {
+	{ AAEON_WMI_MGMT_GUID, (void *)&aaeon_wmi_priv_data },
+	{}
+};
+
+static struct wmi_driver aaeon_wmi_driver = {
+	.driver = {
+		.name = "mfd-aaeon",
+	},
+	.id_table = aaeon_wmi_id_table,
+	.probe = aaeon_wmi_probe,
+};
+
+module_wmi_driver(aaeon_wmi_driver);
+
+MODULE_DEVICE_TABLE(wmi, aaeon_wmi_id_table);
+MODULE_AUTHOR("Kunyang Fan <kunyang_fan@aaeon.com.tw>");
+MODULE_DESCRIPTION("AAEON Board WMI driver");
+MODULE_LICENSE("GPL v2");