Lines Matching +full:wcd9390 +full:- +full:codec

1 // SPDX-License-Identifier: GPL-2.0
21 #include <sound/soc-dapm.h>
153 wcd->sconfig.ch_count = 1; in wcd939x_sdw_hw_params()
154 wcd->active_ports = 0; in wcd939x_sdw_hw_params()
156 ch_mask = wcd->port_config[i].ch_mask; in wcd939x_sdw_hw_params()
162 wcd->sconfig.ch_count++; in wcd939x_sdw_hw_params()
164 port_config[wcd->active_ports] = wcd->port_config[i]; in wcd939x_sdw_hw_params()
165 wcd->active_ports++; in wcd939x_sdw_hw_params()
168 wcd->sconfig.bps = 1; in wcd939x_sdw_hw_params()
169 wcd->sconfig.frame_rate = params_rate(params); in wcd939x_sdw_hw_params()
170 if (wcd->is_tx) in wcd939x_sdw_hw_params()
171 wcd->sconfig.direction = SDW_DATA_DIR_TX; in wcd939x_sdw_hw_params()
173 wcd->sconfig.direction = SDW_DATA_DIR_RX; in wcd939x_sdw_hw_params()
175 wcd->sconfig.type = SDW_STREAM_PCM; in wcd939x_sdw_hw_params()
177 return sdw_stream_add_slave(wcd->sdev, &wcd->sconfig, &port_config[0], in wcd939x_sdw_hw_params()
178 wcd->active_ports, wcd->sruntime); in wcd939x_sdw_hw_params()
186 sdw_stream_remove_slave(wcd->sdev, wcd->sruntime); in wcd939x_sdw_free()
196 wcd->sruntime = stream; in wcd939x_sdw_set_sdw_stream()
204 if (wcd->regmap) in wcd939x_swr_get_regmap()
205 return wcd->regmap; in wcd939x_swr_get_regmap()
207 return ERR_PTR(-EINVAL); in wcd939x_swr_get_regmap()
214 struct wcd939x_sdw_priv *wcd = dev_get_drvdata(&slave->dev); in wcd9390_update_status()
216 if (wcd->regmap && status == SDW_SLAVE_ATTACHED) { in wcd9390_update_status()
218 regcache_cache_only(wcd->regmap, false); in wcd9390_update_status()
219 return regcache_sync(wcd->regmap); in wcd9390_update_status()
228 sdw_write(slave, SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(params->next_bank), in wcd9390_bus_config()
235 * Handle Soundwire out-of-band interrupt event by triggering
243 struct wcd939x_sdw_priv *wcd = dev_get_drvdata(&slave->dev); in wcd9390_interrupt_callback()
244 struct irq_domain *slave_irq = wcd->slave_irq; in wcd9390_interrupt_callback()
249 regmap_read(wcd->regmap, WCD939X_DIGITAL_INTR_STATUS_0, &sts1); in wcd9390_interrupt_callback()
250 regmap_read(wcd->regmap, WCD939X_DIGITAL_INTR_STATUS_1, &sts2); in wcd9390_interrupt_callback()
251 regmap_read(wcd->regmap, WCD939X_DIGITAL_INTR_STATUS_2, &sts3); in wcd9390_interrupt_callback()
259 /* Default values except for Read-Only & Volatile registers */
1245 /* Read-Only Registers */ in wcd939x_readable_register()
1420 struct device *dev = &pdev->dev; in wcd9390_probe()
1426 return -ENOMEM; in wcd9390_probe()
1429 * Port map index starts with 0, however the data port for this codec in wcd9390_probe()
1432 if (of_property_read_bool(dev->of_node, "qcom,tx-port-mapping")) { in wcd9390_probe()
1433 wcd->is_tx = true; in wcd9390_probe()
1434 ret = of_property_read_u32_array(dev->of_node, in wcd9390_probe()
1435 "qcom,tx-port-mapping", in wcd9390_probe()
1436 &pdev->m_port_map[1], in wcd9390_probe()
1439 ret = of_property_read_u32_array(dev->of_node, in wcd9390_probe()
1440 "qcom,rx-port-mapping", in wcd9390_probe()
1441 &pdev->m_port_map[1], in wcd9390_probe()
1448 wcd->sdev = pdev; in wcd9390_probe()
1451 pdev->prop.scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | in wcd9390_probe()
1453 pdev->prop.lane_control_support = true; in wcd9390_probe()
1454 pdev->prop.simple_clk_stop_capable = true; in wcd9390_probe()
1455 if (wcd->is_tx) { in wcd9390_probe()
1456 pdev->prop.source_ports = GENMASK(WCD939X_MAX_TX_SWR_PORTS - 1, 0); in wcd9390_probe()
1457 pdev->prop.src_dpn_prop = wcd939x_tx_dpn_prop; in wcd9390_probe()
1458 wcd->ch_info = &wcd939x_sdw_tx_ch_info[0]; in wcd9390_probe()
1459 pdev->prop.wake_capable = true; in wcd9390_probe()
1461 pdev->prop.sink_ports = GENMASK(WCD939X_MAX_RX_SWR_PORTS - 1, 0); in wcd9390_probe()
1462 pdev->prop.sink_dpn_prop = wcd939x_rx_dpn_prop; in wcd9390_probe()
1463 wcd->ch_info = &wcd939x_sdw_rx_ch_info[0]; in wcd9390_probe()
1466 if (wcd->is_tx) { in wcd9390_probe()
1472 wcd->regmap = regmap_init_sdw(pdev, &wcd939x_regmap_config); in wcd9390_probe()
1473 if (IS_ERR(wcd->regmap)) in wcd9390_probe()
1474 return dev_err_probe(dev, PTR_ERR(wcd->regmap), in wcd9390_probe()
1477 /* Start in cache-only until device is enumerated */ in wcd9390_probe()
1478 regcache_cache_only(wcd->regmap, true); in wcd9390_probe()
1493 struct device *dev = &pdev->dev; in wcd9390_remove()
1498 if (wcd->regmap) in wcd9390_remove()
1499 regmap_exit(wcd->regmap); in wcd9390_remove()
1505 SDW_SLAVE_ENTRY(0x0217, 0x10e, 0), /* WCD9390 & WCD9390 RX/TX Device ID */
1514 if (wcd->regmap) { in wcd939x_sdw_runtime_suspend()
1515 regcache_cache_only(wcd->regmap, true); in wcd939x_sdw_runtime_suspend()
1516 regcache_mark_dirty(wcd->regmap); in wcd939x_sdw_runtime_suspend()
1526 if (wcd->regmap) { in wcd939x_sdw_runtime_resume()
1527 regcache_cache_only(wcd->regmap, false); in wcd939x_sdw_runtime_resume()
1528 regcache_sync(wcd->regmap); in wcd939x_sdw_runtime_resume()
1544 .name = "wcd9390-codec",
1550 MODULE_DESCRIPTION("WCD939X SDW codec driver");