All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 01/26] ARM: pxa: magician: Fix indentation in machine files
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:09   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:09 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch fixes the indentation for the HTC Magician machine definition.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/include/mach/magician.h |  54 ++---
 arch/arm/mach-pxa/magician.c              | 368 +++++++++++++++---------------
 2 files changed, 211 insertions(+), 211 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index ba6a6e1..b08c85a 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -78,43 +78,43 @@
  * CPLD EGPIOs
  */
 
-#define MAGICIAN_EGPIO_BASE			PXA_NR_BUILTIN_GPIO
+#define MAGICIAN_EGPIO_BASE		PXA_NR_BUILTIN_GPIO
 #define MAGICIAN_EGPIO(reg,bit) \
 	(MAGICIAN_EGPIO_BASE + 8*reg + bit)
 
 /* output */
 
-#define EGPIO_MAGICIAN_TOPPOLY_POWER		MAGICIAN_EGPIO(0, 2)
-#define EGPIO_MAGICIAN_LED_POWER		MAGICIAN_EGPIO(0, 5)
-#define EGPIO_MAGICIAN_GSM_RESET		MAGICIAN_EGPIO(0, 6)
-#define EGPIO_MAGICIAN_LCD_POWER		MAGICIAN_EGPIO(0, 7)
-#define EGPIO_MAGICIAN_SPK_POWER		MAGICIAN_EGPIO(1, 0)
-#define EGPIO_MAGICIAN_EP_POWER			MAGICIAN_EGPIO(1, 1)
-#define EGPIO_MAGICIAN_IN_SEL0			MAGICIAN_EGPIO(1, 2)
-#define EGPIO_MAGICIAN_IN_SEL1			MAGICIAN_EGPIO(1, 3)
-#define EGPIO_MAGICIAN_MIC_POWER		MAGICIAN_EGPIO(1, 4)
-#define EGPIO_MAGICIAN_CODEC_RESET		MAGICIAN_EGPIO(1, 5)
-#define EGPIO_MAGICIAN_CODEC_POWER		MAGICIAN_EGPIO(1, 6)
-#define EGPIO_MAGICIAN_BL_POWER			MAGICIAN_EGPIO(1, 7)
-#define EGPIO_MAGICIAN_SD_POWER			MAGICIAN_EGPIO(2, 0)
-#define EGPIO_MAGICIAN_CARKIT_MIC		MAGICIAN_EGPIO(2, 1)
+#define EGPIO_MAGICIAN_TOPPOLY_POWER	MAGICIAN_EGPIO(0, 2)
+#define EGPIO_MAGICIAN_LED_POWER	MAGICIAN_EGPIO(0, 5)
+#define EGPIO_MAGICIAN_GSM_RESET	MAGICIAN_EGPIO(0, 6)
+#define EGPIO_MAGICIAN_LCD_POWER	MAGICIAN_EGPIO(0, 7)
+#define EGPIO_MAGICIAN_SPK_POWER	MAGICIAN_EGPIO(1, 0)
+#define EGPIO_MAGICIAN_EP_POWER		MAGICIAN_EGPIO(1, 1)
+#define EGPIO_MAGICIAN_IN_SEL0		MAGICIAN_EGPIO(1, 2)
+#define EGPIO_MAGICIAN_IN_SEL1		MAGICIAN_EGPIO(1, 3)
+#define EGPIO_MAGICIAN_MIC_POWER	MAGICIAN_EGPIO(1, 4)
+#define EGPIO_MAGICIAN_CODEC_RESET	MAGICIAN_EGPIO(1, 5)
+#define EGPIO_MAGICIAN_CODEC_POWER	MAGICIAN_EGPIO(1, 6)
+#define EGPIO_MAGICIAN_BL_POWER		MAGICIAN_EGPIO(1, 7)
+#define EGPIO_MAGICIAN_SD_POWER		MAGICIAN_EGPIO(2, 0)
+#define EGPIO_MAGICIAN_CARKIT_MIC	MAGICIAN_EGPIO(2, 1)
 #define EGPIO_MAGICIAN_UNKNOWN_WAVEDEV_DLL	MAGICIAN_EGPIO(2, 2)
-#define EGPIO_MAGICIAN_FLASH_VPP		MAGICIAN_EGPIO(2, 3)
-#define EGPIO_MAGICIAN_BL_POWER2		MAGICIAN_EGPIO(2, 4)
-#define EGPIO_MAGICIAN_BQ24022_ISET2		MAGICIAN_EGPIO(2, 5)
-#define EGPIO_MAGICIAN_GSM_POWER		MAGICIAN_EGPIO(2, 7)
+#define EGPIO_MAGICIAN_FLASH_VPP	MAGICIAN_EGPIO(2, 3)
+#define EGPIO_MAGICIAN_BL_POWER2	MAGICIAN_EGPIO(2, 4)
+#define EGPIO_MAGICIAN_BQ24022_ISET2	MAGICIAN_EGPIO(2, 5)
+#define EGPIO_MAGICIAN_GSM_POWER	MAGICIAN_EGPIO(2, 7)
 
 /* input */
 
-#define EGPIO_MAGICIAN_CABLE_STATE_AC		MAGICIAN_EGPIO(4, 0)
-#define EGPIO_MAGICIAN_CABLE_STATE_USB		MAGICIAN_EGPIO(4, 1)
+#define EGPIO_MAGICIAN_CABLE_STATE_AC	MAGICIAN_EGPIO(4, 0)
+#define EGPIO_MAGICIAN_CABLE_STATE_USB	MAGICIAN_EGPIO(4, 1)
 
-#define EGPIO_MAGICIAN_BOARD_ID0		MAGICIAN_EGPIO(5, 0)
-#define EGPIO_MAGICIAN_BOARD_ID1		MAGICIAN_EGPIO(5, 1)
-#define EGPIO_MAGICIAN_BOARD_ID2		MAGICIAN_EGPIO(5, 2)
-#define EGPIO_MAGICIAN_LCD_SELECT		MAGICIAN_EGPIO(5, 3)
-#define EGPIO_MAGICIAN_nSD_READONLY		MAGICIAN_EGPIO(5, 4)
+#define EGPIO_MAGICIAN_BOARD_ID0	MAGICIAN_EGPIO(5, 0)
+#define EGPIO_MAGICIAN_BOARD_ID1	MAGICIAN_EGPIO(5, 1)
+#define EGPIO_MAGICIAN_BOARD_ID2	MAGICIAN_EGPIO(5, 2)
+#define EGPIO_MAGICIAN_LCD_SELECT	MAGICIAN_EGPIO(5, 3)
+#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)
 
 #endif /* _MAGICIAN_H_ */
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index a9761c2..c10f932 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -52,8 +52,8 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO20_nSDCS_2,
 	GPIO21_nSDCS_3,
 	GPIO15_nCS_1,
-	GPIO78_nCS_2,   /* PASIC3 */
-	GPIO79_nCS_3,   /* EGPIO CPLD */
+	GPIO78_nCS_2,	/* PASIC3 */
+	GPIO79_nCS_3,	/* EGPIO CPLD */
 	GPIO80_nCS_4,
 	GPIO33_nCS_5,
 
@@ -134,11 +134,11 @@ static struct pxaficp_platform_data magician_ficp_info = {
 
 #define INIT_KEY(_code, _gpio, _desc)	\
 	{				\
-		.code   = KEY_##_code,	\
-		.gpio   = _gpio,	\
-		.desc   = _desc,	\
-		.type   = EV_KEY,	\
-		.wakeup = 1,		\
+		.code	= KEY_##_code,	\
+		.gpio	= _gpio,	\
+		.desc	= _desc,	\
+		.type	= EV_KEY,	\
+		.wakeup	= 1,		\
 	}
 
 static struct gpio_keys_button magician_button_table[] = {
@@ -160,19 +160,18 @@ static struct gpio_keys_button magician_button_table[] = {
 };
 
 static struct gpio_keys_platform_data gpio_keys_data = {
-	.buttons  = magician_button_table,
-	.nbuttons = ARRAY_SIZE(magician_button_table),
+	.buttons	= magician_button_table,
+	.nbuttons	= ARRAY_SIZE(magician_button_table),
 };
 
 static struct platform_device gpio_keys = {
-	.name = "gpio-keys",
-	.dev  = {
+	.name	= "gpio-keys",
+	.dev	= {
 		.platform_data = &gpio_keys_data,
 	},
-	.id   = -1,
+	.id	= -1,
 };
 
-
 /*
  * EGPIO (Xilinx CPLD)
  *
@@ -181,48 +180,48 @@ static struct platform_device gpio_keys = {
 
 static struct resource egpio_resources[] = {
 	[0] = {
-		.start = PXA_CS3_PHYS,
-		.end   = PXA_CS3_PHYS + 0x20 - 1,
-		.flags = IORESOURCE_MEM,
+		.start	= PXA_CS3_PHYS,
+		.end	= PXA_CS3_PHYS + 0x20 - 1,
+		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
-		.start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
-		.end   = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
-		.flags = IORESOURCE_IRQ,
+		.start	= PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
+		.end	= PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
+		.flags	= IORESOURCE_IRQ,
 	},
 };
 
 static struct htc_egpio_chip egpio_chips[] = {
 	[0] = {
-		.reg_start = 0,
-		.gpio_base = MAGICIAN_EGPIO(0, 0),
-		.num_gpios = 24,
-		.direction = HTC_EGPIO_OUTPUT,
-		.initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */
+		.reg_start	= 0,
+		.gpio_base	= MAGICIAN_EGPIO(0, 0),
+		.num_gpios	= 24,
+		.direction	= HTC_EGPIO_OUTPUT,
+		.initial_values	= 0x40, /* EGPIO_MAGICIAN_GSM_RESET */
 	},
 	[1] = {
-		.reg_start = 4,
-		.gpio_base = MAGICIAN_EGPIO(4, 0),
-		.num_gpios = 24,
-		.direction = HTC_EGPIO_INPUT,
+		.reg_start	= 4,
+		.gpio_base	= MAGICIAN_EGPIO(4, 0),
+		.num_gpios	= 24,
+		.direction	= HTC_EGPIO_INPUT,
 	},
 };
 
 static struct htc_egpio_platform_data egpio_info = {
-	.reg_width    = 8,
-	.bus_width    = 32,
-	.irq_base     = IRQ_BOARD_START,
-	.num_irqs     = 4,
-	.ack_register = 3,
-	.chip         = egpio_chips,
-	.num_chips    = ARRAY_SIZE(egpio_chips),
+	.reg_width	= 8,
+	.bus_width	= 32,
+	.irq_base	= IRQ_BOARD_START,
+	.num_irqs	= 4,
+	.ack_register	= 3,
+	.chip		= egpio_chips,
+	.num_chips	= ARRAY_SIZE(egpio_chips),
 };
 
 static struct platform_device egpio = {
-	.name          = "htc-egpio",
-	.id            = -1,
-	.resource      = egpio_resources,
-	.num_resources = ARRAY_SIZE(egpio_resources),
+	.name		= "htc-egpio",
+	.id		= -1,
+	.resource	= egpio_resources,
+	.num_resources	= ARRAY_SIZE(egpio_resources),
 	.dev = {
 		.platform_data = &egpio_info,
 	},
@@ -234,33 +233,33 @@ static struct platform_device egpio = {
 
 static struct pxafb_mode_info toppoly_modes[] = {
 	{
-		.pixclock     = 96153,
-		.bpp          = 16,
-		.xres         = 240,
-		.yres         = 320,
-		.hsync_len    = 11,
-		.vsync_len    = 3,
-		.left_margin  = 19,
-		.upper_margin = 2,
-		.right_margin = 10,
-		.lower_margin = 2,
-		.sync         = 0,
+		.pixclock	= 96153,
+		.bpp		= 16,
+		.xres		= 240,
+		.yres		= 320,
+		.hsync_len	= 11,
+		.vsync_len	= 3,
+		.left_margin	= 19,
+		.upper_margin	= 2,
+		.right_margin	= 10,
+		.lower_margin	= 2,
+		.sync		= 0,
 	},
 };
 
 static struct pxafb_mode_info samsung_modes[] = {
 	{
-		.pixclock     = 96153,
-		.bpp          = 16,
-		.xres         = 240,
-		.yres         = 320,
-		.hsync_len    = 8,
-		.vsync_len    = 4,
-		.left_margin  = 9,
-		.upper_margin = 4,
-		.right_margin = 9,
-		.lower_margin = 4,
-		.sync         = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+		.pixclock	= 96153,
+		.bpp		= 16,
+		.xres		= 240,
+		.yres		= 320,
+		.hsync_len	= 8,
+		.vsync_len	= 4,
+		.left_margin	= 9,
+		.upper_margin	= 4,
+		.right_margin	= 9,
+		.lower_margin	= 4,
+		.sync	= FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
 	},
 };
 
@@ -326,20 +325,20 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
 }
 
 static struct pxafb_mach_info toppoly_info = {
-	.modes           = toppoly_modes,
-	.num_modes       = 1,
-	.fixed_modes     = 1,
-	.lcd_conn	= LCD_COLOR_TFT_16BPP,
-	.pxafb_lcd_power = toppoly_lcd_power,
+	.modes			= toppoly_modes,
+	.num_modes		= 1,
+	.fixed_modes		= 1,
+	.lcd_conn		= LCD_COLOR_TFT_16BPP,
+	.pxafb_lcd_power	= toppoly_lcd_power,
 };
 
 static struct pxafb_mach_info samsung_info = {
-	.modes           = samsung_modes,
-	.num_modes       = 1,
-	.fixed_modes     = 1,
-	.lcd_conn	 = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |\
-			   LCD_ALTERNATE_MAPPING,
-	.pxafb_lcd_power = samsung_lcd_power,
+	.modes			= samsung_modes,
+	.num_modes		= 1,
+	.fixed_modes		= 1,
+	.lcd_conn		= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |
+		LCD_ALTERNATE_MAPPING,
+	.pxafb_lcd_power	= samsung_lcd_power,
 };
 
 /*
@@ -347,8 +346,8 @@ static struct pxafb_mach_info samsung_info = {
  */
 
 static struct gpio magician_bl_gpios[] = {
-	{ EGPIO_MAGICIAN_BL_POWER,  GPIOF_DIR_OUT, "Backlight power" },
-	{ EGPIO_MAGICIAN_BL_POWER2, GPIOF_DIR_OUT, "Backlight power 2" },
+	{ EGPIO_MAGICIAN_BL_POWER,	GPIOF_DIR_OUT, "Backlight power" },
+	{ EGPIO_MAGICIAN_BL_POWER2,	GPIOF_DIR_OUT, "Backlight power 2" },
 };
 
 static int magician_backlight_init(struct device *dev)
@@ -374,22 +373,22 @@ static void magician_backlight_exit(struct device *dev)
 }
 
 static struct platform_pwm_backlight_data backlight_data = {
-	.pwm_id         = 0,
-	.max_brightness = 272,
-	.dft_brightness = 100,
-	.pwm_period_ns  = 30923,
-	.enable_gpio    = -1,
-	.init           = magician_backlight_init,
-	.notify         = magician_backlight_notify,
-	.exit           = magician_backlight_exit,
+	.pwm_id		= 0,
+	.max_brightness	= 272,
+	.dft_brightness	= 100,
+	.pwm_period_ns	= 30923,
+	.enable_gpio	= -1,
+	.init		= magician_backlight_init,
+	.notify		= magician_backlight_notify,
+	.exit		= magician_backlight_exit,
 };
 
 static struct platform_device backlight = {
-	.name = "pwm-backlight",
-	.id   = -1,
-	.dev  = {
-		.parent        = &pxa27x_device_pwm0.dev,
-		.platform_data = &backlight_data,
+	.name	= "pwm-backlight",
+	.id	= -1,
+	.dev	= {
+		.parent		= &pxa27x_device_pwm0.dev,
+		.platform_data	= &backlight_data,
 	},
 };
 
@@ -416,9 +415,9 @@ static struct gpio_led_platform_data gpio_led_info = {
 };
 
 static struct platform_device leds_gpio = {
-	.name = "leds-gpio",
-	.id   = -1,
-	.dev  = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
 		.platform_data = &gpio_led_info,
 	},
 };
@@ -426,37 +425,37 @@ static struct platform_device leds_gpio = {
 static struct pasic3_led pasic3_leds[] = {
 	{
 		.led = {
-			.name            = "magician:red",
+			.name = "magician:red",
 			.default_trigger = "ds2760-battery.0-charging",
 		},
-		.hw_num = 0,
-		.bit2   = PASIC3_BIT2_LED0,
-		.mask   = PASIC3_MASK_LED0,
+		.hw_num	= 0,
+		.bit2	= PASIC3_BIT2_LED0,
+		.mask	= PASIC3_MASK_LED0,
 	},
 	{
 		.led = {
-			.name            = "magician:green",
+			.name = "magician:green",
 			.default_trigger = "ds2760-battery.0-charging-or-full",
 		},
-		.hw_num = 1,
-		.bit2   = PASIC3_BIT2_LED1,
-		.mask   = PASIC3_MASK_LED1,
+		.hw_num	= 1,
+		.bit2	= PASIC3_BIT2_LED1,
+		.mask	= PASIC3_MASK_LED1,
 	},
 	{
 		.led = {
-			.name            = "magician:blue",
+			.name = "magician:blue",
 			.default_trigger = "bluetooth",
 		},
-		.hw_num = 2,
-		.bit2   = PASIC3_BIT2_LED2,
-		.mask   = PASIC3_MASK_LED2,
+		.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,
+	.num_leds	= ARRAY_SIZE(pasic3_leds),
+	.power_gpio	= EGPIO_MAGICIAN_LED_POWER,
+	.leds		= pasic3_leds,
 };
 
 /*
@@ -465,21 +464,21 @@ static struct pasic3_leds_machinfo pasic3_leds_info = {
 
 static struct resource pasic3_resources[] = {
 	[0] = {
-		.start  = PXA_CS2_PHYS,
+		.start	= PXA_CS2_PHYS,
 		.end	= PXA_CS2_PHYS + 0x1b,
-		.flags  = IORESOURCE_MEM,
+		.flags	= IORESOURCE_MEM,
 	},
 	/* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */
 	[1] = {
-		.start  = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
-		.end    = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
-		.flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
+		.start	= PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
+		.end	= PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
+		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
 	}
 };
 
 static struct pasic3_platform_data pasic3_platform_data = {
-	.led_pdata  = &pasic3_leds_info,
-	.clock_rate = 4000000,
+	.led_pdata	= &pasic3_leds_info,
+	.clock_rate	= 4000000,
 };
 
 static struct platform_device pasic3 = {
@@ -497,21 +496,21 @@ static struct platform_device pasic3 = {
  */
 
 static struct resource gpio_vbus_resource = {
-	.flags = IORESOURCE_IRQ,
-	.start = IRQ_MAGICIAN_VBUS,
-	.end   = IRQ_MAGICIAN_VBUS,
+	.flags	= IORESOURCE_IRQ,
+	.start	= IRQ_MAGICIAN_VBUS,
+	.end	= IRQ_MAGICIAN_VBUS,
 };
 
 static struct gpio_vbus_mach_info gpio_vbus_info = {
-	.gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN,
-	.gpio_vbus   = EGPIO_MAGICIAN_CABLE_STATE_USB,
+	.gpio_pullup	= GPIO27_MAGICIAN_USBC_PUEN,
+	.gpio_vbus	= EGPIO_MAGICIAN_CABLE_STATE_USB,
 };
 
 static struct platform_device gpio_vbus = {
-	.name          = "gpio-vbus",
-	.id            = -1,
-	.num_resources = 1,
-	.resource      = &gpio_vbus_resource,
+	.name		= "gpio-vbus",
+	.id		= -1,
+	.num_resources	= 1,
+	.resource	= &gpio_vbus_resource,
 	.dev = {
 		.platform_data = &gpio_vbus_info,
 	},
@@ -541,38 +540,38 @@ static char *magician_supplicants[] = {
 };
 
 static struct pda_power_pdata power_supply_info = {
-	.init            = power_supply_init,
-	.is_ac_online    = magician_is_ac_online,
-	.exit            = power_supply_exit,
-	.supplied_to     = magician_supplicants,
-	.num_supplicants = ARRAY_SIZE(magician_supplicants),
+	.init			= power_supply_init,
+	.is_ac_online		= magician_is_ac_online,
+	.exit			= power_supply_exit,
+	.supplied_to		= magician_supplicants,
+	.num_supplicants	= ARRAY_SIZE(magician_supplicants),
 };
 
 static struct resource power_supply_resources[] = {
 	[0] = {
-		.name  = "ac",
-		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
-		         IORESOURCE_IRQ_LOWEDGE,
-		.start = IRQ_MAGICIAN_VBUS,
-		.end   = IRQ_MAGICIAN_VBUS,
+		.name	= "ac",
+		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
+			IORESOURCE_IRQ_LOWEDGE,
+		.start	= IRQ_MAGICIAN_VBUS,
+		.end	= IRQ_MAGICIAN_VBUS,
 	},
 	[1] = {
-		.name  = "usb",
-		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
-		         IORESOURCE_IRQ_LOWEDGE,
-		.start = IRQ_MAGICIAN_VBUS,
-		.end   = IRQ_MAGICIAN_VBUS,
+		.name	= "usb",
+		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
+			IORESOURCE_IRQ_LOWEDGE,
+		.start	= IRQ_MAGICIAN_VBUS,
+		.end	= IRQ_MAGICIAN_VBUS,
 	},
 };
 
 static struct platform_device power_supply = {
-	.name = "pda-power",
-	.id   = -1,
-	.dev  = {
+	.name	= "pda-power",
+	.id	= -1,
+	.dev = {
 		.platform_data = &power_supply_info,
 	},
-	.resource      = power_supply_resources,
-	.num_resources = ARRAY_SIZE(power_supply_resources),
+	.resource	= power_supply_resources,
+	.num_resources	= ARRAY_SIZE(power_supply_resources),
 };
 
 /*
@@ -586,11 +585,12 @@ static struct regulator_consumer_supply bq24022_consumers[] = {
 
 static struct regulator_init_data bq24022_init_data = {
 	.constraints = {
-		.max_uA         = 500000,
-		.valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
+		.max_uA		= 500000,
+		.valid_ops_mask	= REGULATOR_CHANGE_CURRENT |
+			REGULATOR_CHANGE_STATUS,
 	},
-	.num_consumer_supplies  = ARRAY_SIZE(bq24022_consumers),
-	.consumer_supplies      = bq24022_consumers,
+	.num_consumer_supplies	= ARRAY_SIZE(bq24022_consumers),
+	.consumer_supplies	= bq24022_consumers,
 };
 
 static struct gpio bq24022_gpios[] = {
@@ -603,26 +603,26 @@ static struct gpio_regulator_state bq24022_states[] = {
 };
 
 static struct gpio_regulator_config bq24022_info = {
-	.supply_name = "bq24022",
+	.supply_name		= "bq24022",
 
-	.enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
-	.enable_high = 0,
-	.enabled_at_boot = 0,
+	.enable_gpio		= GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
+	.enable_high		= 0,
+	.enabled_at_boot	= 0,
 
-	.gpios = bq24022_gpios,
-	.nr_gpios = ARRAY_SIZE(bq24022_gpios),
+	.gpios			= bq24022_gpios,
+	.nr_gpios		= ARRAY_SIZE(bq24022_gpios),
 
-	.states = bq24022_states,
-	.nr_states = ARRAY_SIZE(bq24022_states),
+	.states			= bq24022_states,
+	.nr_states		= ARRAY_SIZE(bq24022_states),
 
-	.type = REGULATOR_CURRENT,
-	.init_data = &bq24022_init_data,
+	.type			= REGULATOR_CURRENT,
+	.init_data		= &bq24022_init_data,
 };
 
 static struct platform_device bq24022 = {
-	.name = "gpio-regulator",
-	.id   = -1,
-	.dev  = {
+	.name	= "gpio-regulator",
+	.id	= -1,
+	.dev	= {
 		.platform_data = &bq24022_info,
 	},
 };
@@ -632,10 +632,10 @@ static struct platform_device bq24022 = {
  */
 
 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,
-			   "mmc card detect", data);
+		"mmc card detect", data);
 }
 
 static void magician_mci_exit(struct device *dev, void *data)
@@ -644,9 +644,9 @@ static void magician_mci_exit(struct device *dev, void *data)
 }
 
 static struct pxamci_platform_data magician_mci_info = {
-	.ocr_mask 		= MMC_VDD_32_33|MMC_VDD_33_34,
-	.init     		= magician_mci_init,
-	.exit     		= magician_mci_exit,
+	.ocr_mask		= MMC_VDD_32_33|MMC_VDD_33_34,
+	.init			= magician_mci_init,
+	.exit			= magician_mci_exit,
 	.gpio_card_detect	= -1,
 	.gpio_card_ro		= EGPIO_MAGICIAN_nSD_READONLY,
 	.gpio_card_ro_invert	= 1,
@@ -664,7 +664,6 @@ static struct pxaohci_platform_data magician_ohci_info = {
 	.power_budget	= 0,
 };
 
-
 /*
  * StrataFlash
  */
@@ -675,21 +674,21 @@ static void magician_set_vpp(struct platform_device *pdev, int vpp)
 }
 
 static struct resource strataflash_resource = {
-	.start = PXA_CS0_PHYS,
-	.end   = PXA_CS0_PHYS + SZ_64M - 1,
-	.flags = IORESOURCE_MEM,
+	.start	= PXA_CS0_PHYS,
+	.end	= PXA_CS0_PHYS + SZ_64M - 1,
+	.flags	= IORESOURCE_MEM,
 };
 
 static struct physmap_flash_data strataflash_data = {
-	.width = 4,
-	.set_vpp = magician_set_vpp,
+	.width		= 4,
+	.set_vpp	= magician_set_vpp,
 };
 
 static struct platform_device strataflash = {
-	.name          = "physmap-flash",
-	.id            = -1,
-	.resource      = &strataflash_resource,
-	.num_resources = 1,
+	.name		= "physmap-flash",
+	.id		= -1,
+	.resource	= &strataflash_resource,
+	.num_resources	= 1,
 	.dev = {
 		.platform_data = &strataflash_data,
 	},
@@ -720,7 +719,7 @@ static struct platform_device *devices[] __initdata = {
 };
 
 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" },
 	{ GPIO104_MAGICIAN_LCD_POWER_1, GPIOF_OUT_INIT_LOW, "LCD power 1" },
 	{ GPIO105_MAGICIAN_LCD_POWER_2, GPIOF_OUT_INIT_LOW, "LCD power 2" },
@@ -754,27 +753,28 @@ static void __init magician_init(void)
 	/* Check LCD type we have */
 	cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000);
 	if (cpld) {
-		u8 board_id = __raw_readb(cpld+0x14);
+		u8 board_id = __raw_readb(cpld + 0x14);
+
 		iounmap(cpld);
 		system_rev = board_id & 0x7;
 		lcd_select = board_id & 0x8;
 		pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
 		if (lcd_select && (system_rev < 3))
 			gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER,
-			                 GPIOF_OUT_INIT_LOW, "SAMSUNG_POWER");
-		pxa_set_fb_info(NULL, lcd_select ? &samsung_info : &toppoly_info);
+				GPIOF_OUT_INIT_LOW, "SAMSUNG_POWER");
+		pxa_set_fb_info(NULL,
+			lcd_select ? &samsung_info : &toppoly_info);
 	} else
 		pr_err("LCD detection: CPLD mapping failed\n");
 }
 
