[HOWTO] activate the FM Radio

Search This thread

sudden36

Senior Member
Mar 5, 2013
223
308
Hey Ho :)
First of all I'm new to XDA so please excuse my mistakes.
I played a little bit with the sound chip of the 2x and got the audio routing for the FMRadio :victory:

First you need to flash this Download CWM by pengus77
Second you need Spirit FM by mikereidis

1) start Spirit FM
2) you can either execute the commands manualy in the terminal or you can download my script and execute it with "Script Manager"
Here are the commands:

EDIT: Updated version here

Now you should hear the station you selected through the headphones :)

PLEASE NOTE
  • The settings disappear after reboot
  • The settings disappear after a call
  • The settings disappear after you close Spirit FM
  • The settings might affect music playback and/or recording, to go back to normal reboot your phone or make a call
  • I'm not responsible if you damage your phone or your ears because of to loud music
  • The sound is only mono, because i don't have the paid version of Spirit FM and maybe it's a hardware limitation :/

Edit: This has been tested with ParanoidAndroid v2.6 - build 08 [Feb 22] and Kowalsky Kernel exp 112

I hope some developers stumble upon this and integrate it in their kernel/ROM

have fun
sudden36
 
Last edited:

kekks

Senior Member
Jun 13, 2012
383
227
Mumbai
The play store link for Spirit fm shows incompatible.

Thanks for the work.

Rom: pengus 0208
Kernel pengus 100p5

Sent from my LG-P990 using xda app-developers app
 

komedol

Senior Member
Jun 15, 2011
104
24
Thanks for the effort, been looking for working radio app for ages! Now I'm a happy camper :good:

One small problem though: when I turned on the FM radio, my phone mic picks up surrounding noise and channels it through my earphone (I'm on PA CM10 build 8 + kowalski 100p5 old bl). Could you please take a look at it?
 

sudden36

Senior Member
Mar 5, 2013
223
308
Thanks for the effort, been looking for working radio app for ages! Now I'm a happy camper :good:

One small problem though: when I turned on the FM radio, my phone mic picks up surrounding noise and channels it through my earphone (I'm on PA CM10 build 8 + kowalski 100p5 old bl). Could you please take a look at it?

Thanks for your feedback :)
I actually made a mistake with the last audio path, here should be the correct one:
Code:
#! /bin/sh

echo "Configuring Input"
alsa_amixer sset "IN1R" "off"
alsa_amixer sset "IN1R PGA IN1RN" "off"
alsa_amixer sset "IN1R PGA IN1RP" "off"
alsa_amixer sset "IN1L" "off"
alsa_amixer sset "IN1L PGA IN1LN" "off"
alsa_amixer sset "IN1L PGA IN1LP" "off"

echo "Configuring Output Mixer"
alsa_amixer sset "Right Output Mixer IN1R" "off"
alsa_amixer sset "Left Output Mixer IN1L" "off"
alsa_amixer sset "Right Output Mixer Right Input" "on"
alsa_amixer sset "Left Output Mixer Right Input" "on"

echo "Configuring Input Mixer"
alsa_amixer sset "MIXINR IN1R" "off"
alsa_amixer sset "MIXINL IN1L" "off"
alsa_amixer sset "MIXINR IN2R" "off"
alsa_amixer sset "MIXINL IN2L" "off"

# change these values to adjust volume to your needs
alsa_amixer sset "MIXINR IN1RP" "5"
alsa_amixer sset "MIXINL IN1LP" "5"

echo "Configuring Headphone Mux"
alsa_amixer sset "Left Headphone Mux" "Mixer"
alsa_amixer sset "Right Headphone Mux" "Mixer"

echo "done"

I hope this time it works ;)
 

Attachments

  • FMRadio.txt
    941 bytes · Views: 1,800

mikereidis

Inactive Recognized Developer
Jan 28, 2011
7,823
4,146
Ottawa/Gatineau, Canada
The play store link for Spirit fm shows incompatible.

