Search Linux Wireless

Re: [PATCH 2/4] mt76x2: dfs: add sw event ring buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lorenzo Bianconi <lorenzo.bianconi@xxxxxxxxxx> writes:

> Introduce sw event ring buffer to queue DFS pulses loaded from the hw.
> Radar pulses will be used in DFS sw detector
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@xxxxxxxxxx>

[...]

> +static bool mt76x2_dfs_fetch_event(struct mt76x2_dev *dev,
> +				   struct mt76x2_dfs_event *event)
> +{
> +	u32 i, data[4];
> +
> +	for (i = 0; i < ARRAY_SIZE(data); i++) {
> +		/* 1st: DFS_R37[31]: 0 (engine 0) - 1 (engine 2)
> +		 * 2nd: DFS_R37[21:0]: pulse time
> +		 * 3rd: DFS_R37[11:0]: pulse width
> +		 * 3rd: DFS_R37[25:16]: phase
> +		 * 4th: DFS_R37[12:0]: current pwr
> +		 * 4th: DFS_R37[21:16]: pwr stable counter
> +		 *
> +		 * 1st: DFS_R37[31:0] set to 0xffffffff means no event detected
> +		 */
> +		data[i] = mt76_rr(dev, MT_BBP(DFS, 37));
> +	}
> +
> +	if (data[0] == GENMASK(31, 0))
> +		return false;
> +
> +	event->engine = (data[0] & BIT(31)) ? 2 : 0;
> +	event->ts = data[1] & GENMASK(21, 0);
> +	event->width = data[2] & GENMASK(11, 0);

No magic values and that data[2] stuff, please. Instead create a proper
struct and defines for the GENMASKs.

-- 
Kalle Valo



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux