yashsingh1/xdaforums huggingface dataset:
[Nexus 4 Q&A, Help & Troubleshooting] borich:
Sooooo...n4 has lte fully functional thanks to an hidden chip. Why fm radio shouldn't works? It's time to post the question in devs thread?
[Nexus 4 Q&A, Help & Troubleshooting] bartio1975:
Most ignorant people talk about FM radio as an antiquated technology. My gym tv's have their audio on different fm frequencies. Will TuneIn or IHeart work for that? Also, when I don't want to consume data but would like to listen to news/music I would like the option to listen to FM?! The only reason I bought the Samsung S-II i9100 was for the FM radio. The ATT version has FM disabled. And the one reason why I'm hesitant to buy the Nexus 4 is the lack of FM. Expand your mind/thinking. People use it for various purposes. Streaming apps don't always work for everyone, all the time in every continent/country!
[Nexus 4 Q&A, Help & Troubleshooting] xytkhi:
i wanna byu n4

buy only if can do something 2 play RADIO FM

so... its possible or not at all ?

thanks !
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
We don't know yet. I'd guess not enough dev types have N4 yet, and not enough time has passed.

From my perspective, if someone can build/boot a kernel that includes the same Qualcomm iris-radio FM driver as the Optimus G, and other S4/S4+ devices with WCN3660 combo chip, then we can find out.

Otherwise, someone will have to get a schematic or trace the PCB and see if the antenna pins are connected. Still, the ultimate proof will be working software. If no antenna connection, software will likely work, but will show RSSI around 0.
[Nexus 4 Q&A, Help & Troubleshooting] xytkhi:
thx 4 answer (:

im very eager to know if the Fm radio is possible in the n4

ok.. we will wait n see
[Nexus 4 Q&A, Help & Troubleshooting] mzanette:
We got LTE, FM coming? :p
[Nexus 4 Q&A, Help & Troubleshooting] borich:
news?
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
Thread would be active if there were news. Now we just have "busy talk" that hasn't changed.

Got a custom kernel loaded with the iris-fm driver ?

Got a case where someone loaded an Optimus G ROM on an N4 ?

Got a schematic ?

If no, no, no, the answer is no.
[Nexus 4 Q&A, Help & Troubleshooting] code65536:
I agree, and the lack of FM was, for a long time, a deal breaker for me. But I really wanted the Nexus 4, so I worked around the lack of a FM radio by buying a MW600 (Google it; I got mine for a bit under $45 at Amazon), which is a bluetooth headset with a built-in FM radio (so I get radio support via the headset, not via the phone). Since you've got to use a (wired) headset anyway with phone-based radio, switching to this headset wasn't too much of a burden.

I'd still like to be able to get in-phone FM, of course, but the MW600 works pretty well, so it's a nice stopgap while the N4's FM is sorted out (and if it turns out that the N4 can't support FM, I won't mind using the MW600 indefinitely; there are some perks, like not having a wire hanging out of my phone).
[Nexus 4 Q&A, Help & Troubleshooting] marsux:
RADIO IRIS driver

Could anybody compile a kernel with RADIO IRIS driver support and test it?

Or compile the driver as module and try to load it?

I read the compilation config file in kernel source code : github.com/android/kernel_msm/blob/android-msm-mako-3.4-jb-mr1/drivers/media/radio/Kconfig

There are 2 modules radio-iris and radio-iris-transport :

What is the role of radio-iris-transport?

config RADIO_IRIS
tristate "Qualcomm IRIS FM support"
depends on VIDEO_V4L2
default n
---help---
Say Y here if you want to use the Qualcomm FM chip (IRIS).
This FM chip uses SMD interface

To compile this driver as a module, choose M here: the
module will be called radio-iris.

config RADIO_IRIS_TRANSPORT
tristate "Qualcomm IRIS Transport"
depends on RADIO_IRIS
default n
---help---
Say Y here if you want to use the Qualcomm FM chip (IRIS).
with SMD as transport.

To compile this driver as a module, choose M here: the
module will be called radio-iris-transport.

---------- Post added at 08:37 PM ---------- Previous post was at 08:11 PM ----------

In radio-iris-transport source code : github.com/android/kernel_msm/blob/android-msm-mako-3.4-jb-mr1/drivers/media/radio/radio-iris-transport.c

there is a description :

But is it optional or required for testing FM?
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
Required.

There is only one configuration I've seen work on devices with the Qualcomm S4/S4+ SOC and Qualcomm WCN3660 FM/BT/WiFi combo chip:

- radio-iris driver compiled into the kernel.

- radio-iris-transport driver built as a loadable module.

Building the transport driver into the kernel doesn't work, for whatever reason.

MANY devices, even those without FM, now have a /system/etc/init.qcom.fm.sh shell script file which mostly does an insmod on /system/lib/modules/radio-iris-transport.ko .

My app, or a system/root portion of the framework or whatever, does this to activate the V4L driver:

"setprop hw.fm.mode normal ; setprop hw.fm.version 0 ; setprop ctl.start fm_dl"

I guess that in theory, some other "transport" could be used in future besides SMD/HCI.

At one time I thought that hcitool, or an app with HCI access could communicate with the FM part of the WCN3660 chip. Broadcom & TI combo (& cg2900) chips have the same architecture of using a shared core for Bluetooth & FM.

Broadcom chips, and older software for TI chips allowed HCI access via hcitool or whatever. But I tried this with WCN3660 and couldn't make it work, I think because the Bluetooth/HCI code is setup to reject FM access with this method.

BTW, with radio-iris loaded (in kernel), but withOUT radio-iris-transport loaded (as a loadable), a /dev/radio0 V4L access pseudo-file is created. But trying to use it generally results in a crash and reboot of the phone. Android drivers are often written badly, and crash like this when "unexpected" stuff happens.

I think the same happens when the transport driver is built into the kernel directly.

And if you don't see a /sys/bus/platform/drivers/APPS_FM directory, I think the transport driver can't be loaded. Some Qualcomm S4 SOC devices that don't use a WCN3660 don't have this dir.
[Nexus 4 Q&A, Help & Troubleshooting] ssauger:
Mike i think i have good news about N4, i asked franciscofranco here for the needed drivers in the kernel. I don't know much about it but read what you posteted in the N4 FM thread. He will do it and since i own a Nexus 4 i will help you as much as i can.
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
Great ! :)