I marked it incompatible because it hasn't worked on custom ICS+ ROMs for the last year+.

I'm happy to see this. I'll try to integrate the ALSA settings into the existing "LG4 / P990" audio-> method tonight. I did a hopeful update to this method in November but only one person reported it working and only briefly.

Do note however that my experience is this:

Getting FM audio working basically, as has been done here, is often VERY difficult (unless you already know the magic incantations). But it's often only 10% or so of the problem.

The other 90% of the work is making audio work well in the midst of phone calls, audio notifications, screen off, headset plug-ins and outs and many "edge cases".

As I've said repeatedly, most of my work these days is with audio issues and not the FM chips and APIs. Android has no framework to support FM audio. And it seems every manufacturer, device/chipset and ROMs do it at least somewhat differently. And it's usually analog audio, injected late in the audio processing chain (ie "hacked in"), rather than going through the normal digital audio paths everything else does.


My point is that I can only officially support this in Spirit if it works well, with few problems, and without too much work from me and without my needing to buy one to test. Otherwise, it may work, but will remain unofficial support.
 

pengus77

Recognized Developer
Mar 10, 2011
2,140
22,971
Penguins' Republic of Antarctica
I marked it incompatible because it hasn't worked on custom ICS+ ROMs for the last year+.

I'm happy to see this. I'll try to integrate the ALSA settings into the existing "LG4 / P990" audio-> method tonight. I did a hopeful update to this method in November but only one person reported it working and only briefly.

Do note however that my experience is this:

Getting FM audio working basically, as has been done here, is often VERY difficult (unless you already know the magic incantations). But it's often only 10% or so of the problem.

The other 90% of the work is making audio work well in the midst of phone calls, audio notifications, screen off, headset plug-ins and outs and many "edge cases".

As I've said repeatedly, most of my work these days is with audio issues and not the FM chips and APIs. Android has no framework to support FM audio. And it seems every manufacturer, device/chipset and ROMs do it at least somewhat differently. And it's usually analog audio, injected late in the audio processing chain (ie "hacked in"), rather than going through the normal digital audio paths everything else does.


My point is that I can only officially support this in Spirit if it works well, with few problems, and without too much work from me and without my needing to buy one to test. Otherwise, it may work, but will remain unofficial support.

Hiya, in the p990 kernel there are a couple tweaks i can implement, exposing via sysfs the is_call_mode and is_fmradio_mode booleans so it's possible to tell the kernel that we're using the radio. Those variables are in the wm8994 code and ICS blobs set them via ioctl. We'll probably also have to mod a bit the phone/framework code in cm10.X to support the same switching, but i think it's "the right way". I'll investigate a bit in ICS to see if i'm correct on this assumption, but if i am we could maybe perform a couple tests in private and see if it works as it should. What do you think ? ;)
 

MetaIIica

Senior Member
Aug 30, 2012
1,568
2,620
Saarbrücken
This is amazing, now we can hope we dont net this steps and the Dev can implement it or its can implement in the Kernel/Rom :D
 

sudden36

Senior Member
Mar 5, 2013
223
308
mike you have an email :D
A question about spirit fm, is the core code to controll the fm chip anywhere openly published, i would like to look at it, just for curiosity :confused:
I think tomorrow i will try to record some radio :laugh:
 

mikereidis

Inactive Recognized Developer
Jan 28, 2011
7,823
4,146
Ottawa/Gatineau, Canada
mike you have an email :D
A question about spirit fm, is the core code to controll the fm chip anywhere openly published, i would like to look at it, just for curiosity :confused:
I think tomorrow i will try to record some radio :laugh:

My code is not published.

This phone uses a Broadcom BCM4329 FM/BT/WiFi combo chip.

The old CM7/MIUI FM app "driver" code is open and used hcitool to control the chip.

There's also a V4L driver written by Nokia for an earlier BCM chip that is more or less register compatible. BCM2048 if I recall correctly.

