* [patch 0/4] [RFC] h1940 updates
@ 2009-11-17 13:54 arnaud.patard
2009-11-17 13:54 ` [patch 1/4] h1940: add mmc device arnaud.patard
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: arnaud.patard @ 2009-11-17 13:54 UTC (permalink / raw)
To: ben-linux; +Cc: linux-samsung-soc
Hi,
This patchset gives an update to h1940 support. It contains:
- add mmc host device
- add rtc device
- add a lcd and backlight devices using platform-lcd and pwm-backlight
- converts the bluetooth support to use the rfkill framework
This has been tested on a 2.6.31 and build tested on your next-s3c24xx-dev-updates branch.
Please, also note that I'm not really good at giving patch descriptions so feel
free to correct them if needed.
Thanks,
Arnaud
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 1/4] h1940: add mmc device
2009-11-17 13:54 [patch 0/4] [RFC] h1940 updates arnaud.patard
@ 2009-11-17 13:54 ` arnaud.patard
2009-11-17 13:54 ` [patch 2/4] h1940: enable rtc arnaud.patard
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: arnaud.patard @ 2009-11-17 13:54 UTC (permalink / raw)
To: ben-linux; +Cc: linux-samsung-soc, Arnaud Patard
Hi,
Content-Disposition: inline; filename=h1940_add_mmc.patch
This patch add mmc host support to h1940
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
---
arch/arm/mach-s3c2410/mach-h1940.c | 19 18 + 1 - 0 !
1 file changed, 18 insertions(+), 1 deletion(-)
Index: linux/arch/arm/mach-s3c2410/mach-h1940.c
===================================================================
--- linux.orig/arch/arm/mach-s3c2410/mach-h1940.c 2009-11-17 13:59:06.000000000 +0100
+++ linux/arch/arm/mach-s3c2410/mach-h1940.c 2009-11-17 14:04:21.000000000 +0100
@@ -21,6 +21,9 @@
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <linux/io.h>
+#include <linux/gpio.h>
+
+#include <linux/mmc/host.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -32,9 +35,12 @@
#include <plat/regs-serial.h>
#include <mach/regs-lcd.h>
-#include <mach/regs-gpio.h>
#include <mach/regs-clock.h>
+#include <mach/regs-gpio.h>
+#include <mach/gpio-fns.h>
+#include <mach/gpio-nrs.h>
+
#include <mach/h1940.h>
#include <mach/h1940-latch.h>
#include <mach/fb.h>
@@ -46,6 +52,7 @@
#include <plat/cpu.h>
#include <plat/pll.h>
#include <plat/pm.h>
+#include <plat/mci.h>
static struct map_desc h1940_iodesc[] __initdata = {
[0] = {
@@ -181,6 +188,13 @@ static struct platform_device h1940_devi
.id = -1,
};
+static struct s3c24xx_mci_pdata h1940_mmc_cfg = {
+ .gpio_detect = S3C2410_GPF(5),
+ .gpio_wprotect = S3C2410_GPH(8),
+ .set_power = NULL,
+ .ocr_avail = MMC_VDD_32_33,
+};
+
static struct platform_device *h1940_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
@@ -190,6 +204,7 @@ static struct platform_device *h1940_dev
&s3c_device_usbgadget,
&h1940_device_leds,
&h1940_device_bluetooth,
+ &s3c_device_sdi,
};
static void __init h1940_map_io(void)
@@ -219,6 +234,8 @@ static void __init h1940_init(void)
s3c24xx_udc_set_platdata(&h1940_udc_cfg);
s3c_i2c0_set_platdata(NULL);
+ s3c_device_sdi.dev.platform_data = &h1940_mmc_cfg;
+
/* Turn off suspend on both USB ports, and switch the
* selectable USB port to USB device mode. */
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 2/4] h1940: enable rtc
2009-11-17 13:54 [patch 0/4] [RFC] h1940 updates arnaud.patard
2009-11-17 13:54 ` [patch 1/4] h1940: add mmc device arnaud.patard
@ 2009-11-17 13:54 ` arnaud.patard
2009-11-17 13:54 ` [patch 3/4] h1940: add lcd/backlight device definition arnaud.patard
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: arnaud.patard @ 2009-11-17 13:54 UTC (permalink / raw)
To: ben-linux; +Cc: linux-samsung-soc, Arnaud Patard
Hi,
Content-Disposition: inline; filename=rtc.patch
Enable 2410 rtc on h1940
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
---
arch/arm/mach-s3c2410/mach-h1940.c | 1 1 + 0 - 0 !
1 file changed, 1 insertion(+)
Index: linux/arch/arm/mach-s3c2410/mach-h1940.c
===================================================================
--- linux.orig/arch/arm/mach-s3c2410/mach-h1940.c 2009-11-17 14:04:21.000000000 +0100
+++ linux/arch/arm/mach-s3c2410/mach-h1940.c 2009-11-17 14:06:06.000000000 +0100
@@ -205,6 +205,7 @@ static struct platform_device *h1940_dev
&h1940_device_leds,
&h1940_device_bluetooth,
&s3c_device_sdi,
+ &s3c_device_rtc,
};
static void __init h1940_map_io(void)
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 3/4] h1940: add lcd/backlight device definition
2009-11-17 13:54 [patch 0/4] [RFC] h1940 updates arnaud.patard
2009-11-17 13:54 ` [patch 1/4] h1940: add mmc device arnaud.patard
2009-11-17 13:54 ` [patch 2/4] h1940: enable rtc arnaud.patard
@ 2009-11-17 13:54 ` arnaud.patard
2009-11-17 13:54 ` [patch 4/4] Convert h1940 bluetooth driver to rfkill arnaud.patard
2009-11-18 0:13 ` [patch 0/4] [RFC] h1940 updates Ben Dooks
4 siblings, 0 replies; 6+ messages in thread
From: arnaud.patard @ 2009-11-17 13:54 UTC (permalink / raw)
To: ben-linux; +Cc: linux-samsung-soc, Arnaud Patard
Hi,
Content-Disposition: inline; filename=h1940_lcd_backlight.patch
Add lcd and backlight device definition. The pwm backlight stuff does not allow to really
set maximum pwm as with my custom driver but it's better to use standard driver instead of
out of tree driver.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
---
arch/arm/mach-s3c2410/mach-h1940.c | 77 77 + 0 - 0 !
1 file changed, 77 insertions(+)
Index: linux/arch/arm/mach-s3c2410/mach-h1940.c
===================================================================
--- linux.orig/arch/arm/mach-s3c2410/mach-h1940.c 2009-11-17 14:06:06.000000000 +0100
+++ linux/arch/arm/mach-s3c2410/mach-h1940.c 2009-11-17 14:08:09.000000000 +0100
@@ -22,6 +22,8 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/gpio.h>
+#include <linux/pwm_backlight.h>
+#include <video/platform_lcd.h>
#include <linux/mmc/host.h>
@@ -195,6 +197,73 @@ static struct s3c24xx_mci_pdata h1940_mm
.ocr_avail = MMC_VDD_32_33,
};
+static int h1940_backlight_init(struct device *dev)
+{
+ gpio_request(S3C2410_GPB(0), "Backlight");
+
+ s3c2410_gpio_setpin(S3C2410_GPB(0), 0);
+ s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
+ s3c2410_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+
+ return 0;
+}
+
+static void h1940_backlight_exit(struct device *dev)
+{
+ s3c2410_gpio_cfgpin(S3C2410_GPB(0), 1/*S3C2410_GPB0_OUTP*/);
+}
+
+static struct platform_pwm_backlight_data backlight_data = {
+ .pwm_id = 0,
+ .max_brightness = 100,
+ .dft_brightness = 50,
+ /* tcnt = 0x31 */
+ .pwm_period_ns = 36296,
+ .init = h1940_backlight_init,
+ .exit = h1940_backlight_exit,
+};
+
+static struct platform_device h1940_backlight = {
+ .name = "pwm-backlight",
+ .dev = {
+ .parent = &s3c_device_timer[0].dev,
+ .platform_data = &backlight_data,
+ },
+ .id = -1,
+};
+
+static void h1940_lcd_power_set(struct plat_lcd_data *pd,
+ unsigned int power)
+{
+ int value;
+
+ if (!power) {
+ /* set to 3ec */
+ s3c2410_gpio_setpin(S3C2410_GPC(0), 0);
+ /* wait for 3ac */
+ do {
+ value = s3c2410_gpio_getpin(S3C2410_GPC(6));
+ } while (value);
+ /* set to 38c */
+ s3c2410_gpio_setpin(S3C2410_GPC(5), 0);
+ } else {
+ /* Set to 3ac */
+ s3c2410_gpio_setpin(S3C2410_GPC(5), 1);
+ /* Set to 3ad */
+ s3c2410_gpio_setpin(S3C2410_GPC(0), 1);
+ }
+}
+
+static struct plat_lcd_data h1940_lcd_power_data = {
+ .set_power = h1940_lcd_power_set,
+};
+
+static struct platform_device h1940_lcd_powerdev = {
+ .name = "platform-lcd",
+ .dev.parent = &s3c_device_lcd.dev,
+ .dev.platform_data = &h1940_lcd_power_data,
+};
+
static struct platform_device *h1940_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
@@ -206,6 +275,9 @@ static struct platform_device *h1940_dev
&h1940_device_bluetooth,
&s3c_device_sdi,
&s3c_device_rtc,
+ &s3c_device_timer[0],
+ &h1940_backlight,
+ &h1940_lcd_powerdev,
};
static void __init h1940_map_io(void)
@@ -249,6 +321,11 @@ static void __init h1940_init(void)
| (0x03 << S3C24XX_PLLCON_SDIVSHIFT);
writel(tmp, S3C2410_UPLLCON);
+ gpio_request(S3C2410_GPC(0), "LCD power");
+ gpio_request(S3C2410_GPC(5), "LCD power");
+ gpio_request(S3C2410_GPC(6), "LCD power");
+
+
platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
}
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 4/4] Convert h1940 bluetooth driver to rfkill
2009-11-17 13:54 [patch 0/4] [RFC] h1940 updates arnaud.patard
` (2 preceding siblings ...)
2009-11-17 13:54 ` [patch 3/4] h1940: add lcd/backlight device definition arnaud.patard
@ 2009-11-17 13:54 ` arnaud.patard
2009-11-18 0:13 ` [patch 0/4] [RFC] h1940 updates Ben Dooks
4 siblings, 0 replies; 6+ messages in thread
From: arnaud.patard @ 2009-11-17 13:54 UTC (permalink / raw)
To: ben-linux; +Cc: linux-samsung-soc, Arnaud Patard
Hi,
Content-Disposition: inline; filename=h1940bt_rfkill.patch
Better using standard interfaces to enable/disable bluetooth
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
---
arch/arm/mach-s3c2410/Kconfig | 8 8 + 0 - 0 !
arch/arm/mach-s3c2410/Makefile | 3 2 + 1 - 0 !
arch/arm/mach-s3c2410/h1940-bluetooth.c | 88 42 + 46 - 0 !
3 files changed, 52 insertions(+), 47 deletions(-)
Index: linux/arch/arm/mach-s3c2410/Kconfig
===================================================================
--- linux.orig/arch/arm/mach-s3c2410/Kconfig 2009-11-17 12:28:19.000000000 +0100
+++ linux/arch/arm/mach-s3c2410/Kconfig 2009-11-17 14:09:12.000000000 +0100
@@ -81,6 +81,14 @@ config ARCH_H1940
help
Say Y here if you are using the HP IPAQ H1940
+config H1940BT
+ tristate "Control the state of H1940 bluetooth chip"
+ depends on ARCH_H1940
+ select RFKILL
+ help
+ This is a simple driver that is able to control
+ the state of built in bluetooth chip on h1940.
+
config PM_H1940
bool
help
Index: linux/arch/arm/mach-s3c2410/Makefile
===================================================================
--- linux.orig/arch/arm/mach-s3c2410/Makefile 2009-11-17 11:54:19.000000000 +0100
+++ linux/arch/arm/mach-s3c2410/Makefile 2009-11-17 14:09:42.000000000 +0100
@@ -21,7 +21,8 @@ obj-$(CONFIG_S3C2410_PLLTABLE) += pll.o
# Machine support
obj-$(CONFIG_ARCH_SMDK2410) += mach-smdk2410.o
-obj-$(CONFIG_ARCH_H1940) += mach-h1940.o h1940-bluetooth.o
+obj-$(CONFIG_ARCH_H1940) += mach-h1940.o
+obj-$(CONFIG_H1940BT) += h1940-bluetooth.o
obj-$(CONFIG_PM_H1940) += pm-h1940.o
obj-$(CONFIG_MACH_N30) += mach-n30.o
obj-$(CONFIG_ARCH_BAST) += mach-bast.o usb-simtec.o
Index: linux/arch/arm/mach-s3c2410/h1940-bluetooth.c
===================================================================
--- linux.orig/arch/arm/mach-s3c2410/h1940-bluetooth.c 2009-11-17 11:54:19.000000000 +0100
+++ linux/arch/arm/mach-s3c2410/h1940-bluetooth.c 2009-11-17 14:09:12.000000000 +0100
@@ -17,6 +17,7 @@
#include <linux/ctype.h>
#include <linux/leds.h>
#include <linux/gpio.h>
+#include <linux/rfkill.h>
#include <mach/regs-gpio.h>
#include <mach/hardware.h>
@@ -24,21 +25,10 @@
#define DRV_NAME "h1940-bt"
-#ifdef CONFIG_LEDS_H1940
-DEFINE_LED_TRIGGER(bt_led_trigger);
-#endif
-
-static int state;
-
/* Bluetooth control */
static void h1940bt_enable(int on)
{
if (on) {
-#ifdef CONFIG_LEDS_H1940
- /* flashing Blue */
- led_trigger_event(bt_led_trigger, LED_HALF);
-#endif
-
/* Power on the chip */
h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER);
/* Reset the chip */
@@ -46,48 +36,31 @@ static void h1940bt_enable(int on)
s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
mdelay(10);
s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
-
- state = 1;
}
else {
-#ifdef CONFIG_LEDS_H1940
- led_trigger_event(bt_led_trigger, 0);
-#endif
-
s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
mdelay(10);
s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
mdelay(10);
h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0);
-
- state = 0;
}
}
-static ssize_t h1940bt_show(struct device *dev, struct device_attribute *attr, char *buf)
+static int h1940bt_set_block(void *data, bool blocked)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", state);
+ h1940bt_enable(!blocked);
+ return 0;
}
-static ssize_t h1940bt_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
-{
- int new_state;
- char *endp;
-
- new_state = simple_strtoul(buf, &endp, 0);
- if (*endp && !isspace(*endp))
- return -EINVAL;
-
- h1940bt_enable(new_state);
-
- return count;
-}
-static DEVICE_ATTR(enable, 0644,
- h1940bt_show,
- h1940bt_store);
+static const struct rfkill_ops h1940bt_rfkill_ops = {
+ .set_block = h1940bt_set_block,
+};
static int __init h1940bt_probe(struct platform_device *pdev)
{
+ struct rfkill *rfk;
+ int ret = 0;
+
/* Configures BT serial port GPIOs */
s3c2410_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
s3c2410_gpio_pullup(S3C2410_GPH(0), 1);
@@ -98,21 +71,44 @@ static int __init h1940bt_probe(struct p
s3c2410_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
s3c2410_gpio_pullup(S3C2410_GPH(3), 1);
-#ifdef CONFIG_LEDS_H1940
- led_trigger_register_simple("h1940-bluetooth", &bt_led_trigger);
-#endif
- /* disable BT by default */
- h1940bt_enable(0);
+ rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
+ &h1940bt_rfkill_ops, NULL);
+ if (!rfk) {
+ ret = -ENOMEM;
+ goto err_rfk_alloc;
+ }
+
+ rfkill_set_led_trigger_name(rfk, "h1940-bluetooth");
+
+ ret = rfkill_register(rfk);
+ if (ret)
+ goto err_rfkill;
+
+ platform_set_drvdata(pdev, rfk);
+
+ return 0;
- return device_create_file(&pdev->dev, &dev_attr_enable);
+err_rfkill:
+ rfkill_destroy(rfk);
+err_rfk_alloc:
+ return ret;
}
static int h1940bt_remove(struct platform_device *pdev)
{
-#ifdef CONFIG_LEDS_H1940
- led_trigger_unregister_simple(bt_led_trigger);
-#endif
+ struct rfkill *rfk = platform_get_drvdata(pdev);
+
+ platform_set_drvdata(pdev, NULL);
+
+ if (rfk) {
+ rfkill_unregister(rfk);
+ rfkill_destroy(rfk);
+ }
+ rfk = NULL;
+
+ h1940bt_enable(0);
+
return 0;
}
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 0/4] [RFC] h1940 updates
2009-11-17 13:54 [patch 0/4] [RFC] h1940 updates arnaud.patard
` (3 preceding siblings ...)
2009-11-17 13:54 ` [patch 4/4] Convert h1940 bluetooth driver to rfkill arnaud.patard
@ 2009-11-18 0:13 ` Ben Dooks
4 siblings, 0 replies; 6+ messages in thread
From: Ben Dooks @ 2009-11-18 0:13 UTC (permalink / raw)
To: arnaud.patard; +Cc: ben-linux, linux-samsung-soc
On Tue, Nov 17, 2009 at 02:54:55PM +0100, arnaud.patard@rtp-net.org wrote:
> Hi,
>
> This patchset gives an update to h1940 support. It contains:
>
> - add mmc host device
> - add rtc device
> - add a lcd and backlight devices using platform-lcd and pwm-backlight
> - converts the bluetooth support to use the rfkill framework
>
> This has been tested on a 2.6.31 and build tested on your next-s3c24xx-dev-updates branch.
>
> Please, also note that I'm not really good at giving patch descriptions so feel
> free to correct them if needed.
I've put these in a branch, howerver it showing your realname
as 'arnaud.patard@rtp-net.org' so if you want this changing please
resubmit (privately will be ok) with a better realname in the email
Also, it left 'Content-Disposition: inline; filename=h1940_lcd_backlight.patch
' in the patch.
Please also wrap descriptions to 77 or less characters per line.
If possible, prefix subjects with 'ARM: H1940' instead of 'h1940:'
--
Ben
Q: What's a light-year?
A: One-third less calories than a regular year.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-11-18 0:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-17 13:54 [patch 0/4] [RFC] h1940 updates arnaud.patard
2009-11-17 13:54 ` [patch 1/4] h1940: add mmc device arnaud.patard
2009-11-17 13:54 ` [patch 2/4] h1940: enable rtc arnaud.patard
2009-11-17 13:54 ` [patch 3/4] h1940: add lcd/backlight device definition arnaud.patard
2009-11-17 13:54 ` [patch 4/4] Convert h1940 bluetooth driver to rfkill arnaud.patard
2009-11-18 0:13 ` [patch 0/4] [RFC] h1940 updates Ben Dooks
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.