Commit 7b6e28c3 authored by Olof Johansson's avatar Olof Johansson

Merge tag 'pxa-for-4.4' of https://github.com/rjarzmik/linux into next/cleanup

This is the pxa changes for v4.4 cycle.

This cycle is bigger than usual :
 - magician was greatly enhanced (new IPs discovered, ...)
 - almost all legacy board files have been updated to the
   new PWM API (mostly for backlight control)
 - some minor fixes in raumfeld, z2 and mioa701

* tag 'pxa-for-4.4' of https://github.com/rjarzmik/linux: (44 commits)
  ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode
  ARM: pxa: raumfeld: make some variables static
  ARM: pxa: magician: Remove pdata for pasic3-leds
  ARM: pxa: magician: Add support for PXA27x UDC
  ARM: pxa: magician: Add support for MAX1587A Vcore regulator
  ARM: pxa: magician: Change comments to be more informative
  ARM: pxa: magician: Move platform_add_devices() to the end of magician_init()
  ARM: pxa: magician: Add missing regulator for PWM backlight
  ARM: pxa: magician: Add debug message for backlight brightness function
  ARM: pxa: magician: Remove definition of the STUART port
  ARM: pxa: magician: Fix wrongly enabled USB host ports
  ARM: pxa: magician: Fix support for Intel Strata NOR Flash
  ARM: pxa: magician: Fix redundant GPIO request for pxaficp_ir
  ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers
  ARM: pxa: magician: Fix and add charging detection functions
  ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz
  ARM: pxa: magician: Rename charger cable detection EGPIOs
  ARM: pxa: magician: Optimize powerup delays for Samsung LCD
  ARM: pxa: magician: Rename abstract LCD GPIOs
  ARM: pxa: magician: Add new discovered EGPIO pins
  ...
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 7b192fb7 54c09889
...@@ -22,15 +22,10 @@ Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a ...@@ -22,15 +22,10 @@ Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a
found in include/linux/spi/pxa2xx_spi.h: found in include/linux/spi/pxa2xx_spi.h:
struct pxa2xx_spi_master { struct pxa2xx_spi_master {
u32 clock_enable;
u16 num_chipselect; u16 num_chipselect;
u8 enable_dma; u8 enable_dma;
}; };
The "pxa2xx_spi_master.clock_enable" field is used to enable/disable the
corresponding SSP peripheral block in the "Clock Enable Register (CKEN"). See
the "PXA2xx Developer Manual" section "Clocks and Power Management".
The "pxa2xx_spi_master.num_chipselect" field is used to determine the number of The "pxa2xx_spi_master.num_chipselect" field is used to determine the number of
slave device (chips) attached to this SPI master. slave device (chips) attached to this SPI master.
...@@ -57,7 +52,6 @@ static struct resource pxa_spi_nssp_resources[] = { ...@@ -57,7 +52,6 @@ static struct resource pxa_spi_nssp_resources[] = {
}; };
static struct pxa2xx_spi_master pxa_nssp_master_info = { static struct pxa2xx_spi_master pxa_nssp_master_info = {
.clock_enable = CKEN_NSSP, /* NSSP Peripheral clock */
.num_chipselect = 1, /* Matches the number of chips attached to NSSP */ .num_chipselect = 1, /* Matches the number of chips attached to NSSP */
.enable_dma = 1, /* Enables NSSP DMA */ .enable_dma = 1, /* Enables NSSP DMA */
}; };
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/dm9000.h> #include <linux/dm9000.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/rtc-v3020.h> #include <linux/rtc-v3020.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -305,11 +306,14 @@ static inline void cm_x300_init_lcd(void) {} ...@@ -305,11 +306,14 @@ static inline void cm_x300_init_lcd(void) {}
#endif #endif
#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
static struct pwm_lookup cm_x300_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.0", NULL, 10000,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data cm_x300_backlight_data = { static struct platform_pwm_backlight_data cm_x300_backlight_data = {
.pwm_id = 2,
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.pwm_period_ns = 10000,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -323,6 +327,7 @@ static struct platform_device cm_x300_backlight_device = { ...@@ -323,6 +327,7 @@ static struct platform_device cm_x300_backlight_device = {
static void cm_x300_init_bl(void) static void cm_x300_init_bl(void)
{ {
pwm_add_table(cm_x300_pwm_lookup, ARRAY_SIZE(cm_x300_pwm_lookup));
platform_device_register(&cm_x300_backlight_device); platform_device_register(&cm_x300_backlight_device);
} }
#else #else
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
...@@ -184,11 +185,14 @@ static inline void income_lcd_init(void) {} ...@@ -184,11 +185,14 @@ static inline void income_lcd_init(void) {}
* Backlight * Backlight
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
static struct pwm_lookup income_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 1000000,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data income_backlight_data = { static struct platform_pwm_backlight_data income_backlight_data = {
.pwm_id = 0,
.max_brightness = 0x3ff, .max_brightness = 0x3ff,
.dft_brightness = 0x1ff, .dft_brightness = 0x1ff,
.pwm_period_ns = 1000000,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -202,6 +206,7 @@ static struct platform_device income_backlight = { ...@@ -202,6 +206,7 @@ static struct platform_device income_backlight = {
static void __init income_pwm_init(void) static void __init income_pwm_init(void)
{ {
pwm_add_table(income_pwm_lookup, ARRAY_SIZE(income_pwm_lookup));
platform_device_register(&income_backlight); platform_device_register(&income_backlight);
} }
#else #else
......
...@@ -395,6 +395,26 @@ static struct resource pxa_ir_resources[] = { ...@@ -395,6 +395,26 @@ static struct resource pxa_ir_resources[] = {
.end = IRQ_ICP, .end = IRQ_ICP,
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
}, },
[3] = {
.start = 0x40800000,
.end = 0x4080001b,
.flags = IORESOURCE_MEM,
},
[4] = {
.start = 0x40700000,
.end = 0x40700023,
.flags = IORESOURCE_MEM,
},
[5] = {
.start = 17,
.end = 17,
.flags = IORESOURCE_DMA,
},
[6] = {
.start = 18,
.end = 18,
.flags = IORESOURCE_DMA,
},
}; };
struct platform_device pxa_device_ficp = { struct platform_device pxa_device_ficp = {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/gpio.h> #include <linux/gpio.h>
...@@ -49,11 +50,14 @@ ...@@ -49,11 +50,14 @@
#define GPIO19_GEN1_CAM_RST 19 #define GPIO19_GEN1_CAM_RST 19
#define GPIO28_GEN2_CAM_RST 28 #define GPIO28_GEN2_CAM_RST 28
static struct pwm_lookup ezx_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78700,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data ezx_backlight_data = { static struct platform_pwm_backlight_data ezx_backlight_data = {
.pwm_id = 0,
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 1023, .dft_brightness = 1023,
.pwm_period_ns = 78770,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -817,6 +821,7 @@ static void __init a780_init(void) ...@@ -817,6 +821,7 @@ static void __init a780_init(void)
platform_device_register(&a780_camera); platform_device_register(&a780_camera);
} }
pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
platform_add_devices(ARRAY_AND_SIZE(a780_devices)); platform_add_devices(ARRAY_AND_SIZE(a780_devices));
} }
......
...@@ -557,10 +557,8 @@ static struct platform_device hx4700_lcd = { ...@@ -557,10 +557,8 @@ static struct platform_device hx4700_lcd = {
*/ */
static struct platform_pwm_backlight_data backlight_data = { static struct platform_pwm_backlight_data backlight_data = {
.pwm_id = -1, /* Superseded by pwm_lookup */
.max_brightness = 200, .max_brightness = 200,
.dft_brightness = 100, .dft_brightness = 100,
.pwm_period_ns = 30923,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -630,7 +628,6 @@ static struct spi_board_info tsc2046_board_info[] __initdata = { ...@@ -630,7 +628,6 @@ static struct spi_board_info tsc2046_board_info[] __initdata = {
static struct pxa2xx_spi_master pxa_ssp2_master_info = { static struct pxa2xx_spi_master pxa_ssp2_master_info = {
.num_chipselect = 1, .num_chipselect = 1,
.clock_enable = CKEN_SSP2,
.enable_dma = 1, .enable_dma = 1,
}; };
......
...@@ -116,13 +116,11 @@ static struct spi_board_info mcp251x_board_info[] = { ...@@ -116,13 +116,11 @@ static struct spi_board_info mcp251x_board_info[] = {
}; };
static struct pxa2xx_spi_master pxa_ssp3_spi_master_info = { static struct pxa2xx_spi_master pxa_ssp3_spi_master_info = {
.clock_enable = CKEN_SSP3,
.num_chipselect = 2, .num_chipselect = 2,
.enable_dma = 1 .enable_dma = 1
}; };
static struct pxa2xx_spi_master pxa_ssp4_spi_master_info = { static struct pxa2xx_spi_master pxa_ssp4_spi_master_info = {
.clock_enable = CKEN_SSP4,
.num_chipselect = 2, .num_chipselect = 2,
.enable_dma = 1 .enable_dma = 1
}; };
......
...@@ -52,9 +52,9 @@ ...@@ -52,9 +52,9 @@
#define GPIO101_MAGICIAN_KEY_VOL_DOWN 101 #define GPIO101_MAGICIAN_KEY_VOL_DOWN 101
#define GPIO102_MAGICIAN_KEY_PHONE 102 #define GPIO102_MAGICIAN_KEY_PHONE 102
#define GPIO103_MAGICIAN_LED_KP 103 #define GPIO103_MAGICIAN_LED_KP 103
#define GPIO104_MAGICIAN_LCD_POWER_1 104 #define GPIO104_MAGICIAN_LCD_VOFF_EN 104
#define GPIO105_MAGICIAN_LCD_POWER_2 105 #define GPIO105_MAGICIAN_LCD_VON_EN 105
#define GPIO106_MAGICIAN_LCD_POWER_3 106 #define GPIO106_MAGICIAN_LCD_DCDC_NRESET 106
#define GPIO107_MAGICIAN_DS1WM_IRQ 107 #define GPIO107_MAGICIAN_DS1WM_IRQ 107
#define GPIO108_MAGICIAN_GSM_READY 108 #define GPIO108_MAGICIAN_GSM_READY 108
#define GPIO114_MAGICIAN_UNKNOWN 114 #define GPIO114_MAGICIAN_UNKNOWN 114
...@@ -78,43 +78,51 @@ ...@@ -78,43 +78,51 @@
* CPLD EGPIOs * CPLD EGPIOs
*/ */
#define MAGICIAN_EGPIO_BASE PXA_NR_BUILTIN_GPIO #define MAGICIAN_EGPIO_BASE PXA_NR_BUILTIN_GPIO
#define MAGICIAN_EGPIO(reg,bit) \ #define MAGICIAN_EGPIO(reg,bit) \
(MAGICIAN_EGPIO_BASE + 8*reg + bit) (MAGICIAN_EGPIO_BASE + 8*reg + bit)
/* output */ /* output */
#define EGPIO_MAGICIAN_TOPPOLY_POWER MAGICIAN_EGPIO(0, 2) #define EGPIO_MAGICIAN_TOPPOLY_POWER MAGICIAN_EGPIO(0, 2)
#define EGPIO_MAGICIAN_LED_POWER MAGICIAN_EGPIO(0, 5) #define EGPIO_MAGICIAN_LED_POWER MAGICIAN_EGPIO(0, 5)
#define EGPIO_MAGICIAN_GSM_RESET MAGICIAN_EGPIO(0, 6) #define EGPIO_MAGICIAN_GSM_RESET MAGICIAN_EGPIO(0, 6)
#define EGPIO_MAGICIAN_LCD_POWER MAGICIAN_EGPIO(0, 7) #define EGPIO_MAGICIAN_LCD_POWER MAGICIAN_EGPIO(0, 7)
#define EGPIO_MAGICIAN_SPK_POWER MAGICIAN_EGPIO(1, 0) #define EGPIO_MAGICIAN_SPK_POWER MAGICIAN_EGPIO(1, 0)
#define EGPIO_MAGICIAN_EP_POWER MAGICIAN_EGPIO(1, 1) #define EGPIO_MAGICIAN_EP_POWER MAGICIAN_EGPIO(1, 1)
#define EGPIO_MAGICIAN_IN_SEL0 MAGICIAN_EGPIO(1, 2) #define EGPIO_MAGICIAN_IN_SEL0 MAGICIAN_EGPIO(1, 2)
#define EGPIO_MAGICIAN_IN_SEL1 MAGICIAN_EGPIO(1, 3) #define EGPIO_MAGICIAN_IN_SEL1 MAGICIAN_EGPIO(1, 3)
#define EGPIO_MAGICIAN_MIC_POWER MAGICIAN_EGPIO(1, 4) #define EGPIO_MAGICIAN_MIC_POWER MAGICIAN_EGPIO(1, 4)
#define EGPIO_MAGICIAN_CODEC_RESET MAGICIAN_EGPIO(1, 5) #define EGPIO_MAGICIAN_CODEC_RESET MAGICIAN_EGPIO(1, 5)
#define EGPIO_MAGICIAN_CODEC_POWER MAGICIAN_EGPIO(1, 6) #define EGPIO_MAGICIAN_CODEC_POWER MAGICIAN_EGPIO(1, 6)
#define EGPIO_MAGICIAN_BL_POWER MAGICIAN_EGPIO(1, 7) #define EGPIO_MAGICIAN_BL_POWER MAGICIAN_EGPIO(1, 7)
#define EGPIO_MAGICIAN_SD_POWER MAGICIAN_EGPIO(2, 0) #define EGPIO_MAGICIAN_SD_POWER MAGICIAN_EGPIO(2, 0)
#define EGPIO_MAGICIAN_CARKIT_MIC MAGICIAN_EGPIO(2, 1) #define EGPIO_MAGICIAN_CARKIT_MIC MAGICIAN_EGPIO(2, 1)
#define EGPIO_MAGICIAN_UNKNOWN_WAVEDEV_DLL MAGICIAN_EGPIO(2, 2) #define EGPIO_MAGICIAN_IR_RX_SHUTDOWN MAGICIAN_EGPIO(2, 2)
#define EGPIO_MAGICIAN_FLASH_VPP MAGICIAN_EGPIO(2, 3) #define EGPIO_MAGICIAN_FLASH_VPP MAGICIAN_EGPIO(2, 3)
#define EGPIO_MAGICIAN_BL_POWER2 MAGICIAN_EGPIO(2, 4) #define EGPIO_MAGICIAN_BL_POWER2 MAGICIAN_EGPIO(2, 4)
#define EGPIO_MAGICIAN_BQ24022_ISET2 MAGICIAN_EGPIO(2, 5) #define EGPIO_MAGICIAN_BQ24022_ISET2 MAGICIAN_EGPIO(2, 5)
#define EGPIO_MAGICIAN_GSM_POWER MAGICIAN_EGPIO(2, 7) #define EGPIO_MAGICIAN_NICD_CHARGE MAGICIAN_EGPIO(2, 6)
#define EGPIO_MAGICIAN_GSM_POWER MAGICIAN_EGPIO(2, 7)
/* input */ /* input */
#define EGPIO_MAGICIAN_CABLE_STATE_AC MAGICIAN_EGPIO(4, 0) /* USB or AC charger type */
#define EGPIO_MAGICIAN_CABLE_STATE_USB MAGICIAN_EGPIO(4, 1) #define EGPIO_MAGICIAN_CABLE_TYPE MAGICIAN_EGPIO(4, 0)
/*
* Vbus is detected
* FIXME behaves like (6,3), may differ for host/device
*/
#define EGPIO_MAGICIAN_CABLE_VBUS MAGICIAN_EGPIO(4, 1)
#define EGPIO_MAGICIAN_BOARD_ID0 MAGICIAN_EGPIO(5, 0) #define EGPIO_MAGICIAN_BOARD_ID0 MAGICIAN_EGPIO(5, 0)
#define EGPIO_MAGICIAN_BOARD_ID1 MAGICIAN_EGPIO(5, 1) #define EGPIO_MAGICIAN_BOARD_ID1 MAGICIAN_EGPIO(5, 1)
#define EGPIO_MAGICIAN_BOARD_ID2 MAGICIAN_EGPIO(5, 2) #define EGPIO_MAGICIAN_BOARD_ID2 MAGICIAN_EGPIO(5, 2)
#define EGPIO_MAGICIAN_LCD_SELECT MAGICIAN_EGPIO(5, 3) #define EGPIO_MAGICIAN_LCD_SELECT MAGICIAN_EGPIO(5, 3)
#define EGPIO_MAGICIAN_nSD_READONLY MAGICIAN_EGPIO(5, 4) #define EGPIO_MAGICIAN_nSD_READONLY MAGICIAN_EGPIO(5, 4)
#define EGPIO_MAGICIAN_EP_INSERT MAGICIAN_EGPIO(6, 1) #define EGPIO_MAGICIAN_EP_INSERT MAGICIAN_EGPIO(6, 1)
/* FIXME behaves like (4,1), may differ for host/device */
#define EGPIO_MAGICIAN_CABLE_INSERTED MAGICIAN_EGPIO(6, 3)
#endif /* _MAGICIAN_H_ */ #endif /* _MAGICIAN_H_ */
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ #define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */
#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ #define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */
extern int __init pxa27x_set_pwrmode(unsigned int mode); extern int pxa27x_set_pwrmode(unsigned int mode);
extern void pxa27x_cpu_pm_enter(suspend_state_t state); extern void pxa27x_cpu_pm_enter(suspend_state_t state);
#endif /* __MACH_PXA27x_H */ #endif /* __MACH_PXA27x_H */
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
...@@ -271,11 +272,14 @@ static struct platform_device lpd270_flash_device[2] = { ...@@ -271,11 +272,14 @@ static struct platform_device lpd270_flash_device[2] = {
}, },
}; };
static struct pwm_lookup lpd270_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78770,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data lpd270_backlight_data = { static struct platform_pwm_backlight_data lpd270_backlight_data = {
.pwm_id = 0,
.max_brightness = 1, .max_brightness = 1,
.dft_brightness = 1, .dft_brightness = 1,
.pwm_period_ns = 78770,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -474,6 +478,7 @@ static void __init lpd270_init(void) ...@@ -474,6 +478,7 @@ static void __init lpd270_init(void)
*/ */
ARB_CNTRL = ARB_CORE_PARK | 0x234; ARB_CNTRL = ARB_CORE_PARK | 0x234;
pwm_add_table(lpd270_pwm_lookup, ARRAY_SIZE(lpd270_pwm_lookup));
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
pxa_set_ac97_info(NULL); pxa_set_ac97_info(NULL);
......
...@@ -24,8 +24,10 @@ ...@@ -24,8 +24,10 @@
#include <linux/mfd/htc-pasic3.h> #include <linux/mfd/htc-pasic3.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/pda_power.h> #include <linux/pda_power.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/regulator/driver.h> #include <linux/regulator/driver.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/gpio-regulator.h> #include <linux/regulator/gpio-regulator.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/usb/gpio_vbus.h> #include <linux/usb/gpio_vbus.h>
...@@ -43,6 +45,12 @@ ...@@ -43,6 +45,12 @@
#include <linux/platform_data/irda-pxaficp.h> #include <linux/platform_data/irda-pxaficp.h>
#include <linux/platform_data/usb-ohci-pxa27x.h> #include <linux/platform_data/usb-ohci-pxa27x.h>
#include <linux/regulator/max1586.h>
#include <linux/platform_data/pxa2xx_udc.h>
#include <mach/udc.h>
#include <mach/pxa27x-udc.h>
#include "devices.h" #include "devices.h"
#include "generic.h" #include "generic.h"
...@@ -52,36 +60,36 @@ static unsigned long magician_pin_config[] __initdata = { ...@@ -52,36 +60,36 @@ static unsigned long magician_pin_config[] __initdata = {
GPIO20_nSDCS_2, GPIO20_nSDCS_2,
GPIO21_nSDCS_3, GPIO21_nSDCS_3,
GPIO15_nCS_1, GPIO15_nCS_1,
GPIO78_nCS_2, /* PASIC3 */ GPIO78_nCS_2, /* PASIC3 */
GPIO79_nCS_3, /* EGPIO CPLD */ GPIO79_nCS_3, /* EGPIO CPLD */
GPIO80_nCS_4, GPIO80_nCS_4,
GPIO33_nCS_5, GPIO33_nCS_5,
/* I2C */ /* I2C UDA1380 + OV9640 */
GPIO117_I2C_SCL, GPIO117_I2C_SCL,
GPIO118_I2C_SDA, GPIO118_I2C_SDA,
/* PWM 0 */ /* PWM 0 - LCD backlight */
GPIO16_PWM0_OUT, GPIO16_PWM0_OUT,
/* I2S */ /* I2S UDA1380 capture */
GPIO28_I2S_BITCLK_OUT, GPIO28_I2S_BITCLK_OUT,
GPIO29_I2S_SDATA_IN, GPIO29_I2S_SDATA_IN,
GPIO31_I2S_SYNC, GPIO31_I2S_SYNC,
GPIO113_I2S_SYSCLK, GPIO113_I2S_SYSCLK,
/* SSP 1 */ /* SSP 1 UDA1380 playback */
GPIO23_SSP1_SCLK, GPIO23_SSP1_SCLK,
GPIO24_SSP1_SFRM, GPIO24_SSP1_SFRM,
GPIO25_SSP1_TXD, GPIO25_SSP1_TXD,
/* SSP 2 */ /* SSP 2 TSC2046 touchscreen */
GPIO19_SSP2_SCLK, GPIO19_SSP2_SCLK,
GPIO14_SSP2_SFRM, GPIO14_SSP2_SFRM,
GPIO89_SSP2_TXD, GPIO89_SSP2_TXD,
GPIO88_SSP2_RXD, GPIO88_SSP2_RXD,
/* MMC */ /* MMC/SD/SDHC slot */
GPIO32_MMC_CLK, GPIO32_MMC_CLK,
GPIO92_MMC_DAT_0, GPIO92_MMC_DAT_0,
GPIO109_MMC_DAT_1, GPIO109_MMC_DAT_1,
...@@ -92,7 +100,7 @@ static unsigned long magician_pin_config[] __initdata = { ...@@ -92,7 +100,7 @@ static unsigned long magician_pin_config[] __initdata = {
/* LCD */ /* LCD */
GPIOxx_LCD_TFT_16BPP, GPIOxx_LCD_TFT_16BPP,
/* QCI */ /* QCI camera interface */
GPIO12_CIF_DD_7, GPIO12_CIF_DD_7,
GPIO17_CIF_DD_6, GPIO17_CIF_DD_6,
GPIO50_CIF_DD_3, GPIO50_CIF_DD_3,
...@@ -120,12 +128,13 @@ static unsigned long magician_pin_config[] __initdata = { ...@@ -120,12 +128,13 @@ static unsigned long magician_pin_config[] __initdata = {
}; };
/* /*
* IRDA * IrDA
*/ */
static struct pxaficp_platform_data magician_ficp_info = { static struct pxaficp_platform_data magician_ficp_info = {
.gpio_pwdown = GPIO83_MAGICIAN_nIR_EN, .gpio_pwdown = GPIO83_MAGICIAN_nIR_EN,
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.gpio_pwdown_inverted = 0,
}; };
/* /*
...@@ -134,11 +143,11 @@ static struct pxaficp_platform_data magician_ficp_info = { ...@@ -134,11 +143,11 @@ static struct pxaficp_platform_data magician_ficp_info = {
#define INIT_KEY(_code, _gpio, _desc) \ #define INIT_KEY(_code, _gpio, _desc) \
{ \ { \
.code = KEY_##_code, \ .code = KEY_##_code, \
.gpio = _gpio, \ .gpio = _gpio, \
.desc = _desc, \ .desc = _desc, \
.type = EV_KEY, \ .type = EV_KEY, \
.wakeup = 1, \ .wakeup = 1, \
} }
static struct gpio_keys_button magician_button_table[] = { static struct gpio_keys_button magician_button_table[] = {
...@@ -160,164 +169,162 @@ static struct gpio_keys_button magician_button_table[] = { ...@@ -160,164 +169,162 @@ static struct gpio_keys_button magician_button_table[] = {
}; };
static struct gpio_keys_platform_data gpio_keys_data = { static struct gpio_keys_platform_data gpio_keys_data = {
.buttons = magician_button_table, .buttons = magician_button_table,
.nbuttons = ARRAY_SIZE(magician_button_table), .nbuttons = ARRAY_SIZE(magician_button_table),
}; };
static struct platform_device gpio_keys = { static struct platform_device gpio_keys = {
.name = "gpio-keys", .name = "gpio-keys",
.dev = { .dev = {
.platform_data = &gpio_keys_data, .platform_data = &gpio_keys_data,
}, },
.id = -1, .id = -1,
}; };
/* /*
* EGPIO (Xilinx CPLD) * EGPIO (Xilinx CPLD)
* *
* 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input * 32-bit aligned 8-bit registers
* 16 possible registers (reg windows size), only 7 used:
* 3x output, 1x irq, 3x input
*/ */
static struct resource egpio_resources[] = { static struct resource egpio_resources[] = {
[0] = { [0] = {
.start = PXA_CS3_PHYS, .start = PXA_CS3_PHYS,
.end = PXA_CS3_PHYS + 0x20 - 1, .end = PXA_CS3_PHYS + 0x20 - 1,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ), .start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
.end = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ), .end = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
}, },
}; };
static struct htc_egpio_chip egpio_chips[] = { static struct htc_egpio_chip egpio_chips[] = {
[0] = { [0] = {
.reg_start = 0, .reg_start = 0,
.gpio_base = MAGICIAN_EGPIO(0, 0), .gpio_base = MAGICIAN_EGPIO(0, 0),
.num_gpios = 24, .num_gpios = 24,
.direction = HTC_EGPIO_OUTPUT, .direction = HTC_EGPIO_OUTPUT,
.initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ /*
* Depends on modules configuration
*/
.initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */
}, },
[1] = { [1] = {
.reg_start = 4, .reg_start = 4,
.gpio_base = MAGICIAN_EGPIO(4, 0), .gpio_base = MAGICIAN_EGPIO(4, 0),
.num_gpios = 24, .num_gpios = 24,
.direction = HTC_EGPIO_INPUT, .direction = HTC_EGPIO_INPUT,
}, },
}; };
static struct htc_egpio_platform_data egpio_info = { static struct htc_egpio_platform_data egpio_info = {
.reg_width = 8, .reg_width = 8,
.bus_width = 32, .bus_width = 32,
.irq_base = IRQ_BOARD_START, .irq_base = IRQ_BOARD_START,
.num_irqs = 4, .num_irqs = 4,
.ack_register = 3, .ack_register = 3,
.chip = egpio_chips, .chip = egpio_chips,
.num_chips = ARRAY_SIZE(egpio_chips), .num_chips = ARRAY_SIZE(egpio_chips),
}; };
static struct platform_device egpio = { static struct platform_device egpio = {
.name = "htc-egpio", .name = "htc-egpio",
.id = -1, .id = -1,
.resource = egpio_resources, .resource = egpio_resources,
.num_resources = ARRAY_SIZE(egpio_resources), .num_resources = ARRAY_SIZE(egpio_resources),
.dev = { .dev = {
.platform_data = &egpio_info, .platform_data = &egpio_info,
}, },
}; };
/* /*
* LCD - Toppoly TD028STEB1 or Samsung LTP280QV * PXAFB LCD - Toppoly TD028STEB1 or Samsung LTP280QV
*/ */
static struct pxafb_mode_info toppoly_modes[] = { static struct pxafb_mode_info toppoly_modes[] = {
{ {
.pixclock = 96153, .pixclock = 96153,
.bpp = 16, .bpp = 16,
.xres = 240, .xres = 240,
.yres = 320, .yres = 320,
.hsync_len = 11, .hsync_len = 11,
.vsync_len = 3, .vsync_len = 3,
.left_margin = 19, .left_margin = 19,
.upper_margin = 2, .upper_margin = 2,
.right_margin = 10, .right_margin = 10,
.lower_margin = 2, .lower_margin = 2,
.sync = 0, .sync = 0,
}, },
}; };
static struct pxafb_mode_info samsung_modes[] = { static struct pxafb_mode_info samsung_modes[] = {
{ {
.pixclock = 96153, .pixclock = 226469,
.bpp = 16, .bpp = 16,
.xres = 240, .xres = 240,
.yres = 320, .yres = 320,
.hsync_len = 8, .hsync_len = 8,
.vsync_len = 4, .vsync_len = 4,
.left_margin = 9, .left_margin = 9,
.upper_margin = 4, .upper_margin = 4,
.right_margin = 9, .right_margin = 9,
.lower_margin = 4, .lower_margin = 4,
.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
}, },
}; };
static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si) static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si)
{ {
pr_debug("Toppoly LCD power\n"); pr_debug("Toppoly LCD power: %s\n", on ? "on" : "off");
if (on) { if (on) {
pr_debug("on\n");
gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1); gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1);
gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
udelay(2000); udelay(2000);
gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
udelay(2000); udelay(2000);
/* FIXME: enable LCDC here */ /* FIXME: enable LCDC here */
udelay(2000); udelay(2000);
gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
udelay(2000); udelay(2000);
gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
} else { } else {
pr_debug("off\n");
msleep(15); msleep(15);
gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
udelay(500); udelay(500);
gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
udelay(1000); udelay(1000);
gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0);
} }
} }
static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
{ {
pr_debug("Samsung LCD power\n"); pr_debug("Samsung LCD power: %s\n", on ? "on" : "off");
if (on) { if (on) {
pr_debug("on\n");
if (system_rev < 3) if (system_rev < 3)
gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1); gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1);
else else
gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
mdelay(10); mdelay(6);
gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
mdelay(10); mdelay(6); /* Avdd -> Voff >5ms */
gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
mdelay(30); mdelay(16); /* Voff -> Von >(5+10)ms */
gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
mdelay(10);
} else { } else {
pr_debug("off\n"); gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
mdelay(10); mdelay(16);
gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
mdelay(30); mdelay(6);
gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
mdelay(10); mdelay(6);
gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0);
mdelay(10);
if (system_rev < 3) if (system_rev < 3)
gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0);
else else
...@@ -326,29 +333,43 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) ...@@ -326,29 +333,43 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
} }
static struct pxafb_mach_info toppoly_info = { static struct pxafb_mach_info toppoly_info = {
.modes = toppoly_modes, .modes = toppoly_modes,
.num_modes = 1, .num_modes = 1,
.fixed_modes = 1, .fixed_modes = 1,
.lcd_conn = LCD_COLOR_TFT_16BPP, .lcd_conn = LCD_COLOR_TFT_16BPP,
.pxafb_lcd_power = toppoly_lcd_power, .pxafb_lcd_power = toppoly_lcd_power,
}; };
static struct pxafb_mach_info samsung_info = { static struct pxafb_mach_info samsung_info = {
.modes = samsung_modes, .modes = samsung_modes,
.num_modes = 1, .num_modes = 1,
.fixed_modes = 1, .fixed_modes = 1,
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |\ .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |
LCD_ALTERNATE_MAPPING, LCD_ALTERNATE_MAPPING,
.pxafb_lcd_power = samsung_lcd_power, .pxafb_lcd_power = samsung_lcd_power,
}; };
/* /*
* Backlight * Backlight
*/ */
static struct pwm_lookup magician_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight", NULL, 30923,
PWM_POLARITY_NORMAL),
};
/*
* fixed regulator for pwm_backlight
*/
static struct regulator_consumer_supply pwm_backlight_supply[] = {
REGULATOR_SUPPLY("power", "pwm_backlight"),
};
static struct gpio magician_bl_gpios[] = { static struct gpio magician_bl_gpios[] = {
{ EGPIO_MAGICIAN_BL_POWER, GPIOF_DIR_OUT, "Backlight power" }, { EGPIO_MAGICIAN_BL_POWER, GPIOF_DIR_OUT, "Backlight power" },
{ EGPIO_MAGICIAN_BL_POWER2, GPIOF_DIR_OUT, "Backlight power 2" }, { EGPIO_MAGICIAN_BL_POWER2, GPIOF_DIR_OUT, "Backlight power 2" },
}; };
static int magician_backlight_init(struct device *dev) static int magician_backlight_init(struct device *dev)
...@@ -358,6 +379,7 @@ static int magician_backlight_init(struct device *dev) ...@@ -358,6 +379,7 @@ static int magician_backlight_init(struct device *dev)
static int magician_backlight_notify(struct device *dev, int brightness) static int magician_backlight_notify(struct device *dev, int brightness)
{ {
pr_debug("Brightness = %i\n", brightness);
gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness); gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness);
if (brightness >= 200) { if (brightness >= 200) {
gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1);
...@@ -373,28 +395,33 @@ static void magician_backlight_exit(struct device *dev) ...@@ -373,28 +395,33 @@ static void magician_backlight_exit(struct device *dev)
gpio_free_array(ARRAY_AND_SIZE(magician_bl_gpios)); gpio_free_array(ARRAY_AND_SIZE(magician_bl_gpios));
} }
/*
* LCD PWM backlight (main)
*
* MP1521 frequency should be:
* 100-400 Hz = 2 .5*10^6 - 10 *10^6 ns
*/
static struct platform_pwm_backlight_data backlight_data = { static struct platform_pwm_backlight_data backlight_data = {
.pwm_id = 0, .max_brightness = 272,
.max_brightness = 272, .dft_brightness = 100,
.dft_brightness = 100, .enable_gpio = -1,
.pwm_period_ns = 30923, .init = magician_backlight_init,
.enable_gpio = -1, .notify = magician_backlight_notify,
.init = magician_backlight_init, .exit = magician_backlight_exit,
.notify = magician_backlight_notify,
.exit = magician_backlight_exit,
}; };
static struct platform_device backlight = { static struct platform_device backlight = {
.name = "pwm-backlight", .name = "pwm-backlight",
.id = -1, .id = -1,
.dev = { .dev = {
.parent = &pxa27x_device_pwm0.dev, .parent = &pxa27x_device_pwm0.dev,
.platform_data = &backlight_data, .platform_data = &backlight_data,
}, },
}; };
/* /*
* LEDs * GPIO LEDs, Phone keys backlight, vibra
*/ */
static struct gpio_led gpio_leds[] = { static struct gpio_led gpio_leds[] = {
...@@ -416,69 +443,32 @@ static struct gpio_led_platform_data gpio_led_info = { ...@@ -416,69 +443,32 @@ static struct gpio_led_platform_data gpio_led_info = {
}; };
static struct platform_device leds_gpio = { static struct platform_device leds_gpio = {
.name = "leds-gpio", .name = "leds-gpio",
.id = -1, .id = -1,
.dev = { .dev = {
.platform_data = &gpio_led_info, .platform_data = &gpio_led_info,
}, },
}; };
static struct pasic3_led pasic3_leds[] = {
{
.led = {
.name = "magician:red",
.default_trigger = "ds2760-battery.0-charging",
},
.hw_num = 0,
.bit2 = PASIC3_BIT2_LED0,
.mask = PASIC3_MASK_LED0,
},
{
.led = {
.name = "magician:green",
.default_trigger = "ds2760-battery.0-charging-or-full",
},
.hw_num = 1,
.bit2 = PASIC3_BIT2_LED1,
.mask = PASIC3_MASK_LED1,
},
{
.led = {
.name = "magician:blue",
.default_trigger = "bluetooth",
},
.hw_num = 2,
.bit2 = PASIC3_BIT2_LED2,
.mask = PASIC3_MASK_LED2,
},
};
static struct pasic3_leds_machinfo pasic3_leds_info = {
.num_leds = ARRAY_SIZE(pasic3_leds),
.power_gpio = EGPIO_MAGICIAN_LED_POWER,
.leds = pasic3_leds,
};
/* /*
* PASIC3 with DS1WM * PASIC3 with DS1WM
*/ */
static struct resource pasic3_resources[] = { static struct resource pasic3_resources[] = {
[0] = { [0] = {
.start = PXA_CS2_PHYS, .start = PXA_CS2_PHYS,
.end = PXA_CS2_PHYS + 0x1b, .end = PXA_CS2_PHYS + 0x1b,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
/* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */
[1] = { [1] = {
.start = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ), .start = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
.end = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ), .end = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
} }
}; };
static struct pasic3_platform_data pasic3_platform_data = { static struct pasic3_platform_data pasic3_platform_data = {
.led_pdata = &pasic3_leds_info,
.clock_rate = 4000000, .clock_rate = 4000000,
}; };
...@@ -493,25 +483,42 @@ static struct platform_device pasic3 = { ...@@ -493,25 +483,42 @@ static struct platform_device pasic3 = {
}; };
/* /*
* USB "Transceiver" * PXA UDC
*/
static void magician_udc_command(int cmd)
{
if (cmd == PXA2XX_UDC_CMD_CONNECT)
UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE;
else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
UP2OCR &= ~(UP2OCR_DPPUE | UP2OCR_DPPUBE);
}
static struct pxa2xx_udc_mach_info magician_udc_info __initdata = {
.udc_command = magician_udc_command,
.gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN,
};
/*
* USB device VBus detection
*/ */
static struct resource gpio_vbus_resource = { static struct resource gpio_vbus_resource = {
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
.start = IRQ_MAGICIAN_VBUS, .start = IRQ_MAGICIAN_VBUS,
.end = IRQ_MAGICIAN_VBUS, .end = IRQ_MAGICIAN_VBUS,
}; };
static struct gpio_vbus_mach_info gpio_vbus_info = { static struct gpio_vbus_mach_info gpio_vbus_info = {
.gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN, .gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN,
.gpio_vbus = EGPIO_MAGICIAN_CABLE_STATE_USB, .gpio_vbus = EGPIO_MAGICIAN_CABLE_VBUS,
}; };
static struct platform_device gpio_vbus = { static struct platform_device gpio_vbus = {
.name = "gpio-vbus", .name = "gpio-vbus",
.id = -1, .id = -1,
.num_resources = 1, .num_resources = 1,
.resource = &gpio_vbus_resource, .resource = &gpio_vbus_resource,
.dev = { .dev = {
.platform_data = &gpio_vbus_info, .platform_data = &gpio_vbus_info,
}, },
...@@ -521,19 +528,60 @@ static struct platform_device gpio_vbus = { ...@@ -521,19 +528,60 @@ static struct platform_device gpio_vbus = {
* External power * External power
*/ */
static int power_supply_init(struct device *dev) static int magician_supply_init(struct device *dev)
{
int ret = -1;
ret = gpio_request(EGPIO_MAGICIAN_CABLE_TYPE, "Cable is AC charger");
if (ret) {
pr_err("Cannot request AC/USB charger GPIO (%i)\n", ret);
goto err_ac;
}
ret = gpio_request(EGPIO_MAGICIAN_CABLE_INSERTED, "Cable inserted");
if (ret) {
pr_err("Cannot request cable detection GPIO (%i)\n", ret);
goto err_usb;
}
return 0;
err_usb:
gpio_free(EGPIO_MAGICIAN_CABLE_TYPE);
err_ac:
return ret;
}
static void magician_set_charge(int flags)
{ {
return gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC"); if (flags & PDA_POWER_CHARGE_AC) {
pr_debug("Charging from AC\n");
gpio_set_value(EGPIO_MAGICIAN_NICD_CHARGE, 1);
} else if (flags & PDA_POWER_CHARGE_USB) {
pr_debug("Charging from USB\n");
gpio_set_value(EGPIO_MAGICIAN_NICD_CHARGE, 1);
} else {
pr_debug("Charging disabled\n");
gpio_set_value(EGPIO_MAGICIAN_NICD_CHARGE, 0);
}
} }
static int magician_is_ac_online(void) static int magician_is_ac_online(void)
{ {
return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE); /* AC=1 */
} }
static void power_supply_exit(struct device *dev) static int magician_is_usb_online(void)
{ {
gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
(!gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE)); /* USB=0 */
}
static void magician_supply_exit(struct device *dev)
{
gpio_free(EGPIO_MAGICIAN_CABLE_INSERTED);
gpio_free(EGPIO_MAGICIAN_CABLE_TYPE);
} }
static char *magician_supplicants[] = { static char *magician_supplicants[] = {
...@@ -541,38 +589,40 @@ static char *magician_supplicants[] = { ...@@ -541,38 +589,40 @@ static char *magician_supplicants[] = {
}; };
static struct pda_power_pdata power_supply_info = { static struct pda_power_pdata power_supply_info = {
.init = power_supply_init, .init = magician_supply_init,
.is_ac_online = magician_is_ac_online, .exit = magician_supply_exit,
.exit = power_supply_exit, .is_ac_online = magician_is_ac_online,
.supplied_to = magician_supplicants, .is_usb_online = magician_is_usb_online,
.num_supplicants = ARRAY_SIZE(magician_supplicants), .set_charge = magician_set_charge,
.supplied_to = magician_supplicants,
.num_supplicants = ARRAY_SIZE(magician_supplicants),
}; };
static struct resource power_supply_resources[] = { static struct resource power_supply_resources[] = {
[0] = { [0] = {
.name = "ac", .name = "ac",
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
IORESOURCE_IRQ_LOWEDGE, IORESOURCE_IRQ_LOWEDGE,
.start = IRQ_MAGICIAN_VBUS, .start = IRQ_MAGICIAN_VBUS,
.end = IRQ_MAGICIAN_VBUS, .end = IRQ_MAGICIAN_VBUS,
}, },
[1] = { [1] = {
.name = "usb", .name = "usb",
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
IORESOURCE_IRQ_LOWEDGE, IORESOURCE_IRQ_LOWEDGE,
.start = IRQ_MAGICIAN_VBUS, .start = IRQ_MAGICIAN_VBUS,
.end = IRQ_MAGICIAN_VBUS, .end = IRQ_MAGICIAN_VBUS,
}, },
}; };
static struct platform_device power_supply = { static struct platform_device power_supply = {
.name = "pda-power", .name = "pda-power",
.id = -1, .id = -1,
.dev = { .dev = {
.platform_data = &power_supply_info, .platform_data = &power_supply_info,
}, },
.resource = power_supply_resources, .resource = power_supply_resources,
.num_resources = ARRAY_SIZE(power_supply_resources), .num_resources = ARRAY_SIZE(power_supply_resources),
}; };
/* /*
...@@ -586,11 +636,12 @@ static struct regulator_consumer_supply bq24022_consumers[] = { ...@@ -586,11 +636,12 @@ static struct regulator_consumer_supply bq24022_consumers[] = {
static struct regulator_init_data bq24022_init_data = { static struct regulator_init_data bq24022_init_data = {
.constraints = { .constraints = {
.max_uA = 500000, .max_uA = 500000,
.valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS, .valid_ops_mask = REGULATOR_CHANGE_CURRENT |
REGULATOR_CHANGE_STATUS,
}, },
.num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers),
.consumer_supplies = bq24022_consumers, .consumer_supplies = bq24022_consumers,
}; };
static struct gpio bq24022_gpios[] = { static struct gpio bq24022_gpios[] = {
...@@ -603,39 +654,85 @@ static struct gpio_regulator_state bq24022_states[] = { ...@@ -603,39 +654,85 @@ static struct gpio_regulator_state bq24022_states[] = {
}; };
static struct gpio_regulator_config bq24022_info = { static struct gpio_regulator_config bq24022_info = {
.supply_name = "bq24022", .supply_name = "bq24022",
.enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, .enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
.enable_high = 0, .enable_high = 0,
.enabled_at_boot = 0, .enabled_at_boot = 1,
.gpios = bq24022_gpios, .gpios = bq24022_gpios,
.nr_gpios = ARRAY_SIZE(bq24022_gpios), .nr_gpios = ARRAY_SIZE(bq24022_gpios),
.states = bq24022_states, .states = bq24022_states,
.nr_states = ARRAY_SIZE(bq24022_states), .nr_states = ARRAY_SIZE(bq24022_states),
.type = REGULATOR_CURRENT, .type = REGULATOR_CURRENT,
.init_data = &bq24022_init_data, .init_data = &bq24022_init_data,
}; };
static struct platform_device bq24022 = { static struct platform_device bq24022 = {
.name = "gpio-regulator", .name = "gpio-regulator",
.id = -1, .id = -1,
.dev = { .dev = {
.platform_data = &bq24022_info, .platform_data = &bq24022_info,
}, },
}; };
/*
* Vcore regulator MAX1587A
*/
static struct regulator_consumer_supply magician_max1587a_consumers[] = {
REGULATOR_SUPPLY("vcc_core", NULL),
};
static struct regulator_init_data magician_max1587a_v3_info = {
.constraints = {
.name = "vcc_core range",
.min_uV = 700000,
.max_uV = 1475000,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
},
.consumer_supplies = magician_max1587a_consumers,
.num_consumer_supplies = ARRAY_SIZE(magician_max1587a_consumers),
};
static struct max1586_subdev_data magician_max1587a_subdevs[] = {
{
.name = "vcc_core",
.id = MAX1586_V3,
.platform_data = &magician_max1587a_v3_info,
}
};
static struct max1586_platform_data magician_max1587a_info = {
.subdevs = magician_max1587a_subdevs,
.num_subdevs = ARRAY_SIZE(magician_max1587a_subdevs),
/*
* NOTICE measured directly on the PCB (board_id == 0x3a), but
* if R24 is present, it will boost the voltage
* (write 1.475V, get 1.645V and smoke)
*/
.v3_gain = MAX1586_GAIN_NO_R24,
};
static struct i2c_board_info magician_pwr_i2c_board_info[] __initdata = {
{
I2C_BOARD_INFO("max1586", 0x14),
.platform_data = &magician_max1587a_info,
},
};
/* /*
* MMC/SD * MMC/SD
*/ */
static int magician_mci_init(struct device *dev, static int magician_mci_init(struct device *dev,
irq_handler_t detect_irq, void *data) irq_handler_t detect_irq, void *data)
{ {
return request_irq(IRQ_MAGICIAN_SD, detect_irq, 0, return request_irq(IRQ_MAGICIAN_SD, detect_irq, 0,
"mmc card detect", data); "mmc card detect", data);
} }
static void magician_mci_exit(struct device *dev, void *data) static void magician_mci_exit(struct device *dev, void *data)
...@@ -644,9 +741,9 @@ static void magician_mci_exit(struct device *dev, void *data) ...@@ -644,9 +741,9 @@ static void magician_mci_exit(struct device *dev, void *data)
} }
static struct pxamci_platform_data magician_mci_info = { static struct pxamci_platform_data magician_mci_info = {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.init = magician_mci_init, .init = magician_mci_init,
.exit = magician_mci_exit, .exit = magician_mci_exit,
.gpio_card_detect = -1, .gpio_card_detect = -1,
.gpio_card_ro = EGPIO_MAGICIAN_nSD_READONLY, .gpio_card_ro = EGPIO_MAGICIAN_nSD_READONLY,
.gpio_card_ro_invert = 1, .gpio_card_ro_invert = 1,
...@@ -660,47 +757,102 @@ static struct pxamci_platform_data magician_mci_info = { ...@@ -660,47 +757,102 @@ static struct pxamci_platform_data magician_mci_info = {
static struct pxaohci_platform_data magician_ohci_info = { static struct pxaohci_platform_data magician_ohci_info = {
.port_mode = PMM_PERPORT_MODE, .port_mode = PMM_PERPORT_MODE,
.flags = ENABLE_PORT1 | ENABLE_PORT3 | POWER_CONTROL_LOW, /* port1: CSR Bluetooth, port2: OTG with UDC */
.flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW,
.power_budget = 0, .power_budget = 0,
.power_on_delay = 100,
}; };
/* /*
* StrataFlash * StrataFlash
*/ */
static int magician_flash_init(struct platform_device *pdev)
{
int ret = gpio_request(EGPIO_MAGICIAN_FLASH_VPP, "flash Vpp enable");
if (ret) {
pr_err("Cannot request flash enable GPIO (%i)\n", ret);
return ret;
}
ret = gpio_direction_output(EGPIO_MAGICIAN_FLASH_VPP, 1);
if (ret) {
pr_err("Cannot set direction for flash enable (%i)\n", ret);
gpio_free(EGPIO_MAGICIAN_FLASH_VPP);
}
return ret;
}
static void magician_set_vpp(struct platform_device *pdev, int vpp) static void magician_set_vpp(struct platform_device *pdev, int vpp)
{ {
gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp);
} }
static void magician_flash_exit(struct platform_device *pdev)
{
gpio_free(EGPIO_MAGICIAN_FLASH_VPP);
}
static struct resource strataflash_resource = { static struct resource strataflash_resource = {
.start = PXA_CS0_PHYS, .start = PXA_CS0_PHYS,
.end = PXA_CS0_PHYS + SZ_64M - 1, .end = PXA_CS0_PHYS + SZ_64M - 1,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}; };
static struct mtd_partition magician_flash_parts[] = {
{
.name = "Bootloader",
.offset = 0x0,
.size = 0x40000,
.mask_flags = MTD_WRITEABLE, /* EXPERIMENTAL */
},
{
.name = "Linux Kernel",
.offset = 0x40000,
.size = MTDPART_SIZ_FULL,
},
};
/*
* physmap-flash driver
*/
static struct physmap_flash_data strataflash_data = { static struct physmap_flash_data strataflash_data = {
.width = 4, .width = 4,
.set_vpp = magician_set_vpp, .init = magician_flash_init,
.set_vpp = magician_set_vpp,
.exit = magician_flash_exit,
.parts = magician_flash_parts,
.nr_parts = ARRAY_SIZE(magician_flash_parts),
}; };
static struct platform_device strataflash = { static struct platform_device strataflash = {
.name = "physmap-flash", .name = "physmap-flash",
.id = -1, .id = -1,
.resource = &strataflash_resource, .resource = &strataflash_resource,
.num_resources = 1, .num_resources = 1,
.dev = { .dev = {
.platform_data = &strataflash_data, .platform_data = &strataflash_data,
}, },
}; };
/* /*
* I2C * PXA I2C main controller
*/ */
static struct i2c_pxa_platform_data i2c_info = { static struct i2c_pxa_platform_data i2c_info = {
.fast_mode = 1, /* OV9640 I2C device doesn't support fast mode */
.fast_mode = 0,
};
/*
* PXA I2C power controller
*/
static struct i2c_pxa_platform_data magician_i2c_power_info = {
.fast_mode = 1,
}; };
/* /*
...@@ -720,12 +872,13 @@ static struct platform_device *devices[] __initdata = { ...@@ -720,12 +872,13 @@ static struct platform_device *devices[] __initdata = {
}; };
static struct gpio magician_global_gpios[] = { static struct gpio magician_global_gpios[] = {
{ GPIO13_MAGICIAN_CPLD_IRQ, GPIOF_IN, "CPLD_IRQ" }, { GPIO13_MAGICIAN_CPLD_IRQ, GPIOF_IN, "CPLD_IRQ" },
{ GPIO107_MAGICIAN_DS1WM_IRQ, GPIOF_IN, "DS1WM_IRQ" }, { GPIO107_MAGICIAN_DS1WM_IRQ, GPIOF_IN, "DS1WM_IRQ" },
{ GPIO104_MAGICIAN_LCD_POWER_1, GPIOF_OUT_INIT_LOW, "LCD power 1" },
{ GPIO105_MAGICIAN_LCD_POWER_2, GPIOF_OUT_INIT_LOW, "LCD power 2" }, /* NOTICE valid LCD init sequence */
{ GPIO106_MAGICIAN_LCD_POWER_3, GPIOF_OUT_INIT_LOW, "LCD power 3" }, { GPIO106_MAGICIAN_LCD_DCDC_NRESET, GPIOF_OUT_INIT_LOW, "LCD DCDC nreset" },
{ GPIO83_MAGICIAN_nIR_EN, GPIOF_OUT_INIT_HIGH, "nIR_EN" }, { GPIO104_MAGICIAN_LCD_VOFF_EN, GPIOF_OUT_INIT_LOW, "LCD VOFF enable" },
{ GPIO105_MAGICIAN_LCD_VON_EN, GPIOF_OUT_INIT_LOW, "LCD VON enable" },
}; };
static void __init magician_init(void) static void __init magician_init(void)
...@@ -737,44 +890,55 @@ static void __init magician_init(void) ...@@ -737,44 +890,55 @@ static void __init magician_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config));
err = gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios)); err = gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios));
if (err) if (err)
pr_err("magician: Failed to request GPIOs: %d\n", err); pr_err("magician: Failed to request global GPIOs: %d\n", err);
pxa_set_ffuart_info(NULL); pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL); pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
platform_add_devices(ARRAY_AND_SIZE(devices)); pwm_add_table(magician_pwm_lookup, ARRAY_SIZE(magician_pwm_lookup));
pxa_set_ficp_info(&magician_ficp_info); pxa_set_ficp_info(&magician_ficp_info);
pxa27x_set_i2c_power_info(NULL); pxa27x_set_i2c_power_info(&magician_i2c_power_info);
pxa_set_i2c_info(&i2c_info); pxa_set_i2c_info(&i2c_info);
i2c_register_board_info(1,
ARRAY_AND_SIZE(magician_pwr_i2c_board_info));
pxa_set_mci_info(&magician_mci_info); pxa_set_mci_info(&magician_mci_info);
pxa_set_ohci_info(&magician_ohci_info); pxa_set_ohci_info(&magician_ohci_info);
pxa_set_udc_info(&magician_udc_info);
/* Check LCD type we have */ /* Check LCD type we have */
cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000);
if (cpld) { if (cpld) {
u8 board_id = __raw_readb(cpld+0x14); u8 board_id = __raw_readb(cpld + 0x14);
iounmap(cpld); iounmap(cpld);
system_rev = board_id & 0x7; system_rev = board_id & 0x7;
lcd_select = board_id & 0x8; lcd_select = board_id & 0x8;
pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
if (lcd_select && (system_rev < 3)) if (lcd_select && (system_rev < 3))
/* NOTICE valid LCD init sequence */
gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER, gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER,
GPIOF_OUT_INIT_LOW, "SAMSUNG_POWER"); GPIOF_OUT_INIT_LOW, "Samsung LCD Power");
pxa_set_fb_info(NULL, lcd_select ? &samsung_info : &toppoly_info); pxa_set_fb_info(NULL,
lcd_select ? &samsung_info : &toppoly_info);
} else } else
pr_err("LCD detection: CPLD mapping failed\n"); pr_err("LCD detection: CPLD mapping failed\n");
}
regulator_register_always_on(0, "power", pwm_backlight_supply,
ARRAY_SIZE(pwm_backlight_supply), 5000000);
platform_add_devices(ARRAY_AND_SIZE(devices));
}
MACHINE_START(MAGICIAN, "HTC Magician") MACHINE_START(MAGICIAN, "HTC Magician")
.atag_offset = 0x100, .atag_offset = 0x100,
.map_io = pxa27x_map_io, .map_io = pxa27x_map_io,
.nr_irqs = MAGICIAN_NR_IRQS, .nr_irqs = MAGICIAN_NR_IRQS,
.init_irq = pxa27x_init_irq, .init_irq = pxa27x_init_irq,
.handle_irq = pxa27x_handle_irq, .handle_irq = pxa27x_handle_irq,
.init_machine = magician_init, .init_machine = magician_init,
.init_time = pxa_timer_init, .init_time = pxa_timer_init,
.restart = pxa_restart, .restart = pxa_restart,
MACHINE_END MACHINE_END
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
...@@ -248,11 +249,14 @@ static struct platform_device mst_flash_device[2] = { ...@@ -248,11 +249,14 @@ static struct platform_device mst_flash_device[2] = {
}; };
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
static struct pwm_lookup mainstone_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78770,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data mainstone_backlight_data = { static struct platform_pwm_backlight_data mainstone_backlight_data = {
.pwm_id = 0,
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 1023, .dft_brightness = 1023,
.pwm_period_ns = 78770,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -266,9 +270,16 @@ static struct platform_device mainstone_backlight_device = { ...@@ -266,9 +270,16 @@ static struct platform_device mainstone_backlight_device = {
static void __init mainstone_backlight_register(void) static void __init mainstone_backlight_register(void)
{ {
int ret = platform_device_register(&mainstone_backlight_device); int ret;
if (ret)
pwm_add_table(mainstone_pwm_lookup, ARRAY_SIZE(mainstone_pwm_lookup));
ret = platform_device_register(&mainstone_backlight_device);
if (ret) {
printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret); printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret);
pwm_remove_table(mainstone_pwm_lookup,
ARRAY_SIZE(mainstone_pwm_lookup));
}
} }
#else #else
#define mainstone_backlight_register() do { } while (0) #define mainstone_backlight_register() do { } while (0)
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/leds.h> #include <linux/leds.h>
...@@ -181,12 +182,15 @@ static unsigned long mioa701_pin_config[] = { ...@@ -181,12 +182,15 @@ static unsigned long mioa701_pin_config[] = {
MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH), MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH),
}; };
static struct pwm_lookup mioa701_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight", NULL, 4000 * 1024,
PWM_POLARITY_NORMAL),
};
/* LCD Screen and Backlight */ /* LCD Screen and Backlight */
static struct platform_pwm_backlight_data mioa701_backlight_data = { static struct platform_pwm_backlight_data mioa701_backlight_data = {
.pwm_id = 0,
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 50, .dft_brightness = 50,
.pwm_period_ns = 4000 * 1024, /* Fl = 250kHz */
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -678,6 +682,7 @@ MIO_SIMPLE_DEV(mioa701_led, "leds-gpio", &gpio_led_info) ...@@ -678,6 +682,7 @@ MIO_SIMPLE_DEV(mioa701_led, "leds-gpio", &gpio_led_info)
MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL) MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL)
MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL)
MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL)
MIO_SIMPLE_DEV(wm9713_acodec, "wm9713-codec", NULL);
MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data);
MIO_SIMPLE_DEV(mioa701_camera, "soc-camera-pdrv",&iclink); MIO_SIMPLE_DEV(mioa701_camera, "soc-camera-pdrv",&iclink);
...@@ -685,6 +690,7 @@ static struct platform_device *devices[] __initdata = { ...@@ -685,6 +690,7 @@ static struct platform_device *devices[] __initdata = {
&mioa701_gpio_keys, &mioa701_gpio_keys,
&mioa701_backlight, &mioa701_backlight,
&mioa701_led, &mioa701_led,
&wm9713_acodec,
&pxa2xx_pcm, &pxa2xx_pcm,
&mioa701_sound, &mioa701_sound,
&power_dev, &power_dev,
...@@ -751,6 +757,7 @@ static void __init mioa701_machine_init(void) ...@@ -751,6 +757,7 @@ static void __init mioa701_machine_init(void)
pxa_set_udc_info(&mioa701_udc_info); pxa_set_udc_info(&mioa701_udc_info);
pxa_set_ac97_info(&mioa701_ac97_info); pxa_set_ac97_info(&mioa701_ac97_info);
pm_power_off = mioa701_poweroff; pm_power_off = mioa701_poweroff;
pwm_add_table(mioa701_pwm_lookup, ARRAY_SIZE(mioa701_pwm_lookup));
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
gsm_init(); gsm_init();
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/pda_power.h> #include <linux/pda_power.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/wm97xx.h> #include <linux/wm97xx.h>
...@@ -270,6 +271,11 @@ void __init palm27x_ac97_init(int minv, int maxv, int jack, int reset) ...@@ -270,6 +271,11 @@ void __init palm27x_ac97_init(int minv, int maxv, int jack, int reset)
* Backlight * Backlight
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
static struct pwm_lookup palm27x_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 3500 * 1024,
PWM_POLARITY_NORMAL),
};
static int palm_bl_power; static int palm_bl_power;
static int palm_lcd_power; static int palm_lcd_power;
...@@ -318,10 +324,8 @@ static void palm27x_backlight_exit(struct device *dev) ...@@ -318,10 +324,8 @@ static void palm27x_backlight_exit(struct device *dev)
} }
static struct platform_pwm_backlight_data palm27x_backlight_data = { static struct platform_pwm_backlight_data palm27x_backlight_data = {
.pwm_id = 0,
.max_brightness = 0xfe, .max_brightness = 0xfe,
.dft_brightness = 0x7e, .dft_brightness = 0x7e,
.pwm_period_ns = 3500 * 1024,
.enable_gpio = -1, .enable_gpio = -1,
.init = palm27x_backlight_init, .init = palm27x_backlight_init,
.notify = palm27x_backlight_notify, .notify = palm27x_backlight_notify,
...@@ -340,6 +344,7 @@ void __init palm27x_pwm_init(int bl, int lcd) ...@@ -340,6 +344,7 @@ void __init palm27x_pwm_init(int bl, int lcd)
{ {
palm_bl_power = bl; palm_bl_power = bl;
palm_lcd_power = lcd; palm_lcd_power = lcd;
pwm_add_lookup(palm27x_pwm_lookup, ARRAY_SIZE(palm27x_pwm_lookup));
platform_device_register(&palm27x_backlight); platform_device_register(&palm27x_backlight);
} }
#endif #endif
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/input/matrix_keypad.h> #include <linux/input/matrix_keypad.h>
...@@ -166,11 +167,14 @@ static inline void palmtc_keys_init(void) {} ...@@ -166,11 +167,14 @@ static inline void palmtc_keys_init(void) {}
* Backlight * Backlight
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
static struct pwm_lookup palmtc_pwm_lookup[] = {
PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS,
PWM_PERIOD_NORMAL),
};
static struct platform_pwm_backlight_data palmtc_backlight_data = { static struct platform_pwm_backlight_data palmtc_backlight_data = {
.pwm_id = 1,
.max_brightness = PALMTC_MAX_INTENSITY, .max_brightness = PALMTC_MAX_INTENSITY,
.dft_brightness = PALMTC_MAX_INTENSITY, .dft_brightness = PALMTC_MAX_INTENSITY,
.pwm_period_ns = PALMTC_PERIOD_NS,
.enable_gpio = GPIO_NR_PALMTC_BL_POWER, .enable_gpio = GPIO_NR_PALMTC_BL_POWER,
}; };
...@@ -184,6 +188,7 @@ static struct platform_device palmtc_backlight = { ...@@ -184,6 +188,7 @@ static struct platform_device palmtc_backlight = {
static void __init palmtc_pwm_init(void) static void __init palmtc_pwm_init(void)
{ {
pwm_add_table(palmtc_pwm_lookup, ARRAY_SIZE(palmtc_pwm_lookup));
platform_device_register(&palmtc_backlight); platform_device_register(&palmtc_backlight);
} }
#else #else
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/pda_power.h> #include <linux/pda_power.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/wm97xx.h> #include <linux/wm97xx.h>
...@@ -138,6 +139,11 @@ static struct platform_device palmte2_pxa_keys = { ...@@ -138,6 +139,11 @@ static struct platform_device palmte2_pxa_keys = {
/****************************************************************************** /******************************************************************************
* Backlight * Backlight
******************************************************************************/ ******************************************************************************/
static struct pwm_lookup palmte2_pwm_lookup[] = {
PWM_LOOKUP("pxa25x-pwm.0", 0, "pwm-backlight.0", NULL,
PALMTE2_PERIOD_NS, PWM_POLARITY_NORMAL),
};
static struct gpio palmte_bl_gpios[] = { static struct gpio palmte_bl_gpios[] = {
{ GPIO_NR_PALMTE2_BL_POWER, GPIOF_INIT_LOW, "Backlight power" }, { GPIO_NR_PALMTE2_BL_POWER, GPIOF_INIT_LOW, "Backlight power" },
{ GPIO_NR_PALMTE2_LCD_POWER, GPIOF_INIT_LOW, "LCD power" }, { GPIO_NR_PALMTE2_LCD_POWER, GPIOF_INIT_LOW, "LCD power" },
...@@ -161,10 +167,8 @@ static void palmte2_backlight_exit(struct device *dev) ...@@ -161,10 +167,8 @@ static void palmte2_backlight_exit(struct device *dev)
} }
static struct platform_pwm_backlight_data palmte2_backlight_data = { static struct platform_pwm_backlight_data palmte2_backlight_data = {
.pwm_id = 0,
.max_brightness = PALMTE2_MAX_INTENSITY, .max_brightness = PALMTE2_MAX_INTENSITY,
.dft_brightness = PALMTE2_MAX_INTENSITY, .dft_brightness = PALMTE2_MAX_INTENSITY,
.pwm_period_ns = PALMTE2_PERIOD_NS,
.enable_gpio = -1, .enable_gpio = -1,
.init = palmte2_backlight_init, .init = palmte2_backlight_init,
.notify = palmte2_backlight_notify, .notify = palmte2_backlight_notify,
...@@ -355,6 +359,7 @@ static void __init palmte2_init(void) ...@@ -355,6 +359,7 @@ static void __init palmte2_init(void)
pxa_set_ac97_info(&palmte2_ac97_pdata); pxa_set_ac97_info(&palmte2_ac97_pdata);
pxa_set_ficp_info(&palmte2_ficp_platform_data); pxa_set_ficp_info(&palmte2_ficp_platform_data);
pwm_add_table(palmte2_pwm_lookup, ARRAY_SIZE(palmte2_pwm_lookup));
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <media/mt9v022.h> #include <media/mt9v022.h>
...@@ -148,11 +149,14 @@ static struct pxafb_mach_info pcm990_fbinfo __initdata = { ...@@ -148,11 +149,14 @@ static struct pxafb_mach_info pcm990_fbinfo __initdata = {
}; };
#endif #endif
static struct pwm_lookup pcm990_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78770,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data pcm990_backlight_data = { static struct platform_pwm_backlight_data pcm990_backlight_data = {
.pwm_id = 0,
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 1023, .dft_brightness = 1023,
.pwm_period_ns = 78770,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -542,6 +546,7 @@ void __init pcm990_baseboard_init(void) ...@@ -542,6 +546,7 @@ void __init pcm990_baseboard_init(void)
#ifndef CONFIG_PCM990_DISPLAY_NONE #ifndef CONFIG_PCM990_DISPLAY_NONE
pxa_set_fb_info(NULL, &pcm990_fbinfo); pxa_set_fb_info(NULL, &pcm990_fbinfo);
#endif #endif
pwm_add_table(pcm990_pwm_lookup, ARRAY_SIZE(pcm990_pwm_lookup));
platform_device_register(&pcm990_backlight_device); platform_device_register(&pcm990_backlight_device);
/* MMC */ /* MMC */
......
...@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(pxa27x_configure_ac97reset); ...@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(pxa27x_configure_ac97reset);
*/ */
static unsigned int pwrmode = PWRMODE_SLEEP; static unsigned int pwrmode = PWRMODE_SLEEP;
int __init pxa27x_set_pwrmode(unsigned int mode) int pxa27x_set_pwrmode(unsigned int mode)
{ {
switch (mode) { switch (mode) {
case PWRMODE_SLEEP: case PWRMODE_SLEEP:
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/w1-gpio.h> #include <linux/w1-gpio.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
...@@ -507,7 +508,7 @@ static struct w1_gpio_platform_data w1_gpio_platform_data = { ...@@ -507,7 +508,7 @@ static struct w1_gpio_platform_data w1_gpio_platform_data = {
.ext_pullup_enable_pin = -EINVAL, .ext_pullup_enable_pin = -EINVAL,
}; };
struct platform_device raumfeld_w1_gpio_device = { static struct platform_device raumfeld_w1_gpio_device = {
.name = "w1-gpio", .name = "w1-gpio",
.dev = { .dev = {
.platform_data = &w1_gpio_platform_data .platform_data = &w1_gpio_platform_data
...@@ -531,13 +532,15 @@ static void __init raumfeld_w1_init(void) ...@@ -531,13 +532,15 @@ static void __init raumfeld_w1_init(void)
* Framebuffer device * Framebuffer device
*/ */
static struct pwm_lookup raumfeld_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight", NULL, 10000,
PWM_POLARITY_NORMAL),
};
/* PWM controlled backlight */ /* PWM controlled backlight */
static struct platform_pwm_backlight_data raumfeld_pwm_backlight_data = { static struct platform_pwm_backlight_data raumfeld_pwm_backlight_data = {
.pwm_id = 0,
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
/* 10000 ns = 10 ms ^= 100 kHz */
.pwm_period_ns = 10000,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -618,6 +621,8 @@ static void __init raumfeld_lcd_init(void) ...@@ -618,6 +621,8 @@ static void __init raumfeld_lcd_init(void)
} else { } else {
mfp_cfg_t raumfeld_pwm_pin_config = GPIO17_PWM0_OUT; mfp_cfg_t raumfeld_pwm_pin_config = GPIO17_PWM0_OUT;
pxa3xx_mfp_config(&raumfeld_pwm_pin_config, 1); pxa3xx_mfp_config(&raumfeld_pwm_pin_config, 1);
pwm_add_table(raumfeld_pwm_lookup,
ARRAY_SIZE(raumfeld_pwm_lookup));
platform_device_register(&raumfeld_pwm_backlight_device); platform_device_register(&raumfeld_pwm_backlight_device);
} }
...@@ -629,7 +634,7 @@ static void __init raumfeld_lcd_init(void) ...@@ -629,7 +634,7 @@ static void __init raumfeld_lcd_init(void)
* SPI devices * SPI devices
*/ */
struct spi_gpio_platform_data raumfeld_spi_platform_data = { static struct spi_gpio_platform_data raumfeld_spi_platform_data = {
.sck = GPIO_SPI_CLK, .sck = GPIO_SPI_CLK,
.mosi = GPIO_SPI_MOSI, .mosi = GPIO_SPI_MOSI,
.miso = GPIO_SPI_MISO, .miso = GPIO_SPI_MISO,
...@@ -848,7 +853,7 @@ static void __init raumfeld_power_init(void) ...@@ -848,7 +853,7 @@ static void __init raumfeld_power_init(void)
static struct regulator_consumer_supply audio_va_consumer_supply = static struct regulator_consumer_supply audio_va_consumer_supply =
REGULATOR_SUPPLY("va", "0-0048"); REGULATOR_SUPPLY("va", "0-0048");
struct regulator_init_data audio_va_initdata = { static struct regulator_init_data audio_va_initdata = {
.consumer_supplies = &audio_va_consumer_supply, .consumer_supplies = &audio_va_consumer_supply,
.num_consumer_supplies = 1, .num_consumer_supplies = 1,
.constraints = { .constraints = {
...@@ -880,7 +885,7 @@ static struct regulator_consumer_supply audio_dummy_supplies[] = { ...@@ -880,7 +885,7 @@ static struct regulator_consumer_supply audio_dummy_supplies[] = {
REGULATOR_SUPPLY("vlc", "0-0048"), REGULATOR_SUPPLY("vlc", "0-0048"),
}; };
struct regulator_init_data audio_dummy_initdata = { static struct regulator_init_data audio_dummy_initdata = {
.consumer_supplies = audio_dummy_supplies, .consumer_supplies = audio_dummy_supplies,
.num_consumer_supplies = ARRAY_SIZE(audio_dummy_supplies), .num_consumer_supplies = ARRAY_SIZE(audio_dummy_supplies),
.constraints = { .constraints = {
...@@ -928,7 +933,7 @@ static struct regulator_init_data vcc_mmc_init_data = { ...@@ -928,7 +933,7 @@ static struct regulator_init_data vcc_mmc_init_data = {
.num_consumer_supplies = 1, .num_consumer_supplies = 1,
}; };
struct max8660_subdev_data max8660_v6_subdev_data = { static struct max8660_subdev_data max8660_v6_subdev_data = {
.id = MAX8660_V6, .id = MAX8660_V6,
.name = "vmmc", .name = "vmmc",
.platform_data = &vcc_mmc_init_data, .platform_data = &vcc_mmc_init_data,
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
...@@ -168,21 +169,24 @@ static inline void tavorevb_init_keypad(void) {} ...@@ -168,21 +169,24 @@ static inline void tavorevb_init_keypad(void) {}
#endif /* CONFIG_KEYBOARD_PXA27x || CONFIG_KEYBOARD_PXA27x_MODULE */ #endif /* CONFIG_KEYBOARD_PXA27x || CONFIG_KEYBOARD_PXA27x_MODULE */
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
static struct pwm_lookup tavorevb_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.0", NULL, 100000,
PWM_POLARITY_NORMAL),
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.1", NULL, 100000,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data tavorevb_backlight_data[] = { static struct platform_pwm_backlight_data tavorevb_backlight_data[] = {
[0] = { [0] = {
/* primary backlight */ /* primary backlight */
.pwm_id = 2,
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.pwm_period_ns = 100000,
.enable_gpio = -1, .enable_gpio = -1,
}, },
[1] = { [1] = {
/* secondary backlight */ /* secondary backlight */
.pwm_id = 0,
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.pwm_period_ns = 100000,
.enable_gpio = -1, .enable_gpio = -1,
}, },
}; };
...@@ -470,6 +474,7 @@ static struct pxafb_mach_info tavorevb_lcd_info = { ...@@ -470,6 +474,7 @@ static struct pxafb_mach_info tavorevb_lcd_info = {
static void __init tavorevb_init_lcd(void) static void __init tavorevb_init_lcd(void)
{ {
pwm_add_table(tavorevb_pwm_lookup, ARRAY_SIZE(tavorevb_pwm_lookup));
platform_device_register(&tavorevb_backlight_devices[0]); platform_device_register(&tavorevb_backlight_devices[0]);
platform_device_register(&tavorevb_backlight_devices[1]); platform_device_register(&tavorevb_backlight_devices[1]);
pxa_set_fb_info(NULL, &tavorevb_lcd_info); pxa_set_fb_info(NULL, &tavorevb_lcd_info);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/usb/isp116x.h> #include <linux/usb/isp116x.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
...@@ -350,6 +351,11 @@ static struct pxafb_mach_info fb_info = { ...@@ -350,6 +351,11 @@ static struct pxafb_mach_info fb_info = {
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
}; };
static struct pwm_lookup viper_pwm_lookup[] = {
PWM_LOOKUP("pxa25x-pwm.0", 0, "pwm-backlight.0", NULL, 1000000,
PWM_POLARITY_NORMAL),
};
static int viper_backlight_init(struct device *dev) static int viper_backlight_init(struct device *dev)
{ {
int ret; int ret;
...@@ -398,10 +404,8 @@ static void viper_backlight_exit(struct device *dev) ...@@ -398,10 +404,8 @@ static void viper_backlight_exit(struct device *dev)
} }
static struct platform_pwm_backlight_data viper_backlight_data = { static struct platform_pwm_backlight_data viper_backlight_data = {
.pwm_id = 0,
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.pwm_period_ns = 1000000,
.enable_gpio = -1, .enable_gpio = -1,
.init = viper_backlight_init, .init = viper_backlight_init,
.notify = viper_backlight_notify, .notify = viper_backlight_notify,
...@@ -939,6 +943,7 @@ static void __init viper_init(void) ...@@ -939,6 +943,7 @@ static void __init viper_init(void)
smc91x_device.num_resources--; smc91x_device.num_resources--;
pxa_set_i2c_info(NULL); pxa_set_i2c_info(NULL);
pwm_add_table(viper_pwm_lookup, ARRAY_SIZE(viper_pwm_lookup));
platform_add_devices(viper_devs, ARRAY_SIZE(viper_devs)); platform_add_devices(viper_devs, ARRAY_SIZE(viper_devs));
viper_init_vcore_gpios(); viper_init_vcore_gpios();
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/z2_battery.h> #include <linux/z2_battery.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
...@@ -199,21 +200,24 @@ static inline void z2_nor_init(void) {} ...@@ -199,21 +200,24 @@ static inline void z2_nor_init(void) {}
* Backlight * Backlight
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
static struct pwm_lookup z2_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.1", 0, "pwm-backlight.0", NULL, 1260320,
PWM_POLARITY_NORMAL),
PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.1", NULL, 1260320,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data z2_backlight_data[] = { static struct platform_pwm_backlight_data z2_backlight_data[] = {
[0] = { [0] = {
/* Keypad Backlight */ /* Keypad Backlight */
.pwm_id = 1,
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 0, .dft_brightness = 0,
.pwm_period_ns = 1260320,
.enable_gpio = -1, .enable_gpio = -1,
}, },
[1] = { [1] = {
/* LCD Backlight */ /* LCD Backlight */
.pwm_id = 2,
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 512, .dft_brightness = 512,
.pwm_period_ns = 1260320,
.enable_gpio = -1, .enable_gpio = -1,
}, },
}; };
...@@ -236,6 +240,7 @@ static struct platform_device z2_backlight_devices[2] = { ...@@ -236,6 +240,7 @@ static struct platform_device z2_backlight_devices[2] = {
}; };
static void __init z2_pwm_init(void) static void __init z2_pwm_init(void)
{ {
pwm_add_table(z2_pwm_lookup, ARRAY_SIZE(z2_pwm_lookup));
platform_device_register(&z2_backlight_devices[0]); platform_device_register(&z2_backlight_devices[0]);
platform_device_register(&z2_backlight_devices[1]); platform_device_register(&z2_backlight_devices[1]);
} }
...@@ -595,13 +600,11 @@ static struct spi_board_info spi_board_info[] __initdata = { ...@@ -595,13 +600,11 @@ static struct spi_board_info spi_board_info[] __initdata = {
}; };
static struct pxa2xx_spi_master pxa_ssp1_master_info = { static struct pxa2xx_spi_master pxa_ssp1_master_info = {
.clock_enable = CKEN_SSP,
.num_chipselect = 1, .num_chipselect = 1,
.enable_dma = 1, .enable_dma = 1,
}; };
static struct pxa2xx_spi_master pxa_ssp2_master_info = { static struct pxa2xx_spi_master pxa_ssp2_master_info = {
.clock_enable = CKEN_SSP2,
.num_chipselect = 1, .num_chipselect = 1,
}; };
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
...@@ -120,11 +121,14 @@ static inline void zylonite_init_leds(void) {} ...@@ -120,11 +121,14 @@ static inline void zylonite_init_leds(void) {}
#endif #endif
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
static struct pwm_lookup zylonite_pwm_lookup[] = {
PWM_LOOKUP("pxa27x-pwm.1", 1, "pwm-backlight.0", NULL, 10000,
PWM_POLARITY_NORMAL),
};
static struct platform_pwm_backlight_data zylonite_backlight_data = { static struct platform_pwm_backlight_data zylonite_backlight_data = {
.pwm_id = 3,
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.pwm_period_ns = 10000,
.enable_gpio = -1, .enable_gpio = -1,
}; };
...@@ -206,6 +210,7 @@ static struct pxafb_mach_info zylonite_sharp_lcd_info = { ...@@ -206,6 +210,7 @@ static struct pxafb_mach_info zylonite_sharp_lcd_info = {
static void __init zylonite_init_lcd(void) static void __init zylonite_init_lcd(void)
{ {
pwm_add_table(zylonite_pwm_lookup, ARRAY_SIZE(zylonite_pwm_lookup));
platform_device_register(&zylonite_backlight_device); platform_device_register(&zylonite_backlight_device);
if (lcd_id & 0x20) { if (lcd_id & 0x20) {
......
...@@ -23,7 +23,6 @@ struct dma_chan; ...@@ -23,7 +23,6 @@ struct dma_chan;
/* device.platform_data for SSP controller devices */ /* device.platform_data for SSP controller devices */
struct pxa2xx_spi_master { struct pxa2xx_spi_master {
u32 clock_enable;
u16 num_chipselect; u16 num_chipselect;
u8 enable_dma; u8 enable_dma;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment