Skip to contentSkip to conversation

add Advantech acpi6 hard disk swap button driver

PATCH In review Tommy Lo 2 participants 2 messages Sep 7, 2016 – Sep 8, 2016 Char and misc drivers

lore
Share & tools
lore

Tommy Lo

author
#0 lore raw

PATCH 1/1 add Advantech acpi6 hard disk swap button driver

Dear Maintainer,
This is writing from Advantech , an IPC/Server manufacturer locates in Taiwan. We would like to upstream a hard disk hot swap button driver for Advantech compactPCI products.
The source code is in the appended document and more precise information is listed as the following. Thanks!

Information:
ACPI6-B provide hot-plug button for each SAS HDD, and interrupt (IRQ5) is generated when pressing button or plugging hard disk. The module catches IRQ5, then raises signal to user space application after checking corresponding status register. It also provides ioctl method which response to CPLD to notify LED on/off . The module is developed by Advantech, and follows the Linux code style guidelines to ensure that there aren't any sparse or compile warnings.

---
 drivers/char/Kconfig      |   9 +
 drivers/char/Makefile     |   2 +
 drivers/char/hdd_hp_btn.c | 596 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/char/hdd_hp_btn.h |  21 ++
 4 files changed, 628 insertions(+)
 create mode 100644 drivers/char/hdd_hp_btn.c
 create mode 100644 drivers/char/hdd_hp_btn.h
drivers/char/Kconfig +9 -0
index dcc0973..3b13adc 100644
@@ -590,5 +590,14 @@ config TILE_SROM
 
 source "drivers/char/xillybus/Kconfig"
 
+config HDD_HP_BTN
+	tristate "Advantech ACPI6 hard disk hot swap button driver"
+	default n
+	help
+	  This driver enables the support for the hard disk hot swap button driver.
+	  ACPI6-B provide hot-plug buttons for each SAS HDD, and an interrupt (IRQ5) is generated when pressing button.
+	  The module catches IRQ5,then raises signal to user space application after checking corresponding status register to get HDD status. 
+	  It also provides ioctl method which response to CPLD to notify LED on/off.
+
 endmenu
 
drivers/char/Makefile +2 -0
index 6e6c244..f3f21de 100644
@@ -60,3 +60,5 @@ js-rtc-y = rtc.o
 obj-$(CONFIG_TILE_SROM)		+= tile-srom.o
 obj-$(CONFIG_XILLYBUS)		+= xillybus/
 obj-$(CONFIG_POWERNV_OP_PANEL)	+= powernv-op-panel.o
+
+obj-$(CONFIG_HDD_HP_BTN)	+= hdd_hp_btn.o
drivers/char/hdd_hp_btn.c new file +596 -0

596 lines not on this page · raw message

drivers/char/hdd_hp_btn.h new file +21 -0
new file mode 100644
index 0000000..3f6b215
@@ -0,0 +1,21 @@
+//signal
+#define HDD_SWAP_SIG 44
+#define SIG_BUTTON1_INVOKE  0x01
+#define SIG_BUTTON2_INVOKE  0x02
+#define SIG_HDD1_INSERT 0x03
+#define SIG_HDD2_INSERT 0x04
+
+//IOCTL
+struct ioctl_cmd
+{
+    unsigned int reg;
+    unsigned int offset;
+    unsigned int val;
+};
+
+#define IOC_MAGIC 'd'
+#define IOCTL_LED_ON _IOW(IOC_MAGIC, 1 , struct ioctl_cmd)
+#define IOCTL_LED_OFF _IOW(IOC_MAGIC, 2 ,struct ioctl_cmd)
+
+#define true 1
+#define false 0
\ No newline at end of file
Signature · 1 line
2.5.5
maintainer
#1 lore raw
Quoted 8 lines · Tommy Lo

Dear Maintainer,
This is writing from Advantech , an IPC/Server manufacturer locates in Taiwan. We would like to upstream a hard disk hot swap button driver for Advantech compactPCI products.
The source code is in the appended document and more precise information is listed as the following. Thanks!

Information:
ACPI6-B provide hot-plug button for each SAS HDD, and interrupt (IRQ5) is generated when pressing button or plugging hard disk. The module catches IRQ5, then raises signal to user space application after checking corresponding status register. It also provides ioctl method which response to CPLD to notify LED on/off . The module is developed by Advantech, and follows the Linux code style guidelines to ensure that there aren't any sparse or compile warnings.

Thanks for the patch, but can you resend it with a Signed-off-by: line, as described by Documentation/SubmittingPatches? We need that before we can take anything.

Also, you should run the code through scripts/checkpatch.pl and fix up the errors it finds. There are still a number of basic coding style fixes that need to be done.

And finally, this code really should tie the LED interaction into the LED kernel subsystem, so that you do not need a custom userspace program to handle ioctls just for LED control. Do you need help in making those changes?

thanks,

greg k-h