Re: [PATCH v3] moto-boot-usb: add help parameter

2012-01-09 Thread Antonio Ospite
On Mon, 9 Jan 2012 09:27:29 +0100
Stefan Schmidt ste...@datenfreihafen.org wrote:

 Hello.
 
 On Sat, 2012-01-07 at 19:25, Angelo S. Mavridis Bartolome wrote:
  From: Angelo S. Mavridis Bartolome barkl...@gmail.com
  
  ---
   src/moto-boot-usb.c |8 
   1 files changed, 8 insertions(+), 0 deletions(-)
  
  diff --git a/src/moto-boot-usb.c b/src/moto-boot-usb.c
  index 962a236..5af26a9 100644
  --- a/src/moto-boot-usb.c
  +++ b/src/moto-boot-usb.c
  @@ -626,6 +626,8 @@ static void usage()
   execute code at ram address\n
  moto-boot-usb setflag usb|dumpkeys|passthrough\t
   set memory flag for gen-blob\n
  +   moto-boot-usb help|--help\t\t\t
  +show this help screen\n
  moto-boot-usb off\t\t\t\t
   power off the phone\n\n);
   
  @@ -875,6 +877,12 @@ int main(int argc, char *argv[])
  error(Too few arguments.);
  exit(1);
  }
  +   
  +   if (!strcmp(argv[1], help) || !strcmp(argv[1], --help)) {
  +   usage();
  +   exit(0);
  +   }
 
 Thinks looks a lot better. Nice suggestion from Antonio to avoid the
 helpParam variable at all.
 
 Antonio, could you apply this? I don't have a moto-boot-usb tree on my
 disk anymore.
 

Sure I'll do that today.

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpPkeE5Xbkmq.pgp
Description: PGP signature


Re: [PATCH v3] moto-boot-usb: add help parameter

2012-01-09 Thread Antonio Ospite
On Sat,  7 Jan 2012 19:25:52 -0200
Angelo S. Mavridis Bartolome barkl...@gmail.com wrote:

 From: Angelo S. Mavridis Bartolome barkl...@gmail.com
 
 ---
  src/moto-boot-usb.c |8 
  1 files changed, 8 insertions(+), 0 deletions(-)


Pushed, in:
http://cgit.openezx.org/moto-boot-usb/commit/?id=42aedf88c6f9d9c09ccdbfe1742a39d94beae1d1

with some little changes:
 - stripped trailing and leading white spaces
 - adjusted the commit message to look like the other commit messages,
   (context and Signed-off-by line)
 - put the help message as the last one in the usage.

BTW Angelo, this was the preliminary change I was talking about in
the other message:
http://cgit.openezx.org/moto-boot-usb/commit/?id=e9ce08686e2ce21ccab021ed4b4f4dd6bec61f92

Thanks,
   Antonio
 
 diff --git a/src/moto-boot-usb.c b/src/moto-boot-usb.c
 index 962a236..5af26a9 100644
 --- a/src/moto-boot-usb.c
 +++ b/src/moto-boot-usb.c
 @@ -626,6 +626,8 @@ static void usage()
execute code at ram address\n
   moto-boot-usb setflag usb|dumpkeys|passthrough\t
set memory flag for gen-blob\n
 + moto-boot-usb help|--help\t\t\t
 +  show this help screen\n
   moto-boot-usb off\t\t\t\t
power off the phone\n\n);
  
 @@ -875,6 +877,12 @@ int main(int argc, char *argv[])
   error(Too few arguments.);
   exit(1);
   }
 + 
 + if (!strcmp(argv[1], help) || !strcmp(argv[1], --help)) {
 + usage();
 + exit(0);
 + }
 +
  
   ezx_device_open();
  
 -- 
 1.7.5.4
 
 
 


-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpmTO2CRcBMA.pgp
Description: PGP signature


Re: [PATCH v2] moto-boot-usb: add help parameter

2012-01-07 Thread Antonio Ospite
On Sat,  7 Jan 2012 13:00:35 -0200
Angelo S. Mavridis Bartolome barkl...@gmail.com wrote:

 From: Angelo S. Mavridis Bartolome barkl...@gmail.com
 
 ---
  src/moto-boot-usb.c |   23 ++-
  1 files changed, 18 insertions(+), 5 deletions(-)
 
 diff --git a/src/moto-boot-usb.c b/src/moto-boot-usb.c
 index 962a236..b389274 100644
 --- a/src/moto-boot-usb.c
 +++ b/src/moto-boot-usb.c
 @@ -28,6 +28,7 @@
  
  #include stdio.h
  #include stdlib.h
 +#include stdbool.h

I'd remove hparam altogether.

  #include unistd.h
  #include string.h
  #include getopt.h
 @@ -627,7 +628,9 @@ static void usage()
   moto-boot-usb setflag usb|dumpkeys|passthrough\t
set memory flag for gen-blob\n
   moto-boot-usb off\t\t\t\t
 -  power off the phone\n\n);
 +  power off the phone\n
 + moto-boot-usb help\t\t\t\t
 +  show this help screen\n\n);


Angelo you could add a preliminary patch to put the last \n in power
off the phone\n\n on a line by its own, and then add the message about
help|--help without the need to change the power off the phone\n
line. Commits are cheap, in a good way.

This is really nitpicking, but it is an example of how to split
generalization/refactoring changes from new stuff.

   info(You can use hexadecimal and decimal 
for addr and size arguments,\n
 @@ -866,14 +869,24 @@ int main(int argc, char *argv[])
   int k_offset = 0;
   int mach_id = 867; /* 867 is the old EZX mach id */
   int ret;
 + bool hparam = 0;
  
   printf(%s\n, $Id$);
 -
 - if (argc  2) {
 + 
 + if (argc = 2  (!strcmp(argv[1], help))) 
 + hparam = 1;
 + else if (argc = 2  (!strcmp(argv[1], --help))) 
 + hparam = 1;
 +

avoid hparam, join the two new conditions like in:
 (!strcmp(argv[1], help) || !strcmp(argv[1], --help))
and do this check after the argc  2 block, this way you KNOW
that argc is = 2 already: follow the code. Diff attached.

In new code I would prefer strncmp() return value to be checked
explicitly (== 0 instead of !) because the NOT syntax does not match
the intuitive semantics here, and that really hurts my simple brain, but
this is another thing to keep in mind: when you add code to a project
you need to use the style already in use, you need to blend in in
order to keep the style consistent.

These little changes are a good didactic excuse, forgive the
verbosity :)

 + if (argc  2 || hparam) {
   usage();
  
 - error(Too few arguments.);
 - exit(1);
 + if (!hparam) {
 + error(Too few arguments.);
 + exit(1);
 + }
 +
 + exit(0);
   }
  
   ezx_device_open();
 -- 

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
diff --git a/src/moto-boot-usb.c b/src/moto-boot-usb.c
index 962a236..e0eaeb8 100644
--- a/src/moto-boot-usb.c
+++ b/src/moto-boot-usb.c
@@ -876,6 +876,11 @@ int main(int argc, char *argv[])
 		exit(1);
 	}
 
+	if (!strcmp(argv[1], help) || !strcmp(argv[1], --help)) {
+		usage();
+		exit(0);
+	}
+
 	ezx_device_open();
 
 


pgpEooEZgC7d4.pgp
Description: PGP signature


Re: [PATCH v3] mmc_spi.c: add support for the regulator framework

2011-05-23 Thread Antonio Ospite
On Wed, 18 May 2011 12:42:12 -0700
Mark Brown broo...@opensource.wolfsonmicro.com wrote:

 On Wed, May 18, 2011 at 07:23:20PM +0200, Antonio Ospite wrote:
 
[...]
2. Add a proper function with all the needed parameters to abstract
   the actual var names, this would be something like:
   mmc_regulator_set_power(mmc, power_mode, vdd, vcc, pdata)
   and yet checking for pdata-setpower can be tricky as 'setpower' 
   is an arbitrary name.
 
 This would be good.

A WIP patch, I don't have a lot of time to spend on this, I tried to
handle the driver specific 'setpower' callback with a macro, let me
know if you have a better idea:

diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index bcb793e..dbbe535 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -298,6 +298,32 @@ static inline int mmc_regulator_set_ocr(struct mmc_host 
*mmc,
 }
 #endif
 
