[PATCH] omap3: ehci: Add regulator framework
Adding regulator framework in EHCI driver. OMAP3 has three HS USB ports so it can have three different regulator for each PHY connected to each port. Currently these regulators are assumed to be optional and driver doesn't fail but continue with the initialization if it doesn't get any regulators. Regulator supply names has to be mapped in board files as 'hsusbN' where 'N' is port number and can be {0, 1 ,2}. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com --- drivers/usb/host/ehci-omap.c | 36 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 97ce7d5..91ab9da 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -37,6 +37,7 @@ #include linux/platform_device.h #include linux/clk.h #include linux/gpio.h +#include linux/regulator/consumer.h #include plat/usb.h struct usb_hcd *ghcd; @@ -191,6 +192,11 @@ struct ehci_hcd_omap { void __iomem*uhh_base; void __iomem*tll_base; void __iomem*ehci_base; + + /* Regulators for USB PHYs. +* Each PHY can have a seperate regulator. +*/ + struct regulator*regulator[OMAP3_HS_USB_PORTS]; }; /*-*/ @@ -839,6 +845,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) int irq = platform_get_irq(pdev, 0); int ret = -ENODEV; + int i; + char supply[7]; if (!pdata) { dev_dbg(pdev-dev, missing platform_data\n); @@ -918,6 +926,21 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) goto err_tll_ioremap; } + /* get ehci regulator and enable */ + for (i = 0 ; i OMAP3_HS_USB_PORTS ; i++) { + if (omap-port_mode[i] != EHCI_HCD_OMAP_MODE_PHY) { + omap-regulator[i] = NULL; + continue; + } + snprintf(supply, sizeof(supply), hsusb%d, i); + omap-regulator[i] = regulator_get(omap-dev, supply); + if (IS_ERR(omap-regulator[i])) + dev_dbg(pdev-dev, + failed to get ehci port%d regulator\n, i); + else + regulator_enable(omap-regulator[i]); + } + ret = omap_start_ehc(omap, hcd); if (ret) { dev_dbg(pdev-dev, failed to start ehci\n); @@ -949,6 +972,12 @@ err_add_hcd: omap_stop_ehc(omap, hcd); err_start: + for (i = 0 ; i OMAP3_HS_USB_PORTS ; i++) { + if (omap-regulator[i]) { + regulator_disable(omap-regulator[i]); + regulator_put(omap-regulator[i]); + } + } iounmap(omap-tll_base); err_tll_ioremap: @@ -981,6 +1010,7 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) { struct ehci_hcd_omap *omap = platform_get_drvdata(pdev); struct usb_hcd *hcd = ehci_to_hcd(omap-ehci); + int i; if (omap-port_mode[0] != EHCI_HCD_OMAP_MODE_UNKNOWN) device_remove_file(pdev-dev, dev_attr_port1); @@ -992,6 +1022,12 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) usb_remove_hcd(hcd); omap_stop_ehc(omap, hcd); iounmap(hcd-regs); + for (i = 0 ; i OMAP3_HS_USB_PORTS ; i++) { + if (omap-regulator[i]) { + regulator_disable(omap-regulator[i]); + regulator_put(omap-regulator[i]); + } + } iounmap(omap-tll_base); iounmap(omap-uhh_base); usb_put_hcd(hcd); -- 1.6.2.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/7] musb: Update musb_init() call for all OMAP3 boards
musb_init() has been modified to pass board specific data so updating this function call from all OMAP3 boards. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com --- arch/arm/mach-omap2/board-2430sdp.c |7 ++- arch/arm/mach-omap2/board-3430sdp.c |7 ++- arch/arm/mach-omap2/board-cm-t35.c |7 ++- arch/arm/mach-omap2/board-ldp.c |7 ++- arch/arm/mach-omap2/board-omap3beagle.c |7 ++- arch/arm/mach-omap2/board-omap3evm.c |7 ++- arch/arm/mach-omap2/board-omap3pandora.c |7 ++- arch/arm/mach-omap2/board-overo.c|7 ++- arch/arm/mach-omap2/board-rx51.c |7 ++- arch/arm/mach-omap2/usb-musb.c |7 +-- arch/arm/plat-omap/include/plat/usb.h|3 ++- 11 files changed, 61 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index db9374b..03d3634 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -23,6 +23,7 @@ #include linux/err.h #include linux/clk.h #include linux/io.h +#include linux/usb/musb.h #include mach/hardware.h #include asm/mach-types.h @@ -194,6 +195,10 @@ static struct twl4030_hsmmc_info mmc[] __initdata = { {} /* Terminator */ }; +static struct musb_hdrc_board_data musb_bdata __initdata = { + .power = 50 +}; + static void __init omap_2430sdp_init(void) { int ret; @@ -203,7 +208,7 @@ static void __init omap_2430sdp_init(void) platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); omap_serial_init(); twl4030_mmc_init(mmc); - usb_musb_init(); + usb_musb_init(musb_bdata); board_smc91x_init(); /* Turn off secondary LCD backlight */ diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index a3c1271..dde1a96 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -24,6 +24,7 @@ #include linux/regulator/machine.h #include linux/io.h #include linux/gpio.h +#include linux/usb/musb.h #include mach/hardware.h #include asm/mach-types.h @@ -484,6 +485,10 @@ static void enable_board_wakeup_source(void) omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */ } +static struct musb_hdrc_board_data musb_bdata __initdata = { + .power = 50 +}; + static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, @@ -509,7 +514,7 @@ static void __init omap_3430sdp_init(void) ARRAY_SIZE(sdp3430_spi_board_info)); ads7846_dev_init(); omap_serial_init(); - usb_musb_init(); + usb_musb_init(musb_bdata); board_smc91x_init(); enable_board_wakeup_source(); usb_ehci_init(ehci_pdata); diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index 22c4529..5d7656c 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c @@ -31,6 +31,7 @@ #include linux/i2c/at24.h #include linux/i2c/twl4030.h #include linux/regulator/machine.h +#include linux/usb/musb.h #include asm/mach-types.h #include asm/mach/arch.h @@ -383,6 +384,10 @@ static struct twl4030_hsmmc_info mmc[] = { {} /* Terminator */ }; +static struct musb_hdrc_board_data musb_bdata __initdata = { + .power = 50 +}; + static struct ehci_hcd_omap_platform_data ehci_pdata = { .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, @@ -491,7 +496,7 @@ static void __init cm_t35_init(void) cm_t35_init_ethernet(); cm_t35_init_led(); - usb_musb_init(); + usb_musb_init(musb_bdata); omap_cfg_reg(AF26_34XX_SYS_NIRQ); } diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index c062238..0546c78 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c @@ -27,6 +27,7 @@ #include linux/i2c/twl4030.h #include linux/io.h #include linux/smsc911x.h +#include linux/usb/musb.h #include mach/hardware.h #include asm/mach-types.h @@ -374,6 +375,10 @@ static struct platform_device *ldp_devices[] __initdata = { ldp_gpio_keys_device, }; +static struct musb_hdrc_board_data musb_bdata __initdata = { + .power = 50 +}; + static void __init omap_ldp_init(void) { omap_i2c_init(); @@ -384,7 +389,7 @@ static void __init omap_ldp_init(void) ARRAY_SIZE(ldp_spi_board_info)); ads7846_dev_init(); omap_serial_init(); - usb_musb_init(); + usb_musb_init(musb_bdata); twl4030_mmc_init(mmc); /* link regulators to MMC adapters */ diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 7ad9846..683b468 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++
[PATCH 6/7] musb: set 'extvbus' default value to zero
Default value of 'extvbus' is being set as '0' to maintain the current programming state of all the musb boards. This flag should be set to '1' for boards using external vbus supply such as, OMAP3EVM Rev =E. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com --- arch/arm/mach-davinci/board-dm355-evm.c |1 + arch/arm/mach-davinci/board-dm355-leopard.c |1 + arch/arm/mach-davinci/board-dm644x-evm.c|1 + arch/arm/mach-davinci/board-sffsdr.c|3 ++- arch/arm/mach-omap2/board-2430sdp.c |3 ++- arch/arm/mach-omap2/board-3430sdp.c |3 ++- arch/arm/mach-omap2/board-cm-t35.c |3 ++- arch/arm/mach-omap2/board-ldp.c |3 ++- arch/arm/mach-omap2/board-omap3beagle.c |3 ++- arch/arm/mach-omap2/board-omap3evm.c|3 ++- arch/arm/mach-omap2/board-omap3pandora.c|3 ++- arch/arm/mach-omap2/board-overo.c |3 ++- arch/arm/mach-omap2/board-rx51.c|3 ++- 13 files changed, 23 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c index 31c5741..ed011ae 100644 --- a/arch/arm/mach-davinci/board-dm355-evm.c +++ b/arch/arm/mach-davinci/board-dm355-evm.c @@ -322,6 +322,7 @@ static struct spi_board_info dm355_evm_spi_info[] __initconst = { static struct musb_hdrc_board_data musb_bdata __initdata = { .power = 250, /* (power in mA)/2 */ .potpgt = 4,/* (potpgt in msec)/2 */ + .extvbus = 0, }; static __init void dm355_evm_init(void) diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c index 2c534f1..4ab8ab5 100644 --- a/arch/arm/mach-davinci/board-dm355-leopard.c +++ b/arch/arm/mach-davinci/board-dm355-leopard.c @@ -248,6 +248,7 @@ static struct spi_board_info dm355_leopard_spi_info[] __initconst = { static struct musb_hdrc_board_data musb_bdata __initdata = { .power = 250, /* (power in mA)/2 */ .potpgt = 4,/* (potpgt in msec)/2 */ + .extvbus = 0, }; static __init void dm355_leopard_init(void) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index 307520e..9e99882 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -443,6 +443,7 @@ static struct pcf857x_platform_data pcf_data_u18 = { static struct musb_hdrc_board_data musb_bdata __initdata = { .power = 250, /* (power in mA)/2 */ .potpgt = 4,/* (potpgt in msec)/2 */ + .extvbus = 0, }; /* U35 - various I/O signals used to manage USB, CF, ATA, etc */ diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c index 5dceeb0..c6c9b20 100644 --- a/arch/arm/mach-davinci/board-sffsdr.c +++ b/arch/arm/mach-davinci/board-sffsdr.c @@ -153,7 +153,8 @@ static struct davinci_uart_config uart_config __initdata = { /* musb board specific data */ static struct musb_hdrc_board_data musb_bdata __initdata = { .power = 0, /* (power in mA)/2 */ - .potpgt = 0 /* (potpgt in msec)/2 */ + .potpgt = 0,/* (potpgt in msec)/2 */ + .extvbus = 0, }; static void __init davinci_sffsdr_map_io(void) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 03d3634..074941c 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -196,7 +196,8 @@ static struct twl4030_hsmmc_info mmc[] __initdata = { }; static struct musb_hdrc_board_data musb_bdata __initdata = { - .power = 50 + .power = 50, + .extvbus = 0, }; static void __init omap_2430sdp_init(void) diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index dde1a96..fd6fc56 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -486,7 +486,8 @@ static void enable_board_wakeup_source(void) } static struct musb_hdrc_board_data musb_bdata __initdata = { - .power = 50 + .power = 50, + .extvbus = 0, }; static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index 5d7656c..134069c 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c @@ -385,7 +385,8 @@ static struct twl4030_hsmmc_info mmc[] = { }; static struct musb_hdrc_board_data musb_bdata __initdata = { - .power = 50 + .power = 50, + .extvbus = 0, }; static struct ehci_hcd_omap_platform_data ehci_pdata = { diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 0546c78..11526d6 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c @@ -376,7 +376,8 @@ static struct platform_device *ldp_devices[] __initdata = { }; static struct musb_hdrc_board_data musb_bdata __initdata = { -
[PATCH 4/7] musb: Update setup_usb() call for all Davinci boards
setup_usb() has been modified to pass board specific data so updating this function call from all Davinci based boards. Added struct device; to fix below compilation warning for Davinci boards. musb.h: struct device, defined within parameter list Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com --- arch/arm/mach-davinci/board-dm355-evm.c |9 - arch/arm/mach-davinci/board-dm355-leopard.c |9 - arch/arm/mach-davinci/board-dm644x-evm.c|8 +++- arch/arm/mach-davinci/board-sffsdr.c|9 - arch/arm/mach-davinci/include/mach/common.h |7 +-- arch/arm/mach-davinci/usb.c |8 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c index 77e8067..31c5741 100644 --- a/arch/arm/mach-davinci/board-dm355-evm.c +++ b/arch/arm/mach-davinci/board-dm355-evm.c @@ -24,6 +24,7 @@ #include media/tvp514x.h #include linux/spi/spi.h #include linux/spi/eeprom.h +#include linux/usb/musb.h #include asm/setup.h #include asm/mach-types.h @@ -317,6 +318,12 @@ static struct spi_board_info dm355_evm_spi_info[] __initconst = { }, }; +/* musb board specific data */ +static struct musb_hdrc_board_data musb_bdata __initdata = { + .power = 250, /* (power in mA)/2 */ + .potpgt = 4,/* (potpgt in msec)/2 */ +}; + static __init void dm355_evm_init(void) { struct clk *aemif; @@ -344,7 +351,7 @@ static __init void dm355_evm_init(void) gpio_request(2, usb_id_toggle); gpio_direction_output(2, USB_ID_VALUE); /* irlml6401 switches over 1A in under 8 msec */ - setup_usb(500, 8); + setup_usb(musb_bdata); davinci_setup_mmc(0, dm355evm_mmc_config); davinci_setup_mmc(1, dm355evm_mmc_config); diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c index 84ad5d1..2c534f1 100644 --- a/arch/arm/mach-davinci/board-dm355-leopard.c +++ b/arch/arm/mach-davinci/board-dm355-leopard.c @@ -21,6 +21,7 @@ #include linux/clk.h #include linux/spi/spi.h #include linux/spi/eeprom.h +#include linux/usb/musb.h #include asm/setup.h #include asm/mach-types.h @@ -243,6 +244,12 @@ static struct spi_board_info dm355_leopard_spi_info[] __initconst = { }, }; +/* musb board specific data */ +static struct musb_hdrc_board_data musb_bdata __initdata = { + .power = 250, /* (power in mA)/2 */ + .potpgt = 4,/* (potpgt in msec)/2 */ +}; + static __init void dm355_leopard_init(void) { struct clk *aemif; @@ -270,7 +277,7 @@ static __init void dm355_leopard_init(void) gpio_request(2, usb_id_toggle); gpio_direction_output(2, USB_ID_VALUE); /* irlml6401 switches over 1A in under 8 msec */ - setup_usb(500, 8); + setup_usb(musb_bdata); davinci_setup_mmc(0, dm355leopard_mmc_config); davinci_setup_mmc(1, dm355leopard_mmc_config); diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index 1213a00..307520e 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -29,6 +29,7 @@ #include linux/phy.h #include linux/clk.h #include linux/videodev2.h +#include linux/usb/musb.h #include media/tvp514x.h @@ -438,6 +439,11 @@ static struct pcf857x_platform_data pcf_data_u18 = { .teardown = evm_u18_teardown, }; +/* musb board specific data */ +static struct musb_hdrc_board_data musb_bdata __initdata = { + .power = 250, /* (power in mA)/2 */ + .potpgt = 4,/* (potpgt in msec)/2 */ +}; /* U35 - various I/O signals used to manage USB, CF, ATA, etc */ @@ -477,7 +483,7 @@ evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c) /* irlml6401 switches over 1A, in under 8 msec; * now it can be managed by nDRV_VBUS ... */ - setup_usb(500, 8); + setup_usb(musb_bdata); return 0; } diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c index 7acdfd8..5dceeb0 100644 --- a/arch/arm/mach-davinci/board-sffsdr.c +++ b/arch/arm/mach-davinci/board-sffsdr.c @@ -38,6 +38,7 @@ #include linux/mtd/partitions.h #include linux/mtd/physmap.h #include linux/io.h +#include linux/usb/musb.h #include asm/setup.h #include asm/mach-types.h @@ -149,6 +150,12 @@ static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 0), }; +/* musb board specific data */ +static struct musb_hdrc_board_data musb_bdata __initdata = { + .power = 0, /* (power in mA)/2 */ + .potpgt = 0 /* (potpgt in msec)/2 */ +}; + static void __init davinci_sffsdr_map_io(void) { dm644x_init(); @@ -164,7 +171,7 @@ static __init void davinci_sffsdr_init(void) davinci_serial_init(uart_config); soc_info-emac_pdata-phy_mask =
[PATCH 5/7] musb: Add 'extvbus' in musb_hdrc_board_data
Some of the board might use external Vbus power supply on musb interface which would require to program ULPI_BUSCONTROL register. Adding 'extvbus' flag which can be set from such boards which will be checked at musb driver files before programming ULPI_BUSCONTROL. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com --- drivers/usb/musb/musb_core.c | 12 +++- drivers/usb/musb/musb_regs.h |5 + include/linux/usb/musb.h |3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 818ccda..c0a6760 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2027,15 +2027,25 @@ bad_config: /* host side needs more setup */ if (is_host_enabled(musb)) { struct usb_hcd *hcd = musb_to_hcd(musb); + u8 busctl; otg_set_host(musb-xceiv, hcd-self); if (is_otg_enabled(musb)) hcd-self.otg_port = 1; musb-xceiv-host = hcd-self; - if (plat-board_data) + if (plat-board_data) { hcd-power_budget = 2 * (plat-board_data-power ? : 250); + /* program PHY to use external vBus if required */ + if (plat-board_data-extvbus) { + busctl = musb_readb(musb-mregs, + MUSB_ULPI_BUSCONTROL); + busctl |= ULPI_USE_EXTVBUS; + musb_writeb(musb-mregs, + MUSB_ULPI_BUSCONTROL, busctl); + } + } } /* For the host-only role, we can activate right away. diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h index cc1d71b..a0314df 100644 --- a/drivers/usb/musb/musb_regs.h +++ b/drivers/usb/musb/musb_regs.h @@ -72,6 +72,10 @@ #define MUSB_DEVCTL_HR 0x02 #define MUSB_DEVCTL_SESSION0x01 +/* ULPI VBUSCONTROL */ +#define ULPI_USE_EXTVBUS 0x01 +#define ULPI_USE_EXTVBUSIND0x02 + /* TESTMODE */ #define MUSB_TEST_FORCE_HOST 0x80 #define MUSB_TEST_FIFO_ACCESS 0x40 @@ -246,6 +250,7 @@ /* REVISIT: vctrl/vstatus: optional vendor utmi+phy register at 0x68 */ #define MUSB_HWVERS0x6C/* 8 bit */ +#define MUSB_ULPI_BUSCONTROL 0x70/* 8 bit */ #define MUSB_EPINFO0x78/* 8 bit */ #define MUSB_RAMINFO 0x79/* 8 bit */ diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index 6e1426c..604c404 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -33,7 +33,8 @@ struct musb_hdrc_board_data { u8 power; /* (HOST or OTG) msec/2 after VBUS on till power good */ u8 potpgt; - + /* flag to program PHY to use external Vbus */ + u8 extvbus; }; struct musb_hdrc_config { -- 1.6.2.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/7] musb: Get power (mA) from board data
Different board may have different power sourcing capability and now with 'struct musb_hdrc_board_data' in place; pass this data from board files and also modify musb_core.c to get 'power' data from 'plat-board_data'. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com --- arch/arm/mach-omap2/usb-musb.c |6 -- drivers/usb/musb/musb_core.c |4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c index a80441d..e89c6b1 100644 --- a/arch/arm/mach-omap2/usb-musb.c +++ b/arch/arm/mach-omap2/usb-musb.c @@ -124,12 +124,6 @@ static struct musb_hdrc_platform_data musb_plat = { /* .clock is set dynamically */ .set_clock = musb_set_clock, .config = musb_config, - - /* REVISIT charge pump on TWL4030 can supply up to -* 100 mA ... but this value is board-specific, like -* mode, and should be passed to usb_musb_init(). -*/ - .power = 50, /* up to 100 mA */ }; static u64 musb_dmamask = DMA_BIT_MASK(32); diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 3a61ddb..818ccda 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2033,7 +2033,9 @@ bad_config: if (is_otg_enabled(musb)) hcd-self.otg_port = 1; musb-xceiv-host = hcd-self; - hcd-power_budget = 2 * (plat-power ? : 250); + if (plat-board_data) + hcd-power_budget = + 2 * (plat-board_data-power ? : 250); } /* For the host-only role, we can activate right away. -- 1.6.2.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/7] musb: Add structure to get board specific data
Adding 'musb_hdrc_board_data' which will have all the board specific parameters such as; mA power, potpgt, extvbus, gpios etc. Currently only 'power' and 'potpgt' is being moved from existing 'musb_hdrc_platform_data' to 'musb_hdrc_board_data' but any further board specific functions or parameter can be added to this structure later. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com --- include/linux/usb/musb.h | 18 -- 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index d437556..6e1426c 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -27,6 +27,15 @@ struct musb_hdrc_eps_bits { u8 bits; }; +/* MUSB board-specific details */ +struct musb_hdrc_board_data { + /* power (mA/2) sourcing capability */ + u8 power; + /* (HOST or OTG) msec/2 after VBUS on till power good */ + u8 potpgt; + +}; + struct musb_hdrc_config { /* MUSB configuration-specific details */ unsignedmultipoint:1; /* multipoint device */ @@ -67,15 +76,9 @@ struct musb_hdrc_platform_data { /* (HOST or OTG) switch VBUS on/off */ int (*set_vbus)(struct device *dev, int is_on); - /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */ - u8 power; - /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */ u8 min_power; - /* (HOST or OTG) msec/2 after VBUS on till power good */ - u8 potpgt; - /* Power the device on or off */ int (*set_power)(int state); @@ -84,6 +87,9 @@ struct musb_hdrc_platform_data { /* MUSB configuration-specific details */ struct musb_hdrc_config *config; + + /* MUSB board-specific details */ + struct musb_hdrc_board_data *board_data; }; -- 1.6.2.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/7] musb: set 'extvbus' for OMAP3EVM Rev =E
MUSB interface can source 500mA on OMAP3EVM Rev = E while Rev E supports only 100mA so setting 'extvbus' flag to '1' for OMAP3EVM Rev = E. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com --- arch/arm/mach-omap2/board-omap3evm.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 0bcf909..a3c8344 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -428,6 +428,8 @@ static void __init omap3_evm_init(void) omap_cfg_reg(AH14_34XX_GPIO21); ehci_pdata.reset_gpio_port[1] = 21; + /* set flag to program ULPI_BUSCONTROL */ + musb_bdata.extvbus = 1; } else { /* setup EHCI phy reset on MDC */ omap_cfg_reg(AF4_34XX_GPIO135_OUT); -- 1.6.2.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
CPU driver
I have downloaded uImage on the beagleboard with the pm branch,and enabled all the CPU power management ,and after booting I found all the files concerning it in the CPUFREQ folder in CPU0,,however i couldn't type cpufreq commands . like cpufreq-info ,cpu-set ,,etc Any suggestions will be appreciated ,, thnx in advance . Best Regrds, tarek -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/9 v2] omap3: pm: introduce dynamic OPP
Kevin Hilman said the following on 11/13/2009 07:31 PM: [...] +void __init omap3_pm_init_opp_table(void) +{ +/* Populate the base CPU rate tables here */ +omap3_mpu_rate_table = kmalloc(sizeof(omap34xx_mpu_rate_table), +GFP_KERNEL); +omap3_dsp_rate_table = kmalloc(sizeof(omap34xx_dsp_rate_table), +GFP_KERNEL); +omap3_l3_rate_table = kmalloc(sizeof(omap34xx_l3_rate_table), +GFP_KERNEL); + +BUG_ON(!omap3_mpu_rate_table || !omap3_dsp_rate_table || +!omap3_l3_rate_table); + +memcpy(omap3_mpu_rate_table, omap34xx_mpu_rate_table, +sizeof(omap34xx_mpu_rate_table)); +memcpy(omap3_dsp_rate_table, omap34xx_dsp_rate_table, +sizeof(omap34xx_dsp_rate_table)); +memcpy(omap3_l3_rate_table, omap34xx_l3_rate_table, +sizeof(omap34xx_l3_rate_table)); +} + Minor issue, but FYI... rather than the kmalloc + memcpy, you can use kmemdup() to do the same thing thanks. Regards, Nishanth Menon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/9 v2] omap3: pm: introduce opp accessor functions
Kevin, Firstly, thanks for your detailed comments. This series looked at the problem as 2 objectives: a) Introduce OPP accessor functions - this series shows it is possible b) Improve the implementation with discussions. I am all for it. I know spending 7-14 hrs like what I did on this, is not enough to bring in the best of the implementation. Kevin Hilman said the following on 11/13/2009 06:58 PM: Nishanth Menon n...@ti.com writes: [...] Signed-off-by: Sanjeev Premi pr...@ti.com Signed-off-by: Nishanth Menon n...@ti.com Some general style comments: - Very good and throrough commenting, Nice! Some minor changes needed - use kerneldoc style throughout (applies to other patches as well) - use standard multi-line comments /me kicking myself for not reading Documentation/ properly.. Ack. will read and fix. - overuse of BUG(). Failures should be more graceful, returning errors and checking errors in callers heh heh.. I am a bit of a paranoid for good reasons.. The rule I followed is: BUG() has been used with static functions, and critical functions that expect params. it is better to flag it to developer that the assumptions of the function are not being met by the caller.. forcing an earlier fix than having to deal with half a dozen functions that never check return values!! I dont mind discussion which locations BUG is superfluous and where it is essential. - EXPORT_SYMBOL(): none of these OPP accessors should be exported to drivers. This is PM core code only. Ack. General design comments: OPP accessor functions don't belong in omap-pm.h. A new OPP header should be used. Maybe plat/opp.h What is the benefit? opp is a pm feature right? May be personal preference, but I'm not crazy about the implementation of the accessor functions. I think moving to a list and using the standard list iterators will clean this up Why do i get a deja-vu feel about that statement :P.. but then, there are three alternatives, that I see: a) array -straight walk.. (Order n) b) list iterator: (Order n) c) array - binary search (Order log n) - should have used this. d) array - hash table (Order 1) - want to use this, but need to spend some cool thinking time to write one hash function.. I personally like (d). But in any case, this is nothing but a bunch of function implementation (and possibly structure improvements). I like to think of it as phase 2 of accessor functions.. let me know if you disagree. I know we discussed this on the initial call and some said that walking an array would be faster. But looking at the code, I think the readability would improve greatly and we don't need OPP tables with dummy first and last entries etc. yes I know - look above. readability needs to match performance for a critical path such as these functions. A list implementation would also allow you make generalized iterators like is done in the clkdm and pwrdm code (see pwrdm_for_each, clkdm_for_each.) one of my initial proposals ;)... but as I shown above, I think there are alternatives instead of using list iterators. At a high level, I'm not in line with the general direction here. In particular, this series continues the use of passing around OPP IDs instead of real world values like frequencies. I think a general cleanup is needed to get rid of the OPP IDs, so either real world values (frequencies and voltages) are passed around or pointers to OPP structs are passed. I agree - if you look at my accessor functions - ONLY one function has opp ID mapping. if you kill that function in the future, none of the other users can use OPPID at all.. I think that is a phase 2 again.. I know one of your goals was to make this less intrusive, but for me, nothing in the current OPP layer and SRF is upstreamable anyways, so I have no objectsion to intrusive changes to these layers. unfortunately, I know of a bunch of folks who might riot if I rewrote SRF (as I was itching to do) when I started dabbling with it.. further, I do not have the bandwidth to do that kind of rewrite and end up perpetually keeping 3630 patches at bay.. More detailed comments below... --- arch/arm/mach-omap2/omap3-opp.h | 40 +--- arch/arm/mach-omap2/pm.c | 160 + arch/arm/mach-omap2/pm34xx.c | 42 arch/arm/plat-omap/include/plat/omap-pm.h | 109 4 files changed, 314 insertions(+), 37 deletions(-) diff --git a/arch/arm/mach-omap2/omap3-opp.h b/arch/arm/mach-omap2/omap3-opp.h index 42557e1..27e2ca5 100644 --- a/arch/arm/mach-omap2/omap3-opp.h +++ b/arch/arm/mach-omap2/omap3-opp.h @@ -21,42 +21,8 @@ #define S83M8300 #define S166M 16600 -static struct omap_opp omap3_mpu_rate_table[] = { -{0, 0, 0, 0}, -/*OPP1*/ -{true, S125M, VDD1_OPP1, 0x1E}, -/*OPP2*/ -{true, S250M, VDD1_OPP2, 0x26}, -/*OPP3*/
Modifying the kernel keymap
All, I'm working with the Wing Linux and Linwizard projects in porting various omap850-based devices to Linux, and was wondering about keymaps. In particular, I'm working with the HTC Herald, which uses an Alt key to access things like numbers and symbols on a physical keyboard. In Linux, the keymappings are wrong for this -- Alt does something different and doesn't allow access to those extra characters. In Linwizard, we've modified the defkeymap and added makefile rules to compile our modified defkeymap when a specific board was selected, but this isn't portable when building a kernel for many boards at once, each having a different mapping. So, my question is, what is the best way to go about changing the defkeymap, or supplying a keymap that allows all the keys to function correctly, but doesn't require non-portable makefile hacks? Thanks, Cory -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: CPU driver
From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- ow...@vger.kernel.org] On Behalf Of tarek attia Sent: Sunday, November 15, 2009 6:33 AM I have downloaded uImage on the beagleboard with the pm branch,and enabled all the CPU power management ,and after booting I found all the files concerning it in the CPUFREQ folder in CPU0,,however i couldn't type cpufreq commands . like cpufreq-info ,cpu-set ,,etc Any suggestions will be appreciated ,, thnx in advance . See [1] Regards, Nishanth Menon Ref: [1] http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Modifying the kernel keymap
Hi, On Sun, 2009-11-15 at 12:06 -0800, Cory Maccarrone wrote: All, I'm working with the Wing Linux and Linwizard projects in porting various omap850-based devices to Linux, and was wondering about keymaps. In particular, I'm working with the HTC Herald, which uses an Alt key to access things like numbers and symbols on a physical keyboard. In Linux, the keymappings are wrong for this -- Alt does something different and doesn't allow access to those extra characters. In Linwizard, we've modified the defkeymap and added makefile rules to compile our modified defkeymap when a specific board was selected, but this isn't portable when building a kernel for many boards at once, each having a different mapping. So, my question is, what is the best way to go about changing the defkeymap, or supplying a keymap that allows all the keys to function correctly, but doesn't require non-portable makefile hacks? how about letting xmodmap handle that ? If you use alt key, then kernel passes alt key. Userland can later remap that key to some other function. -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/19] OMAP: DSS2 v5 intro
Tomi, On Fri, 13 Nov 2009 09:59:28 -0800 Tony Lindgren t...@atomide.com wrote: I rebased DSS2 on top of 8171d88089ad63fc442b2bf32af7c18653adc5cb. It can be found from git://gitorious.org/linux-omap-dss2/linux.git for-next branch. I'm ok with Tony pulling DSS2 to his next-branch, or Stephen pulling directly, which ever works easier for you. I'd rather see Stephen pulling directly from Tomi, that's a good long term solution for maintaining the DSS2 code. OK, I have added that branch to linux-next from today. Thanks for all the efforts. Thanks for adding your subsystem tree as a participant of linux-next. As you may know, this is not a judgment of your code. The purpose of linux-next is for integration testing and to lower the impact of conflicts between subsystems in the next merge window. You will need to ensure that the patches/commits in your tree/series have been: * submitted under GPL v2 (or later) and include the Contributor's Signed-off-by, * posted to the relevant mailing list, * reviewed by you (or another maintainer of your subsystem tree), * successfully unit tested, and * destined for the current or next Linux merge window. Basically, this should be just what you would send to Linus (or ask him to fetch). It is allowed to be rebased if you deem it necessary. -- Cheers, Stephen Rothwell s...@canb.auug.org.au Legal Stuff: By participating in linux-next, your subsystem tree contributions are public and will be included in the linux-next trees. You may be sent e-mail messages indicating errors or other issues when the patches/commits from your subsystem tree are merged and tested in linux-next. These messages may also be cross-posted to the linux-next mailing list, the linux-kernel mailing list, etc. The linux-next tree project and IBM (my employer) make no warranties regarding the linux-next project, the testing procedures, the results, the e-mails, etc. If you don't agree to these ground rules, let me know and I'll remove your tree from participation in linux-next. pgpH7QihUkUw3.pgp Description: PGP signature
Re: [PATCH v3] mfd: Initial support for twl5031
Hi Ilkka, On Tue, Nov 10, 2009 at 05:26:15PM +0200, Ilkka Koskinen wrote: TWL5031 introduces two new interrupts in PIH. Moreover, BCI has changed remarkably and, thus, it's disabled when TWL5031 is in use. Applied to my for-next branch, thanks. Cheers, Samuel. Signed-off-by: Ilkka Koskinen ilkka.koski...@nokia.com --- drivers/mfd/twl4030-core.c | 13 - drivers/mfd/twl4030-irq.c | 131 +- include/linux/i2c/twl4030.h | 47 +-- 3 files changed, 180 insertions(+), 11 deletions(-) diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c index 9b74f88..61c2bb7 100644 --- a/drivers/mfd/twl4030-core.c +++ b/drivers/mfd/twl4030-core.c @@ -152,6 +152,10 @@ #define TWL4030_BASEADD_PWMB 0x00F1 #define TWL4030_BASEADD_KEYPAD 0x00D2 +#define TWL5031_BASEADD_ACCESSORY0x0074 /* Replaces Main Charge */ +#define TWL5031_BASEADD_INTERRUPTS 0x00B9 /* Different than TWL4030's + one */ + /* subchip/slave 3 - POWER ID */ #define TWL4030_BASEADD_BACKUP 0x0014 #define TWL4030_BASEADD_INT 0x002E @@ -183,6 +187,7 @@ /* chip-specific feature flags, for i2c_device_id.driver_data */ #define TWL4030_VAUX2BIT(0) /* pre-5030 voltage ranges */ #define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */ +#define TWL5031 BIT(2) /* twl5031 has different registers */ /*--*/ @@ -235,6 +240,8 @@ static struct twl4030mapping twl4030_map[TWL4030_MODULE_LAST + 1] = { { 2, TWL4030_BASEADD_PWM1 }, { 2, TWL4030_BASEADD_PWMA }, { 2, TWL4030_BASEADD_PWMB }, + { 2, TWL5031_BASEADD_ACCESSORY }, + { 2, TWL5031_BASEADD_INTERRUPTS }, { 3, TWL4030_BASEADD_BACKUP }, { 3, TWL4030_BASEADD_INT }, @@ -482,7 +489,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) { struct device *child; - if (twl_has_bci() pdata-bci !(features TPS_SUBSET)) { + if (twl_has_bci() pdata-bci + !(features (TPS_SUBSET | TWL5031))) { child = add_child(3, twl4030_bci, pdata-bci, sizeof(*pdata-bci), false, @@ -746,6 +754,7 @@ static void clocks_init(struct device *dev, int twl_init_irq(int irq_num, unsigned irq_base, unsigned irq_end); int twl_exit_irq(void); +int twl_init_chip_irq(const char *chip); static int twl4030_remove(struct i2c_client *client) { @@ -821,6 +830,7 @@ twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id) if (client-irq pdata-irq_base pdata-irq_end pdata-irq_base) { + twl_init_chip_irq(id-name); status = twl_init_irq(client-irq, pdata-irq_base, pdata-irq_end); if (status 0) goto fail; @@ -836,6 +846,7 @@ fail: static const struct i2c_device_id twl4030_ids[] = { { twl4030, TWL4030_VAUX2 }, /* Triton 2 */ { twl5030, 0 }, /* T2 updated */ + { twl5031, TWL5031 }, /* TWL5030 updated */ { tps65950, 0 }, /* catalog version of twl5030 */ { tps65930, TPS_SUBSET }, /* fewer LDOs and DACs; no charger */ { tps65920, TPS_SUBSET }, /* fewer LDOs; no codec or charger */ diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c index fb194fe..0b73302 100644 --- a/drivers/mfd/twl4030-irq.c +++ b/drivers/mfd/twl4030-irq.c @@ -74,6 +74,8 @@ struct sih { u8 edr_offset; u8 bytes_edr; /* bytelen of EDR */ + u8 irq_lines; /* number of supported irq lines */ + /* SIR ignored -- set interrupt, for testing only */ struct irq_data { u8 isr_offset; @@ -82,6 +84,9 @@ struct sih { /* + 2 bytes padding */ }; +static const struct sih *sih_modules; +static int nr_sih_modules; + #define SIH_INITIALIZER(modname, nbits) \ .module = TWL4030_MODULE_ ## modname, \ .control_offset = TWL4030_ ## modname ## _SIH_CTRL, \ @@ -89,6 +94,7 @@ struct sih { .bytes_ixr = DIV_ROUND_UP(nbits, 8), \ .edr_offset = TWL4030_ ## modname ## _EDR, \ .bytes_edr = DIV_ROUND_UP((2*(nbits)), 8), \ + .irq_lines = 2, \ .mask = { { \ .isr_offset = TWL4030_ ## modname ## _ISR1, \ .imr_offset = TWL4030_ ## modname ## _IMR1, \ @@ -107,7 +113,8 @@ struct sih { /* Order in this table matches order in PIH_ISR. That is, * BIT(n) in PIH_ISR is sih_modules[n]. */ -static const struct sih sih_modules[6] = { +/* sih_modules_twl4030 is used both in twl4030 and twl5030 */ +static const struct sih
Re: Modifying the kernel keymap
On Sun, Nov 15, 2009 at 2:31 PM, Felipe Balbi m...@felipebalbi.com wrote: Hi, On Sun, 2009-11-15 at 12:06 -0800, Cory Maccarrone wrote: All, I'm working with the Wing Linux and Linwizard projects in porting various omap850-based devices to Linux, and was wondering about keymaps. In particular, I'm working with the HTC Herald, which uses an Alt key to access things like numbers and symbols on a physical keyboard. In Linux, the keymappings are wrong for this -- Alt does something different and doesn't allow access to those extra characters. In Linwizard, we've modified the defkeymap and added makefile rules to compile our modified defkeymap when a specific board was selected, but this isn't portable when building a kernel for many boards at once, each having a different mapping. So, my question is, what is the best way to go about changing the defkeymap, or supplying a keymap that allows all the keys to function correctly, but doesn't require non-portable makefile hacks? how about letting xmodmap handle that ? If you use alt key, then kernel passes alt key. Userland can later remap that key to some other function. -- balbi For X-based interfaces that would work, and there's an equivalent for Android too. My question is more geared towards the console (i.e. no X or Android, just plain linux console). - Cory -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Dose OMAP3 support split transfer?
Hi Guys, Dose OMAP3 support split transaction? Thanks, -- K T Jung -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] Amstrad Delta: add support for LCD contrast
The series consists of 2 patches: [PATCH 1/2] omapfb: lcd_ams_delta: add support for contrast control [PATCH 2/2] OMAP: ams_delta_defconfig: enable LCD class device support It is intended for 2.6.33, if it's not too late. Thanks, Janusz -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] omapfb: lcd_ams_delta: add support for contrast control
The patch extends the Amstrad Delta LCD panel driver with optional support for changing contrast using standard LCD class device API instead of setting it silently to a default value at panel enable. It also allows for lowering power consumption by turning off OMAP_PWL_CLK_ENABLE via lcd_ops.set_power callback. Created and tested against linux-omap for-next, commit 155a75d9725e66e5ec8a383822957dee52427057. Signed-off-by: Janusz Krzysztofik jkrzy...@tis.icnet.pl --- --- a/drivers/video/omap/lcd_ams_delta.c2009-11-14 23:49:16.0 +0100 +++ b/drivers/video/omap/lcd_ams_delta.c2009-11-16 01:32:19.0 +0100 @@ -24,6 +24,7 @@ #include linux/platform_device.h #include linux/io.h #include linux/delay.h +#include linux/lcd.h #include plat/board-ams-delta.h #include mach/hardware.h @@ -31,6 +32,71 @@ #define AMS_DELTA_DEFAULT_CONTRAST 112 +#define AMS_DELTA_MAX_CONTRAST 0x00FF +#define AMS_DELTA_LCD_POWER0x0100 + + +/* LCD class device section */ + +static int ams_delta_lcd; + +static int ams_delta_lcd_set_power(struct lcd_device *dev, int power) +{ + if (power == FB_BLANK_UNBLANK) { + if (!(ams_delta_lcd AMS_DELTA_LCD_POWER)) { + omap_writeb(ams_delta_lcd AMS_DELTA_MAX_CONTRAST, + OMAP_PWL_ENABLE); + omap_writeb(1, OMAP_PWL_CLK_ENABLE); + ams_delta_lcd |= AMS_DELTA_LCD_POWER; + } + } else { + if (ams_delta_lcd AMS_DELTA_LCD_POWER) { + omap_writeb(0, OMAP_PWL_ENABLE); + omap_writeb(0, OMAP_PWL_CLK_ENABLE); + ams_delta_lcd = ~AMS_DELTA_LCD_POWER; + } + } + return 0; +} + +static int ams_delta_lcd_set_contrast(struct lcd_device *dev, int value) +{ + if ((value = 0) (value = AMS_DELTA_MAX_CONTRAST)) { + omap_writeb(value, OMAP_PWL_ENABLE); + ams_delta_lcd = ~AMS_DELTA_MAX_CONTRAST; + ams_delta_lcd |= value; + } + return 0; +} + +#ifdef CONFIG_LCD_CLASS_DEVICE +static int ams_delta_lcd_get_power(struct lcd_device *dev) +{ + if (ams_delta_lcd AMS_DELTA_LCD_POWER) + return FB_BLANK_UNBLANK; + else + return FB_BLANK_POWERDOWN; +} + +static int ams_delta_lcd_get_contrast(struct lcd_device *dev) +{ + if (!(ams_delta_lcd AMS_DELTA_LCD_POWER)) + return 0; + + return ams_delta_lcd AMS_DELTA_MAX_CONTRAST; +} + +static struct lcd_ops ams_delta_lcd_ops = { + .get_power = ams_delta_lcd_get_power, + .set_power = ams_delta_lcd_set_power, + .get_contrast = ams_delta_lcd_get_contrast, + .set_contrast = ams_delta_lcd_set_contrast, +}; +#endif + + +/* omapfb panel section */ + static int ams_delta_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) { @@ -47,10 +113,6 @@ static int ams_delta_panel_enable(struct AMS_DELTA_LATCH2_LCD_NDISP); ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_VBLEN, AMS_DELTA_LATCH2_LCD_VBLEN); - - omap_writeb(1, OMAP_PWL_CLK_ENABLE); - omap_writeb(AMS_DELTA_DEFAULT_CONTRAST, OMAP_PWL_ENABLE); - return 0; } @@ -90,8 +152,31 @@ static struct lcd_panel ams_delta_panel .get_caps = ams_delta_panel_get_caps, }; + +/* platform driver section */ + static int ams_delta_panel_probe(struct platform_device *pdev) { + struct lcd_device *lcd_device = NULL; +#ifdef CONFIG_LCD_CLASS_DEVICE + int ret; + + lcd_device = lcd_device_register(omapfb, pdev-dev, NULL, + ams_delta_lcd_ops); + + if (IS_ERR(lcd_device)) { + ret = PTR_ERR(lcd_device); + dev_err(pdev-dev, failed to register device\n); + return ret; + } + + platform_set_drvdata(pdev, lcd_device); + lcd_device-props.max_contrast = AMS_DELTA_MAX_CONTRAST; +#endif + + ams_delta_lcd_set_contrast(lcd_device, AMS_DELTA_DEFAULT_CONTRAST); + ams_delta_lcd_set_power(lcd_device, FB_BLANK_UNBLANK); + omapfb_register_panel(ams_delta_panel); return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] omap3: ehci: Add regulator framework
Ajay -Original Message- From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Gupta, Ajay Kumar Sent: Sunday, November 15, 2009 2:46 AM To: linux-omap@vger.kernel.org Cc: felipe.ba...@nokia.com; broo...@opensource.wolfsonmicro.com; Gupta, Ajay Kumar Subject: [PATCH] omap3: ehci: Add regulator framework snip + /* get ehci regulator and enable */ + for (i = 0 ; i OMAP3_HS_USB_PORTS ; i++) { + if (omap-port_mode[i] != EHCI_HCD_OMAP_MODE_PHY) { + omap-regulator[i] = NULL; + continue; + } + snprintf(supply, sizeof(supply), hsusb%d, i); supply[] being auto variable, is it guaranteed to be null terminated? Suggestion: n = snprintf(supply, sizeof(supply), hsusb%d, i); supply[n] = '\0'; + omap-regulator[i] = regulator_get(omap-dev, supply); + if (IS_ERR(omap-regulator[i])) + dev_dbg(pdev-dev, + failed to get ehci port%d regulator\n, i); + else + regulator_enable(omap-regulator[i]); + } + snip -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/5] AI TB: Always Innovating OMAP3-based Touch Book
This series adds support for the Always Innovating OMAP3-based Touch Book, Grégoire Gentil Gregoire Gentil (5): Defconfig file of the Always Innovating OMAP3-based Touch Book. Board file of the Always Innovating OMAP3-based Touch Book. Driver for the Freescale MMA7455L accelerometer Driver for the Always Innovating Touch Book keyboard. Additional modifications for the Always Innovating OMAP3-based arch/arm/configs/omap3_touchbook_defconfig | 2441 arch/arm/mach-omap2/Kconfig|5 + arch/arm/mach-omap2/Makefile |2 + arch/arm/mach-omap2/board-omap3touchbook.c | 683 drivers/hid/Kconfig|7 + drivers/hid/Makefile |1 + drivers/hid/hid-alwaysinnovating.c | 262 +++ drivers/hid/hid-core.c |1 + drivers/hid/hid-ids.h |3 + drivers/input/misc/Kconfig |9 + drivers/input/misc/Makefile|2 +- drivers/input/misc/mma7455l.c | 625 +++ drivers/video/omap/lcd_omap3touchbook.c| 130 ++ include/linux/mma7455l.h | 11 + sound/soc/omap/Kconfig |8 + sound/soc/omap/Makefile|2 + sound/soc/omap/omap3touchbook.c| 211 +++ 17 files changed, 4402 insertions(+), 1 deletions(-) create mode 100644 arch/arm/configs/omap3_touchbook_defconfig create mode 100644 arch/arm/mach-omap2/board-omap3touchbook.c create mode 100644 drivers/hid/hid-alwaysinnovating.c create mode 100644 drivers/input/misc/mma7455l.c create mode 100644 drivers/video/omap/lcd_omap3touchbook.c create mode 100644 include/linux/mma7455l.h create mode 100644 sound/soc/omap/omap3touchbook.c -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] AI TB: Board file of the Always Innovating OMAP3-based Touch Book.
Board file of the Always Innovating OMAP3-based Touch Book. Signed-off-by: Gregoire Gentil grego...@gentil.com --- arch/arm/mach-omap2/board-omap3touchbook.c | 683 1 files changed, 683 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/board-omap3touchbook.c diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c new file mode 100644 index 000..ad3ef6e --- /dev/null +++ b/arch/arm/mach-omap2/board-omap3touchbook.c @@ -0,0 +1,683 @@ +/* + * linux/arch/arm/mach-omap2/board-omap3touchbook.c + * + * Copyright (C) 2009 Always Innovating + * + * Modified from mach-omap2/board-omap3beagleboard.c + * + * Initial code: Grégoire Gentil, Tim Yamin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/kernel.h +#include linux/init.h +#include linux/platform_device.h +#include linux/delay.h +#include linux/err.h +#include linux/clk.h +#include linux/io.h +#include linux/leds.h +#include linux/gpio.h +#include linux/input.h +#include linux/gpio_keys.h + +#include linux/mtd/mtd.h +#include linux/mtd/partitions.h +#include linux/mtd/nand.h + +#include plat/mcspi.h +#include linux/spi/spi.h + +#include linux/spi/ads7846.h +#include linux/mma7455l.h + +#include plat/dmtimer.h +#include linux/backlight.h + +#include linux/regulator/machine.h +#include linux/i2c/twl4030.h + +#include mach/hardware.h +#include asm/mach-types.h +#include asm/mach/arch.h +#include asm/mach/map.h +#include asm/mach/flash.h + +#include plat/board.h +#include plat/common.h +#include plat/gpmc.h +#include plat/nand.h +#include plat/mux.h +#include plat/usb.h +#include plat/timer-gp.h + +#include mmc-twl4030.h + +#include asm/setup.h + +#define GPMC_CS0_BASE 0x60 +#define GPMC_CS_SIZE 0x30 + +#define NAND_BLOCK_SIZE SZ_128K + +#define OMAP3_AC_GPIO 136 +#define OMAP3_TS_GPIO 162 +#define TB_BL_PWM_TIMER 9 +#define TB_KILL_POWER_GPIO 168 + +unsigned long touchbook_revision; + +static struct mtd_partition omap3touchbook_nand_partitions[] = { + /* All the partition sizes are listed in terms of NAND block size */ + { + .name = X-Loader, + .offset = 0, + .size = 4 * NAND_BLOCK_SIZE, + .mask_flags = MTD_WRITEABLE, /* force read-only */ + }, + { + .name = U-Boot, + .offset = MTDPART_OFS_APPEND, /* Offset = 0x8 */ + .size = 15 * NAND_BLOCK_SIZE, + .mask_flags = MTD_WRITEABLE, /* force read-only */ + }, + { + .name = U-Boot Env, + .offset = MTDPART_OFS_APPEND, /* Offset = 0x26 */ + .size = 1 * NAND_BLOCK_SIZE, + }, + { + .name = Kernel, + .offset = MTDPART_OFS_APPEND, /* Offset = 0x28 */ + .size = 32 * NAND_BLOCK_SIZE, + }, + { + .name = File System, + .offset = MTDPART_OFS_APPEND, /* Offset = 0x68 */ + .size = MTDPART_SIZ_FULL, + }, +}; + +static struct omap_nand_platform_data omap3touchbook_nand_data = { + .options = NAND_BUSWIDTH_16, + .parts = omap3touchbook_nand_partitions, + .nr_parts = ARRAY_SIZE(omap3touchbook_nand_partitions), + .dma_channel = -1, /* disable DMA in OMAP NAND driver */ + .nand_setup = NULL, + .dev_ready = NULL, +}; + +static struct resource omap3touchbook_nand_resource = { + .flags = IORESOURCE_MEM, +}; + +static struct platform_device omap3touchbook_nand_device = { + .name = omap2-nand, + .id = -1, + .dev = { + .platform_data = omap3touchbook_nand_data, + }, + .num_resources = 1, + .resource = omap3touchbook_nand_resource, +}; + +#include sdram-micron-mt46h32m32lf-6.h + +static struct twl4030_hsmmc_info mmc[] = { + { + .mmc = 1, + .wires = 8, + .gpio_wp = 29, + }, + {} /* Terminator */ +}; + +static struct platform_device omap3_touchbook_lcd_device = { + .name = omap3touchbook_lcd, + .id = -1, +}; + +static struct omap_lcd_config omap3_touchbook_lcd_config __initdata = { + .ctrl_name = internal, +}; + +static struct regulator_consumer_supply touchbook_vmmc1_supply = { + .supply = vmmc, +}; + +static struct regulator_consumer_supply touchbook_vsim_supply = { + .supply = vmmc_aux, +}; + +static struct gpio_led gpio_leds[]; + +static int touchbook_twl_gpio_setup(struct device *dev, + unsigned gpio, unsigned ngpio) +{ + if (system_rev = 0x20 system_rev = 0x34301000) { + omap_cfg_reg(AG9_34XX_GPIO23); + mmc[0].gpio_wp = 23; + } else { + omap_cfg_reg(AH8_34XX_GPIO29); + } + /* gpio + 0 is mmc0_cd (input/IRQ) */ + mmc[0].gpio_cd = gpio + 0; + twl4030_mmc_init(mmc); + + /* link regulators to MMC adapters */ + touchbook_vmmc1_supply.dev = mmc[0].dev; + touchbook_vsim_supply.dev = mmc[0].dev; + + /* REVISIT: need ehci-omap hooks for external VBUS + * power switch and overcurrent detect + */ + + gpio_request(gpio + 1, EHCI_nOC); + gpio_direction_input(gpio + 1); + + /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ + gpio_request(gpio + TWL4030_GPIO_MAX, nEN_USB_PWR); + gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); + + /* TWL4030_GPIO_MAX
[PATCH 3/5] AI TB: Driver for the Freescale MMA7455L accelerometer
Driver for the Freescale MMA7455L accelerometer Signed-off-by: Gregoire Gentil grego...@gentil.com --- drivers/input/misc/Kconfig|9 + drivers/input/misc/Makefile |2 +- drivers/input/misc/mma7455l.c | 625 + include/linux/mma7455l.h | 11 + 4 files changed, 646 insertions(+), 1 deletions(-) create mode 100644 drivers/input/misc/mma7455l.c create mode 100644 include/linux/mma7455l.h diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index a9bb254..454bac7 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -317,4 +317,13 @@ config INPUT_PCAP To compile this driver as a module, choose M here: the module will be called pcap_keys. +config INPUT_MMA7455L + tristate Freescale MMA7455L 3-axis accelerometer + depends on SPI_MASTER + help + SPI driver for the Freescale MMA7455L 3-axis accelerometer. + + The userspace interface is a 3-axis (X/Y/Z) relative movement + Linux input device, reporting REL_[XYZ] events. + endif diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index a8b8485..3db6347 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -30,4 +30,4 @@ obj-$(CONFIG_INPUT_WINBOND_CIR) += winbond-cir.o obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o obj-$(CONFIG_INPUT_YEALINK) += yealink.o - +obj-$(CONFIG_INPUT_MMA7455L) += mma7455l.o diff --git a/drivers/input/misc/mma7455l.c b/drivers/input/misc/mma7455l.c new file mode 100644 index 000..771d4b7 --- /dev/null +++ b/drivers/input/misc/mma7455l.c @@ -0,0 +1,625 @@ +/* Linux kernel driver for the Freescale MMA7455L 3-axis accelerometer + * + * Copyright (C) 2009 by Always Innovating, Inc. + * Author: Gregoire Gentil grego...@gentil.com + * Author: Tim Yamin pl...@roo.me.uk + * All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +/* + * What this driver doesn't yet support: + * + * - I2C + * - INT2 handling + * - Pulse detection (and the sysctls to control it) + * - 10-bit measurement + */ + +#include linux/kernel.h +#include linux/types.h +#include linux/module.h +#include linux/device.h +#include linux/platform_device.h +#include linux/delay.h +#include linux/input.h +#include linux/irq.h +#include linux/interrupt.h +#include linux/sysfs.h +#include linux/gpio.h + +#include linux/mma7455l.h +#include linux/spi/spi.h + +#define MMA7455L_WHOAMI_MAGIC 0x55 + +enum mma7455l_reg { + MMA7455L_REG_XOUTL = 0x00, + MMA7455L_REG_XOUTH = 0x01, + MMA7455L_REG_YOUTL = 0x02, + MMA7455L_REG_YOUTH = 0x03, + MMA7455L_REG_ZOUTL = 0x04, + MMA7455L_REG_ZOUTH = 0x05, + MMA7455L_REG_XOUT8 = 0x06, + MMA7455L_REG_YOUT8 = 0x07, + MMA7455L_REG_ZOUT8 = 0x08, + MMA7455L_REG_STATUS = 0x09, + MMA7455L_REG_DETSRC = 0x0a, + MMA7455L_REG_TOUT = 0x0b, + MMA7455L_REG_RESERVED1 = 0x0c, + MMA7455L_REG_I2CAD = 0x0d, + MMA7455L_REG_USRINF = 0x0e, + MMA7455L_REG_WHOAMI = 0x0f, + MMA7455L_REG_XOFFL = 0x10, + MMA7455L_REG_XOFFH = 0x11, + MMA7455L_REG_YOFFL = 0x12, + MMA7455L_REG_YOFFH = 0x13, + MMA7455L_REG_ZOFFL = 0x14, + MMA7455L_REG_ZOFFH = 0x15, + MMA7455L_REG_MCTL = 0x16, + MMA7455L_REG_INTRST = 0x17, + MMA7455L_REG_CTL1 = 0x18, + MMA7455L_REG_CTL2 = 0x19, + MMA7455L_REG_LDTH = 0x1a, + MMA7455L_REG_PDTH = 0x1b, + MMA7455L_REG_PW = 0x1c, + MMA7455L_REG_LT = 0x1d, + MMA7455L_REG_TW = 0x1e, + MMA7455L_REG_RESERVED2 = 0x1f, +}; + +enum mma7455l_reg_status { + MMA7455L_STATUS_XDA = 0x08, + MMA7455L_STATUS_YDA = 0x10, + MMA7455L_STATUS_ZDA = 0x20, +}; + +enum mma7455l_mode { + MMA7455L_MODE_STANDBY = 0, + MMA7455L_MODE_MEASUREMENT = 1, + MMA7455L_MODE_LEVELDETECTION = 0x42, /* Set DRPD to on */ + MMA7455L_MODE_PULSEDETECTION = 0x43, /* Set DRPD to on */ + MMA7455L_MODE_MASK = 0x43, +}; + +enum mma7455l_gselect { + MMA7455L_GSELECT_8 = 0x0, + MMA7455L_GSELECT_2 = 0x4, + MMA7455L_GSELECT_4 = 0x8, + MMA7455L_GSELECT_MASK = 0xC, +}; + +/* FIXME */ +#define MMA7455L_F_FS 0x0020 /* ADC full scale */ + +struct mma7455l_info { + struct spi_device *spi_dev; + struct input_dev *input_dev; + struct mutex lock; + struct delayed_work work; + + u8 mode; + u8 gSelect; + + u8 flags; + u8 working; +}; + +/* lowlevel register access functions */ + +#define WRITE_BIT (1 7) +#define ADDR_SHIFT 1 + +static
[PATCH 4/5] AI TB: Driver for the Always Innovating Touch Book keyboard.
Driver for the Always Innovating Touch Book keyboard. Signed-off-by: Gregoire Gentil grego...@gentil.com --- drivers/hid/Kconfig|7 + drivers/hid/Makefile |1 + drivers/hid/hid-alwaysinnovating.c | 262 drivers/hid/hid-core.c |1 + drivers/hid/hid-ids.h |3 + 5 files changed, 274 insertions(+), 0 deletions(-) create mode 100644 drivers/hid/hid-alwaysinnovating.c diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 24d90ea..b56ddc5 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -62,6 +62,13 @@ config HID_A4TECH ---help--- Support for A4 tech X5 and WOP-35 / Trust 450L mice. +config HID_ALWAYSINNOVATING + tristate Always Innovating if EMBEDDED + depends on USB_HID + default !EMBEDDED + ---help--- + Support for Always Innovating Touch Book. + config HID_APPLE tristate Apple if EMBEDDED depends on (USB_HID || BT_HIDP) diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 0de2dff..b6a2860 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -20,6 +20,7 @@ ifdef CONFIG_LOGIRUMBLEPAD2_FF endif obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o +obj-$(CONFIG_HID_ALWAYSINNOVATING) += hid-alwaysinnovating.o obj-$(CONFIG_HID_APPLE) += hid-apple.o obj-$(CONFIG_HID_BELKIN) += hid-belkin.o obj-$(CONFIG_HID_CHERRY) += hid-cherry.o diff --git a/drivers/hid/hid-alwaysinnovating.c b/drivers/hid/hid-alwaysinnovating.c new file mode 100644 index 000..a7bb0fd --- /dev/null +++ b/drivers/hid/hid-alwaysinnovating.c @@ -0,0 +1,262 @@ +/* + * USB HID quirks support for the Always Innovating Touch Book + * Code borrowed from hid-apple.c + * + * Copyright (c) 2009 Gregoire Gentil grego...@gentil.com + * Copyright (c) 2009 Tim Yamin pl...@roo.me.uk + */ + +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + */ + +#include linux/device.h +#include linux/hid.h +#include linux/module.h +#include linux/usb.h + +#include hid-ids.h + +struct touchbook_sc { + unsigned long quirks; + unsigned int fn_on; + DECLARE_BITMAP(pressed_fn, KEY_CNT); +}; + +struct touchbook_key_translation { + u16 from; + u16 to; + u8 flags; +}; + +static struct touchbook_key_translation touchbook_fn_keys[] = { + { KEY_F6, KEY_BRIGHTNESSDOWN }, + { KEY_F7, KEY_BRIGHTNESSUP }, + + { KEY_F8, KEY_MUTE }, + { KEY_F9, KEY_VOLUMEDOWN }, + { KEY_F10, KEY_VOLUMEUP }, + + { KEY_UP, KEY_PAGEUP }, + { KEY_DOWN, KEY_PAGEDOWN }, + { } +}; + +extern unsigned long touchbook_revision; +unsigned long swap_key; + +static struct touchbook_key_translation *touchbook_find_translation( + struct touchbook_key_translation *table, u16 from) +{ + struct touchbook_key_translation *trans; + + /* Look for the translation */ + for (trans = table; trans-from; trans++) + if (trans-from == from) + return trans; + + return NULL; +} + +static int touchbook_event(struct hid_device *hid, struct hid_field *field, + struct hid_usage *usage, __s32 value) +{ + int do_translate; + + struct input_dev *input = field-hidinput-input; + struct touchbook_sc *asc = hid_get_drvdata(hid); + struct touchbook_key_translation *trans; + + if (swap_key usage-code == KEY_RIGHTSHIFT) { + input_event(input, usage-type, KEY_END, value); + return 1; + } + + if (swap_key usage-code == KEY_END) { + input_event(input, usage-type, KEY_RIGHTSHIFT, value); + return 1; + } + + if (usage-code == KEY_POWER) { + asc-fn_on = !!value; + input_event(input, usage-type, usage-code, value); + return 1; + } + + trans = touchbook_find_translation(touchbook_fn_keys, usage-code); + if (trans) { + if (test_bit(usage-code, asc-pressed_fn)) + do_translate = 1; + else + do_translate = asc-fn_on; + + if (do_translate) { + if (value) + set_bit(usage-code, asc-pressed_fn); + else + clear_bit(usage-code, asc-pressed_fn); + + input_event(input, usage-type, trans-to, + value); + + return 1; + } + } + + return 0; +} + +static int touchbook_input_mapping(struct hid_device *hdev, + struct hid_input *hi, + struct hid_field *field, struct hid_usage *usage, + unsigned long **bit, int *max) +{ + struct touchbook_key_translation *trans; + + /* Enable all other keys */ + for (trans = touchbook_fn_keys; trans-from; trans++) + set_bit(trans-to, hi-input-keybit); + + return 0; +} + +static ssize_t show_swap_key(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return snprintf(buf, PAGE_SIZE, %lu\n, swap_key); +} + +static ssize_t store_swap_key(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + strict_strtoul(buf, 10, swap_key); + + if (swap_key != 0 swap_key != 1) { + swap_key = 0; + return -EINVAL; + } + + return count; +} + +static struct device_attribute touchbook_hid_attrs[] = { + __ATTR(swap_key, S_IRUGO | S_IWUGO, show_swap_key,
[PATCH 5/5] AI TB: Additional modifications for the Always Innovating OMAP3-based Touch Book, including video and sound.
Additional modifications for the Always Innovating OMAP3-based Touch Book, including video and sound. Signed-off-by: Gregoire Gentil grego...@gentil.com --- arch/arm/mach-omap2/Kconfig |5 + arch/arm/mach-omap2/Makefile|2 + drivers/video/omap/lcd_omap3touchbook.c | 130 +++ sound/soc/omap/Kconfig |8 ++ sound/soc/omap/Makefile |2 + sound/soc/omap/omap3touchbook.c | 211 +++ 6 files changed, 358 insertions(+), 0 deletions(-) create mode 100644 drivers/video/omap/lcd_omap3touchbook.c create mode 100644 sound/soc/omap/omap3touchbook.c diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index b25af76..f271383 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -73,6 +73,11 @@ config MACH_OMAP3_PANDORA bool OMAP3 Pandora depends on ARCH_OMAP3 ARCH_OMAP34XX +config MACH_OMAP3_TOUCHBOOK + bool OMAP3 Touch Book + depends on ARCH_OMAP3 ARCH_OMAP34XX + select BACKLIGHT_CLASS_DEVICE + config MACH_OMAP_3430SDP bool OMAP 3430 SDP board depends on ARCH_OMAP3 ARCH_OMAP34XX diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 59b0ccc..b6b5c7f 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -90,6 +90,8 @@ obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o \ mmc-twl4030.o obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \ mmc-twl4030.o +obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \ +mmc-twl4030.o obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o diff --git a/drivers/video/omap/lcd_omap3touchbook.c b/drivers/video/omap/lcd_omap3touchbook.c new file mode 100644 index 000..5b58703 --- /dev/null +++ b/drivers/video/omap/lcd_omap3touchbook.c @@ -0,0 +1,130 @@ +/* + * LCD panel support for the Touch Book + * + * Author: Gregoire Gentil grego...@gentil.com + * + * Derived from drivers/video/omap/lcd-omap3beagle.c + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include linux/module.h +#include linux/platform_device.h +#include linux/gpio.h +#include linux/i2c/twl4030.h + +#include plat/mux.h +#include plat/omapfb.h +#include asm/mach-types.h + +#define LCD_PANEL_ENABLE_GPIO 176 + +static int omap3beagle_panel_init(struct lcd_panel *panel, + struct omapfb_device *fbdev) +{ + gpio_request(LCD_PANEL_ENABLE_GPIO, LCD enable); + return 0; +} + +static void omap3beagle_panel_cleanup(struct lcd_panel *panel) +{ + gpio_free(LCD_PANEL_ENABLE_GPIO); +} + +static int omap3beagle_panel_enable(struct lcd_panel *panel) +{ + gpio_set_value(LCD_PANEL_ENABLE_GPIO, 1); + return 0; +} + +static void omap3beagle_panel_disable(struct lcd_panel *panel) +{ + gpio_set_value(LCD_PANEL_ENABLE_GPIO, 0); +} + +static unsigned long omap3beagle_panel_get_caps(struct lcd_panel *panel) +{ + return 0; +} + +struct lcd_panel omap3beagle_panel = { + .name = omap3beagle, + .config = OMAP_LCDC_PANEL_TFT, + + .bpp = 16, + .data_lines = 24, + .x_res = 1024, + .y_res = 600, + .hsw = 3, + .hfp = 3, + .hbp = 39, + .vsw = 1, + .vfp = 2, + .vbp = 7, + + .pixel_clock = 64000, + + .init = omap3touchbook_panel_init, + .cleanup = omap3touchbook_panel_cleanup, + .enable = omap3touchbook_panel_enable, + .disable = omap3touchbook_panel_disable, + .get_caps = omap3touchbook_panel_get_caps, +}; + +static int omap3touchbook_panel_probe(struct platform_device *pdev) +{ + omapfb_register_panel(omap3beagle_panel); + return 0; +} + +static int omap3touchbook_panel_remove(struct platform_device *pdev) +{ + return 0; +} + +static int omap3touchbook_panel_suspend(struct platform_device *pdev, +pm_message_t mesg) +{ + return 0; +} + +static int omap3touchbook_panel_resume(struct platform_device *pdev) +{ + return 0; +} + +struct platform_driver omap3touchbook_panel_driver = { + .probe = omap3touchbook_panel_probe, + .remove = omap3touchbook_panel_remove, + .suspend = omap3touchbook_panel_suspend, + .resume = omap3touchbook_panel_resume, + .driver = { + .name = omap3touchbook_lcd, + .owner = THIS_MODULE, + }, +}; + +static int __init omap3touchbook_panel_drv_init(void) +{ + return platform_driver_register(omap3beagle_panel_driver); +} + +static void __exit omap3touchbook_panel_drv_exit(void) +{ +
Re: [PATCH 00/19] OMAP: DSS2: Intro
On Wed, 2009-10-07 at 11:57 +0300, Felipe Contreras wrote: On Wed, Sep 30, 2009 at 12:21 PM, Tomi Valkeinen tomi.valkei...@nokia.com wrote: Hi, Andrew, do you have time to check out the DSS2 driver? Or suggestions how should I proceed. I rebased DSS2 on top of today's linux-tree, and there were no conflicts, so the posted patches should apply. But the rebased tree is also available in master branch at git://gitorious.org/linux-omap-dss2/linux.git It's also worth noting that DSS2 is used basically on all linux-omap trees already, I've seen it working at least on N900 and beagleboard and it makes no sense to try to get some video output without it. P.S. I had to patch the beagleboard support from Tomi's 'master-before-squash'... it would be nice to get it upstream already I second Felipe on this one. DSS2 is a very stable and an ideal video driver for OMAP3. Hopefully, it will make upstream soon, Grégoire -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html