-
 MACHINE_START(MAGICIAN, "HTC Magician")
-	.atag_offset = 0x100,
-	.map_io = pxa27x_map_io,
-	.nr_irqs = MAGICIAN_NR_IRQS,
-	.init_irq = pxa27x_init_irq,
-	.handle_irq = pxa27x_handle_irq,
-	.init_machine = magician_init,
+	.atag_offset	= 0x100,
+	.map_io		= pxa27x_map_io,
+	.nr_irqs	= MAGICIAN_NR_IRQS,
+	.init_irq	= pxa27x_init_irq,
+	.handle_irq	= pxa27x_handle_irq,
+	.init_machine	= magician_init,
 	.init_time	= pxa_timer_init,
 	.restart	= pxa_restart,
 MACHINE_END
-- 
1.7.12.1


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

* [PATCH v4 01/26] ARM: pxa: magician: Fix indentation in machine files
@ 2015-09-28 21:09   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:09 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes the indentation for the HTC Magician machine definition.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/include/mach/magician.h |  54 ++---
 arch/arm/mach-pxa/magician.c              | 368 +++++++++++++++---------------
 2 files changed, 211 insertions(+), 211 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index ba6a6e1..b08c85a 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -78,43 +78,43 @@
  * CPLD EGPIOs
  */
 
-#define MAGICIAN_EGPIO_BASE			PXA_NR_BUILTIN_GPIO
+#define MAGICIAN_EGPIO_BASE		PXA_NR_BUILTIN_GPIO
 #define MAGICIAN_EGPIO(reg,bit) \
 	(MAGICIAN_EGPIO_BASE + 8*reg + bit)
 
 /* output */
 
-#define EGPIO_MAGICIAN_TOPPOLY_POWER		MAGICIAN_EGPIO(0, 2)
-#define EGPIO_MAGICIAN_LED_POWER		MAGICIAN_EGPIO(0, 5)
-#define EGPIO_MAGICIAN_GSM_RESET		MAGICIAN_EGPIO(0, 6)
-#define EGPIO_MAGICIAN_LCD_POWER		MAGICIAN_EGPIO(0, 7)
-#define EGPIO_MAGICIAN_SPK_POWER		MAGICIAN_EGPIO(1, 0)
-#define EGPIO_MAGICIAN_EP_POWER			MAGICIAN_EGPIO(1, 1)
-#define EGPIO_MAGICIAN_IN_SEL0			MAGICIAN_EGPIO(1, 2)
-#define EGPIO_MAGICIAN_IN_SEL1			MAGICIAN_EGPIO(1, 3)
-#define EGPIO_MAGICIAN_MIC_POWER		MAGICIAN_EGPIO(1, 4)
-#define EGPIO_MAGICIAN_CODEC_RESET		MAGICIAN_EGPIO(1, 5)
-#define EGPIO_MAGICIAN_CODEC_POWER		MAGICIAN_EGPIO(1, 6)
-#define EGPIO_MAGICIAN_BL_POWER			MAGICIAN_EGPIO(1, 7)
-#define EGPIO_MAGICIAN_SD_POWER			MAGICIAN_EGPIO(2, 0)
-#define EGPIO_MAGICIAN_CARKIT_MIC		MAGICIAN_EGPIO(2, 1)
+#define EGPIO_MAGICIAN_TOPPOLY_POWER	MAGICIAN_EGPIO(0, 2)
+#define EGPIO_MAGICIAN_LED_POWER	MAGICIAN_EGPIO(0, 5)
+#define EGPIO_MAGICIAN_GSM_RESET	MAGICIAN_EGPIO(0, 6)
+#define EGPIO_MAGICIAN_LCD_POWER	MAGICIAN_EGPIO(0, 7)
+#define EGPIO_MAGICIAN_SPK_POWER	MAGICIAN_EGPIO(1, 0)
+#define EGPIO_MAGICIAN_EP_POWER		MAGICIAN_EGPIO(1, 1)
+#define EGPIO_MAGICIAN_IN_SEL0		MAGICIAN_EGPIO(1, 2)
+#define EGPIO_MAGICIAN_IN_SEL1		MAGICIAN_EGPIO(1, 3)
+#define EGPIO_MAGICIAN_MIC_POWER	MAGICIAN_EGPIO(1, 4)
+#define EGPIO_MAGICIAN_CODEC_RESET	MAGICIAN_EGPIO(1, 5)
+#define EGPIO_MAGICIAN_CODEC_POWER	MAGICIAN_EGPIO(1, 6)
+#define EGPIO_MAGICIAN_BL_POWER		MAGICIAN_EGPIO(1, 7)
+#define EGPIO_MAGICIAN_SD_POWER		MAGICIAN_EGPIO(2, 0)
+#define EGPIO_MAGICIAN_CARKIT_MIC	MAGICIAN_EGPIO(2, 1)
 #define EGPIO_MAGICIAN_UNKNOWN_WAVEDEV_DLL	MAGICIAN_EGPIO(2, 2)
-#define EGPIO_MAGICIAN_FLASH_VPP		MAGICIAN_EGPIO(2, 3)
-#define EGPIO_MAGICIAN_BL_POWER2		MAGICIAN_EGPIO(2, 4)
-#define EGPIO_MAGICIAN_BQ24022_ISET2		MAGICIAN_EGPIO(2, 5)
-#define EGPIO_MAGICIAN_GSM_POWER		MAGICIAN_EGPIO(2, 7)
+#define EGPIO_MAGICIAN_FLASH_VPP	MAGICIAN_EGPIO(2, 3)
+#define EGPIO_MAGICIAN_BL_POWER2	MAGICIAN_EGPIO(2, 4)
+#define EGPIO_MAGICIAN_BQ24022_ISET2	MAGICIAN_EGPIO(2, 5)
+#define EGPIO_MAGICIAN_GSM_POWER	MAGICIAN_EGPIO(2, 7)
 
 /* input */
 
-#define EGPIO_MAGICIAN_CABLE_STATE_AC		MAGICIAN_EGPIO(4, 0)
-#define EGPIO_MAGICIAN_CABLE_STATE_USB		MAGICIAN_EGPIO(4, 1)
+#define EGPIO_MAGICIAN_CABLE_STATE_AC	MAGICIAN_EGPIO(4, 0)
+#define EGPIO_MAGICIAN_CABLE_STATE_USB	MAGICIAN_EGPIO(4, 1)
 
-#define EGPIO_MAGICIAN_BOARD_ID0		MAGICIAN_EGPIO(5, 0)
-#define EGPIO_MAGICIAN_BOARD_ID1		MAGICIAN_EGPIO(5, 1)
-#define EGPIO_MAGICIAN_BOARD_ID2		MAGICIAN_EGPIO(5, 2)
-#define EGPIO_MAGICIAN_LCD_SELECT		MAGICIAN_EGPIO(5, 3)
-#define EGPIO_MAGICIAN_nSD_READONLY		MAGICIAN_EGPIO(5, 4)
+#define EGPIO_MAGICIAN_BOARD_ID0	MAGICIAN_EGPIO(5, 0)
+#define EGPIO_MAGICIAN_BOARD_ID1	MAGICIAN_EGPIO(5, 1)
+#define EGPIO_MAGICIAN_BOARD_ID2	MAGICIAN_EGPIO(5, 2)
+#define EGPIO_MAGICIAN_LCD_SELECT	MAGICIAN_EGPIO(5, 3)
+#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)
 
 #endif /* _MAGICIAN_H_ */
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index a9761c2..c10f932 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -52,8 +52,8 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO20_nSDCS_2,
 	GPIO21_nSDCS_3,
 	GPIO15_nCS_1,
-	GPIO78_nCS_2,   /* PASIC3 */
-	GPIO79_nCS_3,   /* EGPIO CPLD */
+	GPIO78_nCS_2,	/* PASIC3 */
+	GPIO79_nCS_3,	/* EGPIO CPLD */
 	GPIO80_nCS_4,
 	GPIO33_nCS_5,
 
@@ -134,11 +134,11 @@ static struct pxaficp_platform_data magician_ficp_info = {
 
 #define INIT_KEY(_code, _gpio, _desc)	\
 	{				\
-		.code   = KEY_##_code,	\
-		.gpio   = _gpio,	\
-		.desc   = _desc,	\
-		.type   = EV_KEY,	\
-		.wakeup = 1,		\
+		.code	= KEY_##_code,	\
+		.gpio	= _gpio,	\
+		.desc	= _desc,	\
+		.type	= EV_KEY,	\
+		.wakeup	= 1,		\
 	}
 
 static struct gpio_keys_button magician_button_table[] = {
@@ -160,19 +160,18 @@ static struct gpio_keys_button magician_button_table[] = {
 };
 
 static struct gpio_keys_platform_data gpio_keys_data = {
-	.buttons  = magician_button_table,
-	.nbuttons = ARRAY_SIZE(magician_button_table),
+	.buttons	= magician_button_table,
+	.nbuttons	= ARRAY_SIZE(magician_button_table),
 };
 
 static struct platform_device gpio_keys = {
-	.name = "gpio-keys",
-	.dev  = {
+	.name	= "gpio-keys",
+	.dev	= {
 		.platform_data = &gpio_keys_data,
 	},
-	.id   = -1,
+	.id	= -1,
 };
 
-
 /*
  * EGPIO (Xilinx CPLD)
  *
@@ -181,48 +180,48 @@ static struct platform_device gpio_keys = {
 
 static struct resource egpio_resources[] = {
 	[0] = {
-		.start = PXA_CS3_PHYS,
-		.end   = PXA_CS3_PHYS + 0x20 - 1,
-		.flags = IORESOURCE_MEM,
+		.start	= PXA_CS3_PHYS,
+		.end	= PXA_CS3_PHYS + 0x20 - 1,
+		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
-		.start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
-		.end   = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
-		.flags = IORESOURCE_IRQ,
+		.start	= PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
+		.end	= PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
+		.flags	= IORESOURCE_IRQ,
 	},
 };
 
 static struct htc_egpio_chip egpio_chips[] = {
 	[0] = {
-		.reg_start = 0,
-		.gpio_base = MAGICIAN_EGPIO(0, 0),
-		.num_gpios = 24,
-		.direction = HTC_EGPIO_OUTPUT,
-		.initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */
+		.reg_start	= 0,
+		.gpio_base	= MAGICIAN_EGPIO(0, 0),
+		.num_gpios	= 24,
+		.direction	= HTC_EGPIO_OUTPUT,
+		.initial_values	= 0x40, /* EGPIO_MAGICIAN_GSM_RESET */
 	},
 	[1] = {
-		.reg_start = 4,
-		.gpio_base = MAGICIAN_EGPIO(4, 0),
-		.num_gpios = 24,
-		.direction = HTC_EGPIO_INPUT,
+		.reg_start	= 4,
+		.gpio_base	= MAGICIAN_EGPIO(4, 0),
+		.num_gpios	= 24,
+		.direction	= HTC_EGPIO_INPUT,
 	},
 };
 
 static struct htc_egpio_platform_data egpio_info = {
-	.reg_width    = 8,
-	.bus_width    = 32,
-	.irq_base     = IRQ_BOARD_START,
-	.num_irqs     = 4,
-	.ack_register = 3,
-	.chip         = egpio_chips,
-	.num_chips    = ARRAY_SIZE(egpio_chips),
+	.reg_width	= 8,
+	.bus_width	= 32,
+	.irq_base	= IRQ_BOARD_START,
+	.num_irqs	= 4,
+	.ack_register	= 3,
+	.chip		= egpio_chips,
+	.num_chips	= ARRAY_SIZE(egpio_chips),
 };
 
 static struct platform_device egpio = {
-	.name          = "htc-egpio",
-	.id            = -1,
-	.resource      = egpio_resources,
-	.num_resources = ARRAY_SIZE(egpio_resources),
+	.name		= "htc-egpio",
+	.id		= -1,
+	.resource	= egpio_resources,
+	.num_resources	= ARRAY_SIZE(egpio_resources),
 	.dev = {
 		.platform_data = &egpio_info,
 	},
@@ -234,33 +233,33 @@ static struct platform_device egpio = {
 
 static struct pxafb_mode_info toppoly_modes[] = {
 	{
-		.pixclock     = 96153,
-		.bpp          = 16,
-		.xres         = 240,
-		.yres         = 320,
-		.hsync_len    = 11,
-		.vsync_len    = 3,
-		.left_margin  = 19,
-		.upper_margin = 2,
-		.right_margin = 10,
-		.lower_margin = 2,
-		.sync         = 0,
+		.pixclock	= 96153,
+		.bpp		= 16,
+		.xres		= 240,
+		.yres		= 320,
+		.hsync_len	= 11,
+		.vsync_len	= 3,
+		.left_margin	= 19,
+		.upper_margin	= 2,
+		.right_margin	= 10,
+		.lower_margin	= 2,
+		.sync		= 0,
 	},
 };
 
 static struct pxafb_mode_info samsung_modes[] = {
 	{
-		.pixclock     = 96153,
-		.bpp          = 16,
-		.xres         = 240,
-		.yres         = 320,
-		.hsync_len    = 8,
-		.vsync_len    = 4,
-		.left_margin  = 9,
-		.upper_margin = 4,
-		.right_margin = 9,
-		.lower_margin = 4,
-		.sync         = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+		.pixclock	= 96153,
+		.bpp		= 16,
+		.xres		= 240,
+		.yres		= 320,
+		.hsync_len	= 8,
+		.vsync_len	= 4,
+		.left_margin	= 9,
+		.upper_margin	= 4,
+		.right_margin	= 9,
+		.lower_margin	= 4,
+		.sync	= FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
 	},
 };
 
@@ -326,20 +325,20 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
 }
 
 static struct pxafb_mach_info toppoly_info = {
-	.modes           = toppoly_modes,
-	.num_modes       = 1,
-	.fixed_modes     = 1,
-	.lcd_conn	= LCD_COLOR_TFT_16BPP,
-	.pxafb_lcd_power = toppoly_lcd_power,
+	.modes			= toppoly_modes,
+	.num_modes		= 1,
+	.fixed_modes		= 1,
+	.lcd_conn		= LCD_COLOR_TFT_16BPP,
+	.pxafb_lcd_power	= toppoly_lcd_power,
 };
 
 static struct pxafb_mach_info samsung_info = {
-	.modes           = samsung_modes,
-	.num_modes       = 1,
-	.fixed_modes     = 1,
-	.lcd_conn	 = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |\
-			   LCD_ALTERNATE_MAPPING,
-	.pxafb_lcd_power = samsung_lcd_power,
+	.modes			= samsung_modes,
+	.num_modes		= 1,
+	.fixed_modes		= 1,
+	.lcd_conn		= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |
+		LCD_ALTERNATE_MAPPING,
+	.pxafb_lcd_power	= samsung_lcd_power,
 };
 
 /*
@@ -347,8 +346,8 @@ static struct pxafb_mach_info samsung_info = {
  */
 
 static struct gpio magician_bl_gpios[] = {
-	{ EGPIO_MAGICIAN_BL_POWER,  GPIOF_DIR_OUT, "Backlight power" },
-	{ EGPIO_MAGICIAN_BL_POWER2, GPIOF_DIR_OUT, "Backlight power 2" },
+	{ EGPIO_MAGICIAN_BL_POWER,	GPIOF_DIR_OUT, "Backlight power" },
+	{ EGPIO_MAGICIAN_BL_POWER2,	GPIOF_DIR_OUT, "Backlight power 2" },
 };
 
 static int magician_backlight_init(struct device *dev)
@@ -374,22 +373,22 @@ static void magician_backlight_exit(struct device *dev)
 }
 
 static struct platform_pwm_backlight_data backlight_data = {
-	.pwm_id         = 0,
-	.max_brightness = 272,
-	.dft_brightness = 100,
-	.pwm_period_ns  = 30923,
-	.enable_gpio    = -1,
-	.init           = magician_backlight_init,
-	.notify         = magician_backlight_notify,
-	.exit           = magician_backlight_exit,
+	.pwm_id		= 0,
+	.max_brightness	= 272,
+	.dft_brightness	= 100,
+	.pwm_period_ns	= 30923,
+	.enable_gpio	= -1,
+	.init		= magician_backlight_init,
+	.notify		= magician_backlight_notify,
+	.exit		= magician_backlight_exit,
 };
 
 static struct platform_device backlight = {
-	.name = "pwm-backlight",
-	.id   = -1,
-	.dev  = {
-		.parent        = &pxa27x_device_pwm0.dev,
-		.platform_data = &backlight_data,
+	.name	= "pwm-backlight",
+	.id	= -1,
+	.dev	= {
+		.parent		= &pxa27x_device_pwm0.dev,
+		.platform_data	= &backlight_data,
 	},
 };
 
@@ -416,9 +415,9 @@ static struct gpio_led_platform_data gpio_led_info = {
 };
 
 static struct platform_device leds_gpio = {
-	.name = "leds-gpio",
-	.id   = -1,
-	.dev  = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
 		.platform_data = &gpio_led_info,
 	},
 };
@@ -426,37 +425,37 @@ static struct platform_device leds_gpio = {
 static struct pasic3_led pasic3_leds[] = {
 	{
 		.led = {
-			.name            = "magician:red",
+			.name = "magician:red",
 			.default_trigger = "ds2760-battery.0-charging",
 		},
-		.hw_num = 0,
-		.bit2   = PASIC3_BIT2_LED0,
-		.mask   = PASIC3_MASK_LED0,
+		.hw_num	= 0,
+		.bit2	= PASIC3_BIT2_LED0,
+		.mask	= PASIC3_MASK_LED0,
 	},
 	{
 		.led = {
-			.name            = "magician:green",
+			.name = "magician:green",
 			.default_trigger = "ds2760-battery.0-charging-or-full",
 		},
-		.hw_num = 1,
-		.bit2   = PASIC3_BIT2_LED1,
-		.mask   = PASIC3_MASK_LED1,
+		.hw_num	= 1,
+		.bit2	= PASIC3_BIT2_LED1,
+		.mask	= PASIC3_MASK_LED1,
 	},
 	{
 		.led = {
-			.name            = "magician:blue",
+			.name = "magician:blue",
 			.default_trigger = "bluetooth",
 		},
-		.hw_num = 2,
-		.bit2   = PASIC3_BIT2_LED2,
-		.mask   = PASIC3_MASK_LED2,
+		.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,
+	.num_leds	= ARRAY_SIZE(pasic3_leds),
+	.power_gpio	= EGPIO_MAGICIAN_LED_POWER,
+	.leds		= pasic3_leds,
 };
 
 /*
@@ -465,21 +464,21 @@ static struct pasic3_leds_machinfo pasic3_leds_info = {
 
 static struct resource pasic3_resources[] = {
 	[0] = {
-		.start  = PXA_CS2_PHYS,
+		.start	= PXA_CS2_PHYS,
 		.end	= PXA_CS2_PHYS + 0x1b,
-		.flags  = IORESOURCE_MEM,
+		.flags	= IORESOURCE_MEM,
 	},
 	/* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */
 	[1] = {
-		.start  = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
-		.end    = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
-		.flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
+		.start	= PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
+		.end	= PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
+		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
 	}
 };
 
 static struct pasic3_platform_data pasic3_platform_data = {
-	.led_pdata  = &pasic3_leds_info,
-	.clock_rate = 4000000,
+	.led_pdata	= &pasic3_leds_info,
+	.clock_rate	= 4000000,
 };
 
 static struct platform_device pasic3 = {
@@ -497,21 +496,21 @@ static struct platform_device pasic3 = {
  */
 
 static struct resource gpio_vbus_resource = {
-	.flags = IORESOURCE_IRQ,
-	.start = IRQ_MAGICIAN_VBUS,
-	.end   = IRQ_MAGICIAN_VBUS,
+	.flags	= IORESOURCE_IRQ,
+	.start	= IRQ_MAGICIAN_VBUS,
+	.end	= IRQ_MAGICIAN_VBUS,
 };
 
 static struct gpio_vbus_mach_info gpio_vbus_info = {
-	.gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN,
-	.gpio_vbus   = EGPIO_MAGICIAN_CABLE_STATE_USB,
+	.gpio_pullup	= GPIO27_MAGICIAN_USBC_PUEN,
+	.gpio_vbus	= EGPIO_MAGICIAN_CABLE_STATE_USB,
 };
 
 static struct platform_device gpio_vbus = {
-	.name          = "gpio-vbus",
-	.id            = -1,
-	.num_resources = 1,
-	.resource      = &gpio_vbus_resource,
+	.name		= "gpio-vbus",
+	.id		= -1,
+	.num_resources	= 1,
+	.resource	= &gpio_vbus_resource,
 	.dev = {
 		.platform_data = &gpio_vbus_info,
 	},
@@ -541,38 +540,38 @@ static char *magician_supplicants[] = {
 };
 
 static struct pda_power_pdata power_supply_info = {
-	.init            = power_supply_init,
-	.is_ac_online    = magician_is_ac_online,
-	.exit            = power_supply_exit,
-	.supplied_to     = magician_supplicants,
-	.num_supplicants = ARRAY_SIZE(magician_supplicants),
+	.init			= power_supply_init,
+	.is_ac_online		= magician_is_ac_online,
+	.exit			= power_supply_exit,
+	.supplied_to		= magician_supplicants,
+	.num_supplicants	= ARRAY_SIZE(magician_supplicants),
 };
 
 static struct resource power_supply_resources[] = {
 	[0] = {
-		.name  = "ac",
-		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
-		         IORESOURCE_IRQ_LOWEDGE,
-		.start = IRQ_MAGICIAN_VBUS,
-		.end   = IRQ_MAGICIAN_VBUS,
+		.name	= "ac",
+		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
+			IORESOURCE_IRQ_LOWEDGE,
+		.start	= IRQ_MAGICIAN_VBUS,
+		.end	= IRQ_MAGICIAN_VBUS,
 	},
 	[1] = {
-		.name  = "usb",
-		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
-		         IORESOURCE_IRQ_LOWEDGE,
-		.start = IRQ_MAGICIAN_VBUS,
-		.end   = IRQ_MAGICIAN_VBUS,
+		.name	= "usb",
+		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
+			IORESOURCE_IRQ_LOWEDGE,
+		.start	= IRQ_MAGICIAN_VBUS,
+		.end	= IRQ_MAGICIAN_VBUS,
 	},
 };
 
 static struct platform_device power_supply = {
-	.name = "pda-power",
-	.id   = -1,
-	.dev  = {
+	.name	= "pda-power",
+	.id	= -1,
+	.dev = {
 		.platform_data = &power_supply_info,
 	},
-	.resource      = power_supply_resources,
-	.num_resources = ARRAY_SIZE(power_supply_resources),
+	.resource	= power_supply_resources,
+	.num_resources	= ARRAY_SIZE(power_supply_resources),
 };
 
 /*
@@ -586,11 +585,12 @@ static struct regulator_consumer_supply bq24022_consumers[] = {
 
 static struct regulator_init_data bq24022_init_data = {
 	.constraints = {
-		.max_uA         = 500000,
-		.valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
+		.max_uA		= 500000,
+		.valid_ops_mask	= REGULATOR_CHANGE_CURRENT |
+			REGULATOR_CHANGE_STATUS,
 	},
-	.num_consumer_supplies  = ARRAY_SIZE(bq24022_consumers),
-	.consumer_supplies      = bq24022_consumers,
+	.num_consumer_supplies	= ARRAY_SIZE(bq24022_consumers),
+	.consumer_supplies	= bq24022_consumers,
 };
 
 static struct gpio bq24022_gpios[] = {
@@ -603,26 +603,26 @@ static struct gpio_regulator_state bq24022_states[] = {
 };
 
 static struct gpio_regulator_config bq24022_info = {
-	.supply_name = "bq24022",
+	.supply_name		= "bq24022",
 
-	.enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
-	.enable_high = 0,
-	.enabled_at_boot = 0,
+	.enable_gpio		= GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
+	.enable_high		= 0,
+	.enabled_at_boot	= 0,
 
-	.gpios = bq24022_gpios,
-	.nr_gpios = ARRAY_SIZE(bq24022_gpios),
+	.gpios			= bq24022_gpios,
+	.nr_gpios		= ARRAY_SIZE(bq24022_gpios),
 
-	.states = bq24022_states,
-	.nr_states = ARRAY_SIZE(bq24022_states),
+	.states			= bq24022_states,
+	.nr_states		= ARRAY_SIZE(bq24022_states),
 
-	.type = REGULATOR_CURRENT,
-	.init_data = &bq24022_init_data,
+	.type			= REGULATOR_CURRENT,
+	.init_data		= &bq24022_init_data,
 };
 
 static struct platform_device bq24022 = {
-	.name = "gpio-regulator",
-	.id   = -1,
-	.dev  = {
+	.name	= "gpio-regulator",
+	.id	= -1,
+	.dev	= {
 		.platform_data = &bq24022_info,
 	},
 };
@@ -632,10 +632,10 @@ static struct platform_device bq24022 = {
  */
 
 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,
-			   "mmc card detect", data);
+		"mmc card detect", data);
 }
 
 static void magician_mci_exit(struct device *dev, void *data)
@@ -644,9 +644,9 @@ static void magician_mci_exit(struct device *dev, void *data)
 }
 
 static struct pxamci_platform_data magician_mci_info = {
-	.ocr_mask 		= MMC_VDD_32_33|MMC_VDD_33_34,
-	.init     		= magician_mci_init,
-	.exit     		= magician_mci_exit,
+	.ocr_mask		= MMC_VDD_32_33|MMC_VDD_33_34,
+	.init			= magician_mci_init,
+	.exit			= magician_mci_exit,
 	.gpio_card_detect	= -1,
 	.gpio_card_ro		= EGPIO_MAGICIAN_nSD_READONLY,
 	.gpio_card_ro_invert	= 1,
@@ -664,7 +664,6 @@ static struct pxaohci_platform_data magician_ohci_info = {
 	.power_budget	= 0,
 };
 
-
 /*
  * StrataFlash
  */
@@ -675,21 +674,21 @@ static void magician_set_vpp(struct platform_device *pdev, int vpp)
 }
 
 static struct resource strataflash_resource = {
-	.start = PXA_CS0_PHYS,
-	.end   = PXA_CS0_PHYS + SZ_64M - 1,
-	.flags = IORESOURCE_MEM,
+	.start	= PXA_CS0_PHYS,
+	.end	= PXA_CS0_PHYS + SZ_64M - 1,
+	.flags	= IORESOURCE_MEM,
 };
 
 static struct physmap_flash_data strataflash_data = {
-	.width = 4,
-	.set_vpp = magician_set_vpp,
+	.width		= 4,
+	.set_vpp	= magician_set_vpp,
 };
 
 static struct platform_device strataflash = {
-	.name          = "physmap-flash",
-	.id            = -1,
-	.resource      = &strataflash_resource,
-	.num_resources = 1,
+	.name		= "physmap-flash",
+	.id		= -1,
+	.resource	= &strataflash_resource,
+	.num_resources	= 1,
 	.dev = {
 		.platform_data = &strataflash_data,
 	},
@@ -720,7 +719,7 @@ static struct platform_device *devices[] __initdata = {
 };
 
 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" },
 	{ GPIO104_MAGICIAN_LCD_POWER_1, GPIOF_OUT_INIT_LOW, "LCD power 1" },
 	{ GPIO105_MAGICIAN_LCD_POWER_2, GPIOF_OUT_INIT_LOW, "LCD power 2" },
@@ -754,27 +753,28 @@ static void __init magician_init(void)
 	/* Check LCD type we have */
 	cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000);
 	if (cpld) {
-		u8 board_id = __raw_readb(cpld+0x14);
+		u8 board_id = __raw_readb(cpld + 0x14);
+
 		iounmap(cpld);
 		system_rev = board_id & 0x7;
 		lcd_select = board_id & 0x8;
 		pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
 		if (lcd_select && (system_rev < 3))
 			gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER,
-			                 GPIOF_OUT_INIT_LOW, "SAMSUNG_POWER");
-		pxa_set_fb_info(NULL, lcd_select ? &samsung_info : &toppoly_info);
+				GPIOF_OUT_INIT_LOW, "SAMSUNG_POWER");
+		pxa_set_fb_info(NULL,
+			lcd_select ? &samsung_info : &toppoly_info);
 	} else
 		pr_err("LCD detection: CPLD mapping failed\n");
 }
 
