Lines Matching refs:plat_priv

132 static int cnss_get_vreg_single(struct cnss_plat_data *plat_priv,  in cnss_get_vreg_single()  argument
143 dev = &plat_priv->plat_dev->dev; in cnss_get_vreg_single()
144 dt_node = (plat_priv->dev_node ? plat_priv->dev_node : dev->of_node); in cnss_get_vreg_single()
185 static void cnss_put_vreg_single(struct cnss_plat_data *plat_priv, in cnss_put_vreg_single() argument
188 struct device *dev = &plat_priv->plat_dev->dev; in cnss_put_vreg_single()
340 static int cnss_get_vreg(struct cnss_plat_data *plat_priv, in cnss_get_vreg() argument
348 struct device *dev = &plat_priv->plat_dev->dev; in cnss_get_vreg()
353 (plat_priv->dt_type != CNSS_DTT_MULTIEXCHG)) { in cnss_get_vreg()
358 dt_node = (plat_priv->dev_node ? plat_priv->dev_node : dev->of_node); in cnss_get_vreg()
359 if (plat_priv->dt_type == CNSS_DTT_MULTIEXCHG) { in cnss_get_vreg()
366 plat_priv->device_id); in cnss_get_vreg()
377 plat_priv->device_id); in cnss_get_vreg()
389 if (plat_priv->dt_type == CNSS_DTT_MULTIEXCHG) { in cnss_get_vreg()
401 ret = cnss_get_vreg_single(plat_priv, vreg); in cnss_get_vreg()
417 static void cnss_put_vreg(struct cnss_plat_data *plat_priv, in cnss_put_vreg() argument
428 cnss_put_vreg_single(plat_priv, vreg); in cnss_put_vreg()
432 static int cnss_vreg_on(struct cnss_plat_data *plat_priv, in cnss_vreg_on() argument
459 static int cnss_vreg_off(struct cnss_plat_data *plat_priv, in cnss_vreg_off() argument
474 static int cnss_vreg_unvote(struct cnss_plat_data *plat_priv, in cnss_vreg_unvote() argument
490 int cnss_get_vreg_type(struct cnss_plat_data *plat_priv, in cnss_get_vreg_type() argument
503 ret = cnss_get_vreg(plat_priv, &plat_priv->vreg_list, in cnss_get_vreg_type()
514 void cnss_put_vreg_type(struct cnss_plat_data *plat_priv, in cnss_put_vreg_type() argument
519 cnss_put_vreg(plat_priv, &plat_priv->vreg_list); in cnss_put_vreg_type()
526 int cnss_vreg_on_type(struct cnss_plat_data *plat_priv, in cnss_vreg_on_type() argument
533 ret = cnss_vreg_on(plat_priv, &plat_priv->vreg_list); in cnss_vreg_on_type()
543 int cnss_vreg_off_type(struct cnss_plat_data *plat_priv, in cnss_vreg_off_type() argument
550 ret = cnss_vreg_off(plat_priv, &plat_priv->vreg_list); in cnss_vreg_off_type()
560 int cnss_vreg_unvote_type(struct cnss_plat_data *plat_priv, in cnss_vreg_unvote_type() argument
567 ret = cnss_vreg_unvote(plat_priv, &plat_priv->vreg_list); in cnss_vreg_unvote_type()
577 static int cnss_get_clk_single(struct cnss_plat_data *plat_priv, in cnss_get_clk_single() argument
580 struct device *dev = &plat_priv->plat_dev->dev; in cnss_get_clk_single()
603 static void cnss_put_clk_single(struct cnss_plat_data *plat_priv, in cnss_put_clk_single() argument
606 struct device *dev = &plat_priv->plat_dev->dev; in cnss_put_clk_single()
662 int cnss_get_clk(struct cnss_plat_data *plat_priv) in cnss_get_clk() argument
669 if (!plat_priv) in cnss_get_clk()
672 dev = &plat_priv->plat_dev->dev; in cnss_get_clk()
673 clk_list = &plat_priv->clk_list; in cnss_get_clk()
689 ret = cnss_get_clk_single(plat_priv, clk_info); in cnss_get_clk()
711 cnss_put_clk_single(plat_priv, clk_info); in cnss_get_clk()
718 void cnss_put_clk(struct cnss_plat_data *plat_priv) in cnss_put_clk() argument
724 if (!plat_priv) in cnss_put_clk()
727 dev = &plat_priv->plat_dev->dev; in cnss_put_clk()
728 clk_list = &plat_priv->clk_list; in cnss_put_clk()
736 cnss_put_clk_single(plat_priv, clk_info); in cnss_put_clk()
741 static int cnss_clk_on(struct cnss_plat_data *plat_priv, in cnss_clk_on() argument
768 static int cnss_clk_off(struct cnss_plat_data *plat_priv, in cnss_clk_off() argument
783 int cnss_get_pinctrl(struct cnss_plat_data *plat_priv) in cnss_get_pinctrl() argument
791 dev = &plat_priv->plat_dev->dev; in cnss_get_pinctrl()
792 pinctrl_info = &plat_priv->pinctrl_info; in cnss_get_pinctrl()
851 cnss_set_feature_list(plat_priv, CNSS_WLAN_EN_SUPPORT_V01); in cnss_get_pinctrl()
871 cnss_set_feature_list(plat_priv, BOOTSTRAP_CLOCK_SELECT_V01); in cnss_get_pinctrl()
953 int cnss_get_wlan_sw_ctrl(struct cnss_plat_data *plat_priv) in cnss_get_wlan_sw_ctrl() argument
958 dev = &plat_priv->plat_dev->dev; in cnss_get_wlan_sw_ctrl()
959 pinctrl_info = &plat_priv->pinctrl_info; in cnss_get_wlan_sw_ctrl()
975 static void cnss_set_xo_clk_gpio_state(struct cnss_plat_data *plat_priv, in cnss_set_xo_clk_gpio_state() argument
978 int xo_clk_gpio = plat_priv->pinctrl_info.xo_clk_gpio, retry = 0, ret; in cnss_set_xo_clk_gpio_state()
980 if (xo_clk_gpio < 0 || plat_priv->device_id != QCA6490_DEVICE_ID) in cnss_set_xo_clk_gpio_state()
1011 static int cnss_select_pinctrl_state(struct cnss_plat_data *plat_priv, in cnss_select_pinctrl_state() argument
1017 if (!plat_priv) { in cnss_select_pinctrl_state()
1023 pinctrl_info = &plat_priv->pinctrl_info; in cnss_select_pinctrl_state()
1048 cnss_set_xo_clk_gpio_state(plat_priv, true); in cnss_select_pinctrl_state()
1059 if (plat_priv->device_id == QCA6174_DEVICE_ID || in cnss_select_pinctrl_state()
1060 plat_priv->device_id == 0) in cnss_select_pinctrl_state()
1065 cnss_set_xo_clk_gpio_state(plat_priv, false); in cnss_select_pinctrl_state()
1067 cnss_set_xo_clk_gpio_state(plat_priv, false); in cnss_select_pinctrl_state()
1073 cnss_wlan_hw_disable_check(plat_priv); in cnss_select_pinctrl_state()
1074 if (test_bit(CNSS_WLAN_HW_DISABLED, &plat_priv->driver_state)) { in cnss_select_pinctrl_state()
1108 static int cnss_select_pinctrl_enable(struct cnss_plat_data *plat_priv) in cnss_select_pinctrl_enable() argument
1110 int ret = 0, bt_en_gpio = plat_priv->pinctrl_info.bt_en_gpio; in cnss_select_pinctrl_enable()
1113 if (bt_en_gpio < 0 || plat_priv->device_id != QCA6490_DEVICE_ID) in cnss_select_pinctrl_enable()
1118 ret = cnss_select_pinctrl_state(plat_priv, true); in cnss_select_pinctrl_enable()
1128 cnss_select_pinctrl_state(plat_priv, false); in cnss_select_pinctrl_enable()
1136 ret = cnss_select_pinctrl_state(plat_priv, true); in cnss_select_pinctrl_enable()
1140 int cnss_get_input_gpio_value(struct cnss_plat_data *plat_priv, int gpio_num) in cnss_get_input_gpio_value() argument
1157 int cnss_power_on_device(struct cnss_plat_data *plat_priv, bool reset) in cnss_power_on_device() argument
1161 if (plat_priv->powered_on) { in cnss_power_on_device()
1166 cnss_wlan_hw_disable_check(plat_priv); in cnss_power_on_device()
1167 if (test_bit(CNSS_WLAN_HW_DISABLED, &plat_priv->driver_state)) { in cnss_power_on_device()
1172 ret = cnss_vreg_on_type(plat_priv, CNSS_VREG_PRIM); in cnss_power_on_device()
1178 ret = cnss_clk_on(plat_priv, &plat_priv->clk_list); in cnss_power_on_device()
1193 ret = cnss_select_pinctrl_state(plat_priv, false); in cnss_power_on_device()
1204 ret = cnss_select_pinctrl_enable(plat_priv); in cnss_power_on_device()
1210 plat_priv->powered_on = true; in cnss_power_on_device()
1211 clear_bit(CNSS_POWER_OFF, &plat_priv->driver_state); in cnss_power_on_device()
1212 cnss_enable_dev_sol_irq(plat_priv); in cnss_power_on_device()
1213 cnss_set_host_sol_value(plat_priv, 0); in cnss_power_on_device()
1218 cnss_clk_off(plat_priv, &plat_priv->clk_list); in cnss_power_on_device()
1220 cnss_vreg_off_type(plat_priv, CNSS_VREG_PRIM); in cnss_power_on_device()
1225 void cnss_power_off_device(struct cnss_plat_data *plat_priv) in cnss_power_off_device() argument
1227 if (!plat_priv->powered_on) { in cnss_power_off_device()
1232 set_bit(CNSS_POWER_OFF, &plat_priv->driver_state); in cnss_power_off_device()
1233 cnss_bus_shutdown_cleanup(plat_priv); in cnss_power_off_device()
1234 cnss_disable_dev_sol_irq(plat_priv); in cnss_power_off_device()
1235 cnss_select_pinctrl_state(plat_priv, false); in cnss_power_off_device()
1236 cnss_clk_off(plat_priv, &plat_priv->clk_list); in cnss_power_off_device()
1237 cnss_vreg_off_type(plat_priv, CNSS_VREG_PRIM); in cnss_power_off_device()
1238 plat_priv->powered_on = false; in cnss_power_off_device()
1241 bool cnss_is_device_powered_on(struct cnss_plat_data *plat_priv) in cnss_is_device_powered_on() argument
1243 return plat_priv->powered_on; in cnss_is_device_powered_on()
1246 void cnss_set_pin_connect_status(struct cnss_plat_data *plat_priv) in cnss_set_pin_connect_status() argument
1259 plat_priv->pin_result.host_pin_result = pin_status; in cnss_set_pin_connect_status()
1263 static int cnss_cmd_db_ready(struct cnss_plat_data *plat_priv) in cnss_cmd_db_ready() argument
1268 static u32 cnss_cmd_db_read_addr(struct cnss_plat_data *plat_priv, in cnss_cmd_db_read_addr() argument
1274 static int cnss_cmd_db_ready(struct cnss_plat_data *plat_priv) in cnss_cmd_db_ready() argument
1279 static u32 cnss_cmd_db_read_addr(struct cnss_plat_data *plat_priv, in cnss_cmd_db_read_addr() argument
1286 int cnss_get_tcs_info(struct cnss_plat_data *plat_priv) in cnss_get_tcs_info() argument
1288 struct platform_device *plat_dev = plat_priv->plat_dev; in cnss_get_tcs_info()
1300 plat_priv->tcs_info.cmd_base_addr = res->start; in cnss_get_tcs_info()
1303 &plat_priv->tcs_info.cmd_base_addr, &addr_len); in cnss_get_tcs_info()
1312 plat_priv->tcs_info.cmd_base_addr_io = tcs_cmd_base_addr; in cnss_get_tcs_info()
1318 int cnss_get_cpr_info(struct cnss_plat_data *plat_priv) in cnss_get_cpr_info() argument
1320 struct platform_device *plat_dev = plat_priv->plat_dev; in cnss_get_cpr_info()
1321 struct cnss_cpr_info *cpr_info = &plat_priv->cpr_info; in cnss_get_cpr_info()
1326 if (plat_priv->tcs_info.cmd_base_addr == 0) { in cnss_get_cpr_info()
1338 ret = cnss_cmd_db_ready(plat_priv); in cnss_get_cpr_info()
1344 cpr_pmic_addr = cnss_cmd_db_read_addr(plat_priv, cmd_db_name); in cnss_get_cpr_info()
1370 static int cnss_mbox_init(struct cnss_plat_data *plat_priv) in cnss_mbox_init() argument
1372 struct mbox_client *mbox = &plat_priv->mbox_client_data; in cnss_mbox_init()
1376 plat_priv->mbox_chan = NULL; in cnss_mbox_init()
1377 mbox->dev = &plat_priv->plat_dev->dev; in cnss_mbox_init()
1386 plat_priv->mbox_chan = chan; in cnss_mbox_init()
1399 static void cnss_mbox_deinit(struct cnss_plat_data *plat_priv) in cnss_mbox_deinit() argument
1401 if (!plat_priv->mbox_chan) { in cnss_mbox_deinit()
1402 mbox_free_channel(plat_priv->mbox_chan); in cnss_mbox_deinit()
1403 plat_priv->mbox_chan = NULL; in cnss_mbox_deinit()
1415 cnss_mbox_send_msg(struct cnss_plat_data *plat_priv, char *mbox_msg) in cnss_mbox_send_msg() argument
1420 if (!plat_priv->mbox_chan) in cnss_mbox_send_msg()
1426 ret = mbox_send_message(plat_priv->mbox_chan, &pkt); in cnss_mbox_send_msg()
1433 static inline int cnss_mbox_init(struct cnss_plat_data *plat_priv) in cnss_mbox_init() argument
1438 static inline void cnss_mbox_deinit(struct cnss_plat_data *plat_priv) in cnss_mbox_deinit() argument
1443 cnss_mbox_send_msg(struct cnss_plat_data *plat_priv, char *mbox_msg) in cnss_mbox_send_msg() argument
1458 static int cnss_qmp_init(struct cnss_plat_data *plat_priv) in cnss_qmp_init() argument
1462 plat_priv->qmp = NULL; in cnss_qmp_init()
1463 qmp = qmp_get(&plat_priv->plat_dev->dev); in cnss_qmp_init()
1470 plat_priv->qmp = qmp; in cnss_qmp_init()
1481 static void cnss_qmp_deinit(struct cnss_plat_data *plat_priv) in cnss_qmp_deinit() argument
1483 if (plat_priv->qmp) { in cnss_qmp_deinit()
1484 qmp_put(plat_priv->qmp); in cnss_qmp_deinit()
1485 plat_priv->qmp = NULL; in cnss_qmp_deinit()
1497 cnss_qmp_send_msg(struct cnss_plat_data *plat_priv, char *mbox_msg) in cnss_qmp_send_msg() argument
1501 if (!plat_priv->qmp) in cnss_qmp_send_msg()
1505 ret = qmp_send(plat_priv->qmp, mbox_msg, CNSS_MBOX_MSG_MAX_LEN); in cnss_qmp_send_msg()
1521 int cnss_aop_interface_init(struct cnss_plat_data *plat_priv) in cnss_aop_interface_init() argument
1529 ret = cnss_mbox_init(plat_priv); in cnss_aop_interface_init()
1531 ret = cnss_qmp_init(plat_priv); in cnss_aop_interface_init()
1536 ret = cnss_aop_pdc_reconfig(plat_priv); in cnss_aop_interface_init()
1551 void cnss_aop_interface_deinit(struct cnss_plat_data *plat_priv) in cnss_aop_interface_deinit() argument
1553 cnss_mbox_deinit(plat_priv); in cnss_aop_interface_deinit()
1554 cnss_qmp_deinit(plat_priv); in cnss_aop_interface_deinit()
1571 int cnss_aop_send_msg(struct cnss_plat_data *plat_priv, char *mbox_msg) in cnss_aop_send_msg() argument
1575 ret = cnss_mbox_send_msg(plat_priv, mbox_msg); in cnss_aop_send_msg()
1577 ret = cnss_qmp_send_msg(plat_priv, mbox_msg); in cnss_aop_send_msg()
1584 static inline bool cnss_aop_interface_ready(struct cnss_plat_data *plat_priv) in cnss_aop_interface_ready() argument
1586 return (plat_priv->mbox_chan || plat_priv->qmp); in cnss_aop_interface_ready()
1590 int cnss_aop_pdc_reconfig(struct cnss_plat_data *plat_priv) in cnss_aop_pdc_reconfig() argument
1595 if (plat_priv->pdc_init_table_len <= 0 || !plat_priv->pdc_init_table) in cnss_aop_pdc_reconfig()
1599 plat_priv->device_id); in cnss_aop_pdc_reconfig()
1600 for (i = 0; i < plat_priv->pdc_init_table_len; i++) { in cnss_aop_pdc_reconfig()
1601 ret = cnss_aop_send_msg(plat_priv, in cnss_aop_pdc_reconfig()
1602 (char *)plat_priv->pdc_init_table[i]); in cnss_aop_pdc_reconfig()
1610 static const char *cnss_aop_pdc_name_str(struct cnss_plat_data *plat_priv, in cnss_aop_pdc_name_str() argument
1617 if (plat_priv->vreg_pdc_map_len <= 0 || !plat_priv->vreg_pdc_map) in cnss_aop_pdc_name_str()
1620 for (i = 0; i < plat_priv->vreg_pdc_map_len; i++) { in cnss_aop_pdc_name_str()
1621 vreg_map_name = plat_priv->vreg_pdc_map[i]; in cnss_aop_pdc_name_str()
1623 pdc = plat_priv->vreg_pdc_map[i + 1]; in cnss_aop_pdc_name_str()
1632 static int cnss_aop_set_vreg_param(struct cnss_plat_data *plat_priv, in cnss_aop_set_vreg_param() argument
1652 cnss_aop_pdc_name_str(plat_priv, vreg_name), in cnss_aop_set_vreg_param()
1656 return cnss_aop_send_msg(plat_priv, msg); in cnss_aop_set_vreg_param()
1659 int cnss_aop_ol_cpr_cfg_setup(struct cnss_plat_data *plat_priv, in cnss_aop_ol_cpr_cfg_setup() argument
1676 if (plat_priv->pmu_vreg_map_len <= 0 || in cnss_aop_ol_cpr_cfg_setup()
1677 !plat_priv->pmu_vreg_map || in cnss_aop_ol_cpr_cfg_setup()
1678 (!plat_priv->mbox_chan && !plat_priv->qmp)) { in cnss_aop_ol_cpr_cfg_setup()
1702 for (j = 0; j < plat_priv->pmu_vreg_map_len; j += 2) { in cnss_aop_ol_cpr_cfg_setup()
1703 pmu_pin = plat_priv->pmu_vreg_map[j]; in cnss_aop_ol_cpr_cfg_setup()
1706 vreg = plat_priv->pmu_vreg_map[j + 1]; in cnss_aop_ol_cpr_cfg_setup()
1759 cnss_aop_set_vreg_param(plat_priv, in cnss_aop_ol_cpr_cfg_setup()
1767 cnss_aop_set_vreg_param(plat_priv, in cnss_aop_ol_cpr_cfg_setup()
1781 void cnss_power_misc_params_init(struct cnss_plat_data *plat_priv) in cnss_power_misc_params_init() argument
1783 struct device *dev = &plat_priv->plat_dev->dev; in cnss_power_misc_params_init()
1788 plat_priv->pdc_init_table_len = in cnss_power_misc_params_init()
1791 if (plat_priv->pdc_init_table_len > 0) { in cnss_power_misc_params_init()
1792 plat_priv->pdc_init_table = in cnss_power_misc_params_init()
1793 kcalloc(plat_priv->pdc_init_table_len, in cnss_power_misc_params_init()
1795 if (plat_priv->pdc_init_table) { in cnss_power_misc_params_init()
1798 plat_priv->pdc_init_table, in cnss_power_misc_params_init()
1799 plat_priv->pdc_init_table_len); in cnss_power_misc_params_init()
1809 plat_priv->vreg_pdc_map_len = in cnss_power_misc_params_init()
1812 if (plat_priv->vreg_pdc_map_len > 0) { in cnss_power_misc_params_init()
1813 plat_priv->vreg_pdc_map = in cnss_power_misc_params_init()
1814 kcalloc(plat_priv->vreg_pdc_map_len, in cnss_power_misc_params_init()
1816 if (plat_priv->vreg_pdc_map) { in cnss_power_misc_params_init()
1819 plat_priv->vreg_pdc_map, in cnss_power_misc_params_init()
1820 plat_priv->vreg_pdc_map_len); in cnss_power_misc_params_init()
1830 plat_priv->pmu_vreg_map_len = in cnss_power_misc_params_init()
1833 if (plat_priv->pmu_vreg_map_len > 0) { in cnss_power_misc_params_init()
1834 plat_priv->pmu_vreg_map = kcalloc(plat_priv->pmu_vreg_map_len, in cnss_power_misc_params_init()
1836 if (plat_priv->pmu_vreg_map) { in cnss_power_misc_params_init()
1839 plat_priv->pmu_vreg_map, in cnss_power_misc_params_init()
1840 plat_priv->pmu_vreg_map_len); in cnss_power_misc_params_init()
1851 if (plat_priv->device_id == QCA6390_DEVICE_ID || in cnss_power_misc_params_init()
1852 plat_priv->device_id == QCA6490_DEVICE_ID) { in cnss_power_misc_params_init()
1855 &plat_priv->vreg_ol_cpr); in cnss_power_misc_params_init()
1861 &plat_priv->vreg_ipa); in cnss_power_misc_params_init()
1865 ret = of_property_count_u32_elems(plat_priv->plat_dev->dev.of_node, in cnss_power_misc_params_init()
1871 ret = of_property_read_u32_array(plat_priv->plat_dev->dev.of_node, in cnss_power_misc_params_init()
1875 plat_priv->on_chip_pmic_devices_count = cfg_arr_size; in cnss_power_misc_params_init()
1876 plat_priv->on_chip_pmic_board_ids = cfg_arr; in cnss_power_misc_params_init()
1886 int cnss_update_cpr_info(struct cnss_plat_data *plat_priv) in cnss_update_cpr_info() argument
1888 struct cnss_cpr_info *cpr_info = &plat_priv->cpr_info; in cnss_update_cpr_info()
1899 if (plat_priv->device_id != QCA6490_DEVICE_ID) in cnss_update_cpr_info()
1902 if (!plat_priv->vreg_ol_cpr || in cnss_update_cpr_info()
1903 !cnss_aop_interface_ready(plat_priv)) { in cnss_update_cpr_info()
1906 return cnss_aop_set_vreg_param(plat_priv, in cnss_update_cpr_info()
1907 plat_priv->vreg_ol_cpr, in cnss_update_cpr_info()
1913 if (plat_priv->tcs_info.cmd_base_addr == 0) { in cnss_update_cpr_info()
1930 tcs_cmd_addr = plat_priv->tcs_info.cmd_base_addr_io + in cnss_update_cpr_info()
1943 plat_priv->tcs_info.cmd_base_addr + in cnss_update_cpr_info()
1967 int cnss_enable_int_pow_amp_vreg(struct cnss_plat_data *plat_priv) in cnss_enable_int_pow_amp_vreg() argument
1969 struct platform_device *plat_dev = plat_priv->plat_dev; in cnss_enable_int_pow_amp_vreg()
1975 if (plat_priv->device_id != QCA6490_DEVICE_ID) in cnss_enable_int_pow_amp_vreg()
1983 if (!plat_priv->vreg_ipa || in cnss_enable_int_pow_amp_vreg()
1984 !cnss_aop_interface_ready(plat_priv)) { in cnss_enable_int_pow_amp_vreg()
1987 ret = cnss_aop_set_vreg_param(plat_priv, in cnss_enable_int_pow_amp_vreg()
1988 plat_priv->vreg_ipa, in cnss_enable_int_pow_amp_vreg()
1996 if (!plat_priv->tcs_info.cmd_base_addr_io) { in cnss_enable_int_pow_amp_vreg()
2008 tcs_cmd = plat_priv->tcs_info.cmd_base_addr_io + offset; in cnss_enable_int_pow_amp_vreg()
2022 int cnss_dev_specific_power_on(struct cnss_plat_data *plat_priv) in cnss_dev_specific_power_on() argument
2026 if (plat_priv->dt_type != CNSS_DTT_MULTIEXCHG) in cnss_dev_specific_power_on()
2029 ret = cnss_get_vreg_type(plat_priv, CNSS_VREG_PRIM); in cnss_dev_specific_power_on()
2033 plat_priv->powered_on = false; in cnss_dev_specific_power_on()
2034 return cnss_power_on_device(plat_priv, false); in cnss_dev_specific_power_on()