If FM is possible on N4 I'll be very happy & will support it in Spirit (and coming Spirit2) as fast as I can. I'd dread having to wait 3+ months to get an N4 though.

I'd consider an Optimus G even, despite my distaste for LG, just to bypass the N4 waiting list. (EDIT: $800 on Ebay! Forget it, N4 only $500 or so.) But reading about the Optimus G I can't find a single comment from anyone about FM. It seems as if there is some rare variant available somewhere with official FM support, but I can't find it.

I see there's at least one Optimus G service manual with schematics out now: EN_LG-E973_SVC_ENG_121127.pdf . Under "2.5 SW Features" it shows "FM radio No N/A" but the hardware connections are there in the schematic, so hopefully it's just a software disablement.

There is almost no activity in the XDA Optimus G forums, especially compared to N4. I guess that helps explain why I haven't seen a single Optimus G user try to use Spirit and send me a debug log, despite my leaving it enabled on Google Play for just that reason.

It bugs me that I REALLY want to support the Qualcomm WCN3660 FM/combo chip and Qualcomm S4/S4+ SOCs better, but I've only found 3 HTC devices with this that can support FM so far: AT&T OneX LTE (which I have), HTC OneS and the Sprint Evo 4G LTE. And none are really selling all that well, especially compared with Galaxy S2/S3/Note/Note2.

It appears to me that Qualcomm & Exynos are the high end SOC winners of 2012/2013, but without much FM capability in popular products, that will mean little to me. Meanwhile TI OMAP is moving away from mobile, NVidia is really struggling & ST-Ericsson seems almost dead. Mediatek is thriving at the low end, but with virtually no presence in "the western world".
[Nexus 4 Q&A, Help & Troubleshooting] MaluNoPeleke:
I have a N4 and would like to help you if you tell me how.
[Nexus 4 Q&A, Help & Troubleshooting] ssauger:
So mike, what are the steps now? Can you contact franciscofranco for the kernel, since you have more knowlege whats needed. As i says, i can test and help. You can PM me, franco did not allow PM, i have wrote a email to him. It would be so great if FM is possible on that beast, N4 :)

Thanks in advance.
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
I don't have an N4 and I think an N4 owner needs to interface with kernel devs.

I posted there, and didn't see any response after skimming 70 new posts; I don't have time to hang out on a fast moving thread like that. I posted my info and thoughts and have nothing really to add to that.

Unless & until FM is proven I likely wont be getting an N4, and IMO an N4 owner needs to "champion" a cause like this. And I try not to seem too pushy with other devs, particularly busy unpaid volunteers (& still among the best), some of whom aren't that interested in assisting a dev such as myself with a "commercial app".
[Nexus 4 Q&A, Help & Troubleshooting] ssauger:
I will ask franco if he can build a kernel with the needed drivers that i can test than.
[Nexus 4 Q&A, Help & Troubleshooting] AlexWekell:
FM radio...I like to listen to that when I read the paper or watch vhs movies. If I'm out of range though, cassette tapes are sufficient.