+#define STRUCT_FIELD(s, f) ((s)  (s)-f ? (s)-f : NULL )
+
+static inline int mmc_regulator_set_power(struct mmc_host *mmc,
+unsigned char  power_mode,
+struct regulator *supply,
+unsigned short vdd_bit,
+struct device *device,
+void (*setpower_cb)(struct device *, unsigned 
int))
+{
+   if (supply) {
+   int ret;
+
+   if (power_mode == MMC_POWER_OFF)
+   vdd_bit = 0;
+
+   ret = mmc_regulator_set_ocr(mmc, supply, vdd_bit);
+   if (ret)
+   return ret;
+   } else {
+   if (setpower_cb)
+   setpower_cb(device, vdd_bit);
+   }
+
+   return 0;
+}
+
 int mmc_card_awake(struct mmc_host *host);
 int mmc_card_sleep(struct mmc_host *host);
 int mmc_card_can_sleep(struct mmc_host *host);
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 2e8db20..c9a229f 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1231,21 +1231,18 @@ static inline int mmc_spi_setpower(struct mmc_spi_host 
*host,
unsigned char power_mode,
unsigned int vdd)
 {
+   int ret;
+
if (!mmc_spi_canpower(host))
return -ENOSYS;
 
-   if (host-vcc) {
-   int ret;
 
-   if (power_mode == MMC_POWER_OFF)
-   vdd = 0;
+   ret = mmc_regulator_set_power(host-mmc, power_mode, host-vcc, vdd,
+ host-spi-dev,
+ STRUCT_FIELD(host-pdata, setpower));
+   if (ret)
+   return ret;
 
-   ret = mmc_regulator_set_ocr(host-mmc, host-vcc, vdd);
-   if (ret)
-   return ret;
-   } else {
-   host-pdata-setpower(host-spi-dev, vdd);
-   }
 
if (power_mode == MMC_POWER_UP)
msleep(host-powerup_msecs);
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index fbdb21e..f5d9529 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -103,29 +103,20 @@ static inline int pxamci_set_power(struct pxamci_host 
*host,
unsigned int vdd)
 {
int on;
+   int ret;
 
-   if (host-vcc) {
-   int ret;
+   ret = mmc_regulator_set_power(host-mmc, power_mode, host-vcc, vdd,
+ mmc_dev(host-mmc),
+ STRUCT_FIELD(host-pdata, setpower));
+   if (ret)
+   return ret;
 
-   if (power_mode == MMC_POWER_UP) {
-   ret = mmc_regulator_set_ocr(host-mmc, host-vcc, vdd);
-   if (ret)
-   return ret;
-   } else if (power_mode == MMC_POWER_OFF) {
-   ret = mmc_regulator_set_ocr(host-mmc, host-vcc, 0);
-   if (ret)
-   return ret;
-   }
-   }
if (!host-vcc  host-pdata 
gpio_is_valid(host-pdata-gpio_power)) {
on = ((1  vdd)  host-pdata-ocr_mask);
gpio_set_value(host-pdata-gpio_power,
   !!on ^ host-pdata-gpio_power_invert);
}
-   if (!host-vcc  host-pdata  host-pdata-setpower)
-   host-pdata-setpower(mmc_dev(host-mmc), vdd);
-
return 0;
 }
 


-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpYUFBkRQs9W.pgp
Description: PGP signature


[PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR

2011-05-11 Thread Antonio Ospite
Don't wrap regulator_get() inside an ifdef CONFIG_REGULATOR anymore, as
now it degenerates and returns NULL when the regulator framework is
disabled (since commit be1a50d: regulator: Let drivers know when they
use the stub API); and use IS_ERR_OR_NULL() to handle the stub function 
correctly.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---

Changes since v1:
  - Use IS_ERR_OR_NULL() to correctly handle the stub regulator_get()
  - Put the short commit message of be1a50d so it is easier to see what it is 
about, for the long commit and the actual code changes the git history can 
be queried.

Thanks,
   Antonio Ospite
   http://ao2.it

 drivers/mmc/host/pxamci.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 7257738..3a89fb2 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -79,10 +79,9 @@ struct pxamci_host {
 
 static inline void pxamci_init_ocr(struct pxamci_host *host)
 {
-#ifdef CONFIG_REGULATOR
host-vcc = regulator_get(mmc_dev(host-mmc), vmmc);
 
-   if (IS_ERR(host-vcc))
+   if (IS_ERR_OR_NULL(host-vcc))
host-vcc = NULL;
else {
host-mmc-ocr_avail = mmc_regulator_get_ocrmask(host-vcc);
@@ -90,7 +89,7 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
dev_warn(mmc_dev(host-mmc),
ocr_mask/setpower will not be used\n);
}
-#endif
+
if (host-vcc == NULL) {
/* fall-back to platform data */
host-mmc-ocr_avail = host-pdata ?
-- 
1.7.5.1




Re: [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR

2011-05-11 Thread Antonio Ospite
On Tue, 10 May 2011 22:02:14 +0200
Antonio Ospite osp...@studenti.unina.it wrote:
 
 I was blindly trusting code already in mainline again, and for that I
 apologize, I finally took the time to look at the implementation
 of IS_ERR() and test its use, and being IS_ERR(NULL) true it is not what
 we want indeed, see the attached test program.
 

Just for the records, I meant to say being IS_ERR(NULL) _false_ but
you got it anyways.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpq1W6jh7xxN.pgp
Description: PGP signature


Re: [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR

2011-05-11 Thread Antonio Ospite
On Wed, 11 May 2011 10:41:43 -0400
Chris Ball c...@laptop.org wrote:

 On Wed, May 11 2011, Antonio Ospite wrote:
[...]
   drivers/mmc/host/pxamci.c |5 ++---
   1 files changed, 2 insertions(+), 3 deletions(-)
[...]
 
 Thanks, I've merged this and squashed the 2/2 punctuation patch into it;
 it didn't seem worth having a separate patch when both touch the same code.
 

That's perfectly fine with me.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgp8Ywg7mB394.pgp
Description: PGP signature


Re: [ADM] migrating from gitweb to cgit

2011-05-05 Thread Antonio Ospite
On Wed, 27 Apr 2011 17:44:36 +0200
Antonio Ospite osp...@studenti.unina.it wrote:

 On Wed, 27 Apr 2011 16:13:39 +0200
 Harald Welte lafo...@gnumonks.org wrote:
 
[...]
  I agree, we can ignore those, or alternatively if somebody has an interest
  in putting rewrite rules in place...
 
 
 I'd take the lazy approach and work around the first problem with
 rewrite rules as well, I'll get back here when I am on it.
 

I am taking a look now, links can be broken in the meantime.
I will report back when I have something in place.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpI4cdiwYGE1.pgp
Description: PGP signature


Re: [ADM] migrating from gitweb to cgit

2011-05-05 Thread Antonio Ospite
On Wed, 27 Apr 2011 16:13:39 +0200
Harald Welte lafo...@gnumonks.org wrote:

  There are also very few references to gitweb URLs in mailing list
  discussions like in [2] and I think it is not a big deal either to break
  those links for now.
 
 I agree, we can ignore those, or alternatively if somebody has an interest
 in putting rewrite rules in place...
  

OK, that's what I did so far:

  1. Make cgit accessible at the root of the URL, getting rid of
 the /cgit/ subdir

  2. Adjust the rewrite rules from [1] to fit our needs:
 - fixed some copy and paste typos
 - added support for gitweb clean URLs
 - changed project name detection, as we have project names with
   dots in them and the previous regex was failing for them, however
   we now assume that project names end in \.git in the gitweb
   setup.
I am going to write a short blog post about that.

  3. Put the URL rewriting rules in place, they now redirect to
 cgit.openezx.org, but that can be easily changed if we decide to
 have just git.openezx.org.
 Memento: if we do that, change the redirection code to 301 so the
 search engine will move the addresses and the rewrite rules can
 go away altogether eventually; the git-notify hook would really
 need to be changed then...

I verified that:
  - The URLs in the commit logs like in [2] are correctly resolved
  - Most of the URLs from a google search [3] are working
  - Cloning over http is OK from http://cgit. but not from http://git.
but cgit does not even expose the addresses for that.

TL;DR gitweb is now inactive and it could be removed, I just want to
check how cgit interacts with gitosis about the projects list before
ditching gitweb.

Let me know if you experience any problem.
The rewrite rules could be factored, merged, made stricter, but
they're good enough for us I think. 

Regards,
   Antonio

[1] http://www.clearchain.com/blog/posts/cgit-upgrade-gitweb-retired

[2]
http://lists.openezx.org/pipermail/openezx-svnlog/2011-April/001803.html

[3] http://www.google.it/search?q=site%3Agit.openezx.org

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpRG1gr7B2qQ.pgp
Description: PGP signature


Re: [ADM] migrating from gitweb to cgit

2011-04-27 Thread Antonio Ospite
On Wed, 27 Apr 2011 16:13:39 +0200
Harald Welte lafo...@gnumonks.org wrote:

 On Wed, Apr 27, 2011 at 03:12:02PM +0200, Antonio Ospite wrote:
 
  Either is fine with me, I just note that the git-notify[1] hook we are
  using for CIA notifications and commitlog emails assumes gitweb URLs
  when communicating the commit details; not a big deal.
 
 ok, maybe that should be fixed first.
 
  There are also very few references to gitweb URLs in mailing list
  discussions like in [2] and I think it is not a big deal either to break
  those links for now.
 
 I agree, we can ignore those, or alternatively if somebody has an interest
 in putting rewrite rules in place...


I'd take the lazy approach and work around the first problem with
rewrite rules as well, I'll get back here when I am on it.

[...]
 btw: configuration is in /etc/cgitrc and /etc/cgitrepositories
 
  We can fix these details as time permits, so I'd say go ahead, thanks
  Harald.
 
 There's  no real urgency, so we can wait for the CIA notification fix.
 I just noticed that earlier today the machine had a load of 25 due to
 one of those crawlers...
 
 Feel free to ping me once I can deactivate gitweb (or do it yourself)
 at the right point in time.


Ok, will do, thanks.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpS2Jv1yPyBV.pgp
Description: PGP signature


[RESEND PATCH 3/4] mmc_spi.c: factor out a mmc_spi_setpower() function

2011-04-21 Thread Antonio Ospite
Factor out a mmc_spi_setpower() function so to make changing it more
elegant without adding too much stuff to mmc_spi_set_ios().

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 drivers/mmc/host/mmc_spi.c |   43 +++
 1 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 9eae23c..0f3672d 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1221,6 +1221,26 @@ static void mmc_spi_shutdownsequence(struct mmc_spi_host 
*host)
}
 }
 
+static inline int mmc_spi_setpower(struct mmc_spi_host *host,
+   unsigned char power_mode,
+   unsigned int vdd)
+{
+   /* switch power on/off if possible, accounting for
+* max 250msec powerup time if needed.
+*/
+   if (mmc_spi_canpower(host)) {
+   switch (power_mode) {
+   case MMC_POWER_OFF:
+   case MMC_POWER_UP:
+   host-pdata-setpower(host-spi-dev, vdd);
+   if (power_mode == MMC_POWER_UP)
+   msleep(host-powerup_msecs);
+   }
+   }
+
+   return 0;
+}
+
 static char *mmc_powerstring(u8 power_mode)
 {
switch (power_mode) {
@@ -1236,24 +1256,23 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
struct mmc_spi_host *host = mmc_priv(mmc);
 
if (host-power_mode != ios-power_mode) {
+   int ret;
 
dev_dbg(host-spi-dev, mmc_spi: power %s (%d)%s\n,
mmc_powerstring(ios-power_mode),
ios-vdd,
mmc_spi_canpower(host) ? , can switch : );
 
-   /* switch power on/off if possible, accounting for
-* max 250msec powerup time if needed.
-*/
-   if (mmc_spi_canpower(host)) {
-   switch (ios-power_mode) {
-   case MMC_POWER_OFF:
-   case MMC_POWER_UP:
-   host-pdata-setpower(host-spi-dev,
-   ios-vdd);
-   if (ios-power_mode == MMC_POWER_UP)
-   msleep(host-powerup_msecs);
-   }
+   ret = mmc_spi_setpower(host, ios-power_mode, ios-vdd);
+   if (ret) {
+   dev_err(mmc_dev(mmc), unable to set power\n);
+   /*
+* The .set_ios() function in the mmc_host_ops
+* struct return void, and failing to set the
+* power should be rare so we print an error and
+* return here.
+*/
+   return;
}
 
/* See 6.4.1 in the simplified SD card physical spec 2.0 */
-- 
1.7.4.4




[RESEND PATCH 2/4] mmc_spi.c: factor out the SD card shutdown sequence

2011-04-21 Thread Antonio Ospite
Factor out the SD card shutdown sequence to a dedicated
mmc_spi_shutdownsequence() function in order to make mmc_spi_set_ios()
more readable, and also for symmetry with mmc_spi_initsequence() which
is already a dedicated function.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 drivers/mmc/host/mmc_spi.c |   90 +++
 1 files changed, 48 insertions(+), 42 deletions(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 49f5725..9eae23c 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1176,6 +1176,51 @@ static void mmc_spi_initsequence(struct mmc_spi_host 
*host)
}
 }
 
+/* See Section 6.4.2, in SD Simplified Physical Layer Specification 2.0
+ *
+ * If powering down, ground all card inputs to avoid power delivery from data
+ * lines!  On a shared SPI bus, this will probably be temporary; 6.4.2 of
+ * the simplified SD spec says this must last at least 1msec.
+ *
+ *   - Clock low means CPOL 0, e.g. mode 0
+ *   - MOSI low comes from writing zero
+ *   - Chipselect is usually active low...
+ */
+static void mmc_spi_shutdownsequence(struct mmc_spi_host *host)
+{
+   int mres;
+   u8 nullbyte = 0;
+
+   host-spi-mode = ~(SPI_CPOL|SPI_CPHA);
+   mres = spi_setup(host-spi);
+   if (mres  0)
+   dev_dbg(host-spi-dev,
+   switch to SPI mode 0 failed\n);
+
+   if (spi_write(host-spi, nullbyte, 1)  0)
+   dev_dbg(host-spi-dev,
+   put spi signals to low failed\n);
+
+   /*
+* Now clock should be low due to spi mode 0;
+* MOSI should be low because of written 0x00;
+* chipselect should be low (it is active low)
+* power supply is off, so now MMC is off too!
+*
+* FIXME no, chipselect can be high since the
+* device is inactive and SPI_CS_HIGH is clear...
+*/
+   msleep(10);
+   if (mres == 0) {
+   host-spi-mode |= (SPI_CPOL|SPI_CPHA);
+   mres = spi_setup(host-spi);
+   if (mres  0)
+   dev_dbg(host-spi-dev,
+   switch back to SPI mode 3
+failed\n);
+   }
+}
+
 static char *mmc_powerstring(u8 power_mode)
 {
switch (power_mode) {
@@ -1215,49 +1260,10 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
if (ios-power_mode == MMC_POWER_ON)
mmc_spi_initsequence(host);
 
-   /* If powering down, ground all card inputs to avoid power
-* delivery from data lines!  On a shared SPI bus, this
-* will probably be temporary; 6.4.2 of the simplified SD
-* spec says this must last at least 1msec.
-*
-*   - Clock low means CPOL 0, e.g. mode 0
-*   - MOSI low comes from writing zero
-*   - Chipselect is usually active low...
-*/
+   /* See 6.4.2 in the simplified SD card physical spec 2.0 */
if (mmc_spi_canpower(host) 
-   ios-power_mode == MMC_POWER_OFF) {
-   int mres;
-   u8 nullbyte = 0;
-
-   host-spi-mode = ~(SPI_CPOL|SPI_CPHA);
-   mres = spi_setup(host-spi);
-   if (mres  0)
-   dev_dbg(host-spi-dev,
-   switch to SPI mode 0 failed\n);
-
-   if (spi_write(host-spi, nullbyte, 1)  0)
-   dev_dbg(host-spi-dev,
-   put spi signals to low failed\n);
-
-   /*
-* Now clock should be low due to spi mode 0;
-* MOSI should be low because of written 0x00;
-* chipselect should be low (it is active low)
-* power supply is off, so now MMC is off too!
-*
-* FIXME no, chipselect can be high since the
-* device is inactive and SPI_CS_HIGH is clear...
-*/
-   msleep(10);
-   if (mres == 0) {
-   host-spi-mode |= (SPI_CPOL|SPI_CPHA);
-   mres = spi_setup(host-spi);
-   if (mres  0)
-   dev_dbg(host-spi-dev,
-   switch back to SPI mode 3
-failed\n);
-   }
-   }
+   ios-power_mode == MMC_POWER_OFF)
+   mmc_spi_shutdownsequence(host);
 
host-power_mode = ios-power_mode;
}
-- 
1.7.4.4




[RESEND PATCH 1/4] mmc_spi.c: factor out the check for power capability

2011-04-21 Thread Antonio Ospite
Factor out the 'canpower' condition into a dedicated function in order
to avoid repetition and to make changing the condition easier.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 drivers/mmc/host/mmc_spi.c |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 7c1e16a..49f5725 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -152,6 +152,10 @@ struct mmc_spi_host {
dma_addr_t  ones_dma;
 };
 
+static inline int mmc_spi_canpower(struct mmc_spi_host *host)
+{
+   return host-pdata  host-pdata-setpower;
+}
 
 //
 
@@ -1187,19 +1191,16 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
struct mmc_spi_host *host = mmc_priv(mmc);
 
if (host-power_mode != ios-power_mode) {
-   int canpower;
-
-   canpower = host-pdata  host-pdata-setpower;
 
dev_dbg(host-spi-dev, mmc_spi: power %s (%d)%s\n,
mmc_powerstring(ios-power_mode),
ios-vdd,
-   canpower ? , can switch : );
+   mmc_spi_canpower(host) ? , can switch : );
 
/* switch power on/off if possible, accounting for
 * max 250msec powerup time if needed.
 */
-   if (canpower) {
+   if (mmc_spi_canpower(host)) {
switch (ios-power_mode) {
case MMC_POWER_OFF:
case MMC_POWER_UP:
@@ -1223,7 +1224,8 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
 *   - MOSI low comes from writing zero
 *   - Chipselect is usually active low...
 */
-   if (canpower  ios-power_mode == MMC_POWER_OFF) {
+   if (mmc_spi_canpower(host) 
+   ios-power_mode == MMC_POWER_OFF) {
int mres;
u8 nullbyte = 0;
 
@@ -1399,7 +1401,7 @@ static int mmc_spi_probe(struct spi_device *spi)
dev_warn(spi-dev, ASSUMING 3.2-3.4 V slot power\n);
mmc-ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34;
}
-   if (host-pdata  host-pdata-setpower) {
+   if (mmc_spi_canpower(host)) {
host-powerup_msecs = host-pdata-powerup_msecs;
if (!host-powerup_msecs || host-powerup_msecs  250)
host-powerup_msecs = 250;
@@ -1459,7 +1461,7 @@ static int mmc_spi_probe(struct spi_device *spi)
host-dma_dev ?  : , no DMA,
(host-pdata  host-pdata-get_ro)
?  : , no WP,
-   (host-pdata  host-pdata-setpower)
+   mmc_spi_canpower(host)
?  : , no poweroff,
(mmc-caps  MMC_CAP_NEEDS_POLL)
? , cd polling : );
-- 
1.7.4.4




Re: [RESEND PATCH 4/4] mmc_spi.c: add support for the regulator framework

2011-04-21 Thread Antonio Ospite
On Thu, 21 Apr 2011 13:40:41 +0100
Mark Brown broo...@opensource.wolfsonmicro.com wrote:

 On Thu, Apr 21, 2011 at 02:27:53PM +0200, Antonio Ospite wrote:
 
  +#ifdef CONFIG_REGULATOR
  +   host-vcc = regulator_get(mmc_dev(host-mmc), vmmc);
  +
  +   if (IS_ERR(host-vcc)) {
  +   host-vcc = NULL;
  +   } else {
  +   host-mmc-ocr_avail = mmc_regulator_get_ocrmask(host-vcc);
  +   if (host-pdata  host-pdata-ocr_mask)
  +   dev_warn(mmc_dev(host-mmc),
  +   ocr_mask/setpower will not be used\n);
  }
  +#endif
 
 Why is this code conditional?  The regulator API will stub itself out
 (by returning a null pointer, which plays well with your use of null) if
 it's disabled.  I'm also not seeing any corresponding code to release
 the regulator.


Actually I saw this done conditionally in pxamci.c and thought it was
really needed. About the call to regulator_put() if was there but got
lost when squashing the commits into the final patch and I was still
reading that part in my mind even if it was not there anymore.
The importance of reviewers with fresh eyes.

I'll resubmit this forth patch with the needed changes.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgp8P7hvD9qo5.pgp
Description: PGP signature


Re: [PATCH v3] rfkill: Regulator consumer driver for rfkill

2011-04-15 Thread Antonio Ospite
On Thu, 14 Apr 2011 06:06:26 -0700
Mark Brown broo...@opensource.wolfsonmicro.com wrote:

 On Thu, Apr 14, 2011 at 12:39:12PM +0200, Antonio Ospite wrote:
  Johannes Berg johan...@sipsolutions.net wrote:
 
   Should remove do platform_set_drvdata(pdev, NULL)?
 
  AFAICS this is not strictly necessary because we never check for NULL
  here and we are setting drvdata again in _probe() each time the module
  is loaded anyways. If it is considered a good practice for symmetry
  reasons then I'll add it, no problem. Does anyone have comments on that?
 
 We went round this loop with I2C - anything peering at driver data that
 it didn't originally set is buggy anyway so no need to reset to zero.
 If there was a need the platform bus or driver core should do it since
 all devices would need it.
 

Ok, so v3 is the one which could be merged.

John if you are the one who is going to commit it, would you please add
the line:

Reviewed-by: Johannes Berg johan...@sipsolutions.net

Thanks everybody for the comments.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpNryC3rCBVy.pgp
Description: PGP signature


Re: [PATCH v2] rfkill: Regulator consumer driver for rfkill

2011-04-13 Thread Antonio Ospite
On Tue, 12 Apr 2011 13:44:02 +0200
Johannes Berg johan...@sipsolutions.net wrote:

 On Tue, 2011-04-12 at 13:41 +0200, Johannes Berg wrote:
 
   + * static struct regulator_consumer_supply pcap_regulator_V6_consumers 
   [] = {
   + *   { .dev_name = rfkill-regulator.0, supply = vrfkill },
   + * };
  
  It's a comment, but it should be .supply = (missing the .)
 

well spotted, I'll fix this.

   + if (pdata-name == NULL || pdata-type == 0) {
   + dev_err(pdev-dev, invalid name or type in platform data\n);
   + return -EINVAL;
   + }
   +
   + vcc = regulator_get_exclusive(pdev-dev, vrfkill);
  
  Wasn't that supposed to use pdata-supply? Actually, there's no member
  supply in the struct?
 
 Oh wait, I think I just misunderstood how this works. But if the name is
 vrfkill how does that really work with multiple instances?


That's how the regulator framework works, I know Mark already replied to
you but I try to elaborate more for the records and to organize my 
thoughts about that:

 - In the consumers for the regulator we choose the virtual supply,
   vrfkill in this case, and which driver is going to use it.

 - Wrt. to multiple instances, they are distinguished using device ids.

   When we set consumers for a physical regulator we can tell: device
   rfkill-regulator.1 will call this regulator vrfkill and we
   declare the relative rfkill-regulator platform device with .id=1,
   this way the regulator framework knows what physical regulator to
   return when asked for vrfkill _from_ a rfkill-regulator platform
   device instance with .id==1

I hope I am not introducing any inaccuracies :)

A v3 of the patch is on its way.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpERk3JtAPCL.pgp
Description: PGP signature


Re: [PATCH v2] rfkill: Regulator consumer driver for rfkill

2011-04-13 Thread Antonio Ospite
On Tue, 12 Apr 2011 13:41:28 +0200
Johannes Berg johan...@sipsolutions.net wrote:

  +   dev_info(pdev-dev, initialized\n);
 
 Is that message really useful?


I can print the pdata-name here as well as an excuse to keep it,
reality is that I just like visual feedback in dmesg when a driver has
been loaded.

 Other than that, looks good to me.
 
 johannes


In another message you said that the comment in rfkill-regulator.h
still seemed a little wrong to you, would you elaborate more about what
you were referring to?

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpgxa8dLc4CV.pgp
Description: PGP signature


Re: [PATCH] rfkill: Regulator consumer driver for rfkill

2011-04-06 Thread Antonio Ospite
On Wed, 06 Apr 2011 11:29:38 +0200
Johannes Berg johan...@sipsolutions.net wrote:

 On Wed, 2011-04-06 at 11:21 +0200, Antonio Ospite wrote:
 
  +   if (regulator_is_enabled(vcc)) {
  +   dev_dbg(pdev-dev, Regulator already enabled\n);
  +   rfkill_data-reg_enabled = 1;
  +   }
  +   rfkill_init_sw_state(rf_kill, !rfkill_data-reg_enabled);
  +
  +   ret = rfkill_register(rf_kill);
 
 We recently had a thread about how rfkill_init_sw_state() isn't quite
 working the right way. Also, it is indented to be used for devices that
 keep their state over resume. I think you should remove it here and rely
 on rfkill to sync you after registration.
 
 Cf. the long thread here:
 http://thread.gmane.org/gmane.linux.acpi.devel/49577


Ok, but I still need to replace that call with a rfkill_set_sw_state()
to expose the initial status of the regulator to the rfkill system,
right?

 Other than that, no comments from me from an rfkill POV.
 
 johannes
 

Thanks I am waiting a couple of days before sending a v2.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpo9X2HWCTIB.pgp
Description: PGP signature


Re: [PATCH] rfkill: Regulator consumer driver for rfkill

2011-04-06 Thread Antonio Ospite
On Wed, 06 Apr 2011 16:09:28 +0200
Johannes Berg johan...@sipsolutions.net wrote:

 On Wed, 2011-04-06 at 16:06 +0200, Antonio Ospite wrote:
 
+   if (regulator_is_enabled(vcc)) {
+   dev_dbg(pdev-dev, Regulator already enabled\n);
+   rfkill_data-reg_enabled = 1;
+   }
+   rfkill_init_sw_state(rf_kill, !rfkill_data-reg_enabled);
+
+   ret = rfkill_register(rf_kill);
   
   We recently had a thread about how rfkill_init_sw_state() isn't quite
   working the right way. Also, it is indented to be used for devices that
   keep their state over resume. I think you should remove it here and rely
   on rfkill to sync you after registration.
   
   Cf. the long thread here:
   http://thread.gmane.org/gmane.linux.acpi.devel/49577
  
  
  Ok, but I still need to replace that call with a rfkill_set_sw_state()
  to expose the initial status of the regulator to the rfkill system,
  right?
 
 Well, you could, but if you don't do that then the rfkill subsystem will
 simply call set_block() shortly after registration to put it into the
 state that it thinks it should be in, which is usually more useful.
 

I see, let's just drop rfkill_init_sw_state() then.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpkYCWKv6SUL.pgp
Description: PGP signature


Re: [PATCH] rfkill: Regulator consumer driver for rfkill

2011-04-06 Thread Antonio Ospite
On Wed, 6 Apr 2011 23:11:33 +0900
Mark Brown broo...@opensource.wolfsonmicro.com wrote:

 On Wed, Apr 06, 2011 at 11:21:19AM +0200, Antonio Ospite wrote:
 
  +   tristate Generic rfkill regulator driver
  +   depends on RFKILL || !RFKILL
 
 That looks *odd*.

Taken from Documentation/rfkill.txt section 3.  Kernel API.
I guess I can drop it if we want to be stricter and just require RFKILL
to be enabled. Johannes?

 Otherwise this looks fine from a regulator API point
 of view.  You use an exclusive get() so you could get away without
 remembering the enable state as nothing else could hold the device open
 but there's no harm in doing so and it's defensive against silly
 constraints that force the regulator on.
 

Thanks Mark.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpf4tvLZe0cn.pgp
Description: PGP signature


Re: [PATCH 0/4] mmc_spi: Add support for regulator framework

2011-04-04 Thread Antonio Ospite
On Mon, 21 Mar 2011 19:46:38 +0100
Antonio Ospite osp...@studenti.unina.it wrote:

 Hi,
 
 this patchset has the purpose of adding support for the regulator framework 
 to 
 the mmc_spi driver. The first three patches are preparatory cleanups to make 
 the fourth one more straightforward.
 
 Maybe the fourth patch can be improved, I am open to any suggestions about it.


Ping. I forgot to Cc spi-devel-general on this series, should I resend
it?

 These changes take strong inspiration from the pxamci driver; they have been 
 tested on a Motorola A910, which uses a regulator to powerup the MMC card 
 connected to the SPI bus, a test from a current user of the mmc_spi driver 
 would not hurt just to be sure no regressions have been introduced.
 
 Thanks,
Antonio
 
 Antonio Ospite (4):
   mmc_spi.c: factor out the check for power capability
   mmc_spi.c: factor out the SD card shutdown sequence
   mmc_spi.c: factor out a mmc_spi_setpower() function
   mmc_spi.c: add support for the regulator framework
 
  drivers/mmc/host/mmc_spi.c |  194 
 +---
  1 files changed, 129 insertions(+), 65 deletions(-)
 

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpngUdkrOVHQ.pgp
Description: PGP signature


[PATCH] ezx/pcap: initialize PCAP_REG_AUXVREG_MASK

2011-03-23 Thread Antonio Ospite
Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---

Initializing PCAP_REG_AUXVREG_MASK is needed to make vibrator work on gen2 
phones. Now, do we want to set an hardcoded value here? or rather enable the 
features using some symbolic constants taken from the power_ic driver?

Look at 
[1] 
http://git.openezx.org/motorola-2.4.git/blob/53e66c3b1448c5679cb34d64e18cca65830a25b3:/drivers/misc/ssp_pcap.h#l838
 

Regards,
   Antonio Ospite
   http://ao2.it

 arch/arm/mach-pxa/ezx.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index 1fa0b32..024344a 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -768,15 +768,18 @@ static struct pxa27x_keypad_platform_data 
e2_keypad_platform_data = {
 };
 #endif /* CONFIG_MACH_EZX_E2 */
 
-/* FIXME: EMU driver */
 static void ezx_pcap_init(void *pcap)
 {
+   /* FIXME: EMU driver */
ezx_pcap_write(pcap, PCAP_REG_BUSCTRL, (PCAP_BUSCTRL_USB_PU |
PCAP_BUSCTRL_RS232ENB | PCAP_BUSCTRL_VUSB_EN));
gpio_request(120, EMU mux1);
gpio_request(119, EMU mux2);
gpio_direction_output(120, 0);
gpio_direction_output(119, 0);
+
+   /* needed to make vibrator work on gen2 phones */
+   ezx_pcap_write(pcap, PCAP_REG_AUXVREG_MASK, 0x00214D48);
 }
 
 /* SPI */
-- 
1.7.4.1




[PATCH] leds: leds-regulator.c, fix handling already enabled regulators

2011-03-23 Thread Antonio Ospite
Make the driver aware of the initial status of the regulator.

The leds-regulator driver was ignoring the initial status of the
regulator; this resulted in rdev-use_count incremented up to 2 after
calling regulator_led_set_value() in the .probe method when a regulator
was already enabled at insmod time, and this made impossible to ever
disable the regulator.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---

This problem was anticipated by Mark Brown on the very first submission 
of the driver but my knowledge about regulators at the time made me 
overlook what he was asking for, now that I have actually experienced 
the problem I've finally figured out what Mark was really referring to.

NOTE: initially I thought about CC-ing sta...@kernel.org as well on 
this, as it is an actual fix, but then I checked that there are 
currently no users of the driver in mainline linux and I dropped it, is 
that how it should be?

Thanks,
   Antonio Ospite
   http://ao2.it

 drivers/leds/leds-regulator.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c
index 3790816..8497f56 100644
--- a/drivers/leds/leds-regulator.c
+++ b/drivers/leds/leds-regulator.c
@@ -178,6 +178,10 @@ static int __devinit regulator_led_probe(struct 
platform_device *pdev)
led-cdev.flags |= LED_CORE_SUSPENDRESUME;
led-vcc = vcc;
 
+   /* to handle correctly an already enabled regulator */
+   if (regulator_is_enabled(led-vcc))
+   led-enabled = 1;
+
mutex_init(led-mutex);
INIT_WORK(led-work, led_work);
 
-- 
1.7.4.1




[PATCH 0/4] mmc_spi: Add support for regulator framework

2011-03-21 Thread Antonio Ospite
Hi,

this patchset has the purpose of adding support for the regulator framework to 
the mmc_spi driver. The first three patches are preparatory cleanups to make 
the forth one more straightforward.

Maybe the fourth patch can be improved, I am open to any suggestions about it.

These changes take strong inspiration from the pxamci driver; they have been 
tested on a Motorola A910, which uses a regulator to powerup the MMC card 
connected to the SPI bus, a test from a current user of the mmc_spi driver 
would not hurt just to be sure no regressions have been introduced.

Thanks,
   Antonio

Antonio Ospite (4):
  mmc_spi.c: factor out the check for power capability
  mmc_spi.c: factor out the SD card shutdown sequence
  mmc_spi.c: factor out a mmc_spi_setpower() function
  mmc_spi.c: add support for the regulator framework

 drivers/mmc/host/mmc_spi.c |  194 +---
 1 files changed, 129 insertions(+), 65 deletions(-)

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?



[PATCH 2/4] mmc_spi.c: factor out the SD card shutdown sequence

2011-03-21 Thread Antonio Ospite
Factor out the SD card shutdown sequence to a dedicated
mmc_spi_shutdownsequence() function in order to make mmc_spi_set_ios()
more readable, and also for symmetry with mmc_spi_initsequence() which
is already a dedicated function.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 drivers/mmc/host/mmc_spi.c |   90 +++
 1 files changed, 48 insertions(+), 42 deletions(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 1db18ce..fe0fdc4 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1176,6 +1176,51 @@ static void mmc_spi_initsequence(struct mmc_spi_host 
*host)
}
 }
 
+/* See Section 6.4.2, in SD Simplified Physical Layer Specification 2.0
+ *
+ * If powering down, ground all card inputs to avoid power delivery from data
+ * lines!  On a shared SPI bus, this will probably be temporary; 6.4.2 of
+ * the simplified SD spec says this must last at least 1msec.
+ *
+ *   - Clock low means CPOL 0, e.g. mode 0
+ *   - MOSI low comes from writing zero
+ *   - Chipselect is usually active low...
+ */
+static void mmc_spi_shutdownsequence(struct mmc_spi_host *host)
+{
+   int mres;
+   u8 nullbyte = 0;
+
+   host-spi-mode = ~(SPI_CPOL|SPI_CPHA);
+   mres = spi_setup(host-spi);
+   if (mres  0)
+   dev_dbg(host-spi-dev,
+   switch to SPI mode 0 failed\n);
+
+   if (spi_write(host-spi, nullbyte, 1)  0)
+   dev_dbg(host-spi-dev,
+   put spi signals to low failed\n);
+
+   /*
+* Now clock should be low due to spi mode 0;
+* MOSI should be low because of written 0x00;
+* chipselect should be low (it is active low)
+* power supply is off, so now MMC is off too!
+*
+* FIXME no, chipselect can be high since the
+* device is inactive and SPI_CS_HIGH is clear...
+*/
+   msleep(10);
+   if (mres == 0) {
+   host-spi-mode |= (SPI_CPOL|SPI_CPHA);
+   mres = spi_setup(host-spi);
+   if (mres  0)
+   dev_dbg(host-spi-dev,
+   switch back to SPI mode 3
+failed\n);
+   }
+}
+
 static char *mmc_powerstring(u8 power_mode)
 {
switch (power_mode) {
@@ -1215,49 +1260,10 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
if (ios-power_mode == MMC_POWER_ON)
mmc_spi_initsequence(host);
 
-   /* If powering down, ground all card inputs to avoid power
-* delivery from data lines!  On a shared SPI bus, this
-* will probably be temporary; 6.4.2 of the simplified SD
-* spec says this must last at least 1msec.
-*
-*   - Clock low means CPOL 0, e.g. mode 0
-*   - MOSI low comes from writing zero
-*   - Chipselect is usually active low...
-*/
+   /* See 6.4.2 in the simplified SD card physical spec 2.0 */
if (mmc_spi_canpower(host) 
-   ios-power_mode == MMC_POWER_OFF) {
-   int mres;
-   u8 nullbyte = 0;
-
-   host-spi-mode = ~(SPI_CPOL|SPI_CPHA);
-   mres = spi_setup(host-spi);
-   if (mres  0)
-   dev_dbg(host-spi-dev,
-   switch to SPI mode 0 failed\n);
-
-   if (spi_write(host-spi, nullbyte, 1)  0)
-   dev_dbg(host-spi-dev,
-   put spi signals to low failed\n);
-
-   /*
-* Now clock should be low due to spi mode 0;
-* MOSI should be low because of written 0x00;
-* chipselect should be low (it is active low)
-* power supply is off, so now MMC is off too!
-*
-* FIXME no, chipselect can be high since the
-* device is inactive and SPI_CS_HIGH is clear...
-*/
-   msleep(10);
-   if (mres == 0) {
-   host-spi-mode |= (SPI_CPOL|SPI_CPHA);
-   mres = spi_setup(host-spi);
-   if (mres  0)
-   dev_dbg(host-spi-dev,
-   switch back to SPI mode 3
-failed\n);
-   }
-   }
+   ios-power_mode == MMC_POWER_OFF)
+   mmc_spi_shutdownsequence(host);
 
host-power_mode = ios-power_mode;
}
-- 
1.7.4.1




[PATCH 1/4] mmc_spi.c: factor out the check for power capability

2011-03-21 Thread Antonio Ospite
Factor out the 'canpower' condition into a dedicated function in order
to avoid repetition and to make changing the condition easier.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 drivers/mmc/host/mmc_spi.c |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index fd877f6..1db18ce 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -152,6 +152,10 @@ struct mmc_spi_host {
dma_addr_t  ones_dma;
 };
 
+static inline int mmc_spi_canpower(struct mmc_spi_host *host)
+{
+   return host-pdata  host-pdata-setpower;
+}
 
 //
 
@@ -1187,19 +1191,16 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
struct mmc_spi_host *host = mmc_priv(mmc);
 
if (host-power_mode != ios-power_mode) {
-   int canpower;
-
-   canpower = host-pdata  host-pdata-setpower;
 
dev_dbg(host-spi-dev, mmc_spi: power %s (%d)%s\n,
mmc_powerstring(ios-power_mode),
ios-vdd,
-   canpower ? , can switch : );
+   mmc_spi_canpower(host) ? , can switch : );
 
/* switch power on/off if possible, accounting for
 * max 250msec powerup time if needed.
 */
-   if (canpower) {
+   if (mmc_spi_canpower(host)) {
switch (ios-power_mode) {
case MMC_POWER_OFF:
case MMC_POWER_UP:
@@ -1223,7 +1224,8 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
 *   - MOSI low comes from writing zero
 *   - Chipselect is usually active low...
 */
-   if (canpower  ios-power_mode == MMC_POWER_OFF) {
+   if (mmc_spi_canpower(host) 
+   ios-power_mode == MMC_POWER_OFF) {
int mres;
u8 nullbyte = 0;
 
@@ -1399,7 +1401,7 @@ static int mmc_spi_probe(struct spi_device *spi)
dev_warn(spi-dev, ASSUMING 3.2-3.4 V slot power\n);
mmc-ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34;
}
-   if (host-pdata  host-pdata-setpower) {
+   if (mmc_spi_canpower(host)) {
host-powerup_msecs = host-pdata-powerup_msecs;
if (!host-powerup_msecs || host-powerup_msecs  250)
host-powerup_msecs = 250;
@@ -1459,7 +1461,7 @@ static int mmc_spi_probe(struct spi_device *spi)
host-dma_dev ?  : , no DMA,
(host-pdata  host-pdata-get_ro)
?  : , no WP,
-   (host-pdata  host-pdata-setpower)
+   mmc_spi_canpower(host)
?  : , no poweroff,
(mmc-caps  MMC_CAP_NEEDS_POLL)
? , cd polling : );
-- 
1.7.4.1




[PATCH 4/4] mmc_spi.c: add support for the regulator framework

2011-03-21 Thread Antonio Ospite
Add support for powering up SD cards driven by regulators.
This makes the mmc_spi driver work also with the Motorola A910 phone.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 drivers/mmc/host/mmc_spi.c |   61 +++
 1 files changed, 49 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 5e4b2c7..d5fe841 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -31,6 +31,7 @@
 #include linux/dma-mapping.h
 #include linux/crc7.h
 #include linux/crc-itu-t.h
+#include linux/regulator/consumer.h
 #include linux/scatterlist.h
 
 #include linux/mmc/host.h
@@ -150,11 +151,13 @@ struct mmc_spi_host {
 */
void*ones;
dma_addr_t  ones_dma;
+
+   struct regulator*vcc;
 };
 
 static inline int mmc_spi_canpower(struct mmc_spi_host *host)
 {
-   return host-pdata  host-pdata-setpower;
+   return (host-pdata  host-pdata-setpower) || host-vcc;
 }
 
 //
@@ -1225,17 +1228,35 @@ static inline int mmc_spi_setpower(struct mmc_spi_host 
*host,
unsigned char power_mode,
unsigned int vdd)
 {
+   if (!mmc_spi_canpower(host))
+   return -ENOSYS;
+
/* switch power on/off if possible, accounting for
 * max 250msec powerup time if needed.
 */
-   if (mmc_spi_canpower(host)) {
-   switch (power_mode) {
-   case MMC_POWER_OFF:
-   case MMC_POWER_UP:
+   switch (power_mode) {
+   case MMC_POWER_OFF:
+   if (host-vcc) {
+   int ret = mmc_regulator_set_ocr(host-mmc,
+   host-vcc, 0);
+   if (ret)
+   return ret;
+   } else {
+   host-pdata-setpower(host-spi-dev, vdd);
+   }
+   break;
+
+   case MMC_POWER_UP:
+   if (host-vcc) {
+   int ret = mmc_regulator_set_ocr(host-mmc,
+   host-vcc, vdd);
+   if (ret)
+   return ret;
+   } else {
host-pdata-setpower(host-spi-dev, vdd);
-   if (power_mode == MMC_POWER_UP)
-   msleep(host-powerup_msecs);
}
+   msleep(host-powerup_msecs);
+   break;
}
 
return 0;
@@ -1420,12 +1441,28 @@ static int mmc_spi_probe(struct spi_device *spi)
 * and power switching gpios.
 */
host-pdata = mmc_spi_get_pdata(spi);
-   if (host-pdata)
-   mmc-ocr_avail = host-pdata-ocr_mask;
-   if (!mmc-ocr_avail) {
-   dev_warn(spi-dev, ASSUMING 3.2-3.4 V slot power\n);
-   mmc-ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34;
+#ifdef CONFIG_REGULATOR
+   host-vcc = regulator_get(mmc_dev(host-mmc), vmmc);
+
+   if (IS_ERR(host-vcc)) {
+   host-vcc = NULL;
+   } else {
+   host-mmc-ocr_avail = mmc_regulator_get_ocrmask(host-vcc);
+   if (host-pdata  host-pdata-ocr_mask)
+   dev_warn(mmc_dev(host-mmc),
+   ocr_mask/setpower will not be used\n);
}
+#endif
+   if (host-vcc == NULL) {
+   /* fall-back to platform data */
+   if (host-pdata)
+   mmc-ocr_avail = host-pdata-ocr_mask;
+   if (!mmc-ocr_avail) {
+   dev_warn(spi-dev, ASSUMING 3.2-3.4 V slot power\n);
+   mmc-ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
+   }
+   }
+
if (mmc_spi_canpower(host)) {
host-powerup_msecs = host-pdata-powerup_msecs;
if (!host-powerup_msecs || host-powerup_msecs  250)
-- 
1.7.4.1




test delivering mail to openezx-devel

2011-03-18 Thread Antonio Ospite
Hi,

this is just a test to see if my messages can be delivered to
openezx-devel.

I was receiving errors like:

 - These recipients of your message have been processed by the mail
   server: openezx-devel@lists.openezx.org; Failed; 5.4.0 (other or
   undefined network or routing status)

because lists.openezx.org did not have an MX record and my ISP does
not like that, but now Harald fixed that and I should be able to post
again.

Someone else noted that MTAs should fallback to A records when an MX
one is not found, see also [1] and [2] when it says:
 If an empty list of MXs is returned,
   the address is treated as if it was associated with an implicit MX
   RR, with a preference of 0, pointing to that host.

I'll try to report that to my ISP too.

Thanks,
   Antonio

[1] http://en.wikipedia.org/wiki/MX_record#History_of_fallback_to_A
[2] http://tools.ietf.org/html/rfc5321#section-5.1

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpiOzSDOkjIN.pgp
Description: PGP signature


Re: Problems with rootfs

2011-03-18 Thread Antonio Ospite
On Sat, 24 Jul 2010 00:33:55 -0500
Matt kernelpani...@gmail.com wrote:

 I got the kernel booting on a Motorola A910 but it keeps panicing on the
 message Unable to mount root fs on unknown-block(0,0)
 
 Photo here: http://goput.it/str/k7376.jpg
 

For mmc to work on A910 there is the need of some out of tree patches
to make the mmc_spi driver power up the MMC card successfully using the
regulator framework.

I don't know if you are still interested in that after all this time,
but I am going to add such functionality sometime in the near future, I
have some preliminary patches for that already here, let me know if you
would like to test them.

Sorry for the huge delay for responding to that.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgp9gqNyIMNQH.pgp
Description: PGP signature


boot_usb migrated to git, now called moto-boot-usb

2010-06-09 Thread Antonio Ospite
Hi,

I migrated also boot_usb and renamed it to moto-boot-usb.

The code is now here:
http://git.openezx.org/moto-boot-usb.git

The commit notification script hasn't been set up yet, and the wiki
needs to be refreshed as well to match the new source location and the
new name.

Other than that please let me know if there are any problems.

FYI, here are also some notes about migrating an SVN repo to Git:
http://ao2.it/wiki/How_to_migrate_an_SVN_repository_to_Git

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpBu9brKMGlD.pgp
Description: PGP signature


Re: [oe] [PATCH 01/12] fso-image.inc: add an even shorter alias, for ls -l

2010-06-07 Thread Antonio Ospite
On Mon, 31 May 2010 13:19:30 +0200
Koen Kooi k.k...@student.utwente.nl wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 31-05-10 11:55, Antonio Ospite wrote:
  'l' is a must have along with 'll'.
  
  Signed-off-by: Antonio Ospite osp...@studenti.unina.it
[...]
 diff --git a/recipes/images/fso-image.inc b/recipes/images/fso-image.inc
[...]
  +echo alias l='ls -l' ./etc/profile
   echo alias ll='ls -al' ./etc/profile
   # nfs
   mkdir -p ./local/pkg
 
 And what happens if you opkg upgrade base-files? You suddenly lost all
 your tweaks to /etc/profile.

Right, /etc/profile would be overwritten, but that's quite independent
from this very patch, it's the whole fso-image.inc approach which
should be revised, so I'd like this one could still make it.

Or if you can point to the right way to do what
recipes/images/fso-image.inc::fso_rootfs_postprocess() is doing I can
try to implement that.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpZw3kILhrm0.pgp
Description: PGP signature


Re: [PATCH 07/12 v2] motorola-ezx-base.inc: refresh machine definition

2010-06-01 Thread Antonio Ospite
On Mon, 31 May 2010 18:32:34 +0200
Koen Kooi k.k...@student.utwente.nl wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 31-05-10 16:28, Antonio Ospite wrote:
  Reorder sections to a more logic scheme, following magician.conf, other
  cleanups:
  
   * sort MACHINE_FEATURES alphabetically
   * add ezx-gen-blob to EXTRA_IMAGEDEPENDS
   * use MODUTILS=26
   * Add needed kernel modules for BP
  
  Signed-off-by: Antonio Ospite osp...@studenti.unina.it
 
 Acked-by: Koen Kooi k...@openembedded.org
 

Thanks Koen, btw, trying git am om my own patches before pushing I've
found some whitepsace issues, I'll fix these, no semantic changes, but
I just wanted to point out that the changes I am going to push are not
_exactly_ the same I sent here for review.

Is there anything like checkpatch.pl for OE?

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpau3xQV6Coa.pgp
Description: PGP signature


[PATCH 01/12] fso-image.inc: add an even shorter alias, for ls -l

2010-05-31 Thread Antonio Ospite
'l' is a must have along with 'll'.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 recipes/images/fso-image.inc |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/recipes/images/fso-image.inc b/recipes/images/fso-image.inc
index cc626f3..704d267 100644
--- a/recipes/images/fso-image.inc
+++ b/recipes/images/fso-image.inc
@@ -110,6 +110,7 @@ fso_rootfs_postprocess() {
 echo alias fso='cd /local/pkg/fso' ./etc/profile
 echo alias ipkg='opkg' ./etc/profile
 echo alias vim=vi ./etc/profile
+echo alias l='ls -l' ./etc/profile
 echo alias ll='ls -al' ./etc/profile
 # nfs
 mkdir -p ./local/pkg
-- 
1.7.1




[PATCH 03/12] device_table-ezx.txt: add needed device nodes

2010-05-31 Thread Antonio Ospite
* With all the mux nodes we can start playing again with gps on A780
* More fb nodes are needed for pxa fb overlay access
* Audio devices are needed too in the case of static /dev

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 files/device_table-ezx.txt |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/files/device_table-ezx.txt b/files/device_table-ezx.txt
index 7246bc8..4984de9 100644
--- a/files/device_table-ezx.txt
+++ b/files/device_table-ezx.txt
@@ -8,7 +8,17 @@
 #b Block special device file
 #p Fifo (named pipe)
 
-/dev/mux   c   660 0   5   234 0   0   1   
9
+/dev/mux   c   660 0   5   234 0   0   1   
17
 /dev/ttyIPC0   c   660 0   5   251 0   -   -   
-
 /dev/input/uinput  c   660 0   0   10  223 -   
-   -
 /dev/video0c   660 0   44  81  0   -   -   
-
+/dev/fbc   600 0   0   29  0   0   
1   4
+# audio
+/dev/dspc   660 0   29  14  3   -   -  
 - 
+/dev/snd/controlC0  c   660 0   29  116  0   - 
  -   - 
+/dev/snd/pcmC0D0p   c   660 0   29  116  16   -
   -   - 
+/dev/snd/pcmC0D1c   c   660 0   29  116  25   -
   -   - 
+/dev/snd/pcmC0D1p   c   660 0   29  116  17   -
   -   - 
+/dev/snd/pcmC0D2c   c   660 0   29  116  26   -
   -   - 
+/dev/snd/pcmC0D2p   c   660 0   29  116  18   -
   -   - 
+/dev/snd/timer  c   660 0   29  116  33   -
   -   - 
-- 
1.7.1




[PATCH 04/12] xserver-kdrive-common/Xserver: fix EZX settings

2010-05-31 Thread Antonio Ospite
Support all EZX machines, and set up the mouse as a tslib device.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 .../xserver-kdrive-common/Xserver  |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/recipes/xserver-kdrive-common/xserver-kdrive-common/Xserver 
b/recipes/xserver-kdrive-common/xserver-kdrive-common/Xserver
index e2566bb..347b005 100644
--- a/recipes/xserver-kdrive-common/xserver-kdrive-common/Xserver
+++ b/recipes/xserver-kdrive-common/xserver-kdrive-common/Xserver
@@ -144,11 +144,12 @@ case `module_id` in
  PPM=-root-ppm /usr/share/pixmaps/xsplash-qvga-square.ppm
 fi
 ARGS=$ARGS -dpi 181 -screen 320x320 -mouse tslib -hide-cursor 
${PPM} ;;
-Motorola Ezx Platform)
+Motorola Ezx Platform | \
+Motorola EZX*)
 if [ -f /usr/share/pixmaps/xsplash-qvga.ppm ]; then
  PPM=-root-ppm /usr/share/pixmaps/xsplash-qvga.ppm ${PPM}
 fi
-ARGS=$ARGS -dpi 170 -screen ${SCREEN_SIZE} ;;
+ARGS=$ARGS -dpi 170 -mouse tslib -hide-cursor -screen 
${SCREEN_SIZE} ${PPM} ;;
Glofiish M800)
 if [ -f /usr/share/pixmaps/xsplash-vga.ppm ]; then
  PPM=-root-ppm /usr/share/pixmaps/xsplash-vga.ppm
-- 
1.7.1




[PATCH 00/12] motorola-ezx related changes

2010-05-31 Thread Antonio Ospite
Hi, here's some motorola-ezx related changes, plus a couple of other fixes I
am using here.
Namely, the non ezx related changes are 01 and 02.

Can anyone review and apply, please?

Thanks,
   Antonio Ospite


Antonio Ospite (11):
  fso-image.inc: add an even shorter alias for ls -l
  device_table-minimal.txt: fix input device nodes path
  device_table-ezx.txt: add needed device nodes
  xserver-kdrive-common/Xserver: fix EZX settings
  tslib: Add config file for a780 machine
  motorola-ezx-base.inc: use PREFERRED_PROVIDER_virtual/xserver
  motorola-ezx-base.inc: refresh machine definition
  openezx-kernel_git: update recipe
  ezx-gen-blob: bump SRCREV
  ezx-boot-usb-native: bump SRCREV
  frameworkd_git.bb: bump SRCREV

Ilya Petrov (1):
  motorola-ezx-base.inc: Add support for ubifs

 conf/machine/include/motorola-ezx-base.inc |   64 +++-
 files/device_table-ezx.txt |   12 -
 files/device_table-minimal.txt |2 +-
 recipes/ezx/ezx-boot-usb-native_svn.bb |2 +-
 recipes/ezx/ezx-gen-blob_svn.bb|4 +-
 recipes/freesmartphone/frameworkd_git.bb   |4 +-
 recipes/images/fso-image.inc   |1 +
 recipes/linux/openezx-kernel_git.bb|   17 -
 recipes/tslib/tslib/a780/tslib.sh  |5 ++
 .../xserver-kdrive-common/Xserver  |5 +-
 10 files changed, 87 insertions(+), 29 deletions(-)
 create mode 100755 recipes/tslib/tslib/a780/tslib.sh


-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?



[PATCH 05/12] tslib: Add config file for a780 machine

2010-05-31 Thread Antonio Ospite
Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 recipes/tslib/tslib/a780/tslib.sh |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)
 create mode 100755 recipes/tslib/tslib/a780/tslib.sh

diff --git a/recipes/tslib/tslib/a780/tslib.sh 
b/recipes/tslib/tslib/a780/tslib.sh
new file mode 100755
index 000..dd905fb
--- /dev/null
+++ b/recipes/tslib/tslib/a780/tslib.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+TSLIB_TSDEVICE=/dev/input/event2
+
+export TSLIB_TSDEVICE
-- 
1.7.1




[PATCH 07/12] motorola-ezx-base.inc: refresh machine definition

2010-05-31 Thread Antonio Ospite
Reorder sections to a more logic scheme, following magician.conf, other
cleanups:

 * sort MACHINE_FEATURES alphabetically
 * add ezx-gen-blob to EXTRA_IMAGEDEPENDS
 * use MODUTILS=26
 * Add needed kernel modules for BP
 * get rid of udev

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 conf/machine/include/motorola-ezx-base.inc |   47 ++-
 1 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/conf/machine/include/motorola-ezx-base.inc 
b/conf/machine/include/motorola-ezx-base.inc
index 9ad2f14..792919c 100644
--- a/conf/machine/include/motorola-ezx-base.inc
+++ b/conf/machine/include/motorola-ezx-base.inc
@@ -1,7 +1,16 @@
+# use this for overrides
+MACHINE_CLASS = motorola-ezx
+
+#
+# Hardware-based properties
+#
 TARGET_ARCH = arm
 
-PREFERRED_PROVIDER_virtual/xserver = xserver-kdrive
-PREFERRED_PROVIDER_virtual/kernel ?= openezx-kernel
+# Use tune-xscale per default. Machine independent feeds should be built with 
tune-strongarm.
+require conf/machine/include/tune-xscale.inc
+
+# Uncomment this to use iwmmxt optimizations. Remove the above xscale stuff 
first
+#require conf/machine/include/tune-iwmmxt.inc
 
 #cat /proc/mtd
 #dev:size   erasesize  name
@@ -10,34 +19,40 @@ PREFERRED_PROVIDER_virtual/kernel ?= openezx-kernel
 #mtd2: 0058 0002 VFM_Filesystem
 #mtd3: 0002 0002 Logo
 
-MACHINE_FEATURES = kernel26 touchscreen apm alsa bluetooth usbgadget usbhost 
keyboard screen phone
-MACHINE_FEATURES +=  iwmmxt
-
+ROOT_FLASH_SIZE = 24
+MACHINE_GUI_CLASS = smallscreen
 MACHINE_DISPLAY_WIDTH_PIXELS = 240
 MACHINE_DISPLAY_HEIGHT_PIXELS = 320
 MACHINE_DISPLAY_ORIENTATION = 0
 MACHINE_DISPLAY_PPI = 180
+MACHINE_FEATURES = alsa apm bluetooth kernel26 keyboard phone screen 
touchscreen usbgadget usbhost vfat
+MACHINE_FEATURES +=  iwmmxt
 
-# use this for overrides
-MACHINE_CLASS = motorola-ezx
-
+#
+# Software/packages selection
+#
+PREFERRED_PROVIDER_virtual/kernel ?= openezx-kernel
+MODUTILS = 26
 XSERVER = xserver-kdrive-fbdev
-
-ROOT_FLASH_SIZE = 24
+PREFERRED_PROVIDER_virtual/xserver = xserver-kdrive
 
 IMAGE_FSTYPES ?= jffs2
 EXTRA_IMAGECMD_jffs2 = --pad=14680064 --little-endian --eraseblock=0x2 -n
 
-EXTRA_IMAGEDEPENDS += ezx-boot-usb-native
+EXTRA_IMAGEDEPENDS += ezx-boot-usb-native ezx-gen-blob
+
+IMAGE_INSTALL_append += \
+  kernel-module-ohci-hcd \
+  kernel-module-moto-usb-ipc \
+  kernel-module-ts27010mux \
+
 
-# the EZX phones need a userspace daemon to stop the BP from shutting down the 
phone
-MACHINE_ESSENTIAL_EXTRA_RDEPENDS += ezxd
+# We don't want udev, we rely on CONFIG_DEVTMPFS
+IMAGE_DEV_MANAGER = 
+# TODO: remove ./etc/init.d/devices to actually have devtmpfs working
 
 # Ezxd needs to be started very early so we need the mux devices in static /dev
 IMAGE_DEVICE_TABLES = files/device_table-minimal.txt \
files/device_table-ezx.txt
 
-# Use tune-xscale per default. Machine independent feeds should be built with 
tune-strongarm.
-require conf/machine/include/tune-xscale.inc
-
 SERIAL_CONSOLE = 115200 ttyS0
-- 
1.7.1




[PATCH 12/12] frameworkd_git.bb: bump SRCREV

2010-05-31 Thread Antonio Ospite
ogsmd has now some more reliable support for the Freescale Neptune modem
used in Motorola EzX phones.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 recipes/freesmartphone/frameworkd_git.bb |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/recipes/freesmartphone/frameworkd_git.bb 
b/recipes/freesmartphone/frameworkd_git.bb
index 395a137..3d72d8f 100644
--- a/recipes/freesmartphone/frameworkd_git.bb
+++ b/recipes/freesmartphone/frameworkd_git.bb
@@ -4,9 +4,9 @@ AUTHOR = FreeSmartphone.Org Development Team
 SECTION = console/network
 DEPENDS = python-cython-native python-pyrex-native
 LICENSE = GPL
-SRCREV = 93673aa09cafc8fb5cfc3cb4055a73e25e595b70
+SRCREV = 7ee718456af30a7ab1069c4fad0fd33be319c2c8
 PV = 0.9.5.9+gitr${SRCPV}
-PR = r3
+PR = r4
 PE = 1
 
 inherit distutils update-rc.d python-dir
-- 
1.7.1




[PATCH 10/12] ezx-gen-blob: bump SRCREV

2010-05-31 Thread Antonio Ospite
The new version can now be compiled with OE with no problems, previously
the size of the binary produced with the toolchain from OE was too big
to be flashed.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 recipes/ezx/ezx-gen-blob_svn.bb |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/recipes/ezx/ezx-gen-blob_svn.bb b/recipes/ezx/ezx-gen-blob_svn.bb
index 9b56c24..39cec89 100644
--- a/recipes/ezx/ezx-gen-blob_svn.bb
+++ b/recipes/ezx/ezx-gen-blob_svn.bb
@@ -5,10 +5,10 @@ HOMEPAGE = http://people.openezx.org/wyrm/gen-blob;
 LICENSE = GPL
 PROVIDES = virtual/bootloader
 DEPENDS = virtual/kernel
-SRCREV = 2517
+SRCREV = 2519
 PV = 1.0.0+svnr${SRCPV}
 PE = 1
-PR = r1
+PR = r2
 
 SRC_URI = \
   svn://svn.openezx.org/trunk/src/blob/;module=gen-blob;proto=http \
-- 
1.7.1




[PATCH 08/12] motorola-ezx-base.inc: Add support for ubifs

2010-05-31 Thread Antonio Ospite
From: Ilya Petrov ilya.muro...@gmail.com

Signed-off-by: Ilya Petrov ilya.muro...@gmail.com
Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 conf/machine/include/motorola-ezx-base.inc |   17 +
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/conf/machine/include/motorola-ezx-base.inc 
b/conf/machine/include/motorola-ezx-base.inc
index 792919c..c90b327 100644
--- a/conf/machine/include/motorola-ezx-base.inc
+++ b/conf/machine/include/motorola-ezx-base.inc
@@ -39,6 +39,23 @@ PREFERRED_PROVIDER_virtual/xserver = xserver-kdrive
 IMAGE_FSTYPES ?= jffs2
 EXTRA_IMAGECMD_jffs2 = --pad=14680064 --little-endian --eraseblock=0x2 -n
 
+# In order to enable UIBIFS add uibi and ubifs 
+#IMAGE_FSTYPES += ubi ubifs
+
+# From dmesg:
+# UBI: smallest flash I/O unit:1
+# UBI: logical eraseblock size:131072 bytes
+# from ubiattach stdout:
+# UBI device number 0, total 1996 LEBs
+MKUBIFS_ARGS = -m 1 -e 130944 -c 487
+
+# from dmesg:
+# UBI: smallest flash I/O unit:1
+# UBI: physical eraseblock size:   131072 bytes (128 KiB)
+# UBI: sub-page size:  512
+UBINIZE_ARGS = -m 1 -p 128KiB 
+
+
 EXTRA_IMAGEDEPENDS += ezx-boot-usb-native ezx-gen-blob
 
 IMAGE_INSTALL_append += \
-- 
1.7.1




[PATCH 09/12] openezx-kernel_git: update recipe

2010-05-31 Thread Antonio Ospite
* bump KV
* bump SRCREV: The new version enables CONFIG_DEVTMPFS by default and
  some other stuff, and fixes usblan on gen2 when booting from MMC
* Provide a fallback CMDLINE
* Keep OABI config setting
* Use a -oe LOCALVERSION both in KV and in .config

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 recipes/linux/openezx-kernel_git.bb |   17 +
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/recipes/linux/openezx-kernel_git.bb 
b/recipes/linux/openezx-kernel_git.bb
index 55461d1..76929e0 100644
--- a/recipes/linux/openezx-kernel_git.bb
+++ b/recipes/linux/openezx-kernel_git.bb
@@ -1,10 +1,10 @@
 DESCRIPTION = OpenEZX 2.6 Linux Development Kernel for the Motorola EZX GSM 
phones
 AUTHOR = The OpenEZX Team openezx-devel@lists.openezx.org
 HOMEPAGE = http://www.openezx.org;
-SRCREV = b390bb1ee708277297fdfd38e26d955b17d81c2e
-KV = 2.6.33
+SRCREV = c485cc5953bbebdab1c52032754accca75031837
+KV = 2.6.34-oe
 PV = ${KV}+gitr${SRCREV}
-PR = r4
+PR = r5
 
 require linux.inc
 
@@ -25,7 +25,10 @@ S = ${WORKDIR}/git
 COMPATIBLE_HOST = arm.*-linux
 COMPATIBLE_MACHINE = '(a780|e680|a910|a1200|rorkre2|rokre6)'
 
-# The Kernel command line parameters are given via boot_usb or gen-blob
+# Provide a fallback kernel command line, even if parameters should be given
+# via boot_usb or gen-blob
+CMDLINE = console=tty1 root=/dev/mmcblk0p2 rootfstype=ext2 rootdelay=3 
ip=192.168.0.202:192.168.0.200:192.168.0.200:255.255.255.0
+ARM_KEEP_OABI = 1
 
 ###
 # module configs specific to this kernel
@@ -36,3 +39,9 @@ COMPATIBLE_MACHINE = '(a780|e680|a910|a1200|rorkre2|rokre6)'
 do_configure_prepend() {
install -m 0644 ${S}/arch/arm/configs/ezx_defconfig ${WORKDIR}/defconfig
 }
+
+# linux.inc overrides LOCAVERSION but we like to have one
+do_compile_prepend() {
+   sed -i -e '/CONFIG_LOCALVERSION=/d' ${S}/.config
+   echo 'CONFIG_LOCALVERSION=-oe' ${S}/.config
+}
-- 
1.7.1




[PATCH 07/12 v2] motorola-ezx-base.inc: refresh machine definition

2010-05-31 Thread Antonio Ospite
Reorder sections to a more logic scheme, following magician.conf, other
cleanups:

 * sort MACHINE_FEATURES alphabetically
 * add ezx-gen-blob to EXTRA_IMAGEDEPENDS
 * use MODUTILS=26
 * Add needed kernel modules for BP

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---

Changes since v1:

Drop the IMAGE_DEV_MANAGER =  bit, as Koen remarked this belongs to
image not machine.

Regards,
   Antonio

 conf/machine/include/motorola-ezx-base.inc |   43 +--
 1 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/conf/machine/include/motorola-ezx-base.inc 
b/conf/machine/include/motorola-ezx-base.inc
index 9ad2f14..3fb42f4 100644
--- a/conf/machine/include/motorola-ezx-base.inc
+++ b/conf/machine/include/motorola-ezx-base.inc
@@ -1,7 +1,16 @@
+# use this for overrides
+MACHINE_CLASS = motorola-ezx
+
+#
+# Hardware-based properties
+#
 TARGET_ARCH = arm
 
-PREFERRED_PROVIDER_virtual/xserver = xserver-kdrive
-PREFERRED_PROVIDER_virtual/kernel ?= openezx-kernel
+# Use tune-xscale per default. Machine independent feeds should be built with 
tune-strongarm.
+require conf/machine/include/tune-xscale.inc
+
+# Uncomment this to use iwmmxt optimizations. Remove the above xscale stuff 
first
+#require conf/machine/include/tune-iwmmxt.inc
 
 #cat /proc/mtd
 #dev:size   erasesize  name
@@ -10,34 +19,36 @@ PREFERRED_PROVIDER_virtual/kernel ?= openezx-kernel
 #mtd2: 0058 0002 VFM_Filesystem
 #mtd3: 0002 0002 Logo
 
-MACHINE_FEATURES = kernel26 touchscreen apm alsa bluetooth usbgadget usbhost 
keyboard screen phone
-MACHINE_FEATURES +=  iwmmxt
-
+ROOT_FLASH_SIZE = 24
+MACHINE_GUI_CLASS = smallscreen
 MACHINE_DISPLAY_WIDTH_PIXELS = 240
 MACHINE_DISPLAY_HEIGHT_PIXELS = 320
 MACHINE_DISPLAY_ORIENTATION = 0
 MACHINE_DISPLAY_PPI = 180
+MACHINE_FEATURES = alsa apm bluetooth kernel26 keyboard phone screen 
touchscreen usbgadget usbhost vfat
+MACHINE_FEATURES +=  iwmmxt
 
-# use this for overrides
-MACHINE_CLASS = motorola-ezx
-
+#
+# Software/packages selection
+#
+PREFERRED_PROVIDER_virtual/kernel ?= openezx-kernel
+MODUTILS = 26
 XSERVER = xserver-kdrive-fbdev
-
-ROOT_FLASH_SIZE = 24
+PREFERRED_PROVIDER_virtual/xserver = xserver-kdrive
 
 IMAGE_FSTYPES ?= jffs2
 EXTRA_IMAGECMD_jffs2 = --pad=14680064 --little-endian --eraseblock=0x2 -n
 
-EXTRA_IMAGEDEPENDS += ezx-boot-usb-native
+EXTRA_IMAGEDEPENDS += ezx-boot-usb-native ezx-gen-blob
 
-# the EZX phones need a userspace daemon to stop the BP from shutting down the 
phone
-MACHINE_ESSENTIAL_EXTRA_RDEPENDS += ezxd
+IMAGE_INSTALL_append += \
+  kernel-module-ohci-hcd \
+  kernel-module-moto-usb-ipc \
+  kernel-module-ts27010mux \
+
 
 # Ezxd needs to be started very early so we need the mux devices in static /dev
 IMAGE_DEVICE_TABLES = files/device_table-minimal.txt \
files/device_table-ezx.txt
 
-# Use tune-xscale per default. Machine independent feeds should be built with 
tune-strongarm.
-require conf/machine/include/tune-xscale.inc
-
 SERIAL_CONSOLE = 115200 ttyS0
-- 
1.7.1




Re: [PATCH 0/9] frameword: misc fixes for gen1 and gen2 EzX devices

2010-05-25 Thread Antonio Ospite
On Fri, 21 May 2010 17:05:15 +0200
Michael 'Mickey' Lauer mic...@vanille-media.de wrote:

 Thanks Antonio,
 
 all these patches look ok and I have applied them.


I missed sending the last one in my local branch, on its way.

 Looking forward to your patches against fsogsmd ;)


Looking at it right now, it will take some time tho.

 I will setup my A1200 to help you on that as soon as I have some more
 time.


Great, thanks.

Ciao ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpfH3w9kNGCt.pgp
Description: PGP signature


[PATCH 1/9] ogsmd: device.py, detect modem creation failure

2010-05-21 Thread Antonio Ospite
Some devices may be in a certain status that makes impossible to
initialize the modem, in these cases we should not instanciate the
actual Modem class and return None, so we need to detect that.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 framework/subsystems/ogsmd/device.py |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/framework/subsystems/ogsmd/device.py 
b/framework/subsystems/ogsmd/device.py
index a06802f..2c88d49 100644
--- a/framework/subsystems/ogsmd/device.py
+++ b/framework/subsystems/ogsmd/device.py
@@ -81,6 +81,11 @@ class Device( resource.Resource ):
 on_error( resource.ResourceError( estring ) )
 else:
 self.modem = Modem( self, self.bus )
+if self.modem is None:
+estring = Cannot create Modem %s % ( self.modemtype )
+logger.error( estring )
+on_error( resource.ResourceError( estring ) )
+return
 setCurrentModem( self.modem )
 self.modem.open( on_ok, on_error )
 
-- 
1.7.1




[PATCH 4/9] ogsmd: freescale_neptune, handle URCs on the Misc channel

2010-05-21 Thread Antonio Ospite
Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 .../ogsmd/modems/freescale_neptune/modem.py|1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py 
b/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
index f0597ac..2a405fc 100644
--- a/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
+++ b/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
@@ -103,6 +103,7 @@ class FreescaleNeptune( AbstractModem ):
 self._channels[CallAndNetwork].setDelegate( 
UnsolicitedResponseDelegate( self._object, mediator ) )
 self._channels[Sms].setDelegate( UnsolicitedResponseDelegate( 
self._object, mediator ) )
 self._channels[Sim].setDelegate( UnsolicitedResponseDelegate( 
self._object, mediator ) )
+self._channels[Misc].setDelegate( UnsolicitedResponseDelegate( 
self._object, mediator ) )
 
 def numberToPhonebookTuple( self, nstring ):
 
-- 
1.7.1




[PATCH 7/9] ogsmd: freescale_neptune, implement plusCLIP URC

2010-05-21 Thread Antonio Ospite
Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 .../ogsmd/modems/freescale_neptune/unsolicited.py  |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/framework/subsystems/ogsmd/modems/freescale_neptune/unsolicited.py 
b/framework/subsystems/ogsmd/modems/freescale_neptune/unsolicited.py
index 9480450..1e96c32 100644
--- a/framework/subsystems/ogsmd/modems/freescale_neptune/unsolicited.py
+++ b/framework/subsystems/ogsmd/modems/freescale_neptune/unsolicited.py
@@ -95,7 +95,10 @@ class UnsolicitedResponseDelegate( 
AbstractUnsolicitedResponseDelegate ):
 
 # +CLIP: +4969123456789,145
 def plusCLIP( self, righthandside ):
-pass
+number, ntype = safesplit( righthandside, ',' )
+if number and ntype:
+peer = const.phonebookTupleToNumber( number[1:-1], int(ntype) )
+self._mediator.Call.clip( self._object, peer)
 
 # +CMT: 139
 # 
07919471060040340409D041767A5C06903021417134408A41767A5C0625DDE6B70E247D87DB69F719947683C86539A858D581C2E273195D7693CBA0A05B5E37974130568D062A56A5AF66DAED6285DDEB77BB5D7693CBA0A05B5E3797413096CC062A56A5AF66DAED0235CB683928E936BFE7A0BA9B5E968356B45CEC66C3E170369A8C5673818E757A19242DA7E7E510
 
-- 
1.7.1




[PATCH 2/9] ogsmd: move _freescale_neptune_modemOn to __new__

2010-05-21 Thread Antonio Ospite
By moving _freescale_neptune_modemOn() from __init__() to __new__() we
can return None if the modem can't be initialized.

Note that now _freescale_neptune_modemOn() is a static method.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 .../ogsmd/modems/freescale_neptune/modem.py|   19 ---
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py 
b/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
index 11a3dbf..3de8257 100644
--- a/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
+++ b/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
@@ -76,16 +76,20 @@ class FreescaleNeptune( AbstractModem ):
 
 
 @logged
-def __init__( self, *args, **kwargs ):
-AbstractModem.__init__( self, *args, **kwargs )
-
+def __new__( cls, *args, **kwargs ):
 global initDone
 if not initDone:
-ret = self._freescale_neptune_modemOn()
-if not ret:
-return False
+ret = cls._freescale_neptune_modemOn()
+if ret == False:
+return None
 initDone = True
 
+return AbstractModem.__new__( cls, *args, **kwargs )
+
+@logged
+def __init__( self, *args, **kwargs ):
+AbstractModem.__init__( self, *args, **kwargs )
+
 # /dev/mux0
 self._channels[ CallAndNetwork ] = CallAndNetworkChannel( 
self.pathfactory, /dev/mux1, modem=self )
 # /dev/mux2
@@ -127,7 +131,8 @@ class FreescaleNeptune( AbstractModem ):
 def pathfactory(self, name):
 return name
 
-def _freescale_neptune_modemOn(self):
+@staticmethod
+def _freescale_neptune_modemOn():
 global muxfds
 logger.debug(** Modem init 
**)
 subprocess.check_call(['modprobe', 'ohci-hcd'])
-- 
1.7.1




[PATCH 9/9] ogsmd: freecale_neptune, cleanup channels init

2010-05-21 Thread Antonio Ospite
Send AT commands only to the appropriate channels.
Also reorganize the order of the channel classes in the code to reflect the
respective dlci line order.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 .../ogsmd/modems/freescale_neptune/channel.py  |   57 ++--
 1 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/framework/subsystems/ogsmd/modems/freescale_neptune/channel.py 
b/framework/subsystems/ogsmd/modems/freescale_neptune/channel.py
index 94b8574..b7b7b60 100644
--- a/framework/subsystems/ogsmd/modems/freescale_neptune/channel.py
+++ b/framework/subsystems/ogsmd/modems/freescale_neptune/channel.py
@@ -25,11 +25,20 @@ class EzxMuxChannel( AbstractModemChannel ):
 def __init__( self, *args, **kwargs ):
 AbstractModemChannel.__init__( self, *args, **kwargs )
 
+
+#=#
+class CallAndNetworkChannel( EzxMuxChannel ):
+#=#
+def __init__( self, *args, **kwargs ):
+EzxMuxChannel.__init__( self, *args, **kwargs )
+
+# FIXME we can't do this, since it is modem-wide (not VC-wide)
+#self.enqueue( +CMER=0,0,0,0,0 ) # unsolicited event reporting: none
+
 def _populateCommands( self ):
 AbstractModemChannel._populateCommands( self ) # default command init
 
-c = self._commands[init]
-c.append( '+USBSTAT=255,1' )   # charge
+c = self._commands[init] = []
 
 c.append( '+EPOM=1,0' ) # Ezx Power On Modem
 c.append( '+EAPF=12,1,0' ) # ??
@@ -48,23 +57,19 @@ class EzxMuxChannel( AbstractModemChannel ):
 c.append( +CGEREP=2,1 )
 c.append( +CGREG=2 )
 
-#=#
-class CallAndNetworkChannel( EzxMuxChannel ):
-#=#
-def __init__( self, *args, **kwargs ):
-EzxMuxChannel.__init__( self, *args, **kwargs )
+self._commands[sim] = []
 
-# FIXME we can't do this, since it is modem-wide (not VC-wide)
-#self.enqueue( +CMER=0,0,0,0,0 ) # unsolicited event reporting: none
 
 #=#
-class MiscChannel( EzxMuxChannel ):
+class SmsChannel( EzxMuxChannel ):
 #=#
 def __init__( self, *args, **kwargs ):
 EzxMuxChannel.__init__( self, *args, **kwargs )
 
-# FIXME we can't do this, since it is modem-wide (not VC-wide)
-#self.enqueue( +CMER=0,0,0,0,0 ) # unsolicited event reporting: none
+def _populateCommands( self ):
+AbstractModemChannel._populateCommands( self ) # default command init
+
+self._commands[init] = []
 
 # This modem needs a special SIM init sequence otherwise GSM 07.07 SMS 
commands won't succeed
 c = self._commands[sim] = []
@@ -73,18 +78,36 @@ class MiscChannel( EzxMuxChannel ):
 c.append( +EPMS? )
 c.append( +EMGL=4 )
 
-def modemStateSimUnlocked( self, *args, **kwargs ):
-# we _should_ be ready now, alas we can't check for sure :(
-self._modem._object.ReadyStatus( True )
 
 #=#
-class SmsChannel( EzxMuxChannel ):
+class SimChannel( EzxMuxChannel ):
 #=#
 def __init__( self, *args, **kwargs ):
 EzxMuxChannel.__init__( self, *args, **kwargs )
 
+def _populateCommands( self ):
+AbstractModemChannel._populateCommands( self ) # default command init
+
+self._commands[init] = []
+
+
 #=#
-class SimChannel( EzxMuxChannel ):
+class MiscChannel( EzxMuxChannel ):
 #=#
 def __init__( self, *args, **kwargs ):
 EzxMuxChannel.__init__( self, *args, **kwargs )
+
+# FIXME we can't do this, since it is modem-wide (not VC-wide)
+#self.enqueue( +CMER=0,0,0,0,0 ) # unsolicited event reporting: none
+
+def modemStateSimUnlocked( self, *args, **kwargs ):
+# we _should_ be ready now, alas we can't check for sure :(
+self._modem._object.ReadyStatus( True )
+
+def _populateCommands( self ):
+AbstractModemChannel._populateCommands( self ) # default command init
+
+c = self._commands[init] = []
+c.append( '+USBSTAT=255,1' )   # charge
+
+self._commands[sim] = []
-- 
1.7.1




Re: [Fwd: Re: Kernel source code]

2010-05-18 Thread Antonio Ospite
On Mon, 17 May 2010 22:14:33 -0300
angelo ang...@angeste.com.br wrote:

 Antonio Ospite escreveu:
  On Mon, 17 May 2010 11:59:02 -0300
  angelo ang...@angeste.com.br wrote:
 

  Andreas Mohr escreveu:
  
  On Sun, May 16, 2010 at 12:00:01PM +0200, 
  openezx-devel-requ...@lists.openezx.org wrote:


  Do you have any patch to the kernel recognize the sd-card?
 
  Show error:
 
  /mmc0: unrecognized SCR structure version 2.
  mmc0: error -22 whilst initialising SD card./
  
  
  Do some internet research.
 
  This is the error message that I had been debugging quite a while ago,
  unsuccessfully at that time, unfortunately.
  Some months later someone else fortunately managed to nail it:
  it is an SD struct member mis-alignment issue (quite directly causing the
  unrecognized SCR structure version 2 message), patch _is_ available,
  but I don't know any specifics now, would need research to find this
  patch (I publicly thanked the one who managed to fix it, though).
 
  Andreas Mohr
   

  I found here: http://lists.denx.de/pipermail/u-boot/2009-April/050516.html
  It this patch?
 
 
  
 
  This patch is for u-boot, not for linux kernel.
 
  Ciao,
 Antonio
 

 I have found the correct patch,but i receive a error of permission
  I had tried to edit permissions,but  do not effect Can help Me?


Please send the exact error you get, otherwise we cannot do any guess
about what the cause is.

Also, tell where the correct patch is, so others will find with search
engines in future.

Ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpPVx81QJt1s.pgp
Description: PGP signature


Re: [Fwd: Re: Kernel source code]

2010-05-18 Thread Antonio Ospite
On Tue, 18 May 2010 10:18:29 -0300
angelo ang...@angeste.com.br wrote:

  
  Do you have any patch to the kernel recognize the sd-card?
 
  Show error:
 
  /mmc0: unrecognized SCR structure version 2.
  mmc0: error -22 whilst initialising SD card./
  
[...]

 I had resolve the problem... But the correct patch is:
 http://www.rpsys.net/openzaurus/patches/mmcsd_no_scr_check-r2.patch
 

So with this one you can get the latest kernel to work with your card?
This workaround is different from the fix Andreas was pointing to,
isnt'it?

Ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpKRhsxsJzUQ.pgp
Description: PGP signature


Re: [Fwd: Re: Kernel source code]

2010-05-18 Thread Antonio Ospite
On Tue, 18 May 2010 12:49:13 -0300
angelo ang...@angeste.com.br wrote:


  I had resolve the problem... But the correct patch is:
  http://www.rpsys.net/openzaurus/patches/mmcsd_no_scr_check-r2.patch
  
 
  So with this one you can get the latest kernel to work with your card?
  This workaround is different from the fix Andreas was pointing to,
  isnt'it?
 
  Ciao,
 Antonio
 
 This patch work with the Linux Kernel 2.6.24... I use it.
 
  Now i having problems to init the rootfs,But ok,i having help with my 
 friends Thanks.
 Angelo


So you didn't try latest openezx kernel (now updated to 2.6.34), with or
without that patch, did you?

Ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpHs73BJurQj.pgp
Description: PGP signature


Re: [Fwd: Re: Kernel source code]

2010-05-17 Thread Antonio Ospite
On Mon, 17 May 2010 11:59:02 -0300
angelo ang...@angeste.com.br wrote:

 Andreas Mohr escreveu:
  On Sun, May 16, 2010 at 12:00:01PM +0200, 
  openezx-devel-requ...@lists.openezx.org wrote:

  Do you have any patch to the kernel recognize the sd-card?
 
  Show error:
 
  /mmc0: unrecognized SCR structure version 2.
  mmc0: error -22 whilst initialising SD card./
  
 
  Do some internet research.
 
  This is the error message that I had been debugging quite a while ago,
  unsuccessfully at that time, unfortunately.
  Some months later someone else fortunately managed to nail it:
  it is an SD struct member mis-alignment issue (quite directly causing the
  unrecognized SCR structure version 2 message), patch _is_ available,
  but I don't know any specifics now, would need research to find this
  patch (I publicly thanked the one who managed to fix it, though).
 
  Andreas Mohr
   
 
 I found here: http://lists.denx.de/pipermail/u-boot/2009-April/050516.html
 It this patch?
 
 

This patch is for u-boot, not for linux kernel.

Ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpYVXXzAF1S6.pgp
Description: PGP signature


Re: [Fwd: Re: Kernel source code]

2010-05-15 Thread Antonio Ospite
On Sat, 15 May 2010 16:30:17 -0300
angelo ang...@angeste.com.br wrote:

 Antonio Ospite escreveu:
  On Sat, 15 May 2010 13:51:55 -0300
  angelo ang...@angeste.com.br wrote:
[...]
 
  Angelo if you are interested in having latest openezx kernel working,
  follow the guide on the wiki.
  http://wiki.openezx.org/Kernel_hacking_-_linux-2.6
  and tell us the _exact_ message the kernel gives you.
 
[...]
 Please,can you show to me one alternate link  for  download  the latest  
 openezx  kernel? I can not download from the git...
 

You can grab a .tgz snapshot from here:
http://git.openezx.org/openezx.git?a=snapshot;h=refs/heads/ezx/current;sf=tgz

or clone via http if the git protocol is blocked by some firewall:
git clone http://git.openezx.org/openezx.git
(note that you won't get progress report via http you just have to
wait for the clone operation to complete, with no visual feedback)

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpOEKruWwzPS.pgp
Description: PGP signature


Re: boot_usb kernel uploading

2010-05-14 Thread Antonio Ospite
On Fri, 14 May 2010 08:25:22 + (UTC)
Dmitri Hrapof hra...@common-lisp.ru wrote:

 Hello!
 
 I've tried A) part of http://wiki.openezx.org/Getting_Started
 with my A780 and A1200.
 Everything worked with A1200, but boot_usb failed to upload kernel 
 to A780. I used both precompiled boot_usb and boot_usb from svn, 
 but uploading just stopped at various places - 13%, 20%, etc.
 I used precompiled gen-blob.
 Is there anything I can try with A780 to solve this?

Try commenting out
//#define USECS_SLEEP 500
in boot_usb.c, line 46, recompile and let us know.

 (I'm using A1200 as my day-to-day phone, so I'd like to experiment with
 A780 :)


Cool, let us know also if you want to get more involved in openezx, stop
by #openezx IRC channel on FreeNode if you have some time.

 Thanks,
 Dmitri
 

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpO4nN0T5BbH.pgp
Description: PGP signature


Re: boot_usb kernel uploading

2010-05-14 Thread Antonio Ospite
On Fri, 14 May 2010 10:41:50 + (UTC)
Dmitri Hrapof hra...@common-lisp.ru wrote:

 Antonio Ospite ospite at studenti.unina.it writes:
 
  Try commenting out
  //#define USECS_SLEEP 500
  in boot_usb.c, line 46, recompile and let us know.
 
 It was commented, I uncommented both it and DEBUG, ie
 
 #define USECS_SLEEP 500 
 
 #define DEBUG 
 
 and managed to get the kernel to my A780. Thank you very much!


Yes I mean UNcomment, sorry. Are you sure that uncommenting
DEBUG is strictly required?

  Cool, let us know also if you want to get more involved in openezx, stop
 
 My plan is to debug my (non-existent yet) app on FreeRunner and then put it 
 on a
 phone with built-in camera. Tried to obtain a developer's certificate from
 Motorola (to code in Java), but it's unavailable for a1200/a780. So, I hope to
 need working camera, wi-fi, GPRS and bluetooth in OpenEZX by the end of the 
 year
 (if carrying a webcam together with FreeRunner is sufficiently inconvenient) 
 :)


wi-fi is tricky on A780/A1200 (there are MicroSD wi-fi adapter that
should work, but no one tested them on EzX phones so far; IIRC someone
used a SD wifi module on E6 tho) and GPRS, well I don't think we
ever even tried to use it with OpenEZX. Camera and bluetooth should be
mostly OK.

  if you have some time.
 
 I wish I had :)
 

Ciao ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpf80kx2MXT0.pgp
Description: PGP signature


Re: Kernel source code

2010-05-14 Thread Antonio Ospite
On Fri, 14 May 2010 18:59:56 -0300
angelo ang...@angeste.com.br wrote:

 Hello
 I am from Brazil,and i need a old version of OpenEzx kernel source code. 
 Do you have the Download link for anything old version? My SD card is 
 only recognized by a  compiled version,but  not work  correctly,i need 
 old source of kernel for me .


Hi Angelo, if you know what kernel version you need you could try
getting it from the git repository itself by grepping through the
history. Give us more details.

If instead a simple patch is needed to make your SD work, maybe we could
consider adding it to our repository so you can track the latest kernel
version.

 Thank you,and sorry by my bad english.
 Angelo


Regards,
   Antonio

P.S. Consider subscribing to the list, I had to pass your message
manually.

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpZJQFza4BaN.pgp
Description: PGP signature


Re: [oe] gen-blob size with gcc-4.4.2 SOLVED? (was: [PATCH 0/5] Misc updates for EZX bits in OE)

2010-04-23 Thread Antonio Ospite
WARNING:
This was going to be a
  I didn't know what I was doing but it worked
kind of post, but then I did some homework and now I think I know a bit
more about what I did :)

The post below is quite lengthy as it contains all the steps I went
through in order to come to some conclusions.

On Fri, 26 Mar 2010 16:17:24 +0100
Antonio Ospite osp...@studenti.unina.it wrote:

 On Thu, 25 Mar 2010 13:39:00 -0700
 Khem Raj raj.k...@gmail.com wrote:
 
  On (25/03/10 18:19), Antonio Ospite wrote:
[...]
   Note that although ezx-gen-blob builds fine now, it seems to have issues 
   with
   GCC 4.4: the binary size is about 300KiB instead of the expected 64KiB, if
   anyone has a clue please let me know.
 

Comparing the section sizes for the two binaries:
   textdata bss dec hex filename
  40212   20764  244356  305332   4a8b4 blob-rest-elf32-with-gcc-4.1.2
  39595  265124   4  304723   4a653 blob-rest-elf32-with-gcc-4.4.2

So something fishing about the data and bss sections. After reading
a bit about what ELF sections are[0,1] I'd guess gcc-4.4.2 might be
forcing initializations for uninitialized data putting it in the
binary image and that makes the object file size grow.

This explanation would also help me to understand more the warning
message:
.../arm-oe-linux-gnueabi/bin/ld:
warning: section `.bss' type changed to PROGBITS

  I can help you here. If you can give me the two images with symbols and
  your linking script it uses. Secondly are you using same binutils/ld in
  both cases ?
 


I also had to learn what a linker script[2] is, it can be used to
define sections properties and object files layout, right?
The one used by blob/gen-blob is here:
http://svn.openezx.org/trunk/src/blob/gen-blob/src/blob/rest-ld-script.in

Now, looking at the bss section, I noted that there is a nested
stack section, this is different from the other sections, so as a
first naive/blind try I changed that from:
. = ALIGN(4);
.bss : {
__bss_start = .;
/* first the real BSS data */
*(.bss) 

/* and next the stack */
. = ALIGN(4);
__stack_start = .;
*(.stack)
__stack_end = .;
__bss_end = .;
}
to
/* the BSS section should *always* be the last section */
. = ALIGN(4);
.bss : {
__bss_start = .;
/* first the real BSS data */
*(.bss) 
__bss_end = .;
}

/* and next the stack */
. = ALIGN(4);
.stack : {
__stack_start = .;
*(.stack)
__stack_end = .;
}

And the binary sizes is now:
   textdata bss dec hex filename
  40212   20764  244356  305332   4a8b4 blob-rest-elf32-with-gcc-4.1.2
  39595   20772  227972  288339   46653 blob-rest-elf32-with-gcc-4.4.2

The strange thing is that after this blind change from a very rough
guess-work the binary even seemed to work... so I did some more research
to figure out a more correct solution.

I found out somewhere on the interwebs that the nesting shouldn't be a
problem, and that stack size can be defined directly inside the
linker script, like in [3], so I tried with this change (getting the
actual stack size from src/blob/stack.S):

Index: gen-blob-with-gcc-4.4.2/src/blob/rest-ld-script.in
===
--- gen-blob-with-gcc-4.4.2.orig/src/blob/rest-ld-script.in
+++ gen-blob-with-gcc-4.4.2/src/blob/rest-ld-script.in
@@ -97,7 +97,8 @@
/* and next the stack */
. = ALIGN(4);
__stack_start = .;
-   *(.stack)
+   /* allocate a 16kB stack */
+   . = . + 16 * 1024;
__stack_end = .;
__bss_end = .;


Sizes are now:
   textdata bss dec hex filename
  40212   20764  244356  305332   4a8b4 blob-rest-elf32-with-gcc-4.1.2
  39595   20772  244356  304723   4a653 blob-rest-elf32-with-gcc-4.4.2

bss size matches, this a good sign, not a coincidence, isnt'it? And
the binary still works. Is that really ok?

[...]
 I am using the very ld the toolchain provides, so I they are
 different, and I noted than the 4.4.2 one gives this warning:
 .../arm-oe-linux-gnueabi/bin/ld:
 warning: section `.bss' type changed to PROGBITS


This warning goes away with either the changes above.

So the last patch above would look ok to me, I think I figured out WHAT
was happening, but I don't understand WHY this change is necessary.
Is that the section name .stack defined in stack.S is not recognized?
If so, why?

Khem I am now only asking you if you can help me understand why newer
GCCs don't behave in the same way as older ones wrt. this aspect.
Thanks.

 The problem seems to rise during linking indeed, the size difference
 of .o files produced by the two toolchains is ~ 3 KiB

Re: [oe] gen-blob size with gcc-4.4.2 SOLVED? (was: [PATCH 0/5] Misc updates for EZX bits in OE)

2010-04-23 Thread Antonio Ospite
On Fri, 23 Apr 2010 09:45:04 -0700
Khem Raj raj.k...@gmail.com wrote:

 On Fri, Apr 23, 2010 at 5:28 AM, Antonio Ospite
 osp...@studenti.unina.it wrote:
[...]
  On Fri, 26 Mar 2010 16:17:24 +0100
  Antonio Ospite osp...@studenti.unina.it wrote:
 
  On Thu, 25 Mar 2010 13:39:00 -0700
  Khem Raj raj.k...@gmail.com wrote:
 
   On (25/03/10 18:19), Antonio Ospite wrote:
  [...]
Note that although ezx-gen-blob builds fine now, it seems to have 
issues with
GCC 4.4: the binary size is about 300KiB instead of the expected 
64KiB, if
anyone has a clue please let me know.
  
 
  Comparing the section sizes for the two binaries:
    text    data     bss     dec     hex filename
   40212   20764  244356  305332   4a8b4 blob-rest-elf32-with-gcc-4.1.2
   39595  265124       4  304723   4a653 blob-rest-elf32-with-gcc-4.4.2
 
  So something fishing about the data and bss sections. After reading
  a bit about what ELF sections are[0,1] I'd guess gcc-4.4.2 might be
  forcing initializations for uninitialized data putting it in the
  binary image and that makes the object file size grow.
 
[...]
 
  Index: gen-blob-with-gcc-4.4.2/src/blob/rest-ld-script.in
  ===
  --- gen-blob-with-gcc-4.4.2.orig/src/blob/rest-ld-script.in
  +++ gen-blob-with-gcc-4.4.2/src/blob/rest-ld-script.in
  @@ -97,7 +97,8 @@
                 /* and next the stack */
                 . = ALIGN(4);
                 __stack_start = .;
  -               *(.stack)
  +               /* allocate a 16kB stack */
  +               . = . + 16 * 1024;
                 __stack_end = .;
                 __bss_end = .;
 
 
 
 you already have this in stack.S so its not needed. The correct fix would be 
 to
 classify the output segment as NOLOAD explicitly like this
 
   .bss(NOLOAD) : {
   __bss_start = .;
   /* first the real BSS data */
   *(.bss)
 
   /* and next the stack */
   . = ALIGN(4);
   __stack_start = .;
   *(.stack)
   __stack_end = .;
   __bss_end = .;
   }
 
 you should not need any other changes.
 

This works in fact. Thanks a lot.

  I am using the very ld the toolchain provides, so I they are
  different, and I noted than the 4.4.2 one gives this warning:
  .../arm-oe-linux-gnueabi/bin/ld:
  warning: section `.bss' type changed to PROGBITS
 
 
 The problem is the .stack is
 not a special nobits section like .bss is so when you club is together
 in .bss then
 there is a mismatch and hence the warning.
 

I see, so when using a recent binutils: being .stack considered progbits
by default, .bss —containing it— is changed to progbits as well if we
don't specify otherwise. While with older binutils .bss was kept nobits
in any case?

Thanks again.

Best wishes,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpG7MGR7iabR.pgp
Description: PGP signature


Re: [oe] [PATCH 0/5] Misc updates for EZX bits in OE

2010-04-15 Thread Antonio Ospite
On Fri, 26 Mar 2010 16:17:24 +0100
Antonio Ospite osp...@studenti.unina.it wrote:

 On Thu, 25 Mar 2010 13:39:00 -0700
 Khem Raj raj.k...@gmail.com wrote:
 
  On (25/03/10 18:19), Antonio Ospite wrote:
   Hi,
   
   here are some updates for EZX bits in OE.
   
   With these changes we have a working image to experiment with ts27010mux
   driver and ezxd, no fso support yet. Tested on Motorola A780.
   
   Note that although ezx-gen-blob builds fine now, it seems to have issues 
   with
   GCC 4.4: the binary size is about 300KiB instead of the expected 64KiB, if
   anyone has a clue please let me know.
  
  I can help you here. If you can give me the two images with symbols and
  your linking script it uses. Secondly are you using same binutils/ld in
  both cases ?
 
 
 Here are more details:
 A gcc-4.1.2 toolchain[1] produces the expected result,
 the current gcc-4.4.2 toolchain[2] from 'minimal' distro does not.


Hi Khem, would you be able to take a look at this?
The attachments I sent in the old mail are still available here:
http://thread.gmane.org/gmane.comp.handhelds.openembedded/31488/focus=31520

Thanks,
   Antonio

 I am using the very ld the toolchain provides, so I they are
 different, and I noted than the 4.4.2 one gives this warning:
 .../arm-oe-linux-gnueabi/bin/ld:
 warning: section `.bss' type changed to PROGBITS
 
 The problem seems to rise during linking indeed, the size difference
 of .o files produced by the two toolchains is ~ 3 KiB overall, it does
 not seem to justify the bump I have after linking to more than 200KiB.
 
 I am attaching here the two binaries before stripping, but also some
 scripts to easily recreate the entire scenario, since I am not sure of
 what you exactly need to find out what's happening.
 The command used for linking is attached as well.
 
 Thanks,
Antonio
 

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgp8y2SGASU9w.pgp
Description: PGP signature


[PATCH] ogsmd: add freescale_neptune init routine

2010-04-15 Thread Antonio Ospite
This allows BP init to complete successfully on EZX phones without
having to rely on ezxd.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 .../ogsmd/modems/freescale_neptune/modem.py|   88 +---
 1 files changed, 76 insertions(+), 12 deletions(-)
 mode change 100644 = 100755 
framework/subsystems/ogsmd/modems/freescale_neptune/modem.py

diff --git a/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py 
b/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
old mode 100644
new mode 100755
index e6b4fd3..11a3dbf
--- a/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
+++ b/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
@@ -28,8 +28,23 @@ from .unsolicited import UnsolicitedResponseDelegate
 from ogsmd.gsm.decor import logged
 from ogsmd.gsm.channel import AtCommandChannel
 
+import logging
+logger = logging.getLogger( MODULE_NAME )
+
 import types
 
+import os
+import sys
+import errno
+import fcntl
+import termios
+import array
+import time
+import subprocess
+
+muxfds = []
+initDone = False
+
 #=#
 class FreescaleNeptune( AbstractModem ):
 #=#
@@ -64,22 +79,27 @@ class FreescaleNeptune( AbstractModem ):
 def __init__( self, *args, **kwargs ):
 AbstractModem.__init__( self, *args, **kwargs )
 
+global initDone
+if not initDone:
+ret = self._freescale_neptune_modemOn()
+if not ret:
+return False
+initDone = True
+
 # /dev/mux0
-self._channels[ CallAndNetwork ] = CallAndNetworkChannel( 
self.pathfactory, /dev/mux0, modem=self )
+self._channels[ CallAndNetwork ] = CallAndNetworkChannel( 
self.pathfactory, /dev/mux1, modem=self )
 # /dev/mux2
-self._channels[ Sms ] = SmsChannel( self.pathfactory, /dev/mux2, 
modem=self )
+self._channels[ Sms ] = SmsChannel( self.pathfactory, /dev/mux3, 
modem=self )
 # /dev/mux4
 self._channels[ Sim ] = SimChannel( self.pathfactory, /dev/mux4, 
modem=self )
 # /dev/mux6
-self._channels[ Misc ] = MiscChannel( self.pathfactory, /dev/mux6, 
modem=self )
+self._channels[ Misc ] = MiscChannel( self.pathfactory, /dev/mux5, 
modem=self )
 
 # configure channels
 self._channels[CallAndNetwork].setDelegate( 
UnsolicitedResponseDelegate( self._object, mediator ) )
 self._channels[Sms].setDelegate( UnsolicitedResponseDelegate( 
self._object, mediator ) )
 self._channels[Sim].setDelegate( UnsolicitedResponseDelegate( 
self._object, mediator ) )
 
-self._initDone = None
-
 def numberToPhonebookTuple( self, nstring ):
 
 Modem violating GSM 07.07 here. It always includes the '+' for 
international numbers,
@@ -104,11 +124,55 @@ class FreescaleNeptune( AbstractModem ):
 else:
 return self._channels[Misc]
 
-def pathfactory( self, name ):
-
-Overridden for internal purposes. Shut down OpenEZX lowlevel 
initialization daemon.
-
-if self._initDone is None:
-self._initDone = True
-killall( EZXD_PROCESS_NAME )
+def pathfactory(self, name):
 return name
+
+def _freescale_neptune_modemOn(self):
+global muxfds
+logger.debug(** Modem init 
**)
+subprocess.check_call(['modprobe', 'ohci-hcd'])
+time.sleep(2)
+subprocess.check_call(['modprobe', 'moto-usb-ipc'])
+subprocess.check_call(['modprobe', 'ts27010mux'])
+
+N_TS2710 = 19
+dlci_lines = [0, 1, 2, 3, 4, 5, 6, 7, 8]
+devpath  = /dev/ttyIPC0
+counter = 10
+
+# Loop when opening /dev/ttyIPC0 to have some tolerance
+ipc = None
+while True:
+logger.debug(Trying to open %s... % devpath)
+counter -= 1
+try:
+ipc = os.open(devpath, os.O_RDWR)
+except OSError as e:
+if e.errno == errno.ENODEV:
+continue
+
+if ipc or counter == 0:
+break
+
+if not ipc:
+logger.error(Error opening %s % devpath)
+return False
+
+logger.debug(Setting ldisc)
+line = array.array('i', [N_TS2710])
+ret = fcntl.ioctl(ipc, termios.TIOCSETD, line, 1)
+if ret != 0:
+logger.error(ioctl error %s % devpath)
+return False
+
+for dlci in dlci_lines:
+devpath = /dev/mux%d % dlci
+try:
+fd = os.open(devpath, os.O_RDWR | os.O_NOCTTY)
+except OSError as e:
+logger.error(%s: %s % (devpath, e.strerror))
+return False
+
+logger.debug(Opened %s % devpath)
+muxfds.append(fd)
+return True

ts27010mux support in FSO framworkd

2010-03-31 Thread Antonio Ospite
Hi,

with the following patch we can use frameworkd[1] from FSO[2] without
even ezxd. I only tested it with cli-framework because fso-zhone-image
does not build in OE right now (TBH even fso-console-image has a little
problem [3,4]).

The point is about getting at least something working. Note that 
_modprobe_ for BP modules is deferred until the modem object is created,
this prevents the phone from shutting off. Any comments? Mickeyl, can I
send it for inclusion as it is now?

With these changes I can send SMSs and I can see SMSs coming in, even if
it looks like the GSM carrier is not aware I received the message and
keeps sending it to me. I can read the message without confirming the
GSM provider that I received it, is that normal?

I'll spend some more time trying to have the fso-zhone-image working, so
that people can play with ogsmd, while I study fsogsmd[5].

Ciao ciao,
   Antonio

[1] http://git.freesmartphone.org/?p=framework.git;a=summary
[2] http://www.freesmartphone.org/
[3] http://bugs.openembedded.org/show_bug.cgi?id=5385
[4] http://thread.gmane.org/gmane.comp.handhelds.openembedded/31506
[5] http://wiki.freesmartphone.org/index.php/Implementations/fsogsmd


diff --git a/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py 
b/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
index e6b4fd3..77040f1 100644
--- a/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
+++ b/framework/subsystems/ogsmd/modems/freescale_neptune/modem.py
@@ -28,8 +28,23 @@ from .unsolicited import UnsolicitedResponseDelegate
 from ogsmd.gsm.decor import logged
 from ogsmd.gsm.channel import AtCommandChannel
 
+import logging
+logger = logging.getLogger( MODULE_NAME )
+
 import types
 
+import os
+import sys
+import errno
+import fcntl
+import termios
+import array
+import time
+import subprocess
+
+muxfds = []
+initDone = False
+
 #=#
 class FreescaleNeptune( AbstractModem ):
 #=#
@@ -64,22 +79,27 @@ class FreescaleNeptune( AbstractModem ):
 def __init__( self, *args, **kwargs ):
 AbstractModem.__init__( self, *args, **kwargs )
 
+global initDone
+if not initDone:
+ret = self._freescale_neptune_modemOn()
+if not ret:
+return False
+initDone = True
+
 # /dev/mux0
-self._channels[ CallAndNetwork ] = CallAndNetworkChannel( 
self.pathfactory, /dev/mux0, modem=self )
+self._channels[ CallAndNetwork ] = CallAndNetworkChannel( 
self.pathfactory, /dev/mux1, modem=self )
 # /dev/mux2
-self._channels[ Sms ] = SmsChannel( self.pathfactory, /dev/mux2, 
modem=self )
+self._channels[ Sms ] = SmsChannel( self.pathfactory, /dev/mux3, 
modem=self )
 # /dev/mux4
 self._channels[ Sim ] = SimChannel( self.pathfactory, /dev/mux4, 
modem=self )
 # /dev/mux6
-self._channels[ Misc ] = MiscChannel( self.pathfactory, /dev/mux6, 
modem=self )
+self._channels[ Misc ] = MiscChannel( self.pathfactory, /dev/mux5, 
modem=self )
 
 # configure channels
 self._channels[CallAndNetwork].setDelegate( 
UnsolicitedResponseDelegate( self._object, mediator ) )
 self._channels[Sms].setDelegate( UnsolicitedResponseDelegate( 
self._object, mediator ) )
 self._channels[Sim].setDelegate( UnsolicitedResponseDelegate( 
self._object, mediator ) )
 
-self._initDone = None
-
 def numberToPhonebookTuple( self, nstring ):
 
 Modem violating GSM 07.07 here. It always includes the '+' for 
international numbers,
@@ -104,11 +124,56 @@ class FreescaleNeptune( AbstractModem ):
 else:
 return self._channels[Misc]
 
-def pathfactory( self, name ):
-
-Overridden for internal purposes. Shut down OpenEZX lowlevel 
initialization daemon.
-
-if self._initDone is None:
-self._initDone = True
-killall( EZXD_PROCESS_NAME )
+def pathfactory(self, name):
 return name
+
+def _freescale_neptune_modemOn(self):
+global muxfds
+logger.debug(** Modem init 
**)
+subprocess.check_call(['modprobe', 'ohci-hcd'])
+time.sleep(2)
+subprocess.check_call(['modprobe', 'moto-usb-ipc'])
+subprocess.check_call(['modprobe', 'ts27010mux'])
+
+N_TS2710 = 19
+dlci_lines = [0, 1, 2, 3, 4, 5, 6, 7, 8]
+devpath  = /dev/ttyIPC0
+counter = 10
+
+# Loop when opening /dev/ttyIPC0 to have some tolerance
+ipc = None
+while True:
+logger.debug(Trying to open %s... % devpath)
+counter -= 1
+try:
+ipc = os.open(devpath, os.O_RDWR)
+except OSError as e:
+if e.errno == errno.ENODEV:
+continue 
+
+  

Re: [oe] [PATCH 0/5] Misc updates for EZX bits in OE

2010-03-26 Thread Antonio Ospite
On Fri, 26 Mar 2010 16:17:24 +0100
Antonio Ospite osp...@studenti.unina.it wrote:

 Here are more details:
 A gcc-4.1.2 toolchain[1] produces the expected result,
 the current gcc-4.4.2 toolchain[2] from 'minimal' distro does not.
 

Forgot the refs in previous mail even if they were in the attached
script. And I hope the attached 600KB didn't annoy people _too_much_

Regards,
   Antonio

[1]
http://ezxdev.org/qtopia/sdk/arm-angstrom-linux-gnueabi-4.1.2.tar.bz2
[2]
http://people.openezx.org/ao2/deploy/sdk/minimal-dev-snapshot-20100323-x86_64-linux-armv5te-linux-gnueabi-toolchain.tar.bz2

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpydSzMWhG1P.pgp
Description: PGP signature


[PATCH 1/5] ezx: update openezx-kernel version

2010-03-25 Thread Antonio Ospite
This version uses an adapted ts27010mux driver from Motorola Milestone.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 conf/distro/include/sane-srcrevs.inc |2 +-
 recipes/linux/openezx-kernel_git.bb  |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/conf/distro/include/sane-srcrevs.inc 
b/conf/distro/include/sane-srcrevs.inc
index da44903..7e08ca0 100644
--- a/conf/distro/include/sane-srcrevs.inc
+++ b/conf/distro/include/sane-srcrevs.inc
@@ -138,7 +138,7 @@ SRCREV_pn-ologicd ?= 
4a32af91a9479ebd4d1d39057354ac9904d74cbb
 SRCREV_pn-om-locations ?= 942e88a1b689ffe3f11a2d982cce389cc965b2ec
 SRCREV_pn-openbsc ?= 5e68183a201ab92f29cd2467df5209f7b351a66d
 SRCREV_pn-openbsc-onwaves ?= 0d9ed87d5c7d5b6e21dc3bbb282e215068742566
-SRCREV_pn-openezx-kernel ?= 43b844d1d38f0343272d3f0f844f80666186c526
+SRCREV_pn-openezx-kernel ?= b390bb1ee708277297fdfd38e26d955b17d81c2e
 SRCREV_pn-openmoko-footer ?= 2354
 SRCREV_pn-openmoko-terminal2 ?= 4782
 SRCREV_pn-openmoocow ?= 39648419825cddfea1cb1321e552a12b71fede14
diff --git a/recipes/linux/openezx-kernel_git.bb 
b/recipes/linux/openezx-kernel_git.bb
index 64fac44..a986b4a 100644
--- a/recipes/linux/openezx-kernel_git.bb
+++ b/recipes/linux/openezx-kernel_git.bb
@@ -1,9 +1,9 @@
 DESCRIPTION = OpenEZX 2.6 Linux Development Kernel for the Motorola EZX GSM 
phones
 AUTHOR = The OpenEZX Team openezx-devel@lists.openezx.org
 HOMEPAGE = http://www.openezx.org;
-KV = 2.6.29+2.6.30rc2
+KV = 2.6.33
 PV = ${KV}+gitr${SRCREV}
-PR = r3
+PR = r4
 
 require linux.inc
 
-- 
1.7.0.3




[PATCH 5/5] ezx: update device_table-ezx.txt

2010-03-25 Thread Antonio Ospite
Update mux nodes to be used with the ts27010mux driver.
Fix names for ttyIPC0 and video0 nodes.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 files/device_table-ezx.txt |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/files/device_table-ezx.txt b/files/device_table-ezx.txt
index f477a67..7246bc8 100644
--- a/files/device_table-ezx.txt
+++ b/files/device_table-ezx.txt
@@ -8,7 +8,7 @@
 #b Block special device file
 #p Fifo (named pipe)
 
-/dev/mux   c   660 0   5   250 0   1   1   
8
-/dev/ttyIPCc   660 0   5   251 0   -   -   
-
+/dev/mux   c   660 0   5   234 0   0   1   
9
+/dev/ttyIPC0   c   660 0   5   251 0   -   -   
-
 /dev/input/uinput  c   660 0   0   10  223 -   
-   -
-/dev/video c   660 0   44  81  0   -   -   
-
+/dev/video0c   660 0   44  81  0   -   -   
-
-- 
1.7.0.3




[PATCH 2/5] ezx: update ezx-boot-usb-native version

2010-03-25 Thread Antonio Ospite
Fix also ezx-boot-usb-native_svn.bb as the code now resides in a 'src'
subdirectory.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 conf/distro/include/sane-srcrevs.inc   |2 +-
 recipes/ezx/ezx-boot-usb-native_svn.bb |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/conf/distro/include/sane-srcrevs.inc 
b/conf/distro/include/sane-srcrevs.inc
index 7e08ca0..2248e78 100644
--- a/conf/distro/include/sane-srcrevs.inc
+++ b/conf/distro/include/sane-srcrevs.inc
@@ -55,7 +55,7 @@ SRCREV_pn-elf2flt ?= 1786
 SRCREV_pn-epdfview ?= 346
 SRCREV_pn-epiphany ?= 7837
 SRCREV_pn-essential-dialer ?= 194
-SRCREV_pn-ezx-boot-usb-native ?= 2371
+SRCREV_pn-ezx-boot-usb-native ?= 2512
 SRCREV_pn-ezx-gen-blob ?= 2426
 SRCREV_pn-ezxd ?= 2074
 SRCREV_pn-fbgrab-viewer-native ?= 1943
diff --git a/recipes/ezx/ezx-boot-usb-native_svn.bb 
b/recipes/ezx/ezx-boot-usb-native_svn.bb
index 1298cac..237d06b 100644
--- a/recipes/ezx/ezx-boot-usb-native_svn.bb
+++ b/recipes/ezx/ezx-boot-usb-native_svn.bb
@@ -14,7 +14,7 @@ inherit autotools native
 
 do_deploy() {
 install -d ${DEPLOY_DIR_TOOLS}
-install -m 0755 boot_usb ${DEPLOY_DIR_TOOLS}/ezx-boot-usb-${PV}
+install -m 0755 src/boot_usb ${DEPLOY_DIR_TOOLS}/ezx-boot-usb-${PV}
 }
 
 do_stage() {
-- 
1.7.0.3




[PATCH 4/5] ezx: update ezx-gen-blob version

2010-03-25 Thread Antonio Ospite
NOTE: this version builds fine but the resulting binaries do not seem to
be correct, their size is about 300KiB instead of the expected 64KiB.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 conf/distro/include/sane-srcrevs.inc |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/conf/distro/include/sane-srcrevs.inc 
b/conf/distro/include/sane-srcrevs.inc
index 1b4972a..8451e3d 100644
--- a/conf/distro/include/sane-srcrevs.inc
+++ b/conf/distro/include/sane-srcrevs.inc
@@ -56,7 +56,7 @@ SRCREV_pn-epdfview ?= 346
 SRCREV_pn-epiphany ?= 7837
 SRCREV_pn-essential-dialer ?= 194
 SRCREV_pn-ezx-boot-usb-native ?= 2512
-SRCREV_pn-ezx-gen-blob ?= 2426
+SRCREV_pn-ezx-gen-blob ?= 2517
 SRCREV_pn-ezxd ?= 2513
 SRCREV_pn-fbgrab-viewer-native ?= 1943
 SRCREV_pn-flashrom ?= 3682
-- 
1.7.0.3




Re: [PATCH 4/5] ezx: update ezx-gen-blob version

2010-03-25 Thread Antonio Ospite
On Thu, 25 Mar 2010 18:42:40 +0100
Stefan Schmidt ste...@datenfreihafen.org wrote:

 Hello.
 
 On Thu, 2010-03-25 at 18:19, Antonio Ospite wrote:
  NOTE: this version builds fine but the resulting binaries do not seem to
  be correct, their size is about 300KiB instead of the expected 64KiB.
  
  Signed-off-by: Antonio Ospite osp...@studenti.unina.it
 
 I would need some more information before acking this one. Does the old rev
 still build with the gcc in OE?
 
 If yes I would prefer to stay with the old rev as a known working one until 
 the
 root cause is found and fixed. If it does not even build we could go ahead and
 bump the rev as it does make things not even worse.


The current version doesn't even build, so bumping the revision is good
even if doesn't solve the size issue.

 Side note for others: Personally I know nobody who ever installed the gen-blob
 produced with OE on his phone. All people who did it used a precompiled 
 version
 from Wyrm, Antonio or me or compiled it by hand. So this one should not bring 
 to
 much harm.


As you may guess, even compiling it manually doesn't work anymore with
a recent toolchain...  to be more precise: I've tried running the
big binary loading it via usb, it seems to work but it is just not
suitable to be flashed because of its size.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpg8nKNFyJhW.pgp
Description: PGP signature


Re: [PATCH 4/5] ezx: update ezx-gen-blob version

2010-03-25 Thread Antonio Ospite
On Thu, 25 Mar 2010 19:30:50 +0100
Stefan Schmidt ste...@datenfreihafen.org wrote:

 Hello.
 
 On Thu, 2010-03-25 at 19:13, Antonio Ospite wrote:
  On Thu, 25 Mar 2010 18:42:40 +0100
  Stefan Schmidt ste...@datenfreihafen.org wrote:
  
   On Thu, 2010-03-25 at 18:19, Antonio Ospite wrote:
NOTE: this version builds fine but the resulting binaries do not seem to
be correct, their size is about 300KiB instead of the expected 64KiB.
[...]
   Side note for others: Personally I know nobody who ever installed the 
   gen-blob
   produced with OE on his phone. All people who did it used a precompiled 
   version
   from Wyrm, Antonio or me or compiled it by hand. So this one should not 
   bring to
   much harm.
  
 
  As you may guess, even compiling it manually doesn't work anymore with
  a recent toolchain...  to be more precise: I've tried running the
  big binary loading it via usb, it seems to work but it is just not
  suitable to be flashed because of its size.
 
 Interesting. It is stripped, right?

Yep.

 Anyway, as the old one does not build and
 the new one works you have my

 Acked-by: Stefan Schmidt ste...@datenfreihafen.org
 

Thanks.
Stefan are you also going to push these changes?

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpmKabYcKZDM.pgp
Description: PGP signature


Re: About A1600

2010-03-25 Thread Antonio Ospite
On Thu, 25 Mar 2010 22:01:40 +0300
N N ajo...@mail.ru wrote:

 Hi!
 
 Is anybody interested in LCD support for gen-blob on A1600?
 
 ajor,
 Russia


Hi ajor, yes we are interested in anything which regards A1600.
Have you already tried running openezx kernel on it?

Consider subscribing to openezx-devel mailing list, for now I just
accepted your message manually. You can also find us in the #openezx IRC
channel on Freenode.

Regards,
   Antonio

P.S.: I cannot send the mail to ajo...@mail.ru, if anyone can, please
forward this on. Thanks.

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgp9EZ56RLS8b.pgp
Description: PGP signature


Some little fresh air for openezx

2010-03-25 Thread Antonio Ospite
Hi,

it's spring time and it's starting to get nicer and warmer down here in
Italy, it's time to open the windows and let some fresh air come in.

So I started refreshing the openezx userspace foundations:
 1. a more recent toolchain[1] (x86_64 and i686) thanks to Jan Prunk
who provided access to an i686 machine.
 2. a new fso-console-image, kernel, modules and gen-blob[2]
NOTE: don't flash this gen-blob, it's huge; it should work fine
via usb tho.
 3. latest boot_usb[3].

This bundle lets you have BP working with latest ezxd and latest kernel
which comes now with an adapted ts27010mux driver from Motorola
Milestone (thanks to Erik Gilling), so you hardcore OpenEZXers can
make some tests with the new mux driver. How many are we, 2, maybe 4? :)

These updates are going to hit also OpenEmbedded sometime soon.

Next is to fix support for freescale_neptune modem in ogsmd and
build a fso-zhone-image, so a broader audience can have some fun too.

Some questions:
 * does anyone have access to those MicroSD Wifi cards? It looks like
   there is some linux support for them now[4].
 * does anyone has a spare A1200/E6 (or even A1600, albeit there is no
   confirmation openezx works on it) to sell/lend/donate?
   If you sell it, it needs to be really cheap ( 50 Eur ship. incl.)
   for me to be interested :)

Have fun,
   Antonio

[1] http://people.openezx.org/ao2/deploy/sdk/
[2] http://people.openezx.org/ao2/deploy/images/a780/
[3] http://people.openezx.org/ao2/deploy/tools/
[4]
http://acassis.wordpress.com/2010/01/27/microsd-wifi-with-linux-support/

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgphU8VBP3QGK.pgp
Description: PGP signature


Re: [oe] [PATCH 0/5] Misc updates for EZX bits in OE

2010-03-25 Thread Antonio Ospite
On Thu, 25 Mar 2010 13:39:00 -0700
Khem Raj raj.k...@gmail.com wrote:

 On (25/03/10 18:19), Antonio Ospite wrote:
[...]
  Note that although ezx-gen-blob builds fine now, it seems to have issues 
  with
  GCC 4.4: the binary size is about 300KiB instead of the expected 64KiB, if
  anyone has a clue please let me know.
 
 I can help you here. If you can give me the two images with symbols and
 your linking script it uses. Secondly are you using same binutils/ld in
 both cases ?


I'll dig for an older toolchain in order to replicate the two
scenarios, and get back here to get your help.
Many thanks for your offer Khem.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgp1Ax5gx7Ppj.pgp
Description: PGP signature


Re: Code from OpenEZX used for Motorola Milestone.

2010-02-20 Thread Antonio Ospite
On Mon, 4 Jan 2010 12:49:34 -0800
Erik Gilling konk...@google.com wrote:

 On Sun, Dec 27, 2009 at 6:39 AM, Michael 'Mickey' Lauer
 mic...@vanille-media.de wrote:
  Am Sonntag, den 27.12.2009, 15:21 +0100 schrieb Antonio Ospite:
 
  Timothy Meade (tmzt) reported that there is some code from OpenEZX[0]
  which has been used as a base for the TS 07.10/27.010 mux driver for
  Motorola Milestone[1] (which is a GSM Droid, Droid is also addressed
  with the codename Sholes, IIUC). You can find some evidence here:
 
  http://android.git.kernel.org/?p=kernel/omap.git;a=blob;f=drivers/misc/ts27010mux/ts27010_mux.c;h=e95b7c71f43257f835aa65afffe6dec074c442c1;hb=android-omap-2.6.29-eclair
 
  Good find. Unfortunately it still looks pretty baseband specific,
  I would have welcomed a driver that supports the standardized protocols
  instead.
 
 This driver is almost a complete rewrite of the driver from Motorola.
 That driver had significant code-rot, race conditions, and possible
 buffer overflows. The driver was primarily written to the TS 27.010
 spec.  There are a a few bits that are specific to the Motorola
 baseband.  Also, flow control was left unimplemented.


The driver is indeed way cleaner than the one we use in OpenEZX, and
with some quite limited changes it can be made to work with EZX
platform baseband processor too, see the attached proof-of-concept
patch; basically all it needed were sequence numbers and ACK packets
support, and adjusted dlci-tty mapping. It kind of works but it still
needs some more work.

  It would be great if our code and the one from Motorola could be
  kept in sync somehow, that would also ease mainline submission a lot
  in the long run.
 
  You realize this is a pipe dream, right? ;) Oh well, hope dies last.


Erik, would you at least accept patches? I also found some small
defects.

If we collaborate on this driver, what should we consider as the
upstream repository where to get the latest version of it, on which we
can base our modifications? Is the aforementioned android git repo ok?

I'd also like to discuss the dlci-tty mapping: can we get completely rid
of it assuming an implicit 1:1 mapping? And, how are you opening
channel 0 with the current ts27010mux driver?

Thanks in advance,
   Antonio Ospite

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
Make ts27010mux driver work with EZX baseband processor

ts27010mux is a TS 07.10/27.010 mux kernel driver for Motorola Milestone
developed by Erik Gilling.

It  can be found here:
http://android.git.kernel.org/?p=kernel/omap.git;a=blob;f=drivers/misc/ts27010mux/ts27010_mux.c;h=e95b7c71f43257f835aa65afffe6dec074c442c1;hb=android-omap-2.6.29-eclair

In order to check out the code:
  git clone git://android.git.kernel.org/kernel/omap.git
  git checkout remotes/origin/android-omap-2.6.29-eclair
  ls -l drivers/misc/ts27010mux

This patch adds sequence numbers, ACK packets, and adjusts the dli-tty
mapping to work with the baseband processor used in Motorola EZX
platform.

Antonio Ospite
http://ao2.it

diff -pruN __mux/ts27010mux//ts0710.h drivers/char/ts27010mux//ts0710.h
--- __mux/ts27010mux//ts0710.h	2010-02-14 12:17:25.0 +0100
+++ drivers/char/ts27010mux//ts0710.h	2010-02-20 19:32:42.0 +0100
@@ -53,7 +53,7 @@
 #define FLAG_SIZE 2
 
 #define TS0710_MAX_HDR_SIZE 5
-#define DEF_TS0710_MTU 512
+#define DEF_TS0710_MTU 256
 
 #define TS0710_BASIC_FLAG 0xF9
 
diff -pruN __mux/ts27010mux//ts27010_mux.c drivers/char/ts27010mux//ts27010_mux.c
--- __mux/ts27010mux//ts27010_mux.c	2010-02-17 18:33:44.0 +0100
+++ drivers/char/ts27010mux//ts27010_mux.c	2010-02-20 20:18:06.0 +0100
@@ -94,10 +94,12 @@
 #define CMDTAG 0x55
 #define DATATAG 0xAA
 
-static const u8 tty2dlci[NR_MUXS] =
-{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
-static const u8 iscmdtty[NR_MUXS] =
-{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
+#define ACK 0x4F
+
+static const u8 tty2dlci[NR_MUXS+1] =
+{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+static const u8 iscmdtty[NR_MUXS+1] =
+{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 
 struct dlci_tty {
 	const u8 cmdtty;
@@ -105,7 +107,7 @@ struct dlci_tty {
 };
 
 static const struct dlci_tty dlci2tty[] = {
-	{0, 0},	/* DLCI 0 */
+	//{0, 0},	/* DLCI 0 */
 	{0, 0},/* DLCI 1 */
 	{1, 1},/* DLCI 2 */
 	{2, 2},/* DLCI 3 */
@@ -126,6 +128,7 @@ static const struct dlci_tty dlci2tty[]
 
 enum recv_state {
 	RECV_STATE_IDLE,
+	RECV_STATE_BP_SLIDE_SEQ,
 	RECV_STATE_ADDR,
 	RECV_STATE_CONTROL,
 	RECV_STATE_LEN,
@@ -247,7 +250,7 @@ static void ts27010_debugstr(const char
 
 static int ts0710_valid_dlci(u8 dlci)
 {
-	if ((dlci  TS0710_MAX_CHN)  (dlci  0))
+	if ((dlci  TS0710_MAX_CHN)) //  (dlci = 0

Re: New rqhw_decode tool

2009-12-26 Thread Antonio Ospite
On Thu, 24 Dec 2009 13:22:08 +0100
Stefan Schmidt ste...@datenfreihafen.org wrote:

 Hello.
 
 On Thu, 2009-12-24 at 09:49, Antonio Ospite wrote:

  LED driver is the only doubt I had, but checking audio on e680 would
  also be good. BTW, right now the repository has been updated to
  2.6.33-rc1 and there is still something non-working, I hope you managed
  to get a previous version; or you can find binaries at
  http://people.openezx.org/ao2/images
 
 Indeed I have some troubles here. Either with your binaries nor with a
 selfcompiled one I'm getting usb_ethernet to work. Even tried 3 different
 kernels on my host.


Code from git repository should be working now.

 usb0 appears and I'm able to set the address, but trying to ping the phone 
 gives
 my nothing. Even tried it with MTU set to 900.


Make sure you unplug and replug the usb cable to make usblan work,
shamefully this is still needed.

 What happends though is that the error counter in ifconfig increases all the
 time. So there is something fishy here. Without a shell on the device I'm not
 really able to perform any tests on LED or audio.
 
 Does it work for you? If yes, what kernel version you are using on your host? 
 If
 it works for you with your latest image I'll try it here with my A780 as this 
 is
 the only device we have both.


usblan works here with a780.

 regards
 Stefan Schmidt

Ciao ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgprjVuimwflL.pgp
Description: PGP signature


Cleaning up merged branches.

2009-12-26 Thread Antonio Ospite
Hi,

I cleaned up the following topic branches merged mainline:
asoc/set_tdm_slot
asoc/remove-code-duplication
asoc/upstream-for-2.6.32
ezx/increase-nrirqs
ezx/mach/camera_new
ezx/mach/leds-lp3944_new
ezx/mach/pxa2xx-flash
ezx/pcap
ezx/pcap_keys
ezx/pcap_regulator
ezx/pcap_rtc
ezx/pcap_ts
leds-regulator
pcap/fix-irq-handler
pcap/irq_to_pcap
pcap/set_bits
pcap/set_ts_bits
spi/pxa2xx_spi-register-early

Please, if you have push access to our repository, run the attached script
before updating, thanks, it will delete all your local references to
remotely deleted topgit branches. Report any problems here.

IIUC since topgit 0.8 these cleanup script are not needed anymore, as
topgit can now track git branches better, I get this message when I call
tg remote openezx after changing the tg layout:

tg: Probably you want to remove the push specs introduced by an old version of 
topgit:
tg:git config --unset-all remote.openezx.push 
\\+refs/top-bases/\\*:refs/top-bases/\\*
tg:git config --unset-all remote.openezx.push 
\\+refs/heads/\\*:refs/heads/\\*
tg: (or use git config --bool --add topgit.dontwarnonoldpushspecs true to get 
rid of this warning)
tg: Remote openezx can now follow TopGit topic branches.
tg: Next, do: git fetch openezx

I'll do more tests at the next (little) cleanup, once ezx/pcap-leds gets
merged, so you guys have all the time to update your topgit to the
latest version.

Take care,
   Antonio

--
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
#!/bin/sh
# this script will delete unused and already merged topgit branches on your
# openezx local tree. Please, run this script on your openezx kernel folder
# before syncing your topgit patches with git.openezx again. Thanks!
# Daniel Ribeiro drw...@gmail.com

REMOTE=origin

OLD_BRANCHES='
asoc/set_tdm_slot
asoc/remove-code-duplication
asoc/upstream-for-2.6.32
ezx/mach/leds-lp3944_new
ezx/mach/camera_new
ezx/mach/pxa2xx-flash
ezx/pcap_keys
ezx/pcap_rtc
ezx/pcap_ts
leds-regulator
ezx/increase-nrirqs
ezx/pcap
pcap/set_bits
pcap/fix-irq-handler
pcap/set_ts_bits
pcap/irq_to_pcap
ezx/pcap_regulator
spi/pxa2xx_spi-register-early
'

git checkout ezx/current

for p in $OLD_BRANCHES;
do
	echo Deleting $p...
	tg delete -f $p
	rm -f .git/refs/top-bases/$p .git/refs/remotes/$REMOTE/$p .git/refs/remotes/$REMOTE/top-bases/$p
	#rm -f .git/logs/refs/remotes/$REMOTE/top-bases/$p
done

tg remote --populate $REMOTE


pgpCzcZp6a7qI.pgp
Description: PGP signature


Re: New rqhw_decode tool

2009-12-24 Thread Antonio Ospite
On Wed, 23 Dec 2009 18:38:46 +0100
Stefan Schmidt ste...@datenfreihafen.org wrote:

 On Wed, 2009-12-23 at 18:10, Antonio Ospite wrote:

  I wanted to release a new version on Dec. 13th, exactly one year
  after the previous one, but I failed because of some other stuff I had
  to do. So yes, I think a new release is cool!
 
 Will look into this in January. I don't expect that I have much time between
 xmas, 26C3 and new year. :)


I'll see if I could do the Changelog thing and release announcement.

  Have a good holiday time,
 
 Same for you.
 
 BTW, I fighting to get a setup ready to test the LED driver on my E680. Hope 
 to
 finish this tonight. Anything special you want me to test?


LED driver is the only doubt I had, but checking audio on e680 would
also be good. BTW, right now the repository has been updated to
2.6.33-rc1 and there is still something non-working, I hope you managed
to get a previous version; or you can find binaries at
http://people.openezx.org/ao2/images

 regards
 Stefan Schmidt

Ciao ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgp5ByDJ4XlSZ.pgp
Description: PGP signature


Re: New rqhw_decode tool

2009-12-23 Thread Antonio Ospite
On Wed, 23 Dec 2009 18:00:31 +0100
Stefan Schmidt ste...@datenfreihafen.org wrote:

 Hello.
 
 On Mon, 2009-12-14 at 17:08, Antonio Ospite wrote:
  
  Now the program simply decode the string and prints out values for
  some fields, but with enough examples we could even derive a meaning for
  each field in the hw decriptor (e.g. ma_type == 2 means EZX or PXA) and
  even come to a database to make boot_usb detect the phone model
  automatically. A use for this would be to stop passing the mach_id
  manually on command line when calling boot_usb.
 
 I just added entries for an E680i, an ROKR E2 and an A1200. As well as updated
 the bootloader version for the A780 which seems to be the same as mine.


Thanks Stefan.
As there are some more entries now, I'll move them in a table soon.

 Thanks for starting this!
 
 BTW, how do you feel about a new boot_usb release?


I wanted to release a new version on Dec. 13th, exactly one year
after the previous one, but I failed because of some other stuff I had
to do. So yes, I think a new release is cool!

 regards
 Stefan Schmidt

Have a good holiday time,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpWlhGb6fgTE.pgp
Description: PGP signature


Re: [PATCH v2] leds: Add LED class driver for regulator driven LEDs.

2009-12-15 Thread Antonio Ospite
On Mon,  7 Dec 2009 15:08:13 +0100
Antonio Ospite osp...@studenti.unina.it wrote:

 This driver provides an interface for controlling LEDs (or vibrators)
 connected to PMICs for which there is a regulator framework driver.
 
 This driver can be used, for instance, to control vibrator on all Motorola EZX
 phones using the pcap-regulator driver services.
 
 Signed-off-by: Antonio Ospite osp...@studenti.unina.it
 ---
 
 Addressed the observations from Mark Brown, Liam Girdwood and Linus Walleij.
 
 Patch against:
 git://git.o-hand.com/linux-rpurdie-leds for-mm
 
 Changes since v1:
  - Use vled as supply id.
  - use regulator_get_exclusive
  - remove double semicolon
  - check for LED_OFF instead of 0
  - handle regulators which can't change voltages
  - rename led_regulator_get_vdd to led_regulator_get_voltage
  - split regulator_led_set_value out of led_work
  - allow setting an initial brightness value
  - fix sections markers (__devinit, __devexit, etc.)
 
 The only slight doubt I still have is about
 led_regulator_get_max_brightness(), I have to use regulator_set_voltage() 
 there
 to tell if a regulator has REGULATOR_CHANGE_VOLTAGE enabled.
 
 Regards,
Antonio

Ping?

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpbqYurwR3Az.pgp
Description: PGP signature


New rqhw_decode tool

2009-12-14 Thread Antonio Ospite
Hi,

I added a little tool to play with the reply string of the RQHW command
present in Motorola bootloaders.

See
http://svnweb.openezx.org/cgi-bin/viewvc.cgi?view=revroot=svn.openezx.orgrevision=2499

Now the program simply decode the string and prints out values for
some fields, but with enough examples we could even derive a meaning for
each field in the hw decriptor (e.g. ma_type == 2 means EZX or PXA) and
even come to a database to make boot_usb detect the phone model
automatically. A use for this would be to stop passing the mach_id
manually on command line when calling boot_usb.

If you have a Motorola phone around, you could reply to this message
supplying the following info.

 - Phone model and bootloader version if known
 - The RSHW string as printed out by recent boot_usb

You can even hack boot_usb to send RQHW to a non-EZX Motorola phone,
that would be interesting as well.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpSu4BVLlenA.pgp
Description: PGP signature


Re: A1200 Camera sensor

2009-12-14 Thread Antonio Ospite
On Mon, 14 Dec 2009 14:16:24 -0200
Alan Carvalho de Assis acas...@gmail.com wrote:

 Hi Guys,
 
 Could you please confirm the sensor chip used on A1200 camera?
 
 In the OpenEZX wiki says it Micron MI2010/MT9D111:
 http://wiki.openezx.org/Camera
 
 But the link in the wiki points to OV2630 PDF:
 According to this(http://www.asia-optical.com.tw/pdf/aoci/pdf_c/154.pdf)
 document...


See page 3 of that document. We linked this document just to document
that the chip can have two names MI2010 and MT9D111

In latest linux kernel there is this driver
drivers/staging/dream/camera/mt9d112.c
I don't know if it supports the sensor on a1200 but it is worth a try
IMHO.

 Best Regards,
 
 Alan
 

Ciao ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpP3pOn35h7Y.pgp
Description: PGP signature


Re: pcap-leds: testers with e680 needed

2009-12-13 Thread Antonio Ospite
Nobody with e680, yet? I am submitting the leds-pcap driver for review
soon, a test on real hardware would be great to have.

Here's the latest build:
http://people.openezx.org/ao2/images/200912131256/

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgprD839fF6Ih.pgp
Description: PGP signature


Re: pcap-leds: testers with e680 needed

2009-12-13 Thread Antonio Ospite
On Sun, 13 Dec 2009 17:34:17 +0100
Stefan Schmidt ste...@datenfreihafen.org wrote:

 Hello.
 
 On Sun, 2009-12-13 at 16:46, Antonio Ospite wrote:
  Nobody with e680, yet? I am submitting the leds-pcap driver for review
  soon, a test on real hardware would be great to have.
 
 I should have one, but no idea where it is at the moment. :(


No hurry, this is our motto. ;)

 A test on A780 should be enough, or not?


On a780 it works ok.

e680 uses some gpio tricks to share one pcap leds register between two
physical LEDs, I refactored the gpio handling code, it should be ok but
I just wished this confirmed. Not a big deal anyways, a later bugfix is
always possible.

 regards
 Stefan Schmidt

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpb1eYOSExxt.pgp
Description: PGP signature


[PATCH v2] leds: Add LED class driver for regulator driven LEDs.

2009-12-07 Thread Antonio Ospite
This driver provides an interface for controlling LEDs (or vibrators)
connected to PMICs for which there is a regulator framework driver.

This driver can be used, for instance, to control vibrator on all Motorola EZX
phones using the pcap-regulator driver services.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---

Addressed the observations from Mark Brown, Liam Girdwood and Linus Walleij.

Patch against:
git://git.o-hand.com/linux-rpurdie-leds for-mm

Changes since v1:
 - Use vled as supply id.
 - use regulator_get_exclusive
 - remove double semicolon
 - check for LED_OFF instead of 0
 - handle regulators which can't change voltages
 - rename led_regulator_get_vdd to led_regulator_get_voltage
 - split regulator_led_set_value out of led_work
 - allow setting an initial brightness value
 - fix sections markers (__devinit, __devexit, etc.)

The only slight doubt I still have is about
led_regulator_get_max_brightness(), I have to use regulator_set_voltage() there
to tell if a regulator has REGULATOR_CHANGE_VOLTAGE enabled.

Regards,
   Antonio

 drivers/leds/Kconfig   |6 +
 drivers/leds/Makefile  |1 +
 drivers/leds/leds-regulator.c  |  242 
 include/linux/leds-regulator.h |   46 
 4 files changed, 295 insertions(+), 0 deletions(-)
 create mode 100644 drivers/leds/leds-regulator.c
 create mode 100644 include/linux/leds-regulator.h

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index f12a996..8a0e1ec 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -229,6 +229,12 @@ config LEDS_PWM
help
  This option enables support for pwm driven LEDs
 
+config LEDS_REGULATOR
+   tristate REGULATOR driven LED support
+   depends on LEDS_CLASS  REGULATOR
+   help
+ This option enables support for regulator driven LEDs.
+
 config LEDS_BD2802
tristate LED driver for BD2802 RGB LED
depends on LEDS_CLASS  I2C
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 176f0c6..9e63869 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o
 obj-$(CONFIG_LEDS_WM831X_STATUS)   += leds-wm831x-status.o
 obj-$(CONFIG_LEDS_WM8350)  += leds-wm8350.o
 obj-$(CONFIG_LEDS_PWM) += leds-pwm.o
+obj-$(CONFIG_LEDS_REGULATOR)   += leds-regulator.o
 obj-$(CONFIG_LEDS_INTEL_SS4200)+= leds-ss4200.o
 obj-$(CONFIG_LEDS_LT3593)  += leds-lt3593.o
 obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c
new file mode 100644
index 000..7f00de3
--- /dev/null
+++ b/drivers/leds/leds-regulator.c
@@ -0,0 +1,242 @@
+/*
+ * leds-regulator.c - LED class driver for regulator driven LEDs.
+ *
+ * Copyright (C) 2009 Antonio Ospite osp...@studenti.unina.it
+ *
+ * Inspired by leds-wm8350 driver.
+ *
+ * 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
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include linux/module.h
+#include linux/err.h
+#include linux/workqueue.h
+#include linux/leds.h
+#include linux/leds-regulator.h
+#include linux/platform_device.h
+#include linux/regulator/consumer.h
+
+#define to_regulator_led(led_cdev) \
+   container_of(led_cdev, struct regulator_led, cdev)
+
+struct regulator_led {
+   struct led_classdev cdev;
+   enum led_brightness value;
+   int enabled;
+   struct mutex mutex;
+   struct work_struct work;
+
+   struct regulator *vcc;
+};
+
+static inline int led_regulator_get_max_brightness(struct regulator *supply)
+{
+   int ret;
+   int voltage = regulator_list_voltage(supply, 0);
+
+   if (voltage = 0)
+   return 1;
+
+   /* even if regulator can't change voltages,
+* we still assume it can change status
+* and the LED can be turned on and off.
+*/
+   ret = regulator_set_voltage(supply, voltage, voltage);
+   if (ret  0)
+   return 1;
+
+   return regulator_count_voltages(supply);
+}
+
+static int led_regulator_get_voltage(struct regulator *supply,
+   enum led_brightness brightness)
+{
+   if (brightness == 0)
+   return -EINVAL;
+
+   return regulator_list_voltage(supply, brightness - 1);
+}
+
+
+static void regulator_led_enable(struct regulator_led *led)
+{
+   int ret;
+
+   if (led-enabled)
+   return;
+
+   ret = regulator_enable(led-vcc);
+   if (ret != 0) {
+   dev_err(led-cdev.dev, Failed to enable vcc: %d\n, ret);
+   return;
+   }
+
+   led-enabled = 1;
+}
+
+static void regulator_led_disable(struct regulator_led *led)
+{
+   int ret;
+
+   if (!led-enabled)
+   return;
+
+   ret = regulator_disable(led-vcc

WARNING: at kernel/lockdep.c

2009-12-05 Thread Antonio Ospite
Hi,

I am getting this warning on gen2, is this because of eoc? Ilya?

[ cut here ]
WARNING: at kernel/lockdep.c:2465 lockdep_trace_alloc+0xac/0xec()
Modules linked in:
[c002febc] (unwind_backtrace+0x0/0xe0) from [c0043c9c] 
(warn_slowpath_common+0x4c/0x68)
[c0043c9c] (warn_slowpath_common+0x4c/0x68) from [c006a1a8] 
(lockdep_trace_alloc+0xac/0xec)
[c006a1a8] (lockdep_trace_alloc+0xac/0xec) from [c00a1c20] 
(kmem_cache_alloc+0x20/0xc4)
[c00a1c20] (kmem_cache_alloc+0x20/0xc4) from [c017b07c] 
(pcap_adc_async+0x24/0xc4)
[c017b07c] (pcap_adc_async+0x24/0xc4) from [c017b170] 
(pcap_adc_sync+0x54/0x88)
[c017b170] (pcap_adc_sync+0x54/0x88) from [c01bd0c4] 
(pcap_bat_update+0x54/0xf0)
[c01bd0c4] (pcap_bat_update+0x54/0xf0) from [c01bd438] 
(eoc_charge_vbus+0x80/0xb8)
[c01bd438] (eoc_charge_vbus+0x80/0xb8) from [c0075ccc] 
(handle_IRQ_event+0x28/0xf8)
[c0075ccc] (handle_IRQ_event+0x28/0xf8) from [c0077af4] 
(handle_simple_irq+0xb0/0xcc)
[c0077af4] (handle_simple_irq+0xb0/0xcc) from [c017b784] 
(eoc_isr_work+0xd4/0x12c)
[c017b784] (eoc_isr_work+0xd4/0x12c) from [c00559ec] 
(worker_thread+0x1dc/0x2cc)
[c00559ec] (worker_thread+0x1dc/0x2cc) from [c0058b94] (kthread+0x7c/0x84)
[c0058b94] (kthread+0x7c/0x84) from [c002afd0] (kernel_thread_exit+0x0/0x8)
---[ end trace 51c3e191cf7432f8 ]---

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpnZppntao5y.pgp
Description: PGP signature


Re: [PATCH] leds: Add LED class driver for regulator driven LEDs.

2009-12-04 Thread Antonio Ospite
On Wed, 2 Dec 2009 18:06:58 +
Mark Brown broo...@opensource.wolfsonmicro.com wrote:

  +   vcc = regulator_get(pdev-dev, pdata-supply);
  +   if (IS_ERR(vcc)) {
  +   dev_err(pdev-dev, Cannot get vcc for %s\n, pdata-name);
  +   return PTR_ERR(vcc);;
  +   }
 
 You almost certainly want regulator_get_exclusive() here; this driver
 can't function properly if something else is using the regulator and
 holding the LED on or off without it.  You'll also want to check the
 status of the LED on startup and update your internal status to match
 that.

When you refer to the status of the LED on startup do you mean a
initial brightness value passed via leds-regulator platform data, or the
initial status or the regulator itself?

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpad9zLrWrSm.pgp
Description: PGP signature


[PATCH] leds: Add LED class driver for regulator driven LEDs.

2009-12-02 Thread Antonio Ospite
This driver provides an interface for controlling LEDs (or vibrators)
connected to PMICs for which there is a regulator framework driver.

This driver can be used, for instance, to control vibrator on all Motorola EZX
phones using the pcap-regulator driver services.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
The patch is against:
git://git.o-hand.com/linux-rpurdie-leds for-mm

A doubt I had was about leaving the 'supply' variable configurable from
platform data, or relying on some fixed value like vled, but leaving it
configurable covers the case when we have different regulators used for
different LEDs or vibrators.

Should I add a note in Documentation/ about how to use it? Tell me if so.

Thanks,
   Antonio

P.S.: for those who get the mail from LKML, please Cc me on reply.

 drivers/leds/Kconfig   |6 +
 drivers/leds/Makefile  |1 +
 drivers/leds/leds-regulator.c  |  214 
 include/linux/leds-regulator.h |   20 
 4 files changed, 241 insertions(+), 0 deletions(-)
 create mode 100644 drivers/leds/leds-regulator.c
 create mode 100644 include/linux/leds-regulator.h

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index f12a996..8a0e1ec 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -229,6 +229,12 @@ config LEDS_PWM
help
  This option enables support for pwm driven LEDs
 
+config LEDS_REGULATOR
+   tristate REGULATOR driven LED support
+   depends on LEDS_CLASS  REGULATOR
+   help
+ This option enables support for regulator driven LEDs.
+
 config LEDS_BD2802
tristate LED driver for BD2802 RGB LED
depends on LEDS_CLASS  I2C
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 176f0c6..9e63869 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o
 obj-$(CONFIG_LEDS_WM831X_STATUS)   += leds-wm831x-status.o
 obj-$(CONFIG_LEDS_WM8350)  += leds-wm8350.o
 obj-$(CONFIG_LEDS_PWM) += leds-pwm.o
+obj-$(CONFIG_LEDS_REGULATOR)   += leds-regulator.o
 obj-$(CONFIG_LEDS_INTEL_SS4200)+= leds-ss4200.o
 obj-$(CONFIG_LEDS_LT3593)  += leds-lt3593.o
 obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c
new file mode 100644
index 000..fca5d42
--- /dev/null
+++ b/drivers/leds/leds-regulator.c
@@ -0,0 +1,214 @@
+/*
+ * leds-regulator.c - LED class driver for regulator driven LEDs.
+ *
+ * Copyright (C) 2009 Antonio Ospite osp...@studenti.unina.it
+ *
+ * Inspired by leds-wm8350 driver.
+ *
+ * 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
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include linux/module.h
+#include linux/err.h
+#include linux/workqueue.h
+#include linux/leds.h
+#include linux/leds-regulator.h
+#include linux/platform_device.h
+#include linux/regulator/consumer.h
+
+#define to_regulator_led(led_cdev) \
+   container_of(led_cdev, struct regulator_led, cdev)
+
+struct regulator_led {
+   struct led_classdev cdev;
+   enum led_brightness value;
+   int enabled;
+   struct mutex mutex;
+   struct work_struct work;
+
+   struct regulator *vcc;
+};
+
+static inline int led_regulator_get_max_brightness(struct regulator *supply)
+{
+   return regulator_count_voltages(supply);
+}
+
+static int led_regulator_get_vdd(struct regulator *supply,
+   enum led_brightness brightness)
+{
+   if (brightness == 0)
+   return 0;
+
+   return regulator_list_voltage(supply, brightness - 1);
+}
+
+
+static void regulator_led_enable(struct regulator_led *led)
+{
+   int ret;
+
+   if (led-enabled)
+   return;
+
+   ret = regulator_enable(led-vcc);
+   if (ret != 0) {
+   dev_err(led-cdev.dev, Failed to enable vcc: %d\n, ret);
+   return;
+   }
+
+   led-enabled = 1;
+}
+
+static void regulator_led_disable(struct regulator_led *led)
+{
+   int ret;
+
+   if (!led-enabled)
+   return;
+
+   ret = regulator_disable(led-vcc);
+   if (ret != 0) {
+   dev_err(led-cdev.dev, Failed to disable vcc: %d\n, ret);
+   return;
+   }
+
+   led-enabled = 0;
+}
+
+static void led_work(struct work_struct *work)
+{
+   struct regulator_led *led;
+   int voltage;
+   int ret;
+
+   led = container_of(work, struct regulator_led, work);
+
+   mutex_lock(led-mutex);
+
+   if (led-value == 0) {
+   regulator_led_disable(led);
+   goto out;
+   }
+
+   voltage = led_regulator_get_vdd(led-vcc, led-value);
+   dev_dbg(led-cdev.dev, brightness: %d voltage: %d,
+   led-value, voltage);
+
+   ret

Re: [PATCH] leds: Add LED class driver for regulator driven LEDs.

2009-12-02 Thread Antonio Ospite
On Wed, 2 Dec 2009 18:06:58 +
Mark Brown broo...@opensource.wolfsonmicro.com wrote:

 On Wed, Dec 02, 2009 at 06:40:25PM +0100, Antonio Ospite wrote:
 
  A doubt I had was about leaving the 'supply' variable configurable from
  platform data, or relying on some fixed value like vled, but leaving it
  configurable covers the case when we have different regulators used for
  different LEDs or vibrators.
 
 There's no need to do this since the regulator API matches consumers
 based on struct device as well as name so you can have as many LEDs as
 you like all using the same supply name mapping to different regulators.


I need some more explanation here, I am currently using the driver with
this code:

+/* VVIB: Vibrator on A780, A1200, A910, E6, E2 */
+static struct regulator_consumer_supply pcap_regulator_VVIB_consumers
[] = {
+   { .dev_name = leds-regulator, .supply = vibrator, },
   
+};
+
+static struct regulator_init_data pcap_regulator_VVIB_data = {
+   .constraints = {
+   .min_uV = 130,
+   .max_uV = 300,
+   .valid_ops_mask = REGULATOR_CHANGE_STATUS |
+   REGULATOR_CHANGE_VOLTAGE,
+   },
+   .num_consumer_supplies = ARRAY_SIZE
(pcap_regulator_VVIB_consumers),
+   .consumer_supplies = pcap_regulator_VVIB_consumers,
+};

@@ -749,6 +766,10 @@ static struct pcap_subdev a780_pcap_subdevs[] = {
.name   = pcap-regulator,
.id = VAUX3,
.platform_data  = pcap_regulator_VAUX3_data,
+   }, {
+   .name   = pcap-regulator,
+   .id = VVIB,
+   .platform_data  = pcap_regulator_VVIB_data,
},
 };


and then:

 
@@ -872,8 +893,24 @@ static struct platform_device a780_camera = {
},
 };
 
+/* vibrator */
+static struct led_regulator_platform_data a780_vibrator_data = {
+   .name   = a780::vibrator,
+   .supply = vibrator
    I'll get the regulator with this.
+};
+
+static struct platform_device a780_vibrator = {
+   .name = leds-regulator,
+   .id   = -1,
+   .dev  = {
+   .platform_data = a780_vibrator_data,
+   },
+};
+
+
 static struct platform_device *a780_devices[] __initdata = {
a780_gpio_keys,
+   a780_vibrator
 };

If I set the .supply value fixed, how can I assign different
regulators to different leds? Should I use the address to the platform
device (a780_vibrator in this case) for .dev when defining the
regulator in the first place?

  Should I add a note in Documentation/ about how to use it? Tell me if so.
 
 If you wish to, it's not essential (only one existing LED driver appears
 to do this) and the comment in the header file is probably adequate.


Ok.

  +static inline int led_regulator_get_max_brightness(struct regulator 
  *supply)
  +{
  +   return regulator_count_voltages(supply);
  +}
 
 More graceful handling of regulators that don't implement list_voltage
 might be nice (for simple on/off control - not all regulators have
 configurable voltages).  If a regulator doesn't support list_voltage
 you'll get -EINVAL.


Ok, I need to study the regulator framework a bit more, but I think I
got the logic you are referring to, if we can actually list voltages
then max_brightness is the number of voltages as it is now, else if we
can only change status then max_brightness is 1 (one).

  +   vcc = regulator_get(pdev-dev, pdata-supply);
  +   if (IS_ERR(vcc)) {
  +   dev_err(pdev-dev, Cannot get vcc for %s\n, pdata-name);
  +   return PTR_ERR(vcc);;
  +   }
 
 You almost certainly want regulator_get_exclusive() here; this driver
 can't function properly if something else is using the regulator and
 holding the LED on or off without it.  You'll also want to check the
 status of the LED on startup and update your internal status to match
 that.

Will do, thanks for reviewing the code.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpc4wa4dNjUm.pgp
Description: PGP signature


Re: [PATCH] leds: Add LED class driver for regulator driven LEDs.

2009-12-02 Thread Antonio Ospite
On Wed, 02 Dec 2009 18:23:55 +
Liam Girdwood l...@slimlogic.co.uk wrote:

 On Wed, 2009-12-02 at 18:40 +0100, Antonio Ospite wrote:
  This driver provides an interface for controlling LEDs (or vibrators)
  connected to PMICs for which there is a regulator framework driver.
  
  This driver can be used, for instance, to control vibrator on all Motorola 
  EZX
  phones using the pcap-regulator driver services.
  
  Signed-off-by: Antonio Ospite osp...@studenti.unina.it
 
 Some very minor points below.
 

Thanks for reviewing the code.

[...]
  +
  +static void led_work(struct work_struct *work)
  +{
  +   struct regulator_led *led;
  +   int voltage;
  +   int ret;
  +
  +   led = container_of(work, struct regulator_led, work);
  +
  +   mutex_lock(led-mutex);
  +
  +   if (led-value == 0) {
 
 LED_OFF instead of 0 here ?


Ok.

  +   regulator_led_disable(led);
  +   goto out;
  +   }
  +
  +   voltage = led_regulator_get_vdd(led-vcc, led-value);
  +   dev_dbg(led-cdev.dev, brightness: %d voltage: %d,
  +   led-value, voltage);
  +
  +   ret = regulator_set_voltage(led-vcc, voltage, voltage);
  +   if (ret != 0)
  +   dev_err(led-cdev.dev, Failed to set voltage %d: %d\n,
  +   voltage, ret);
 
 Some regulators may not support voltage change (via hw design or
 constraints) so set_voltage() will fail. We probably want to handle this
 regulator type so we don't call set_voltage().


Ok, I'll read more about the regulator framework to find out how to
check regulator capabilities.

  +
  +   regulator_led_enable(led);
  +
  +out:
  +   mutex_unlock(led-mutex);
  +}
  +
[...]
  +static int regulator_led_probe(struct platform_device *pdev)
  +{
  +   struct led_regulator_platform_data *pdata = pdev-dev.platform_data;
  +   struct regulator_led *led;
  +   struct regulator *vcc;
  +   int ret;
  +
  +   if (pdata == NULL) {
  +   dev_err(pdev-dev, no platform data\n);
  +   return -ENODEV;
  +   }
  +
  +   vcc = regulator_get(pdev-dev, pdata-supply);
  +   if (IS_ERR(vcc)) {
  +   dev_err(pdev-dev, Cannot get vcc for %s\n, pdata-name);
  +   return PTR_ERR(vcc);;
 
 double ;; here


Thanks.

[...]

Regards,
   Antonio 

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpL1eUuADG6I.pgp
Description: PGP signature


Re: [PATCH] leds: Add LED class driver for regulator driven LEDs.

2009-12-02 Thread Antonio Ospite
On Wed, 2 Dec 2009 20:40:26 +
Mark Brown broo...@opensource.wolfsonmicro.com wrote:

 On Wed, Dec 02, 2009 at 09:25:21PM +0100, Antonio Ospite wrote:
  Mark Brown broo...@opensource.wolfsonmicro.com wrote:
 
   There's no need to do this since the regulator API matches consumers
   based on struct device as well as name so you can have as many LEDs as
   you like all using the same supply name mapping to different regulators.
 
  I need some more explanation here, I am currently using the driver with
  this code:
 
  +/* VVIB: Vibrator on A780, A1200, A910, E6, E2 */
  +static struct regulator_consumer_supply pcap_regulator_VVIB_consumers
  [] = {
  +   { .dev_name = leds-regulator, .supply = vibrator, },
 
 So you're instantiating the device with .id set to -1 (as your code
 below shows), meaning there's only one leds-regulator in the system and
 there's no need to number them.  If you had more than one of them then
 you'd number them and then have something like:
 
   { .dev_name = leds-regulator.0, supply = vled },
   { .dev_name = leds-regulator.1, supply = vled },
 
 when setting up the supplies.


Ok, the .id in .dev_name is what I was missing.

  If I set the .supply value fixed, how can I assign different
  regulators to different leds? Should I use the address to the platform
  device (a780_vibrator in this case) for .dev when defining the
  regulator in the first place?
 
 There is no need to use the .dev field, that is kept to avoid build
 breakage transitioning to dev_name.

Now everything is clear.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpWGZuaSvggE.pgp
Description: PGP signature


Re: pcap-leds: testers with e680 needed

2009-11-29 Thread Antonio Ospite
On Fri, 27 Nov 2009 17:37:45 +0100
Antonio Ospite osp...@studenti.unina.it wrote:

 Hi,
 
 I've been cleaning up pcap-leds driver a bit for mainline submission,
 can anyone with e680 test it to see if I introduced any regression?
 
 Thanks,
Antonio


Here's a prebuilt kernel to make testers' life easier:
http://people.openezx.org/ao2/images/200911291106/zImage-200911291106

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpUMetm3S3rL.pgp
Description: PGP signature


Re: [PATCH] leds-lp3944.h: remove unneeded include.

2009-11-29 Thread Antonio Ospite
On Sat, 28 Nov 2009 13:55:57 +0100
Antonio Ospite osp...@studenti.unina.it wrote:

 This include was needed in the first version of the driver because we used to
 expose workqueue details in platform data definition, now we don't.


Actually also including linux/leds.h can be avoided, an updated
patch is on its way.

Thanks,
   Antonio

 Signed-off-by: Antonio Ospite osp...@studenti.unina.it
 ---
  include/linux/leds-lp3944.h |1 -
  1 files changed, 0 insertions(+), 1 deletions(-)
 
 diff --git a/include/linux/leds-lp3944.h b/include/linux/leds-lp3944.h
 index afc9f9f..40e514a 100644
 --- a/include/linux/leds-lp3944.h
 +++ b/include/linux/leds-lp3944.h
 @@ -13,7 +13,6 @@
  #define __LINUX_LEDS_LP3944_H
  
  #include linux/leds.h
 -#include linux/workqueue.h
  
  #define LP3944_LED0 0
  #define LP3944_LED1 1
 -- 
 1.6.5.3
 


-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpoV4BbKewxb.pgp
Description: PGP signature


[PATCH v2] leds-lp3944.h: remove unneeded includes.

2009-11-29 Thread Antonio Ospite
These were needed in the first version of the driver because we used to expose
workqueue and led class details in the header file, now we don't.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
 include/linux/leds-lp3944.h |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/include/linux/leds-lp3944.h b/include/linux/leds-lp3944.h
index afc9f9f..2618aa9 100644
--- a/include/linux/leds-lp3944.h
+++ b/include/linux/leds-lp3944.h
@@ -12,9 +12,6 @@
 #ifndef __LINUX_LEDS_LP3944_H
 #define __LINUX_LEDS_LP3944_H
 
-#include linux/leds.h
-#include linux/workqueue.h
-
 #define LP3944_LED0 0
 #define LP3944_LED1 1
 #define LP3944_LED2 2
-- 
1.6.5.3




[PATCH] ezx-pcap: remove defines for custom led gpio encoding

2009-11-29 Thread Antonio Ospite
We used these, in a first version of leds-pcap driver, in order to encode gpio
enabling and gpio inversion for a led inside the variable used for the gpio
number. In the new leds-pcap driver we rely on gpio_is_valid() to derive if a
led is gpio enabled and we have a dedicated flag to tell if the gpio value has
to be inverted.

Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---

Just a note, the leds-pcap driver I am mentioning is not in mainline yet, so
this can be merged without any dependencies.

Thanks,
   Antonio

 include/linux/mfd/ezx-pcap.h |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h
index e5124ce..89a95af 100644
--- a/include/linux/mfd/ezx-pcap.h
+++ b/include/linux/mfd/ezx-pcap.h
@@ -231,9 +231,6 @@ void pcap_set_ts_bits(struct pcap_chip *, u32);
 #define PCAP_LED_4MA   1
 #define PCAP_LED_5MA   2
 #define PCAP_LED_9MA   3
-#define PCAP_LED_GPIO_VAL_MASK 0x00ff
-#define PCAP_LED_GPIO_EN   0x0100
-#define PCAP_LED_GPIO_INVERT   0x0200
 #define PCAP_LED_T_MASK0xf
 #define PCAP_LED_C_MASK0x3
 #define PCAP_BL_MASK   0x1f
-- 
1.6.5.3




pcap-leds: testers with e680 needed

2009-11-27 Thread Antonio Ospite
Hi,

I've been cleaning up pcap-leds driver a bit for mainline submission,
can anyone with e680 test it to see if I introduced any regression?

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpK8qHnH01VP.pgp
Description: PGP signature


Re: About ROKR E6 developing

2009-11-17 Thread Antonio Ospite
On Mon, 16 Nov 2009 22:34:01 -0430
Evander Palacios biomorgoth.palac...@gmail.com wrote:

 Hello there,


Hi Evander, I needed to manually accept this message, please
consider subscribing to the list if you haven't yet.
See http://lists.openezx.org/mailman/listinfo/ 

 I'm an ROKR E6 owner and i've been watching your work since some time ago.
 I've been interested in developing and experimenting with my phone most
 about to learn it's system and also to try and improve certain features (for
 example, i've in mind a Threaded SMS Viewing, among other things).

 Also i've get to know that this and other few Motorola Phones were developed
 using QT technology. I have used QT some time ago to develop some University
 projects (i'm studying Computer Science) but i don't know exactly how to
 make and export QT applications for mobile devices (just QT programming over
 Win :S ).


The OpenEZX project is working only on the _kernel_ support for EZX
phones, if you intend to develop userspace apps for the original
firmware, then other communities like motorolafans could suit better.

If you instead want to know how your phone works at a very low level
then there's something for you here :)

 So, i'm interested in your developing, and i'd like to know more about the
 project just to know if i can help with something (testing, porting, new
 features, ... ).


Take a look at http://wiki.openezx.org you'll find also the IRC channel
details on the wiki.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpiJ8mDHKw3f.pgp
Description: PGP signature


Re: [PATCH 1/3 v3] Add camera support for A780 and A910 EZX phones

2009-11-12 Thread Antonio Ospite
On Wed, 11 Nov 2009 19:02:11 +0100 (CET)
Guennadi Liakhovetski g.liakhovet...@gmx.de wrote:

 Hi Antonio
 
 Still one more nitpick:


Comments below.

 On Wed, 11 Nov 2009, Antonio Ospite wrote:
 
[...]
   
  +/* camera */
  +static int a780_camera_init(void)
 
 This function returns an error but...
 
  +{
  +   int err;
  +
  +   /*
  +* GPIO50_nCAM_EN is active low
  +* GPIO19_GEN1_CAM_RST is active on rising edge
  +*/
  +   err = gpio_request(GPIO50_nCAM_EN, nCAM_EN);
  +   if (err) {
  +   pr_err(%s: Failed to request nCAM_EN\n, __func__);
  +   goto fail;
  +   }
[...]
  +   return err;
  +}
  +
[...]
   static void __init a780_init(void)
  @@ -699,6 +782,9 @@ static void __init a780_init(void)
   
  pxa_set_keypad_info(a780_keypad_platform_data);
   
  +   a780_camera_init();
 
 ...it is not used. So, I would either make it void, or check the return 
 code, and maybe even not register the camera since it's going to be 
 useless anyway? Same for a910.


Actually I was keeping returning an error just in case there would be a
soc-camera .init() someday. But it's indeed a good idea to check the
return value once that we have it.

I am inlining here only the incremental change for a faster review,
I am going to send v4 of the patch separately for you ACK, hopefully :).

Note, now the return value of platform_device_register is ignored but
this is not grave, I guess.

Thanks for your time,
   Antonio

diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index 74423a6..1a73b7b 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -767,7 +767,6 @@ static struct platform_device a780_camera = {
 
 static struct platform_device *a780_devices[] __initdata = {
a780_gpio_keys,
-   a780_camera,
 };
 
 static void __init a780_init(void)
@@ -782,8 +781,10 @@ static void __init a780_init(void)
 
pxa_set_keypad_info(a780_keypad_platform_data);
 
-   a780_camera_init();
-   pxa_set_camera_info(a780_pxacamera_platform_data);
+   if (a780_camera_init() == 0) {
+   pxa_set_camera_info(a780_pxacamera_platform_data);
+   platform_device_register(a780_camera);
+   }
 
platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
platform_add_devices(ARRAY_AND_SIZE(a780_devices));
@@ -1026,7 +1027,6 @@ static struct platform_device a910_camera = {
 
 static struct platform_device *a910_devices[] __initdata = {
a910_gpio_keys,
-   a910_camera,
 };
 
 static void __init a910_init(void)
@@ -1041,8 +1041,10 @@ static void __init a910_init(void)
 
pxa_set_keypad_info(a910_keypad_platform_data);
 
-   a910_camera_init();
-   pxa_set_camera_info(a910_pxacamera_platform_data);
+   if (a910_camera_init() == 0) {
+   pxa_set_camera_info(a910_pxacamera_platform_data);
+   platform_device_register(a910_camera);
+   }
 
platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
platform_add_devices(ARRAY_AND_SIZE(a910_devices));


-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpibaeljZXh0.pgp
Description: PGP signature


[PATCH 1/3 v4] Add camera support for A780 and A910 EZX phones

2009-11-12 Thread Antonio Ospite
Signed-off-by: Bart Visscher ba...@thisnet.nl
Signed-off-by: Antonio Ospite osp...@studenti.unina.it
---
Changes since v3:
 - Check {a780,a910}_camera_init() return value, and register camera
   conditionally.

 arch/arm/mach-pxa/ezx.c |  174 +-
 1 files changed, 170 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index 588b265..46c32cf 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -17,8 +17,11 @@
 #include linux/delay.h
 #include linux/pwm_backlight.h
 #include linux/input.h
+#include linux/gpio.h
 #include linux/gpio_keys.h
 
+#include media/soc_camera.h
+
 #include asm/setup.h
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -29,6 +32,7 @@
 #include plat/i2c.h
 #include mach/hardware.h
 #include mach/pxa27x_keypad.h
+#include mach/camera.h
 
 #include devices.h
 #include generic.h
@@ -38,6 +42,9 @@
 #define GPIO15_A910_FLIP_LID   15
 #define GPIO12_E680_LOCK_SWITCH12
 #define GPIO15_E6_LOCK_SWITCH  15
+#define GPIO50_nCAM_EN 50
+#define GPIO19_GEN1_CAM_RST19
+#define GPIO28_GEN2_CAM_RST28
 
 static struct platform_pwm_backlight_data ezx_backlight_data = {
.pwm_id = 0,
@@ -191,8 +198,8 @@ static unsigned long gen1_pin_config[] __initdata = {
GPIO94_CIF_DD_5,
GPIO17_CIF_DD_6,
GPIO108_CIF_DD_7,
-   GPIO50_GPIO,/* CAM_EN */
-   GPIO19_GPIO,/* CAM_RST */
+   GPIO50_GPIO | MFP_LPM_DRIVE_HIGH,   /* CAM_EN */
+   GPIO19_GPIO | MFP_LPM_DRIVE_HIGH,   /* CAM_RST */
 
/* EMU */
GPIO120_GPIO,   /* EMU_MUX1 */
@@ -248,8 +255,8 @@ static unsigned long gen2_pin_config[] __initdata = {
GPIO48_CIF_DD_5,
GPIO93_CIF_DD_6,
GPIO12_CIF_DD_7,
-   GPIO50_GPIO,/* CAM_EN */
-   GPIO28_GPIO,/* CAM_RST */
+   GPIO50_GPIO | MFP_LPM_DRIVE_HIGH,   /* CAM_EN */
+   GPIO28_GPIO | MFP_LPM_DRIVE_HIGH,   /* CAM_RST */
GPIO17_GPIO,/* CAM_FLASH */
 };
 #endif
@@ -683,6 +690,81 @@ static struct platform_device a780_gpio_keys = {
},
 };
 
+/* camera */
+static int a780_camera_init(void)
+{
+   int err;
+
+   /*
+* GPIO50_nCAM_EN is active low
+* GPIO19_GEN1_CAM_RST is active on rising edge
+*/
+   err = gpio_request(GPIO50_nCAM_EN, nCAM_EN);
+   if (err) {
+   pr_err(%s: Failed to request nCAM_EN\n, __func__);
+   goto fail;
+   }
+
+   err = gpio_request(GPIO19_GEN1_CAM_RST, CAM_RST);
+   if (err) {
+   pr_err(%s: Failed to request CAM_RST\n, __func__);
+   goto fail_gpio_cam_rst;
+   }
+
+   gpio_direction_output(GPIO50_nCAM_EN, 1);
+   gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
+
+   return 0;
+
+fail_gpio_cam_rst:
+   gpio_free(GPIO50_nCAM_EN);
+fail:
+   return err;
+}
+
+static int a780_camera_power(struct device *dev, int on)
+{
+   gpio_set_value(GPIO50_nCAM_EN, !on);
+   return 0;
+}
+
+static int a780_camera_reset(struct device *dev)
+{
+   gpio_set_value(GPIO19_GEN1_CAM_RST, 0);
+   msleep(10);
+   gpio_set_value(GPIO19_GEN1_CAM_RST, 1);
+
+   return 0;
+}
+
+struct pxacamera_platform_data a780_pxacamera_platform_data = {
+   .flags  = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
+   PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
+   .mclk_10khz = 5000,
+};
+
+static struct i2c_board_info a780_camera_i2c_board_info = {
+   I2C_BOARD_INFO(mt9m111, 0x5d),
+};
+
+static struct soc_camera_link a780_iclink = {
+   .bus_id = 0,
+   .flags  = SOCAM_SENSOR_INVERT_PCLK,
+   .i2c_adapter_id = 0,
+   .board_info = a780_camera_i2c_board_info,
+   .module_name= mt9m111,
+   .power  = a780_camera_power,
+   .reset  = a780_camera_reset,
+};
+
+static struct platform_device a780_camera = {
+   .name   = soc-camera-pdrv,
+   .id = 0,
+   .dev= {
+   .platform_data = a780_iclink,
+   },
+};
+
 static struct platform_device *a780_devices[] __initdata = {
a780_gpio_keys,
 };
@@ -699,6 +781,11 @@ static void __init a780_init(void)
 
pxa_set_keypad_info(a780_keypad_platform_data);
 
+   if (a780_camera_init() == 0) {
+   pxa_set_camera_info(a780_pxacamera_platform_data);
+   platform_device_register(a780_camera);
+   }
+
platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
platform_add_devices(ARRAY_AND_SIZE(a780_devices));
 }
@@ -864,6 +951,80 @@ static struct platform_device a910_gpio_keys = {
},
 };
 
+/* camera */
+static int a910_camera_init(void)
+{
+   int err;
+
+   /*
+* GPIO50_nCAM_EN is active low

Re: [PATCH 1/3 v2] ezx: Add camera support for A780 and A910 EZX phones

2009-11-10 Thread Antonio Ospite
Ping.

Guennadi, did you see the patch below? Or I should completely remove
the .init() callback like you said in another message?
As I said, my humble preference would be to keep GPIOs setup local to
the driver somehow, but you just tell me what to do :)

On Fri, 6 Nov 2009 18:29:10 +0100
Antonio Ospite osp...@studenti.unina.it wrote:

 On Fri, 6 Nov 2009 15:11:55 +0100 (CET)
 Guennadi Liakhovetski g.liakhovet...@gmx.de wrote:
 
  On Thu, 5 Nov 2009, Antonio Ospite wrote:
  
   See? It's power(), reset(), init().
   Maybe the problem is in soc_camera_probe()?
  
  Sorry, you'd have to elaborate more on this. So, what's wrong with that 
  sequence? it doesn't make sense to reset a powered down device or reset 
  after init or whatever...
 
 
 I mean, when probing (or even opening) the device, pxacamera.init()
 is now called *after* the power ON and reset. If I kept disabled (high)
 nCAM_EN in init(), as it should've been, this would have overridden
 the previous power(1) call.
 
 Isn't init() in pxacamera platform data meant to initialize the device
 before it can be powered ON? In fact I am requesting the gpios in
 a780_pxacamera_init, and if power() or reset() are called before it, then
 they will be invalid, because the gpios have not been requested yet.
 
 Moreover, pxacamera.init() is called in pxa_camera_activate, which is
 called in pxa_camera_add_device, which in turn is invoked by
 soc_camera_open() every time.
 Shouldn't the init() method, where I request gpios, be called
 only on probe?
 
 Let me be more schematic, when probing the camera we have:
 
 soc_camera_probe() /* same in soc_camera_open! */
 |-icl-power(1)
 |-icl-reset()
 |-icd-ops-add()
   |-  pxacamera.init()  /* requesting gpios here! */
 |-video_dev_create(icd)
 |-...
 
 Maybe we should have something like:
 
 pxacamera.init()   /* request gpios only once! on probe. */
 soc_camera_probe() /* same in soc_camera_open */
 |-icl-power(1)
 |-icl-reset()
 |-icd-ops-add()
 |-video_dev_create(icd)
 |-...
 
 Or, I'm missing what init() is supposed to do :)
 Does a patch like this make sense to you?
 (I've read the other mail about removing .init just before hitting Send,
 this can be an alternative to removing it, having GPIOs setup in the
 user driver seems clearer to me.)
 
 diff --git a/drivers/media/video/pxa_camera.c 
 b/drivers/media/video/pxa_camera.c
 index 6952e96..3101bcb 100644
 --- a/drivers/media/video/pxa_camera.c
 +++ b/drivers/media/video/pxa_camera.c
 @@ -881,18 +882,8 @@ static void recalculate_fifo_timeout(struct 
 pxa_camera_dev *pcdev,
  
  static void pxa_camera_activate(struct pxa_camera_dev *pcdev)
  {
 - struct pxacamera_platform_data *pdata = pcdev-pdata;
 - struct device *dev = pcdev-soc_host.v4l2_dev.dev;
   u32 cicr4 = 0;
  
 - dev_dbg(dev, Registered platform device at %p data %p\n,
 - pcdev, pdata);
 -
 - if (pdata  pdata-init) {
 - dev_dbg(dev, %s: Init gpios\n, __func__);
 - pdata-init(dev);
 - }
 -
   /* disable all interrupts */
   __raw_writel(0x3ff, pcdev-base + CICR0);
  
 @@ -1651,6 +1644,17 @@ static int __devinit pxa_camera_probe(struct 
 platform_device *pdev)
   pcdev-res = res;
  
   pcdev-pdata = pdev-dev.platform_data;
 +
 + dev_dbg(pdev-dev, Registered platform device at %p data %p\n,
 + pcdev, pcdev-pdata);
 +
 + if (pcdev-pdata  pcdev-pdata-init) {
 + dev_dbg(pdev-dev, %s: Init gpios\n, __func__);
 + err = pcdev-pdata-init(pdev-dev);
 + if (err)
 + goto exit_clk;
 + }
 +
   pcdev-platform_flags = pcdev-pdata-flags;
   if (!(pcdev-platform_flags  (PXA_CAMERA_DATAWIDTH_8 |
   PXA_CAMERA_DATAWIDTH_9 | PXA_CAMERA_DATAWIDTH_10))) {

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpgJFMg69o2S.pgp
Description: PGP signature


Re: bug in pcap_battery

2009-11-08 Thread Antonio Ospite
On Sun, 8 Nov 2009 00:52:42 +0200
Ilya Petrov ilya.muro...@gmail.com wrote:


  Just tell me what you want me to do. Just a child branch of ezx/eoc?
 
  master -- ezx/eoc_charger -- ezx/eoc
 
  right?
 
 i dunno how its called in tg terms :(
 i need ezx/eoc_regulator subdriver branch, as we have
 ezx/pcap_regulator for pcap


I see, the hierarchy should be like this then:

ezx/eoc -- ezx/eoc-charger -- ezx/mach/eoc-chager

-- means that the right side depends on the left side.

Will do that then.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpshwDnTSGlo.pgp
Description: PGP signature


Re: Using statically allocated memory for platform_data.

2009-11-08 Thread Antonio Ospite
On Mon, 2 Nov 2009 11:23:16 +0100
Antonio Ospite osp...@studenti.unina.it wrote:

 Hi,
 
 I noted that in some mfd drivers (drivers/mfd/ezx-pcap.c and
 drivers/mfd/da903x.c) there is code like this:
 
 static int __devinit pcap_add_subdev(struct pcap_chip *pcap,
  struct pcap_subdev *subdev)
 {
 struct platform_device *pdev;
 
 pdev = platform_device_alloc(subdev-name, subdev-id);
 pdev-dev.parent = pcap-spi-dev;
 pdev-dev.platform_data = subdev-platform_data;
 
 return platform_device_add(pdev);
 }
 
 Note the _direct_assignment_ of platform data; then in board init code
 there are often global struct pointers passed as subdev platform data,
 see arch/arm/mach-pxa/em-x270.c::em_x270_da9030_subdevs for instance.
 
 In these cases, whenever the subdev platform device is unregistered,
 the call to platform_device_release() tries to kfree the platform data,
 and being it statically allocated memory this triggers a bug from SLAB:
   kernel BUG at mm/slab.c:521!
 In my case this prevented proper device poweroff.
 
 The question: should these mfd drivers use platform_device_add_data()
 which allocates dynamic memory for *a copy* of platform data? Is this
 simple solution acceptable even if there will be more memory used?
 Or should we setup platform_data in dynamic memory from the beginning
 in board init code? (which would be way less pretty IMHO).
 

Just for reference, in our local repository I am _temporarily_ working
around the bug with a change like the following, even if I am leaking
some memory. Any comments?

diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index df405af..e4e999b 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -379,12 +379,17 @@ static int pcap_remove_subdev(struct device *dev, void 
*unused)
return 0;
 }

+static void pcap_subdev_release(struct device *dev)
+{
+}
+
 static int __devinit pcap_add_subdev(struct pcap_chip *pcap,
struct pcap_subdev *subdev)
 {
struct platform_device *pdev;

pdev = platform_device_alloc(subdev-name, subdev-id);
+   pdev-dev.release = pcap_subdev_release;
pdev-dev.parent = pcap-spi-dev;
pdev-dev.platform_data = subdev-platform_data;

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


pgpi9HWI0JsIO.pgp
Description: PGP signature


  1   2   3   >