Lines Matching +full:col +full:- +full:offset

1 // SPDX-License-Identifier: ISC
11 struct mt76_dev *mdev = &dev->mt76; in mt792x_acpi_read()
18 root = ACPI_HANDLE(mdev->dev); in mt792x_acpi_read()
20 return -EOPNOTSUPP; in mt792x_acpi_read()
24 return -EIO; in mt792x_acpi_read()
28 return -EIO; in mt792x_acpi_read()
31 if (sar_root->type != ACPI_TYPE_PACKAGE || in mt792x_acpi_read()
32 sar_root->package.count < 4 || in mt792x_acpi_read()
33 sar_root->package.elements[0].type != ACPI_TYPE_INTEGER) { in mt792x_acpi_read()
34 dev_err(mdev->dev, "sar cnt = %d\n", in mt792x_acpi_read()
35 sar_root->package.count); in mt792x_acpi_read()
36 ret = -EINVAL; in mt792x_acpi_read()
41 *tbl = devm_kzalloc(mdev->dev, sar_root->package.count, in mt792x_acpi_read()
44 ret = -ENOMEM; in mt792x_acpi_read()
50 *len = sar_root->package.count; in mt792x_acpi_read()
52 for (i = 0; i < sar_root->package.count; i++) { in mt792x_acpi_read()
53 union acpi_object *sar_unit = &sar_root->package.elements[i]; in mt792x_acpi_read()
55 if (sar_unit->type != ACPI_TYPE_INTEGER) in mt792x_acpi_read()
58 *(*tbl + i) = (u8)sar_unit->integer.value; in mt792x_acpi_read()
61 ret = i == sar_root->package.count ? 0 : -EINVAL; in mt792x_acpi_read()
94 enable = ((struct mt792x_asar_dyn *)*table)->enable; in mt792x_asar_acpi_read_mtds()
99 enable = ((struct mt792x_asar_dyn_v2 *)*table)->enable; in mt792x_asar_acpi_read_mtds()
104 return -EINVAL; in mt792x_asar_acpi_read_mtds()
107 tblcnt = (len - prelen) / sarlen; in mt792x_asar_acpi_read_mtds()
110 return -EINVAL; in mt792x_asar_acpi_read_mtds()
136 return -EINVAL; in mt792x_asar_acpi_read_mtgs()
139 tblcnt = (len - prelen) / sarlen; in mt792x_asar_acpi_read_mtgs()
141 return -EINVAL; in mt792x_asar_acpi_read_mtgs()
157 return -EINVAL; in mt792x_asar_acpi_read_mtfg()
167 asar = devm_kzalloc(dev->mt76.dev, sizeof(*asar), GFP_KERNEL); in mt792x_init_acpi_sar()
169 return -ENOMEM; in mt792x_init_acpi_sar()
171 ret = mt792x_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver); in mt792x_init_acpi_sar()
173 devm_kfree(dev->mt76.dev, asar->countrylist); in mt792x_init_acpi_sar()
174 asar->countrylist = NULL; in mt792x_init_acpi_sar()
177 ret = mt792x_asar_acpi_read_mtds(dev, (u8 **)&asar->dyn, asar->ver); in mt792x_init_acpi_sar()
179 devm_kfree(dev->mt76.dev, asar->dyn); in mt792x_init_acpi_sar()
180 asar->dyn = NULL; in mt792x_init_acpi_sar()
184 ret = mt792x_asar_acpi_read_mtgs(dev, (u8 **)&asar->geo, asar->ver); in mt792x_init_acpi_sar()
186 devm_kfree(dev->mt76.dev, asar->geo); in mt792x_init_acpi_sar()
187 asar->geo = NULL; in mt792x_init_acpi_sar()
191 ret = mt792x_asar_acpi_read_mtfg(dev, (u8 **)&asar->fg); in mt792x_init_acpi_sar()
193 devm_kfree(dev->mt76.dev, asar->fg); in mt792x_init_acpi_sar()
194 asar->fg = NULL; in mt792x_init_acpi_sar()
196 dev->phy.acpisar = asar; in mt792x_init_acpi_sar()
206 struct mt792x_acpi_sar *asar = phy->acpisar; in mt792x_asar_get_geo_pwr()
211 if (!asar->geo) in mt792x_asar_get_geo_pwr()
214 switch (phy->mt76->dev->region) { in mt792x_asar_get_geo_pwr()
226 if (asar->ver == 1) { in mt792x_asar_get_geo_pwr()
227 band_pwr = &asar->geo->tbl[idx].band[0]; in mt792x_asar_get_geo_pwr()
228 max = ARRAY_SIZE(asar->geo->tbl[idx].band); in mt792x_asar_get_geo_pwr()
230 band_pwr = &asar->geo_v2->tbl[idx].band[0]; in mt792x_asar_get_geo_pwr()
231 max = ARRAY_SIZE(asar->geo_v2->tbl[idx].band); in mt792x_asar_get_geo_pwr()
251 geo_power = (band_pwr + idx)->pwr; in mt792x_asar_get_geo_pwr()
252 dyn_power += (band_pwr + idx)->offset; in mt792x_asar_get_geo_pwr()
262 const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa; in mt792x_asar_range_pwr()
263 struct mt792x_acpi_sar *asar = phy->acpisar; in mt792x_asar_range_pwr()
269 if (asar->ver == 1) { in mt792x_asar_range_pwr()
270 limit = &asar->dyn->tbl[0].frp[0]; in mt792x_asar_range_pwr()
271 max = ARRAY_SIZE(asar->dyn->tbl[0].frp); in mt792x_asar_range_pwr()
273 limit = &asar->dyn_v2->tbl[0].frp[0]; in mt792x_asar_range_pwr()
274 max = ARRAY_SIZE(asar->dyn_v2->tbl[0].frp); in mt792x_asar_range_pwr()
280 if (range->start_freq >= 5945) in mt792x_asar_range_pwr()
282 else if (range->start_freq >= 5150) in mt792x_asar_range_pwr()
292 const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa; in mt792x_init_acpi_sar_power()
295 if (!phy->acpisar || !((struct mt792x_acpi_sar *)phy->acpisar)->dyn) in mt792x_init_acpi_sar_power()
302 for (i = 0; i < capa->num_freq_ranges; i++) { in mt792x_init_acpi_sar_power()
303 struct mt76_freq_range_power *frp = &phy->mt76->frp[i]; in mt792x_init_acpi_sar_power()
305 frp->range = set_default ? &capa->freq_ranges[i] : frp->range; in mt792x_init_acpi_sar_power()
306 if (!frp->range) in mt792x_init_acpi_sar_power()
309 frp->power = min_t(s8, set_default ? 127 : frp->power, in mt792x_init_acpi_sar_power()
310 mt792x_asar_range_pwr(phy, frp->range, i)); in mt792x_init_acpi_sar_power()
319 struct mt792x_acpi_sar *acpisar = phy->acpisar; in mt792x_acpi_get_flags()
334 fg = acpisar->fg; in mt792x_acpi_get_flags()
341 for (i = 0; i < fg->nr_flag; i++) { in mt792x_acpi_get_flags()
343 if (fg->flag[i] == map[j].acpi_idx) { in mt792x_acpi_get_flags()
360 mode_6g = (cl->mode_6g > 0x02) ? 0 : cl->mode_6g; in mt792x_acpi_get_mtcl_map()
361 mode_5g9 = (cl->mode_5g9 > 0x01) ? 0 : cl->mode_5g9; in mt792x_acpi_get_mtcl_map()
363 if ((cl->cl6g[row] & BIT(column)) || cl->mode_6g == 0x02) in mt792x_acpi_get_mtcl_map()
365 if (cl->version > 1 && cl->cl5g9[row] & BIT(column)) in mt792x_acpi_get_mtcl_map()
385 struct mt792x_acpi_sar *sar = phy->acpisar; in mt792x_acpi_get_mtcl_conf()
387 int col, row, i; in mt792x_acpi_get_mtcl_conf() local
392 cl = sar->countrylist; in mt792x_acpi_get_mtcl_conf()
397 col = 7 - i % 8; in mt792x_acpi_get_mtcl_conf()
400 return mt792x_acpi_get_mtcl_map(row, col, cl); in mt792x_acpi_get_mtcl_conf()