linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* USB networking news, ofono for d4: less hacked version
@ 2020-05-06 10:11 Pavel Machek
  2020-05-06 14:43 ` Tony Lindgren
  0 siblings, 1 reply; 8+ messages in thread
From: Pavel Machek @ 2020-05-06 10:11 UTC (permalink / raw)
  To: kernel list, linux-omap, tony, sre, nekit1000, mpartap, merlijn,
	martin_rysavy

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

Hi!

So... I found out that USB networking works way better when I don't
attempt to charge the phone at the same. Yes, green light was
blinking.

I pushed

To github.com:pavelmachek/ofono.git
   e7b58fdd..1e7e5ce3  mux-v1.19-2 -> mux-v1.19-2

which creates copy of atchat, so I don't damage existing
functionality. It still seems to somehow work. Lot more work is still
needed. Designed to work with latest kernel patches from Tony, using
gsmmux interfaces.

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: USB networking news, ofono for d4: less hacked version
  2020-05-06 10:11 USB networking news, ofono for d4: less hacked version Pavel Machek
@ 2020-05-06 14:43 ` Tony Lindgren
  2020-05-06 23:05   ` Pavel Machek
  0 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2020-05-06 14:43 UTC (permalink / raw)
  To: Pavel Machek
  Cc: kernel list, linux-omap, sre, nekit1000, mpartap, merlijn, martin_rysavy

* Pavel Machek <pavel@ucw.cz> [200506 10:12]:
> Hi!
> 
> So... I found out that USB networking works way better when I don't
> attempt to charge the phone at the same. Yes, green light was
> blinking.

OK yes we don't have much of a charger detection currently and the
charger tries to reconnect with the LED blinking rapidly with an
empty battery.

> To github.com:pavelmachek/ofono.git
>    e7b58fdd..1e7e5ce3  mux-v1.19-2 -> mux-v1.19-2
> 
> which creates copy of atchat, so I don't damage existing
> functionality. It still seems to somehow work. Lot more work is still
> needed. Designed to work with latest kernel patches from Tony, using
> gsmmux interfaces.

OK, sounds like that should work :) 

I still need to figure update audio notifications for the current set of
gsmmux patches. Eventually maybe ofono can just set the voice call audio
routing using alsa. But let's get the kernel notifications working first
as we also need to fix up the audio parts for the earlier comments from
Peter and Sebastian.

Regards,

Tony


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

* Re: USB networking news, ofono for d4: less hacked version
  2020-05-06 14:43 ` Tony Lindgren
@ 2020-05-06 23:05   ` Pavel Machek
  2020-05-07 14:07     ` Tony Lindgren
  0 siblings, 1 reply; 8+ messages in thread
From: Pavel Machek @ 2020-05-06 23:05 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: kernel list, linux-omap, sre, nekit1000, mpartap, merlijn, martin_rysavy

[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]

On Wed 2020-05-06 07:43:38, Tony Lindgren wrote:
> * Pavel Machek <pavel@ucw.cz> [200506 10:12]:
> > Hi!
> > 
> > So... I found out that USB networking works way better when I don't
> > attempt to charge the phone at the same. Yes, green light was
> > blinking.
> 
> OK yes we don't have much of a charger detection currently and the
> charger tries to reconnect with the LED blinking rapidly with an
> empty battery.

Do you have an idea why that causes problems with usb data connection?

I created a script to disable charging -- and that works. I also found
out cable about 5cm long. Not nice to use, but works significantly
better w.r.t. charging.

> > To github.com:pavelmachek/ofono.git
> >    e7b58fdd..1e7e5ce3  mux-v1.19-2 -> mux-v1.19-2
> > 
> > which creates copy of atchat, so I don't damage existing
> > functionality. It still seems to somehow work. Lot more work is still
> > needed. Designed to work with latest kernel patches from Tony, using
> > gsmmux interfaces.
> 
> OK, sounds like that should work :)

