Skip to contentSkip to conversation

ARM: pxa: magician: Fix indentation in machine files

PATCH Applied Petr Cvek 3 participants 59 messages Sep 28, 2015 – Oct 13, 2015 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Petr Cvek

author
#1 lore raw

PATCH v4 1/26 ARM: pxa: magician: Fix indentation in machine files

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

---
 arch/arm/mach-pxa/include/mach/magician.h |  54 ++---
 arch/arm/mach-pxa/magician.c              | 368 +++++++++++++++---------------
 2 files changed, 211 insertions(+), 211 deletions(-)
arch/arm/mach-pxa/include/mach/magician.h +27 -27
index ba6a6e1..b08c85a 100644
@@ -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_ */
arch/arm/mach-pxa/magician.c +184 -184

597 lines not on this page · raw message

Signature · 1 line
1.7.12.1
Acked-by on v4 1/26
#2 lore raw

Am Montag, den 28.09.2015, 23:09 +0200 schrieb Petr Cvek:

Quoted 4 lines

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

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

author
#3 lore raw

PATCH v4 2/26 ARM: pxa: magician: Change comments to be more informative

In reply to a message not in the archive

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

---
 arch/arm/mach-pxa/magician.c | 46 +++++++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 15 deletions(-)
arch/arm/mach-pxa/magician.c +31 -15
index c10f932..c8fa379 100644
@@ -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 = {
Signature · 1 line
1.7.12.1
#4 lore raw

Re: [PATCH v4 02/26] ARM: pxa: magician: Change comments to be more informative

Am Montag, den 28.09.2015, 23:10 +0200 schrieb Petr Cvek:

Quoted 5 lines

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

This is mostly fine, some comments below.

[...]

Quoted 7 lines

static struct resource egpio_resources[] = {

arch/arm/mach-pxa/magician.c +0 -1
@@ -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 */

arch/arm/mach-pxa/magician.c static struct htc_egpio_chip egpio_chips[] = { · line 208

Quoted 7 lines
arch/arm/mach-pxa/magician.c +4 -0
+		/*
+		 * 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?

[...]

Quoted 5 lines

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

What is MP1521?

[...]

arch/arm/mach-pxa/magician.c static struct pasic3_leds_machinfo · line 480

Quoted 8 lines
arch/arm/mach-pxa/magician.c +1 -1
@@ -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.

arch/arm/mach-pxa/magician.c static struct platform_device pasic3 = { · line 514

Quoted 9 lines
arch/arm/mach-pxa/magician.c +1 -1
@@ -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

maintainer Applied
#5 lore raw

Re: [PATCH v4 02/26] ARM: pxa: magician: Change comments to be more informative

Quoted 6 lines · Philipp Zabel

Am Montag, den 28.09.2015, 23:10 +0200 schrieb Petr Cvek:

Quoted 5 lines

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

Queued to pxa/for-next with Philipp's comments taken into account.

Thanks.

--
Robert

PS: the MP1521 topic

Quoted 7 lines
Quoted 5 lines

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

author
#6 lore raw

PATCH v4 3/26 ARM: pxa: magician: Print more specific error message for global GPIOs

In reply to a message not in the archive

Print more specific error message for global GPIOs.

---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-pxa/magician.c +1 -1
index c8fa379..29d8146 100644
@@ -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);
Signature · 1 line
1.7.12.1
Acked-by on v4 3/26
#7 lore raw

Re: [PATCH v4 03/26] ARM: pxa: magician: Print more specific error message for global GPIOs

Am Montag, den 28.09.2015, 23:10 +0200 schrieb Petr Cvek:

Quoted 3 lines

Print more specific error message for global GPIOs.

Quoted 21 lines
---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach renamed from arch/arm/mach-pxa/magician.c +0 -1
-pxa/magician.c

index c8fa379..29d8146 100644

arch/arm/mach-pxa/magician.c +1 -1
@@ -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);
arch/arm/mach-pxa/magician.c +0 -0
 	pxa_set_ffuart_info(NULL);
 	pxa_set_btuart_info(NULL);
author
#8 lore raw

PATCH v4 4/26 ARM: pxa: magician: Optimize debug messages for LCD power

In reply to a message not in the archive

Optimize the debug messages for the LCD power.

---
 arch/arm/mach-pxa/magician.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/arm/mach-pxa/magician.c +2 -6
index 29d8146..1bac785 100644
@@ -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);
Signature · 1 line
1.7.12.1
author
#10 lore raw

PATCH v4 5/26 ARM: pxa: magician: Change description of LCD power GPIO

In reply to a message not in the archive

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

---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-pxa/magician.c +1 -1
index 1bac785..a93ed14 100644
@@ -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
Signature · 1 line
1.7.12.1
author
#12 lore raw

PATCH v4 6/26 ARM: pxa: magician: Add new discovered EGPIO pins

In reply to a message not in the archive

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

---
 arch/arm/mach-pxa/include/mach/magician.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-pxa/include/mach/magician.h +4 -1
index b08c85a..3f8922a 100644
@@ -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_ */
Signature · 1 line
1.7.12.1
Acked-by on v4 6/26
#13 lore raw

Re: [PATCH v4 06/26] ARM: pxa: magician: Add new discovered EGPIO pins

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:

Quoted 5 lines

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

Do you have more details how NiCD charging works?

regards
Philipp

author
#14 lore raw

PATCH v4 7/26 ARM: pxa: magician: Fix HTC Magician pin mux definitions

In reply to a message not in the archive

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.

---
 arch/arm/mach-pxa/magician.c | 77 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 70 insertions(+), 7 deletions(-)
arch/arm/mach-pxa/magician.c +70 -7
index a93ed14..91d302b 100644
@@ -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? */
 };
 
 /*
Signature · 1 line
1.7.12.1
#15 lore raw

Re: [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:

Quoted 7 lines

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.

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

author
#16 lore raw

Re: [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions

Dne 3.10.2015 v 14:30 Philipp Zabel napsal(a):

Quoted 7 lines

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:

Quoted 6 lines

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.

Quoted 6 lines
Quoted 1 line

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.

Quoted 4 lines

best regards
Philipp

Petr

maintainer
#17 lore raw

Re: [PATCH v4 07/26] ARM: pxa: magician: Fix HTC Magician pin mux definitions

Quoted 15 lines · Petr Cvek

Dne 3.10.2015 v 14:30 Philipp Zabel napsal(a):

Quoted 7 lines

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:

Quoted 6 lines

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.

Quoted 6 lines
Quoted 1 line

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.

Quoted 4 lines

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.

Signature · 1 line
Robert
author
#18 lore raw

PATCH v4 8/26 ARM: pxa: magician: Rename abstract LCD GPIOs

In reply to a message not in the archive

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.

---
 arch/arm/mach-pxa/include/mach/magician.h |  6 +++---
 arch/arm/mach-pxa/magician.c              | 33 +++++++++++++++++--------------
 2 files changed, 21 insertions(+), 18 deletions(-)
arch/arm/mach-pxa/include/mach/magician.h +3 -3
index 3f8922a..af4cdc2 100644
@@ -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
arch/arm/mach-pxa/magician.c +18 -15
index 91d302b..d78fc3a 100644
@@ -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,
Signature · 1 line
1.7.12.1
Acked-by on v4 8/26
#19 lore raw

Re: [PATCH v4 08/26] ARM: pxa: magician: Rename abstract LCD GPIOs

Am Montag, den 28.09.2015, 23:15 +0200 schrieb Petr Cvek:

Quoted 7 lines

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.

regards
Philipp

author
#20 lore raw

PATCH v4 9/26 ARM: pxa: magician: Optimize powerup delays for Samsung LCD

In reply to a message not in the archive

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

---
 arch/arm/mach-pxa/magician.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
arch/arm/mach-pxa/magician.c +6 -8
index d78fc3a..14d1f55 100644
@@ -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
Signature · 1 line
1.7.12.1
author
#22 lore raw

PATCH v4 10/26 ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz

In reply to a message not in the archive

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%.

---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-pxa/magician.c +1 -1
index 14d1f55..2c487ae 100644
@@ -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,
Signature · 1 line
1.7.12.1
Acked-by on v4 10/26
#23 lore raw

Re: [PATCH v4 10/26] ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:

Quoted 7 lines

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%.

author
#24 lore raw

PATCH v4 11/26 ARM: pxa: magician: Optimize EGPIO initial values

In reply to a message not in the archive

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.

---
 arch/arm/mach-pxa/magician.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/magician.c +5 -2
index 2c487ae..bf0760e 100644
@@ -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,
Signature · 1 line
1.7.12.1
#25 lore raw

Re: [PATCH v4 11/26] ARM: pxa: magician: Optimize EGPIO initial values

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:

Quoted 7 lines

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

maintainer
#26 lore raw

Re: [PATCH v4 11/26] ARM: pxa: magician: Optimize EGPIO initial values

Quoted 11 lines · Philipp Zabel

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:

Quoted 7 lines

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.

Signature · 1 line
Robert
author
#27 lore raw

PATCH v4 12/26 ARM: pxa: magician: Rename charger cable detection EGPIOs

In reply to a message not in the archive

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.

---
 arch/arm/mach-pxa/include/mach/magician.h | 11 ++++++++---
 arch/arm/mach-pxa/magician.c              |  8 ++++----
 2 files changed, 12 insertions(+), 7 deletions(-)
arch/arm/mach-pxa/include/mach/magician.h +8 -3
index af4cdc2..5f6b850 100644
@@ -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_ */
arch/arm/mach-pxa/magician.c +4 -4
index bf0760e..b645288 100644
@@ -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[] = {
Signature · 1 line
1.7.12.1
#28 lore raw

Re: [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:

Quoted 15 lines

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

Quoted 5 lines

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

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

author
#29 lore raw

Re: [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs

Dne 3.10.2015 v 14:38 Philipp Zabel napsal(a):

Quoted 20 lines

Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:

Quoted 19 lines

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.

Quoted 7 lines
Quoted 1 line

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.

Quoted 2 lines

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

author
#30 lore raw

PATCH v4 13/26 ARM: pxa: magician: Fix and add charging detection functions

In reply to a message not in the archive

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

---
 arch/arm/mach-pxa/magician.c | 57 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 50 insertions(+), 7 deletions(-)
arch/arm/mach-pxa/magician.c +50 -7
index b645288..906df6d 100644
@@ -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),
Signature · 1 line
1.7.12.1
author
#31 lore raw

PATCH v4 14/26 ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers

In reply to a message not in the archive

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.

---
 arch/arm/mach-pxa/magician.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/magician.c +11 -2
index 906df6d..86d395d 100644
@@ -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);
Signature · 1 line
1.7.12.1
Acked-by on v4 14/26
#32 lore raw

Re: [PATCH v4 14/26] ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers

Am Montag, den 28.09.2015, 23:33 +0200 schrieb Petr Cvek:

Quoted 29 lines

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.

---
 arch/arm/mach-pxa/magician.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach renamed from arch/arm/mach-pxa/magician.c +0 -1
-pxa/magician.c

index 906df6d..86d395d 100644

arch/arm/mach-pxa/magician.c static struct platform_device strataflash = { · line 821

Quoted 5 lines
arch/arm/mach-pxa/magician.c +1 -1
@@ -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,

regards
Philipp

author
#33 lore raw

PATCH v4 15/26 ARM: pxa: magician: Fix redundant GPIO request for pxaficp_ir

In reply to a message not in the archive

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

---
 arch/arm/mach-pxa/magician.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-pxa/magician.c +1 -1
index 86d395d..91b5ed0 100644
@@ -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)
Signature · 1 line
1.7.12.1
author
#34 lore raw

PATCH v4 16/26 ARM: pxa: magician: Fix support for Intel Strata NOR Flash

In reply to a message not in the archive

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.

---
 arch/arm/mach-pxa/magician.c | 45 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
arch/arm/mach-pxa/magician.c +45 -0
index 91b5ed0..8e8b122 100644
@@ -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 = {
Signature · 1 line
1.7.12.1
author
#35 lore raw

PATCH v4 17/26 ARM: pxa: magician: Fix wrongly enabled USB host ports

In reply to a message not in the archive

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).

---
 arch/arm/mach-pxa/magician.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-pxa/magician.c +3 -1
index 8e8b122..af8133a 100644
@@ -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,
 };
 
 /*
Signature · 1 line
1.7.12.1
#36 lore raw

Re: [PATCH v4 17/26] ARM: pxa: magician: Fix wrongly enabled USB host ports

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:

Quoted 25 lines

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).

---
 arch/arm/mach-pxa/magician.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach renamed from arch/arm/mach-pxa/magician.c +0 -1
-pxa/magician.c

index 8e8b122..af8133a 100644

arch/arm/mach-pxa/magician.c +3 -1
@@ -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,
Quoted 1 line

};

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

author
#37 lore raw

Re: [PATCH v4 17/26] ARM: pxa: magician: Fix wrongly enabled USB host ports

Dne 3.10.2015 v 14:45 Philipp Zabel napsal(a):

Quoted 17 lines

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:

Quoted 16 lines

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).

---
 arch/arm/mach-pxa/magician.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach renamed from arch/arm/mach-pxa/magician.c +0 -1
-pxa/magician.c

index 8e8b122..af8133a 100644

arch/arm/mach-pxa/magician.c +0 -0
@@ -780,8 +780,10 @@ static struct pxamci_platform_data
 magician_mci_info = {
 
Quoted 14 lines
Quoted 10 lines
arch/arm/mach-pxa/magician.c +3 -1
 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.

Quoted 4 lines

regards
Philipp

Petr

author
#38 lore raw

PATCH v4 18/26 ARM: pxa: magician: Add support for ADS7846

In reply to a message not in the archive

Add support for an ADS7846 touchscreen.

---
 arch/arm/mach-pxa/magician.c | 86 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
arch/arm/mach-pxa/magician.c +86 -0
index af8133a..450f35f 100644
@@ -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")
Signature · 1 line
1.7.12.1
#39 lore raw

Re: [PATCH v4 18/26] ARM: pxa: magician: Add support for ADS7846

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:

Quoted 1 line

Add support for an ADS7846 touchscreen.

It's actually a TSC2045.

Quoted 41 lines
---
 arch/arm/mach-pxa/magician.c | 86
++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
arch/arm/mach renamed from arch/arm/mach-pxa/magician.c +0 -1
-pxa/magician.c

index af8133a..450f35f 100644

arch/arm/mach-pxa/magician.c +12 -0
@@ -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 = {

arch/arm/mach-pxa/magician.c static struct platform_device bq24022 = { · line 772

Quoted 10 lines
arch/arm/mach-pxa/magician.c +10 -0
+	.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.

Quoted 54 lines
arch/arm/mach-pxa/magician.c +24 -0
+	.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 */

arch/arm/mach-pxa/magician.c +2 -0
+	.y_plate_ohms		= 180,
+	.pressure_max		= 255,	/* up to 12bit

sampling */

arch/arm/mach-pxa/magician.c +5 -0
+	.debounce_max		= 10,
+	.debounce_tol		= 3,
+	.debounce_rep		= 1,
+	.gpio_pendown		= GPIO115_MAGICIAN_nPEN_IRQ,
+	.keep_vref_on		= 1,	/* FIXME, external

Vref? */

arch/arm/mach-pxa/magician.c +2 -0
+	.vref_delay_usecs	= 100,
+	/* .wait_for_sync, GPIO77_LCD_BIAS low noise measure,

latency! */

arch/arm/mach-pxa/magician.c +9 -0
+};
+
+struct pxa2xx_spi_chip tsc2046_chip_info = {
+	.tx_threshold	= 1,
+	.rx_threshold	= 2,
+	.timeout	= 64,
+	.gpio_cs	= -1,
+};
+

arch/arm/mach-pxa/magician.c static struct i2c_pxa_platform_data magician_i2c_power_info = { · line 955

Quoted 10 lines
arch/arm/mach-pxa/magician.c +10 -0
+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.

Quoted 30 lines
arch/arm/mach-pxa/magician.c +8 -0
+		.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,
arch/arm/mach-pxa/magician.c +4 -0
 	&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));
