Closed Bug 872417 Opened 12 years ago Closed 7 years ago

B2G Emulator: support FMRadio emulation

Categories

(Firefox OS Graveyard :: Emulator, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: vicamo, Assigned: vicamo)

References

Details

Per bug 862672 comment 52, we might need an emulated FM chip for further testing. The FM hardware we're using for Unagi is WCN2243, code named Bahama[1], supported by Qualcomm Tavarua FM core driver[2]. The major mission here should be implement minimum necessary drivers, host emulation for Gecko FMRadio component while providing console commands that enables further automation tests as well. Known requirements/limits[3] are: 1) handset switch in /devices/virtual/switch/h2w 2) V4L2 device in /dev/radio0. Supported ioctls are VIDIOC_QUERYCAP, 2.1) VIDIOC_QUERYCAP (get capabilities): 2.1.1) V4L2_CAP_RADIO, 2.1.2) V4L2_CAP_TUNER 2.2) VIDIOC_S_CTRL (control set): 2.2.1) V4L2_CID_PRIVATE_TAVARUA_STATE (FM_RECV & FM_OFF), 2.2.2) V4L2_CID_PRIVATE_TAVARUA_EMPHASIS, 2.2.3) V4L2_CID_PRIVATE_TAVARUA_RDS_STD (always 0), 2.2.4) V4L2_CID_PRIVATE_TAVARUA_SPACING, 2.2.5) V4L2_CID_PRIVATE_TAVARUA_REGION, 2.2.6) V4L2_CID_PRIVATE_TAVARUA_SET_AUDIO_PATH, 2.3) VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY (get frequency) 2.4) VIDIOC_S_TUNER, VIDIOC_G_TUNER (tuner attributes): 2.4.1) rangelow, 2.4.2) rangehigh 2.5) VIDIOC_DQBUF (exchange a buffer with the driver) 2.6) VIDIOC_S_HW_FREQ_SEEK (perform a hardware frequency seek) 3) Android properties 3.1) "hw.fm.version": WO, 3.2) "hw.fm.mode": WO, "normal" or "config_dac" 3.3) "hw.fm.init": RO, 3.4) "ro.moz.fm.noAnalog": RO 3.5) "hw.fm.isAnalog": WO 4) Android service: 4.1) "fm_dl": oneshot service, write pre-configured parameters to device. [1]: https://www.codeaurora.org/gitweb/quic/le/?p=kernel/msm.git;a=commitdiff;h=31b2fd9ccd06f593ddd987dd13b29e42cebcf93a [2]: https://www.codeaurora.org/gitweb/quic/le/?p=kernel/msm.git;a=blob;f=drivers/media/radio/radio-tavarua.c;h=afc36408fd7b476993c811a40211b809b2c29cd4;hb=refs/heads/ics_chocolate_rb4.2 [3]: https://mxr.mozilla.org/mozilla-central/source/hal/gonk/GonkFMRadio.cpp
Looking forward to it!
Mostly V4L2 stuff are necessary and don't seem to me some serious problems. We can also fill user buffer with some random data. For Android properties and fm_dl service, currently we don't break the whole initialization process for their absence. That 4-second wait loop also acts as a hardware delay that we need to reproduce bug 862672. Looks doable for me.
But I'd like to add: hard-code some hardware initialization code in Gecko is really unwise. We should split them into some HAL module that implements a predefined common interface as possible.
In the current implementation of FM Radio, we may need these functions. I know there are some discussions about RDS support but this future is not enabled on unagi. * EnableFMRadio: Initialize FM chip (async) * DisableFMRadio: Release FM resource (async) * FMRadioSeek: Seek FM frequency with up/down direction (async) * GetFMRadioFrequency: Get current frequency (sync) * SetFMRadioFrequency: Set specific frequency (sync) * GetFMRadioSignalStrength: Get signal strength (sync)
(In reply to StevenLee from comment #5) > In the current implementation of FM Radio, we may need these functions. I > know there are some discussions about RDS support but this future is not > enabled on unagi. > * EnableFMRadio: Initialize FM chip (async) > * DisableFMRadio: Release FM resource (async) > * FMRadioSeek: Seek FM frequency with up/down direction (async) > * GetFMRadioFrequency: Get current frequency (sync) > * SetFMRadioFrequency: Set specific frequency (sync) > * GetFMRadioSignalStrength: Get signal strength (sync) How about IsFMRadioOn and GetFMRadioSettings?
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #2) > Mostly V4L2 stuff are necessary and don't seem to me some serious problems. > We can also fill user buffer with some random data. Just find I'm wrong. VIDIOC_DQBUF is not for audio data, but for retrieving state transition status. So we're surely has to fill correct data according to current operation state.
(In reply to StevenLee from comment #5) > In the current implementation of FM Radio, we may need these functions. I > know there are some discussions about RDS support but this future is not > enabled on unagi. There might be some misunderstandings. Emulation here won't alter a line of code in Gecko.
Assignee: nobody → vyang
From bug 885370, we may add a GonkFM_Goldfish.cpp to completely ignore behaviours of Qualcomm WCN2243 and define our own virtual FM hardware.
Blocks: b2g-emulator
Depends on: 885370
No longer depends on: 885370
Component: General → Emulator
FYI, Tavarua support should be the only driver specific thing. It was a hack to make the 1.0 release. There is a full V4L2 standard mode in the FM backend which only uses standard V4L2 calls to setup the FM radio. I recommend testing that mode instead of Tavarua/MSM mode. I wrote a FM radio driver which works with it that may be helpful as a reference - https://bugzilla.mozilla.org/attachment.cgi?id=8334519&action=diff .
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.