As I said, still ton of work to do :-(.

> I still need to figure update audio notifications for the current set of
> gsmmux patches. Eventually maybe ofono can just set the voice call audio
> routing using alsa. But let's get the kernel notifications working first
> as we also need to fix up the audio parts for the earlier comments from
> Peter and Sebastian.

Ofono does not normally touch ALSA, so I'd prefer not to do it from
there.

But I might be confused. I recall some audio patches were needed for
basic phone calls (setting up mixers to connect gsm<->audio), but
those worked before gsmux support was enabled. (Maybe some hardcoded
commands were needed to be sent to gsmmux somewhere).

I assume neither gsmmux audio parts nor mixer parts are available in
-next at the moment?

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: USB networking news, ofono for d4: less hacked version
  2020-05-06 23:05   ` Pavel Machek
@ 2020-05-07 14:07     ` Tony Lindgren
  2020-05-08 10:02       ` ofono for d4: less hcked and more working version was " Pavel Machek
  0 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2020-05-07 14:07 UTC (permalink / raw)
  To: Pavel Machek
  Cc: kernel list, linux-omap, sre, nekit1000, mpartap, merlijn, martin_rysavy

* Pavel Machek <pavel@ucw.cz> [200506 23:06]:
> On Wed 2020-05-06 07:43:38, Tony Lindgren wrote:
> > * Pavel Machek <pavel@ucw.cz> [200506 10:12]:
> > > Hi!
> > > 
> > > So... I found out that USB networking works way better when I don't
> > > attempt to charge the phone at the same. Yes, green light was
> > > blinking.
> > 
> > OK yes we don't have much of a charger detection currently and the
> > charger tries to reconnect with the LED blinking rapidly with an
> > empty battery.
> 
> Do you have an idea why that causes problems with usb data connection?

If the charger is configured to draw too much current, the USB port
or hub will cut it off. I have been carrying the following patch in
droid4-pending-v5.6 that lowers the charge current if it fails, maybe
see if that helps?

> I created a script to disable charging -- and that works. I also found
> out cable about 5cm long. Not nice to use, but works significantly
> better w.r.t. charging.

Yeah some USB cables are really thin.

> > I still need to figure update audio notifications for the current set of
> > gsmmux patches. Eventually maybe ofono can just set the voice call audio
> > routing using alsa. But let's get the kernel notifications working first
> > as we also need to fix up the audio parts for the earlier comments from
> > Peter and Sebastian.
> 
> Ofono does not normally touch ALSA, so I'd prefer not to do it from
> there.

OK

> But I might be confused. I recall some audio patches were needed for
> basic phone calls (setting up mixers to connect gsm<->audio), but
> those worked before gsmux support was enabled. (Maybe some hardcoded
> commands were needed to be sent to gsmmux somewhere).

We're currently reconfiguring the TDM transport that based on the
unsolicited messages on dlci1. I still need to figure out how to add
that back while keeping the serdev-ngsm driver generic.

I'm thinking maybe we'll just have the voice call audio driver also be a
read-only consumer driver for dlci1 to listen to the unsolicited
messages on dlci1, and also request n_gsm spin up /dev/gsmtty1.

Then if at some point we have some Linux generic modem framework, it
can provide some notifiers for the call state.

> I assume neither gsmmux audio parts nor mixer parts are available in
> -next at the moment?

Sorry not yet, will post as soon as I have the audio notifiers part
working, so it will be some days away still with time permitting.

Regards,

Tony

8< -------------------------------
From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Sun, 16 Feb 2020 16:59:06 -0800
Subject: [PATCH] power: supply: cpcap-charger: Adjust current based on
 charger interrupts

When debugging why higher than 500 mA charge current does not work, I
noticed that we start getting lots of chrgcurr1 interrupts if we attempt
to charge at rates higher than the charger can provide.

Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/power/supply/cpcap-charger.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c
--- a/drivers/power/supply/cpcap-charger.c
+++ b/drivers/power/supply/cpcap-charger.c
@@ -147,6 +147,8 @@ struct cpcap_charger_ddata {
 	int status;
 	int state;
 	int voltage;
+	int last_current;
+	int last_current_retries;
 };
 
 struct cpcap_interrupt_desc {
@@ -616,6 +618,7 @@ static void cpcap_usb_detect(struct work_struct *work)
 	/* Just init the state if a charger is connected with no chrg_det set */
 	if (!s.chrg_det && s.chrgcurr1 && s.vbusvld) {
 		cpcap_charger_update_state(ddata, CPCAP_CHARGER_DETECTING);
+		ddata->last_current = 0;
 
 		return;
 	}
@@ -662,6 +665,30 @@ static void cpcap_usb_detect(struct work_struct *work)
 		else
 			max_current = CPCAP_REG_CRM_ICHRG_0A532;
 
+		switch (ddata->state) {
+		case CPCAP_CHARGER_DETECTING:
+			ddata->last_current_retries = 0;
+			break;
+		case CPCAP_CHARGER_DISCONNECTED:
+			if (ddata->last_current > CPCAP_REG_CRM_ICHRG_0A532) {
+				/* Attempt current 3 times before lowering */
+				if (ddata->last_current_retries++ >= 3) {
+					ddata->last_current--;
+					ddata->last_current_retries = 0;
+					/* Wait a bit for voltage to ramp up */
+					usleep_range(40000, 50000);
+				}
+				max_current = ddata->last_current;
+			}
+			dev_info(ddata->dev, "enabling charger with current %i\n",
+				 max_current);
+			break;
+		default:
+			ddata->last_current_retries = 0;
+			break;
+		}
+
+		ddata->last_current = max_current;
 		vchrg = cpcap_charger_voltage_to_regval(ddata->voltage);
 		error = cpcap_charger_set_state(ddata,
 						CPCAP_REG_CRM_VCHRG(vchrg),
-- 
2.26.2

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

* ofono for d4: less hcked and more working version was Re: USB networking news, ofono for d4: less hacked version
  2020-05-07 14:07     ` Tony Lindgren
@ 2020-05-08 10:02       ` Pavel Machek
  2020-05-09 13:57         ` Tony Lindgren
  2020-05-09 14:31         ` Tony Lindgren
  0 siblings, 2 replies; 8+ messages in thread
From: Pavel Machek @ 2020-05-08 10:02 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: kernel list, linux-omap, sre, nekit1000, mpartap, merlijn, martin_rysavy

[-- Attachment #1: Type: text/plain, Size: 2109 bytes --]

Hi!

> > But I might be confused. I recall some audio patches were needed for
> > basic phone calls (setting up mixers to connect gsm<->audio), but
> > those worked before gsmux support was enabled. (Maybe some hardcoded
> > commands were needed to be sent to gsmmux somewhere).
> 
> We're currently reconfiguring the TDM transport that based on the
> unsolicited messages on dlci1. I still need to figure out how to add
> that back while keeping the serdev-ngsm driver generic.

Is it really neccessary? I believe I was simply configuring codecs for
voice call and left them like that.

> > I assume neither gsmmux audio parts nor mixer parts are available in
> > -next at the moment?
> 
> Sorry not yet, will post as soon as I have the audio notifiers part
> working, so it will be some days away still with time permitting.

Thanks... feel free to cc me.

I pushed new version of ofono: I'm still not sure about those incoming
sms (but _some_ sms are received). Rest should be better.

Best regards,
								Pavel

user@devuan:/my/ofono$ git push
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 479 bytes | 0 bytes/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To github.com:pavelmachek/ofono.git
   606faf92..f6f43041  mux-v1.29-3 -> mux-v1.29-3


commit f6f43041ab33e2b811b73d4009ecfa0692d192aa
Author: Pavel <pavel@ucw.cz>
Date:   Fri May 8 11:57:04 2020 +0200

    Trivial fix for incoming calls. Now basic functionality should
    work.

commit 606faf92c289166a5577963f1f987bc321edd226
Author: Pavel <pavel@ucw.cz>
Date:   Fri May 8 11:45:32 2020 +0200

    Got enough of netreg to work for ofone to talk to us.

    Incoming calls do NOT seem to work.

    Outgoing calls seem ok.

    Incoming SMS seem ok.

    Outgoing SMS seem ok.
    

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: ofono for d4: less hcked and more working version was Re: USB networking news, ofono for d4: less hacked version
  2020-05-08 10:02       ` ofono for d4: less hcked and more working version was " Pavel Machek
@ 2020-05-09 13:57         ` Tony Lindgren
  2020-05-09 14:31         ` Tony Lindgren
  1 sibling, 0 replies; 8+ messages in thread
From: Tony Lindgren @ 2020-05-09 13:57 UTC (permalink / raw)
  To: Pavel Machek
  Cc: kernel list, linux-omap, sre, nekit1000, mpartap, merlijn, martin_rysavy

* Pavel Machek <pavel@ucw.cz> [200508 10:03]:
> Hi!
> 
> > > But I might be confused. I recall some audio patches were needed for
> > > basic phone calls (setting up mixers to connect gsm<->audio), but
> > > those worked before gsmux support was enabled. (Maybe some hardcoded
> > > commands were needed to be sent to gsmmux somewhere).
> > 
> > We're currently reconfiguring the TDM transport that based on the
> > unsolicited messages on dlci1. I still need to figure out how to add
> > that back while keeping the serdev-ngsm driver generic.
> 
> Is it really neccessary? I believe I was simply configuring codecs for
> voice call and left them like that.

Yes something needs to call set_tdm_slot() for voice calls. AFAIK we have
only the dlci1 messages indicating a voice call is happening.

So I got that added directly into the snd-soc-motmdm driver where it now
listens to notifications on dlci1 while we still have /dev/gsmtty1 for
userspace. Looks like I still need to fix the mixer controls before I can
test voice calls again though.. Will post the patches as soon as I get
that done.

I'm not yet sure what's the preferred way to do notifications with ALSA,
but based on the earlier comments the piece of code calling set_tdm_slot()
should not be the codec driver. Instead, it should be called by either
snd-soc-audio-graph-card or a custom card driver for the device.

> I pushed new version of ofono: I'm still not sure about those incoming
> sms (but _some_ sms are received). Rest should be better.

OK

Regards,

Tony

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

* Re: ofono for d4: less hcked and more working version was Re: USB networking news, ofono for d4: less hacked version
  2020-05-08 10:02       ` ofono for d4: less hcked and more working version was " Pavel Machek
  2020-05-09 13:57         ` Tony Lindgren
@ 2020-05-09 14:31         ` Tony Lindgren
  2020-05-09 19:36           ` Pavel Machek
  1 sibling, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2020-05-09 14:31 UTC (permalink / raw)
  To: Pavel Machek
  Cc: kernel list, linux-omap, sre, nekit1000, mpartap, merlijn, martin_rysavy

* Pavel Machek <pavel@ucw.cz> [200508 10:03]:
> I pushed new version of ofono: I'm still not sure about those incoming
> sms (but _some_ sms are received). Rest should be better.

Please check that you have applied commit 738b150ecefb ("ARM: dts:
omap4-droid4: Fix occasional lost wakeirq for uart1"), otherwise incoming
SMS may not always show up, and GPS can stop producing data.

Hmm for ofono motchat, why not handle the U0000 part directly in motchat
and use just a timestamp based ID there?

Regards,

Tony

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

* Re: ofono for d4: less hcked and more working version was Re: USB networking news, ofono for d4: less hacked version
  2020-05-09 14:31         ` Tony Lindgren
@ 2020-05-09 19:36           ` Pavel Machek
  0 siblings, 0 replies; 8+ messages in thread
From: Pavel Machek @ 2020-05-09 19:36 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: kernel list, linux-omap, sre, nekit1000, mpartap, merlijn, martin_rysavy

[-- Attachment #1: Type: text/plain, Size: 1522 bytes --]

On Sat 2020-05-09 07:31:11, Tony Lindgren wrote:
> * Pavel Machek <pavel@ucw.cz> [200508 10:03]:
> > I pushed new version of ofono: I'm still not sure about those incoming
> > sms (but _some_ sms are received). Rest should be better.
> 
> Please check that you have applied commit 738b150ecefb ("ARM: dts:
> omap4-droid4: Fix occasional lost wakeirq for uart1"), otherwise incoming
> SMS may not always show up, and GPS can stop producing data.

Thanks for support. But problem is not that SMS fails to come. Problem
is that it comes over and over and over again. It takes few minutes.

Now it is 20:40, and I got:

{MessageManager} [/motmdm_1] IncomingMessage Vazeny zakazniku, bylo
Vam vygenerovane nasledujici jednorazove heslo pro pristup do
samoobsluhy: 947xxx ({ LocalSentTime = 2020-05-09T20:38:38+0200,
SentTime = 2020-05-09T20:38:38+0200, Sender = Tescomobile })

I believe that I'll get it again in half an hour or something. Then I
reboot to stock rom, and will receive it for one final time. (Unless
my last hack worked.).

Hmm, hour has passed, and no message. Interesting. Maybe I finally got
it right?

> Hmm for ofono motchat, why not handle the U0000 part directly in motchat
> and use just a timestamp based ID there?

Yes, that's possible future improvement :-). I plan to get it to work,
first...

Best regards,

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

end of thread, other threads:[~2020-05-09 19:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 10:11 USB networking news, ofono for d4: less hacked version Pavel Machek
2020-05-06 14:43 ` Tony Lindgren
2020-05-06 23:05   ` Pavel Machek
2020-05-07 14:07     ` Tony Lindgren
2020-05-08 10:02       ` ofono for d4: less hcked and more working version was " Pavel Machek
2020-05-09 13:57         ` Tony Lindgren
2020-05-09 14:31         ` Tony Lindgren
2020-05-09 19:36           ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).