+
 }
 
Quoted 1 line

MACHINE_START(MAGICIAN, "HTC Magician")

regards
Philipp

author
#40 lore raw

Re: [PATCH v4 18/26] ARM: pxa: magician: Add support for ADS7846

Dne 3.10.2015 v 14:49 Philipp Zabel napsal(a):

Quoted 4 lines

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:

Quoted 1 line

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).

Quoted 113 lines
Quoted 42 lines
---
 arch/arm/mach-pxa/magician.c | 86
++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
arch/arm/mach renamed from arch/arm/mach-pxa/magician.c +0 -1
-pxa/magician.c

index af8133a..450f35f 100644

arch/arm/mach-pxa/magician.c +12 -0
@@ -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 = {

arch/arm/mach-pxa/magician.c static struct platform_device bq24022 = { · line 772

Quoted 10 lines
arch/arm/mach-pxa/magician.c +10 -0
+	.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.

Quoted 58 lines
arch/arm/mach-pxa/magician.c +24 -0
+	.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 */

arch/arm/mach-pxa/magician.c +2 -0
+	.y_plate_ohms		= 180,
+	.pressure_max		= 255,	/* up to 12bit

sampling */

arch/arm/mach-pxa/magician.c +5 -0
+	.debounce_max		= 10,
+	.debounce_tol		= 3,
+	.debounce_rep		= 1,
+	.gpio_pendown		= GPIO115_MAGICIAN_nPEN_IRQ,
+	.keep_vref_on		= 1,	/* FIXME, external

Vref? */

arch/arm/mach-pxa/magician.c +2 -0
+	.vref_delay_usecs	= 100,
+	/* .wait_for_sync, GPIO77_LCD_BIAS low noise measure,

latency! */

arch/arm/mach-pxa/magician.c +13 -0
+};
+
+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,
+};
Quoted 8 lines