Really though, do your local radio stations offer an online stream? A lot of places (and this might be an american thing) offer an equivalent stream that's accessed either through an app or an online radio streamer.

The best online radio app is TuneIn Radio
[Nexus 4 Q&A, Help & Troubleshooting] tylerwatt12:
FM radio is a good thing to have if there is no cell signal, the towers are down, in case of natural disaster, or if you don't have an unlimited data plan.
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
The vast majority of people posting on XDA are well aware of streaming apps, and the pros and cons.

There are plenty of over the air FM broadcast band transmissions that are not streamed, such as the audio from TV #3 at your local gym.

Then there are data plan costs, the huge number of people who live outside the few rich countries with dense cities with highly available data, and many other reasons.

This thread is a technical discussion about HOW (or if possible) to get OTA FM, not a debate about it's merits, nor is it intended to (no offence intended) educate those who don't understand why we would want OTA FM.
[Nexus 4 Q&A, Help & Troubleshooting] Quinny899:
Sorry, how good quality is your stream? Would I choose an online stream over my (admittedly DAB, but that's beside the point) radio? NOPE :nuke:
[Nexus 4 Q&A, Help & Troubleshooting] Tenny:
Really hopeful that we can get the FM radio working on here... I used to always question why FM radio is useful at all (like many in this thread) but as time has gone by, I have found several instances where I would love to have it.

-To listen to the TV's at the gym, you need FM Radio.

-Local Sports games are rarely played on the streaming apps. It's usually an error if they are playing them.
[Nexus 4 Q&A, Help & Troubleshooting] BringIT85:
This will be awesome if FM Radio works on Nexus 4...one question does one has to Root the device in order to get FM Radio working ??
[Nexus 4 Q&A, Help & Troubleshooting] Quinny899:
Most likely yes, as the stock kernel doesn't have the FM stuff in I don't think
[Nexus 4 Q&A, Help & Troubleshooting] BringIT85:
ah ok .then i gonna wait till it works then i am going to root .. any idea which method/way is the best to root N4 i am new to andriod and rooting stuff so any guidance on it will be helpful ..cause i dont want to brick my N4
[Nexus 4 Q&A, Help & Troubleshooting] Rusty!:
You wont brick it, the Nexus line is designed for it.

Just look at the guides*.

*But not in the paedo way
[Nexus 4 Q&A, Help & Troubleshooting] calanizzle:
TuneIN app
[Nexus 4 Q&A, Help & Troubleshooting] Quinny899:
Read the thread...
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
Nobody has proved yet whether or not FM will EVER be able to work on the N4. So "... wait till it works..." may be forever/never.

IF it's possible it will likely require a custom kernel, which requires rooting, unlocking or whatever.

"I want FM too" or "How do I get FM" posts just distract us... A thread title making it clear it's unknown yet, or moving the thread to a dev section (but not 2 threads !) might reduce the distractions.
[Nexus 4 Q&A, Help & Troubleshooting] BringIT85:
My first comment was if it works on N4 so i am not rooting it right away
[Nexus 4 Q&A, Help & Troubleshooting] craggy_island:
I have built a kernel with radio-iris driver compiled into it and the transport driver as a loadable module.

I can load radio-iris-transport.ko, have /dev/radio0 and can see a /sys/bus/platform/drivers/APPS_FM directory

However when I try open /dev/radio0 it returns -1

Probably not a good sign....i'll keep digging...
[Nexus 4 Q&A, Help & Troubleshooting] ssauger:
Sounds good that someone tried it on kernel side. Francisco told me in his kernel thread its possible to include the drivers and i should email him. But no response since few days about it.
[Nexus 4 Q&A, Help & Troubleshooting] marsux:
Great, thank you for compiling kernel with drivers,

I don't know if the error while opening /dev/radio0 is a bad news. How do you open it, with a C code ?

Anyway, could you test if you can get FM signal or debug info with "Spirit FM December 11 Free" (or later) ?

There are free versions in this thread : http://xdaforums.com/showthread.php?t=1059296 (latest version in the first lines)

Maybe mikereidis can tell us what to do now.

Within the app, go to Menu > Email logs, to send logs to the Spirit developer.

Thanks.
[Nexus 4 Q&A, Help & Troubleshooting] craggy_island:
Yep at the moment I have a very simple shared object that simply does:

int fd = open(radio_path, O_RDONLY, O_NONBLOCK);

I have already tried Spirit FM and it doesn't work :( I can certainly email the logs to the dev
[Nexus 4 Q&A, Help & Troubleshooting] ssauger:
Yeah, maybe you can find some usefull together with the dev. Thanks for your work and please let us up to date here ;)
[Nexus 4 Q&A, Help & Troubleshooting] FISKER_Q:
Not sure if that's what the Spirit FM app does, but you could always try making a dmesg and logcat and post it for the dev.
[Nexus 4 Q&A, Help & Troubleshooting] craggy_island:
No problem glad to help :) I too would like fm as i use it for listening to the commentary at rugby matches!