-
 MACHINE_START(MAGICIAN, "HTC Magician")
-	.atag_offset = 0x100,
-	.map_io = pxa27x_map_io,
-	.nr_irqs = MAGICIAN_NR_IRQS,
-	.init_irq = pxa27x_init_irq,
-	.handle_irq = pxa27x_handle_irq,
-	.init_machine = magician_init,
+	.atag_offset	= 0x100,
+	.map_io		= pxa27x_map_io,
+	.nr_irqs	= MAGICIAN_NR_IRQS,
+	.init_irq	= pxa27x_init_irq,
+	.handle_irq	= pxa27x_handle_irq,
+	.init_machine	= magician_init,
 	.init_time	= pxa_timer_init,
 	.restart	= pxa_restart,
 MACHINE_END
-- 
1.7.12.1

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

* [PATCH v4 02/26] ARM: pxa: magician: Change comments to be more informative
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:10   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:10 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch changes the comments in the HTC Magician machine source code
to better describe used devices and interfaces.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 46 +++++++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index c10f932..c8fa379 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -57,31 +57,31 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO80_nCS_4,
 	GPIO33_nCS_5,
 
-	/* I2C */
+	/* I2C UDA1380 + OV9640 */
 	GPIO117_I2C_SCL,
 	GPIO118_I2C_SDA,
 
-	/* PWM 0 */
+	/* PWM 0 - LCD backlight */
 	GPIO16_PWM0_OUT,
 
-	/* I2S */
+	/* I2S UDA1380 capture */
 	GPIO28_I2S_BITCLK_OUT,
 	GPIO29_I2S_SDATA_IN,
 	GPIO31_I2S_SYNC,
 	GPIO113_I2S_SYSCLK,
 
-	/* SSP 1 */
+	/* SSP 1 UDA1380 playback */
 	GPIO23_SSP1_SCLK,
 	GPIO24_SSP1_SFRM,
 	GPIO25_SSP1_TXD,
 
-	/* SSP 2 */
+	/* SSP 2 TSC2046 touchscreen */
 	GPIO19_SSP2_SCLK,
 	GPIO14_SSP2_SFRM,
 	GPIO89_SSP2_TXD,
 	GPIO88_SSP2_RXD,
 
-	/* MMC */
+	/* MMC/SD/SDHC slot */
 	GPIO32_MMC_CLK,
 	GPIO92_MMC_DAT_0,
 	GPIO109_MMC_DAT_1,
@@ -92,7 +92,7 @@ static unsigned long magician_pin_config[] __initdata = {
 	/* LCD */
 	GPIOxx_LCD_TFT_16BPP,
 
-	/* QCI */
+	/* QCI camera interface */
 	GPIO12_CIF_DD_7,
 	GPIO17_CIF_DD_6,
 	GPIO50_CIF_DD_3,
@@ -120,7 +120,7 @@ static unsigned long magician_pin_config[] __initdata = {
 };
 
 /*
- * IRDA
+ * IrDA
  */
 
 static struct pxaficp_platform_data magician_ficp_info = {
@@ -175,7 +175,9 @@ static struct platform_device gpio_keys = {
 /*
  * 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[] = {
@@ -197,7 +199,10 @@ static struct htc_egpio_chip egpio_chips[] = {
 		.gpio_base	= MAGICIAN_EGPIO(0, 0),
 		.num_gpios	= 24,
 		.direction	= HTC_EGPIO_OUTPUT,
-		.initial_values	= 0x40, /* EGPIO_MAGICIAN_GSM_RESET */
+		/*
+		 * Depends on modules configuration
+		 */
+		.initial_values	= 0x40,
 	},
 	[1] = {
 		.reg_start	= 4,
@@ -228,7 +233,7 @@ static struct platform_device egpio = {
 };
 
 /*
- * LCD - Toppoly TD028STEB1 or Samsung LTP280QV
+ * PXAFB LCD - Toppoly TD028STEB1 or Samsung LTP280QV
  */
 
 static struct pxafb_mode_info toppoly_modes[] = {
@@ -372,6 +377,13 @@ static void magician_backlight_exit(struct device *dev)
 	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 = {
 	.pwm_id		= 0,
 	.max_brightness	= 272,
@@ -393,7 +405,7 @@ static struct platform_device backlight = {
 };
 
 /*
- * LEDs
+ * GPIO LEDs, Phone keys backlight, vibra
  */
 
 static struct gpio_led gpio_leds[] = {
@@ -422,6 +434,10 @@ static struct platform_device leds_gpio = {
 	},
 };
 
+/*
+ * PASIC3 LEDs
+ */
+
 static struct pasic3_led pasic3_leds[] = {
 	{
 		.led = {
@@ -459,7 +475,7 @@ static struct pasic3_leds_machinfo pasic3_leds_info = {
 };
 
 /*
- * PASIC3 with DS1WM
+ * PASIC3 DS1WM
  */
 
 static struct resource pasic3_resources[] = {
@@ -492,7 +508,7 @@ static struct platform_device pasic3 = {
 };
 
 /*
- * USB "Transceiver"
+ * PXA UDC
  */
 
 static struct resource gpio_vbus_resource = {
@@ -695,7 +711,7 @@ static struct platform_device strataflash = {
 };
 
 /*
- * I2C
+ * PXA I2C main controller
  */
 
 static struct i2c_pxa_platform_data i2c_info = {
-- 
1.7.12.1


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

* [PATCH v4 02/26] ARM: pxa: magician: Change comments to be more informative
@ 2015-09-28 21:10   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:10 UTC (permalink / raw)
  To: linux-arm-kernel

This patch changes the comments in the HTC Magician machine source code
to better describe used devices and interfaces.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 46 +++++++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index c10f932..c8fa379 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -57,31 +57,31 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO80_nCS_4,
 	GPIO33_nCS_5,
 
-	/* I2C */
+	/* I2C UDA1380 + OV9640 */
 	GPIO117_I2C_SCL,
 	GPIO118_I2C_SDA,
 
-	/* PWM 0 */
+	/* PWM 0 - LCD backlight */
 	GPIO16_PWM0_OUT,
 
-	/* I2S */
+	/* I2S UDA1380 capture */
 	GPIO28_I2S_BITCLK_OUT,
 	GPIO29_I2S_SDATA_IN,
 	GPIO31_I2S_SYNC,
 	GPIO113_I2S_SYSCLK,
 
-	/* SSP 1 */
+	/* SSP 1 UDA1380 playback */
 	GPIO23_SSP1_SCLK,
 	GPIO24_SSP1_SFRM,
 	GPIO25_SSP1_TXD,
 
-	/* SSP 2 */
+	/* SSP 2 TSC2046 touchscreen */
 	GPIO19_SSP2_SCLK,
 	GPIO14_SSP2_SFRM,
 	GPIO89_SSP2_TXD,
 	GPIO88_SSP2_RXD,
 
-	/* MMC */
+	/* MMC/SD/SDHC slot */
 	GPIO32_MMC_CLK,
 	GPIO92_MMC_DAT_0,
 	GPIO109_MMC_DAT_1,
@@ -92,7 +92,7 @@ static unsigned long magician_pin_config[] __initdata = {
 	/* LCD */
 	GPIOxx_LCD_TFT_16BPP,
 
-	/* QCI */
+	/* QCI camera interface */
 	GPIO12_CIF_DD_7,
 	GPIO17_CIF_DD_6,
 	GPIO50_CIF_DD_3,
@@ -120,7 +120,7 @@ static unsigned long magician_pin_config[] __initdata = {
 };
 
 /*
- * IRDA
+ * IrDA
  */
 
 static struct pxaficp_platform_data magician_ficp_info = {
@@ -175,7 +175,9 @@ static struct platform_device gpio_keys = {
 /*
  * 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[] = {
@@ -197,7 +199,10 @@ static struct htc_egpio_chip egpio_chips[] = {
 		.gpio_base	= MAGICIAN_EGPIO(0, 0),
 		.num_gpios	= 24,
 		.direction	= HTC_EGPIO_OUTPUT,
-		.initial_values	= 0x40, /* EGPIO_MAGICIAN_GSM_RESET */
+		/*
+		 * Depends on modules configuration
+		 */
+		.initial_values	= 0x40,
 	},
 	[1] = {
 		.reg_start	= 4,
@@ -228,7 +233,7 @@ static struct platform_device egpio = {
 };
 
 /*
- * LCD - Toppoly TD028STEB1 or Samsung LTP280QV
+ * PXAFB LCD - Toppoly TD028STEB1 or Samsung LTP280QV
  */
 
 static struct pxafb_mode_info toppoly_modes[] = {
@@ -372,6 +377,13 @@ static void magician_backlight_exit(struct device *dev)
 	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 = {
 	.pwm_id		= 0,
 	.max_brightness	= 272,
@@ -393,7 +405,7 @@ static struct platform_device backlight = {
 };
 
 /*
- * LEDs
+ * GPIO LEDs, Phone keys backlight, vibra
  */
 
 static struct gpio_led gpio_leds[] = {
@@ -422,6 +434,10 @@ static struct platform_device leds_gpio = {
 	},
 };
 
+/*
+ * PASIC3 LEDs
+ */
+
 static struct pasic3_led pasic3_leds[] = {
 	{
 		.led = {
@@ -459,7 +475,7 @@ static struct pasic3_leds_machinfo pasic3_leds_info = {
 };
 
 /*
- * PASIC3 with DS1WM
+ * PASIC3 DS1WM
  */
 
 static struct resource pasic3_resources[] = {
@@ -492,7 +508,7 @@ static struct platform_device pasic3 = {
 };
 
 /*
- * USB "Transceiver"
+ * PXA UDC
  */
 
 static struct resource gpio_vbus_resource = {
@@ -695,7 +711,7 @@ static struct platform_device strataflash = {
 };
 
 /*
- * I2C
+ * PXA I2C main controller
  */
 
 static struct i2c_pxa_platform_data i2c_info = {
-- 
1.7.12.1

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

* [PATCH v4 03/26] ARM: pxa: magician: Print more specific error message for global GPIOs
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:10   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:10 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Print more specific error message for global GPIOs.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index c8fa379..29d8146 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -752,7 +752,7 @@ static void __init magician_init(void)
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config));
 	err = gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios));
 	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_btuart_info(NULL);
-- 
1.7.12.1


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

* [PATCH v4 03/26] ARM: pxa: magician: Print more specific error message for global GPIOs
@ 2015-09-28 21:10   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:10 UTC (permalink / raw)
  To: linux-arm-kernel

Print more specific error message for global GPIOs.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index c8fa379..29d8146 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -752,7 +752,7 @@ static void __init magician_init(void)
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config));
 	err = gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios));
 	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_btuart_info(NULL);
-- 
1.7.12.1

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

* [PATCH v4 04/26] ARM: pxa: magician: Optimize debug messages for LCD power
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:11   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:11 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Optimize the debug messages for the LCD power.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 29d8146..1bac785 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -270,10 +270,9 @@ static struct pxafb_mode_info samsung_modes[] = {
 
 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) {
-		pr_debug("on\n");
 		gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1);
 		gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1);
 		udelay(2000);
@@ -285,7 +284,6 @@ static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si)
 		udelay(2000);
 		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
 	} else {
-		pr_debug("off\n");
 		msleep(15);
 		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
 		udelay(500);
@@ -298,10 +296,9 @@ static void toppoly_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) {
-		pr_debug("on\n");
 		if (system_rev < 3)
 			gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1);
 		else
@@ -314,7 +311,6 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
 		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
 		mdelay(10);
 	} else {
-		pr_debug("off\n");
 		mdelay(10);
 		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
 		mdelay(30);
-- 
1.7.12.1


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

* [PATCH v4 04/26] ARM: pxa: magician: Optimize debug messages for LCD power
@ 2015-09-28 21:11   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:11 UTC (permalink / raw)
  To: linux-arm-kernel

Optimize the debug messages for the LCD power.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 29d8146..1bac785 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -270,10 +270,9 @@ static struct pxafb_mode_info samsung_modes[] = {
 
 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) {
-		pr_debug("on\n");
 		gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1);
 		gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1);
 		udelay(2000);
@@ -285,7 +284,6 @@ static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si)
 		udelay(2000);
 		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
 	} else {
-		pr_debug("off\n");
 		msleep(15);
 		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
 		udelay(500);
@@ -298,10 +296,9 @@ static void toppoly_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) {
-		pr_debug("on\n");
 		if (system_rev < 3)
 			gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1);
 		else
@@ -314,7 +311,6 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
 		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
 		mdelay(10);
 	} else {
-		pr_debug("off\n");
 		mdelay(10);
 		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
 		mdelay(30);
-- 
1.7.12.1

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

* [PATCH v4 05/26] ARM: pxa: magician: Change description of LCD power GPIO
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:11   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:11 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch changes the description of the LCD power GPIO to be more
specific.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 1bac785..a93ed14 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -773,7 +773,7 @@ static void __init magician_init(void)
 		pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
 		if (lcd_select && (system_rev < 3))
 			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);
 	} else
-- 
1.7.12.1


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

* [PATCH v4 05/26] ARM: pxa: magician: Change description of LCD power GPIO
@ 2015-09-28 21:11   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:11 UTC (permalink / raw)
  To: linux-arm-kernel

This patch changes the description of the LCD power GPIO to be more
specific.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 1bac785..a93ed14 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -773,7 +773,7 @@ static void __init magician_init(void)
 		pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
 		if (lcd_select && (system_rev < 3))
 			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);
 	} else
-- 
1.7.12.1

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

* [PATCH v4 06/26] ARM: pxa: magician: Add new discovered EGPIO pins
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:15   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:15 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch adds EGPIO pins: Infra transceiver power, NiCD charging and
inserted charger cable.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/include/mach/magician.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index b08c85a..3f8922a 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -98,10 +98,11 @@
 #define EGPIO_MAGICIAN_BL_POWER		MAGICIAN_EGPIO(1, 7)
 #define EGPIO_MAGICIAN_SD_POWER		MAGICIAN_EGPIO(2, 0)
 #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_BL_POWER2	MAGICIAN_EGPIO(2, 4)
 #define EGPIO_MAGICIAN_BQ24022_ISET2	MAGICIAN_EGPIO(2, 5)
+#define EGPIO_MAGICIAN_NICD_CHARGE	MAGICIAN_EGPIO(2, 6)
 #define EGPIO_MAGICIAN_GSM_POWER	MAGICIAN_EGPIO(2, 7)
 
 /* input */
@@ -116,5 +117,7 @@
 #define EGPIO_MAGICIAN_nSD_READONLY	MAGICIAN_EGPIO(5, 4)
 
 #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, 4)
 
 #endif /* _MAGICIAN_H_ */
-- 
1.7.12.1


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

* [PATCH v4 06/26] ARM: pxa: magician: Add new discovered EGPIO pins
@ 2015-09-28 21:15   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:15 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds EGPIO pins: Infra transceiver power, NiCD charging and
inserted charger cable.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/include/mach/magician.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index b08c85a..3f8922a 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -98,10 +98,11 @@
 #define EGPIO_MAGICIAN_BL_POWER		MAGICIAN_EGPIO(1, 7)
 #define EGPIO_MAGICIAN_SD_POWER		MAGICIAN_EGPIO(2, 0)
 #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_BL_POWER2	MAGICIAN_EGPIO(2, 4)
 #define EGPIO_MAGICIAN_BQ24022_ISET2	MAGICIAN_EGPIO(2, 5)
+#define EGPIO_MAGICIAN_NICD_CHARGE	MAGICIAN_EGPIO(2, 6)
 #define EGPIO_MAGICIAN_GSM_POWER	MAGICIAN_EGPIO(2, 7)
 
 /* input */
@@ -116,5 +117,7 @@
 #define EGPIO_MAGICIAN_nSD_READONLY	MAGICIAN_EGPIO(5, 4)
 
 #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, 4)
 
 #endif /* _MAGICIAN_H_ */
-- 
1.7.12.1

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

* [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:15   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:15 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch fixes a pin mux for the HTC Magician machine. Wrong and missing
definitions caused a bad LCD operation and an unavailability of several
peripherals.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 77 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 70 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index a93ed14..91d302b 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -4,8 +4,9 @@
  * and T-Mobile MDA Compact.
  *
  * Copyright (c) 2006-2007 Philipp Zabel
+ * Copyright (c) 2014-2015 Petr Cvek (massive rework)
  *
- * Based on hx4700.c, spitz.c and others.
+ * Based on hx4700.c, spitz.c, board-overo.c and others.
  *
  * 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
@@ -56,6 +57,8 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO79_nCS_3,	/* EGPIO CPLD */
 	GPIO80_nCS_4,
 	GPIO33_nCS_5,
+	GPIO49_nPWE,
+	GPIO18_RDY,
 
 	/* I2C UDA1380 + OV9640 */
 	GPIO117_I2C_SCL,
@@ -64,6 +67,10 @@ static unsigned long magician_pin_config[] __initdata = {
 	/* PWM 0 - LCD backlight */
 	GPIO16_PWM0_OUT,
 
+	/* Omnivision camera power and reset GPIO */
+	MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH),	/* /Enable */
+	MFP_CFG_OUT(GPIO57, AF0, DRIVE_HIGH),	/* Reset */
+
 	/* I2S UDA1380 capture */
 	GPIO28_I2S_BITCLK_OUT,
 	GPIO29_I2S_SDATA_IN,
@@ -89,8 +96,26 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO111_MMC_DAT_3,
 	GPIO112_MMC_CMD,
 
-	/* LCD */
-	GPIOxx_LCD_TFT_16BPP,
+	/*
+	 * LCD
+	 * NOTICE Samsung LTP280QV:
+	 * cannot use GPIOxx_LCD_TFT_16BPP, GPIO75 is LCD power,
+	 * 74 unused (AF0 by bootloader?)
+	 */
+	GPIOxx_LCD_16BPP,
+	GPIO76_LCD_PCLK,
+	GPIO77_LCD_BIAS,	/* data_valid (v/hsync) (ADS7846 sync?) */
+
+	/* NOTICE valid LCD init sequence */
+
+	/* for GPIO75_MAGICIAN_SAMSUNG_POWER */
+	MFP_CFG_OUT(GPIO75, AF0, DRIVE_HIGH),
+	/* for GPIO106_MAGICIAN_LCD_DCDC_NRESET */
+	MFP_CFG_OUT(GPIO106, AF0, DRIVE_HIGH),
+	/* for GPIO104_MAGICIAN_LCD_VOFF_EN */
+	MFP_CFG_OUT(GPIO104, AF0, DRIVE_HIGH),
+	/* for GPIO105_MAGICIAN_LCD_VON_EN */
+	MFP_CFG_OUT(GPIO105, AF0, DRIVE_HIGH),
 
 	/* QCI camera interface */
 	GPIO12_CIF_DD_7,
@@ -107,16 +132,54 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO85_CIF_LV,
 
 	/* Magician specific input GPIOs */
-	GPIO9_GPIO,	/* unknown */
 	GPIO10_GPIO,	/* GSM_IRQ */
 	GPIO13_GPIO,	/* CPLD_IRQ */
 	GPIO107_GPIO,	/* DS1WM_IRQ */
 	GPIO108_GPIO,	/* GSM_READY */
 	GPIO115_GPIO,	/* nPEN_IRQ */
 
-	/* I2C */
-	GPIO117_I2C_SCL,
-	GPIO118_I2C_SDA,
+	/* Vibration motor */
+	MFP_CFG_OUT(GPIO22, AF0, DRIVE_LOW),
+
+	/* Keypad LEDs (red/green phone) */
+	MFP_CFG_OUT(GPIO103, AF0, DRIVE_LOW),
+
+	/* GSM pins */
+	MFP_CFG_OUT(GPIO11, AF0, DRIVE_LOW),	/* CPU is unavailable(?) */
+	MFP_CFG_OUT(GPIO26, AF0, DRIVE_LOW),	/* GSM power */
+	MFP_CFG_OUT(GPIO86, AF0, DRIVE_HIGH),	/* GSM reset */
+
+	/* USB connector */
+	MFP_CFG_OUT(GPIO27, AF0, DRIVE_LOW),	/* enable usbc pull-up */
+	MFP_CFG_OUT(GPIO30, AF0, DRIVE_LOW),	/* /charging enable */
+
+	/* FFUART, FIXME never observed to do something, GSM data? */
+	GPIO34_FFUART_RXD,
+	GPIO35_FFUART_CTS,
+	GPIO36_FFUART_DCD,
+	GPIO39_FFUART_TXD,
+	GPIO41_FFUART_RTS,
+
+	/* BTUART, AT commands/data, HTC port line discipline */
+	GPIO42_BTUART_RXD,
+	GPIO43_BTUART_TXD,
+	GPIO44_BTUART_CTS,
+	GPIO45_BTUART_RTS,
+
+	/* Power I2C, controller will overrule GPIO */
+	GPIO3_GPIO,	/* SCL */
+	GPIO4_GPIO,	/* SDA */
+
+	/* IrDA GPIOs, pxaficp will change it to correct AFx */
+	MFP_CFG_IN(GPIO46, AF0),
+	MFP_CFG_OUT(GPIO47, AF0, DRIVE_LOW),
+	/* FIXME: probably IrDA transmitter disable */
+	MFP_CFG_OUT(GPIO83, AF0, DRIVE_HIGH),
+
+	/* FIXME yet unknown exact function */
+	GPIO9_GPIO,	/* unknown */
+	MFP_CFG_OUT(GPIO40, AF0, DRIVE_LOW),	/* FIXME GSM? */
+	MFP_CFG_OUT(GPIO87, AF0, DRIVE_LOW),	/* FIXME GSM? */
 };
 
 /*
-- 
1.7.12.1


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

* [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions
@ 2015-09-28 21:15   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:15 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes a pin mux for the HTC Magician machine. Wrong and missing
definitions caused a bad LCD operation and an unavailability of several
peripherals.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 77 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 70 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index a93ed14..91d302b 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -4,8 +4,9 @@
  * and T-Mobile MDA Compact.
  *
  * Copyright (c) 2006-2007 Philipp Zabel
+ * Copyright (c) 2014-2015 Petr Cvek (massive rework)
  *
- * Based on hx4700.c, spitz.c and others.
+ * Based on hx4700.c, spitz.c, board-overo.c and others.
  *
  * 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
@@ -56,6 +57,8 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO79_nCS_3,	/* EGPIO CPLD */
 	GPIO80_nCS_4,
 	GPIO33_nCS_5,
+	GPIO49_nPWE,
+	GPIO18_RDY,
 
 	/* I2C UDA1380 + OV9640 */
 	GPIO117_I2C_SCL,
@@ -64,6 +67,10 @@ static unsigned long magician_pin_config[] __initdata = {
 	/* PWM 0 - LCD backlight */
 	GPIO16_PWM0_OUT,
 
+	/* Omnivision camera power and reset GPIO */
+	MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH),	/* /Enable */
+	MFP_CFG_OUT(GPIO57, AF0, DRIVE_HIGH),	/* Reset */
+
 	/* I2S UDA1380 capture */
 	GPIO28_I2S_BITCLK_OUT,
 	GPIO29_I2S_SDATA_IN,
@@ -89,8 +96,26 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO111_MMC_DAT_3,
 	GPIO112_MMC_CMD,
 
-	/* LCD */
-	GPIOxx_LCD_TFT_16BPP,
+	/*
+	 * LCD
+	 * NOTICE Samsung LTP280QV:
+	 * cannot use GPIOxx_LCD_TFT_16BPP, GPIO75 is LCD power,
+	 * 74 unused (AF0 by bootloader?)
+	 */
+	GPIOxx_LCD_16BPP,
+	GPIO76_LCD_PCLK,
+	GPIO77_LCD_BIAS,	/* data_valid (v/hsync) (ADS7846 sync?) */
+
+	/* NOTICE valid LCD init sequence */
+
+	/* for GPIO75_MAGICIAN_SAMSUNG_POWER */
+	MFP_CFG_OUT(GPIO75, AF0, DRIVE_HIGH),
+	/* for GPIO106_MAGICIAN_LCD_DCDC_NRESET */
+	MFP_CFG_OUT(GPIO106, AF0, DRIVE_HIGH),
+	/* for GPIO104_MAGICIAN_LCD_VOFF_EN */
+	MFP_CFG_OUT(GPIO104, AF0, DRIVE_HIGH),
+	/* for GPIO105_MAGICIAN_LCD_VON_EN */
+	MFP_CFG_OUT(GPIO105, AF0, DRIVE_HIGH),
 
 	/* QCI camera interface */
 	GPIO12_CIF_DD_7,
@@ -107,16 +132,54 @@ static unsigned long magician_pin_config[] __initdata = {
 	GPIO85_CIF_LV,
 
 	/* Magician specific input GPIOs */
-	GPIO9_GPIO,	/* unknown */
 	GPIO10_GPIO,	/* GSM_IRQ */
 	GPIO13_GPIO,	/* CPLD_IRQ */
 	GPIO107_GPIO,	/* DS1WM_IRQ */
 	GPIO108_GPIO,	/* GSM_READY */
 	GPIO115_GPIO,	/* nPEN_IRQ */
 
-	/* I2C */
-	GPIO117_I2C_SCL,
-	GPIO118_I2C_SDA,
+	/* Vibration motor */
+	MFP_CFG_OUT(GPIO22, AF0, DRIVE_LOW),
+
+	/* Keypad LEDs (red/green phone) */
+	MFP_CFG_OUT(GPIO103, AF0, DRIVE_LOW),
+
+	/* GSM pins */
+	MFP_CFG_OUT(GPIO11, AF0, DRIVE_LOW),	/* CPU is unavailable(?) */
+	MFP_CFG_OUT(GPIO26, AF0, DRIVE_LOW),	/* GSM power */
+	MFP_CFG_OUT(GPIO86, AF0, DRIVE_HIGH),	/* GSM reset */
+
+	/* USB connector */
+	MFP_CFG_OUT(GPIO27, AF0, DRIVE_LOW),	/* enable usbc pull-up */
+	MFP_CFG_OUT(GPIO30, AF0, DRIVE_LOW),	/* /charging enable */
+
+	/* FFUART, FIXME never observed to do something, GSM data? */
+	GPIO34_FFUART_RXD,
+	GPIO35_FFUART_CTS,
+	GPIO36_FFUART_DCD,
+	GPIO39_FFUART_TXD,
+	GPIO41_FFUART_RTS,
+
+	/* BTUART, AT commands/data, HTC port line discipline */
+	GPIO42_BTUART_RXD,
+	GPIO43_BTUART_TXD,
+	GPIO44_BTUART_CTS,
+	GPIO45_BTUART_RTS,
+
+	/* Power I2C, controller will overrule GPIO */
+	GPIO3_GPIO,	/* SCL */
+	GPIO4_GPIO,	/* SDA */
+
+	/* IrDA GPIOs, pxaficp will change it to correct AFx */
+	MFP_CFG_IN(GPIO46, AF0),
+	MFP_CFG_OUT(GPIO47, AF0, DRIVE_LOW),
+	/* FIXME: probably IrDA transmitter disable */
+	MFP_CFG_OUT(GPIO83, AF0, DRIVE_HIGH),
+
+	/* FIXME yet unknown exact function */
+	GPIO9_GPIO,	/* unknown */
+	MFP_CFG_OUT(GPIO40, AF0, DRIVE_LOW),	/* FIXME GSM? */
+	MFP_CFG_OUT(GPIO87, AF0, DRIVE_LOW),	/* FIXME GSM? */
 };
 
 /*
-- 
1.7.12.1

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

* [PATCH v4 08/26] ARM: pxa: magician: Rename abstract LCD GPIOs
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:15   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:15 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch renames GPIOs, which are used to control the power lines to
the LCD screen. New names correspond to a real functionality, which was
measured on the HTC Magician board_id 0x3a.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/include/mach/magician.h |  6 +++---
 arch/arm/mach-pxa/magician.c              | 33 +++++++++++++++++--------------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index 3f8922a..af4cdc2 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -52,9 +52,9 @@
 #define GPIO101_MAGICIAN_KEY_VOL_DOWN 		101
 #define GPIO102_MAGICIAN_KEY_PHONE		102
 #define GPIO103_MAGICIAN_LED_KP			103
-#define GPIO104_MAGICIAN_LCD_POWER_1 		104
-#define GPIO105_MAGICIAN_LCD_POWER_2		105
-#define GPIO106_MAGICIAN_LCD_POWER_3		106
+#define GPIO104_MAGICIAN_LCD_VOFF_EN		104
+#define GPIO105_MAGICIAN_LCD_VON_EN		105
+#define GPIO106_MAGICIAN_LCD_DCDC_NRESET	106
 #define GPIO107_MAGICIAN_DS1WM_IRQ		107
 #define GPIO108_MAGICIAN_GSM_READY		108
 #define GPIO114_MAGICIAN_UNKNOWN		114
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 91d302b..d78fc3a 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -337,22 +337,22 @@ static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si)
 
 	if (on) {
 		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);
 		gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
 		udelay(2000);
 		/* FIXME: enable LCDC here */
 		udelay(2000);
-		gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1);
+		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
 		udelay(2000);
-		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
+		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
 	} else {
 		msleep(15);
-		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
+		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
 		udelay(500);
-		gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0);
+		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
 		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);
 	}
 }
