static int iwm_phy_db_send_all_channel_groups(struct iwm_softc *sc, enum iwm_phy_db_section_type type, uint8_t max_ch_groups) { uint16_t i; int err; struct iwm_phy_db_entry *entry; /* Send all the channel-specific groups to operational fw */ for (i = 0; i < max_ch_groups; i++) { entry = iwm_phy_db_get_section(sc, type, i); if (!entry) return EINVAL; if (!entry->size) continue; /* Send the requested PHY DB section */ err = iwm_send_phy_db_cmd(sc, type, entry->size, entry->data); if (err) { IWM_DPRINTF(sc, IWM_DEBUG_CMD, "%s: Can't SEND phy_db section %d (%d), " "err %d\n", __func__, type, i, err); return err; } IWM_DPRINTF(sc, IWM_DEBUG_CMD, "Sent PHY_DB HCMD, type = %d num = %d\n", type, i); } return 0; }
int iwm_send_phy_db_data(struct iwm_phy_db *phy_db) { uint8_t *data = NULL; uint16_t size = 0; int err; IWM_DPRINTF(phy_db->sc, IWM_DEBUG_CMD | IWM_DEBUG_RESET, "%s: Sending phy db data and configuration to runtime image\n", __func__); /* Send PHY DB CFG section */ err = iwm_phy_db_get_section_data(phy_db, IWM_PHY_DB_CFG, &data, &size, 0); if (err) { device_printf(phy_db->sc->sc_dev, "%s: Cannot get Phy DB cfg section, %d\n", __func__, err); return err; } err = iwm_send_phy_db_cmd(phy_db, IWM_PHY_DB_CFG, size, data); if (err) { device_printf(phy_db->sc->sc_dev, "%s: Cannot send HCMD of Phy DB cfg section, %d\n", __func__, err); return err; } err = iwm_phy_db_get_section_data(phy_db, IWM_PHY_DB_CALIB_NCH, &data, &size, 0); if (err) { device_printf(phy_db->sc->sc_dev, "%s: Cannot get Phy DB non specific channel section, " "%d\n", __func__, err); return err; } err = iwm_send_phy_db_cmd(phy_db, IWM_PHY_DB_CALIB_NCH, size, data); if (err) { device_printf(phy_db->sc->sc_dev, "%s: Cannot send HCMD of Phy DB non specific channel " "sect, %d\n", __func__, err); return err; } /* Send all the TXP channel specific data */ err = iwm_phy_db_send_all_channel_groups(phy_db, IWM_PHY_DB_CALIB_CHG_PAPD, phy_db->n_group_papd); if (err) { device_printf(phy_db->sc->sc_dev, "%s: Cannot send channel specific PAPD groups, %d\n", __func__, err); return err; } /* Send all the TXP channel specific data */ err = iwm_phy_db_send_all_channel_groups(phy_db, IWM_PHY_DB_CALIB_CHG_TXP, phy_db->n_group_txp); if (err) { device_printf(phy_db->sc->sc_dev, "%s: Cannot send channel specific TX power groups, " "%d\n", __func__, err); return err; } IWM_DPRINTF(phy_db->sc, IWM_DEBUG_CMD | IWM_DEBUG_RESET, "%s: Finished sending phy db non channel data\n", __func__); return 0; }