---------- Post added at 04:12 PM ---------- Previous post was at 03:59 PM ----------

i'm pretty sure at some point Spirit FM is going to have to have to get a handle on /dev/radio0 in order to communicate with the driver to set frequencies, get signal strength etc...

my intention was, as a test, to try and get the driver version...so maybe the driver isn't actually loaded...more digging...
[Nexus 4 Q&A, Help & Troubleshooting] craggy_island:
i can now access /dev/radio0 and my simple test returns a driver version of 0x30400

not sure if this is good news or not but i guess it proves the driver is loaded and working...
[Nexus 4 Q&A, Help & Troubleshooting] FISKER_Q:
So i assume Spirit FM is still not working?
[Nexus 4 Q&A, Help & Troubleshooting] craggy_island:
nope :( obviously i cant see Spirit Fm's code and just because i can communicate with the driver using the code i've written doesn't necessarily mean that a fully fledged fm radio will actually work but i guess it's a start...i'll keep trying...
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
Great ! Sounds like you have it working. You're using the VIDIOC_QUERYCAP ioctl ?

Perhaps you were getting an error before because permissions weren't opened on /dev/radio0 and you weren't running as root.

Assuming the above is true and good, there IMO remains one BIG question: Can we get RSSI above 20 or so when tuned to a strong station, with the wired headset plugged in for an antenna ?

If yes, and especially if you see RDS info using my Unlocked app, then it's "Game On !". And I'll be quickly checking EBay prices for N4... :)

Audio should be possible, since it can be done digitally, with no analog connections needed. But if headset antenna connection is there, I'd bet analog connections should be there too. (Actually I don't recall if analog is even used with WCN3660 right now anyway.)

For audio, set Audio-> Method to "HTC OneS/X LTE ALSA". It won't be set automatically.

Free version of Spirit is here. It supports RSSI at top left, but not RDS: http://d-h.st/mYw

Please send a debug log with Menu-> Test-> Email-> Logs and press Send after 20 seconds, or manually send the /sdcard/sprt_debug.txt file.
[Nexus 4 Q&A, Help & Troubleshooting] craggy_island:
hi mate!

that's exactly why i couldn't open /dev/radio0 !! silly mistake on part...doh!!

yep am using VIDIOC_QUERYCAP int ret = ioctl(fd, VIDIOC_QUERYCAP, &caps);

looks like we're getting somewhere :fingers-crossed: gonna try you're app right away...
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
:)

It will all end in exclamation marks and this thread getting very happy and busy... (Hope...)

Or disappointment...

It's always been a BIG thrill for me the first time I hear FM audio coming from a new device with a custom ROM.

Tick, tick, tick,... we're waiting... (Leaves for dinner...)
[Nexus 4 Q&A, Help & Troubleshooting] jessesam:
Will this also enable the FM transmitter so that we can play music through car speakers?
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
EXTREMELY unlikely, despite that Broadcom, TI, and these Qualcomm FM chips have the capability. It requires that the FM transmit antenna pin be connected somewhere useful. A super motivated person with the skills and likely thousands of dollars of equipment, MIGHT be able to make such a hardware mod.

For whatever reasons (such as FCC type regulatory approval costs and time delays) there has never been an Android phone that is widely available in the "West" that has official FM transmit support. Until recently I only knew of one that works unofficially (myTouch 4G), but have now found a few more: some models of Xperia P/U/Sola/Go. Sharp has/had some Japan only models, and I'm sure there are some obscure (to us at least) Chinese devices. I think I read once of some non-phone device with FM transmit too.
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
That's usually a sign that radio-iris-transport.ko is not loaded . It needs to be a loadable module, BTW, can't be in the kernel. The radio-iris should probably be built in though.

If it's not loaded, some V4L functions work, but trying to actually use FM crashes and reboots the phone. It seems pretty common that large company Android kernel device driver developers often don't use parameter validation, which crashes the kernel when "unexpected inputs" arrive.

