Each FFT bin value is represented as an 8 bit integer
in SAMP message. But depending on the configuration,
the FFT bin value reported by HW might exceed 8 bits.
Clamp the FFT bin value between the min and max value
which can be represented by 8 bits. For linear mode,
min and max FFT bin value which can be represented by
8 bit is 0 and U8_MAX respectively. For dBm mode, min
and max FFT bin value which can be represented by 8 bit
is S8_MIN and S8_MAX respectively.
CRs-Fixed: 3056458
Change-Id: I9ec75f781a130d3ed0d0d9393975fd5874961ce0
It calls spectral_process_phyerr of spectral operations without any
check. Which cause null point dereference potentially. So, check this
pointer before calling.
Change-Id: Iae246f847dd41e62b628223652a9527a65b43799
CRs-Fixed: 3055246
Populate and expose the following 320MHz spectral capabilities.
- Agile spectral scan support for 320MHz mode.
- Number of detectors used for spectral scan in 320MHz mode.
Change-Id: Ibea77d4ec8b1d9322ef82d1d48236836ffad24ec
CRs-Fixed: 3053059
Pass report parameters to FFT bin byte swap function instead of
FFT bin length adjustment WAR.
Change-Id: I02a280bc4e8e0839c894a70258e1f16a784c08a6
CRs-Fixed: 3051559
FW sends Spectral scan detector info TLV in WMI_PDEV_SSCAN_FW_PARAM
event to indicate the information of a detector participating in a sscan
session. FW sends one TLV of this type for each detector participating
in a spectral scan session. Add support to process the TLV and update
the spectral host data structures accordingly.
CRs-Fixed: 3044193
Change-Id: Ie17b6ea9336ada7a00e4594fa2f7f49ef3d443e5
FW sends Spectral scan chan info TLV in WMI_PDEV_SSCAN_FW_PARAM_EVENTID
event to indicate the channel information for a spectral scan session.
Add support to process the TLV and update the spectral host data structures
accordingly.
CRs-Fixed: 3044162
Change-Id: Ibbf7f6bbbb267123bbdf44bcfffa2cfb1c2926df
On Beryllium architecture, PHY DMA applies a 32-bit byte swap to assist
in efficient Host reads when connected to a big-endian Host.
This is done to avoid byte swapping at the Host.
So, if the Host reads this data 32-bit word at a time, the byte order
would be intact. Report headers are not a problem because as they are
composed of 32-bit words. For FFT bins, read each DWORD at a time and
extract FFT bins out of that DWORD. Make this change in a generic way to
keep the design uniform across different chipsets and endian modes.
CRs-Fixed: 3042188
Change-Id: Idff1ac7eb5e18c692c9ee8b19b9ae9e6b962d486
Add Spectral APIs to convert channel width values
from enum phy_ch_width to nl80211_chan_width and
vice-versa.
CRs-Fixed: 3029184
Change-Id: I60fb7fb04b943b0d70c569ff6587e5e8efd7722b
Populate the list of supported spectral scan bandwidths for different
targets and use that in populating the detector list.
CRs-Fixed: 3042448
Change-Id: I5dac2c845843698bbafac64a01517acfbe120180
Initialize the variable "segid" to prevent the usage of junk value.
Dont dereference the spectral-lmac object if the same is NULL.
Change-Id: I5206a99017f77e5c94368d91171a7eb05745933c
Beryllium chipsets support FFT sizes as follows for different sscan widths.
20MHz:- Min FFT size: 5, Max FFT size: 9
40MHz:- Min FFT size: 5, Max FFT size: 10
> 40MHz:- Min FFT size: 5, Max FFT size: 11
Populate these FFT sizes for Beryllium targets.
CRs-Fixed: 3042443
Change-Id: Id7052e3513b29789e96c351aa4cdede499ef2578
Add support to configure spectral scan bandwidth as provided by the user.
Validate the user configured value before applying it. As the spectral scan
bandwidth is an optional parameter, when the user doesn't configure it, use
configure the spectral scan bandwidth to the maximum value supported by the
target for the current operating bandwidth.
Also, populate the spectral scan bandwidths supported for different
operating bandwidths on different targets.
CRs-Fixed: 3042424
Change-Id: I266aa5489b0ce5c149968067a06e1cc65bb4e3b7
Add locks for detector list, per-session report info
and per-session detector map, to avoid inconsistent
concurrent accesses.
Using spin_lock_bh for locking between Process and
Tasklet context.
CRs-Fixed: 2983801
Change-Id: If709fd91f193072f07b9dae19bf48e6da2d369d3
Move the left band and right band edge extra bins to
the end of the Spectral bin_pwr array.
CRs-Fixed: 3002177
Change-Id: Iea93879763a7e2c56cdb5f4d3d163e2d4b082b26
It doesn't check smode before used as array index, the potential risk
is that OOB read or write once get invalid value from target. So, this
change checks smode value before using.
Change-Id: Ibc0625f43e31bc8b49694cca778726c6528290a8
CRs-Fixed: 3034136
In target_if_process_phyerr_gen2(), initialize variables
to prevent usage of junk values.
In target_if_process_sfft_report_gen3(), add check to
ensure the index doesn't exceed the size of the array.
Change-Id: Ie738d1fc836e1a2ec1358b635a4b6c64a424b894
Different chipsets are reporting cfreq1 and cfreq2 in different formats in
Spectral reports. This leads to confusion at the user-interface level.
Convert the cfreq1 and cfreq2 representations as follows before sending the
Spectral report to upper layers.
For a contiguous channel, cfreq1 will represent the center of the entire
span and cfreq2 will be 0. For a discontiguous channel like 80p80, cfreq1
will represent the center of the first segment whereas cfreq2 will
represent the center of the second segment.
CRs-Fixed: 3020790
Change-Id: I86e330c9a3a66701f274e20db2d8bc5934608a6b
As part of Spectral init, the Host sends DMA ring init command to
HALPHY. QCN9224 M2M emulation setups don't have HALPHY subsystem and
the WMI command need to be cleanly stubbed out in emulation FW image.
Until then, revert this Spectral init change.
Change-Id: I88e3e3995ee1b7103a03e4b6a38ff4117044c63c
CRs-Fixed: 3016633
The host can receive some spectral samples even after stopping the scan
as there could be some samples already sitting in the WMI event pipe.
Drop those frames in the driver itself.
CRs-Fixed: 3014336
Change-Id: I8aece67b46aa84e974b538f40ffcb937c855f5a3
In SBS modes, there are 3 detectors shared between 2 pdevs that are operate
in 5GHz band. Global number space is used for detectors across these pdevs.
Detector list should be following in SBS modes.
For the pdev that use PHYA0:
detector 0 for normal mode
detector 2 for agile mode
For the pdev that use PHYA1:
detector 1 for normal mode
detector 2 for agile mode
There is no direct way of knowing which pdevs are using PHYA0 or PHYA1.
We need to look at the phy_id of a given pdev and compare against other
pdevs on the same psoc to figure out whether the given pdev is operating
using PHYA1. Add the necessary support for the same.
CRs-Fixed: 2993772
Change-Id: I034fe64a7a8988e327a60684a0d008f4b22ef395
Use lb_edge_bins->start_bin_idx as the bin_pwr array start bin
index, when left band edge extra bins are present.
In all other cases, use the detector start bin index
detector_info->start_bin_idx.
CRs-Fixed: 3005949
Change-Id: Ic91c3eb386d693b3f929c687e269e882b6bd8f59
The per-session detector map is keyed by detector ID
from the Spectral FFT report and is only valid for one
session, ie. start scan to stop scan.
There is a possibility of receiving FFT report with
an invalid detector ID, for a particular session.
Due to this, invalid detector map information may get
accessed.
Verify that detector ID received in Spectral report is
valid for given spectral scan mode and channel width,
by checking the detector list.
Add a validity flag to the per_session_det_map, and check
whether detector map is valid for the detector ID used to
access it.
CRs-Fixed: 2998410
Change-Id: I1f38ae22b458bb1fea62b99422ec60095071b3c6
Modify APIs target_if_dbg_print_samp_msg() and
target_if_dbg_print_samp_param() to use the
new formats for spectral_samp_msg and
target_if_samp_msg_params, respectively.
CRs-Fixed: 2961953
Change-Id: Ib0776c2189e9ca1dc33d38f2a7609aa6d15959ee
Add a new API free_samp_msg_skb(), to free
SAMP msg buffer, if error in phyerr processing
for 160/80p80 MHz modes. Call this API from
reset_160mhz_delivery_state_machine(), to
avoid redundancy.
CRs-Fixed: 2961987
Change-Id: I3a0488997e474fef6f4f57e3fbfd1a163c91ac7b
Add API target_if_spectral_populate_samp_params_gen2() to
populate fields in target_if_samp_msg_params, using
search fft report and target_if_spectral_rfqual_info
fields.
CRs-Fixed: 2961986
Change-Id: Iad970483f6183d2e52d97e6c3ddf8f146845fbe4
Add API target_if_spectral_populate_samp_params_gen3() to
populate fields in target_if_samp_msg_params, using
Spectral report, search fft report and spectral scan
summary report.
CRs-Fixed: 2945300
Change-Id: Idce57af9a198773491f6c6bc7303641ec0fb15a7
Modify struct target_if_samp_msg_params to only include
fields to fill the new SAMP message format, which
are not present in the per-session report-level
info and detector map structures.
CRs-Fixed: 2961956
Change-Id: I54f69bb63c5b64a59cb83b9f205c74c83475fc14
Add sscan_detector_list struct to store the number
of detectors and detector list for a given Spectral
scan mode and channel width, based on the target type.
Initialize this struct during target_if_pdev_spectral_init.
CRs-Fixed: 2961954
Change-Id: Ia920438429579c096349a0170d15e288d46cf9a9
Add API target_if_spectral_get_start_end_freq to set
start and end frequencies in the per-session
detector level map, based on spectral scan
cfreq1/cfreq2 and operating BW.
API target_if_populate_detector_start_end_freqs handles
population of the start and end frequencies per-detector,
in a session.
CRs-Fixed: 2961957
Change-Id: I68a052db6643d92c22e7ee671f4e46af33c2fa08
Replace numerical values with macros, for indicating
position and size of Spectral FFT report fields, in
target_if_consume_sfft_report_gen3().
Change-Id: I81994ebb0d642bc4cbebe2b24aabcae567ae6a9c
CRs-Fixed: 2945319
Modify prev_tstamp variable in target_if_spectral
structure to an array and index it based on detector ID.
Also, modify target_if_spectral_verify_ts() to include
detector_id parameter and compare current timestamp with previously
received sample on per-detector level, to check discrepancy.
Change-Id: I9f6382909ac0661323db54f160f1350cb8bd8153
CRs-Fixed: 2945318
Add target_if_spectral_get_num_fft_bins() to find the
number of FFT bins, from the Spectral FFT size.
It will adjust the number of FFT bins according to
Spectral report mode.
Change-Id: I8f81f2b784d71387f951c38701af6cf4443246e0
CRs-Fixed: 2945316
Add API to fill FFT bin start and end indices to the
detector map, depending on the values of cfreq1 and cfreq2.
This is to handle samples where the frequency of
Detector 0 is greater than that of Detector 1.
Fill the start and end indices for bins such that
the bin_pwr array is in increasing order of
frequencies but the order of detectors same as
that sent by the HW.
Add API target_if_update_session_info_from_report_ctx(),
to populate the per-session information in the
consume report context. This includes population of
start and end bin indices on per-detector level,
start and end frequencies on per-detector level
and cfreq1/cfreq2 on per-report level,
Change-Id: I044c6961e5f710089b0192876e8717f9127b497f
CRs-Fixed: 2945315
Find the last_raw_timestamp and adjusted_timestamp
as part of the FFT report processing API.
Change-Id: Ibc7fd524ca897ead3b4b8ca25ba6e6487154305d
CRs-Fixed: 2945307
Fill per-session information in per_session_det_map and
per_session_report_info, with per-report and per-detector
level information, respectively.
These intermediate structures help in filling the
SAMP message.
Change-Id: Ib194fde3567ce76710e010febf729746fedf7a2c
CRs-Fixed: 2945297
Add a new API target_if_fill_samp_msg, to populate
the Spectral SAMP message and detector level
information, using pdev_spectral_det_map
and per_session_report_info. Send the SAMP message
to upper layers when completely filled.
Change-Id: If43494fe4a09dbfeb9aea6cb0fa20b406d81e390
CRs-Fixed: 2945282
Refactor target_if_consume_spectral_report_gen3()
and divide the functionality into individual
functions.
This will be under OPTIMIZED_SAMP_MESSAGE flag, which
is unset by default for all profiles, till
development is complete.
Change-Id: I07e753dcaff6e81dfc8739df4e691d871c921581
CRs-Fixed: 2945171
A state machine checks if spectral reports are
in order for gen3 spectral 160/80p80. Currently,
this state machine has four states.
Modify this state machine to have only two states and
change associated APIs accordingly.
Change-Id: I754758fdf0529394c63fe371f54db79d52459999
CRs-Fixed: 2945161
Define a map with per-detector information, that is
keyed by the detector ID from Spectral FFT report.
Use per-detector information from this map to fill
the Spectral SAMP message.
Define struct per_session_report_info, for per session
info that needs to be filled at report level within
SAMP message.
Change-Id: I9f73bd904cc3d4cac42d21b89b1ceb586da7f911
CRs-Fixed: 2945158
Modify the API to include Validation and
processing of Spectral search FFT report.
This will be under OPTIMIZED_SAMP_MESSAGE flag, which
is unset by default for all profiles, till
development is complete.
Change-Id: I250867e2c002f491f51a36416ea9ca5ae0bc5508
CRs-Fixed: 2945132
Modify target_if_consume_sscan_summary_report_gen3() to
include validation and processing of Spectral summary
report.
This will be under OPTIMIZED_SAMP_MESSAGE flag, which
is unset by default for all profiles, till
development is complete.
Change-Id: Ice88b8e74ed714515f21b9b232aa0088fbb54d1d
CRs-Fixed: 2945124
Sometimes firmware sends spectral events repeatedly with
wrong vdev. This causes continuous error logs are
written to kmsg.
Replace info prints in target_if_consume_spectral_report_gen3()
with debug level prints.
Change-Id: I2ca4be7d0d13e841a6dbd4efbc02ecd2b12893f8
CRs-Fixed: 2926759
Agile scans (preCAC/RCAC) use the Agile Engine which is also needed
for the Agile spectral scan. Hence, both cannot run at the same time.
Currently, if Agile preCAC is enabled, Agile spectral scan is not
started. Do not start the spectral scan if either RCAC is enabled or
preCAC is enabled.
Change-Id: I242c28c2c3f8872ceab6314dde80361c283d3ac1
CRs-Fixed: 2922250
When agile spectral frequency is 0 and user tries to start agile spectral
scan, 'A parameter is not initialized' message is thrown from user space
but that message is not enough to identify that agile spectral frequency
is not initialized. To address this, print an error message from driver
when Agile spectral frequency is 0.
CRs-Fixed: 2921000
Change-Id: Ibbb144a57774ad274b31015c7a04aa6097daf09f