linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series
@ 2010-07-23 17:17 Vasily Khoruzhick
  2010-07-23 17:17 ` [PATCH v6 1/2] rx1950: add battery device Vasily Khoruzhick
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-07-23 17:17 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series adds more support for iPAQ rx1950 PDA to linux:
1. LEDs driver -- it controls blue, green and red LEDs on rx1950
2. Battery driver -- adds ability to monitor and charge battery.
This driver is suitable for H1940 PDA aswell (just need to write
some machine specific callbacks and get voltage LUTs)

v2: removed ac registration from s3c_adc_battery driver, use
pda_power instead for ac support

v3: split LEDs patch to driver and machine parts,
split battery patch into battery + LED trigger parts,
now battery driver can skip gpio/callbacks usage
(if there's no gpio pin to determine that battery is
full or if charger is enabled automatically)

v4: add .blink_set callback to LEDs driver instead of
using LED_HALF value for blinking, remove LED triggers
from battery driver completely (for now)

v5: restore lut_acin usage in s3c_adc_battery driver,
it was accidently removed during removing AC support
from driver

v6: drop rx1950-specific LEDs driver, use leds-gpio instead,
skip s3c-adc-battery patch, as it's already merged into battery-2.6
tree

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v6 1/2] rx1950: add battery device
  2010-07-23 17:17 [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series Vasily Khoruzhick
@ 2010-07-23 17:17 ` Vasily Khoruzhick
  2010-07-23 17:17 ` [PATCH v6 2/2] rx1950: add LEDs support Vasily Khoruzhick
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-07-23 17:17 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 arch/arm/mach-s3c2440/Kconfig       |    3 +
 arch/arm/mach-s3c2440/mach-rx1950.c |  160 +++++++++++++++++++++++++++++++++++
 2 files changed, 163 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index cd8e7de..9b6b026 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -198,6 +198,9 @@ config MACH_RX1950
 	select S3C_DEV_NAND
 	select S3C2410_IOTIMING if S3C2440_CPUFREQ
 	select S3C2440_XTAL_16934400
+	select S3C_ADC
+	select PDA_POWER
+	select BATTERY_S3C_ADC
 	help
 	   Say Y here if you're using HP iPAQ rx1950
 
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index 8603b57..1ccb1ae 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -24,8 +24,10 @@
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
 #include <linux/sysdev.h>
+#include <linux/pda_power.h>
 #include <linux/pwm_backlight.h>
 #include <linux/pwm.h>
+#include <linux/s3c_adc_battery.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -126,6 +128,162 @@ static struct s3c2410fb_display rx1950_display = {
 
 };
 
+static int power_supply_init(struct device *dev)
+{
+	return gpio_request(S3C2410_GPF(2), "cable plugged");
+}
+
+static int rx1950_is_ac_online(void)
+{
+	return !gpio_get_value(S3C2410_GPF(2));
+}
+
+static void power_supply_exit(struct device *dev)
+{
+	gpio_free(S3C2410_GPF(2));
+}
+
+static char *rx1950_supplicants[] = {
+	"main-battery"
+};
+
+static struct pda_power_pdata power_supply_info = {
+	.init				= power_supply_init,
+	.is_ac_online		= rx1950_is_ac_online,
+	.exit				= power_supply_exit,
+	.supplied_to		= rx1950_supplicants,
+	.num_supplicants	= ARRAY_SIZE(rx1950_supplicants),
+};
+
+static struct resource power_supply_resources[] = {
+	[0] = {
+			.name	= "ac",
+			.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE |
+					  IORESOURCE_IRQ_HIGHEDGE,
+			.start	= IRQ_EINT2,
+			.end	= IRQ_EINT2,
+	},
+};
+
+static struct platform_device power_supply = {
+	.name			= "pda-power",
+	.id				= -1,
+	.dev			= {
+						.platform_data =
+							&power_supply_info,
+	},
+	.resource		= power_supply_resources,
+	.num_resources	= ARRAY_SIZE(power_supply_resources),
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
+	{4100, 156, 100},
+	{4050, 156, 95},
+	{4025, 141, 90},
+	{3995, 144, 85},
+	{3957, 162, 80},
+	{3931, 147, 75},
+	{3902, 147, 70},
+	{3863, 153, 65},
+	{3838, 150, 60},
+	{3800, 153, 55},
+	{3765, 153, 50},
+	{3748, 172, 45},
+	{3740, 153, 40},
+	{3714, 175, 35},
+	{3710, 156, 30},
+	{3963, 156, 25},
+	{3672, 178, 20},
+	{3651, 178, 15},
+	{3629, 178, 10},
+	{3612, 162, 5},
+	{3605, 162, 0},
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
+	{4200, 0, 100},
+	{4190, 0, 99},
+	{4178, 0, 95},
+	{4110, 0, 70},
+	{4076, 0, 65},
+	{4046, 0, 60},
+	{4021, 0, 55},
+	{3999, 0, 50},
+	{3982, 0, 45},
+	{3965, 0, 40},
+	{3957, 0, 35},
+	{3948, 0, 30},
+	{3936, 0, 25},
+	{3927, 0, 20},
+	{3906, 0, 15},
+	{3880, 0, 10},
+	{3829, 0, 5},
+	{3820, 0, 0},
+};
+
+int rx1950_bat_init(void)
+{
+	int ret;
+
+	ret = gpio_request(S3C2410_GPJ(2), "rx1950-charger-enable-1");
+	if (ret)
+		goto err_gpio1;
+	ret = gpio_request(S3C2410_GPJ(3), "rx1950-charger-enable-2");
+	if (ret)
+		goto err_gpio2;
+
+	return 0;
+
+err_gpio2:
+	gpio_free(S3C2410_GPJ(2));
+err_gpio1:
+	return ret;
+}
+
+void rx1950_bat_exit(void)
+{
+	gpio_free(S3C2410_GPJ(2));
+	gpio_free(S3C2410_GPJ(3));
+}
+
+void rx1950_enable_charger(void)
+{
+	gpio_direction_output(S3C2410_GPJ(2), 1);
+	gpio_direction_output(S3C2410_GPJ(3), 1);
+}
+
+void rx1950_disable_charger(void)
+{
+	gpio_direction_output(S3C2410_GPJ(2), 0);
+	gpio_direction_output(S3C2410_GPJ(3), 0);
+}
+
+static struct s3c_adc_bat_pdata rx1950_bat_cfg = {
+	.init = rx1950_bat_init,
+	.exit = rx1950_bat_exit,
+	.enable_charger = rx1950_enable_charger,
+	.disable_charger = rx1950_disable_charger,
+	.gpio_charge_finished = S3C2410_GPF(3),
+	.lut_noac = bat_lut_noac,
+	.lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
+	.lut_acin = bat_lut_acin,
+	.lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
+	.volt_channel = 0,
+	.current_channel = 1,
+	.volt_mult = 4235,
+	.current_mult = 2900,
+	.internal_impedance = 200,
+};
+
+static struct platform_device rx1950_battery = {
+	.name             = "s3c-adc-battery",
+	.id               = -1,
+	.dev = {
+		.parent = &s3c_device_adc.dev,
+		.platform_data = &rx1950_bat_cfg,
+	},
+};
+
 static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
 	.displays = &rx1950_display,
 	.num_displays = 1,
@@ -502,6 +660,8 @@ static struct platform_device *rx1950_devices[] __initdata = {
 	&s3c_device_timer[1],
 	&rx1950_backlight,
 	&rx1950_device_gpiokeys,
+	&power_supply,
+	&rx1950_battery,
 };
 
 static struct clk *rx1950_clocks[] __initdata = {
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v6 2/2] rx1950: add LEDs support
  2010-07-23 17:17 [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series Vasily Khoruzhick
  2010-07-23 17:17 ` [PATCH v6 1/2] rx1950: add battery device Vasily Khoruzhick