@@ -367,19 +367,19 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
 		else
 			gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
 		mdelay(10);
-		gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1);
+		gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
 		mdelay(10);
-		gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1);
+		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
 		mdelay(30);
-		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
+		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
 		mdelay(10);
 	} else {
 		mdelay(10);
-		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
+		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
 		mdelay(30);
-		gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0);
+		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
 		mdelay(10);
-		gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0);
+		gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
 		mdelay(10);
 		if (system_rev < 3)
 			gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0);
@@ -796,9 +796,11 @@ static struct platform_device *devices[] __initdata = {
 static struct gpio magician_global_gpios[] = {
 	{ GPIO13_MAGICIAN_CPLD_IRQ, GPIOF_IN, "CPLD_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" },
-	{ GPIO106_MAGICIAN_LCD_POWER_3, GPIOF_OUT_INIT_LOW, "LCD power 3" },
+
+	/* NOTICE valid LCD init sequence */
+	{ GPIO106_MAGICIAN_LCD_DCDC_NRESET, GPIOF_OUT_INIT_LOW, "LCD DCDC nreset" },
+	{ GPIO104_MAGICIAN_LCD_VOFF_EN, GPIOF_OUT_INIT_LOW, "LCD VOFF enable" },
+	{ GPIO105_MAGICIAN_LCD_VON_EN, GPIOF_OUT_INIT_LOW, "LCD VON enable" },
 	{ GPIO83_MAGICIAN_nIR_EN, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
 };
 
@@ -835,6 +837,7 @@ static void __init magician_init(void)
 		lcd_select = board_id & 0x8;
 		pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
 		if (lcd_select && (system_rev < 3))
+			/* NOTICE valid LCD init sequence */
 			gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER,
 				GPIOF_OUT_INIT_LOW, "Samsung LCD Power");
 		pxa_set_fb_info(NULL,
-- 
1.7.12.1


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

* [PATCH v4 08/26] ARM: pxa: magician: Rename abstract LCD GPIOs
@ 2015-09-28 21:15   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:15 UTC (permalink / raw)
  To: linux-arm-kernel

This patch renames GPIOs, which are used to control the power lines to
the LCD screen. New names correspond to a real functionality, which was
measured on the HTC Magician board_id 0x3a.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/include/mach/magician.h |  6 +++---
 arch/arm/mach-pxa/magician.c              | 33 +++++++++++++++++--------------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index 3f8922a..af4cdc2 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -52,9 +52,9 @@
 #define GPIO101_MAGICIAN_KEY_VOL_DOWN 		101
 #define GPIO102_MAGICIAN_KEY_PHONE		102
 #define GPIO103_MAGICIAN_LED_KP			103
-#define GPIO104_MAGICIAN_LCD_POWER_1 		104
-#define GPIO105_MAGICIAN_LCD_POWER_2		105
-#define GPIO106_MAGICIAN_LCD_POWER_3		106
+#define GPIO104_MAGICIAN_LCD_VOFF_EN		104
+#define GPIO105_MAGICIAN_LCD_VON_EN		105
+#define GPIO106_MAGICIAN_LCD_DCDC_NRESET	106
 #define GPIO107_MAGICIAN_DS1WM_IRQ		107
 #define GPIO108_MAGICIAN_GSM_READY		108
 #define GPIO114_MAGICIAN_UNKNOWN		114
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 91d302b..d78fc3a 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -337,22 +337,22 @@ static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si)
 
 	if (on) {
 		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);
 		gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
 		udelay(2000);
 		/* FIXME: enable LCDC here */
 		udelay(2000);
-		gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1);
+		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
 		udelay(2000);
-		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
+		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
 	} else {
 		msleep(15);
-		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
+		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
 		udelay(500);
-		gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0);
+		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
 		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);
 	}
 }
@@ -367,19 +367,19 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
 		else
 			gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
 		mdelay(10);
-		gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1);
+		gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
 		mdelay(10);
-		gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1);
+		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
 		mdelay(30);
-		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
+		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
 		mdelay(10);
 	} else {
 		mdelay(10);
-		gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
+		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
 		mdelay(30);
-		gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0);
+		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
 		mdelay(10);
-		gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0);
+		gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
 		mdelay(10);
 		if (system_rev < 3)
 			gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0);
@@ -796,9 +796,11 @@ static struct platform_device *devices[] __initdata = {
 static struct gpio magician_global_gpios[] = {
 	{ GPIO13_MAGICIAN_CPLD_IRQ, GPIOF_IN, "CPLD_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" },
-	{ GPIO106_MAGICIAN_LCD_POWER_3, GPIOF_OUT_INIT_LOW, "LCD power 3" },
+
+	/* NOTICE valid LCD init sequence */
+	{ GPIO106_MAGICIAN_LCD_DCDC_NRESET, GPIOF_OUT_INIT_LOW, "LCD DCDC nreset" },
+	{ GPIO104_MAGICIAN_LCD_VOFF_EN, GPIOF_OUT_INIT_LOW, "LCD VOFF enable" },
+	{ GPIO105_MAGICIAN_LCD_VON_EN, GPIOF_OUT_INIT_LOW, "LCD VON enable" },
 	{ GPIO83_MAGICIAN_nIR_EN, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
 };
 
@@ -835,6 +837,7 @@ static void __init magician_init(void)
 		lcd_select = board_id & 0x8;
 		pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
 		if (lcd_select && (system_rev < 3))
+			/* NOTICE valid LCD init sequence */
 			gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER,
 				GPIOF_OUT_INIT_LOW, "Samsung LCD Power");
 		pxa_set_fb_info(NULL,
-- 
1.7.12.1

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

* [PATCH v4 09/26] ARM: pxa: magician: Optimize powerup delays for Samsung LCD
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:16   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:16 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Delays for the Samsung LCD are greater than needed. These values were
extracted from a datasheet.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index d78fc3a..14d1f55 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -366,21 +366,19 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
 			gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1);
 		else
 			gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
-		mdelay(10);
+		mdelay(6);
 		gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
-		mdelay(10);
+		mdelay(6);	/* Avdd -> Voff >5ms */
 		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
-		mdelay(30);
+		mdelay(16);	/* Voff -> Von >(5+10)ms */
 		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
-		mdelay(10);
 	} else {
-		mdelay(10);
 		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
-		mdelay(30);
+		mdelay(16);
 		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
-		mdelay(10);
+		mdelay(6);
 		gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
-		mdelay(10);
+		mdelay(6);
 		if (system_rev < 3)
 			gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0);
 		else
-- 
1.7.12.1


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

* [PATCH v4 09/26] ARM: pxa: magician: Optimize powerup delays for Samsung LCD
@ 2015-09-28 21:16   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:16 UTC (permalink / raw)
  To: linux-arm-kernel

Delays for the Samsung LCD are greater than needed. These values were
extracted from a datasheet.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index d78fc3a..14d1f55 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -366,21 +366,19 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
 			gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1);
 		else
 			gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
-		mdelay(10);
+		mdelay(6);
 		gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
-		mdelay(10);
+		mdelay(6);	/* Avdd -> Voff >5ms */
 		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
-		mdelay(30);
+		mdelay(16);	/* Voff -> Von >(5+10)ms */
 		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
-		mdelay(10);
 	} else {
-		mdelay(10);
 		gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
-		mdelay(30);
+		mdelay(16);
 		gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
-		mdelay(10);
+		mdelay(6);
 		gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
-		mdelay(10);
+		mdelay(6);
 		if (system_rev < 3)
 			gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0);
 		else
-- 
1.7.12.1

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

* [PATCH v4 10/26] ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:32   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:32 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Change the default Samsung LCD refresh from an unrealistic 117Hz to 50Hz
as no video applications on the HTC Magician can work that fast.

