Skip to contentSkip to conversation

ARM: pxa: magician: Fix indentation in machine files

PATCH Superseded Petr Cvek 2 participants 50 messages Sep 17, 2015 – Sep 26, 2015 1 message not in the archive

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

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 v3 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 |  62 ++---
 arch/arm/mach-pxa/magician.c              | 368 +++++++++++++++---------------
 2 files changed, 215 insertions(+), 215 deletions(-)
arch/arm/mach-pxa/include/mach/magician.h +31 -31
index ba6a6e1..a88f551 100644
@@ -21,10 +21,10 @@
 
 #define GPIO0_MAGICIAN_KEY_POWER		0
 #define GPIO9_MAGICIAN_UNKNOWN			9
-#define GPIO10_MAGICIAN_GSM_IRQ			10
+#define GPIO10_MAGICIAN_GSM_IRQ		10
 #define GPIO11_MAGICIAN_GSM_OUT1		11
 #define GPIO13_MAGICIAN_CPLD_IRQ		13
-#define GPIO18_MAGICIAN_UNKNOWN			18
+#define GPIO18_MAGICIAN_UNKNOWN		18
 #define GPIO22_MAGICIAN_VIBRA_EN		22
 #define GPIO26_MAGICIAN_GSM_POWER		26
 #define GPIO27_MAGICIAN_USBC_PUEN		27
@@ -32,8 +32,8 @@
 #define GPIO37_MAGICIAN_KEY_HANGUP		37
 #define GPIO38_MAGICIAN_KEY_CONTACTS		38
 #define GPIO40_MAGICIAN_GSM_OUT2		40
-#define GPIO48_MAGICIAN_UNKNOWN			48
-#define GPIO56_MAGICIAN_UNKNOWN			56
+#define GPIO48_MAGICIAN_UNKNOWN		48
+#define GPIO56_MAGICIAN_UNKNOWN		56
 #define GPIO57_MAGICIAN_CAM_RESET		57
 #define GPIO75_MAGICIAN_SAMSUNG_POWER		75
 #define GPIO83_MAGICIAN_nIR_EN			83
@@ -51,7 +51,7 @@
 #define GPIO100_MAGICIAN_KEY_VOL_UP		100
 #define GPIO101_MAGICIAN_KEY_VOL_DOWN 		101
 #define GPIO102_MAGICIAN_KEY_PHONE		102
-#define GPIO103_MAGICIAN_LED_KP			103
+#define GPIO103_MAGICIAN_LED_KP		103
 #define GPIO104_MAGICIAN_LCD_POWER_1 		104
 #define GPIO105_MAGICIAN_LCD_POWER_2		105
 #define GPIO106_MAGICIAN_LCD_POWER_3		106
