Lines Matching +full:txs +full:- +full:delta
1 // SPDX-License-Identifier: ISC
10 #include <linux/nvmem-consumer.h>
18 struct device_node *np = dev->dev->of_node; in mt76_get_of_eeprom_data()
22 data = of_get_property(np, "mediatek,eeprom-data", &size); in mt76_get_of_eeprom_data()
24 return -ENOENT; in mt76_get_of_eeprom_data()
27 return -EINVAL; in mt76_get_of_eeprom_data()
38 struct device_node *np = dev->dev->of_node; in mt76_get_of_epprom_from_mtd()
47 list = of_get_property(np, "mediatek,mtd-eeprom", &size); in mt76_get_of_epprom_from_mtd()
49 return -ENOENT; in mt76_get_of_epprom_from_mtd()
53 return -ENOENT; in mt76_get_of_epprom_from_mtd()
57 return -EINVAL; in mt76_get_of_epprom_from_mtd()
61 part = np->name; in mt76_get_of_epprom_from_mtd()
70 ret = -EINVAL; in mt76_get_of_epprom_from_mtd()
80 dev_err(dev->dev, "reading EEPROM from mtd %s failed: %i\n", in mt76_get_of_epprom_from_mtd()
86 ret = -EINVAL; in mt76_get_of_epprom_from_mtd()
90 if (of_property_read_bool(dev->dev->of_node, "big-endian")) { in mt76_get_of_epprom_from_mtd()
101 dev->test_mtd.name = devm_kstrdup(dev->dev, part, GFP_KERNEL); in mt76_get_of_epprom_from_mtd()
102 dev->test_mtd.offset = offset; in mt76_get_of_epprom_from_mtd()
114 struct device_node *np = dev->dev->of_node; in mt76_get_of_epprom_from_nvmem()
131 ret = -EINVAL; in mt76_get_of_epprom_from_nvmem()
147 struct device_node *np = dev->dev->of_node; in mt76_get_of_eeprom()
151 return -ENOENT; in mt76_get_of_eeprom()
163 return -ENOENT; in mt76_get_of_eeprom()
171 struct mt76_dev *dev = phy->dev; in mt76_eeprom_override()
173 struct device_node *np = dev->dev->of_node; in mt76_eeprom_override()
175 of_get_mac_address(np, phy->macaddr); in mt76_eeprom_override()
177 if (!is_valid_ether_addr(phy->macaddr)) { in mt76_eeprom_override()
179 eth_random_addr(phy->macaddr); in mt76_eeprom_override()
180 dev_info(dev->dev, in mt76_eeprom_override()
182 phy->macaddr); in mt76_eeprom_override()
207 struct device_node *np = dev->dev->of_node; in mt76_find_power_limits_node()
217 if (dev->region < ARRAY_SIZE(region_names)) in mt76_find_power_limits_node()
218 region_name = region_names[dev->region]; in mt76_find_power_limits_node()
220 np = of_get_child_by_name(np, "power-limits"); in mt76_find_power_limits_node()
233 if (mt76_string_prop_find(country, dev->alpha2) || in mt76_find_power_limits_node()
249 if (!prop || !prop->value || prop->length < min * 4) in mt76_get_of_array()
252 *len = prop->length; in mt76_get_of_array()
254 return prop->value; in mt76_get_of_array()
270 if (chan->hw_value >= be32_to_cpu(val[0]) && in mt76_find_channel_node()
271 chan->hw_value <= be32_to_cpu(val[1])) in mt76_find_channel_node()
275 len -= 2 * sizeof(*val); in mt76_find_channel_node()
288 val = mt76_get_of_array(np, "txs-delta", &len, nss); in mt76_get_txs_delta()
292 return be32_to_cpu(val[nss - 1]); in mt76_get_txs_delta()
329 if (--cur > 0) in mt76_apply_multi_array_limit()
333 len -= pwr_len + 1; in mt76_apply_multi_array_limit()
347 struct mt76_dev *dev = phy->dev; in mt76_get_rate_power_limits()
353 u32 mcs_rates = dev->drv->mcs_rates; in mt76_get_rate_power_limits()
355 u32 ru_rates = ARRAY_SIZE(dest->ru[0]); in mt76_get_rate_power_limits()
377 switch (chan->band) { in mt76_get_rate_power_limits()
391 snprintf(name, sizeof(name), "txpower-%cg", band); in mt76_get_rate_power_limits()
400 txs_delta = mt76_get_txs_delta(np, hweight8(phy->antenna_mask)); in mt76_get_rate_power_limits()
402 val = mt76_get_of_array(np, "rates-cck", &len, ARRAY_SIZE(dest->cck)); in mt76_get_rate_power_limits()
403 mt76_apply_array_limit(dest->cck, ARRAY_SIZE(dest->cck), val, in mt76_get_rate_power_limits()
406 val = mt76_get_of_array(np, "rates-ofdm", in mt76_get_rate_power_limits()
407 &len, ARRAY_SIZE(dest->ofdm)); in mt76_get_rate_power_limits()
408 mt76_apply_array_limit(dest->ofdm, ARRAY_SIZE(dest->ofdm), val, in mt76_get_rate_power_limits()
411 val = mt76_get_of_array(np, "rates-mcs", &len, mcs_rates + 1); in mt76_get_rate_power_limits()
412 mt76_apply_multi_array_limit(dest->mcs[0], ARRAY_SIZE(dest->mcs[0]), in mt76_get_rate_power_limits()
413 ARRAY_SIZE(dest->mcs), val, len, in mt76_get_rate_power_limits()
416 val = mt76_get_of_array(np, "rates-ru", &len, ru_rates + 1); in mt76_get_rate_power_limits()
417 mt76_apply_multi_array_limit(dest->ru[0], ARRAY_SIZE(dest->ru[0]), in mt76_get_rate_power_limits()
418 ARRAY_SIZE(dest->ru), val, len, in mt76_get_rate_power_limits()
429 dev->eeprom.size = len; in mt76_eeprom_init()
430 dev->eeprom.data = devm_kzalloc(dev->dev, len, GFP_KERNEL); in mt76_eeprom_init()
431 if (!dev->eeprom.data) in mt76_eeprom_init()
432 return -ENOMEM; in mt76_eeprom_init()
434 return !mt76_get_of_eeprom(dev, dev->eeprom.data, 0, len); in mt76_eeprom_init()