@ 2010-07-23 17:17 ` Vasily Khoruzhick
  2010-07-26  7:46 ` [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series Vasily Khoruzhick
  2010-07-28  9:17 ` Vasily Khoruzhick
  3 siblings, 0 replies; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-07-23 17:17 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 arch/arm/mach-s3c2440/mach-rx1950.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index 1ccb1ae..8c24869 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -28,6 +28,7 @@
 #include <linux/pwm_backlight.h>
 #include <linux/pwm.h>
 #include <linux/s3c_adc_battery.h>
+#include <linux/leds.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -258,6 +259,37 @@ void rx1950_disable_charger(void)
 	gpio_direction_output(S3C2410_GPJ(3), 0);
 }
 
+static struct gpio_led rx1950_leds_desc[] = {
+	{
+		.name				= "Green",
+		.default_trigger	= "main-battery-charging-or-full",
+		.gpio				= S3C2410_GPA(6),
+	},
+	{
+		.name				= "Red",
+		.default_trigger	= "main-battery-full",
+		.gpio				= S3C2410_GPA(7),
+	},
+	{
+		.name				= "Blue",
+		.default_trigger	= "rx1950-acx-mem",
+		.gpio				= S3C2410_GPA(11),
+	},
+};
+
+static struct gpio_led_platform_data rx1950_leds_pdata = {
+	.num_leds	= ARRAY_SIZE(rx1950_leds_desc),
+	.leds		= rx1950_leds_desc,
+};
+
+static struct platform_device rx1950_leds = {
+	.name	= "leds-gpio",
+	.id		= -1,
+	.dev	= {
+				.platform_data = &rx1950_leds_pdata,
+	},
+};
+
 static struct s3c_adc_bat_pdata rx1950_bat_cfg = {
 	.init = rx1950_bat_init,
 	.exit = rx1950_bat_exit,
@@ -662,6 +694,7 @@ static struct platform_device *rx1950_devices[] __initdata = {
 	&rx1950_device_gpiokeys,
 	&power_supply,
 	&rx1950_battery,
+	&rx1950_leds,
 };
 
 static struct clk *rx1950_clocks[] __initdata = {
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series
  2010-07-23 17:17 [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series Vasily Khoruzhick
  2010-07-23 17:17 ` [PATCH v6 1/2] rx1950: add battery device Vasily Khoruzhick
  2010-07-23 17:17 ` [PATCH v6 2/2] rx1950: add LEDs support Vasily Khoruzhick
@ 2010-07-26  7:46 ` Vasily Khoruzhick
  2010-08-18 16:43   ` Vasily Khoruzhick
  2010-07-28  9:17 ` Vasily Khoruzhick
  3 siblings, 1 reply; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-07-26  7:46 UTC (permalink / raw)
  To: linux-arm-kernel

? ????????? ?? 23 ???? 2010 20:17:50 ????? Vasily Khoruzhick ???????:
> This patch series adds more support for iPAQ rx1950 PDA to linux:

Hi, Ben

Please, if it's possible, review this patch series this week. I want this 
series to be ready for 2.6.36, but next week I'm going on vacation and will be 
offline from 2 aug till 18 aug.

s3c-adc-battery patch from v5 was merged into battery-2.6 tree and so it's 
skipped in v6 series, so send comments for battery driver for v5 3/4 patch.

Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100726/0b588fa9/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series
  2010-07-23 17:17 [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series Vasily Khoruzhick
                   ` (2 preceding siblings ...)
  2010-07-26  7:46 ` [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series Vasily Khoruzhick
@ 2010-07-28  9:17 ` Vasily Khoruzhick
  2010-07-30 12:58   ` Vasily Khoruzhick
  3 siblings, 1 reply; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-07-28  9:17 UTC (permalink / raw)
  To: linux-arm-kernel

? ????????? ?? 23 ???? 2010 20:17:50 ????? Vasily Khoruzhick ???????:
> This patch series adds more support for iPAQ rx1950 PDA to linux:
> 1. LEDs driver -- it controls blue, green and red LEDs on rx1950
> 2. Battery driver -- adds ability to monitor and charge battery.
> This driver is suitable for H1940 PDA aswell (just need to write
> some machine specific callbacks and get voltage LUTs)
> 
> v2: removed ac registration from s3c_adc_battery driver, use
> pda_power instead for ac support
> 
> v3: split LEDs patch to driver and machine parts,
> split battery patch into battery + LED trigger parts,
> now battery driver can skip gpio/callbacks usage
> (if there's no gpio pin to determine that battery is
> full or if charger is enabled automatically)
> 
> v4: add .blink_set callback to LEDs driver instead of
> using LED_HALF value for blinking, remove LED triggers
> from battery driver completely (for now)
> 
> v5: restore lut_acin usage in s3c_adc_battery driver,
> it was accidently removed during removing AC support
> from driver
> 
> v6: drop rx1950-specific LEDs driver, use leds-gpio instead,
> skip s3c-adc-battery patch, as it's already merged into battery-2.6
> tree

Ping
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100728/4c75bf60/attachment.sig>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series
  2010-07-28  9:17 ` Vasily Khoruzhick
@ 2010-07-30 12:58   ` Vasily Khoruzhick
  0 siblings, 0 replies; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-07-30 12:58 UTC (permalink / raw)
  To: linux-arm-kernel

? ????????? ?? 28 ???? 2010 12:17:21 ????? Vasily Khoruzhick ???????:
> ? ????????? ?? 23 ???? 2010 20:17:50 ????? Vasily Khoruzhick ???????:
> > This patch series adds more support for iPAQ rx1950 PDA to linux:
> > 1. LEDs driver -- it controls blue, green and red LEDs on rx1950
> > 2. Battery driver -- adds ability to monitor and charge battery.
> > This driver is suitable for H1940 PDA aswell (just need to write
> > some machine specific callbacks and get voltage LUTs)
> > 
> > v2: removed ac registration from s3c_adc_battery driver, use
> > pda_power instead for ac support
> > 
> > v3: split LEDs patch to driver and machine parts,
> > split battery patch into battery + LED trigger parts,
> > now battery driver can skip gpio/callbacks usage
> > (if there's no gpio pin to determine that battery is
> > full or if charger is enabled automatically)
> > 
> > v4: add .blink_set callback to LEDs driver instead of
> > using LED_HALF value for blinking, remove LED triggers
> > from battery driver completely (for now)
> > 
> > v5: restore lut_acin usage in s3c_adc_battery driver,
> > it was accidently removed during removing AC support
> > from driver
> > 
> > v6: drop rx1950-specific LEDs driver, use leds-gpio instead,
> > skip s3c-adc-battery patch, as it's already merged into battery-2.6
> > tree
> 
> Ping

And last ping, as I'm leaving on vacation on 2nd August :)

Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100730/94da45ba/attachment.sig>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series
  2010-07-26  7:46 ` [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series Vasily Khoruzhick
@ 2010-08-18 16:43   ` Vasily Khoruzhick
  0 siblings, 0 replies; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-08-18 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

? ????????? ?? 26 ???? 2010 10:46:17 ????? Vasily Khoruzhick ???????:
> Hi, Ben
> 
> Please, if it's possible, review this patch series this week. I want this
> series to be ready for 2.6.36, but next week I'm going on vacation and will
> be offline from 2 aug till 18 aug.
> 
> s3c-adc-battery patch from v5 was merged into battery-2.6 tree and so it's
> skipped in v6 series, so send comments for battery driver for v5 3/4 patch.
> 
> Regards
> Vasily

Hi, Ben

Is there anything wrong with this series? I got no comments from you on this 
series for a long time.

Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100818/646c5982/attachment.sig>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-08-18 16:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-23 17:17 [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series Vasily Khoruzhick
2010-07-23 17:17 ` [PATCH v6 1/2] rx1950: add battery device Vasily Khoruzhick
2010-07-23 17:17 ` [PATCH v6 2/2] rx1950: add LEDs support Vasily Khoruzhick
2010-07-26  7:46 ` [PATCH v6 0/2] s3c24xx: iPAQ rx1950 series Vasily Khoruzhick
2010-08-18 16:43   ` Vasily Khoruzhick
2010-07-28  9:17 ` Vasily Khoruzhick
2010-07-30 12:58   ` Vasily Khoruzhick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).