arch/arm/mach-pxa/magician.c static struct i2c_pxa_platform_data magician_i2c_power_info = { · line 955

Quoted 6 lines
arch/arm/mach-pxa/magician.c +6 -0
+
+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?

Quoted 31 lines
Quoted 31 lines
arch/arm/mach-pxa/magician.c +8 -0
+		.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,
arch/arm/mach-pxa/magician.c +4 -0
 	&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));
+
 }
 
Quoted 5 lines
Quoted 1 line

MACHINE_START(MAGICIAN, "HTC Magician")

regards
Philipp

Petr

author
#41 lore raw

PATCH v4 19/26 ARM: pxa: magician: Add support for Omnivision OV9640 camera

In reply to a message not in the archive

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

---
 arch/arm/mach-pxa/magician.c | 61 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
arch/arm/mach-pxa/magician.c +61 -0
index 450f35f..d844b9c 100644
@@ -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")
Signature · 1 line
1.7.12.1
#42 lore raw

Re: [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:

Quoted 4 lines

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

Still untested, but looks good to me.

regards
Philipp

maintainer
#43 lore raw

Re: [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera

Quoted 7 lines · Philipp Zabel

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:

Quoted 4 lines

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

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.

Signature · 1 line
Robert
author
#44 lore raw

Re: [PATCH v4 19/26] ARM: pxa: magician: Add support for Omnivision OV9640 camera

Dne 7.10.2015 v 21:49 Robert Jarzmik napsal(a):

Quoted 6 lines
Quoted 4 lines · Philipp Zabel

Am Montag, den 28.09.2015, 23:38 +0200 schrieb Petr Cvek:

Quoted 3 lines

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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

author
#45 lore raw

PATCH v4 20/26 ARM: pxa: magician: Add support for MAX1587A Vcore regulator

In reply to a message not in the archive

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.

---
 arch/arm/mach-pxa/magician.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm/mach-pxa/magician.c +52 -0
index d844b9c..490d79f 100644
@@ -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);
 
Signature · 1 line
1.7.12.1
#46 lore raw

Re: [PATCH v4 20/26] ARM: pxa: magician: Add support for MAX1587A Vcore regulator

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:

Quoted 39 lines

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.

---
 arch/arm/mach-pxa/magician.c | 52
++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm/mach renamed from arch/arm/mach-pxa/magician.c +0 -1
-pxa/magician.c

index d844b9c..490d79f 100644

arch/arm/mach-pxa/magician.c +5 -0
@@ -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
+ */
+

arch/arm/mach-pxa/magician.c static struct platform_device vads7846_device = · line 805

Quoted 10 lines
arch/arm/mach-pxa/magician.c +9 -0
+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

maintainer
#47 lore raw

Re: [PATCH v4 20/26] ARM: pxa: magician: Add support for MAX1587A Vcore regulator

Quoted 7 lines · Philipp Zabel

arch/arm/mach-pxa/magician.c static struct platform_device vads7846_device = { · line 803

Quoted 5 lines
arch/arm/mach-pxa/magician.c +5 -0
+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.

Signature · 1 line
Robert
author
#48 lore raw

PATCH v4 21/26 ARM: pxa: magician: Add support for PXA27x UDC

In reply to a message not in the archive

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

---
 arch/arm/mach-pxa/magician.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/mach-pxa/magician.c +22 -0
index 490d79f..331dfd1 100644
@@ -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);
Signature · 1 line
1.7.12.1
Acked-by on v4 21/26
#49 lore raw

Re: [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:

Quoted 25 lines

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

---
 arch/arm/mach-pxa/magician.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/mach renamed from arch/arm/mach-pxa/magician.c +0 -1
-pxa/magician.c

index 490d79f..331dfd1 100644

arch/arm/mach-pxa/magician.c +4 -0
@@ -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"
 

arch/arm/mach-pxa/magician.c static struct platform_device pasic3 = { · line 587

Quoted 2 lines
arch/arm/mach-pxa/magician.c +0 -0
@@ -582,6 +586,23 @@ static struct platform_device pasic3 = {
  * PXA UDC
  */

This comment should be part of this patch.

Quoted 7 lines
arch/arm/mach-pxa/magician.c +7 -0
+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);
+}

arch/arm/mach-pxa/magician.c static struct platform_device pasic3 = { · line 605

Quoted 10 lines
arch/arm/mach-pxa/magician.c +10 -0
+
+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,

regards
Philipp

author
#51 lore raw

PATCH v4 22/26 ARM: pxa: magician: Remove pdata for pasic3-leds

In reply to a message not in the archive

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.

---
 arch/arm/mach-pxa/magician.c | 44 ++------------------------------------------
 1 file changed, 2 insertions(+), 42 deletions(-)
arch/arm/mach-pxa/magician.c +2 -42
index 331dfd1..8a90b90 100644
@@ -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 = {
Signature · 1 line
1.7.12.1
Acked-by on v4 22/26
#52 lore raw

Re: [PATCH v4 22/26] ARM: pxa: magician: Remove pdata for pasic3-leds

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:

Quoted 10 lines

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.

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

regards
Philipp

maintainer Applied
#53 lore raw

Re: [PATCH v4 22/26] ARM: pxa: magician: Remove pdata for pasic3-leds

Quoted 10 lines · Philipp Zabel

Am Montag, den 28.09.2015, 23:39 +0200 schrieb Petr Cvek:

Quoted 9 lines

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.

Quoted 6 lines
Quoted 1 line

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

Queued into pxa/for-next, thanks.

Cheers.

Signature · 1 line
Robert
author
#54 lore raw

PATCH v4 23/26 ARM: pxa: magician: Remove definition of the STUART port

In reply to a message not in the archive

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.

---
 arch/arm/mach-pxa/magician.c | 1 -
 1 file changed, 1 deletion(-)
arch/arm/mach-pxa/magician.c +0 -1
index 8a90b90..c89f2a8 100644
@@ -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));
 
Signature · 1 line
1.7.12.1
author
#55 lore raw

PATCH v4 24/26 ARM: pxa: magician: Add debug message for backlight brightness function

In reply to a message not in the archive

Add a debug message for the backlight brightness function.

---
 arch/arm/mach-pxa/magician.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-pxa/magician.c +1 -0
index c89f2a8..5de33c6 100644
@@ -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);
Signature · 1 line
1.7.12.1
author
#56 lore raw

PATCH v4 25/26 ARM: pxa: magician: Add missing regulator for PWM backlight

In reply to a message not in the archive

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

---
 arch/arm/mach-pxa/magician.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/mach-pxa/magician.c +12 -0
index 5de33c6..8d3946d 100644
@@ -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")
Signature · 1 line
1.7.12.1
Acked-by on v4 25/26
#57 lore raw

Re: [PATCH v4 25/26] ARM: pxa: magician: Add missing regulator for PWM backlight

Am Montag, den 28.09.2015, 23:40 +0200 schrieb Petr Cvek:

Quoted 3 lines

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.

Quoted 1 line

regards
Philipp

author
#58 lore raw

PATCH v4 26/26 ARM: pxa: magician: Move platform_add_devices() to the end of magician_init()

In reply to a message not in the archive

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).

---
 arch/arm/mach-pxa/magician.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/magician.c +2 -2
index 8d3946d..3aba1c4 100644
@@ -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")
Signature · 1 line
1.7.12.1
Acked-by on v4 26/26
#59 lore raw

Re: [PATCH v4 26/26] ARM: pxa: magician: Move platform_add_devices() to the end of magician_init()

Am Montag, den 28.09.2015, 23:42 +0200 schrieb Petr Cvek:

Quoted 9 lines

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).