APUv2/v3 board support V2
Enrico Weigelt, metux IT consult
maintainerHi folks,
this is version 2 of my APUv2/APUv3 series. Heavily reworked, hope I've now addressed all issues of the last one.
Major changes are:
* using gpiod_lookup_table instead of hardcoded gpio numbers
* moved the PCHs gpio register definitions to the gpio drivers' header (but keeping the actual assignments in the board driver, as they're board speficic)
* moved IO resource definition from board to gpio driver (the FCHs mmio base address could be changed, but nobody seems to ever do it)
* added gpio line names
* moved the gpio driver's pdata definitions to::
include/linux/platform_data/gpio/gpio-amd-fch.h
* reduced some code redundancies and various cleanups
Possibly debatable:
* does is the assigned key code fit well ? (KEY_SETUP seemed the best candidate to me, but I'm open to suggestions)
* should the pch gpio become a sub-device of some toplevel PCH device ? (which then could also maintain the base address, etc)
Note: the keyboard device needs separate patch for gpiod_lookup_table support in gpio-keys-polled driver. I'll sent it separately.
--mtx
Signature · 3 lines
Enrico Weigelt, metux IT consult Free software and Linux embedded engineering [email protected] -- +49-151-27565287
Enrico Weigelt, metux IT consult
maintainerPATCH 1/2 gpio: AMD G-Series PCH gpio driver
GPIO platform driver for the AMD G-series PCH (eg. on GX-412TC)
This driver doesn't registers itself automatically, as it needs to be provided with platform specific configuration, provided by some board driver setup code.
Didn't implement oftree probing yet, as it's rarely found on x86.
--- MAINTAINERS | 7 + drivers/gpio/Kconfig | 10 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-amd-fch.c | 205 ++++++++++++++++++++++++ include/linux/platform_data/gpio/gpio-amd-fch.h | 46 ++++++ 5 files changed, 269 insertions(+) create mode 100644 drivers/gpio/gpio-amd-fch.c create mode 100644 include/linux/platform_data/gpio/gpio-amd-fch.h
MAINTAINERS +7 -0
@@ -766,6 +766,13 @@ S: Supported F: Documentation/hwmon/fam15h_power F: drivers/hwmon/fam15h_power.c +AMD FCH GPIO DRIVER +M: Enrico Weigelt, metux IT consult <[email protected]> +L: [email protected] +S: Maintained +F: drivers/gpio/gpio-amd-fch.c +F: include/linux/platform_data/gpio/gpio-amd-fch.h + AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER L: [email protected] (moderated for non-subscribers) S: Orphan
drivers/gpio/Kconfig +10 -0
@@ -654,6 +654,16 @@ config GPIO_LOONGSON1 help Say Y or M here to support GPIO on Loongson1 SoCs. +config GPIO_AMD_FCH + tristate "GPIO support for AMD Fusion Controller Hub (G-series SOCs)" + select GPIO_GENERIC + help + This option enables driver for GPIO on AMDs Fusion Controller Hub, + as found on G-series SOCs (eg. GX-412TC) + + Note: This driver doesn't registers itself automatically, as it + needs to be provided with platform specific configuration. + (See eg. CONFIG_PCENGINES_APU2.) endmenu menu "Port-mapped I/O GPIO drivers"
drivers/gpio/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_GPIO_ADP5520) += gpio-adp5520.o obj-$(CONFIG_GPIO_ADP5588) += gpio-adp5588.o obj-$(CONFIG_GPIO_ALTERA) += gpio-altera.o obj-$(CONFIG_GPIO_ALTERA_A10SR) += gpio-altera-a10sr.o +obj-$(CONFIG_GPIO_AMD_FCH) += gpio-amd-fch.o obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o
drivers/gpio/gpio-amd-fch.c new file +205 -0
205 lines not on this page · raw message
include/linux/platform_data/gpio/gpio-amd-fch.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH 1/2] gpio: AMD G-Series PCH gpio driver
On Wed, Feb 13, 2019 at 10:57 PM Enrico Weigelt, metux IT consult <[email protected]> wrote:
Thanks for this version, my comments below.
Quoted 8 lines
GPIO platform driver for the AMD G-series PCH (eg. on GX-412TC)
This driver doesn't registers itself automatically, as it needs to be provided with platform specific configuration, provided by some board driver setup code.
Didn't implement oftree probing yet, as it's rarely found on x86.
Since I don't see neither changelog nor version of the series, it's hard to say what had been changed and addressed.
drivers/gpio/gpio-amd-fch.c line 41
Quoted 9 lines
drivers/gpio/gpio-amd-fch.c new file +8
-0+static void *amd_fch_gpio_addr (struct amd_fch_gpio_priv *priv, +unsigned int gpio) +{ +if (unlikely (gpio > priv->pdata->gpio_num)) { +dev_err (&priv->pdev->dev, +"gpio number %d out of range\n" , gpio); +return NULL ; + }
I'm pretty sure this wouldn't be the case.
drivers/gpio/gpio-amd-fch.c line 54
Quoted 6 lines
drivers/gpio/gpio-amd-fch.c new file +5
-0+ +return priv->base + priv->pdata->gpio_reg[gpio]*sizeof (u32); +} +if (unlikely (!ptr)) +return -EINVAL ;
Neither those ones.
drivers/gpio/gpio-amd-fch.c line 114
Quoted 8 lines
drivers/gpio/gpio-amd-fch.c new file +8
-0+spin_lock_irqsave (&priv->gc.bgpio_lock, flags); + +if (value) +writel_relaxed (readl_relaxed (ptr) |AMD_FCH_GPIO_FLAG_WRITE , + ptr); +else +writel_relaxed (readl_relaxed (ptr) & ~AMD_FCH_GPIO_FLAG_WRITE , + ptr);
This will look better in usual pattern, i.e.
u32 value;
...
value = readl...
if (...)
...
else
...
writel...
drivers/gpio/gpio-amd-fch.c line 144
Quoted 8 lines
drivers/gpio/gpio-amd-fch.c new file +8
-0+static int amd_fch_gpio_request (struct gpio_chip *chip, +unsigned int gpio_pin) +{ +if (likely (gpio_pin < chip->ngpio)) +return 0 ; + +return -EINVAL ; +}
Can't be generic request routine used?
drivers/gpio/gpio-amd-fch.c line 153
Quoted 10 lines
drivers/gpio/gpio-amd-fch.c new file +9
-0+ +static int amd_fch_gpio_probe (struct platform_device *pdev) +{ +struct amd_fch_gpio_priv *priv; +struct amd_fch_gpio_pdata *pdata; +struct resource res =DEFINE_RES_MEM_NAMED ( +AMD_FCH_MMIO_BASE +AMD_FCH_GPIO_BANK0_BASE , +AMD_FCH_GPIO_SIZE , +"amd-fch-gpio-iomem" );
Define this outside the function as static variable.
drivers/gpio/gpio-amd-fch.c line 156
Quoted 4 lines
drivers/gpio/gpio-amd-fch.c new file +3
-0+ + pdata =dev_get_platdata (&pdev->dev); +
Redundant blank line.
Quoted 1 line
+ if (unlikely(pdata == NULL)) {
Simple if (!pdata)
drivers/gpio/gpio-amd-fch.c line 163
Quoted 7 lines
drivers/gpio/gpio-amd-fch.c new file +6
-0+dev_err (&pdev->dev,"no platform_data\n" ); +return -ENOENT ; + } + + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); +
Redundant blank line.
Quoted 1 line
+ if (unlikely(priv == NULL))
This check is simple
if (!priv)
drivers/gpio/gpio-amd-fch.c line 186
Quoted 9 lines
drivers/gpio/gpio-amd-fch.c new file +7
-0+return -ENOMEM ; + +spin_lock_init (&priv->gc.bgpio_lock); + + priv->base =devm_ioremap_resource (&pdev->dev, &res); +if (IS_ERR (priv->base)) +return -ENXIO ;
Do not shadow error code.
Quoted 5 lines
drivers/gpio/gpio-amd-fch.c new file +5
-0+ +platform_set_drvdata (pdev, priv); + +return devm_gpiochip_add_data (&pdev->dev, &priv->gc, priv); +}
Signature · 2 lines
With Best Regards, Andy Shevchenko
Enrico Weigelt, metux IT consult
maintainerPATCH 2/2 x86: pcengines apuv2 gpio/leds/keys platform driver
In reply to Enrico Weigelt, metux IT consultDriver for PCengines APUv2 board's front LEDs and Button, which are attached to AMD PCH GPIOs. Due to lack of dedicated ACPI entry, detecting the board via DMI.
--- MAINTAINERS | 5 + drivers/platform/x86/Kconfig | 13 ++ drivers/platform/x86/Makefile | 1 + drivers/platform/x86/pcengines-apuv2.c | 259 +++++++++++++++++++++++++++++++++ 4 files changed, 278 insertions(+) create mode 100644 drivers/platform/x86/pcengines-apuv2.c
MAINTAINERS +5 -0
@@ -11522,6 +11522,11 @@ F: lib/parman.c F: lib/test_parman.c F: include/linux/parman.h +PC ENGINES APU BOARD DRIVER +M: Enrico Weigelt, metux IT consult <[email protected]> +S: Maintained +F: drivers/platform/x86/pcengines-apuv2.c + PC87360 HARDWARE MONITORING DRIVER M: Jim Cromie <[email protected]> L: [email protected]
drivers/platform/x86/Kconfig +13 -0
@@ -1303,6 +1303,19 @@ config HUAWEI_WMI To compile this driver as a module, choose M here: the module will be called huawei-wmi. +config PCENGINES_APU2 + tristate "PC Engines APUv2/3 front button and LEDs driver" + select GPIO_AMD_FCH + select KEYBOARD_GPIO + select KEYBOARD_GPIO_POLLED + select LEDS_GPIO + help + This driver provides support for the front button and LEDs on + PC Engines APUv2/APUv3 board. + + To compile this driver as a module, choose M here: the module + will be called pcengines-apuv2. + endif # X86_PLATFORM_DEVICES config PMC_ATOM
drivers/platform/x86/Makefile +1 -0
@@ -96,3 +96,4 @@ obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o obj-$(CONFIG_I2C_MULTI_INSTANTIATE) += i2c-multi-instantiate.o obj-$(CONFIG_INTEL_ATOMISP2_PM) += intel_atomisp2_pm.o +obj-$(CONFIG_PCENGINES_APU2) += pcengines-apuv2.o
drivers/platform/x86/pcengines-apuv2.c new file +259 -0
259 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH 2/2] x86: pcengines apuv2 gpio/leds/keys platform driver
drivers/platform/x86/pcengines-apuv2.c line 16
Quoted 8 lines · metux IT consult
Driver for PCengines APUv2 board's front LEDs and Button, which are attached to AMD PCH GPIOs. Due to lack of dedicated ACPI entry, detecting the board via DMI.
drivers/platform/x86/pcengines-apuv2.c new file +2
-0+#include <linux/init.h> +#include <linux/module.h>
One of them is not needed.
Quoted 6 lines
drivers/platform/x86/pcengines-apuv2.c new file +6
-0+static struct platform_device *__init apu_create_pdev ( +const char * name, +const void *pdata, +size_t sz) +{ +struct platform_device *pdev;
drivers/platform/x86/pcengines-apuv2.c line 197
Quoted 10 lines
drivers/platform/x86/pcengines-apuv2.c new file +9
-0+ + pdev =platform_device_register_resndata ( +NULL ,/* parent */ + name,/* name */ +PLATFORM_DEVID_NONE ,/* id */ +NULL ,/* res */ +0 ,/* res_num */ + pdata,/* platform_data */ + sz);
No need to comment the obvious.
drivers/platform/x86/pcengines-apuv2.c line 200
Quoted 4 lines
drivers/platform/x86/pcengines-apuv2.c new file +3
-0+ +if (IS_ERR (pdev)) +pr_err (KBUILD_MODNAME ": failed registering %s: %ld\n" , name,PTR_ERR (pdev));
Better to set pr_fmt() macro at the top of source.
drivers/platform/x86/pcengines-apuv2.c line 211
Quoted 12 lines
drivers/platform/x86/pcengines-apuv2.c new file +11
-0+ +return pdev; +} + +static int __init apu_board_init (void ) +{ +int rc; +const struct dmi_system_id *id; + + id =dmi_first_match (apu_gpio_dmi_table); +
Redundant blank line.
drivers/platform/x86/pcengines-apuv2.c line 213
Quoted 2 lines
drivers/platform/x86/pcengines-apuv2.c new file +2
-0+if (!id) { +pr_err (KBUILD_MODNAME ": failed to detect apu board via dmi\n" );
pr_fmt()
drivers/platform/x86/pcengines-apuv2.c line 235
Quoted 4 lines
drivers/platform/x86/pcengines-apuv2.c new file +3
-0+return -ENODEV ; + } +pr_info (KBUILD_MODNAME ": initialized: gpio, leds, keys\n" );
Noise.
Quoted 2 lines
(quoted diff) +2
-0+ return 0; +}
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · metux IT consult
Hi folks,
this is version 2 of my APUv2/APUv3 series. Heavily reworked, hope I've now addressed all issues of the last one.
Thanks!
It looks indeed better.
I dunno how you created this message, I hope you used --cover-letter parameter to git-format-patch.
Just don't forget to add -v<N>, where <N> is version.
Also makes sense to do --thread to put proper references to emails.
Quoted 30 lines
Major changes are:
* usinggpiod_lookup_tableinstead of hardcoded gpio numbers
* moved the PCHs gpio register definitions to the gpio drivers' header (but keeping the actual assignments in the board driver, as they're board speficic)
* moved IO resource definition from board to gpio driver (the FCHs mmio base address could be changed, but nobody seems to ever do it)
* added gpio line names
* moved the gpio driver's pdata definitions to::
include/linux/platform_data/gpio/gpio-amd-fch.h
* reduced some code redundancies and various cleanupsPossibly debatable:
* does is the assigned key code fit well ? (KEY_SETUPseemed the best candidate to me, but I'm open to suggestions)
* should the pch gpio become a sub-device of some toplevel PCH device ? (which then could also maintain the base address, etc)Note: the keyboard device needs separate patch for
gpiod_lookup_tablesupport in gpio-keys-polled driver. I'll sent it separately.--mtx
--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
Signature · 2 lines
With Best Regards, Andy Shevchenko
On 14.02.19 03:17, Andy Shevchenko wrote:
Hi,
Quoted 2 lines
I dunno how you created this message, I hope you used --cover-letter parameter to git-format-patch.
I'm using: git send-email --compose <...>
Quoted 1 line
Just don't forget to add -v<N>, where <N> is version.
hmm, git send-email doesn't seem to have a corresponding flag :(
--mtx
Signature · 3 lines
Enrico Weigelt, metux IT consult Free software and Linux embedded engineering [email protected] -- +49-151-27565287
Quoted 10 lines · metux IT consult
Quoted 2 lines · Andy Shevchenko
I dunno how you created this message, I hope you used --cover-letter parameter to git-format-patch.
I'm using: git send-email --compose <...>
Quoted 1 line
Just don't forget to add -v<N>, where <N> is version.
hmm, git send-email doesn't seem to have a corresponding flag :(
It's there from several releases. But it's not a send-email option, it's format-patch one.
send-email passes those commands to format-patch.
Perhaps time to update your ancient version of git tools? :-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
It's there from several releases. But it's not a send-email option, it's format-patch one.
send-email passes those commands to format-patch.
oh, wasn't aware of that.
thx.
--mtx
Signature · 3 lines
Enrico Weigelt, metux IT consult Free software and Linux embedded engineering [email protected] -- +49-151-27565287
Enrico Weigelt, metux IT consult
maintainerAPUv2/v3 board support V3
In reply to Enrico Weigelt, metux IT consultHi folks,
this is version 3 of my APUv2/APUv3 series.
change in V3:
* gpio driver
* drop unncessary gpio id checks
* cleanup amd_fch_gpio_set()
* move iores outside probe()
* shorter NULL checks and correct error in probe()
* apu board driver
* drop unneeded init.h
* drop unnecessary comments
* clean up logging
* dont need to depend on KEYBOARD_GPIO
--mtx
Enrico Weigelt, metux IT consult
maintainerPATCH v3 1/2 gpio: AMD G-Series PCH gpio driver
GPIO platform driver for the AMD G-series PCH (eg. on GX-412TC)
This driver doesn't registers itself automatically, as it needs to be provided with platform specific configuration, provided by some board driver setup code.
Didn't implement oftree probing yet, as it's rarely found on x86.
--- MAINTAINERS | 7 + drivers/gpio/Kconfig | 10 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-amd-fch.c | 182 ++++++++++++++++++++++++ include/linux/platform_data/gpio/gpio-amd-fch.h | 46 ++++++ 5 files changed, 246 insertions(+) create mode 100644 drivers/gpio/gpio-amd-fch.c create mode 100644 include/linux/platform_data/gpio/gpio-amd-fch.h
MAINTAINERS +7 -0
@@ -766,6 +766,13 @@ S: Supported F: Documentation/hwmon/fam15h_power F: drivers/hwmon/fam15h_power.c +AMD FCH GPIO DRIVER +M: Enrico Weigelt, metux IT consult <[email protected]> +L: [email protected] +S: Maintained +F: drivers/gpio/gpio-amd-fch.c +F: include/linux/platform_data/gpio/gpio-amd-fch.h + AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER L: [email protected] (moderated for non-subscribers) S: Orphan
drivers/gpio/Kconfig +10 -0
@@ -654,6 +654,16 @@ config GPIO_LOONGSON1 help Say Y or M here to support GPIO on Loongson1 SoCs. +config GPIO_AMD_FCH + tristate "GPIO support for AMD Fusion Controller Hub (G-series SOCs)" + select GPIO_GENERIC + help + This option enables driver for GPIO on AMDs Fusion Controller Hub, + as found on G-series SOCs (eg. GX-412TC) + + Note: This driver doesn't registers itself automatically, as it + needs to be provided with platform specific configuration. + (See eg. CONFIG_PCENGINES_APU2.) endmenu menu "Port-mapped I/O GPIO drivers"
drivers/gpio/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_GPIO_ADP5520) += gpio-adp5520.o obj-$(CONFIG_GPIO_ADP5588) += gpio-adp5588.o obj-$(CONFIG_GPIO_ALTERA) += gpio-altera.o obj-$(CONFIG_GPIO_ALTERA_A10SR) += gpio-altera-a10sr.o +obj-$(CONFIG_GPIO_AMD_FCH) += gpio-amd-fch.o obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o
drivers/gpio/gpio-amd-fch.c new file +182 -0
182 lines not on this page · raw message
include/linux/platform_data/gpio/gpio-amd-fch.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v3 1/2] gpio: AMD G-Series PCH gpio driver
Quoted 16 lines · metux IT consult
GPIO platform driver for the AMD G-series PCH (eg. on GX-412TC)
This driver doesn't registers itself automatically, as it needs to be provided with platform specific configuration, provided by some board driver setup code.
Didn't implement oftree probing yet, as it's rarely found on x86.
Signed-off-by Enrico Weigelt, metux IT consult <[email protected]>
(...)
drivers/gpio/Kconfig config GPIO_LOONGSON1 · line 659
Quoted 3 lines
drivers/gpio/Kconfig +3
-0+config GPIO_AMD_FCH + tristate "GPIO support for AMD Fusion Controller Hub (G-series SOCs)" + select GPIO_GENERIC
Now I see that you do this
Quoted 1 line
+
spin_lock_irqsave(&priv->gc.bgpio_lock, flags);
(...)
Quoted 1 line
+
spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags);
Only to get that spinlock.
That's not what GPIO_GENERIC is for, just put a spinlock in your local state container struct amd_fch_gpio_priv instead.
Yours,
Linus Walleij
Enrico Weigelt, metux IT consult
maintainerPATCH v3 2/2 x86: pcengines apuv2 gpio/leds/keys platform driver
In reply to Enrico Weigelt, metux IT consultDriver for PCengines APUv2 board's front LEDs and Button, which are attached to AMD PCH GPIOs. Due to lack of dedicated ACPI entry, detecting the board via DMI.
--- MAINTAINERS | 5 + drivers/platform/x86/Kconfig | 12 ++ drivers/platform/x86/Makefile | 1 + drivers/platform/x86/pcengines-apuv2.c | 261 +++++++++++++++++++++++++++++++++ 4 files changed, 279 insertions(+) create mode 100644 drivers/platform/x86/pcengines-apuv2.c
MAINTAINERS +5 -0
@@ -11522,6 +11522,11 @@ F: lib/parman.c F: lib/test_parman.c F: include/linux/parman.h +PC ENGINES APU BOARD DRIVER +M: Enrico Weigelt, metux IT consult <[email protected]> +S: Maintained +F: drivers/platform/x86/pcengines-apuv2.c + PC87360 HARDWARE MONITORING DRIVER M: Jim Cromie <[email protected]> L: [email protected]
drivers/platform/x86/Kconfig +12 -0
@@ -1303,6 +1303,18 @@ config HUAWEI_WMI To compile this driver as a module, choose M here: the module will be called huawei-wmi. +config PCENGINES_APU2 + tristate "PC Engines APUv2/3 front button and LEDs driver" + select GPIO_AMD_FCH + select KEYBOARD_GPIO_POLLED + select LEDS_GPIO + help + This driver provides support for the front button and LEDs on + PC Engines APUv2/APUv3 board. + + To compile this driver as a module, choose M here: the module + will be called pcengines-apuv2. + endif # X86_PLATFORM_DEVICES config PMC_ATOM
drivers/platform/x86/Makefile +1 -0
@@ -96,3 +96,4 @@ obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o obj-$(CONFIG_I2C_MULTI_INSTANTIATE) += i2c-multi-instantiate.o obj-$(CONFIG_INTEL_ATOMISP2_PM) += intel_atomisp2_pm.o +obj-$(CONFIG_PCENGINES_APU2) += pcengines-apuv2.o
drivers/platform/x86/pcengines-apuv2.c new file +261 -0
261 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v3 2/2] x86: pcengines apuv2 gpio/leds/keys platform driver
Quoted 4 lines · metux IT consult
Driver for PCengines APUv2 board's front LEDs and Button, which are attached to AMD PCH GPIOs. Due to lack of dedicated ACPI entry, detecting the board via DMI.
Quoted 8 lines
Signed-off-by Enrico Weigelt, metux IT consult <[email protected]>
Patch applied with Andy's review tag.
Yours,
Linus Walleij
Andy Shevchenko
Reviewed-byRe: APUv2/v3 board support V3
In reply to Enrico Weigelt, metux IT consultQuoted 4 lines · metux IT consult
Hi folks,
Thanks for an update.
Linus, this one looks good enough, though some style minors can be addressed:
- redundant parens (and actually I prefer to see x = readl(); x |= ...; writel(); in three lines)
- useless blank lines
- style of parameters where one per line (it's not needed in this drivers)
In any case, FWIW,
Quoted 17 lines
this is version 3 of my APUv2/APUv3 series.
change in V3:
* gpio driver
* drop unncessary gpio id checks
* cleanupamd_fch_gpio_set()
* move iores outsideprobe()
* shorter NULL checks and correct error inprobe()
* apu board driver
* drop unneededinit.h
* drop unnecessary comments
* clean up logging
* dont need to depend onKEYBOARD_GPIO--mtx
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: APUv2/v3 board support V3
Quoted 10 lines · Andy Shevchenko
On Fri, Feb 15, 2019 at 12:05 AM Enrico Weigelt, metux IT consult
Linus, this one looks good enough, though some style minors can be addressed:
- redundant parens (and actually I prefer to see x =readl(); x |= ...;writel(); in three lines)
- useless blank lines
- style of parameters where one per line (it's not needed in this drivers)In any case, FWIW,
Reviewed-by Andy Shevchenko <[email protected]>
OK Enrico can you include Andy's Review tag when you respin, fix the spinlock issue I pointed out and send out as v4 and I'll apply it.
Yours,
Linus Walleij
Enrico Weigelt, metux IT consult
maintainerAPUv2/v3 board support v4
In reply to Enrico Weigelt, metux IT consultHi folks,
this is version 4 of my APUv2/APUv3 series.
changes in v4:
* fixed spinlocks (using own field instead of gc.bgpio_lock)
* dropped superflous dependency on GPIO_GENERIC
* initialize gc.base = -1
* added Reviewed-By tags
changes in v3:
* gpio driver
* drop unncessary gpio id checks
* cleanup amd_fch_gpio_set()
* move iores outside probe()
* shorter NULL checks and correct error in probe()
* apu board driver
* drop unneeded init.h
* drop unnecessary comments
* clean up logging
* dont need to depend on KEYBOARD_GPIO
--mtx
Enrico Weigelt, metux IT consult
maintainerPATCH v4 1/2 gpio: AMD G-Series PCH gpio driver
GPIO platform driver for the AMD G-series PCH (eg. on GX-412TC)
This driver doesn't registers itself automatically, as it needs to be provided with platform specific configuration, provided by some board driver setup code.
Didn't implement oftree probing yet, as it's rarely found on x86.
--- MAINTAINERS | 7 + drivers/gpio/Kconfig | 9 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-amd-fch.c | 185 ++++++++++++++++++++++++ include/linux/platform_data/gpio/gpio-amd-fch.h | 46 ++++++ 5 files changed, 248 insertions(+) create mode 100644 drivers/gpio/gpio-amd-fch.c create mode 100644 include/linux/platform_data/gpio/gpio-amd-fch.h
MAINTAINERS +7 -0
@@ -766,6 +766,13 @@ S: Supported F: Documentation/hwmon/fam15h_power F: drivers/hwmon/fam15h_power.c +AMD FCH GPIO DRIVER +M: Enrico Weigelt, metux IT consult <[email protected]> +L: [email protected] +S: Maintained +F: drivers/gpio/gpio-amd-fch.c +F: include/linux/platform_data/gpio/gpio-amd-fch.h + AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER L: [email protected] (moderated for non-subscribers) S: Orphan
drivers/gpio/Kconfig +9 -0
@@ -654,6 +654,15 @@ config GPIO_LOONGSON1 help Say Y or M here to support GPIO on Loongson1 SoCs. +config GPIO_AMD_FCH + tristate "GPIO support for AMD Fusion Controller Hub (G-series SOCs)" + help + This option enables driver for GPIO on AMDs Fusion Controller Hub, + as found on G-series SOCs (eg. GX-412TC) + + Note: This driver doesn't registers itself automatically, as it + needs to be provided with platform specific configuration. + (See eg. CONFIG_PCENGINES_APU2.) endmenu menu "Port-mapped I/O GPIO drivers"
drivers/gpio/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_GPIO_ADP5520) += gpio-adp5520.o obj-$(CONFIG_GPIO_ADP5588) += gpio-adp5588.o obj-$(CONFIG_GPIO_ALTERA) += gpio-altera.o obj-$(CONFIG_GPIO_ALTERA_A10SR) += gpio-altera-a10sr.o +obj-$(CONFIG_GPIO_AMD_FCH) += gpio-amd-fch.o obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o
drivers/gpio/gpio-amd-fch.c new file +185 -0
185 lines not on this page · raw message
include/linux/platform_data/gpio/gpio-amd-fch.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v4 1/2] gpio: AMD G-Series PCH gpio driver
Quoted 15 lines · metux IT consult
GPIO platform driver for the AMD G-series PCH (eg. on GX-412TC)
This driver doesn't registers itself automatically, as it needs to be provided with platform specific configuration, provided by some board driver setup code.
Didn't implement oftree probing yet, as it's rarely found on x86.
Quoted 2 lines
Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Enrico Weigelt, metux IT consult <[email protected]>
Patch applied.
Yours,
Linus Walleij
Enrico Weigelt, metux IT consult
maintainerPATCH v4 2/2 x86: pcengines apuv2 gpio/leds/keys platform driver
In reply to Enrico Weigelt, metux IT consultDriver for PCengines APUv2 board's front LEDs and Button, which are attached to AMD PCH GPIOs. Due to lack of dedicated ACPI entry, detecting the board via DMI.
--- MAINTAINERS | 5 + drivers/platform/x86/Kconfig | 12 ++ drivers/platform/x86/Makefile | 1 + drivers/platform/x86/pcengines-apuv2.c | 261 +++++++++++++++++++++++++++++++++ 4 files changed, 279 insertions(+) create mode 100644 drivers/platform/x86/pcengines-apuv2.c
MAINTAINERS +5 -0
@@ -11522,6 +11522,11 @@ F: lib/parman.c F: lib/test_parman.c F: include/linux/parman.h +PC ENGINES APU BOARD DRIVER +M: Enrico Weigelt, metux IT consult <[email protected]> +S: Maintained +F: drivers/platform/x86/pcengines-apuv2.c + PC87360 HARDWARE MONITORING DRIVER M: Jim Cromie <[email protected]> L: [email protected]
drivers/platform/x86/Kconfig +12 -0
@@ -1303,6 +1303,18 @@ config HUAWEI_WMI To compile this driver as a module, choose M here: the module will be called huawei-wmi. +config PCENGINES_APU2 + tristate "PC Engines APUv2/3 front button and LEDs driver" + select GPIO_AMD_FCH + select KEYBOARD_GPIO_POLLED + select LEDS_GPIO + help + This driver provides support for the front button and LEDs on + PC Engines APUv2/APUv3 board. + + To compile this driver as a module, choose M here: the module + will be called pcengines-apuv2. + endif # X86_PLATFORM_DEVICES config PMC_ATOM
drivers/platform/x86/Makefile +1 -0
@@ -96,3 +96,4 @@ obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o obj-$(CONFIG_I2C_MULTI_INSTANTIATE) += i2c-multi-instantiate.o obj-$(CONFIG_INTEL_ATOMISP2_PM) += intel_atomisp2_pm.o +obj-$(CONFIG_PCENGINES_APU2) += pcengines-apuv2.o
drivers/platform/x86/pcengines-apuv2.c new file +261 -0
261 lines not on this page · raw message
Signature · 1 line
1.9.1