@@ -84,37 +84,37 @@
 
 /* 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
maintainer
#2 lore raw

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

Quoted 13 lines · Petr Cvek

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

---
 arch/arm/mach-pxa/include/mach/magician.h |  62 ++---
 arch/arm/mach-pxa/magician.c              | 368 +++++++++++++++---------------
 2 files changed, 215 insertions(+), 215 deletions(-)
arch/arm/mach-pxa/include/mach/magician.h +0 -0
index ba6a6e1..a88f551 100644

arch/arm/mach-pxa/include/mach/magician.h line 24

Quoted 5 lines
arch/arm/mach-pxa/include/mach/magician.h +1 -1
@@ -21,10 +21,10 @@
 
 #define GPIO0_MAGICIAN_KEY_POWER		0
 #define GPIO9_MAGICIAN_UNKNOWN			9
-#define GPIO10_MAGICIAN_GSM_IRQ			10
+#define GPIO10_MAGICIAN_GSM_IRQ		10

I think your editor deserves a bit of configuration. Have a look at this file with "less .../magician.h". Give that the tab after the ".._IRQ" begins at column 31 (column 0 being the first), the first tab goes to column 32, the second to 40. All other numbers are at column 48.

Ditto for the next lines.

Quoted 11 lines
arch/arm/mach-pxa/include/mach/magician.h +0 -10
-#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)

arch/arm/mach-pxa/include/mach/magician.h line 92

Quoted 10 lines
arch/arm/mach-pxa/include/mach/magician.h +6 -4
-#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)

Here same problem for xxx_EP_POWER.

arch/arm/mach-pxa/include/mach/magician.h line 98

Quoted 6 lines
arch/arm/mach-pxa/include/mach/magician.h +6 -0
+#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)

Ditto.

Quoted 1 line

+#define EGPIO_MAGICIAN_SD_POWER MAGICIAN_EGPIO(2, 0)

Ditto.

arch/arm/mach-pxa/magician.c

Quoted 5 lines
arch/arm/mach-pxa/magician.c +0 -0

index a9761c2..c10f932 100644

arch/arm/mach-pxa/magician.c +0 -0

Same remark, check your favorite editor first please.

Cheers.

--
Robert

author
#3 lore raw

PATCH v3 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
maintainer
#4 lore raw

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

Quoted 4 lines · Petr Cvek

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

Ok, this one seems to have all Philipp's comments addressed if I'm not mistaken. Let's give Philipp one week to ack, and I'll queue it (with an ack or with no answer).

Cheers.

--
Robert

author
#5 lore raw

PATCH v3 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
maintainer
#6 lore raw

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

Quoted 3 lines · Petr Cvek

Print more specific error message for global GPIOs.

Waiting for one week for Philipp's ack, then queuing it. Will send a mail once queued.

Cheers.

--
Robert

author
#7 lore raw

PATCH v3 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
maintainer
#8 lore raw

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

Quoted 1 line · Petr Cvek

Optimize the debug messages for the LCD power.

Waiting for a week for Philipp's ack, then queing it.

Cheers.

--
Robert

author
#9 lore raw

PATCH v3 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
maintainer
#10 lore raw

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

Quoted 2 lines · Petr Cvek

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

Waiting for a week for Philipp's ack, then queing it.

Cheers.

--
Robert

author
#11 lore raw

PATCH v3 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 a88f551..88da10e 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
maintainer
#12 lore raw

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

Quoted 2 lines · Petr Cvek

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

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#13 lore raw

PATCH v3 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
maintainer
#14 lore raw

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

Quoted 5 lines · 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.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#15 lore raw

PATCH v3 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 88da10e..f0e08f8 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
maintainer
#16 lore raw

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

Quoted 5 lines · 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.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#17 lore raw

PATCH v3 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
maintainer
#18 lore raw

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

Quoted 4 lines · Petr Cvek

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

Waiting for a week for Philipp's ack and queuing it after. An ack on this one would be warmly welcome Philipp, as I have no way to judge if these timings fit the board you're using as well.

Cheers.

--
Robert

author
#19 lore raw

PATCH v3 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
maintainer
#20 lore raw

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

Quoted 4 lines · 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%.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#21 lore raw

PATCH v3 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
maintainer
#22 lore raw

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

Quoted 7 lines · 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.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#23 lore raw

PATCH v3 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 f0e08f8..41371ca 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
maintainer
#24 lore raw

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

Quoted 10 lines · 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:

Quoted 8 lines

- AC/USB type
- Cable detection1
- Cable detection2

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

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#25 lore raw

PATCH v3 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
maintainer
#26 lore raw

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

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

Quoted 10 lines · Petr Cvek

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 +4 -0
+static int magician_is_usb_online(void)
+{
+	return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
+		(!gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE)); /* USB=0 */

No need to the extra parenthesis, just :

Review

Quoted 2 lines
(quoted diff) +2 -0
+	return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
+		!gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE); /* USB=0 */

As the remaining looks sgood to me, I'll wait for a week for Philipp's ack and queuing it after with this parenthesis thing fixed, won't cost me much.

Cheers.

--
Robert

author
#27 lore raw

PATCH v3 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
maintainer
#28 lore raw

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

Quoted 10 lines · 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

Quoted 6 lines

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.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#29 lore raw

PATCH v3 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
maintainer
#30 lore raw

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

Quoted 4 lines · Petr Cvek

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

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#31 lore raw

PATCH v3 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
maintainer
#32 lore raw

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

Quoted 8 lines · Petr Cvek

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.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#33 lore raw

PATCH v3 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
maintainer
#34 lore raw

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

Quoted 4 lines · 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).

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#35 lore raw

PATCH v3 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
maintainer
#36 lore raw

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

Quoted 3 lines · Petr Cvek

Add support for an ADS7846 touchscreen.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#37 lore raw

PATCH v3 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
author
#38 lore raw

PATCH v3 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
maintainer
#39 lore raw

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

Quoted 10 lines · 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.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#40 lore raw

PATCH v3 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..76f8399 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
maintainer
#41 lore raw

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

Quoted 3 lines · Petr Cvek

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

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#42 lore raw

PATCH v3 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 76f8399..a588fbc 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
author
#43 lore raw

PATCH v3 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 a588fbc..386e6f0 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
maintainer
#44 lore raw

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

Quoted 7 lines · Petr Cvek

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.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#45 lore raw

PATCH v3 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 386e6f0..67969b1 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
maintainer
#46 lore raw

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

Quoted 3 lines · Petr Cvek

Add a debug message for the backlight brightness function.

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#47 lore raw

PATCH v3 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 67969b1..c43e587 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
maintainer
#48 lore raw

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

Quoted 4 lines · Petr Cvek

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

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert

author
#49 lore raw

PATCH v3 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 c43e587..4ac1d55 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
maintainer
#50 lore raw

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

Quoted 6 lines · 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).

Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert