HTC Herald various device support
cover HTC Herald various device support
This patch set is an updated version of a series of patches I submitted a while ago. It's built against the latest linux-omap master branch, and removes all defconfig updates. Other comments were put in place as well.
This patch set implements the following drivers and support for them into the HTC Herald:
* MMC card support
* I2C and HTCPLD drivers
* TSC2046 touchscreen support
* Serial port fixes for omap7xx
* Bluetooth common code for HTC omap7xx smartphones
The bluetooth drivers are implemented with the expectation that they will be used by other devices once the board files are submitted (Elf/Elfin, Opal, etc).
Cory Maccarrone (5):
[OMAP] HTCHERALD: MMC, I2C, HTCPLD and related devices [OMAP] htcherald: SPI register config, TSC2046 touchscreen [omap1] omap7xx clocks, mux, serial fixes [omap1] Bluetooth device code common to HTC smartphones [htcherald] Add board support for UARTs, bluetooth
arch/arm/mach-omap1/Kconfig | 2 + arch/arm/mach-omap1/Makefile | 2 +- arch/arm/mach-omap1/board-htcherald.c | 346 ++++++++++++++++++++++++++++- arch/arm/mach-omap1/clock_data.c | 20 ++ arch/arm/mach-omap1/htc-bt.c | 183 +++++++++++++++ arch/arm/mach-omap1/include/mach/htc-bt.h | 22 ++ arch/arm/mach-omap1/mux.c | 4 + arch/arm/mach-omap1/serial.c | 7 + arch/arm/plat-omap/include/plat/mux.h | 4 + 9 files changed, 583 insertions(+), 7 deletions(-) create mode 100644 arch/arm/mach-omap1/htc-bt.c create mode 100644 arch/arm/mach-omap1/include/mach/htc-bt.h
PATCH 1/5 HTCHERALD: MMC, I2C, HTCPLD and related devices
This change adds in MMC and I2C support to the HTC Herald board, as well as adding the HTCPLD driver for the PLD used on this phone. It also adds in the gpio-keys entries for the front directional keys and selector and the cursor keys on the slide-out keyboard, and gpio-leds support for the LEDs attached to the htcpld.
The Kconfig was also modified to add 64 GPIOs and IRQs to the default maximum number of each for the HTC herald. This is needed because the HTCPLD chip on this board exposes an additional 32 gpios and 16 irqs that would not fit in the default limits.
--- arch/arm/mach-omap1/Kconfig | 2 + arch/arm/mach-omap1/board-htcherald.c | 288 ++++++++++++++++++++++++++++++++- 2 files changed, 284 insertions(+), 6 deletions(-)
arch/arm/mach-omap1/Kconfig +2 -0
@@ -64,6 +64,8 @@ config MACH_OMAP_HTCWIZARD config MACH_HERALD bool "HTC Herald" depends on ARCH_OMAP850 + select OMAP_GPIO_EXTRA64 + select OMAP_IRQ_EXTRA64 help HTC Herald smartphone support (AKA T-Mobile Wing, ...)
arch/arm/mach-omap1/board-htcherald.c +282 -6
339 lines not on this page · raw message
Signature · 1 line
1.6.0.4
Tony Lindgren
reviewerPATCH 1/5 HTCHERALD: MMC, I2C, HTCPLD and related devices
Quoted 22 lines · Cory Maccarrone
This change adds in MMC and I2C support to the HTC Herald board, as well as adding the HTCPLD driver for the PLD used on this phone. It also adds in the gpio-keys entries for the front directional keys and selector and the cursor keys on the slide-out keyboard, and gpio-leds support for the LEDs attached to the htcpld.
The
Kconfigwas also modified to add 64 GPIOs and IRQs to the default maximum number of each for the HTC herald. This is needed because the HTCPLD chip on this board exposes an additional 32 gpios and 16 irqs that would not fit in the default limits.Signed-off-by Cory Maccarrone <[email protected]>--- arch/arm/mach-omap1/Kconfig | 2 + arch/arm/mach-omap1/board-htcherald.c | 288 ++++++++++++++++++++++++++++++++- 2 files changed, 284 insertions(+), 6 deletions(-)arch/arm/mach-omap1/Kconfig +0
-0
arch/arm/mach-omap1/Kconfig config MACH_OMAP_HTCWIZARD · line 71
Quoted 8 lines
arch/arm/mach-omap1/Kconfig +2
-0@@ -64,6 +64,8 @@ config MACH_OMAP_HTCWIZARD config MACH_HERALD bool "HTC Herald" depends on ARCH_OMAP850 + select OMAP_GPIO_EXTRA64 + select OMAP_IRQ_EXTRA64 help HTC Herald smartphone support (AKA T-Mobile Wing, ...)
Looking at this patches again.. These above does not exist in the mainline kernel.
Quoted 48 lines
arch/arm/mach-omap1/Kconfig +48
-0+/* HTCPLD definitions */ + +/* + * CPLD Logic + * + +Chip 3 - 0x03 + +Function 7 6 5 4 3 2 1 0 +------------------------------------ +DPAD light x x x x x x x 1 +SoundDev x x x x 1 x x x +Screen white 1 x x x x x x x +MMC power on x x x x x 1 x x +Happy times (n) 0 x x x x 1 x x + +Chip 4 - 0x04 + +Function 7 6 5 4 3 2 1 0 +------------------------------------ +Keyboard light x x x x x x x 1 +LCD Bright (4) x x x x x 1 1 x +LCD Bright (3) x x x x x 0 1 x +LCD Bright (2) x x x x x 1 0 x +LCD Bright (1) x x x x x 0 0 x +LCD Off x x x x 0 x x x +LCD image (fb) 1 x x x x x x x +LCD image (white) 0 x x x x x x x +Caps lock LED x x 1 x x x x x + +Chip 5 - 0x05 + +Function 7 6 5 4 3 2 1 0 +------------------------------------ +Red (solid) x x x x x 1 x x +Red (flash) x x x x x x 1 x +Green (GSM flash) x x x x 1 x x x +Green (GSM solid) x x x 1 x x x x +Green (wifi flash) x x 1 x x x x x +Blue (bt flash) x 1 x x x x x x +DPAD Int Enable 1 x x x x x x 0 + +(Combinations of the above can be made for different colors.) +The direction pad interrupt enable must be set each time the +interrupt is handled. + +Chip 6 - 0x06 +
arch/arm/mach-omap1/Kconfig
Quoted 10 lines
arch/arm/mach-omap1/Kconfig +10
-0+Function 7 6 5 4 3 2 1 0 +------------------------------------ +Vibrator x x x x 1 x x x +Alt LED x x x 1 x x x x +Screen white 1 x x x x x x x +Screen white x x 1 x x x x x +Screen white x 0 x x x x x x +Enable kbd dpad x x x x x x 0 x +Happy Times 0 1 0 x x x 0 x +*/
/*
* Please put the above into standard comments like
* this thanks
*/
Other than that, looks good to me. Have to leave this to the next merge window though.
Regards,
Tony
PATCH v2 1/5 HTCHERALD: MMC, I2C, HTCPLD and related devices
This change adds in MMC and I2C support to the HTC Herald board, as well as adding the HTCPLD driver for the PLD used on this phone. It also adds in the gpio-keys entries for the front directional keys and selector and the cursor keys on the slide-out keyboard, and gpio-leds support for the LEDs attached to the htcpld.
--- arch/arm/mach-omap1/board-htcherald.c | 287 ++++++++++++++++++++++++++++++++- 1 files changed, 281 insertions(+), 6 deletions(-)
The HTCPLD driver in this patch currently won't work because of the currently hard-coded maximum limit of IRQs and GPIOs for omap1 devices. This would either need to be increased, or redone somehow. This patch doesn't address that, as I've been told that something to address this is coming soon.
arch/arm/mach-omap1/board-htcherald.c +281 -6
@@ -30,6 +30,11 @@#include <linux/input.h> #include <linux/io.h> #include <linux/gpio.h> +#include <linux/gpio_keys.h> +#include <linux/i2c.h> +#include <linux/i2c-gpio.h> +#include <linux/htcpld.h> +#include <linux/leds.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -39,6 +44,7 @@#include <plat/board.h> #include <plat/keypad.h> #include <plat/usb.h> +#include <plat/mmc.h> #include <mach/irqs.h>
@@ -52,13 +58,120 @@#define OMAP_LCDC_CTRL_LCD_EN (1 << 0)#define OMAP_LCDC_STAT_DONE (1 << 0) -static struct omap_lcd_config htcherald_lcd_config__initdata = { - .ctrl_name ="internal" , -}; +/* GPIO definitions for the power button and keyboard slide switch */ +#define HTCHERALD_GPIO_POWER 139 +#define HTCHERALD_GPIO_SLIDE 174 +#define HTCHERALD_GIRQ_BTNS 141 -static struct omap_board_config_kernel htcherald_config[]__initdata = { - {OMAP_TAG_LCD , &htcherald_lcd_config }, -}; +/* HTCPLD definitions */ + +/* +* CPLD Logic +* +* Chip 3 - 0x03 +* +* Function 7 6 5 4 3 2 1 0 +* ------------------------------------ +* DPAD light x x x x x x x 1 +* SoundDev x x x x 1 x x x +* Screen white 1 x x x x x x x +* MMC power on x x x x x 1 x x +* Happy times (n) 0 x x x x 1 x x +* +* Chip 4 - 0x04 +* +* Function 7 6 5 4 3 2 1 0 +* ------------------------------------ +* Keyboard light x x x x x x x 1 +* LCD Bright (4) x x x x x 1 1 x +* LCD Bright (3) x x x x x 0 1 x +* LCD Bright (2) x x x x x 1 0 x +* LCD Bright (1) x x x x x 0 0 x +* LCD Off x x x x 0 x x x +* LCD image (fb) 1 x x x x x x x +* LCD image (white) 0 x x x x x x x +* Caps lock LED x x 1 x x x x x +* +* Chip 5 - 0x05 +* +* Function 7 6 5 4 3 2 1 0 +* ------------------------------------ +* Red (solid) x x x x x 1 x x +* Red (flash) x x x x x x 1 x +* Green (GSM flash) x x x x 1 x x x +* Green (GSM solid) x x x 1 x x x x +* Green (wifi flash) x x 1 x x x x x +* Blue (bt flash) x 1 x x x x x x +* DPAD Int Enable 1 x x x x x x 0 +* +* (Combinations of the above can be made for different colors.) +* The direction pad interrupt enable must be set each time the +* interrupt is handled. +* +* Chip 6 - 0x06 +* +* Function 7 6 5 4 3 2 1 0 +* ------------------------------------ +* Vibrator x x x x 1 x x x +* Alt LED x x x 1 x x x x +* Screen white 1 x x x x x x x +* Screen white x x 1 x x x x x +* Screen white x 0 x x x x x x +* Enable kbd dpad x x x x x x 0 x +* Happy Times 0 1 0 x x x 0 x +*/ + +/* +* HTCPLD GPIO lines start 16 after OMAP_MAX_GPIO_LINES to account +* for the 16 MPUIO lines. +*/ +#define HTCPLD_GPIO_START_OFFSET (OMAP_MAX_GPIO_LINES + 16) +#define HTCPLD_IRQ (chip, offset) (OMAP_IRQ_END + 8 * (chip) + (offset)) +#define HTCPLD_BASE (chip, offset) \ + (HTCPLD_GPIO_START_OFFSET + 8 * (chip) + (offset)) + +#define HTCPLD_GPIO_LED_DPAD HTCPLD_BASE(0, 0) +#define HTCPLD_GPIO_LED_KBD HTCPLD_BASE(1, 0) +#define HTCPLD_GPIO_LED_CAPS HTCPLD_BASE(1, 5) +#define HTCPLD_GPIO_LED_RED_FLASH HTCPLD_BASE(2, 1) +#define HTCPLD_GPIO_LED_RED_SOLID HTCPLD_BASE(2, 2) +#define HTCPLD_GPIO_LED_GREEN_FLASH HTCPLD_BASE(2, 3) +#define HTCPLD_GPIO_LED_GREEN_SOLID HTCPLD_BASE(2, 4) +#define HTCPLD_GPIO_LED_WIFI HTCPLD_BASE(2, 5) +#define HTCPLD_GPIO_LED_BT HTCPLD_BASE(2, 6) +#define HTCPLD_GPIO_LED_VIBRATE HTCPLD_BASE(3, 3) +#define HTCPLD_GPIO_LED_ALT HTCPLD_BASE(3, 4) + +#define HTCPLD_GPIO_RIGHT_KBD HTCPLD_BASE(6, 7) +#define HTCPLD_GPIO_UP_KBD HTCPLD_BASE(6, 6) +#define HTCPLD_GPIO_LEFT_KBD HTCPLD_BASE(6, 5) +#define HTCPLD_GPIO_DOWN_KBD HTCPLD_BASE(6, 4) + +#define HTCPLD_GPIO_RIGHT_DPAD HTCPLD_BASE(7, 7) +#define HTCPLD_GPIO_UP_DPAD HTCPLD_BASE(7, 6) +#define HTCPLD_GPIO_LEFT_DPAD HTCPLD_BASE(7, 5) +#define HTCPLD_GPIO_DOWN_DPAD HTCPLD_BASE(7, 4) +#define HTCPLD_GPIO_ENTER_DPAD HTCPLD_BASE(7, 3) + +/* +* The htcpld chip requires a gpio write to a specific line +* to re-enable interrupts after one has occurred. +*/ +#define HTCPLD_GPIO_INT_RESET_HI HTCPLD_BASE(2, 7) +#define HTCPLD_GPIO_INT_RESET_LO HTCPLD_BASE(2, 0) + +/* Chip 5 */ +#define HTCPLD_IRQ_RIGHT_KBD HTCPLD_IRQ(0, 7) +#define HTCPLD_IRQ_UP_KBD HTCPLD_IRQ(0, 6) +#define HTCPLD_IRQ_LEFT_KBD HTCPLD_IRQ(0, 5) +#define HTCPLD_IRQ_DOWN_KBD HTCPLD_IRQ(0, 4) + +/* Chip 6 */ +#define HTCPLD_IRQ_RIGHT_DPAD HTCPLD_IRQ(1, 7) +#define HTCPLD_IRQ_UP_DPAD HTCPLD_IRQ(1, 6) +#define HTCPLD_IRQ_LEFT_DPAD HTCPLD_IRQ(1, 5) +#define HTCPLD_IRQ_DOWN_DPAD HTCPLD_IRQ(1, 4) +#define HTCPLD_IRQ_ENTER_DPAD HTCPLD_IRQ(1, 3)/* Keyboard definition */
@@ -140,6 +253,129 @@ static struct platform_device kp_device = { .resource = kp_resources, }; +/* GPIO buttons for keyboard slide and power button */ +static struct gpio_keys_button herald_gpio_keys_table[] = { + {BTN_0 ,HTCHERALD_GPIO_POWER ,1 ,"POWER" ,EV_KEY ,1 ,20 }, + {SW_LID ,HTCHERALD_GPIO_SLIDE ,0 ,"SLIDE" ,EV_SW ,1 ,20 }, + + {KEY_LEFT ,HTCPLD_GPIO_LEFT_KBD ,1 ,"LEFT" ,EV_KEY ,1 ,20 }, + {KEY_RIGHT ,HTCPLD_GPIO_RIGHT_KBD ,1 ,"RIGHT" ,EV_KEY ,1 ,20 }, + {KEY_UP ,HTCPLD_GPIO_UP_KBD ,1 ,"UP" ,EV_KEY ,1 ,20 }, + {KEY_DOWN ,HTCPLD_GPIO_DOWN_KBD ,1 ,"DOWN" ,EV_KEY ,1 ,20 }, + + {KEY_LEFT ,HTCPLD_GPIO_LEFT_DPAD ,1 ,"DLEFT" ,EV_KEY ,1 ,20 }, + {KEY_RIGHT ,HTCPLD_GPIO_RIGHT_DPAD ,1 ,"DRIGHT" ,EV_KEY ,1 ,20 }, + {KEY_UP ,HTCPLD_GPIO_UP_DPAD ,1 ,"DUP" ,EV_KEY ,1 ,20 }, + {KEY_DOWN ,HTCPLD_GPIO_DOWN_DPAD ,1 ,"DDOWN" ,EV_KEY ,1 ,20 }, + {KEY_ENTER ,HTCPLD_GPIO_ENTER_DPAD ,1 ,"DENTER" ,EV_KEY ,1 ,20 }, +}; + +static struct gpio_keys_platform_data herald_gpio_keys_data = { + .buttons = herald_gpio_keys_table, + .nbuttons =ARRAY_SIZE (herald_gpio_keys_table), + .rep =1 , +}; + +static struct platform_device herald_gpiokeys_device = { + .name ="gpio-keys" , + .id =-1 , + .dev = { + .platform_data = &herald_gpio_keys_data, + }, +}; + +/* LEDs for the Herald. These connect to the HTCPLD GPIO device. */ +static struct gpio_led gpio_leds[] = { + {"dpad" ,NULL ,HTCPLD_GPIO_LED_DPAD ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"kbd" ,NULL ,HTCPLD_GPIO_LED_KBD ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"vibrate" ,NULL ,HTCPLD_GPIO_LED_VIBRATE ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"green_solid" ,NULL ,HTCPLD_GPIO_LED_GREEN_SOLID ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"green_flash" ,NULL ,HTCPLD_GPIO_LED_GREEN_FLASH ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"red_solid" ,"mmc0" ,HTCPLD_GPIO_LED_RED_SOLID ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"red_flash" ,NULL ,HTCPLD_GPIO_LED_RED_FLASH ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"wifi" ,NULL ,HTCPLD_GPIO_LED_WIFI ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"bt" ,NULL ,HTCPLD_GPIO_LED_BT ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"caps" ,NULL ,HTCPLD_GPIO_LED_CAPS ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, + {"alt" ,NULL ,HTCPLD_GPIO_LED_ALT ,0 ,0 ,LEDS_GPIO_DEFSTATE_OFF }, +}; + +static struct gpio_led_platform_data gpio_leds_data = { + .leds = gpio_leds, + .num_leds =ARRAY_SIZE (gpio_leds), +}; + +static struct platform_device gpio_leds_device = { + .name ="leds-gpio" , + .id =0 , + .dev = { + .platform_data = &gpio_leds_data, + }, +}; + +/* HTC PLD chips */ + +static struct resource htcpld_resources[] = { + [0 ] = { + .start =OMAP_GPIO_IRQ (HTCHERALD_GIRQ_BTNS ), + .end =OMAP_GPIO_IRQ (HTCHERALD_GIRQ_BTNS ), + .flags =IORESOURCE_IRQ , + }, +}; + +struct htcpld_chip_platform_data htcpld_chips[] = { + [0 ] = { + .addr =0x03 , + .reset =0x04 , + .num_gpios =8 , + .gpio_out_base =HTCPLD_BASE (0 ,0 ), + .gpio_in_base =HTCPLD_BASE (4 ,0 ), + }, + [1 ] = { + .addr =0x04 , + .reset =0x8e , + .num_gpios =8 , + .gpio_out_base =HTCPLD_BASE (1 ,0 ), + .gpio_in_base =HTCPLD_BASE (5 ,0 ), + }, + [2 ] = { + .addr =0x05 , + .reset =0x80 , + .num_gpios =8 , + .gpio_out_base =HTCPLD_BASE (2 ,0 ), + .gpio_in_base =HTCPLD_BASE (6 ,0 ), + .irq_base =HTCPLD_IRQ (0 ,0 ), + .num_irqs =8 , + }, + [3 ] = { + .addr =0x06 , + .reset =0x40 , + .num_gpios =8 , + .gpio_out_base =HTCPLD_BASE (3 ,0 ), + .gpio_in_base =HTCPLD_BASE (7 ,0 ), + .irq_base =HTCPLD_IRQ (1 ,0 ), + .num_irqs =8 , + }, +}; + +struct htcpld_core_platform_data htcpld_pfdata = { + .int_reset_gpio_hi =HTCPLD_GPIO_INT_RESET_HI , + .int_reset_gpio_lo =HTCPLD_GPIO_INT_RESET_LO , + .i2c_adapter_id =1 , + + .chip = htcpld_chips, + .num_chip =ARRAY_SIZE (htcpld_chips), +}; + +static struct platform_device htcpld_device = { + .name ="i2c-htcpld" , + .id =-1 , + .resource = htcpld_resources, + .num_resources =ARRAY_SIZE (htcpld_resources), + .dev = { + .platform_data = &htcpld_pfdata, + }, +}; +/* USB Device */ static struct omap_usb_config htcherald_usb_config__initdata = { .otg =0 ,
@@ -150,14 +386,45 @@ static struct omap_usb_config htcherald_usb_config __initdata = { };/* LCD Device resources */ +static struct omap_lcd_config htcherald_lcd_config__initdata = { + .ctrl_name ="internal" , +}; + +static struct omap_board_config_kernel htcherald_config[]__initdata = { + {OMAP_TAG_LCD , &htcherald_lcd_config }, +}; +static struct platform_device lcd_device = { .name ="lcd_htcherald" , .id =-1 , }; +/* MMC Card */ +#if defined(CONFIG_MMC_OMAP ) || defined(CONFIG_MMC_OMAP_MODULE ) +static struct omap_mmc_platform_data htc_mmc1_data = { + .nr_slots =1 , + .switch_slot =NULL , + .slots[0 ] = { + .ocr_mask =MMC_VDD_28_29 |MMC_VDD_30_31 | +MMC_VDD_32_33 |MMC_VDD_33_34 , + .name ="mmcblk" , + .nomux =1 , + .wires =4 , + .switch_pin =-1 , + }, +}; + +static struct omap_mmc_platform_data *htc_mmc_data[1 ]; +#endif + + +/* Platform devices for the Herald */ static struct platform_device *devices[]__initdata = { &kp_device, &lcd_device, + &htcpld_device, + &gpio_leds_device, + &herald_gpiokeys_device, };/*
@@ -278,6 +545,7 @@ static void __init htcherald_init(void) {printk (KERN_INFO "HTC Herald init.\n" ); +/* Do board initialization before we register all the devices */ omap_gpio_init (); omap_board_config = htcherald_config;
@@ -288,6 +556,13 @@ static void __init htcherald_init(void)htcherald_usb_enable ();omap1_usb_init (&htcherald_usb_config); + +omap_register_i2c_bus (1 ,100 ,NULL ,0 ); + +#if defined(CONFIG_MMC_OMAP ) || defined(CONFIG_MMC_OMAP_MODULE ) + htc_mmc_data[0 ] = &htc_mmc1_data; +omap1_init_mmc (htc_mmc_data,1 ); +#endif }static void __init htcherald_init_irq (void )
Signature · 1 line
1.7.0.4
PATCH 2/5 htcherald: SPI register config, TSC2046 touchscreen
In reply to Cory MaccarroneThis change adds SPI bus support for the HTC Herald, and adds in support for the TSC2046-based touchscreen attached to this device (using the ADS7846 driver).
--- arch/arm/mach-omap1/board-htcherald.c | 35 +++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-)
arch/arm/mach-omap1/board-htcherald.c +35 -0
@@ -35,6 +35,8 @@#include <linux/i2c-gpio.h> #include <linux/htcpld.h> #include <linux/leds.h> +#include <linux/spi/spi.h> +#include <linux/spi/ads7846.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -63,6 +65,9 @@#define HTCHERALD_GPIO_SLIDE 174#define HTCHERALD_GIRQ_BTNS 141 +/* GPIO definitions for the touchscreen */ +#define HTCHERALD_GPIO_TS 76 +/* HTCPLD definitions */ /*
@@ -429,6 +434,33 @@ static struct platform_device *devices[] __initdata = { };/* +* Touchscreen +*/ +static const struct ads7846_platform_data htcherald_ts_platform_data = { + .model =7846 , + .keep_vref_on =1 , + .x_plate_ohms =496 , + .gpio_pendown =HTCHERALD_GPIO_TS , + .pressure_max =100000 , + .pressure_min =5000 , + .x_min =528 , + .x_max =3760 , + .y_min =624 , + .y_max =3760 , +}; + +static struct spi_board_info __initdata htcherald_spi_board_info[] = { + { + .modalias ="ads7846" , + .platform_data = &htcherald_ts_platform_data, + .irq =OMAP_GPIO_IRQ (HTCHERALD_GPIO_TS ), + .max_speed_hz =2500000 , + .bus_num =2 , + .chip_select =1 , + } +}; + +/* * Init functions from here on */
@@ -558,6 +590,9 @@ static void __init htcherald_init(void)htcherald_usb_enable ();omap1_usb_init (&htcherald_usb_config); +spi_register_board_info (htcherald_spi_board_info, +ARRAY_SIZE (htcherald_spi_board_info)); +omap_register_i2c_bus (1 ,100 ,NULL ,0 );#if defined(CONFIG_MMC_OMAP ) || defined(CONFIG_MMC_OMAP_MODULE )
Signature · 1 line
1.6.0.4
Tony Lindgren
reviewerPATCH 2/5 htcherald: SPI register config, TSC2046 touchscreen
Quoted 3 lines · Cory Maccarrone
This change adds SPI bus support for the HTC Herald, and adds in support for the TSC2046-based touchscreen attached to this device (using the ADS7846 driver).
This looks OK to me, but unfortunately does not apply without 1/5.
Regards,
Tony
PATCH 3/5 omap7xx clocks, mux, serial fixes
In reply to Cory MaccarroneThis change adds in the necessary clocks and mux pins for UART control on omap7xx devices. I also made a change in the serial code to only try and initialize two UARTs in omap_serial_init, as these devices don't have three.
--- arch/arm/mach-omap1/clock_data.c | 20 ++++++++++++++++++++ arch/arm/mach-omap1/mux.c | 4 ++++ arch/arm/mach-omap1/serial.c | 7 +++++++ arch/arm/plat-omap/include/plat/mux.h | 4 ++++ 4 files changed, 35 insertions(+), 0 deletions(-)
arch/arm/mach-omap1/clock_data.c +20 -0
@@ -551,6 +551,24 @@ static struct clk usb_dc_ck7xx = { .enable_bit = SOFT_USB_OTG_DPLL_REQ_SHIFT, }; +static struct clk uart1_7xx = { + .name ="uart1_ck" , + .ops = &clkops_generic, +/* Direct from ULPD, no parent */ + .rate =12000000 , + .enable_reg =OMAP1_IO_ADDRESS (SOFT_REQ_REG ), + .enable_bit =9 , +}; + +static struct clk uart2_7xx = { + .name ="uart2_ck" , + .ops = &clkops_generic, +/* Direct from ULPD, no parent */ + .rate =12000000 , + .enable_reg =OMAP1_IO_ADDRESS (SOFT_REQ_REG ), + .enable_bit =11 , +}; +static struct clk mclk_1510 = { .name ="mclk" , .ops = &clkops_generic,
@@ -697,7 +715,9 @@ static struct omap_clk omap_clks[] = {/* ULPD clocks */ CLK (NULL ,"uart1_ck" , &uart1_1510,CK_1510 |CK_310 ),CLK (NULL ,"uart1_ck" , &uart1_16xx.clk,CK_16XX ), +CLK (NULL ,"uart1_ck" , &uart1_7xx,CK_7XX ),CLK (NULL ,"uart2_ck" , &uart2_ck,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"uart2_ck" , &uart2_7xx,CK_7XX ),CLK (NULL ,"uart3_ck" , &uart3_1510,CK_1510 |CK_310 ),CLK (NULL ,"uart3_ck" , &uart3_16xx.clk,CK_16XX ), CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310),
arch/arm/mach-omap1/mux.c +4 -0
@@ -70,6 +70,10 @@ MUX_CFG_7XX("SPI_7XX_3", 6, 13, 4, 12, 1, 0) MUX_CFG_7XX("SPI_7XX_4", 6, 17, 4, 16, 1, 0) MUX_CFG_7XX("SPI_7XX_5", 8, 25, 0, 24, 0, 0)MUX_CFG_7XX ("SPI_7XX_6" ,9 ,5 ,0 ,4 ,0 ,0 ) + +/* UART pins */ +MUX_CFG_7XX("UART_7XX_1", 3, 21, 0, 20, 0, 0) +MUX_CFG_7XX ("UART_7XX_2" ,8 ,1 ,6 ,0 ,0 ,0 ) };#define OMAP7XX_PINS_SZ ARRAY_SIZE(omap7xx_pins)#else
arch/arm/mach-omap1/serial.c +7 -0
@@ -122,6 +122,13 @@ void __init omap_serial_init(void)for (i =0 ; i <ARRAY_SIZE (serial_platform_data) -1 ; i++) { +/* Don't look@UARTs higher than 2 for omap7xx */ +if (cpu_is_omap7xx () && i >1 ) { + serial_platform_data[i].membase =NULL ; + serial_platform_data[i].mapbase =0 ; +continue ; + } +/* Static mapping, never released */ serial_platform_data[i].membase =ioremap (serial_platform_data[i].mapbase,SZ_2K );
arch/arm/plat-omap/include/plat/mux.h +4 -0
@@ -173,6 +173,10 @@ enum omap7xx_index {SPI_7XX_4 ,SPI_7XX_5 ,SPI_7XX_6 , + +/* UART */ +UART_7XX_1 , + UART_7XX_2, }; enum omap1xxx_index {
Signature · 1 line
1.6.0.4
Tony Lindgren
reviewerPATCH 3/5 omap7xx clocks, mux, serial fixes
Quoted 4 lines · Cory Maccarrone
This change adds in the necessary clocks and mux pins for UART control on omap7xx devices. I also made a change in the serial code to only try and initialize two UARTs in
omap_serial_init, as these devices don't have three.
This I have already queued up in omap-for-linus.
Regards,
Tony
PATCH 4/5 Bluetooth device code common to HTC smartphones
In reply to Cory MaccarroneThis change adds in a bluetooth controld driver/rfkill interface to the serial bluetooth controller found on many HTC smartphones such as the HTC Herald and HTC Wizard.
--- arch/arm/mach-omap1/htc-bt.c | 183 +++++++++++++++++++++++++++++ arch/arm/mach-omap1/include/mach/htc-bt.h | 22 ++++ 2 files changed, 205 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/htc-bt.c create mode 100644 arch/arm/mach-omap1/include/mach/htc-bt.h
arch/arm/mach-omap1/htc-bt.c new file +183 -0
@@ -0,0 +1,183 @@ +/* +* Bluetooth built-in chip control +* +* Copyright (c) 2010 Cory Maccarrone +* Based on tosa-bt.c copyright (c) 2008 Dmitry Baryshkov +* +* 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/module.h> +#include <linux/platform_device.h> +#include <linux/gpio.h> +#include <linux/delay.h> +#include <linux/rfkill.h> +#include <linux/clk.h> + +#include <plat/mux.h> + +#include <mach/htc-bt.h> + +static struct clk *uart_ck; + +static void htc_bt_on (struct htc_bt_data *data) +{ +gpio_set_value (data->gpio_pwr,1 ); + +if (uart_ck) +clk_enable (uart_ck); + +msleep (1000 ); + +if (data->gpio_enable) +gpio_set_value (data->gpio_enable,1 ); +} + +static void htc_bt_off (struct htc_bt_data *data) +{ +gpio_set_value (data->gpio_pwr,0 ); + +if (uart_ck) +clk_disable (uart_ck); + +msleep (1000 ); + +if (data->gpio_enable) +gpio_set_value (data->gpio_enable,0 ); +} + +static int htc_bt_set_block (void *data,bool blocked) +{ +if (!blocked) +htc_bt_on (data); +else +htc_bt_off (data); + +return 0 ; +} + +static const struct rfkill_ops htc_bt_rfkill_ops = { + .set_block = htc_bt_set_block, +}; + +static int htc_bt_probe (struct platform_device *dev) +{ +int rc; +struct rfkill *rfk; + +struct htc_bt_data *data = dev->dev.platform_data; + +/* Configure the GPIOs */ +if (data->gpio_enable) { + rc =gpio_request (data->gpio_enable,"Bluetooth enable" ); +if (rc) + goto err_enable; + rc =gpio_direction_output (data->gpio_enable,0 ); +if (rc) + goto err_enable_dir; + } + + rc =gpio_request (data->gpio_pwr,"Bluetooth power" ); +if (rc) + goto err_pwr; + rc =gpio_direction_output (data->gpio_pwr,0 ); +if (rc) + goto err_pwr_dir; + +/* Get the clocks */ +if (data->uart_clock !=NULL ) { + uart_ck =clk_get (NULL , data->uart_clock); +if (IS_ERR (uart_ck)) { +pr_warn ("htc-bt: Could not get uart clock\n" ); + uart_ck =NULL ; + }else +clk_disable (uart_ck); + }else + uart_ck =NULL ; + +/* MUX pins for UART */ +omap_cfg_reg (UART_7XX_1 ); +omap_cfg_reg (UART_7XX_2 ); + +/* Configure RFKill */ + rfk =rfkill_alloc ("htc-bt" , &dev->dev,RFKILL_TYPE_BLUETOOTH , + &htc_bt_rfkill_ops, data); +if (!rfk) { + rc = -ENOMEM ; + goto err_rfk_alloc; + } + +rfkill_set_led_trigger_name (rfk,"htc-bt" ); + + rc =rfkill_register (rfk); +if (rc) + goto err_rfkill; + +platform_set_drvdata (dev, rfk); + +return 0 ; + +err_rfkill: +rfkill_destroy (rfk); +err_rfk_alloc: +htc_bt_off (data); +err_pwr_dir: +gpio_free (data->gpio_pwr); +err_pwr: +err_enable_dir: +if (data->gpio_enable) +gpio_free (data->gpio_enable); +err_enable: +return rc; +} + +static int __devexit htc_bt_remove(struct platform_device *dev) +{ +struct htc_bt_data *data = dev->dev.platform_data; +struct rfkill *rfk =platform_get_drvdata (dev); + +platform_set_drvdata (dev,NULL ); + +if (rfk) { +rfkill_unregister (rfk); +rfkill_destroy (rfk); + } + rfk =NULL ; + +htc_bt_off (data); + +gpio_free (data->gpio_pwr); +if (data->gpio_enable) +gpio_free (data->gpio_enable); + +return 0 ; +} + +static struct platform_driver htc_bt_driver = { + .probe = htc_bt_probe, + .remove =__devexit_p (htc_bt_remove), + + .driver = { + .name ="htc-bt" , + .owner =THIS_MODULE , + }, +}; + + +static int __init htc_bt_init (void ) +{ +return platform_driver_register (&htc_bt_driver); +} + +static void __exit htc_bt_exit(void) +{ +platform_driver_unregister (&htc_bt_driver); +} + +late_initcall (htc_bt_init); +module_exit (htc_bt_exit); +
arch/arm/mach-omap1/include/mach/htc-bt.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* HTC bluetooth built-in chip control. +* +* Copyright (C) 2010 Cory Maccarrone +* Based on tosa_bt.h copyright (c) 2008 Dmitry Baryshkov +* +* 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. +* +*/ +#ifndef HTC_BT_H +#define HTC_BT_H + +struct htc_bt_data { +const char *uart_clock; +int gpio_pwr; +int gpio_enable; +}; + +#endif +
Signature · 1 line
1.6.0.4
Tony Lindgren
reviewerPATCH 4/5 Bluetooth device code common to HTC smartphones
Quoted 3 lines · Cory Maccarrone
This change adds in a bluetooth controld driver/rfkill interface to the serial bluetooth controller found on many HTC smartphones such as the HTC Herald and HTC Wizard.
To me it looks like most of this should be in drivers/bluetooth/omap7xx.c or something like that. Then you can just pass it the gpio numbers in the platform_data.
Regards,
Tony
PATCH 4/5 Bluetooth device code common to HTC smartphones
Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Cory Maccarrone
This change adds in a bluetooth controld driver/rfkill interface to the serial bluetooth controller found on many HTC smartphones such as the HTC Herald and HTC Wizard.
To me it looks like most of this should be in
drivers/bluetooth/omap7xx.cor something like that. Then you can just pass it the gpio numbers in theplatform_data.
Not sure I agree that it fits there. The driver isn't really a bluetooth driver -- it's really just an RFKILL interface, and some code to toggle UART clocks on and off, plus GPIO work on a board-specific level. In principle, the gpios could be set and the clocks enabled in the board files, and this driver wouldn't be necessary to get working bluetooth (as we'd use hciattach on /dev/ttyS*). But then, we can't toggle it off for power saving. Maybe a better place would be plat-omap/? But it really is more specific to these HTC boards, not the architecture itself.
So really, the only point of this driver is to be able to power on and off the external bluetooth chip, which is why I submitted it as helper code to the board files.
- Cory
Tony Lindgren
reviewerPATCH 4/5 Bluetooth device code common to HTC smartphones
Quoted 11 lines · Cory Maccarrone
Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Cory Maccarrone
This change adds in a bluetooth controld driver/rfkill interface to the serial bluetooth controller found on many HTC smartphones such as the HTC Herald and HTC Wizard.
To me it looks like most of this should be in
drivers/bluetooth/omap7xx.cor something like that. Then you can just pass it the gpio numbers in theplatform_data.
Quoted 9 lines
Not sure I agree that it fits there. The driver isn't really a bluetooth driver -- it's really just an RFKILL interface, and some code to toggle UART clocks on and off, plus GPIO work on a board-specific level. In principle, the gpios could be set and the clocks enabled in the board files, and this driver wouldn't be necessary to get working bluetooth (as we'd use hciattach on
/dev/ttyS*). But then, we can't toggle it off for power saving. Maybe a better place would be plat-omap/? But it really is more specific to these HTC boards, not the architecture itself.
Hmm well what we've used earlier is to set something like set_power function pointer in the platform data, then call that in the driver if set. But in this case the driver is 8250.c, so let's not mess with that..
This issue should get properly solved with the omap specific serial driver once we get that merged as then we can have hooks for set_power in addition to cutting serial clocks when idle.
Quoted 3 lines
So really, the only point of this driver is to be able to power on and off the external bluetooth chip, which is why I submitted it as helper code to the board files.
Yeah. Can you take a look at the omap specific serial driver to get it working on omap1?
Then you can have your GPIO functions set in the board-*.c file as set_power or similar, and the UART driver can idle properly.
Regards,
Tony
PATCH 4/5 Bluetooth device code common to HTC smartphones
Quoted 35 lines · Tony Lindgren
Quoted 11 lines · Cory Maccarrone
Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Cory Maccarrone
This change adds in a bluetooth controld driver/rfkill interface to the serial bluetooth controller found on many HTC smartphones such as the HTC Herald and HTC Wizard.
To me it looks like most of this should be in
drivers/bluetooth/omap7xx.cor something like that. Then you can just pass it the gpio numbers in theplatform_data.Quoted 9 lines
Not sure I agree that it fits there. ?The driver isn't really a bluetooth driver -- it's really just an RFKILL interface, and some code to toggle UART clocks on and off, plus GPIO work on a board-specific level. ?In principle, the gpios could be set and the clocks enabled in the board files, and this driver wouldn't be necessary to get working bluetooth (as we'd use hciattach on
/dev/ttyS*). ?But then, we can't toggle it off for power saving. Maybe a better place would be plat-omap/? ?But it really is more specific to these HTC boards, not the architecture itself.Hmm well what we've used earlier is to set something like
set_powerfunction pointer in the platform data, then call that in the driver if set. But in this case the driver is 8250.c, so let's not mess with that..This issue should get properly solved with the omap specific serial driver once we get that merged as then we can have hooks for
set_powerin addition to cutting serial clocks when idle.Quoted 3 lines
So really, the only point of this driver is to be able to power on and off the external bluetooth chip, which is why I submitted it as helper code to the board files.
Quoted 6 lines
Yeah. Can you take a look at the omap specific serial driver to get it working on omap1?
Then you can have your GPIO functions set in the board-*.c file as
set_poweror similar, and the UART driver can idle properly.
I can look at it. Where is the code for that, arch/arm/mach-omap2/serial.c?
- Cory
Tony Lindgren
reviewerPATCH 4/5 Bluetooth device code common to HTC smartphones
Quoted 36 lines · Cory Maccarrone
Quoted 35 lines · Tony Lindgren
Quoted 11 lines · Cory Maccarrone
Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Cory Maccarrone
This change adds in a bluetooth controld driver/rfkill interface to the serial bluetooth controller found on many HTC smartphones such as the HTC Herald and HTC Wizard.
To me it looks like most of this should be in
drivers/bluetooth/omap7xx.cor something like that. Then you can just pass it the gpio numbers in theplatform_data.Quoted 9 lines
Not sure I agree that it fits there. ?The driver isn't really a bluetooth driver -- it's really just an RFKILL interface, and some code to toggle UART clocks on and off, plus GPIO work on a board-specific level. ?In principle, the gpios could be set and the clocks enabled in the board files, and this driver wouldn't be necessary to get working bluetooth (as we'd use hciattach on
/dev/ttyS*). ?But then, we can't toggle it off for power saving. Maybe a better place would be plat-omap/? ?But it really is more specific to these HTC boards, not the architecture itself.Hmm well what we've used earlier is to set something like
set_powerfunction pointer in the platform data, then call that in the driver if set. But in this case the driver is 8250.c, so let's not mess with that..This issue should get properly solved with the omap specific serial driver once we get that merged as then we can have hooks for
set_powerin addition to cutting serial clocks when idle.Quoted 3 lines
So really, the only point of this driver is to be able to power on and off the external bluetooth chip, which is why I submitted it as helper code to the board files.
Quoted 8 lines
Quoted 6 lines
Yeah. Can you take a look at the omap specific serial driver to get it working on omap1?
Then you can have your GPIO functions set in the board-*.c file as
set_poweror similar, and the UART driver can idle properly.I can look at it. Where is the code for that,
arch/arm/mach-omap2/serial.c?
It's been floating on the list for a while now, here's the latest version:
http://www.spinics.net/lists/linux-omap/msg31786.html
Probably doing the platform data initialization is the biggest part that needs to be done for omap1, the driver itself should not need much changes.
Regards,
Tony
PATCH 5/5 Add board support for UARTs, bluetooth
In reply to Cory MaccarroneThis change adds bluetooth and UART initialization support to the HTC Herald board driver. This allows use of the serial bluetooth adapter attached to UART1 using hciattach.
--- arch/arm/mach-omap1/Makefile | 2 +- arch/arm/mach-omap1/board-htcherald.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletions(-)
arch/arm/mach-omap1/Makefile +1 -1
@@ -42,7 +42,7 @@ obj-$(CONFIG_MACH_NOKIA770) += board-nokia770.o obj-$(CONFIG_MACH_AMS_DELTA) += board-ams-delta.o obj-$(CONFIG_AMS_DELTA_FIQ) += ams-delta-fiq.o ams-delta-fiq-handler.o obj-$(CONFIG_MACH_SX1) += board-sx1.o board-sx1-mmc.o -obj-$(CONFIG_MACH_HERALD) += board-htcherald.o +obj-$(CONFIG_MACH_HERALD) += board-htcherald.o htc-bt.o ifeq ($(CONFIG_ARCH_OMAP15XX),y) # Innovator-1510 FPGA
arch/arm/mach-omap1/board-htcherald.c +23 -0
@@ -47,8 +47,10 @@#include <plat/keypad.h> #include <plat/usb.h> #include <plat/mmc.h> +#include <plat/mux.h> #include <mach/irqs.h> +#include <mach/htc-bt.h> #include <linux/delay.h>
@@ -138,6 +140,7 @@ Happy Times 0 1 0 x x x 0 x#define HTCPLD_GPIO_LED_DPAD HTCPLD_BASE(0, 0)#define HTCPLD_GPIO_LED_KBD HTCPLD_BASE(1, 0) +#define HTCPLD_GPIO_BT_POWER HTCPLD_BASE(1, 4)#define HTCPLD_GPIO_LED_CAPS HTCPLD_BASE(1, 5)#define HTCPLD_GPIO_LED_RED_FLASH HTCPLD_BASE(2, 1)#define HTCPLD_GPIO_LED_RED_SOLID HTCPLD_BASE(2, 2)
@@ -423,6 +426,22 @@ static struct omap_mmc_platform_data htc_mmc1_data = {static struct omap_mmc_platform_data *htc_mmc_data[1 ];#endif +/* Bluetooth */ +#define HTCHERALD_GPIO_BT_ENABLE 125 + +static struct htc_bt_data htcherald_bt_data = { + .uart_clock ="uart1_ck" , + .gpio_pwr =HTCPLD_GPIO_BT_POWER , + .gpio_enable =HTCHERALD_GPIO_BT_ENABLE , +}; + +static struct platform_device bt_device = { + .name ="htc-bt" , + .id =-1 , + .dev = { + .platform_data = &htcherald_bt_data, + }, +};/* Platform devices for the Herald */ static struct platform_device *devices[]__initdata = {
@@ -431,6 +450,7 @@ static struct platform_device *devices[] __initdata = { &htcpld_device, &gpio_leds_device, &herald_gpiokeys_device, + &bt_device, };/*
@@ -574,6 +594,7 @@ done:printk (KERN_INFO "USB setup complete.\n" ); } +static void __init htcherald_init (void ) {printk (KERN_INFO "HTC Herald init.\n" );
@@ -595,6 +616,8 @@ static void __init htcherald_init(void)omap_register_i2c_bus (1 ,100 ,NULL ,0 ); +omap_serial_init (); +#if defined(CONFIG_MMC_OMAP ) || defined(CONFIG_MMC_OMAP_MODULE ) htc_mmc_data[0 ] = &htc_mmc1_data;omap1_init_mmc (htc_mmc_data,1 );
Signature · 1 line
1.6.0.4
Tony Lindgren
reviewerPATCH 5/5 Add board support for UARTs, bluetooth
Quoted 3 lines · Cory Maccarrone
This change adds bluetooth and UART initialization support to the HTC Herald board driver. This allows use of the serial bluetooth adapter attached to UART1 using hciattach.
Ah and here you already have the gpio pins in platform_data, nice. Still, the driver part should be under drivers in the previous patch.
Regards,
Tony