Add Altera A10SR Status & Control Monitor
v3 cover Add Altera A10SR Status & Control Monitor
From: Thor Thayer <[email protected]>
his patch series adds the Altera Arria10 DevKit System Resource chip's Status and Control Monitor to the A10SR Multi-Function Device. An earlier patch added this to the hwmon class which wasn't the proper place so this functionality is added to the misc directory.
Version 2 changes the DT names from -mon to -monitor for better readability and clarity and changed the previous version from modular to built-in.
Version 3 improves the DT bindings naming and removes an unused variable.
Thor Thayer (4):
dt-bindings: mfd: Add Altera Arria10 SR Monitor
misc: Add Altera Arria10 System Resource Control
mfd: altr-a10sr: Add Arria10 SR Monitor
ARM: socfpga: dts: Add Monitor to A10-SR MFD
.../devicetree/bindings/mfd/altera-a10sr.txt | 11 +- MAINTAINERS | 1 + arch/arm/boot/dts/socfpga_arria10_socdk.dtsi | 4 + drivers/mfd/altera-a10sr.c | 6 +- drivers/misc/Kconfig | 7 + drivers/misc/Makefile | 1 + drivers/misc/altera-a10sr-monitor.c | 175 +++++++++++++++++++++ 7 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 drivers/misc/altera-a10sr-monitor.c
Signature · 1 line
1.9.1
PATCH v3 1/4 dt-bindings: mfd: Add Altera Arria10 SR Monitor
From: Thor Thayer <[email protected]>
Add the Arria10 DevKit System Resource Chip register and state monitoring module to the MFD.
---
Note: This needs to be applied to the bindings document that was Acked & Applied but didn't reach the for-next branch. See https://patchwork.ozlabs.org/patch/629397/
---
v2 Change compatible string -mon to -monitor for clarity v3 Replace node name a10sr_monitor with just monitor.
Replace node name a10sr_gpio with just gpio.
--- Documentation/devicetree/bindings/mfd/altera-a10sr.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/altera-a10sr.txt +10 -1
@@ -17,7 +17,8 @@ The A10SR consists of these sub-devices: Device Description ------ ---------- -a10sr_gpio GPIO Controller +gpio GPIO Controller +monitor Register and State Monitoring Arria10 GPIO Required Properties:
@@ -27,6 +28,10 @@ Required Properties: the second cell is used to specify flags. See ../gpio/gpio.txt for more information. +Arria10 Register and State Monitor +Required Properties: +- compatible : Should be "altr,a10sr-monitor" + Example: resource-manager at 0 {
@@ -43,4 +48,8 @@ Example: gpio-controller; #gpio-cells = <2>; }; + + monitor { + compatible = "altr,a10sr-monitor"; + }; };
Signature · 1 line
1.9.1
Re: [PATCHv3 1/4] dt-bindings: mfd: Add Altera Arria10 SR Monitor
Quoted 14 lines · On Wed, 02 Nov 2016, [email protected] wrote:
From: Thor Thayer <[email protected]>
Add the Arria10 DevKit System Resource Chip register and state monitoring module to the MFD.
Signed-off-by Thor Thayer <[email protected]>---
Note: This needs to be applied to the bindings document that was Acked & Applied but didn't reach the for-next branch. See https://patchwork.ozlabs.org/patch/629397/
---
v2 Change compatible string -mon to -monitor for clarity v3 Replace node namea10sr_monitorwith just monitor.
Replace node namea10sr_gpiowith just gpio.
Quoted 3 lines
--- Documentation/devicetree/bindings/mfd/altera-a10sr.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
For my own reference:
Quoted 34 lines
Documentation/devicetree/bindings/mfd/altera-a10sr.txt +10
-1@@ -17,7 +17,8 @@ The A10SR consists of these sub-devices: Device Description ------ ---------- -a10sr_gpio GPIO Controller +gpio GPIO Controller +monitor Register and State Monitoring Arria10 GPIO Required Properties:@@ -27,6 +28,10 @@ Required Properties: the second cell is used to specify flags. See ../gpio/gpio.txt for more information. +Arria10 Register and State Monitor +Required Properties: +- compatible : Should be "altr,a10sr-monitor" + Example: resource-manager@0 {@@ -43,4 +48,8 @@ Example: gpio-controller; #gpio-cells = <2>; }; + + monitor { + compatible = "altr,a10sr-monitor"; + }; };
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCHv3 1/4] dt-bindings: mfd: Add Altera Arria10 SR Monitor
In reply to [email protected]Quoted 14 lines · tthayer at opensource.altera.com
From: Thor Thayer <[email protected]>
Add the Arria10 DevKit System Resource Chip register and state monitoring module to the MFD.
Signed-off-by Thor Thayer <[email protected]>---
Note: This needs to be applied to the bindings document that was Acked & Applied but didn't reach the for-next branch. See https://patchwork.ozlabs.org/patch/629397/
---
v2 Change compatible string -mon to -monitor for clarity v3 Replace node namea10sr_monitorwith just monitor.
Replace node namea10sr_gpiowith just gpio.
Quoted 3 lines
--- Documentation/devicetree/bindings/mfd/altera-a10sr.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
PATCH v3 2/4 misc: Add Altera Arria10 System Resource Control
In reply to [email protected]From: Thor Thayer <[email protected]>
This patch adds the Altera Arria10 control & monitoring functions to the Arria10 System Resource chip.
---
v2 Change compatible string and filename from -mon to -monitor
Change CONFIG from module to builtin.
Make wm_rst register writeable.
v3 Remove unused ret variable.
Shorten driver name (remove altr_).
--- MAINTAINERS | 1 + drivers/misc/Kconfig | 7 ++ drivers/misc/Makefile | 1 + drivers/misc/altera-a10sr-monitor.c | 175 ++++++++++++++++++++++++++++++++++++ 4 files changed, 184 insertions(+) create mode 100644 drivers/misc/altera-a10sr-monitor.c
MAINTAINERS +1 -0
@@ -635,6 +635,7 @@ M: Thor Thayer <[email protected]> S: Maintained F: drivers/gpio/gpio-altera-a10sr.c F: drivers/mfd/altera-a10sr.c +F: drivers/misc/altera-a10sr-monitor.c F: include/linux/mfd/altera-a10sr.h ALTERA TRIPLE SPEED ETHERNET DRIVER
drivers/misc/Kconfig +7 -0
@@ -766,6 +766,13 @@ config PANEL_BOOT_MESSAGE An empty message will only clear the display at driver init time. Any other printf()-formatted message is valid with newline and escape codes. +config ALTERA_A10SR_MONITOR + bool "Altera Arria10 System Resource Monitor" + depends on MFD_ALTERA_A10SR + help + This enables the System Resource monitor driver for the Altera + Arria10 DevKit. + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
@@ -43,6 +43,7 @@ obj-y += ti-st/ obj-y += lis3lv02d/ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ +obj-$(CONFIG_ALTERA_A10SR_MONITOR) += altera-a10sr-monitor.o obj-$(CONFIG_INTEL_MEI) += mei/ obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/ obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o
drivers/misc/altera-a10sr-monitor.c new file +175 -0
175 lines not on this page · raw message
Signature · 1 line
1.9.1
Greg KH
maintainerRe: [PATCHv3 2/4] misc: Add Altera Arria10 System Resource Control
Quoted 115 lines · On Wed, Nov 02, 2016 at 09:32:56AM -0500, [email protected] wrote:
From: Thor Thayer <[email protected]>
This patch adds the Altera Arria10 control & monitoring functions to the Arria10 System Resource chip.
Signed-off-by Thor Thayer <[email protected]>---
v2 Change compatible string and filename from -mon to -monitor
Change CONFIG from module to builtin.
Makewm_rstregister writeable.
v3 Remove unused ret variable.
Shorten driver name (removealtr_).--- MAINTAINERS | 1 + drivers/misc/Kconfig | 7 ++ drivers/misc/Makefile | 1 + drivers/misc/altera-a10sr-monitor.c | 175 ++++++++++++++++++++++++++++++++++++ 4 files changed, 184 insertions(+) create mode 100644 drivers/misc/altera-a10sr-monitor.cMAINTAINERS +1
-0@@ -635,6 +635,7 @@ M: Thor Thayer <[email protected]> S: Maintained F: drivers/gpio/gpio-altera-a10sr.c F: drivers/mfd/altera-a10sr.c +F: drivers/misc/altera-a10sr-monitor.c F: include/linux/mfd/altera-a10sr.h ALTERA TRIPLE SPEED ETHERNET DRIVERdrivers/misc/Kconfig +7
-0@@ -766,6 +766,13 @@ config PANEL_BOOT_MESSAGE An empty message will only clear the display at driver init time. Any other printf()-formatted message is valid with newline and escape codes. +config ALTERA_A10SR_MONITOR + bool "Altera Arria10 System Resource Monitor" + depends on MFD_ALTERA_A10SR + help + This enables the System Resource monitor driver for the Altera + Arria10 DevKit. + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"drivers/misc/Makefile +1
-0@@ -43,6 +43,7 @@ obj-y += ti-st/ obj-y += lis3lv02d/ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ +obj-$(CONFIG_ALTERA_A10SR_MONITOR) += altera-a10sr-monitor.o obj-$(CONFIG_INTEL_MEI) += mei/ obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/ obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.odrivers/misc/altera-a10sr-monitor.c new file +47
-0@@ -0,0 +1,175 @@ +/* +* Altera Arria10 DevKit System Resource Chip Monitor Driver +* +* Author: Thor Thayer <[email protected]> +* +* Copyright Intel Corporation (C) 2014-2016. All Rights Reserved +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +* +* Monitor driver for the Altera Arria10 MAX5 System Resource Chip +* Adapted from ics932s401.c +*/ + +#include <linux/err.h> +#include <linux/mfd/altera-a10sr.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + +struct altr_a10sr_regs { +struct regmap *regmap; +struct attribute_group attr_grp; +}; + +static ssize_t a10sr_show (struct device *dev, +struct device_attribute *devattr,char *buf); +static ssize_t a10sr_store (struct device *dev, +struct device_attribute *devattr,const char *buf, +size_t count); + +/* Define FS entries */ +static DEVICE_ATTR(max5_version, 0444, a10sr_show, NULL); +static DEVICE_ATTR(max5_led, 0644, a10sr_show, a10sr_store); +static DEVICE_ATTR(max5_button, 0444, a10sr_show, NULL); +static DEVICE_ATTR(max5_button_irq, 0644, a10sr_show, a10sr_store); +static DEVICE_ATTR(max5_pg1, 0444, a10sr_show, NULL); +static DEVICE_ATTR(max5_pg2, 0444, a10sr_show, NULL);
drivers/misc/altera-a10sr-monitor.c line 57
Quoted 10 lines
drivers/misc/altera-a10sr-monitor.c new file +10
-0+static DEVICE_ATTR(max5_pg3, 0444, a10sr_show, NULL); +static DEVICE_ATTR(max5_fmcab, 0444, a10sr_show, NULL); +static DEVICE_ATTR(max5_hps_resets, 0644, a10sr_show, a10sr_store); +static DEVICE_ATTR(max5_per_resets, 0644, a10sr_show, a10sr_store); +static DEVICE_ATTR(max5_sfpa, 0644, a10sr_show, a10sr_store); +static DEVICE_ATTR(max5_sfpb, 0644, a10sr_show, a10sr_store); +static DEVICE_ATTR(max5_i2c_master, 0644, a10sr_show, a10sr_store); +static DEVICE_ATTR(max5_wm_rst, 0644, a10sr_show, a10sr_store); +static DEVICE_ATTR(max5_wm_rst_key, 0644, a10sr_show, a10sr_store); +static DEVICE_ATTR(max5_pmbus, 0644, a10sr_show, a10sr_store);
Please add a Documentation/ABI file to describe all of thes new sysfs files that you are saying will be present for all of time.
And do you really want userspace access like this to these values? Shouldn't things like the led and button use the proper led and input layers instead?
Quoted 5 lines
drivers/misc/altera-a10sr-monitor.c new file +5
-0+static int altr_a10sr_regs_probe (struct platform_device *pdev) +{ +struct altr_a10sr_regs *a10regs; +struct altr_a10sr *a10sr =dev_get_drvdata (pdev->dev.parent); +
drivers/misc/altera-a10sr-monitor.c line 149
Quoted 10 lines
drivers/misc/altera-a10sr-monitor.c new file +10
-0+ a10regs =devm_kzalloc (&pdev->dev,sizeof (*a10regs),GFP_KERNEL ); +if (!a10regs) +return -ENOMEM ; + + a10regs->regmap = a10sr->regmap; + a10regs->attr_grp = a10sr_attr_group; + +platform_set_drvdata (pdev, a10regs); + +return sysfs_create_group (&pdev->dev.kobj, &a10sr_attr_group);
You just raced userspace and lost :(
Please set the group file properly, and then the driver core should set this up for you correctly.
thanks,
greg k-h
PATCH v3 3/4 mfd: altr-a10sr: Add Arria10 SR Monitor
In reply to [email protected]From: Thor Thayer <[email protected]>
Add the Altera Arria10 DevKit System Resource Monitor functionality to the MFD device.
---
v2 Change from -mon to -monitor for clarity
v3 Shorten driver name (remove altr_).
--- drivers/mfd/altera-a10sr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mfd/altera-a10sr.c +5 -1
@@ -30,9 +30,13 @@static const struct mfd_cell altr_a10sr_subdev_info[] = { { - .name ="altr_a10sr_gpio" , + .name ="a10sr_gpio" , .of_compatible ="altr,a10sr-gpio" , }, + { + .name ="a10sr_monitor" , + .of_compatible ="altr,a10sr-monitor" , + }, };static bool altr_a10sr_reg_readable (struct device *dev,unsigned int reg)
Signature · 1 line
1.9.1
PATCH v3 4/4 ARM: socfpga: dts: Add Monitor to A10-SR MFD
In reply to [email protected]From: Thor Thayer <[email protected]>
Add the Monitor functionality to the Arria10 DevKit System Resource chip.
---
v2 Change from -mon to -monitor for clarity.
v3 Change node name from a10_monitor to monitor.
--- arch/arm/boot/dts/socfpga_arria10_socdk.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/socfpga_arria10_socdk.dtsi +4 -0
@@ -121,6 +121,10 @@ gpio-controller; #gpio-cells = <2>; }; + + monitor { + compatible = "altr,a10sr-monitor"; + }; }; };
Signature · 1 line
1.9.1
Re: [PATCHv3 4/4] ARM: socfpga: dts: Add Monitor to A10-SR MFD
Quoted 19 lines · tthayer at opensource.altera.com
From: Thor Thayer <[email protected]>
Add the Monitor functionality to the Arria10 DevKit System Resource chip.
Signed-off-by Thor Thayer <[email protected]>---
v2 Change from -mon to -monitor for clarity.
v3 Change node name froma10_monitorto monitor.--- arch/arm/boot/dts/socfpga_arria10_socdk.dtsi | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/boot/dts/socfpga_arria10_socdk.dtsi +0
-0
arch/arm/boot/dts/socfpga_arria10_socdk.dtsi line 130
Quoted 10 lines
arch/arm/boot/dts/socfpga_arria10_socdk.dtsi +4
-0@@ -121,6 +121,10 @@ gpio-controller; #gpio-cells = <2>; }; + + monitor { + compatible = "altr,a10sr-monitor"; + }; }; };