Re: [PATCHv2 bluetooth-next 2/4] ieee802154/atusb: Add .set_txpower operation to the driver

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

 



On Fri, May 29, 2015 at 10:51:26AM +0200, Stefan Schmidt wrote:
> From: Stefan Schmidt <s.schmidt@xxxxxxxxxxx>
> 
> Atusb uses the at86rf231 transceiver so we can use the same calculation
> for txpower settings for it.
> 
> Signed-off-by: Stefan Schmidt <stefan@xxxxxxxxxxxxxxx>
> ---
>  drivers/net/ieee802154/atusb.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
> index 95d4220..9805ebe 100644
> --- a/drivers/net/ieee802154/atusb.c
> +++ b/drivers/net/ieee802154/atusb.c
> @@ -453,6 +453,26 @@ static void atusb_stop(struct ieee802154_hw *hw)
>  	atusb_get_and_clear_error(atusb);
>  }
>  
> +#define ATUSB_MAX_TX_POWERS 0xF
> +static const s32 atusb_powers[ATUSB_MAX_TX_POWERS + 1] = {
> +	300, 280, 230, 180, 130, 70, 0, -100, -200, -300, -400, -500, -700,
> +	-900, -1200, -1700,
> +};
> +
> +static int
> +atusb_set_txpower(struct ieee802154_hw *hw, s32 mbm)
> +{
> +	struct atusb *atusb = hw->priv;
> +	u32 i;
> +
> +	for (i = 0; i < hw->phy->supported.tx_powers_size; i++) {
> +		if (hw->phy->supported.tx_powers[i] == mbm)
> +			return atusb_write_subreg(atusb, SR_TX_PWR_23X, i);
> +	}
> +
> +	return -EINVAL;
> +}
> +

also the mapping looks different in at86rf230. Anyway, it's just a note.

- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux