Lines Matching +full:wcd9380 +full:- +full:codec
1 // SPDX-License-Identifier: GPL-2.0
19 #include <sound/soc-dapm.h>
111 wcd->sconfig.ch_count = 1; in wcd938x_sdw_hw_params()
112 wcd->active_ports = 0; in wcd938x_sdw_hw_params()
114 ch_mask = wcd->port_config[i].ch_mask; in wcd938x_sdw_hw_params()
120 wcd->sconfig.ch_count++; in wcd938x_sdw_hw_params()
122 port_config[wcd->active_ports] = wcd->port_config[i]; in wcd938x_sdw_hw_params()
123 wcd->active_ports++; in wcd938x_sdw_hw_params()
126 wcd->sconfig.bps = 1; in wcd938x_sdw_hw_params()
127 wcd->sconfig.frame_rate = params_rate(params); in wcd938x_sdw_hw_params()
128 if (wcd->is_tx) in wcd938x_sdw_hw_params()
129 wcd->sconfig.direction = SDW_DATA_DIR_TX; in wcd938x_sdw_hw_params()
131 wcd->sconfig.direction = SDW_DATA_DIR_RX; in wcd938x_sdw_hw_params()
133 wcd->sconfig.type = SDW_STREAM_PCM; in wcd938x_sdw_hw_params()
135 return sdw_stream_add_slave(wcd->sdev, &wcd->sconfig, in wcd938x_sdw_hw_params()
136 &port_config[0], wcd->active_ports, in wcd938x_sdw_hw_params()
137 wcd->sruntime); in wcd938x_sdw_hw_params()
145 sdw_stream_remove_slave(wcd->sdev, wcd->sruntime); in wcd938x_sdw_free()
155 wcd->sruntime = stream; in wcd938x_sdw_set_sdw_stream()
164 struct wcd938x_sdw_priv *wcd = dev_get_drvdata(&slave->dev); in wcd9380_update_status()
166 if (wcd->regmap && (status == SDW_SLAVE_ATTACHED)) { in wcd9380_update_status()
168 regcache_cache_only(wcd->regmap, false); in wcd9380_update_status()
169 return regcache_sync(wcd->regmap); in wcd9380_update_status()
178 sdw_write(slave, SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(params->next_bank), 0x01); in wcd9380_bus_config()
186 struct wcd938x_sdw_priv *wcd = dev_get_drvdata(&slave->dev); in wcd9380_interrupt_callback()
187 struct irq_domain *slave_irq = wcd->slave_irq; in wcd9380_interrupt_callback()
192 regmap_read(wcd->regmap, WCD938X_DIGITAL_INTR_STATUS_0, &sts1); in wcd9380_interrupt_callback()
193 regmap_read(wcd->regmap, WCD938X_DIGITAL_INTR_STATUS_1, &sts2); in wcd9380_interrupt_callback()
194 regmap_read(wcd->regmap, WCD938X_DIGITAL_INTR_STATUS_2, &sts3); in wcd9380_interrupt_callback()
1220 struct device *dev = &pdev->dev; in wcd9380_probe()
1226 return -ENOMEM; in wcd9380_probe()
1229 * Port map index starts with 0, however the data port for this codec in wcd9380_probe()
1232 if (of_property_read_bool(dev->of_node, "qcom,tx-port-mapping")) { in wcd9380_probe()
1233 wcd->is_tx = true; in wcd9380_probe()
1234 ret = of_property_read_u32_array(dev->of_node, "qcom,tx-port-mapping", in wcd9380_probe()
1235 &pdev->m_port_map[1], in wcd9380_probe()
1238 ret = of_property_read_u32_array(dev->of_node, "qcom,rx-port-mapping", in wcd9380_probe()
1239 &pdev->m_port_map[1], in wcd9380_probe()
1246 wcd->sdev = pdev; in wcd9380_probe()
1249 pdev->prop.scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | in wcd9380_probe()
1252 pdev->prop.lane_control_support = true; in wcd9380_probe()
1253 pdev->prop.simple_clk_stop_capable = true; in wcd9380_probe()
1254 if (wcd->is_tx) { in wcd9380_probe()
1255 pdev->prop.source_ports = GENMASK(WCD938X_MAX_SWR_PORTS - 1, 0); in wcd9380_probe()
1256 pdev->prop.src_dpn_prop = wcd938x_dpn_prop; in wcd9380_probe()
1257 wcd->ch_info = &wcd938x_sdw_tx_ch_info[0]; in wcd9380_probe()
1258 pdev->prop.wake_capable = true; in wcd9380_probe()
1260 pdev->prop.sink_ports = GENMASK(WCD938X_MAX_SWR_PORTS - 1, 0); in wcd9380_probe()
1261 pdev->prop.sink_dpn_prop = wcd938x_dpn_prop; in wcd9380_probe()
1262 wcd->ch_info = &wcd938x_sdw_rx_ch_info[0]; in wcd9380_probe()
1265 if (wcd->is_tx) { in wcd9380_probe()
1266 wcd->regmap = devm_regmap_init_sdw(pdev, &wcd938x_regmap_config); in wcd9380_probe()
1267 if (IS_ERR(wcd->regmap)) in wcd9380_probe()
1268 return dev_err_probe(dev, PTR_ERR(wcd->regmap), in wcd9380_probe()
1271 /* Start in cache-only until device is enumerated */ in wcd9380_probe()
1272 regcache_cache_only(wcd->regmap, true); in wcd9380_probe()
1297 struct device *dev = &pdev->dev; in wcd9380_remove()
1318 if (wcd->regmap) { in wcd938x_sdw_runtime_suspend()
1319 regcache_cache_only(wcd->regmap, true); in wcd938x_sdw_runtime_suspend()
1320 regcache_mark_dirty(wcd->regmap); in wcd938x_sdw_runtime_suspend()
1330 if (wcd->regmap) { in wcd938x_sdw_runtime_resume()
1331 regcache_cache_only(wcd->regmap, false); in wcd938x_sdw_runtime_resume()
1332 regcache_sync(wcd->regmap); in wcd938x_sdw_runtime_resume()
1351 .name = "wcd9380-codec",
1357 MODULE_DESCRIPTION("WCD938X SDW codec driver");