Beyond that, no open source code exists that I'm aware of, but I haven't really looked in the last 12+ months. The chips specs are secret and I've never found them, even on Chinese sites dedicated to confidential tech documents.
 

tonyp

Inactive Recognized Developer
Feb 3, 2011
5,019
34,902
My code is not published.

This phone uses a Broadcom BCM4329 FM/BT/WiFi combo chip.

The old CM7/MIUI FM app "driver" code is open and used hcitool to control the chip.

There's also a V4L driver written by Nokia for an earlier BCM chip that is more or less register compatible. BCM2048 if I recall correctly.

Beyond that, no open source code exists that I'm aware of, but I haven't really looked in the last 12+ months. The chips specs are secret and I've never found them, even on Chinese sites dedicated to confidential tech documents.

In case it helps, here's the LG internal service manual which shows the technical paths and GPIOs etc.:
https://www.dropbox.com/s/etzanib7jgx7tp7/LG_P990_Optimus_2X_Star_Speed_service_manual.rar
 

Top Liked Posts

  • There are no posts matching your filters.
  • 51
    This script should reset the audio routing to the default values set at startup.
    However it is untested an your feedback is always appreciated :)

    The fearless of you can even remove the lines commented with "probably unneeded" and test it.

    greets
    sudden

    Left them in... :)

    May 8 Spirit FM Free http://d-h.st/rXW

    (As my sig indicates I'm mostly taking time off now, but I had to do a build for another reason, so...)
    50
    Hey Ho :)
    First of all I'm new to XDA so please excuse my mistakes.
    I played a little bit with the sound chip of the 2x and got the audio routing for the FMRadio :victory:

    First you need to flash this Download CWM by pengus77
    Second you need Spirit FM by mikereidis

    1) start Spirit FM
    2) you can either execute the commands manualy in the terminal or you can download my script and execute it with "Script Manager"
    Here are the commands:

    EDIT: Updated version here

    Now you should hear the station you selected through the headphones :)

    PLEASE NOTE
    • The settings disappear after reboot
    • The settings disappear after a call
    • The settings disappear after you close Spirit FM
    • The settings might affect music playback and/or recording, to go back to normal reboot your phone or make a call
    • I'm not responsible if you damage your phone or your ears because of to loud music
    • The sound is only mono, because i don't have the paid version of Spirit FM and maybe it's a hardware limitation :/

    Edit: This has been tested with ParanoidAndroid v2.6 - build 08 [Feb 22] and Kowalsky Kernel exp 112

    I hope some developers stumble upon this and integrate it in their kernel/ROM

    have fun
    sudden36
    18
    Awesome man! I'll setup this path directly in the kernel via a sysfs switch so it's persistent ;)
    15
    The play store link for Spirit fm shows incompatible.

    I marked it incompatible because it hasn't worked on custom ICS+ ROMs for the last year+.

    I'm happy to see this. I'll try to integrate the ALSA settings into the existing "LG4 / P990" audio-> method tonight. I did a hopeful update to this method in November but only one person reported it working and only briefly.

    Do note however that my experience is this:

    Getting FM audio working basically, as has been done here, is often VERY difficult (unless you already know the magic incantations). But it's often only 10% or so of the problem.

    The other 90% of the work is making audio work well in the midst of phone calls, audio notifications, screen off, headset plug-ins and outs and many "edge cases".

    As I've said repeatedly, most of my work these days is with audio issues and not the FM chips and APIs. Android has no framework to support FM audio. And it seems every manufacturer, device/chipset and ROMs do it at least somewhat differently. And it's usually analog audio, injected late in the audio processing chain (ie "hacked in"), rather than going through the normal digital audio paths everything else does.


    My point is that I can only officially support this in Spirit if it works well, with few problems, and without too much work from me and without my needing to buy one to test. Otherwise, it may work, but will remain unofficial support.
    13
    FM Disable script

    This script should reset the audio routing to the default values set at startup.
    However it is untested an your feedback is always appreciated :)

    The fearless of you can even remove the lines commented with "probably unneeded" and test it.

    greets
    sudden