From: Petr Cvek <petr.cvek@tul.cz>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: philipp.zabel@gmail.com, daniel@zonque.org,
haojian.zhuang@gmail.com, sameo@linux.intel.com,
lee.jones@linaro.org, cooloney@gmail.com, rpurdie@rpsys.net,
j.anaszewski@samsung.com, linux@arm.linux.org.uk, sre@kernel.org,
dbaryshkov@gmail.com, dwmw2@infradead.org,
linux-leds@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 04/21] ARM: pxa: magician: Add, fix and init (new) GPIOs
Date: Wed, 19 Aug 2015 00:46:25 +0200 [thread overview]
Message-ID: <55D3B5C1.2070806@tul.cz> (raw)
In-Reply-To: <87mvxo8lqi.fsf@belgarion.home>
Dne 18.8.2015 v 21:01 Robert Jarzmik napsal(a):
>
> From here onward, I'll suppose you'll catch all whitespace/indentation changes
> and extract them towards patch 01/21 ...
OK
>
>> /* input */
>>
>> -#define EGPIO_MAGICIAN_CABLE_STATE_AC MAGICIAN_EGPIO(4, 0)
>> -#define EGPIO_MAGICIAN_CABLE_STATE_USB MAGICIAN_EGPIO(4, 1)
>> +/* AC=1, USB=0 */
>> +#define EGPIO_MAGICIAN_CABLE_TYPE MAGICIAN_EGPIO(4, 0)
>> +/* =1 when AC or USB cable inserted */
>> +#define EGPIO_MAGICIAN_CABLE_INSERT1 MAGICIAN_EGPIO(4, 1)
> The naming makes me uneasy : it's rather vague "cable insert".
> If AC and USB are the only charging methods, why not have something like
> "EGPIO_MAGICIAN_POWERED" or the like ?
I don't see why not, but there are two GPIOs and it may turn out they have different function. I found it only for power/usb cable insertion. For example they may differ when usb device is connected (magician is now a host) but I did not test it (yet, phone does not generate vbus power).
>
>> 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,
> Okay so that are no I2C devices on magician ? Why keep GPIO119_MAGICIAN_I2C_* at
> the beginning of the file then ?
It is a duplicite definition.
http://lxr.free-electrons.com/source/arch/arm/mach-pxa/magician.c#L60
and in the same array again at:
http://lxr.free-electrons.com/source/arch/arm/mach-pxa/magician.c#L118
>
>> + MFP_CFG_OUT(GPIO40, AF0, DRIVE_LOW), /* FIXME GSM? */
>> + MFP_CFG_OUT(GPIO87, AF0, DRIVE_LOW), /* FIXME GSM? */
>> +
>> + /* Left GPIOs (undefined here):
>> + * 18, 49 : bootloader=VLIO?, WinM=TODO
>> + * 48 : AF0/out0
>> + * 56 : AF0/out0
>> + * 74 : bootloader=AF0/output
>> + * 86 : bootloader=AF0/input (but should be gsm reset???)
>> + * 114 : AF0/out0
>> + * 119 : AF0/out0
>> + * 120 : AF0/out
>> + * 1 : dedicated reset, AF0/output
>> + * 13 : cpld irq, output (??)
>> + */
> This is not describing current code. This doesn't belong to this file, even if I
> know how frustrating it is to reverse engineer all these gpios. I created a wiki
> web page will all GPIOs to let go my frustration in the past :)
OK I can create file in Documentation for that (at least one pin has a different direction in kernel vs bootloader).
BTW on xda wiki?
>
>> @@ -241,8 +324,9 @@ static struct htc_egpio_chip egpio_chips[] = {
>>
>> /*
>> * Depends on modules configuration
>> + * Things like MMC and LCD should be enabled
>> */
>> - .initial_values = 0x40,
>> + .initial_values = 0x21a0c0,
> Aren't they enabled by each driver upon its probe() ? What if MMC nor LCD is
> compiled in the kernel ?
>
Some of it is from time kernel did not get to rootfs detection: 0x8000 for to be able to read panic errors (before a backlight driver is loaded - which is BTW not working now in vanilla). 0x80 should be for a valid LCD power sequence (broken one causes invalid voltages on LCD power lines). 0x2000 is RESET for soundcard as original 0x40 is for GSM. MMC can be probably changed to "0" now when everything is working. 0x200000 as 500mA charging should be enabled (for safety) as sometimes boot on weak accu can cause overcurrent, which will hardreset the phone.
>> @@ -343,21 +427,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);
>> - gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1);
>> - mdelay(10);
>> - gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1);
>> - mdelay(30);
>> - gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
>> - mdelay(10);
>> + mdelay(6);
>> + gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
>> + mdelay(6); /* Avdd -> Voff >5ms */
>> + gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
>> + mdelay(16); /* Voff -> Von >(5+10)ms */
>> + gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
>> } else {
>> - mdelay(10);
>> - gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
>> - mdelay(30);
>> - gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0);
>> - mdelay(10);
>> - gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0);
>> - mdelay(10);
>> + gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
>> + mdelay(16);
>> + gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
>> + mdelay(6);
>> + gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
>> + mdelay(6);
> You're changing the timings here, right ? This should be an appart patch. What
> is the reason of the change by the way ?
Faster reaction, one change from msleep to mdelay (in toppoly LCD) and reading a datasheet for a valid sequence.
>
> Cheers.
>
Best regards,
Petr
WARNING: multiple messages have this Message-ID (diff)
From: petr.cvek@tul.cz (Petr Cvek)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 04/21] ARM: pxa: magician: Add, fix and init (new) GPIOs
Date: Wed, 19 Aug 2015 00:46:25 +0200 [thread overview]
Message-ID: <55D3B5C1.2070806@tul.cz> (raw)
In-Reply-To: <87mvxo8lqi.fsf@belgarion.home>
Dne 18.8.2015 v 21:01 Robert Jarzmik napsal(a):
>
> From here onward, I'll suppose you'll catch all whitespace/indentation changes
> and extract them towards patch 01/21 ...
OK
>
>> /* input */
>>
>> -#define EGPIO_MAGICIAN_CABLE_STATE_AC MAGICIAN_EGPIO(4, 0)
>> -#define EGPIO_MAGICIAN_CABLE_STATE_USB MAGICIAN_EGPIO(4, 1)
>> +/* AC=1, USB=0 */
>> +#define EGPIO_MAGICIAN_CABLE_TYPE MAGICIAN_EGPIO(4, 0)
>> +/* =1 when AC or USB cable inserted */
>> +#define EGPIO_MAGICIAN_CABLE_INSERT1 MAGICIAN_EGPIO(4, 1)
> The naming makes me uneasy : it's rather vague "cable insert".
> If AC and USB are the only charging methods, why not have something like
> "EGPIO_MAGICIAN_POWERED" or the like ?
I don't see why not, but there are two GPIOs and it may turn out they have different function. I found it only for power/usb cable insertion. For example they may differ when usb device is connected (magician is now a host) but I did not test it (yet, phone does not generate vbus power).
>
>> 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,
> Okay so that are no I2C devices on magician ? Why keep GPIO119_MAGICIAN_I2C_* at
> the beginning of the file then ?
It is a duplicite definition.
http://lxr.free-electrons.com/source/arch/arm/mach-pxa/magician.c#L60
and in the same array again at:
http://lxr.free-electrons.com/source/arch/arm/mach-pxa/magician.c#L118
>
>> + MFP_CFG_OUT(GPIO40, AF0, DRIVE_LOW), /* FIXME GSM? */
>> + MFP_CFG_OUT(GPIO87, AF0, DRIVE_LOW), /* FIXME GSM? */
>> +
>> + /* Left GPIOs (undefined here):
>> + * 18, 49 : bootloader=VLIO?, WinM=TODO
>> + * 48 : AF0/out0
>> + * 56 : AF0/out0
>> + * 74 : bootloader=AF0/output
>> + * 86 : bootloader=AF0/input (but should be gsm reset???)
>> + * 114 : AF0/out0
>> + * 119 : AF0/out0
>> + * 120 : AF0/out
>> + * 1 : dedicated reset, AF0/output
>> + * 13 : cpld irq, output (??)
>> + */
> This is not describing current code. This doesn't belong to this file, even if I
> know how frustrating it is to reverse engineer all these gpios. I created a wiki
> web page will all GPIOs to let go my frustration in the past :)
OK I can create file in Documentation for that (at least one pin has a different direction in kernel vs bootloader).
BTW on xda wiki?
>
>> @@ -241,8 +324,9 @@ static struct htc_egpio_chip egpio_chips[] = {
>>
>> /*
>> * Depends on modules configuration
>> + * Things like MMC and LCD should be enabled
>> */
>> - .initial_values = 0x40,
>> + .initial_values = 0x21a0c0,
> Aren't they enabled by each driver upon its probe() ? What if MMC nor LCD is
> compiled in the kernel ?
>
Some of it is from time kernel did not get to rootfs detection: 0x8000 for to be able to read panic errors (before a backlight driver is loaded - which is BTW not working now in vanilla). 0x80 should be for a valid LCD power sequence (broken one causes invalid voltages on LCD power lines). 0x2000 is RESET for soundcard as original 0x40 is for GSM. MMC can be probably changed to "0" now when everything is working. 0x200000 as 500mA charging should be enabled (for safety) as sometimes boot on weak accu can cause overcurrent, which will hardreset the phone.
>> @@ -343,21 +427,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);
>> - gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1);
>> - mdelay(10);
>> - gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1);
>> - mdelay(30);
>> - gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1);
>> - mdelay(10);
>> + mdelay(6);
>> + gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
>> + mdelay(6); /* Avdd -> Voff >5ms */
>> + gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
>> + mdelay(16); /* Voff -> Von >(5+10)ms */
>> + gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
>> } else {
>> - mdelay(10);
>> - gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0);
>> - mdelay(30);
>> - gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0);
>> - mdelay(10);
>> - gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0);
>> - mdelay(10);
>> + gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
>> + mdelay(16);
>> + gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
>> + mdelay(6);
>> + gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
>> + mdelay(6);
> You're changing the timings here, right ? This should be an appart patch. What
> is the reason of the change by the way ?
Faster reaction, one change from msleep to mdelay (in toppoly LCD) and reading a datasheet for a valid sequence.
>
> Cheers.
>
Best regards,
Petr
next prev parent reply other threads:[~2015-08-18 22:46 UTC|newest]
Thread overview: 135+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1439843482.git.petr.cvek@tul.cz>
2015-08-17 21:56 ` [PATCH v2 01/21] ARM: pxa: magician: Fix Kconfig for magician to always include htc-egpio Petr Cvek
2015-08-17 21:56 ` Petr Cvek
2015-08-18 18:31 ` Robert Jarzmik
2015-08-18 18:31 ` Robert Jarzmik
2015-08-18 20:02 ` Petr Cvek
2015-08-18 20:02 ` Petr Cvek
2015-08-19 7:29 ` Philipp Zabel
2015-08-19 7:29 ` Philipp Zabel
2015-08-24 3:39 ` Petr Cvek
2015-08-24 3:39 ` Petr Cvek
2015-08-17 21:56 ` [PATCH v2 02/21] ARM: pxa: magician: Fix indentation and whitespaces Petr Cvek
2015-08-17 21:56 ` Petr Cvek
2015-08-18 18:32 ` Robert Jarzmik
2015-08-18 18:32 ` Robert Jarzmik
2015-08-19 7:42 ` Philipp Zabel
2015-08-19 7:42 ` Philipp Zabel
2015-08-17 21:57 ` [PATCH v2 03/21] ARM: pxa: magician: Fix comments, debug functions and print strings Petr Cvek
2015-08-17 21:57 ` Petr Cvek
2015-08-18 18:39 ` Robert Jarzmik
2015-08-18 18:39 ` Robert Jarzmik
2015-08-18 23:09 ` Petr Cvek
2015-08-18 23:09 ` Petr Cvek
2015-08-19 7:57 ` Philipp Zabel
2015-08-19 7:57 ` Philipp Zabel
2015-08-17 21:58 ` [PATCH v2 04/21] ARM: pxa: magician: Add, fix and init (new) GPIOs Petr Cvek
2015-08-17 21:58 ` Petr Cvek
2015-08-18 19:01 ` Robert Jarzmik
2015-08-18 19:01 ` Robert Jarzmik
2015-08-18 22:46 ` Petr Cvek [this message]
2015-08-18 22:46 ` Petr Cvek
2015-08-17 21:58 ` [PATCH v2 05/21] ARM: pxa: magician: Add support for ADS7846 touchscreen Petr Cvek
2015-08-17 21:58 ` Petr Cvek
2015-08-19 18:41 ` Robert Jarzmik
2015-08-19 18:41 ` Robert Jarzmik
2015-08-17 21:59 ` [PATCH v2 06/21] ARM: pxa: magician: Add normal and power I2C definition Petr Cvek
2015-08-17 21:59 ` Petr Cvek
2015-08-19 8:02 ` Philipp Zabel
2015-08-19 8:02 ` Philipp Zabel
2015-08-19 18:41 ` Robert Jarzmik
2015-08-19 18:41 ` Robert Jarzmik
2015-08-17 21:59 ` [PATCH v2 07/21] ARM: pxa: magician: Fix IrDA pdata and redundant GPIO request Petr Cvek
2015-08-17 21:59 ` Petr Cvek
2015-08-19 18:41 ` Robert Jarzmik
2015-08-19 18:41 ` Robert Jarzmik
2015-08-17 22:00 ` [PATCH v2 08/21] ARM: pxa: magician: Add StrataFlash Vpp GPIO and alternative driver Petr Cvek
2015-08-17 22:00 ` Petr Cvek
2015-08-17 22:01 ` [PATCH v2 09/21] ARM: pxa: magician: Add OV9640 camera support Petr Cvek
2015-08-17 22:01 ` Petr Cvek
2015-08-20 19:48 ` Robert Jarzmik
2015-08-20 19:48 ` Robert Jarzmik
2015-08-20 20:26 ` Arnd Bergmann
2015-08-20 20:26 ` Arnd Bergmann
2015-08-20 22:39 ` Petr Cvek
2015-08-20 22:39 ` Petr Cvek
2015-08-21 13:45 ` Arnd Bergmann
2015-08-21 13:45 ` Arnd Bergmann
2015-08-21 17:36 ` Robert Jarzmik
2015-08-21 22:09 ` Petr Cvek
2015-08-21 22:09 ` Petr Cvek
2015-08-22 12:41 ` Robert Jarzmik
2015-08-22 12:41 ` Robert Jarzmik
2015-08-24 6:53 ` Lee Jones
2015-08-24 6:53 ` Lee Jones
2015-08-17 22:01 ` [PATCH v2 10/21] ARM: pxa: magician: Add UDA1380 sound support Petr Cvek
2015-08-17 22:01 ` Petr Cvek
2015-08-20 19:51 ` Robert Jarzmik
2015-08-20 19:51 ` Robert Jarzmik
2015-08-20 23:01 ` Petr Cvek
2015-08-20 23:01 ` Petr Cvek
2015-08-28 8:48 ` Robert Jarzmik
2015-08-28 8:48 ` Robert Jarzmik
2015-08-17 22:01 ` [PATCH v2 11/21] ARM: pxa: magician: Add MAX1586 Vcore regulator support Petr Cvek
2015-08-17 22:01 ` Petr Cvek
2015-08-20 19:32 ` Robert Jarzmik
2015-08-20 19:32 ` Robert Jarzmik
2015-08-20 22:33 ` Petr Cvek
2015-08-20 22:33 ` Petr Cvek
2015-08-28 8:49 ` Robert Jarzmik
2015-08-28 8:49 ` Robert Jarzmik
2015-08-17 22:02 ` [PATCH v2 12/21] ARM: pxa: magician: Add PXA27x UDC support Petr Cvek
2015-08-17 22:02 ` Petr Cvek
2015-08-20 17:23 ` Robert Jarzmik
2015-08-20 17:23 ` Robert Jarzmik
2015-08-20 22:21 ` Petr Cvek
2015-08-20 22:21 ` Petr Cvek
2015-08-28 9:58 ` Robert Jarzmik
2015-08-28 9:58 ` Robert Jarzmik
2015-08-17 22:03 ` [PATCH v2 13/21] ARM: pxa: magician: Fix charging source and add NiCd backup charging Petr Cvek
2015-08-17 22:03 ` Petr Cvek
2015-08-17 22:18 ` Petr Cvek
2015-08-17 22:18 ` Petr Cvek
2015-08-17 22:03 ` [PATCH v2 14/21] ARM: pxa: magician: Fix PXA USB OHCI port enable flags Petr Cvek
2015-08-17 22:03 ` Petr Cvek
2015-08-17 22:03 ` [PATCH v2 15/21] ARM: pxa: magician: Fix PWM backlight regulator Petr Cvek
2015-08-17 22:03 ` Petr Cvek
2015-08-20 19:58 ` Robert Jarzmik
2015-08-20 19:58 ` Robert Jarzmik
2015-08-17 22:04 ` [PATCH v2 16/21] ARM: pxa: magician: Add support for alternative LCD backlight Petr Cvek
2015-08-17 22:04 ` Petr Cvek
2015-08-20 20:01 ` Robert Jarzmik
2015-08-20 20:01 ` Robert Jarzmik
2015-08-23 20:55 ` Petr Cvek
2015-08-23 20:55 ` Petr Cvek
2015-08-24 8:25 ` Robert Jarzmik
2015-08-24 8:25 ` Robert Jarzmik
2015-08-17 22:04 ` [PATCH v2 17/21] ARM: pxa: magician: Remove (temporarily) pasic3 LED support Petr Cvek
2015-08-17 22:04 ` Petr Cvek
2015-08-22 16:25 ` Robert Jarzmik
2015-08-22 16:25 ` Robert Jarzmik
2015-08-17 22:05 ` [PATCH v2 18/21] mfd: htc-pasic3: Prepare driver for leds-pasic3 Petr Cvek
2015-08-17 22:05 ` Petr Cvek
2015-08-18 6:52 ` Lee Jones
2015-08-18 6:52 ` Lee Jones
2015-08-18 21:01 ` Petr Cvek
2015-08-18 21:01 ` Petr Cvek
2015-08-19 6:58 ` Lee Jones
2015-08-19 6:58 ` Lee Jones
2015-08-17 22:06 ` [PATCH v2 19/21] leds: leds-pasic3: Add support for PASIC3 LED controller Petr Cvek
2015-08-17 22:06 ` Petr Cvek
2015-08-17 22:14 ` Petr Cvek
2015-08-17 22:14 ` Petr Cvek
2015-08-18 10:27 ` Jacek Anaszewski
2015-08-18 10:27 ` Jacek Anaszewski
2015-08-18 21:48 ` Petr Cvek
2015-08-18 21:48 ` Petr Cvek
2015-08-19 8:09 ` Philipp Zabel
2015-08-19 8:09 ` Philipp Zabel
2015-08-19 8:49 ` Jacek Anaszewski
2015-08-19 8:49 ` Jacek Anaszewski
2015-08-17 22:06 ` [PATCH v2 20/21] ARM: pxa: magician: Re-add pdata for new leds-pasic3 driver Petr Cvek
2015-08-17 22:06 ` Petr Cvek
2015-08-17 22:07 ` [PATCH v2 21/21] ARM: pxa: magician: Move platform_add_devices() to the end of magician_init() Petr Cvek
2015-08-17 22:07 ` Petr Cvek
2015-08-22 16:27 ` Robert Jarzmik
2015-08-22 16:27 ` Robert Jarzmik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55D3B5C1.2070806@tul.cz \
--to=petr.cvek@tul.cz \
--cc=cooloney@gmail.com \
--cc=daniel@zonque.org \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=haojian.zhuang@gmail.com \
--cc=j.anaszewski@samsung.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=philipp.zabel@gmail.com \
--cc=robert.jarzmik@free.fr \
--cc=rpurdie@rpsys.net \
--cc=sameo@linux.intel.com \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.