Try something like this, from a root shell:

insmod /system/lib/modules/radio-iris-transport.ko

Or something like this:

setprop hw.fm.mode normal ; setprop hw.fm.version 0 ; setprop ctl.start fm_dl

Or run the QCom FM init script in /system/etc .

I've have a binary that might do something useful too, but your email bounced: http://d-h.st/oFM

If the transport driver won't load, then we might have another wall to climb.

EDIT: I guess he ran out of time today and will try tomorrow.
[Nexus 4 Q&A, Help & Troubleshooting] craggy_island:
ok....the good news...Spirit FM now starts :) :good: the bad news...the RSSI value remains at 0 even though I know the freq I've set is that of a strong local station and there's no sound...hopefully only a minor issue :fingers-crossed:

have sent logs to Spirit FM dev...
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
Well the only "good news" for me here is that I likely won't have to spend much more time on the Nexus 4. :(

The bad news is that I think this quest is done, with little hope.

Everything in the logs looks good except RSSI. Which means the FM chip is being controlled just fine.

The obvious explanation is that the FM Receive antenna pin is likely grounded. I've seen this on other devices with WCN3660.

Hypothetically there might be some other explanation, but I doubt it. I think the only thing that might have a slim chance is to find an Optimus G ROM with working FM radio, and use the kernel and/or other stuff from that, or at least kernel+stuff from a custom ROM that allows FM to work. Test with that and hypothetically FM might work.

But the chance is IMO so tiny that I might as well unsubscribe from this thread, and ask for someone to notify me if anyone ever gets FM working. But they won't. But I gave up one one Motorola device long ago and someone managed to figure out FM 3 years later. So you never know.

And now I close my Nexus 4 EBay tabs. I see auctions going for $450-500 or so and almost all 16 GB. Buy me nows seem to be $520 and up.
[Nexus 4 Q&A, Help & Troubleshooting] craggy_island:
kinda figured it was bad news when there was no signal...

case closed...
[Nexus 4 Q&A, Help & Troubleshooting] marsux:
I cannot believe it! It is sabotage from LG and Google..

I don't understand why.

Has Optimus G a FM radio ?

In comments from this page http://www.gsmarena.com/lg_optimus_g_e973-reviews-4941.php,

script_writer has written :
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
Same "sabotage" as on every other Nexus device, except the Nexus One.

The customers tell the phone OEMs "No FM", whether the customers are Google, ATT, Sprint, Verizon, etc.

This is largely a US (and Canada now) phenomenon. International versions of phones are much more likely to have FM.

Most of our carriers have decided we don't want free over-the-air FM, and that the cost to NOT disable FM would be too high. That's what they say to politicians, the NAB and allied groups anyway.

The NAB has tried to get a law passed, but the politicians listen more to the electronics industry. They claim it will cost big money and ultimately cost American jobs.

Early reports said yes. But nobody has reported FM available on their variant. I think the Korean version (F180 ?) might.
[Nexus 4 Q&A, Help & Troubleshooting] marsux:
Do you think the european version could have FM radio ?

Sadly, I believe there is only one version for the Nexus 4.
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
Not for a Nexus, no.

My Nexus FM hopes are confined to a possible future Nexus device supporting FM officially.

There is an experimental FMRadio branch of AOSP with the ST-Ericsson proposed Android FM API here: https://android-review.googlesource.com/#/q/owner:benn.porscke@stericsson.com+status:open,n,z

It's been slowly making it's way through AOSP for 2 years now, and only Sony supports it at present in 2012 devices using Radio3.apk .

But IMO the major phone and chip OEMs need to commit to some sort of FM API before it could ever become an official part of Android.

One can hope. Spirit2 is supporting this API, so I hope to do my little part in trying to make it a future reality.
[Nexus 4 Q&A, Help & Troubleshooting] mikereidis:
Never say never, LOL.

Turns out I forgot that the WCN3660 DOES have an antenna switch. The default is "External / Headset" which works fine on HTC devices. But devices like Xperia T use "Internal", which despite it's name can still be external and connected to the wired headset.

And I think any device using this pin for antenna can transmit too.

Jan 10 free version of Spirit FM app is here: http://d-h.st/FaY

It should set antenna to external for HTC devices and internal for all others. But there's a Debug-> Antenna setting to be sure of the setting.

Also, Audio-> Method setting should be automatic, should we get lucky with signal, but can still be set manually to "HTC OneS/X LTE ALSA" which is most likely to work.

As before, a kernel with the radio-iris-transport.ko module is required to test.