The optimalization lowers the RAM latency at least by 3%.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 14d1f55..2c487ae 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -317,7 +317,7 @@ static struct pxafb_mode_info toppoly_modes[] = {
 
 static struct pxafb_mode_info samsung_modes[] = {
 	{
-		.pixclock	= 96153,
+		.pixclock	= 226469,
 		.bpp		= 16,
 		.xres		= 240,
 		.yres		= 320,
-- 
1.7.12.1


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

* [PATCH v4 10/26] ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz
@ 2015-09-28 21:32   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:32 UTC (permalink / raw)
  To: linux-arm-kernel

Change the default Samsung LCD refresh from an unrealistic 117Hz to 50Hz
as no video applications on the HTC Magician can work that fast.

The optimalization lowers the RAM latency at least by 3%.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 14d1f55..2c487ae 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -317,7 +317,7 @@ static struct pxafb_mode_info toppoly_modes[] = {
 
 static struct pxafb_mode_info samsung_modes[] = {
 	{
-		.pixclock	= 96153,
+		.pixclock	= 226469,
 		.bpp		= 16,
 		.xres		= 240,
 		.yres		= 320,
-- 
1.7.12.1

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

* [PATCH v4 11/26] ARM: pxa: magician: Optimize EGPIO initial values
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:32   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:32 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch optimizes initial values of the EGPIO chip driver.

GSM and sound should be powered off during boot. A weak accumulator and
a powered GSM sometimes cause a system reboot. A charging current should be
as high as possible during boot.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 2c487ae..bf0760e 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -263,9 +263,12 @@ static struct htc_egpio_chip egpio_chips[] = {
 		.num_gpios	= 24,
 		.direction	= HTC_EGPIO_OUTPUT,
 		/*
-		 * Depends on modules configuration
+		 * NOTICE LCD valid power on sequence
+		 * Disable GSM and sound
+		 * Low accu can cause reboot, set 500mA charging
+		 * OR 0x8000 for LCD backlight (debug printks)
 		 */
-		.initial_values	= 0x40,
+		.initial_values	= 0x2020c0,
 	},
 	[1] = {
 		.reg_start	= 4,
-- 
1.7.12.1


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

* [PATCH v4 11/26] ARM: pxa: magician: Optimize EGPIO initial values
@ 2015-09-28 21:32   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:32 UTC (permalink / raw)
  To: linux-arm-kernel

This patch optimizes initial values of the EGPIO chip driver.

GSM and sound should be powered off during boot. A weak accumulator and
a powered GSM sometimes cause a system reboot. A charging current should be
as high as possible during boot.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 2c487ae..bf0760e 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -263,9 +263,12 @@ static struct htc_egpio_chip egpio_chips[] = {
 		.num_gpios	= 24,
 		.direction	= HTC_EGPIO_OUTPUT,
 		/*
-		 * Depends on modules configuration
+		 * NOTICE LCD valid power on sequence
+		 * Disable GSM and sound
+		 * Low accu can cause reboot, set 500mA charging
+		 * OR 0x8000 for LCD backlight (debug printks)
 		 */
-		.initial_values	= 0x40,
+		.initial_values	= 0x2020c0,
 	},
 	[1] = {
 		.reg_start	= 4,
-- 
1.7.12.1

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

* [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:32   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:32 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch renames EGPIOs, which are used for the charging cable presence
and type detection. Old names did not correspond with an observed
functionality (on board_id 0x3a). The behavior is not:

- AC charger
- USB charger
- Cable detection

, but:

- AC/USB type
- Cable detection1
- Cable detection2

This patch fixes a possible typo in the bit offset for the cable detection
EGPIO declaration, too.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/include/mach/magician.h | 11 ++++++++---
 arch/arm/mach-pxa/magician.c              |  8 ++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index af4cdc2..5f6b850 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -107,8 +107,13 @@
 
 /* input */
 
-#define EGPIO_MAGICIAN_CABLE_STATE_AC	MAGICIAN_EGPIO(4, 0)
-#define EGPIO_MAGICIAN_CABLE_STATE_USB	MAGICIAN_EGPIO(4, 1)
+/* USB or AC charger type */
+#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_ID1	MAGICIAN_EGPIO(5, 1)
@@ -118,6 +123,6 @@
 
 #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, 4)
+#define EGPIO_MAGICIAN_CABLE_INSERTED	MAGICIAN_EGPIO(6, 3)
 
 #endif /* _MAGICIAN_H_ */
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index bf0760e..b645288 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -579,7 +579,7 @@ static struct resource gpio_vbus_resource = {
 
 static struct gpio_vbus_mach_info gpio_vbus_info = {
 	.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 = {
@@ -598,17 +598,17 @@ static struct platform_device gpio_vbus = {
 
 static int power_supply_init(struct device *dev)
 {
-	return gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC");
+	return gpio_request(EGPIO_MAGICIAN_CABLE_TYPE, "Cable USB/AC type");
 }
 
 static int magician_is_ac_online(void)
 {
-	return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC);
+	return gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE);
 }
 
 static void power_supply_exit(struct device *dev)
 {
-	gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC);
+	gpio_free(EGPIO_MAGICIAN_CABLE_TYPE);
 }
 
 static char *magician_supplicants[] = {
-- 
1.7.12.1


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

* [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs
@ 2015-09-28 21:32   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:32 UTC (permalink / raw)
  To: linux-arm-kernel

This patch renames EGPIOs, which are used for the charging cable presence
and type detection. Old names did not correspond with an observed
functionality (on board_id 0x3a). The behavior is not:

- AC charger
- USB charger
- Cable detection

, but:

- AC/USB type
- Cable detection1
- Cable detection2

This patch fixes a possible typo in the bit offset for the cable detection
EGPIO declaration, too.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/include/mach/magician.h | 11 ++++++++---
 arch/arm/mach-pxa/magician.c              |  8 ++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index af4cdc2..5f6b850 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -107,8 +107,13 @@
 
 /* input */
 
-#define EGPIO_MAGICIAN_CABLE_STATE_AC	MAGICIAN_EGPIO(4, 0)
-#define EGPIO_MAGICIAN_CABLE_STATE_USB	MAGICIAN_EGPIO(4, 1)
+/* USB or AC charger type */
+#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_ID1	MAGICIAN_EGPIO(5, 1)
@@ -118,6 +123,6 @@
 
 #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, 4)
+#define EGPIO_MAGICIAN_CABLE_INSERTED	MAGICIAN_EGPIO(6, 3)
 
 #endif /* _MAGICIAN_H_ */
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index bf0760e..b645288 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -579,7 +579,7 @@ static struct resource gpio_vbus_resource = {
 
 static struct gpio_vbus_mach_info gpio_vbus_info = {
 	.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 = {
@@ -598,17 +598,17 @@ static struct platform_device gpio_vbus = {
 
 static int power_supply_init(struct device *dev)
 {
-	return gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC");
+	return gpio_request(EGPIO_MAGICIAN_CABLE_TYPE, "Cable USB/AC type");
 }
 
 static int magician_is_ac_online(void)
 {
-	return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC);
+	return gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE);
 }
 
 static void power_supply_exit(struct device *dev)
 {
-	gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC);
+	gpio_free(EGPIO_MAGICIAN_CABLE_TYPE);
 }
 
 static char *magician_supplicants[] = {
-- 
1.7.12.1

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

* [PATCH v4 13/26] ARM: pxa: magician: Fix and add charging detection functions
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:33   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:33 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch fixes the charging detection functions for pda_power driver
(according to newly discovered EGPIOs) and add NiCd backup accumulator
charging support.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 57 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 50 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index b645288..906df6d 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -596,18 +596,59 @@ static struct platform_device gpio_vbus = {
  * External power
  */
 
-static int power_supply_init(struct device *dev)
+static int magician_supply_init(struct device *dev)
 {
-	return gpio_request(EGPIO_MAGICIAN_CABLE_TYPE, "Cable USB/AC type");
+	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)
+{
+	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)
 {
-	return gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE);
+	return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
+		gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE); /* AC=1 */
+}
+
+static int magician_is_usb_online(void)
+{
+	return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
+		(!gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE)); /* USB=0 */
 }
 
-static void power_supply_exit(struct device *dev)
+static void magician_supply_exit(struct device *dev)
 {
+	gpio_free(EGPIO_MAGICIAN_CABLE_INSERTED);
 	gpio_free(EGPIO_MAGICIAN_CABLE_TYPE);
 }
 
@@ -616,9 +657,11 @@ static char *magician_supplicants[] = {
 };
 
 static struct pda_power_pdata power_supply_info = {
-	.init			= power_supply_init,
+	.init			= magician_supply_init,
+	.exit			= magician_supply_exit,
 	.is_ac_online		= magician_is_ac_online,
-	.exit			= power_supply_exit,
+	.is_usb_online		= magician_is_usb_online,
+	.set_charge		= magician_set_charge,
 	.supplied_to		= magician_supplicants,
 	.num_supplicants	= ARRAY_SIZE(magician_supplicants),
 };
@@ -683,7 +726,7 @@ static struct gpio_regulator_config bq24022_info = {
 
 	.enable_gpio		= GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
 	.enable_high		= 0,
-	.enabled_at_boot	= 0,
+	.enabled_at_boot	= 1,
 
 	.gpios			= bq24022_gpios,
 	.nr_gpios		= ARRAY_SIZE(bq24022_gpios),
-- 
1.7.12.1


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

* [PATCH v4 13/26] ARM: pxa: magician: Fix and add charging detection functions
@ 2015-09-28 21:33   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:33 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes the charging detection functions for pda_power driver
(according to newly discovered EGPIOs) and add NiCd backup accumulator
charging support.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 57 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 50 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index b645288..906df6d 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -596,18 +596,59 @@ static struct platform_device gpio_vbus = {
  * External power
  */
 
-static int power_supply_init(struct device *dev)
+static int magician_supply_init(struct device *dev)
 {
-	return gpio_request(EGPIO_MAGICIAN_CABLE_TYPE, "Cable USB/AC type");
+	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)
+{
+	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)
 {
-	return gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE);
+	return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
+		gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE); /* AC=1 */
+}
+
+static int magician_is_usb_online(void)
+{
+	return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
+		(!gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE)); /* USB=0 */
 }
 
-static void power_supply_exit(struct device *dev)
+static void magician_supply_exit(struct device *dev)
 {
+	gpio_free(EGPIO_MAGICIAN_CABLE_INSERTED);
 	gpio_free(EGPIO_MAGICIAN_CABLE_TYPE);
 }
 
@@ -616,9 +657,11 @@ static char *magician_supplicants[] = {
 };
 
 static struct pda_power_pdata power_supply_info = {
-	.init			= power_supply_init,
+	.init			= magician_supply_init,
+	.exit			= magician_supply_exit,
 	.is_ac_online		= magician_is_ac_online,
-	.exit			= power_supply_exit,
+	.is_usb_online		= magician_is_usb_online,
+	.set_charge		= magician_set_charge,
 	.supplied_to		= magician_supplicants,
 	.num_supplicants	= ARRAY_SIZE(magician_supplicants),
 };
@@ -683,7 +726,7 @@ static struct gpio_regulator_config bq24022_info = {
 
 	.enable_gpio		= GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
 	.enable_high		= 0,
-	.enabled_at_boot	= 0,
+	.enabled_at_boot	= 1,
 
 	.gpios			= bq24022_gpios,
 	.nr_gpios		= ARRAY_SIZE(bq24022_gpios),
-- 
1.7.12.1

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

* [PATCH v4 14/26] ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:33   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:33 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch changes fast_mode settings for the normal and power I2C
controller on the HTC Magician machine.

Connected device on the Power I2C:
- MAX1587A: working in the fast mode

Connected devices on the Normal I2C:
- UDA1380: working in the fast mode
- OV9640: bus became stuck in the fast mode

The OV9640 is not using a standard I2C protocol, but an SCCB variant. Maybe
it is not fully compatible in the fast mode. Therefore fast mode for normal
I2C is disabled. If you not using the OV9640 then you can enable the fast
mode for the UDA1380.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 906df6d..86d395d 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -818,7 +818,16 @@ static struct platform_device strataflash = {
  */
 
 static struct i2c_pxa_platform_data i2c_info = {
-	.fast_mode = 1,
+	/* FIXME both I2C devices should support fast mode */
+	.fast_mode	= 0,
+};
+
+/*
+ * PXA I2C power controller
+ */
+
+static struct i2c_pxa_platform_data magician_i2c_power_info = {
+	.fast_mode	= 1,
 };
 
 /*
@@ -866,7 +875,7 @@ static void __init magician_init(void)
 	platform_add_devices(ARRAY_AND_SIZE(devices));
 
 	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_mci_info(&magician_mci_info);
 	pxa_set_ohci_info(&magician_ohci_info);
-- 
1.7.12.1


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

* [PATCH v4 14/26] ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers
@ 2015-09-28 21:33   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:33 UTC (permalink / raw)
  To: linux-arm-kernel

This patch changes fast_mode settings for the normal and power I2C
controller on the HTC Magician machine.

Connected device on the Power I2C:
- MAX1587A: working in the fast mode

Connected devices on the Normal I2C:
- UDA1380: working in the fast mode
- OV9640: bus became stuck in the fast mode

The OV9640 is not using a standard I2C protocol, but an SCCB variant. Maybe
it is not fully compatible in the fast mode. Therefore fast mode for normal
I2C is disabled. If you not using the OV9640 then you can enable the fast
mode for the UDA1380.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 906df6d..86d395d 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -818,7 +818,16 @@ static struct platform_device strataflash = {
  */
 
 static struct i2c_pxa_platform_data i2c_info = {
-	.fast_mode = 1,
+	/* FIXME both I2C devices should support fast mode */
+	.fast_mode	= 0,
+};
+
+/*
+ * PXA I2C power controller
+ */
+
+static struct i2c_pxa_platform_data magician_i2c_power_info = {
+	.fast_mode	= 1,
 };
 
 /*
@@ -866,7 +875,7 @@ static void __init magician_init(void)
 	platform_add_devices(ARRAY_AND_SIZE(devices));
 
 	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_mci_info(&magician_mci_info);
 	pxa_set_ohci_info(&magician_ohci_info);
-- 
1.7.12.1

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

* [PATCH v4 15/26] ARM: pxa: magician: Fix redundant GPIO request for pxaficp_ir
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:34   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:34 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

The pxaficp_ir driver requests a power GPIO for the transceiver internally,
so a global GPIO allocation in magician_init() is redundant.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 86d395d..91b5ed0 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -189,6 +189,7 @@ static unsigned long magician_pin_config[] __initdata = {
 static struct pxaficp_platform_data magician_ficp_info = {
 	.gpio_pwdown		= GPIO83_MAGICIAN_nIR_EN,
 	.transceiver_cap	= IR_SIRMODE | IR_OFF,
+	.gpio_pwdown_inverted	= 0,
 };
 
 /*
@@ -854,7 +855,6 @@ static struct gpio magician_global_gpios[] = {
 	{ GPIO106_MAGICIAN_LCD_DCDC_NRESET, GPIOF_OUT_INIT_LOW, "LCD DCDC nreset" },
 	{ GPIO104_MAGICIAN_LCD_VOFF_EN, GPIOF_OUT_INIT_LOW, "LCD VOFF enable" },
 	{ GPIO105_MAGICIAN_LCD_VON_EN, GPIOF_OUT_INIT_LOW, "LCD VON enable" },
-	{ GPIO83_MAGICIAN_nIR_EN, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
 };
 
 static void __init magician_init(void)
-- 
1.7.12.1


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

* [PATCH v4 15/26] ARM: pxa: magician: Fix redundant GPIO request for pxaficp_ir
@ 2015-09-28 21:34   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

The pxaficp_ir driver requests a power GPIO for the transceiver internally,
so a global GPIO allocation in magician_init() is redundant.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 86d395d..91b5ed0 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -189,6 +189,7 @@ static unsigned long magician_pin_config[] __initdata = {
 static struct pxaficp_platform_data magician_ficp_info = {
 	.gpio_pwdown		= GPIO83_MAGICIAN_nIR_EN,
 	.transceiver_cap	= IR_SIRMODE | IR_OFF,
+	.gpio_pwdown_inverted	= 0,
 };
 
 /*
@@ -854,7 +855,6 @@ static struct gpio magician_global_gpios[] = {
 	{ GPIO106_MAGICIAN_LCD_DCDC_NRESET, GPIOF_OUT_INIT_LOW, "LCD DCDC nreset" },
 	{ GPIO104_MAGICIAN_LCD_VOFF_EN, GPIOF_OUT_INIT_LOW, "LCD VOFF enable" },
 	{ GPIO105_MAGICIAN_LCD_VON_EN, GPIOF_OUT_INIT_LOW, "LCD VON enable" },
-	{ GPIO83_MAGICIAN_nIR_EN, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
 };
 
 static void __init magician_init(void)
-- 
1.7.12.1

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

* [PATCH v4 16/26] ARM: pxa: magician: Fix support for Intel Strata NOR Flash
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:34   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:34 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Old definition for the physmap-flash driver is incomplete:
- Use of an EGPIO without previous request
- Missing the MTD partitions

This patch fixes it. Read functionality was tested on the machine with
board_id 0x3a. Writing was not tested.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 45 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 91b5ed0..8e8b122 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -788,20 +788,65 @@ static struct pxaohci_platform_data magician_ohci_info = {
  * 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)
 {
 	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 = {
 	.start	= PXA_CS0_PHYS,
 	.end	= PXA_CS0_PHYS + SZ_64M - 1,
 	.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 = {
 	.width		= 4,
+	.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 = {
-- 
1.7.12.1


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

* [PATCH v4 16/26] ARM: pxa: magician: Fix support for Intel Strata NOR Flash
@ 2015-09-28 21:34   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

Old definition for the physmap-flash driver is incomplete:
- Use of an EGPIO without previous request
- Missing the MTD partitions

This patch fixes it. Read functionality was tested on the machine with
board_id 0x3a. Writing was not tested.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 45 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 91b5ed0..8e8b122 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -788,20 +788,65 @@ static struct pxaohci_platform_data magician_ohci_info = {
  * 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)
 {
 	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 = {
 	.start	= PXA_CS0_PHYS,
 	.end	= PXA_CS0_PHYS + SZ_64M - 1,
 	.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 = {
 	.width		= 4,
+	.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 = {
-- 
1.7.12.1

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

* [PATCH v4 17/26] ARM: pxa: magician: Fix wrongly enabled USB host ports
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:38   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:38 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

USB host ports on the HTC Magician are wrongly enabled. Port 1 is for
bluetooth and port 2 is for OTG (mux in the charger connector).

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 8e8b122..af8133a 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -780,8 +780,10 @@ static struct pxamci_platform_data magician_mci_info = {
 
 static struct pxaohci_platform_data magician_ohci_info = {
 	.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_on_delay = 100,
 };
 
 /*
-- 
1.7.12.1


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

* [PATCH v4 17/26] ARM: pxa: magician: Fix wrongly enabled USB host ports
@ 2015-09-28 21:38   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:38 UTC (permalink / raw)
  To: linux-arm-kernel

USB host ports on the HTC Magician are wrongly enabled. Port 1 is for
bluetooth and port 2 is for OTG (mux in the charger connector).

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 8e8b122..af8133a 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -780,8 +780,10 @@ static struct pxamci_platform_data magician_mci_info = {
 
 static struct pxaohci_platform_data magician_ohci_info = {
 	.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_on_delay = 100,
 };
 
 /*
-- 
1.7.12.1

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

* [PATCH v4 18/26] ARM: pxa: magician: Add support for ADS7846
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:38   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:38 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Add support for an ADS7846 touchscreen.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 86 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index af8133a..450f35f 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -28,6 +28,7 @@
 #include <linux/pwm_backlight.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/gpio-regulator.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
 #include <linux/usb/gpio_vbus.h>
 #include <linux/i2c/pxa-i2c.h>
@@ -44,6 +45,10 @@
 #include <linux/platform_data/irda-pxaficp.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 
+#include <linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>
+#include <linux/spi/ads7846.h>
+
 #include "devices.h"
 #include "generic.h"
 
@@ -748,6 +753,37 @@ static struct platform_device bq24022 = {
 };
 
 /*
+ * fixed regulator for ads7846
+ */
+
+static struct regulator_consumer_supply ads7846_supply =
+	REGULATOR_SUPPLY("vcc", "spi2.0");
+
+static struct regulator_init_data vads7846_regulator = {
+	.constraints = {
+		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies	= 1,
+	.consumer_supplies	= &ads7846_supply,
+};
+
+static struct fixed_voltage_config vads7846 = {
+	.supply_name	= "vads7846",
+	.microvolts	= 3300000, /* probably */
+	.gpio		= -EINVAL,
+	.startup_delay	= 0,
+	.init_data	= &vads7846_regulator,
+};
+
+static struct platform_device vads7846_device = {
+	.name	= "reg-fixed-voltage",
+	.id	= 1,
+	.dev	= {
+		.platform_data = &vads7846,
+	},
+};
+
+/*
  * MMC/SD
  */
 
@@ -879,6 +915,51 @@ static struct i2c_pxa_platform_data magician_i2c_power_info = {
 };
 
 /*
+ * Touchscreen
+ */
+
+static struct ads7846_platform_data ads7846_pdata = {
+	.model			= 7846,
+	.x_min			= 0,
+	.y_min			= 0,
+	.x_max			= 4096,
+	.y_max			= 4096,
+	.x_plate_ohms		= 180,	/* for pressure in 0-255 */
+	.y_plate_ohms		= 180,
+	.pressure_max		= 255,	/* up to 12bit sampling */
+	.debounce_max		= 10,
+	.debounce_tol		= 3,
+	.debounce_rep		= 1,
+	.gpio_pendown		= GPIO115_MAGICIAN_nPEN_IRQ,
+	.keep_vref_on		= 1,	/* FIXME, external Vref? */
+	.vref_delay_usecs	= 100,
+	/* .wait_for_sync, GPIO77_LCD_BIAS low noise measure, latency! */
+};
+
+struct pxa2xx_spi_chip tsc2046_chip_info = {
+	.tx_threshold	= 1,
+	.rx_threshold	= 2,
+	.timeout	= 64,
+	.gpio_cs	= -1,
+};
+
+static struct pxa2xx_spi_master magician_spi_info = {
+	.num_chipselect	= 1,
+	.enable_dma	= 1,
+};
+
+static struct spi_board_info ads7846_spi_board_info[] __initdata = {
+	{
+		.modalias		= "ads7846",
+		.bus_num		= 2,
+		.max_speed_hz		= 1857143,
+		.platform_data		= &ads7846_pdata,
+		.controller_data	= &tsc2046_chip_info,
+		.irq = PXA_GPIO_TO_IRQ(GPIO115_MAGICIAN_nPEN_IRQ),
+	},
+};
+
+/*
  * Platform devices
  */
 
@@ -887,6 +968,7 @@ static struct platform_device *devices[] __initdata = {
 	&egpio,
 	&backlight,
 	&pasic3,
+	&vads7846_device,
 	&bq24022,
 	&gpio_vbus,
 	&power_supply,
@@ -944,6 +1026,10 @@ static void __init magician_init(void)
 			lcd_select ? &samsung_info : &toppoly_info);
 	} else
 		pr_err("LCD detection: CPLD mapping failed\n");
+
+	pxa2xx_set_spi_info(2, &magician_spi_info);
+	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_info));
+
 }
 
 MACHINE_START(MAGICIAN, "HTC Magician")
-- 
1.7.12.1


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

* [PATCH v4 18/26] ARM: pxa: magician: Add support for ADS7846
@ 2015-09-28 21:38   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:38 UTC (permalink / raw)
  To: linux-arm-kernel

Add support for an ADS7846 touchscreen.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 86 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index af8133a..450f35f 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -28,6 +28,7 @@
 #include <linux/pwm_backlight.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/gpio-regulator.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
 #include <linux/usb/gpio_vbus.h>
 #include <linux/i2c/pxa-i2c.h>
@@ -44,6 +45,10 @@
 #include <linux/platform_data/irda-pxaficp.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 
+#include <linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>
+#include <linux/spi/ads7846.h>
+
 #include "devices.h"
 #include "generic.h"
 
@@ -748,6 +753,37 @@ static struct platform_device bq24022 = {
 };
 
 /*
+ * fixed regulator for ads7846
+ */
+
+static struct regulator_consumer_supply ads7846_supply =
+	REGULATOR_SUPPLY("vcc", "spi2.0");
+
+static struct regulator_init_data vads7846_regulator = {
+	.constraints = {
+		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies	= 1,
+	.consumer_supplies	= &ads7846_supply,
+};
+
+static struct fixed_voltage_config vads7846 = {
+	.supply_name	= "vads7846",
+	.microvolts	= 3300000, /* probably */
+	.gpio		= -EINVAL,
+	.startup_delay	= 0,
+	.init_data	= &vads7846_regulator,
+};
+
+static struct platform_device vads7846_device = {
+	.name	= "reg-fixed-voltage",
+	.id	= 1,
+	.dev	= {
+		.platform_data = &vads7846,
+	},
+};
+
+/*
  * MMC/SD
  */
 
@@ -879,6 +915,51 @@ static struct i2c_pxa_platform_data magician_i2c_power_info = {
 };
 
 /*
+ * Touchscreen
+ */
+
+static struct ads7846_platform_data ads7846_pdata = {
+	.model			= 7846,
+	.x_min			= 0,
+	.y_min			= 0,
+	.x_max			= 4096,
+	.y_max			= 4096,
+	.x_plate_ohms		= 180,	/* for pressure in 0-255 */
+	.y_plate_ohms		= 180,
+	.pressure_max		= 255,	/* up to 12bit sampling */
+	.debounce_max		= 10,
+	.debounce_tol		= 3,
+	.debounce_rep		= 1,
+	.gpio_pendown		= GPIO115_MAGICIAN_nPEN_IRQ,
+	.keep_vref_on		= 1,	/* FIXME, external Vref? */
+	.vref_delay_usecs	= 100,
+	/* .wait_for_sync, GPIO77_LCD_BIAS low noise measure, latency! */
+};
+
+struct pxa2xx_spi_chip tsc2046_chip_info = {
+	.tx_threshold	= 1,
+	.rx_threshold	= 2,
+	.timeout	= 64,
+	.gpio_cs	= -1,
+};
+
+static struct pxa2xx_spi_master magician_spi_info = {
+	.num_chipselect	= 1,
+	.enable_dma	= 1,
+};
+
+static struct spi_board_info ads7846_spi_board_info[] __initdata = {
+	{
+		.modalias		= "ads7846",
+		.bus_num		= 2,
+		.max_speed_hz		= 1857143,
+		.platform_data		= &ads7846_pdata,
+		.controller_data	= &tsc2046_chip_info,
+		.irq = PXA_GPIO_TO_IRQ(GPIO115_MAGICIAN_nPEN_IRQ),
+	},
+};
+
+/*
  * Platform devices
  */
 
@@ -887,6 +968,7 @@ static struct platform_device *devices[] __initdata = {
 	&egpio,
 	&backlight,
 	&pasic3,
+	&vads7846_device,
 	&bq24022,
 	&gpio_vbus,
 	&power_supply,
@@ -944,6 +1026,10 @@ static void __init magician_init(void)
 			lcd_select ? &samsung_info : &toppoly_info);
 	} else
 		pr_err("LCD detection: CPLD mapping failed\n");
+
+	pxa2xx_set_spi_info(2, &magician_spi_info);
+	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_info));
+
 }
 
 MACHINE_START(MAGICIAN, "HTC Magician")
-- 
1.7.12.1

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

* [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:38   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:38 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch adds support for an OV9640 camera to the HTC Magician machine.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 61 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 450f35f..d844b9c 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -49,6 +49,9 @@
 #include <linux/spi/pxa2xx_spi.h>
 #include <linux/spi/ads7846.h>
 
+#include <linux/platform_data/camera-pxa.h>
+#include <media/soc_camera.h>
+
 #include "devices.h"
 #include "generic.h"
 
@@ -960,6 +963,60 @@ static struct spi_board_info ads7846_spi_board_info[] __initdata = {
 };
 
 /*
+ * SoC Camera for OV9640 chip
+ */
+
+static struct pxacamera_platform_data magician_pxacamera_pdata = {
+	.flags		= PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
+		PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
+	.mclk_10khz	= 4800,
+};
+
+static int magician_camera_power(struct device *dev, int power)
+{
+	pr_debug("Camera power = %i\n", power);
+
+	gpio_set_value(GPIO116_MAGICIAN_nCAM_EN, !power);
+	mdelay(3);
+
+	return 0;
+}
+
+static int magician_camera_reset(struct device *dev)
+{
+	pr_debug("Camera reset\n");
+
+	gpio_set_value(GPIO57_MAGICIAN_CAM_RESET, 1);
+	mdelay(3);
+	gpio_set_value(GPIO57_MAGICIAN_CAM_RESET, 0);
+	mdelay(3);
+
+	return 0;
+}
+
+static struct i2c_board_info magician_camera_i2c_board_info = {
+	I2C_BOARD_INFO("ov9640", 0x30),
+	.flags = I2C_CLIENT_SCCB,
+};
+
+static struct soc_camera_link magician_camera_iclink = {
+	.bus_id		= 0,
+	.flags		= SOCAM_DATAWIDTH_8,
+	.i2c_adapter_id	= 0,
+	.board_info	= &magician_camera_i2c_board_info,
+	.power		= magician_camera_power,
+	.reset		= magician_camera_reset,
+};
+
+static struct platform_device magician_camera = {
+	.name	= "soc-camera-pdrv",
+	.id	= 0,
+	.dev	= {
+		.platform_data = &magician_camera_iclink,
+	},
+};
+
+/*
  * Platform devices
  */
 
@@ -974,6 +1031,7 @@ static struct platform_device *devices[] __initdata = {
 	&power_supply,
 	&strataflash,
 	&leds_gpio,
+	&magician_camera,
 };
 
 static struct gpio magician_global_gpios[] = {
@@ -984,6 +1042,8 @@ static struct gpio magician_global_gpios[] = {
 	{ GPIO106_MAGICIAN_LCD_DCDC_NRESET, GPIOF_OUT_INIT_LOW, "LCD DCDC nreset" },
 	{ GPIO104_MAGICIAN_LCD_VOFF_EN, GPIOF_OUT_INIT_LOW, "LCD VOFF enable" },
 	{ GPIO105_MAGICIAN_LCD_VON_EN, GPIOF_OUT_INIT_LOW, "LCD VON enable" },
+	{ GPIO57_MAGICIAN_CAM_RESET, GPIOF_OUT_INIT_HIGH, "Camera reset" },
+	{ GPIO116_MAGICIAN_nCAM_EN, GPIOF_OUT_INIT_HIGH, "Camera power" },
 };
 
 static void __init magician_init(void)
@@ -1030,6 +1090,7 @@ static void __init magician_init(void)
 	pxa2xx_set_spi_info(2, &magician_spi_info);
 	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_info));
 
+	pxa_set_camera_info(&magician_pxacamera_pdata);
 }
 
 MACHINE_START(MAGICIAN, "HTC Magician")
-- 
1.7.12.1


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

* [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera
@ 2015-09-28 21:38   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:38 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for an OV9640 camera to the HTC Magician machine.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 61 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 450f35f..d844b9c 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -49,6 +49,9 @@
 #include <linux/spi/pxa2xx_spi.h>
 #include <linux/spi/ads7846.h>
 
+#include <linux/platform_data/camera-pxa.h>
+#include <media/soc_camera.h>
+
 #include "devices.h"
 #include "generic.h"
 
@@ -960,6 +963,60 @@ static struct spi_board_info ads7846_spi_board_info[] __initdata = {
 };
 
 /*
+ * SoC Camera for OV9640 chip
+ */
+
+static struct pxacamera_platform_data magician_pxacamera_pdata = {
+	.flags		= PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
+		PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
+	.mclk_10khz	= 4800,
+};
+
+static int magician_camera_power(struct device *dev, int power)
+{
+	pr_debug("Camera power = %i\n", power);
+
+	gpio_set_value(GPIO116_MAGICIAN_nCAM_EN, !power);
+	mdelay(3);
+
+	return 0;
+}
+
+static int magician_camera_reset(struct device *dev)
+{
+	pr_debug("Camera reset\n");
+
+	gpio_set_value(GPIO57_MAGICIAN_CAM_RESET, 1);
+	mdelay(3);
+	gpio_set_value(GPIO57_MAGICIAN_CAM_RESET, 0);
+	mdelay(3);
+
+	return 0;
+}
+
+static struct i2c_board_info magician_camera_i2c_board_info = {
+	I2C_BOARD_INFO("ov9640", 0x30),
+	.flags = I2C_CLIENT_SCCB,
+};
+
+static struct soc_camera_link magician_camera_iclink = {
+	.bus_id		= 0,
+	.flags		= SOCAM_DATAWIDTH_8,
+	.i2c_adapter_id	= 0,
+	.board_info	= &magician_camera_i2c_board_info,
+	.power		= magician_camera_power,
+	.reset		= magician_camera_reset,
+};
+
+static struct platform_device magician_camera = {
+	.name	= "soc-camera-pdrv",
+	.id	= 0,
+	.dev	= {
+		.platform_data = &magician_camera_iclink,
+	},
+};
+
+/*
  * Platform devices
  */
 
@@ -974,6 +1031,7 @@ static struct platform_device *devices[] __initdata = {
 	&power_supply,
 	&strataflash,
 	&leds_gpio,
+	&magician_camera,
 };
 
 static struct gpio magician_global_gpios[] = {
@@ -984,6 +1042,8 @@ static struct gpio magician_global_gpios[] = {
 	{ GPIO106_MAGICIAN_LCD_DCDC_NRESET, GPIOF_OUT_INIT_LOW, "LCD DCDC nreset" },
 	{ GPIO104_MAGICIAN_LCD_VOFF_EN, GPIOF_OUT_INIT_LOW, "LCD VOFF enable" },
 	{ GPIO105_MAGICIAN_LCD_VON_EN, GPIOF_OUT_INIT_LOW, "LCD VON enable" },
+	{ GPIO57_MAGICIAN_CAM_RESET, GPIOF_OUT_INIT_HIGH, "Camera reset" },
+	{ GPIO116_MAGICIAN_nCAM_EN, GPIOF_OUT_INIT_HIGH, "Camera power" },
 };
 
 static void __init magician_init(void)
@@ -1030,6 +1090,7 @@ static void __init magician_init(void)
 	pxa2xx_set_spi_info(2, &magician_spi_info);
 	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_info));
 
+	pxa_set_camera_info(&magician_pxacamera_pdata);
 }
 
 MACHINE_START(MAGICIAN, "HTC Magician")
-- 
1.7.12.1

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

* [PATCH v4 20/26] ARM: pxa: magician: Add support for MAX1587A Vcore regulator
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:39   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:39 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

HTC Magician contains a MAX1587A voltage regulator for a Vcore supply.
The Vcore regulation is required for a CPU speed switching. This patch adds
declaration for the max1586 driver.

Notice:

- MAX1587A version does not support the V6 (USIM) output.
- A boost resistor was directly measured for a board_id 0x3a.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index d844b9c..490d79f 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -52,6 +52,8 @@
 #include <linux/platform_data/camera-pxa.h>
 #include <media/soc_camera.h>
 
+#include <linux/regulator/max1586.h>
+
 #include "devices.h"
 #include "generic.h"
 
@@ -787,6 +789,52 @@ static struct platform_device vads7846_device = {
 };
 
 /*
+ * 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		= 1500000,
+		.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
  */
 
@@ -1066,6 +1114,10 @@ static void __init magician_init(void)
 	pxa_set_ficp_info(&magician_ficp_info);
 	pxa27x_set_i2c_power_info(&magician_i2c_power_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_ohci_info(&magician_ohci_info);
 
-- 
1.7.12.1


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

* [PATCH v4 20/26] ARM: pxa: magician: Add support for MAX1587A Vcore regulator
@ 2015-09-28 21:39   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:39 UTC (permalink / raw)
  To: linux-arm-kernel

HTC Magician contains a MAX1587A voltage regulator for a Vcore supply.
The Vcore regulation is required for a CPU speed switching. This patch adds
declaration for the max1586 driver.

Notice:

- MAX1587A version does not support the V6 (USIM) output.
- A boost resistor was directly measured for a board_id 0x3a.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index d844b9c..490d79f 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -52,6 +52,8 @@
 #include <linux/platform_data/camera-pxa.h>
 #include <media/soc_camera.h>
 
+#include <linux/regulator/max1586.h>
+
 #include "devices.h"
 #include "generic.h"
 
@@ -787,6 +789,52 @@ static struct platform_device vads7846_device = {
 };
 
 /*
+ * 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		= 1500000,
+		.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
  */
 
@@ -1066,6 +1114,10 @@ static void __init magician_init(void)
 	pxa_set_ficp_info(&magician_ficp_info);
 	pxa27x_set_i2c_power_info(&magician_i2c_power_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_ohci_info(&magician_ohci_info);
 
-- 
1.7.12.1

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

* [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:39   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:39 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

A PXA27x SoC supports USB device mode, this patch adds support for that.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 490d79f..331dfd1 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -54,6 +54,10 @@
 
 #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 "generic.h"
 
@@ -582,6 +586,23 @@ static struct platform_device pasic3 = {
  * 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 VUSB detection
+ */
+
 static struct resource gpio_vbus_resource = {
 	.flags	= IORESOURCE_IRQ,
 	.start	= IRQ_MAGICIAN_VBUS,
@@ -1120,6 +1141,7 @@ static void __init magician_init(void)
 
 	pxa_set_mci_info(&magician_mci_info);
 	pxa_set_ohci_info(&magician_ohci_info);
+	pxa_set_udc_info(&magician_udc_info);
 
 	/* Check LCD type we have */
 	cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000);
-- 
1.7.12.1


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

* [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC
@ 2015-09-28 21:39   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:39 UTC (permalink / raw)
  To: linux-arm-kernel

A PXA27x SoC supports USB device mode, this patch adds support for that.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 490d79f..331dfd1 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -54,6 +54,10 @@
 
 #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 "generic.h"
 
@@ -582,6 +586,23 @@ static struct platform_device pasic3 = {
  * 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 VUSB detection
+ */
+
 static struct resource gpio_vbus_resource = {
 	.flags	= IORESOURCE_IRQ,
 	.start	= IRQ_MAGICIAN_VBUS,
@@ -1120,6 +1141,7 @@ static void __init magician_init(void)
 
 	pxa_set_mci_info(&magician_mci_info);
 	pxa_set_ohci_info(&magician_ohci_info);
+	pxa_set_udc_info(&magician_udc_info);
 
 	/* Check LCD type we have */
 	cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000);
-- 
1.7.12.1

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

* [PATCH v4 22/26] ARM: pxa: magician: Remove pdata for pasic3-leds
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:39   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:39 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

The pasic3-leds driver was never in vanilla kernel. Actual configuration
data for a hypothetical driver does not describe hardware completely, so
remove them.

This patch prepare HTC Magician machine code to pasic3-leds driver
addition.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 44 ++------------------------------------------
 1 file changed, 2 insertions(+), 42 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 331dfd1..8a90b90 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -510,46 +510,6 @@ static struct platform_device leds_gpio = {
 };
 
 /*
- * PASIC3 LEDs
- */
-
-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 DS1WM
  */
 
@@ -568,8 +528,8 @@ static struct resource pasic3_resources[] = {
 };
 
 static struct pasic3_platform_data pasic3_platform_data = {
-	.led_pdata	= &pasic3_leds_info,
-	.clock_rate	= 4000000,
+/*	.led_pdata  = &pasic3_leds_info,*/
+	.clock_rate = 4000000,
 };
 
 static struct platform_device pasic3 = {
-- 
1.7.12.1


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

* [PATCH v4 22/26] ARM: pxa: magician: Remove pdata for pasic3-leds
@ 2015-09-28 21:39   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:39 UTC (permalink / raw)
  To: linux-arm-kernel

The pasic3-leds driver was never in vanilla kernel. Actual configuration
data for a hypothetical driver does not describe hardware completely, so
remove them.

This patch prepare HTC Magician machine code to pasic3-leds driver
addition.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 44 ++------------------------------------------
 1 file changed, 2 insertions(+), 42 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 331dfd1..8a90b90 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -510,46 +510,6 @@ static struct platform_device leds_gpio = {
 };
 
 /*
- * PASIC3 LEDs
- */
-
-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 DS1WM
  */
 
@@ -568,8 +528,8 @@ static struct resource pasic3_resources[] = {
 };
 
 static struct pasic3_platform_data pasic3_platform_data = {
-	.led_pdata	= &pasic3_leds_info,
-	.clock_rate	= 4000000,
+/*	.led_pdata  = &pasic3_leds_info,*/
+	.clock_rate = 4000000,
 };
 
 static struct platform_device pasic3 = {
-- 
1.7.12.1

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

* [PATCH v4 23/26] ARM: pxa: magician: Remove definition of the STUART port
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:40   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:40 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Magician STUART port is connected to the infraport and used by the FICP
driver. The FICP driver uses its own definition.

Required for correct initialization of the pxaficp_ir driver after
planned dmaengine conversion.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 8a90b90..c89f2a8 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -1088,7 +1088,6 @@ static void __init magician_init(void)
 
 	pxa_set_ffuart_info(NULL);
 	pxa_set_btuart_info(NULL);
-	pxa_set_stuart_info(NULL);
 
 	platform_add_devices(ARRAY_AND_SIZE(devices));
 
-- 
1.7.12.1


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

* [PATCH v4 23/26] ARM: pxa: magician: Remove definition of the STUART port
@ 2015-09-28 21:40   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:40 UTC (permalink / raw)
  To: linux-arm-kernel

Magician STUART port is connected to the infraport and used by the FICP
driver. The FICP driver uses its own definition.

Required for correct initialization of the pxaficp_ir driver after
planned dmaengine conversion.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 8a90b90..c89f2a8 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -1088,7 +1088,6 @@ static void __init magician_init(void)
 
 	pxa_set_ffuart_info(NULL);
 	pxa_set_btuart_info(NULL);
-	pxa_set_stuart_info(NULL);
 
 	platform_add_devices(ARRAY_AND_SIZE(devices));
 
-- 
1.7.12.1

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

* [PATCH v4 24/26] ARM: pxa: magician: Add debug message for backlight brightness function
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:40   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:40 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Add a debug message for the backlight brightness function.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index c89f2a8..5de33c6 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -437,6 +437,7 @@ static int magician_backlight_init(struct device *dev)
 
 static int magician_backlight_notify(struct device *dev, int brightness)
 {
+	pr_debug("Brightness = %i\n", brightness);
 	gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness);
 	if (brightness >= 200) {
 		gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1);
-- 
1.7.12.1


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

* [PATCH v4 24/26] ARM: pxa: magician: Add debug message for backlight brightness function
@ 2015-09-28 21:40   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:40 UTC (permalink / raw)
  To: linux-arm-kernel

Add a debug message for the backlight brightness function.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index c89f2a8..5de33c6 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -437,6 +437,7 @@ static int magician_backlight_init(struct device *dev)
 
 static int magician_backlight_notify(struct device *dev, int brightness)
 {
+	pr_debug("Brightness = %i\n", brightness);
 	gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness);
 	if (brightness >= 200) {
 		gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1);
-- 
1.7.12.1

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

* [PATCH v4 25/26] ARM: pxa: magician: Add missing regulator for PWM backlight
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:40   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:40 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Add a fake regulator, which is required for the correct initialization
of the PWM backlight driver.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 5de33c6..8d3946d 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -425,6 +425,15 @@ static struct pxafb_mach_info samsung_info = {
  * Backlight
  */
 
+ /*
+ * fixed regulator for pwm_backlight
+ */
+
+static struct regulator_consumer_supply pwm_backlight_supply[] = {
+	REGULATOR_SUPPLY("power", "pwm_backlight"),
+};
+
+
 static struct gpio magician_bl_gpios[] = {
 	{ EGPIO_MAGICIAN_BL_POWER,	GPIOF_DIR_OUT, "Backlight power" },
 	{ EGPIO_MAGICIAN_BL_POWER2,	GPIOF_DIR_OUT, "Backlight power 2" },
@@ -1125,6 +1134,9 @@ static void __init magician_init(void)
 	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_info));
 
 	pxa_set_camera_info(&magician_pxacamera_pdata);
+
+	regulator_register_always_on(0, "power", pwm_backlight_supply,
+		ARRAY_SIZE(pwm_backlight_supply), 5000000);
 }
 
 MACHINE_START(MAGICIAN, "HTC Magician")
-- 
1.7.12.1


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

* [PATCH v4 25/26] ARM: pxa: magician: Add missing regulator for PWM backlight
@ 2015-09-28 21:40   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:40 UTC (permalink / raw)
  To: linux-arm-kernel

Add a fake regulator, which is required for the correct initialization
of the PWM backlight driver.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 5de33c6..8d3946d 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -425,6 +425,15 @@ static struct pxafb_mach_info samsung_info = {
  * Backlight
  */
 
+ /*
+ * fixed regulator for pwm_backlight
+ */
+
+static struct regulator_consumer_supply pwm_backlight_supply[] = {
+	REGULATOR_SUPPLY("power", "pwm_backlight"),
+};
+
+
 static struct gpio magician_bl_gpios[] = {
 	{ EGPIO_MAGICIAN_BL_POWER,	GPIOF_DIR_OUT, "Backlight power" },
 	{ EGPIO_MAGICIAN_BL_POWER2,	GPIOF_DIR_OUT, "Backlight power 2" },
@@ -1125,6 +1134,9 @@ static void __init magician_init(void)
 	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_info));
 
 	pxa_set_camera_info(&magician_pxacamera_pdata);
+
+	regulator_register_always_on(0, "power", pwm_backlight_supply,
+		ARRAY_SIZE(pwm_backlight_supply), 5000000);
 }
 
 MACHINE_START(MAGICIAN, "HTC Magician")
-- 
1.7.12.1

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

* [PATCH v4 26/26] ARM: pxa: magician: Move platform_add_devices() to the end of magician_init()
       [not found] <cover.1443472089.git.petr.cvek@tul.cz>
@ 2015-09-28 21:42   ` Petr Cvek
  2015-09-28 21:10   ` Petr Cvek
                     ` (24 subsequent siblings)
  25 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:42 UTC (permalink / raw)
  To: robert.jarzmik, philipp.zabel, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

This patch moves platform_add_devices() (standard declaration of devices)
outside of the platform specific device declarations. Moving to the end
of the magician_init() clarifies the source code (standard and specific
declaration are not mixed).

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 8d3946d..3aba1c4 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -1099,8 +1099,6 @@ static void __init magician_init(void)
 	pxa_set_ffuart_info(NULL);
 	pxa_set_btuart_info(NULL);
 
-	platform_add_devices(ARRAY_AND_SIZE(devices));
-
 	pxa_set_ficp_info(&magician_ficp_info);
 	pxa27x_set_i2c_power_info(&magician_i2c_power_info);
 	pxa_set_i2c_info(&i2c_info);
@@ -1137,6 +1135,8 @@ static void __init magician_init(void)
 
 	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")
-- 
1.7.12.1


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

* [PATCH v4 26/26] ARM: pxa: magician: Move platform_add_devices() to the end of magician_init()
@ 2015-09-28 21:42   ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-09-28 21:42 UTC (permalink / raw)
  To: linux-arm-kernel

This patch moves platform_add_devices() (standard declaration of devices)
outside of the platform specific device declarations. Moving to the end
of the magician_init() clarifies the source code (standard and specific
declaration are not mixed).

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 8d3946d..3aba1c4 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -1099,8 +1099,6 @@ static void __init magician_init(void)
 	pxa_set_ffuart_info(NULL);
 	pxa_set_btuart_info(NULL);
 
-	platform_add_devices(ARRAY_AND_SIZE(devices));
-
 	pxa_set_ficp_info(&magician_ficp_info);
 	pxa27x_set_i2c_power_info(&magician_i2c_power_info);
 	pxa_set_i2c_info(&i2c_info);
@@ -1137,6 +1135,8 @@ static void __init magician_init(void)
 
 	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")
-- 
1.7.12.1

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

* Re: [PATCH v4 01/26] ARM: pxa: magician: Fix indentation in machine files
  2015-09-28 21:09   ` Petr Cvek
@ 2015-10-03 12:14     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:14 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:09 +0200 schrieb Petr Cvek:
> This patch fixes the indentation for the HTC Magician machine
> definition.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

I still think these are a lot of arbitrary changes, maybe the
description should better say "consistently replace spaces with tabs"
or something like this.

best regards
Philipp

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

* [PATCH v4 01/26] ARM: pxa: magician: Fix indentation in machine files
@ 2015-10-03 12:14     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:14 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:09 +0200 schrieb Petr Cvek:
> This patch fixes the indentation for the HTC Magician machine
> definition.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

I still think these are a lot of arbitrary changes, maybe the
description should better say "consistently replace spaces with tabs"
or something like this.

best regards
Philipp

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

* Re: [PATCH v4 02/26] ARM: pxa: magician: Change comments to be more informative
  2015-09-28 21:10   ` Petr Cvek
@ 2015-10-03 12:19     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:19 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:10 +0200 schrieb Petr Cvek:
> This patch changes the comments in the HTC Magician machine source
> code
> to better describe used devices and interfaces.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

This is mostly fine, some comments below.

[...]
>  static struct resource egpio_resources[] = {
> @@ -197,7 +199,10 @@ static struct htc_egpio_chip egpio_chips[] = {
>  		.gpio_base	= MAGICIAN_EGPIO(0, 0),
>  		.num_gpios	= 24,
>  		.direction	= HTC_EGPIO_OUTPUT,
> -		.initial_values	= 0x40, /*
> EGPIO_MAGICIAN_GSM_RESET */
> +		/*
> +		 * Depends on modules configuration
> +		 */
> +		.initial_values	= 0x40,
>  	},
>  	[1] = {
>  		.reg_start	= 4,

Why drop the info that this is the GSM reset while improving comments
in every other place with more information?

[...]
> +/*
> + * LCD PWM backlight (main)
> + *
> + * MP1521 frequency should be:
> + *	100-400 Hz = 2 .5*10^6 - 10 *10^6 ns

What is MP1521?

[...]
> @@ -459,7 +475,7 @@ static struct pasic3_leds_machinfo
> pasic3_leds_info = {
>  };
>  
>  /*
> - * PASIC3 with DS1WM
> + * PASIC3 DS1WM
>   */

This is indeed an mfd chip that contains a DS1WM IP core. I think the
older comment is better.

> @@ -492,7 +508,7 @@ static struct platform_device pasic3 = {
>  };
>  
>  /*
> - * USB "Transceiver"
> + * PXA UDC
>   */
>  
>  static struct resource gpio_vbus_resource = {

You fix this in a later commit, but here the change is incorrect.

regards
Philipp

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

* [PATCH v4 02/26] ARM: pxa: magician: Change comments to be more informative
@ 2015-10-03 12:19     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:19 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:10 +0200 schrieb Petr Cvek:
> This patch changes the comments in the HTC Magician machine source
> code
> to better describe used devices and interfaces.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

This is mostly fine, some comments below.

[...]
>  static struct resource egpio_resources[] = {
> @@ -197,7 +199,10 @@ static struct htc_egpio_chip egpio_chips[] = {
>  		.gpio_base	= MAGICIAN_EGPIO(0, 0),
>  		.num_gpios	= 24,
>  		.direction	= HTC_EGPIO_OUTPUT,
> -		.initial_values	= 0x40, /*
> EGPIO_MAGICIAN_GSM_RESET */
> +		/*
> +		 * Depends on modules configuration
> +		 */
> +		.initial_values	= 0x40,
>  	},
>  	[1] = {
>  		.reg_start	= 4,

Why drop the info that this is the GSM reset while improving comments
in every other place with more information?

[...]
> +/*
> + * LCD PWM backlight (main)
> + *
> + * MP1521 frequency should be:
> + *	100-400 Hz = 2?.5*10^6 - 10?*10^6 ns

What is MP1521?

[...]
> @@ -459,7 +475,7 @@ static struct pasic3_leds_machinfo
> pasic3_leds_info = {
>  };
>  
>  /*
> - * PASIC3 with DS1WM
> + * PASIC3 DS1WM
>   */

This is indeed an mfd chip that contains a DS1WM IP core. I think the
older comment is better.

> @@ -492,7 +508,7 @@ static struct platform_device pasic3 = {
>  };
>  
>  /*
> - * USB "Transceiver"
> + * PXA UDC
>   */
>  
>  static struct resource gpio_vbus_resource = {

You fix this in a later commit, but here the change is incorrect.

regards
Philipp

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

* Re: [PATCH v4 03/26] ARM: pxa: magician: Print more specific error message for global GPIOs
  2015-09-28 21:10   ` Petr Cvek
@ 2015-10-03 12:19     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:19 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:10 +0200 schrieb Petr Cvek:
> Print more specific error message for global GPIOs.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

> ---
>  arch/arm/mach-pxa/magician.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index c8fa379..29d8146 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -752,7 +752,7 @@ static void __init magician_init(void)
>  	pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config));
>  	err =
> gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios));
>  	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_btuart_info(NULL);

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

* [PATCH v4 03/26] ARM: pxa: magician: Print more specific error message for global GPIOs
@ 2015-10-03 12:19     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:19 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:10 +0200 schrieb Petr Cvek:
> Print more specific error message for global GPIOs.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

> ---
>  arch/arm/mach-pxa/magician.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index c8fa379..29d8146 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -752,7 +752,7 @@ static void __init magician_init(void)
>  	pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config));
>  	err =
> gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios));
>  	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_btuart_info(NULL);

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

* Re: [PATCH v4 04/26] ARM: pxa: magician: Optimize debug messages for LCD power
  2015-09-28 21:11   ` Petr Cvek
@ 2015-10-03 12:20     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:20 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:11 +0200 schrieb Petr Cvek:
> Optimize the debug messages for the LCD power.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* [PATCH v4 04/26] ARM: pxa: magician: Optimize debug messages for LCD power
@ 2015-10-03 12:20     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:20 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:11 +0200 schrieb Petr Cvek:
> Optimize the debug messages for the LCD power.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* Re: [PATCH v4 05/26] ARM: pxa: magician: Change description of LCD power GPIO
  2015-09-28 21:11   ` Petr Cvek
@ 2015-10-03 12:21     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:21 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:11 +0200 schrieb Petr Cvek:
> This patch changes the description of the LCD power GPIO to be more
> specific.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* [PATCH v4 05/26] ARM: pxa: magician: Change description of LCD power GPIO
@ 2015-10-03 12:21     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:21 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:11 +0200 schrieb Petr Cvek:
> This patch changes the description of the LCD power GPIO to be more
> specific.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* Re: [PATCH v4 06/26] ARM: pxa: magician: Add new discovered EGPIO pins
  2015-09-28 21:15   ` Petr Cvek
@ 2015-10-03 12:23     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:23 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
> This patch adds EGPIO pins: Infra transceiver power, NiCD charging
> and
> inserted charger cable.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

Do you have more details how NiCD charging works?

regards
Philipp

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

* [PATCH v4 06/26] ARM: pxa: magician: Add new discovered EGPIO pins
@ 2015-10-03 12:23     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:23 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
> This patch adds EGPIO pins: Infra transceiver power, NiCD charging
> and
> inserted charger cable.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

Do you have more details how NiCD charging works?

regards
Philipp

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

* Re: [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions
  2015-09-28 21:15   ` Petr Cvek
@ 2015-10-03 12:30     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:30 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
> This patch fixes a pin mux for the HTC Magician machine. Wrong and
> missing
> definitions caused a bad LCD operation and an unavailability of
> several
> peripherals.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

NAK on this one. Until this patch I can boot my o2 Xda mini with
Toppoly display and see the framebuffer kernel console output. Can we
split the LCD changes from the rest, I assume those are what breaks my
display.

best regards
Philipp

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

* [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions
@ 2015-10-03 12:30     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
> This patch fixes a pin mux for the HTC Magician machine. Wrong and
> missing
> definitions caused a bad LCD operation and an unavailability of
> several
> peripherals.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

NAK on this one. Until this patch I can boot my o2 Xda mini with
Toppoly display and see the framebuffer kernel console output. Can we
split the LCD changes from the rest, I assume those are what breaks my
display.

best regards
Philipp

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

* Re: [PATCH v4 08/26] ARM: pxa: magician: Rename abstract LCD GPIOs
  2015-09-28 21:15   ` Petr Cvek
@ 2015-10-03 12:31     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:31 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
> This patch renames GPIOs, which are used to control the power lines
> to
> the LCD screen. New names correspond to a real functionality, which
> was
> measured on the HTC Magician board_id 0x3a.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* [PATCH v4 08/26] ARM: pxa: magician: Rename abstract LCD GPIOs
@ 2015-10-03 12:31     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:31 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
> This patch renames GPIOs, which are used to control the power lines
> to
> the LCD screen. New names correspond to a real functionality, which
> was
> measured on the HTC Magician board_id 0x3a.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* Re: [PATCH v4 09/26] ARM: pxa: magician: Optimize powerup delays for Samsung LCD
  2015-09-28 21:16   ` Petr Cvek
@ 2015-10-03 12:32     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:32 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:16 +0200 schrieb Petr Cvek:
> Delays for the Samsung LCD are greater than needed. These values were
> extracted from a datasheet.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* [PATCH v4 09/26] ARM: pxa: magician: Optimize powerup delays for Samsung LCD
@ 2015-10-03 12:32     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:32 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:16 +0200 schrieb Petr Cvek:
> Delays for the Samsung LCD are greater than needed. These values were
> extracted from a datasheet.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* Re: [PATCH v4 10/26] ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz
  2015-09-28 21:32   ` Petr Cvek
@ 2015-10-03 12:33     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:33 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
> Change the default Samsung LCD refresh from an unrealistic 117Hz to
> 50Hz
> as no video applications on the HTC Magician can work that fast.
> 
> The optimalization lowers the RAM latency at least by 3%.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

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

* [PATCH v4 10/26] ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz
@ 2015-10-03 12:33     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:33 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
> Change the default Samsung LCD refresh from an unrealistic 117Hz to
> 50Hz
> as no video applications on the HTC Magician can work that fast.
> 
> The optimalization lowers the RAM latency at least by 3%.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

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

* Re: [PATCH v4 11/26] ARM: pxa: magician: Optimize EGPIO initial values
  2015-09-28 21:32   ` Petr Cvek
@ 2015-10-03 12:35     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:35 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
> This patch optimizes initial values of the EGPIO chip driver.
> 
> GSM and sound should be powered off during boot. A weak accumulator
> and
> a powered GSM sometimes cause a system reboot. A charging current
> should be
> as high as possible during boot.

Wouldn't that violate USB spec if we boot the magician while plugged
into an unpowered USB host?

regards
Philipp

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

* [PATCH v4 11/26] ARM: pxa: magician: Optimize EGPIO initial values
@ 2015-10-03 12:35     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:35 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
> This patch optimizes initial values of the EGPIO chip driver.
> 
> GSM and sound should be powered off during boot. A weak accumulator
> and
> a powered GSM sometimes cause a system reboot. A charging current
> should be
> as high as possible during boot.

Wouldn't that violate USB spec if we boot the magician while plugged
into an unpowered USB host?

regards
Philipp

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

* Re: [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs
  2015-09-28 21:32   ` Petr Cvek
@ 2015-10-03 12:38     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:38 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
> This patch renames EGPIOs, which are used for the charging cable
> presence
> and type detection. Old names did not correspond with an observed
> functionality (on board_id 0x3a). The behavior is not:
> 
> - AC charger
> - USB charger
> - Cable detection
> 
> , but:
> 
> - AC/USB type
> - Cable detection1
> - Cable detection2
> 
> This patch fixes a possible typo in the bit offset for the cable
> detection
> EGPIO declaration, too.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Just to be sure, please tell me what are the values of those three
EGPIOs while
  a) wall plug charger plugged in
  b) usb cable connected to a host plugged in
  c) no cable plugged in

It could well be there are differences between our boards.

regards
Philipp

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

* [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs
@ 2015-10-03 12:38     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:38 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
> This patch renames EGPIOs, which are used for the charging cable
> presence
> and type detection. Old names did not correspond with an observed
> functionality (on board_id 0x3a). The behavior is not:
> 
> - AC charger
> - USB charger
> - Cable detection
> 
> , but:
> 
> - AC/USB type
> - Cable detection1
> - Cable detection2
> 
> This patch fixes a possible typo in the bit offset for the cable
> detection
> EGPIO declaration, too.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Just to be sure, please tell me what are the values of those three
EGPIOs while
  a) wall plug charger plugged in
  b) usb cable connected to a host plugged in
  c) no cable plugged in

It could well be there are differences between our boards.

regards
Philipp

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

* Re: [PATCH v4 14/26] ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers
  2015-09-28 21:33   ` Petr Cvek
@ 2015-10-03 12:41     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:41 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:33 +0200 schrieb Petr Cvek:
> This patch changes fast_mode settings for the normal and power I2C
> controller on the HTC Magician machine.
> 
> Connected device on the Power I2C:
> - MAX1587A: working in the fast mode
> 
> Connected devices on the Normal I2C:
> - UDA1380: working in the fast mode
> - OV9640: bus became stuck in the fast mode
> 
> The OV9640 is not using a standard I2C protocol, but an SCCB variant.
> Maybe
> it is not fully compatible in the fast mode. Therefore fast mode for
> normal
> I2C is disabled. If you not using the OV9640 then you can enable the
> fast
> mode for the UDA1380.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index 906df6d..86d395d 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -818,7 +818,16 @@ static struct platform_device strataflash = {
>   */
>  
>  static struct i2c_pxa_platform_data i2c_info = {
> -	.fast_mode = 1,
> +	/* FIXME both I2C devices should support fast mode */

Maybe add the info from the commit description here (it's OV9640 that
doesn't support fast mode).

Otherwise,
Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* [PATCH v4 14/26] ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers
@ 2015-10-03 12:41     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:41 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:33 +0200 schrieb Petr Cvek:
> This patch changes fast_mode settings for the normal and power I2C
> controller on the HTC Magician machine.
> 
> Connected device on the Power I2C:
> - MAX1587A: working in the fast mode
> 
> Connected devices on the Normal I2C:
> - UDA1380: working in the fast mode
> - OV9640: bus became stuck in the fast mode
> 
> The OV9640 is not using a standard I2C protocol, but an SCCB variant.
> Maybe
> it is not fully compatible in the fast mode. Therefore fast mode for
> normal
> I2C is disabled. If you not using the OV9640 then you can enable the
> fast
> mode for the UDA1380.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index 906df6d..86d395d 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -818,7 +818,16 @@ static struct platform_device strataflash = {
>   */
>  
>  static struct i2c_pxa_platform_data i2c_info = {
> -	.fast_mode = 1,
> +	/* FIXME both I2C devices should support fast mode */

Maybe add the info from the commit description here (it's OV9640 that
doesn't support fast mode).

Otherwise,
Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* Re: [PATCH v4 17/26] ARM: pxa: magician: Fix wrongly enabled USB host ports
  2015-09-28 21:38   ` Petr Cvek
@ 2015-10-03 12:45     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:45 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
> USB host ports on the HTC Magician are wrongly enabled. Port 1 is for
> bluetooth and port 2 is for OTG (mux in the charger connector).
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index 8e8b122..af8133a 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -780,8 +780,10 @@ static struct pxamci_platform_data
> magician_mci_info = {
>  
>  static struct pxaohci_platform_data magician_ohci_info = {
>  	.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_on_delay = 100,
>  };

I have only ever tested the CSR bluetooth chip, so this could be
correct, or again something that is different between the magician
variants. I don't know.

regards
Philipp

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

* [PATCH v4 17/26] ARM: pxa: magician: Fix wrongly enabled USB host ports
@ 2015-10-03 12:45     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:45 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
> USB host ports on the HTC Magician are wrongly enabled. Port 1 is for
> bluetooth and port 2 is for OTG (mux in the charger connector).
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index 8e8b122..af8133a 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -780,8 +780,10 @@ static struct pxamci_platform_data
> magician_mci_info = {
>  
>  static struct pxaohci_platform_data magician_ohci_info = {
>  	.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_on_delay = 100,
>  };

I have only ever tested the CSR bluetooth chip, so this could be
correct, or again something that is different between the magician
variants. I don't know.

regards
Philipp

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

* Re: [PATCH v4 18/26] ARM: pxa: magician: Add support for ADS7846
  2015-09-28 21:38   ` Petr Cvek
@ 2015-10-03 12:49     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:49 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
> Add support for an ADS7846 touchscreen.

It's actually a TSC2045.

> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 86
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 86 insertions(+)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index af8133a..450f35f 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -28,6 +28,7 @@
>  #include <linux/pwm_backlight.h>
>  #include <linux/regulator/driver.h>
>  #include <linux/regulator/gpio-regulator.h>
> +#include <linux/regulator/fixed.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/usb/gpio_vbus.h>
>  #include <linux/i2c/pxa-i2c.h>
> @@ -44,6 +45,10 @@
>  #include <linux/platform_data/irda-pxaficp.h>
>  #include <linux/platform_data/usb-ohci-pxa27x.h>
>  
> +#include <linux/spi/spi.h>
> +#include <linux/spi/pxa2xx_spi.h>
> +#include <linux/spi/ads7846.h>
> +
>  #include "devices.h"
>  #include "generic.h"
>  
> @@ -748,6 +753,37 @@ static struct platform_device bq24022 = {
>  };
>  
>  /*
> + * fixed regulator for ads7846
> + */
> +
> +static struct regulator_consumer_supply ads7846_supply =
> +	REGULATOR_SUPPLY("vcc", "spi2.0");
> +
> +static struct regulator_init_data vads7846_regulator = {
> +	.constraints = {
> +		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
> +	},
> +	.num_consumer_supplies	= 1,
> +	.consumer_supplies	= &ads7846_supply,
> +};
> +
> +static struct fixed_voltage_config vads7846 = {
> +	.supply_name	= "vads7846",
> +	.microvolts	= 3300000, /* probably */

I agree.

> +	.gpio		= -EINVAL,
> +	.startup_delay	= 0,
> +	.init_data	= &vads7846_regulator,
> +};
> +
> +static struct platform_device vads7846_device = {
> +	.name	= "reg-fixed-voltage",
> +	.id	= 1,
> +	.dev	= {
> +		.platform_data = &vads7846,
> +	},
> +};
> +
> +/*
>   * MMC/SD
>   */
>  
> @@ -879,6 +915,51 @@ static struct i2c_pxa_platform_data
> magician_i2c_power_info = {
>  };
>  
>  /*
> + * Touchscreen
> + */
> +
> +static struct ads7846_platform_data ads7846_pdata = {
> +	.model			= 7846,
> +	.x_min			= 0,
> +	.y_min			= 0,
> +	.x_max			= 4096,
> +	.y_max			= 4096,
> +	.x_plate_ohms		= 180,	/* for pressure
> in 0-255 */
> +	.y_plate_ohms		= 180,
> +	.pressure_max		= 255,	/* up to 12bit
> sampling */
> +	.debounce_max		= 10,
> +	.debounce_tol		= 3,
> +	.debounce_rep		= 1,
> +	.gpio_pendown		= GPIO115_MAGICIAN_nPEN_IRQ,
> +	.keep_vref_on		= 1,	/* FIXME, external
> Vref? */
> +	.vref_delay_usecs	= 100,
> +	/* .wait_for_sync, GPIO77_LCD_BIAS low noise measure,
> latency! */
> +};
> +
> +struct pxa2xx_spi_chip tsc2046_chip_info = {
> +	.tx_threshold	= 1,
> +	.rx_threshold	= 2,
> +	.timeout	= 64,
> +	.gpio_cs	= -1,
> +};
> +
> +static struct pxa2xx_spi_master magician_spi_info = {
> +	.num_chipselect	= 1,
> +	.enable_dma	= 1,
> +};
> +
> +static struct spi_board_info ads7846_spi_board_info[] __initdata = {
> +	{
> +		.modalias		= "ads7846",
> +		.bus_num		= 2,
> +		.max_speed_hz		= 1857143,

I had used 2.6 MHz here.

> +		.platform_data		= &ads7846_pdata,
> +		.controller_data	= &tsc2046_chip_info,
> +		.irq = PXA_GPIO_TO_IRQ(GPIO115_MAGICIAN_nPEN_IRQ),
> +	},
> +};
> +
> +/*
>   * Platform devices
>   */
>  
> @@ -887,6 +968,7 @@ static struct platform_device *devices[]
> __initdata = {
>  	&egpio,
>  	&backlight,
>  	&pasic3,
> +	&vads7846_device,
>  	&bq24022,
>  	&gpio_vbus,
>  	&power_supply,
> @@ -944,6 +1026,10 @@ static void __init magician_init(void)
>  			lcd_select ? &samsung_info : &toppoly_info);
>  	} else
>  		pr_err("LCD detection: CPLD mapping failed\n");
> +
> +	pxa2xx_set_spi_info(2, &magician_spi_info);
> +	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_inf
> o));
> +
>  }
>  
>  MACHINE_START(MAGICIAN, "HTC Magician")

regards
Philipp

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

* [PATCH v4 18/26] ARM: pxa: magician: Add support for ADS7846
@ 2015-10-03 12:49     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
> Add support for an ADS7846 touchscreen.

It's actually a TSC2045.

> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 86
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 86 insertions(+)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index af8133a..450f35f 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -28,6 +28,7 @@
>  #include <linux/pwm_backlight.h>
>  #include <linux/regulator/driver.h>
>  #include <linux/regulator/gpio-regulator.h>
> +#include <linux/regulator/fixed.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/usb/gpio_vbus.h>
>  #include <linux/i2c/pxa-i2c.h>
> @@ -44,6 +45,10 @@
>  #include <linux/platform_data/irda-pxaficp.h>
>  #include <linux/platform_data/usb-ohci-pxa27x.h>
>  
> +#include <linux/spi/spi.h>
> +#include <linux/spi/pxa2xx_spi.h>
> +#include <linux/spi/ads7846.h>
> +
>  #include "devices.h"
>  #include "generic.h"
>  
> @@ -748,6 +753,37 @@ static struct platform_device bq24022 = {
>  };
>  
>  /*
> + * fixed regulator for ads7846
> + */
> +
> +static struct regulator_consumer_supply ads7846_supply =
> +	REGULATOR_SUPPLY("vcc", "spi2.0");
> +
> +static struct regulator_init_data vads7846_regulator = {
> +	.constraints = {
> +		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
> +	},
> +	.num_consumer_supplies	= 1,
> +	.consumer_supplies	= &ads7846_supply,
> +};
> +
> +static struct fixed_voltage_config vads7846 = {
> +	.supply_name	= "vads7846",
> +	.microvolts	= 3300000, /* probably */

I agree.

> +	.gpio		= -EINVAL,
> +	.startup_delay	= 0,
> +	.init_data	= &vads7846_regulator,
> +};
> +
> +static struct platform_device vads7846_device = {
> +	.name	= "reg-fixed-voltage",
> +	.id	= 1,
> +	.dev	= {
> +		.platform_data = &vads7846,
> +	},
> +};
> +
> +/*
>   * MMC/SD
>   */
>  
> @@ -879,6 +915,51 @@ static struct i2c_pxa_platform_data
> magician_i2c_power_info = {
>  };
>  
>  /*
> + * Touchscreen
> + */
> +
> +static struct ads7846_platform_data ads7846_pdata = {
> +	.model			= 7846,
> +	.x_min			= 0,
> +	.y_min			= 0,
> +	.x_max			= 4096,
> +	.y_max			= 4096,
> +	.x_plate_ohms		= 180,	/* for pressure
> in 0-255 */
> +	.y_plate_ohms		= 180,
> +	.pressure_max		= 255,	/* up to 12bit
> sampling */
> +	.debounce_max		= 10,
> +	.debounce_tol		= 3,
> +	.debounce_rep		= 1,
> +	.gpio_pendown		= GPIO115_MAGICIAN_nPEN_IRQ,
> +	.keep_vref_on		= 1,	/* FIXME, external
> Vref? */
> +	.vref_delay_usecs	= 100,
> +	/* .wait_for_sync, GPIO77_LCD_BIAS low noise measure,
> latency! */
> +};
> +
> +struct pxa2xx_spi_chip tsc2046_chip_info = {
> +	.tx_threshold	= 1,
> +	.rx_threshold	= 2,
> +	.timeout	= 64,
> +	.gpio_cs	= -1,
> +};
> +
> +static struct pxa2xx_spi_master magician_spi_info = {
> +	.num_chipselect	= 1,
> +	.enable_dma	= 1,
> +};
> +
> +static struct spi_board_info ads7846_spi_board_info[] __initdata = {
> +	{
> +		.modalias		= "ads7846",
> +		.bus_num		= 2,
> +		.max_speed_hz		= 1857143,

I had used 2.6 MHz here.

> +		.platform_data		= &ads7846_pdata,
> +		.controller_data	= &tsc2046_chip_info,
> +		.irq = PXA_GPIO_TO_IRQ(GPIO115_MAGICIAN_nPEN_IRQ),
> +	},
> +};
> +
> +/*
>   * Platform devices
>   */
>  
> @@ -887,6 +968,7 @@ static struct platform_device *devices[]
> __initdata = {
>  	&egpio,
>  	&backlight,
>  	&pasic3,
> +	&vads7846_device,
>  	&bq24022,
>  	&gpio_vbus,
>  	&power_supply,
> @@ -944,6 +1026,10 @@ static void __init magician_init(void)
>  			lcd_select ? &samsung_info : &toppoly_info);
>  	} else
>  		pr_err("LCD detection: CPLD mapping failed\n");
> +
> +	pxa2xx_set_spi_info(2, &magician_spi_info);
> +	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_inf
> o));
> +
>  }
>  
>  MACHINE_START(MAGICIAN, "HTC Magician")

regards
Philipp

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

* Re: [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera
  2015-09-28 21:38   ` Petr Cvek
@ 2015-10-03 12:50     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:50 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
> This patch adds support for an OV9640 camera to the HTC Magician
> machine.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Still untested, but looks good to me.

regards
Philipp

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

* [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera
@ 2015-10-03 12:50     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
> This patch adds support for an OV9640 camera to the HTC Magician
> machine.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Still untested, but looks good to me.

regards
Philipp

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

* Re: [PATCH v4 20/26] ARM: pxa: magician: Add support for MAX1587A Vcore regulator
  2015-09-28 21:39   ` Petr Cvek
@ 2015-10-03 12:57     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:57 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:
> HTC Magician contains a MAX1587A voltage regulator for a Vcore
> supply.
> The Vcore regulation is required for a CPU speed switching. This
> patch adds
> declaration for the max1586 driver.
> 
> Notice:
> 
> - MAX1587A version does not support the V6 (USIM) output.
> - A boost resistor was directly measured for a board_id 0x3a.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 52
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index d844b9c..490d79f 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -52,6 +52,8 @@
>  #include <linux/platform_data/camera-pxa.h>
>  #include <media/soc_camera.h>
>  
> +#include <linux/regulator/max1586.h>
> +
>  #include "devices.h"
>  #include "generic.h"
>  
> @@ -787,6 +789,52 @@ static struct platform_device vads7846_device =
> {
>  };
>  
>  /*
> + * 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		= 1500000,

Wouldn't that be 1475000 for MAX1587A without the R24 resistor?

regards
Philipp

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

* [PATCH v4 20/26] ARM: pxa: magician: Add support for MAX1587A Vcore regulator
@ 2015-10-03 12:57     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:57 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:
> HTC Magician contains a MAX1587A voltage regulator for a Vcore
> supply.
> The Vcore regulation is required for a CPU speed switching. This
> patch adds
> declaration for the max1586 driver.
> 
> Notice:
> 
> - MAX1587A version does not support the V6 (USIM) output.
> - A boost resistor was directly measured for a board_id 0x3a.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 52
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index d844b9c..490d79f 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -52,6 +52,8 @@
>  #include <linux/platform_data/camera-pxa.h>
>  #include <media/soc_camera.h>
>  
> +#include <linux/regulator/max1586.h>
> +
>  #include "devices.h"
>  #include "generic.h"
>  
> @@ -787,6 +789,52 @@ static struct platform_device vads7846_device =
> {
>  };
>  
>  /*
> + * 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		= 1500000,

Wouldn't that be 1475000 for MAX1587A without the R24 resistor?

regards
Philipp

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

* Re: [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC
  2015-09-28 21:39   ` Petr Cvek
@ 2015-10-03 12:58     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:58 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:
> A PXA27x SoC supports USB device mode, this patch adds support for
> that.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index 490d79f..331dfd1 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -54,6 +54,10 @@
>  
>  #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 "generic.h"
>  
> @@ -582,6 +586,23 @@ static struct platform_device pasic3 = {
>   * PXA UDC
>   */

This comment should be part of this patch.

> +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 VUSB detection
> + */
> +

Move this comment to the earlier comment fixup patch.

Otherwise,
Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC
@ 2015-10-03 12:58     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:58 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:
> A PXA27x SoC supports USB device mode, this patch adds support for
> that.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
>  arch/arm/mach-pxa/magician.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
> -pxa/magician.c
> index 490d79f..331dfd1 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -54,6 +54,10 @@
>  
>  #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 "generic.h"
>  
> @@ -582,6 +586,23 @@ static struct platform_device pasic3 = {
>   * PXA UDC
>   */

This comment should be part of this patch.

> +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 VUSB detection
> + */
> +

Move this comment to the earlier comment fixup patch.

Otherwise,
Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* Re: [PATCH v4 22/26] ARM: pxa: magician: Remove pdata for pasic3-leds
  2015-09-28 21:39   ` Petr Cvek
@ 2015-10-03 12:59     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:59 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:
> The pasic3-leds driver was never in vanilla kernel. Actual
> configuration
> data for a hypothetical driver does not describe hardware completely,
> so
> remove them.
> 
> This patch prepare HTC Magician machine code to pasic3-leds driver
> addition.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

I had never figured out completely how the PASIC3 led blinking
machinery works. If these LED descriptions are insufficient,

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* [PATCH v4 22/26] ARM: pxa: magician: Remove pdata for pasic3-leds
@ 2015-10-03 12:59     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 12:59 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:
> The pasic3-leds driver was never in vanilla kernel. Actual
> configuration
> data for a hypothetical driver does not describe hardware completely,
> so
> remove them.
> 
> This patch prepare HTC Magician machine code to pasic3-leds driver
> addition.
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

I had never figured out completely how the PASIC3 led blinking
machinery works. If these LED descriptions are insufficient,

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* Re: [PATCH v4 25/26] ARM: pxa: magician: Add missing regulator for PWM backlight
  2015-09-28 21:40   ` Petr Cvek
@ 2015-10-03 13:02     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 13:02 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:40 +0200 schrieb Petr Cvek:
> Add a fake regulator, which is required for the correct
> initialization
> of the PWM backlight driver.

Fixed, not fake. Even though we can't control it, the backlight does
have a supply.

> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* [PATCH v4 25/26] ARM: pxa: magician: Add missing regulator for PWM backlight
@ 2015-10-03 13:02     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 13:02 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:40 +0200 schrieb Petr Cvek:
> Add a fake regulator, which is required for the correct
> initialization
> of the PWM backlight driver.

Fixed, not fake. Even though we can't control it, the backlight does
have a supply.

> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

regards
Philipp

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

* Re: [PATCH v4 26/26] ARM: pxa: magician: Move platform_add_devices() to the end of magician_init()
  2015-09-28 21:42   ` Petr Cvek
@ 2015-10-03 13:04     ` Philipp Zabel
  -1 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 13:04 UTC (permalink / raw)
  To: Petr Cvek, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Am Montag, den 28.09.2015, 23:42 +0200 schrieb Petr Cvek:
> This patch moves platform_add_devices() (standard declaration of
> devices)
> outside of the platform specific device declarations. Moving to the
> end
> of the magician_init() clarifies the source code (standard and
> specific
> declaration are not mixed).
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

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

* [PATCH v4 26/26] ARM: pxa: magician: Move platform_add_devices() to the end of magician_init()
@ 2015-10-03 13:04     ` Philipp Zabel
  0 siblings, 0 replies; 118+ messages in thread
From: Philipp Zabel @ 2015-10-03 13:04 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 28.09.2015, 23:42 +0200 schrieb Petr Cvek:
> This patch moves platform_add_devices() (standard declaration of
> devices)
> outside of the platform specific device declarations. Moving to the
> end
> of the magician_init() clarifies the source code (standard and
> specific
> declaration are not mixed).
> 
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>

Acked-by: Philipp Zabel <philipp.zabel@gmail.com>

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

* Re: [PATCH v4 17/26] ARM: pxa: magician: Fix wrongly enabled USB host ports
  2015-10-03 12:45     ` Philipp Zabel
@ 2015-10-05  2:03       ` Petr Cvek
  -1 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-05  2:03 UTC (permalink / raw)
  To: Philipp Zabel, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Dne 3.10.2015 v 14:45 Philipp Zabel napsal(a):
> Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
>> USB host ports on the HTC Magician are wrongly enabled. Port 1 is for
>> bluetooth and port 2 is for OTG (mux in the charger connector).
>>
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>> ---
>>  arch/arm/mach-pxa/magician.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
>> -pxa/magician.c
>> index 8e8b122..af8133a 100644
>> --- a/arch/arm/mach-pxa/magician.c
>> +++ b/arch/arm/mach-pxa/magician.c
>> @@ -780,8 +780,10 @@ static struct pxamci_platform_data
>> magician_mci_info = {
>>  
>>  static struct pxaohci_platform_data magician_ohci_info = {
>>  	.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_on_delay = 100,
>>  };
> 
> I have only ever tested the CSR bluetooth chip, so this could be
> correct, or again something that is different between the magician
> variants. I don't know.

If your magician has USB client directly from PXA SoC (not external PHY),
then only host port 2 can be muxed with client.

Intel® PXA27x Processor Family, Developer’s Manual

	"12.5 USB On-The-Go Operation"
	"Figure 12-15. USB OTG Configurations"

I think there was no implementation in the Windows Mobile, but I was able to
switch this mux and use a wifi usb dongle on the same connector as USB client.

> 
> regards
> Philipp
> 

Petr

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

* [PATCH v4 17/26] ARM: pxa: magician: Fix wrongly enabled USB host ports
@ 2015-10-05  2:03       ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-05  2:03 UTC (permalink / raw)
  To: linux-arm-kernel

Dne 3.10.2015 v 14:45 Philipp Zabel napsal(a):
> Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
>> USB host ports on the HTC Magician are wrongly enabled. Port 1 is for
>> bluetooth and port 2 is for OTG (mux in the charger connector).
>>
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>> ---
>>  arch/arm/mach-pxa/magician.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
>> -pxa/magician.c
>> index 8e8b122..af8133a 100644
>> --- a/arch/arm/mach-pxa/magician.c
>> +++ b/arch/arm/mach-pxa/magician.c
>> @@ -780,8 +780,10 @@ static struct pxamci_platform_data
>> magician_mci_info = {
>>  
>>  static struct pxaohci_platform_data magician_ohci_info = {
>>  	.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_on_delay = 100,
>>  };
> 
> I have only ever tested the CSR bluetooth chip, so this could be
> correct, or again something that is different between the magician
> variants. I don't know.

If your magician has USB client directly from PXA SoC (not external PHY),
then only host port 2 can be muxed with client.

Intel? PXA27x Processor Family, Developer?s Manual

	"12.5 USB On-The-Go Operation"
	"Figure 12-15. USB OTG Configurations"

I think there was no implementation in the Windows Mobile, but I was able to
switch this mux and use a wifi usb dongle on the same connector as USB client.

> 
> regards
> Philipp
> 

Petr

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

* Re: [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions
  2015-10-03 12:30     ` Philipp Zabel
@ 2015-10-05  2:15       ` Petr Cvek
  -1 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-05  2:15 UTC (permalink / raw)
  To: Philipp Zabel, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Dne 3.10.2015 v 14:30 Philipp Zabel napsal(a):
> Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
>> This patch fixes a pin mux for the HTC Magician machine. Wrong and
>> missing
>> definitions caused a bad LCD operation and an unavailability of
>> several
>> peripherals.
>>
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> 
> NAK on this one. Until this patch I can boot my o2 Xda mini with
> Toppoly display and see the framebuffer kernel console output. Can we
> split the LCD changes from the rest, I assume those are what breaks my
> display.

I read the Toppoly datasheet and it seems, the LCD panel implements V/HSYNC, while Samsung does not (and I'm sure at least one of these sync pins must be GPIO for DC-DC control). A solution is probably to reconfigure the GPIO muxes by detected LCD type.

> 
> best regards
> Philipp
> 

Petr

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

* [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions
@ 2015-10-05  2:15       ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-05  2:15 UTC (permalink / raw)
  To: linux-arm-kernel

Dne 3.10.2015 v 14:30 Philipp Zabel napsal(a):
> Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
>> This patch fixes a pin mux for the HTC Magician machine. Wrong and
>> missing
>> definitions caused a bad LCD operation and an unavailability of
>> several
>> peripherals.
>>
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> 
> NAK on this one. Until this patch I can boot my o2 Xda mini with
> Toppoly display and see the framebuffer kernel console output. Can we
> split the LCD changes from the rest, I assume those are what breaks my
> display.

I read the Toppoly datasheet and it seems, the LCD panel implements V/HSYNC, while Samsung does not (and I'm sure at least one of these sync pins must be GPIO for DC-DC control). A solution is probably to reconfigure the GPIO muxes by detected LCD type.

> 
> best regards
> Philipp
> 

Petr

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

* Re: [PATCH v4 11/26] ARM: pxa: magician: Optimize EGPIO initial values
  2015-10-03 12:35     ` Philipp Zabel
@ 2015-10-07 19:45       ` Robert Jarzmik
  -1 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-07 19:45 UTC (permalink / raw)
  To: Philipp Zabel
  Cc: Petr Cvek, daniel, haojian.zhuang, linux, linux-kernel, linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
>> This patch optimizes initial values of the EGPIO chip driver.
>> 
>> GSM and sound should be powered off during boot. A weak accumulator
>> and
>> a powered GSM sometimes cause a system reboot. A charging current
>> should be
>> as high as possible during boot.
>
> Wouldn't that violate USB spec if we boot the magician while plugged
> into an unpowered USB host?

You're right. As USB 2.0 device cannot draw more than 100mA until enumerated
(prior to battery charging spec 1.1). It is described in USB 2.0 specification,
chapter 7.3.2, in the table :
 - Unconfigured Function/Hub - ICCInit - maximum 100mA.

So I'll drop this patch for now I think.

Cheers.

-- 
Robert

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

* [PATCH v4 11/26] ARM: pxa: magician: Optimize EGPIO initial values
@ 2015-10-07 19:45       ` Robert Jarzmik
  0 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-07 19:45 UTC (permalink / raw)
  To: linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
>> This patch optimizes initial values of the EGPIO chip driver.
>> 
>> GSM and sound should be powered off during boot. A weak accumulator
>> and
>> a powered GSM sometimes cause a system reboot. A charging current
>> should be
>> as high as possible during boot.
>
> Wouldn't that violate USB spec if we boot the magician while plugged
> into an unpowered USB host?

You're right. As USB 2.0 device cannot draw more than 100mA until enumerated
(prior to battery charging spec 1.1). It is described in USB 2.0 specification,
chapter 7.3.2, in the table :
 - Unconfigured Function/Hub - ICCInit - maximum 100mA.

So I'll drop this patch for now I think.

Cheers.

-- 
Robert

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

* Re: [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera
  2015-10-03 12:50     ` Philipp Zabel
@ 2015-10-07 19:49       ` Robert Jarzmik
  -1 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-07 19:49 UTC (permalink / raw)
  To: Petr Cvek, Philipp Zabel
  Cc: daniel, haojian.zhuang, linux, linux-kernel, linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
>> This patch adds support for an OV9640 camera to the HTC Magician
>> machine.
>> 
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>
> Still untested, but looks good to me.
I'm still reluctant to have the reset with the timings handled in the board code
as I consider this should be in the camera driver code
(magician_camera_reset()).

Cheers.

-- 
Robert

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

* [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera
@ 2015-10-07 19:49       ` Robert Jarzmik
  0 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-07 19:49 UTC (permalink / raw)
  To: linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
>> This patch adds support for an OV9640 camera to the HTC Magician
>> machine.
>> 
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>
> Still untested, but looks good to me.
I'm still reluctant to have the reset with the timings handled in the board code
as I consider this should be in the camera driver code
(magician_camera_reset()).

Cheers.

-- 
Robert

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

* Re: [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera
  2015-10-07 19:49       ` Robert Jarzmik
@ 2015-10-08  6:05         ` Petr Cvek
  -1 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-08  6:05 UTC (permalink / raw)
  To: Robert Jarzmik, Philipp Zabel, g.liakhovetski
  Cc: daniel, haojian.zhuang, linux, linux-kernel, linux-arm-kernel

Dne 7.10.2015 v 21:49 Robert Jarzmik napsal(a):
> Philipp Zabel <philipp.zabel@gmail.com> writes:
> 
>> Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
>>> This patch adds support for an OV9640 camera to the HTC Magician
>>> machine.
>>>
>>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>>
>> Still untested, but looks good to me.
> I'm still reluctant to have the reset with the timings handled in the board code
> as I consider this should be in the camera driver code
> (magician_camera_reset()).

It supports an actual state of the OV9640 driver handling. But I can exclude it until
OV9640 will be transitioned. I don't have enough information about gpiod and soc-camera
and not enough time to maintain multiple different (and dependent) patchsets.

I forgot to test the timings ... actually I think I forgot results :-D . It was around the same time
I have found I2C fast mode is not working. Will test again.

Petr


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

* [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera
@ 2015-10-08  6:05         ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-08  6:05 UTC (permalink / raw)
  To: linux-arm-kernel

Dne 7.10.2015 v 21:49 Robert Jarzmik napsal(a):
> Philipp Zabel <philipp.zabel@gmail.com> writes:
> 
>> Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
>>> This patch adds support for an OV9640 camera to the HTC Magician
>>> machine.
>>>
>>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>>
>> Still untested, but looks good to me.
> I'm still reluctant to have the reset with the timings handled in the board code
> as I consider this should be in the camera driver code
> (magician_camera_reset()).

It supports an actual state of the OV9640 driver handling. But I can exclude it until
OV9640 will be transitioned. I don't have enough information about gpiod and soc-camera
and not enough time to maintain multiple different (and dependent) patchsets.

I forgot to test the timings ... actually I think I forgot results :-D . It was around the same time
I have found I2C fast mode is not working. Will test again.

Petr

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

* Re: [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs
  2015-10-03 12:38     ` Philipp Zabel
@ 2015-10-09  2:33       ` Petr Cvek
  -1 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-09  2:33 UTC (permalink / raw)
  To: Philipp Zabel, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Dne 3.10.2015 v 14:38 Philipp Zabel napsal(a):
> Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
>> This patch renames EGPIOs, which are used for the charging cable
>> presence
>> and type detection. Old names did not correspond with an observed
>> functionality (on board_id 0x3a). The behavior is not:
>>
>> - AC charger
>> - USB charger
>> - Cable detection
>>
>> , but:
>>
>> - AC/USB type
>> - Cable detection1
>> - Cable detection2
>>
>> This patch fixes a possible typo in the bit offset for the cable
>> detection
>> EGPIO declaration, too.
>>
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> 
> Just to be sure, please tell me what are the values of those three
> EGPIOs while
>   a) wall plug charger plugged in
>   b) usb cable connected to a host plugged in
>   c) no cable plugged in

usb	charger	none
====	=======	====
0xC0	0xC0	0xC0
0xA0	0xA0	0xA0
0x61	0x61	0x61
0x00	0x00	0x00
0x02	0x03	0x00	//first cable detection and charger type
0x3A	0x3A	0x3A	//send me your board_id
0x09	0x09	0x01	//second cable detection
0x04	0x04	0x04
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00

I think the charger is original.

> 
> It could well be there are differences between our boards.

Well it is CPLD chip, so they can have different bitstreams (OT: I can think of many CPLD HDL enhancements :-D).

Cheers,
Petr

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

* [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs
@ 2015-10-09  2:33       ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-09  2:33 UTC (permalink / raw)
  To: linux-arm-kernel

Dne 3.10.2015 v 14:38 Philipp Zabel napsal(a):
> Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
>> This patch renames EGPIOs, which are used for the charging cable
>> presence
>> and type detection. Old names did not correspond with an observed
>> functionality (on board_id 0x3a). The behavior is not:
>>
>> - AC charger
>> - USB charger
>> - Cable detection
>>
>> , but:
>>
>> - AC/USB type
>> - Cable detection1
>> - Cable detection2
>>
>> This patch fixes a possible typo in the bit offset for the cable
>> detection
>> EGPIO declaration, too.
>>
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> 
> Just to be sure, please tell me what are the values of those three
> EGPIOs while
>   a) wall plug charger plugged in
>   b) usb cable connected to a host plugged in
>   c) no cable plugged in

usb	charger	none
====	=======	====
0xC0	0xC0	0xC0
0xA0	0xA0	0xA0
0x61	0x61	0x61
0x00	0x00	0x00
0x02	0x03	0x00	//first cable detection and charger type
0x3A	0x3A	0x3A	//send me your board_id
0x09	0x09	0x01	//second cable detection
0x04	0x04	0x04
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00
0x00	0x00	0x00

I think the charger is original.

> 
> It could well be there are differences between our boards.

Well it is CPLD chip, so they can have different bitstreams (OT: I can think of many CPLD HDL enhancements :-D).

Cheers,
Petr

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

* Re: [PATCH v4 18/26] ARM: pxa: magician: Add support for ADS7846
  2015-10-03 12:49     ` Philipp Zabel
@ 2015-10-12  4:39       ` Petr Cvek
  -1 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-12  4:39 UTC (permalink / raw)
  To: Philipp Zabel, robert.jarzmik, daniel, haojian.zhuang, linux
  Cc: linux-kernel, linux-arm-kernel

Dne 3.10.2015 v 14:49 Philipp Zabel napsal(a):
> Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
>> Add support for an ADS7846 touchscreen.
> 
> It's actually a TSC2045.

2046...,  but I will mention it in next commit message (it was name of the driver).

> 
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>> ---
>>  arch/arm/mach-pxa/magician.c | 86
>> ++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 86 insertions(+)
>>
>> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
>> -pxa/magician.c
>> index af8133a..450f35f 100644
>> --- a/arch/arm/mach-pxa/magician.c
>> +++ b/arch/arm/mach-pxa/magician.c
>> @@ -28,6 +28,7 @@
>>  #include <linux/pwm_backlight.h>
>>  #include <linux/regulator/driver.h>
>>  #include <linux/regulator/gpio-regulator.h>
>> +#include <linux/regulator/fixed.h>
>>  #include <linux/regulator/machine.h>
>>  #include <linux/usb/gpio_vbus.h>
>>  #include <linux/i2c/pxa-i2c.h>
>> @@ -44,6 +45,10 @@
>>  #include <linux/platform_data/irda-pxaficp.h>
>>  #include <linux/platform_data/usb-ohci-pxa27x.h>
>>  
>> +#include <linux/spi/spi.h>
>> +#include <linux/spi/pxa2xx_spi.h>
>> +#include <linux/spi/ads7846.h>
>> +
>>  #include "devices.h"
>>  #include "generic.h"
>>  
>> @@ -748,6 +753,37 @@ static struct platform_device bq24022 = {
>>  };
>>  
>>  /*
>> + * fixed regulator for ads7846
>> + */
>> +
>> +static struct regulator_consumer_supply ads7846_supply =
>> +	REGULATOR_SUPPLY("vcc", "spi2.0");
>> +
>> +static struct regulator_init_data vads7846_regulator = {
>> +	.constraints = {
>> +		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
>> +	},
>> +	.num_consumer_supplies	= 1,
>> +	.consumer_supplies	= &ads7846_supply,
>> +};
>> +
>> +static struct fixed_voltage_config vads7846 = {
>> +	.supply_name	= "vads7846",
>> +	.microvolts	= 3300000, /* probably */
> 
> I agree.
> 
>> +	.gpio		= -EINVAL,
>> +	.startup_delay	= 0,
>> +	.init_data	= &vads7846_regulator,
>> +};
>> +
>> +static struct platform_device vads7846_device = {
>> +	.name	= "reg-fixed-voltage",
>> +	.id	= 1,
>> +	.dev	= {
>> +		.platform_data = &vads7846,
>> +	},
>> +};
>> +
>> +/*
>>   * MMC/SD
>>   */
>>  
>> @@ -879,6 +915,51 @@ static struct i2c_pxa_platform_data
>> magician_i2c_power_info = {
>>  };
>>  
>>  /*
>> + * Touchscreen
>> + */
>> +
>> +static struct ads7846_platform_data ads7846_pdata = {
>> +	.model			= 7846,
>> +	.x_min			= 0,
>> +	.y_min			= 0,
>> +	.x_max			= 4096,
>> +	.y_max			= 4096,
>> +	.x_plate_ohms		= 180,	/* for pressure
>> in 0-255 */
>> +	.y_plate_ohms		= 180,
>> +	.pressure_max		= 255,	/* up to 12bit
>> sampling */
>> +	.debounce_max		= 10,
>> +	.debounce_tol		= 3,
>> +	.debounce_rep		= 1,
>> +	.gpio_pendown		= GPIO115_MAGICIAN_nPEN_IRQ,
>> +	.keep_vref_on		= 1,	/* FIXME, external
>> Vref? */
>> +	.vref_delay_usecs	= 100,
>> +	/* .wait_for_sync, GPIO77_LCD_BIAS low noise measure,
>> latency! */
>> +};
>> +
>> +struct pxa2xx_spi_chip tsc2046_chip_info = {
>> +	.tx_threshold	= 1,
>> +	.rx_threshold	= 2,
>> +	.timeout	= 64,
>> +	.gpio_cs	= -1,
>> +};
>> +
>> +static struct pxa2xx_spi_master magician_spi_info = {
>> +	.num_chipselect	= 1,
>> +	.enable_dma	= 1,
>> +};
>> +
>> +static struct spi_board_info ads7846_spi_board_info[] __initdata = {
>> +	{
>> +		.modalias		= "ads7846",
>> +		.bus_num		= 2,
>> +		.max_speed_hz		= 1857143,
> 
> I had used 2.6 MHz here.

Will change to something more visible, probably remnants of some debugging.
BTW It sets frequency of a SPI? 

> 
>> +		.platform_data		= &ads7846_pdata,
>> +		.controller_data	= &tsc2046_chip_info,
>> +		.irq = PXA_GPIO_TO_IRQ(GPIO115_MAGICIAN_nPEN_IRQ),
>> +	},
>> +};
>> +
>> +/*
>>   * Platform devices
>>   */
>>  
>> @@ -887,6 +968,7 @@ static struct platform_device *devices[]
>> __initdata = {
>>  	&egpio,
>>  	&backlight,
>>  	&pasic3,
>> +	&vads7846_device,
>>  	&bq24022,
>>  	&gpio_vbus,
>>  	&power_supply,
>> @@ -944,6 +1026,10 @@ static void __init magician_init(void)
>>  			lcd_select ? &samsung_info : &toppoly_info);
>>  	} else
>>  		pr_err("LCD detection: CPLD mapping failed\n");
>> +
>> +	pxa2xx_set_spi_info(2, &magician_spi_info);
>> +	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_inf
>> o));
>> +
>>  }
>>  
>>  MACHINE_START(MAGICIAN, "HTC Magician")
> 
> regards
> Philipp
> 

Petr

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

* [PATCH v4 18/26] ARM: pxa: magician: Add support for ADS7846
@ 2015-10-12  4:39       ` Petr Cvek
  0 siblings, 0 replies; 118+ messages in thread
From: Petr Cvek @ 2015-10-12  4:39 UTC (permalink / raw)
  To: linux-arm-kernel

Dne 3.10.2015 v 14:49 Philipp Zabel napsal(a):
> Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:
>> Add support for an ADS7846 touchscreen.
> 
> It's actually a TSC2045.

2046...,  but I will mention it in next commit message (it was name of the driver).

> 
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>> ---
>>  arch/arm/mach-pxa/magician.c | 86
>> ++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 86 insertions(+)
>>
>> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach
>> -pxa/magician.c
>> index af8133a..450f35f 100644
>> --- a/arch/arm/mach-pxa/magician.c
>> +++ b/arch/arm/mach-pxa/magician.c
>> @@ -28,6 +28,7 @@
>>  #include <linux/pwm_backlight.h>
>>  #include <linux/regulator/driver.h>
>>  #include <linux/regulator/gpio-regulator.h>
>> +#include <linux/regulator/fixed.h>
>>  #include <linux/regulator/machine.h>
>>  #include <linux/usb/gpio_vbus.h>
>>  #include <linux/i2c/pxa-i2c.h>
>> @@ -44,6 +45,10 @@
>>  #include <linux/platform_data/irda-pxaficp.h>
>>  #include <linux/platform_data/usb-ohci-pxa27x.h>
>>  
>> +#include <linux/spi/spi.h>
>> +#include <linux/spi/pxa2xx_spi.h>
>> +#include <linux/spi/ads7846.h>
>> +
>>  #include "devices.h"
>>  #include "generic.h"
>>  
>> @@ -748,6 +753,37 @@ static struct platform_device bq24022 = {
>>  };
>>  
>>  /*
>> + * fixed regulator for ads7846
>> + */
>> +
>> +static struct regulator_consumer_supply ads7846_supply =
>> +	REGULATOR_SUPPLY("vcc", "spi2.0");
>> +
>> +static struct regulator_init_data vads7846_regulator = {
>> +	.constraints = {
>> +		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
>> +	},
>> +	.num_consumer_supplies	= 1,
>> +	.consumer_supplies	= &ads7846_supply,
>> +};
>> +
>> +static struct fixed_voltage_config vads7846 = {
>> +	.supply_name	= "vads7846",
>> +	.microvolts	= 3300000, /* probably */
> 
> I agree.
> 
>> +	.gpio		= -EINVAL,
>> +	.startup_delay	= 0,
>> +	.init_data	= &vads7846_regulator,
>> +};
>> +
>> +static struct platform_device vads7846_device = {
>> +	.name	= "reg-fixed-voltage",
>> +	.id	= 1,
>> +	.dev	= {
>> +		.platform_data = &vads7846,
>> +	},
>> +};
>> +
>> +/*
>>   * MMC/SD
>>   */
>>  
>> @@ -879,6 +915,51 @@ static struct i2c_pxa_platform_data
>> magician_i2c_power_info = {
>>  };
>>  
>>  /*
>> + * Touchscreen
>> + */
>> +
>> +static struct ads7846_platform_data ads7846_pdata = {
>> +	.model			= 7846,
>> +	.x_min			= 0,
>> +	.y_min			= 0,
>> +	.x_max			= 4096,
>> +	.y_max			= 4096,
>> +	.x_plate_ohms		= 180,	/* for pressure
>> in 0-255 */
>> +	.y_plate_ohms		= 180,
>> +	.pressure_max		= 255,	/* up to 12bit
>> sampling */
>> +	.debounce_max		= 10,
>> +	.debounce_tol		= 3,
>> +	.debounce_rep		= 1,
>> +	.gpio_pendown		= GPIO115_MAGICIAN_nPEN_IRQ,
>> +	.keep_vref_on		= 1,	/* FIXME, external
>> Vref? */
>> +	.vref_delay_usecs	= 100,
>> +	/* .wait_for_sync, GPIO77_LCD_BIAS low noise measure,
>> latency! */
>> +};
>> +
>> +struct pxa2xx_spi_chip tsc2046_chip_info = {
>> +	.tx_threshold	= 1,
>> +	.rx_threshold	= 2,
>> +	.timeout	= 64,
>> +	.gpio_cs	= -1,
>> +};
>> +
>> +static struct pxa2xx_spi_master magician_spi_info = {
>> +	.num_chipselect	= 1,
>> +	.enable_dma	= 1,
>> +};
>> +
>> +static struct spi_board_info ads7846_spi_board_info[] __initdata = {
>> +	{
>> +		.modalias		= "ads7846",
>> +		.bus_num		= 2,
>> +		.max_speed_hz		= 1857143,
> 
> I had used 2.6 MHz here.

Will change to something more visible, probably remnants of some debugging.
BTW It sets frequency of a SPI? 

> 
>> +		.platform_data		= &ads7846_pdata,
>> +		.controller_data	= &tsc2046_chip_info,
>> +		.irq = PXA_GPIO_TO_IRQ(GPIO115_MAGICIAN_nPEN_IRQ),
>> +	},
>> +};
>> +
>> +/*
>>   * Platform devices
>>   */
>>  
>> @@ -887,6 +968,7 @@ static struct platform_device *devices[]
>> __initdata = {
>>  	&egpio,
>>  	&backlight,
>>  	&pasic3,
>> +	&vads7846_device,
>>  	&bq24022,
>>  	&gpio_vbus,
>>  	&power_supply,
>> @@ -944,6 +1026,10 @@ static void __init magician_init(void)
>>  			lcd_select ? &samsung_info : &toppoly_info);
>>  	} else
>>  		pr_err("LCD detection: CPLD mapping failed\n");
>> +
>> +	pxa2xx_set_spi_info(2, &magician_spi_info);
>> +	spi_register_board_info(ARRAY_AND_SIZE(ads7846_spi_board_inf
>> o));
>> +
>>  }
>>  
>>  MACHINE_START(MAGICIAN, "HTC Magician")
> 
> regards
> Philipp
> 

Petr

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

* Re: [PATCH v4 02/26] ARM: pxa: magician: Change comments to be more informative
  2015-10-03 12:19     ` Philipp Zabel
@ 2015-10-13 20:08       ` Robert Jarzmik
  -1 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:08 UTC (permalink / raw)
  To: Petr Cvek, Philipp Zabel
  Cc: daniel, haojian.zhuang, linux, linux-kernel, linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Am Montag, den 28.09.2015, 23:10 +0200 schrieb Petr Cvek:
>> This patch changes the comments in the HTC Magician machine source
>> code
>> to better describe used devices and interfaces.
>> 
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
Queued to pxa/for-next with Philipp's comments taken into account.

Thanks.

--
Robert

PS: the MP1521 topic
>> +/*
>> + * LCD PWM backlight (main)
>> + *
>> + * MP1521 frequency should be:
>> + *	100-400 Hz = 2 .5*10^6 - 10 *10^6 ns
>
> What is MP1521?
How about this one :
http://www.digchip.com/datasheets/parts/datasheet/1006/MP1521-pdf.php

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

* [PATCH v4 02/26] ARM: pxa: magician: Change comments to be more informative
@ 2015-10-13 20:08       ` Robert Jarzmik
  0 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:08 UTC (permalink / raw)
  To: linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Am Montag, den 28.09.2015, 23:10 +0200 schrieb Petr Cvek:
>> This patch changes the comments in the HTC Magician machine source
>> code
>> to better describe used devices and interfaces.
>> 
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
Queued to pxa/for-next with Philipp's comments taken into account.

Thanks.

--
Robert

PS: the MP1521 topic
>> +/*
>> + * LCD PWM backlight (main)
>> + *
>> + * MP1521 frequency should be:
>> + *	100-400 Hz = 2?.5*10^6 - 10?*10^6 ns
>
> What is MP1521?
How about this one :
http://www.digchip.com/datasheets/parts/datasheet/1006/MP1521-pdf.php

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

* Re: [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions
  2015-10-05  2:15       ` Petr Cvek
@ 2015-10-13 20:09         ` Robert Jarzmik
  -1 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:09 UTC (permalink / raw)
  To: Petr Cvek
  Cc: Philipp Zabel, daniel, haojian.zhuang, linux, linux-kernel,
	linux-arm-kernel

Petr Cvek <petr.cvek@tul.cz> writes:

> Dne 3.10.2015 v 14:30 Philipp Zabel napsal(a):
>> Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
>>> This patch fixes a pin mux for the HTC Magician machine. Wrong and
>>> missing
>>> definitions caused a bad LCD operation and an unavailability of
>>> several
>>> peripherals.
>>>
>>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>> 
>> NAK on this one. Until this patch I can boot my o2 Xda mini with
>> Toppoly display and see the framebuffer kernel console output. Can we
>> split the LCD changes from the rest, I assume those are what breaks my
>> display.
>
> I read the Toppoly datasheet and it seems, the LCD panel implements V/HSYNC,
> while Samsung does not (and I'm sure at least one of these sync pins must be
> GPIO for DC-DC control). A solution is probably to reconfigure the GPIO muxes by
> detected LCD type.

For the time being, I'll drop this one.

Cheers.

-- 
Robert

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

* [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions
@ 2015-10-13 20:09         ` Robert Jarzmik
  0 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:09 UTC (permalink / raw)
  To: linux-arm-kernel

Petr Cvek <petr.cvek@tul.cz> writes:

> Dne 3.10.2015 v 14:30 Philipp Zabel napsal(a):
>> Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:
>>> This patch fixes a pin mux for the HTC Magician machine. Wrong and
>>> missing
>>> definitions caused a bad LCD operation and an unavailability of
>>> several
>>> peripherals.
>>>
>>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>> 
>> NAK on this one. Until this patch I can boot my o2 Xda mini with
>> Toppoly display and see the framebuffer kernel console output. Can we
>> split the LCD changes from the rest, I assume those are what breaks my
>> display.
>
> I read the Toppoly datasheet and it seems, the LCD panel implements V/HSYNC,
> while Samsung does not (and I'm sure at least one of these sync pins must be
> GPIO for DC-DC control). A solution is probably to reconfigure the GPIO muxes by
> detected LCD type.

For the time being, I'll drop this one.

Cheers.

-- 
Robert

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

* Re: [PATCH v4 20/26] ARM: pxa: magician: Add support for MAX1587A Vcore regulator
  2015-10-03 12:57     ` Philipp Zabel
@ 2015-10-13 20:16       ` Robert Jarzmik
  -1 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:16 UTC (permalink / raw)
  To: Petr Cvek, Philipp Zabel
  Cc: daniel, haojian.zhuang, linux, linux-kernel, linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

>> +static struct regulator_init_data magician_max1587a_v3_info = {
>> +	.constraints = {
>> +		.name		= "vcc_core range",
>> +		.min_uV		= 700000,
>> +		.max_uV		= 1500000,
>
> Wouldn't that be 1475000 for MAX1587A without the R24 resistor?
That is what I read in the Maxim 1587A datasheet, so squashed this into the
patch and queued into pxa/for-next.

Thanks.

-- 
Robert

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

* [PATCH v4 20/26] ARM: pxa: magician: Add support for MAX1587A Vcore regulator
@ 2015-10-13 20:16       ` Robert Jarzmik
  0 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:16 UTC (permalink / raw)
  To: linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

>> +static struct regulator_init_data magician_max1587a_v3_info = {
>> +	.constraints = {
>> +		.name		= "vcc_core range",
>> +		.min_uV		= 700000,
>> +		.max_uV		= 1500000,
>
> Wouldn't that be 1475000 for MAX1587A without the R24 resistor?
That is what I read in the Maxim 1587A datasheet, so squashed this into the
patch and queued into pxa/for-next.

Thanks.

-- 
Robert

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

* Re: [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC
  2015-10-03 12:58     ` Philipp Zabel
@ 2015-10-13 20:29       ` Robert Jarzmik
  -1 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:29 UTC (permalink / raw)
  To: Petr Cvek, Philipp Zabel
  Cc: daniel, haojian.zhuang, linux, linux-kernel, linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Acked-by: Philipp Zabel <philipp.zabel@gmail.com>
Comments used and pushed into pxa/for-next, thanks.

Cheers.

-- 
Robert

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

* [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC
@ 2015-10-13 20:29       ` Robert Jarzmik
  0 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:29 UTC (permalink / raw)
  To: linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Acked-by: Philipp Zabel <philipp.zabel@gmail.com>
Comments used and pushed into pxa/for-next, thanks.

Cheers.

-- 
Robert

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

* Re: [PATCH v4 22/26] ARM: pxa: magician: Remove pdata for pasic3-leds
  2015-10-03 12:59     ` Philipp Zabel
@ 2015-10-13 20:32       ` Robert Jarzmik
  -1 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:32 UTC (permalink / raw)
  To: Petr Cvek, Philipp Zabel
  Cc: daniel, haojian.zhuang, linux, linux-kernel, linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:
>> The pasic3-leds driver was never in vanilla kernel. Actual
>> configuration
>> data for a hypothetical driver does not describe hardware completely,
>> so
>> remove them.
>> 
>> This patch prepare HTC Magician machine code to pasic3-leds driver
>> addition.
>> 
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>
> I had never figured out completely how the PASIC3 led blinking
> machinery works. If these LED descriptions are insufficient,
>
> Acked-by: Philipp Zabel <philipp.zabel@gmail.com>
Queued into pxa/for-next, thanks.

Cheers.

-- 
Robert

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

* [PATCH v4 22/26] ARM: pxa: magician: Remove pdata for pasic3-leds
@ 2015-10-13 20:32       ` Robert Jarzmik
  0 siblings, 0 replies; 118+ messages in thread
From: Robert Jarzmik @ 2015-10-13 20:32 UTC (permalink / raw)
  To: linux-arm-kernel

Philipp Zabel <philipp.zabel@gmail.com> writes:

> Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:
>> The pasic3-leds driver was never in vanilla kernel. Actual
>> configuration
>> data for a hypothetical driver does not describe hardware completely,
>> so
>> remove them.
>> 
>> This patch prepare HTC Magician machine code to pasic3-leds driver
>> addition.
>> 
>> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
>
> I had never figured out completely how the PASIC3 led blinking
> machinery works. If these LED descriptions are insufficient,
>
> Acked-by: Philipp Zabel <philipp.zabel@gmail.com>
Queued into pxa/for-next, thanks.

Cheers.

-- 
Robert

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

end of thread, other threads:[~2015-10-13 20:38 UTC | newest]

Thread overview: 118+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1443472089.git.petr.cvek@tul.cz>
2015-09-28 21:09 ` [PATCH v4 01/26] ARM: pxa: magician: Fix indentation in machine files Petr Cvek
2015-09-28 21:09   ` Petr Cvek
2015-10-03 12:14   ` Philipp Zabel
2015-10-03 12:14     ` Philipp Zabel
2015-09-28 21:10 ` [PATCH v4 02/26] ARM: pxa: magician: Change comments to be more informative Petr Cvek
2015-09-28 21:10   ` Petr Cvek
2015-10-03 12:19   ` Philipp Zabel
2015-10-03 12:19     ` Philipp Zabel
2015-10-13 20:08     ` Robert Jarzmik
2015-10-13 20:08       ` Robert Jarzmik
2015-09-28 21:10 ` [PATCH v4 03/26] ARM: pxa: magician: Print more specific error message for global GPIOs Petr Cvek
2015-09-28 21:10   ` Petr Cvek
2015-10-03 12:19   ` Philipp Zabel
2015-10-03 12:19     ` Philipp Zabel
2015-09-28 21:11 ` [PATCH v4 04/26] ARM: pxa: magician: Optimize debug messages for LCD power Petr Cvek
2015-09-28 21:11   ` Petr Cvek
2015-10-03 12:20   ` Philipp Zabel
2015-10-03 12:20     ` Philipp Zabel
2015-09-28 21:11 ` [PATCH v4 05/26] ARM: pxa: magician: Change description of LCD power GPIO Petr Cvek
2015-09-28 21:11   ` Petr Cvek
2015-10-03 12:21   ` Philipp Zabel
2015-10-03 12:21     ` Philipp Zabel
2015-09-28 21:15 ` [PATCH v4 06/26] ARM: pxa: magician: Add new discovered EGPIO pins Petr Cvek
2015-09-28 21:15   ` Petr Cvek
2015-10-03 12:23   ` Philipp Zabel
2015-10-03 12:23     ` Philipp Zabel
2015-09-28 21:15 ` [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions Petr Cvek
2015-09-28 21:15   ` Petr Cvek
2015-10-03 12:30   ` Philipp Zabel
2015-10-03 12:30     ` Philipp Zabel
2015-10-05  2:15     ` Petr Cvek
2015-10-05  2:15       ` Petr Cvek
2015-10-13 20:09       ` Robert Jarzmik
2015-10-13 20:09         ` Robert Jarzmik
2015-09-28 21:15 ` [PATCH v4 08/26] ARM: pxa: magician: Rename abstract LCD GPIOs Petr Cvek
2015-09-28 21:15   ` Petr Cvek
2015-10-03 12:31   ` Philipp Zabel
2015-10-03 12:31     ` Philipp Zabel
2015-09-28 21:16 ` [PATCH v4 09/26] ARM: pxa: magician: Optimize powerup delays for Samsung LCD Petr Cvek
2015-09-28 21:16   ` Petr Cvek
2015-10-03 12:32   ` Philipp Zabel
2015-10-03 12:32     ` Philipp Zabel
2015-09-28 21:32 ` [PATCH v4 10/26] ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz Petr Cvek
2015-09-28 21:32   ` Petr Cvek
2015-10-03 12:33   ` Philipp Zabel
2015-10-03 12:33     ` Philipp Zabel
2015-09-28 21:32 ` [PATCH v4 11/26] ARM: pxa: magician: Optimize EGPIO initial values Petr Cvek
2015-09-28 21:32   ` Petr Cvek
2015-10-03 12:35   ` Philipp Zabel
2015-10-03 12:35     ` Philipp Zabel
2015-10-07 19:45     ` Robert Jarzmik
2015-10-07 19:45       ` Robert Jarzmik
2015-09-28 21:32 ` [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs Petr Cvek
2015-09-28 21:32   ` Petr Cvek
2015-10-03 12:38   ` Philipp Zabel
2015-10-03 12:38     ` Philipp Zabel
2015-10-09  2:33     ` Petr Cvek
2015-10-09  2:33       ` Petr Cvek
2015-09-28 21:33 ` [PATCH v4 13/26] ARM: pxa: magician: Fix and add charging detection functions Petr Cvek
2015-09-28 21:33   ` Petr Cvek
2015-09-28 21:33 ` [PATCH v4 14/26] ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers Petr Cvek
2015-09-28 21:33   ` Petr Cvek
2015-10-03 12:41   ` Philipp Zabel
2015-10-03 12:41     ` Philipp Zabel
2015-09-28 21:34 ` [PATCH v4 15/26] ARM: pxa: magician: Fix redundant GPIO request for pxaficp_ir Petr Cvek
2015-09-28 21:34   ` Petr Cvek
2015-09-28 21:34 ` [PATCH v4 16/26] ARM: pxa: magician: Fix support for Intel Strata NOR Flash Petr Cvek
2015-09-28 21:34   ` Petr Cvek
2015-09-28 21:38 ` [PATCH v4 17/26] ARM: pxa: magician: Fix wrongly enabled USB host ports Petr Cvek
2015-09-28 21:38   ` Petr Cvek
2015-10-03 12:45   ` Philipp Zabel
2015-10-03 12:45     ` Philipp Zabel
2015-10-05  2:03     ` Petr Cvek
2015-10-05  2:03       ` Petr Cvek
2015-09-28 21:38 ` [PATCH v4 18/26] ARM: pxa: magician: Add support for ADS7846 Petr Cvek
2015-09-28 21:38   ` Petr Cvek
2015-10-03 12:49   ` Philipp Zabel
2015-10-03 12:49     ` Philipp Zabel
2015-10-12  4:39     ` Petr Cvek
2015-10-12  4:39       ` Petr Cvek
2015-09-28 21:38 ` [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera Petr Cvek
2015-09-28 21:38   ` Petr Cvek
2015-10-03 12:50   ` Philipp Zabel
2015-10-03 12:50     ` Philipp Zabel
2015-10-07 19:49     ` Robert Jarzmik
2015-10-07 19:49       ` Robert Jarzmik
2015-10-08  6:05       ` Petr Cvek
2015-10-08  6:05         ` Petr Cvek
2015-09-28 21:39 ` [PATCH v4 20/26] ARM: pxa: magician: Add support for MAX1587A Vcore regulator Petr Cvek
2015-09-28 21:39   ` Petr Cvek
2015-10-03 12:57   ` Philipp Zabel
2015-10-03 12:57     ` Philipp Zabel
2015-10-13 20:16     ` Robert Jarzmik
2015-10-13 20:16       ` Robert Jarzmik
2015-09-28 21:39 ` [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC Petr Cvek
2015-09-28 21:39   ` Petr Cvek
2015-10-03 12:58   ` Philipp Zabel
2015-10-03 12:58     ` Philipp Zabel
2015-10-13 20:29     ` Robert Jarzmik
2015-10-13 20:29       ` Robert Jarzmik
2015-09-28 21:39 ` [PATCH v4 22/26] ARM: pxa: magician: Remove pdata for pasic3-leds Petr Cvek
2015-09-28 21:39   ` Petr Cvek
2015-10-03 12:59   ` Philipp Zabel
2015-10-03 12:59     ` Philipp Zabel
2015-10-13 20:32     ` Robert Jarzmik
2015-10-13 20:32       ` Robert Jarzmik
2015-09-28 21:40 ` [PATCH v4 23/26] ARM: pxa: magician: Remove definition of the STUART port Petr Cvek
2015-09-28 21:40   ` Petr Cvek
2015-09-28 21:40 ` [PATCH v4 24/26] ARM: pxa: magician: Add debug message for backlight brightness function Petr Cvek
2015-09-28 21:40   ` Petr Cvek
2015-09-28 21:40 ` [PATCH v4 25/26] ARM: pxa: magician: Add missing regulator for PWM backlight Petr Cvek
2015-09-28 21:40   ` Petr Cvek
2015-10-03 13:02   ` Philipp Zabel
2015-10-03 13:02     ` Philipp Zabel
2015-09-28 21:42 ` [PATCH v4 26/26] ARM: pxa: magician: Move platform_add_devices() to the end of magician_init() Petr Cvek
2015-09-28 21:42   ` Petr Cvek
2015-10-03 13:04   ` Philipp Zabel
2015-10-03 13:04     ` Philipp Zabel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.