Skip to contentSkip to conversation

Add pca9532 platform data for Thecus N2100

PATCH In review Riku Voipio 6 participants 9 messages Apr 29, 2008 – Apr 30, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add pca9532 platform data for Thecus N2100

Thecus N2100 has leds and a buzzer attached to a pca9532 controller. Attach the driver to the i2c bus and define the pca9532 pin coniguration for this platform in n2100_leds.

With this patch, support for N2100 should be complete in mainline Linux.

---
 arch/arm/mach-iop32x/n2100.c |   52 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)
arch/arm/mach-iop32x/n2100.c +52 -0
index bc91d6e..029d234 100644
@@ -17,6 +17,7 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/f75375s.h>
+#include <linux/leds-pca9532.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
@@ -206,6 +207,53 @@ static struct f75375s_platform_data n2100_f75375s = {
 	.pwm_enable = { 0, 0 },
 };
 
+static struct pca9532_platform_data n2100_leds = {
+	.leds = {
+	{	.name = "n2100:red:satafail0",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+	{	.name = "n2100:red:satafail1",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+	{	.name = "n2100:blue:usb",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+	{ 	.type = PCA9532_TYPE_NONE },
+
+	{ 	.type = PCA9532_TYPE_NONE },
+	{ 	.type = PCA9532_TYPE_NONE },
+	{ 	.type = PCA9532_TYPE_NONE },
+	{	.name = "n2100:red:usb",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+
+	{	.type = PCA9532_TYPE_NONE }, /* power OFF gpio */
+	{	.type = PCA9532_TYPE_NONE }, /* reset gpio */
+	{	.type = PCA9532_TYPE_NONE },
+	{	.type = PCA9532_TYPE_NONE },
+
+	{	.type = PCA9532_TYPE_NONE },
+	{	.name = "n2100:orange:system",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+	{	.name = "n2100:red:system",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+	{	.name = "N2100 beeper"  ,
+		.state =  PCA9532_OFF,
+		.type = PCA9532_TYPE_N2100_BEEP,
+	},
+	},
+	.psc = { 0, 0 },
+	.pwm = { 0, 0 },
+};
+
 static struct i2c_board_info __initdata n2100_i2c_devices[] = {
 	{
 		I2C_BOARD_INFO("rtc-rs5c372", 0x32),
@@ -216,6 +264,10 @@ static struct i2c_board_info __initdata n2100_i2c_devices[] = {
 		.type = "f75375",
 		.platform_data = &n2100_f75375s,
 	},
+	{
+		I2C_BOARD_INFO("pca9532", 0x60),
+		.platform_data = &n2100_leds,
+	},
 };
 
 /*
Signature · 5 lines
1.5.4.5


-- 
"rm -rf" only sounds scary if you don't have backups
#1 lore raw
Quoted 11 lines · On Tue, 29 Apr 2008 23:08:53 +0300 Riku Voipio <[email protected]> wrote:

Thecus N2100 has leds and a buzzer attached to a pca9532 controller. Attach the driver to the i2c bus and define the pca9532 pin coniguration for this platform in n2100_leds.

With this patch, support for N2100 should be complete in mainline Linux.

---
 arch/arm/mach-iop32x/n2100.c |   52 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

So I guess this is really a patch for the git-leds tree, even though it affects only arch/arm/...

#2 lore raw
Quoted 10 lines · Andrew Morton
Quoted 7 lines · On Tue, 29 Apr 2008 23:08:53 +0300 Riku Voipio <[email protected]> wrote:

Thecus N2100 has leds and a buzzer attached to a pca9532 controller. Attach the driver to the i2c bus and define the pca9532 pin coniguration for this platform in n2100_leds.

With this patch, support for N2100 should be complete in mainline Linux.

Quoted 7 lines
Quoted 4 lines
---
 arch/arm/mach-iop32x/n2100.c |   52 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

So I guess this is really a patch for the git-leds tree, even though it affects only arch/arm/...

I'll await guidance from Russell about where he wants it to go, I'm fine with git-leds but if he wants to take it through the arm tree I'm ok with that too in which case the ACK above applies.

Cheers,

Richard

#3 lore raw
Quoted 16 lines · Richard Purdie
Quoted 15 lines · Andrew Morton
Quoted 11 lines · On Tue, 29 Apr 2008 23:08:53 +0300 Riku Voipio <[email protected]> wrote:

Thecus N2100 has leds and a buzzer attached to a pca9532 controller. Attach the driver to the i2c bus and define the pca9532 pin coniguration for this platform in n2100_leds.

With this patch, support for N2100 should be complete in mainline Linux.

---
 arch/arm/mach-iop32x/n2100.c |   52 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)
Quoted 8 lines
Quoted 2 lines

So I guess this is really a patch for the git-leds tree, even though it affects only arch/arm/...

I'll await guidance from Russell about where he wants it to go, I'm fine with git-leds but if he wants to take it through the arm tree I'm ok with that too in which case the ACK above applies.

Oh, yet more surprise code apparantly submitted and as yet unreviewd during the merge window! ;(

Looks sane enough.

I don't see it really matters. Note that I'll be sending my final pull for this merge window in about one hours time, and I've just pushed the tree, patches and mboxes out.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#4 lore raw
In reply to Andrew Morton
Quoted 10 lines · Andrew Morton
Quoted 7 lines · On Tue, 29 Apr 2008 23:08:53 +0300 Riku Voipio <[email protected]> wrote:

Thecus N2100 has leds and a buzzer attached to a pca9532 controller. Attach the driver to the i2c bus and define the pca9532 pin coniguration for this platform in n2100_leds.

With this patch, support for N2100 should be complete in mainline Linux.

Quoted 7 lines
Quoted 4 lines
---
 arch/arm/mach-iop32x/n2100.c |   52 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

So I guess this is really a patch for the git-leds tree, even though it affects only arch/arm/...

Since it depends on pca9532-led-driver being added first, I believe it would logistically simpler to get both patches through leds tree.

Signature · 1 line
"rm -rf" only sounds scary if you don't have backups
#5 lore raw
Quoted 2 lines · Riku Voipio

Since it depends on pca9532-led-driver being added first, I believe it would logistically simpler to get both patches through leds tree.

Yes it does, and given that it should go along side the other patch in the same tree. Otherwise we _are_ going to cause compilation damage.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#6 lore raw
Quoted 7 lines · Russell King
Quoted 2 lines · Riku Voipio

Since it depends on pca9532-led-driver being added first, I believe it would logistically simpler to get both patches through leds tree.

Yes it does, and given that it should go along side the other patch in the same tree. Otherwise we _are_ going to cause compilation damage.

Agreed, I'll take them in the LED tree then after I've had a closer look at the driver tomorrow.

The LED tree has already merged for this development cycle though so it will have to be queued for the next one.

Cheers,

Richard

#8 lore raw
In reply to Riku Voipio
Quoted 65 lines · Riku Voipio

Thecus N2100 has leds and a buzzer attached to a pca9532 controller. Attach the driver to the i2c bus and define the pca9532 pin coniguration for this platform in n2100_leds.

With this patch, support for N2100 should be complete in mainline Linux.

---
 arch/arm/mach-iop32x/n2100.c |   52 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)
arch/arm/mach-iop32x/n2100.c +38 -0
index bc91d6e..029d234 100644
@@ -17,6 +17,7 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/f75375s.h>
+#include <linux/leds-pca9532.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
@@ -206,6 +207,53 @@ static struct f75375s_platform_data n2100_f75375s = {
 	.pwm_enable = { 0, 0 },
 };
 
+static struct pca9532_platform_data n2100_leds = {
+	.leds = {
+	{	.name = "n2100:red:satafail0",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+	{	.name = "n2100:red:satafail1",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+	{	.name = "n2100:blue:usb",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+	{ 	.type = PCA9532_TYPE_NONE },
+
+	{ 	.type = PCA9532_TYPE_NONE },
+	{ 	.type = PCA9532_TYPE_NONE },
+	{ 	.type = PCA9532_TYPE_NONE },
+	{	.name = "n2100:red:usb",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+
+	{	.type = PCA9532_TYPE_NONE }, /* power OFF gpio */
+	{	.type = PCA9532_TYPE_NONE }, /* reset gpio */
+	{	.type = PCA9532_TYPE_NONE },
+	{	.type = PCA9532_TYPE_NONE },
+
+	{	.type = PCA9532_TYPE_NONE },
+	{	.name = "n2100:orange:system",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,
+	},
+	{	.name = "n2100:red:system",
+		.state = PCA9532_OFF,
+		.type = PCA9532_TYPE_LED,

arch/arm/mach-iop32x/n2100.c static struct f75375s_platform_data n2100_f75375s = { · line 256

Quoted 10 lines
arch/arm/mach-iop32x/n2100.c +10 -0
+	},
+	{	.name = "N2100 beeper"  ,
+		.state =  PCA9532_OFF,
+		.type = PCA9532_TYPE_N2100_BEEP,
+	},
+	},
+	.psc = { 0, 0 },
+	.pwm = { 0, 0 },
+};
+

This .leds field looks like an array where an item's position is significant. If this is the case, initialisers should use the "[N] = { ... }," notation, IMO.

Also, intendation in the .leds initialiser is wrong.

Apart from that, thank you for completing the n2100 hw support.

/Mikael