Lines Matching full:slave
63 struct sdw_slave *slave, in _sdw_program_slave_port_params() argument
84 ret = sdw_write_no_pm(slave, addr1, t_params->offset2); in _sdw_program_slave_port_params()
91 ret = sdw_write_no_pm(slave, addr2, t_params->blk_pkg_mode); in _sdw_program_slave_port_params()
108 ret = sdw_write_no_pm(slave, addr3, wbuf); in _sdw_program_slave_port_params()
118 ret = sdw_write_no_pm(slave, addr4, wbuf); in _sdw_program_slave_port_params()
131 struct sdw_slave_prop *slave_prop = &s_rt->slave->prop; in sdw_program_slave_port_params()
137 if (s_rt->slave->is_mockup_device) in sdw_program_slave_port_params()
140 dpn_prop = sdw_get_slave_dpn_prop(s_rt->slave, in sdw_program_slave_port_params()
166 ret = sdw_update_no_pm(s_rt->slave, addr1, 0xF, wbuf); in sdw_program_slave_port_params()
168 dev_err(&s_rt->slave->dev, in sdw_program_slave_port_params()
176 ret = sdw_write_no_pm(s_rt->slave, addr2, (p_params->bps - 1)); in sdw_program_slave_port_params()
178 dev_err(&s_rt->slave->dev, in sdw_program_slave_port_params()
187 ret = sdw_write_no_pm(s_rt->slave, addr3, wbuf); in sdw_program_slave_port_params()
189 dev_err(&s_rt->slave->dev, in sdw_program_slave_port_params()
196 ret = sdw_write_no_pm(s_rt->slave, addr4, t_params->offset1); in sdw_program_slave_port_params()
198 dev_err(&s_rt->slave->dev, in sdw_program_slave_port_params()
206 ret = sdw_write_no_pm(s_rt->slave, addr5, t_params->blk_grp_ctrl); in sdw_program_slave_port_params()
208 dev_err(&s_rt->slave->dev, in sdw_program_slave_port_params()
217 ret = sdw_write_no_pm(s_rt->slave, addr6, t_params->lane_ctrl); in sdw_program_slave_port_params()
219 dev_err(&s_rt->slave->dev, in sdw_program_slave_port_params()
227 ret = _sdw_program_slave_port_params(bus, s_rt->slave, in sdw_program_slave_port_params()
230 dev_err(&s_rt->slave->dev, in sdw_program_slave_port_params()
262 * and Slave(s)
273 /* Program transport & port parameters for Slave(s) */ in sdw_program_port_params()
293 * sdw_enable_disable_slave_ports: Enable/disable slave data port
296 * @s_rt: slave runtime
322 ret = sdw_write_no_pm(s_rt->slave, addr, p_rt->ch_mask); in sdw_enable_disable_slave_ports()
324 ret = sdw_write_no_pm(s_rt->slave, addr, 0x0); in sdw_enable_disable_slave_ports()
327 dev_err(&s_rt->slave->dev, in sdw_enable_disable_slave_ports()
328 "Slave chn_en reg write failed:%d port:%d\n", in sdw_enable_disable_slave_ports()
370 * Slave(s)
381 /* Enable/Disable Slave port(s) */ in sdw_enable_disable_ports()
406 struct sdw_slave *slave = s_rt->slave; in sdw_do_port_prep() local
408 mutex_lock(&slave->sdw_dev_lock); in sdw_do_port_prep()
410 if (slave->probed) { in sdw_do_port_prep()
411 struct device *dev = &slave->dev; in sdw_do_port_prep()
415 ret = drv->ops->port_prep(slave, &prep_ch, cmd); in sdw_do_port_prep()
417 dev_err(dev, "Slave Port Prep cmd %d failed: %d\n", in sdw_do_port_prep()
422 mutex_unlock(&slave->sdw_dev_lock); in sdw_do_port_prep()
442 dpn_prop = sdw_get_slave_dpn_prop(s_rt->slave, in sdw_prep_deprep_slave_ports()
447 "Slave Port:%d properties not found\n", prep_ch.num); in sdw_prep_deprep_slave_ports()
465 ret = sdw_configure_dpn_intr(s_rt->slave, p_rt->num, prep, in sdw_prep_deprep_slave_ports()
471 /* Inform slave about the impending port prepare */ in sdw_prep_deprep_slave_ports()
474 /* Prepare Slave port implementing CP_SM */ in sdw_prep_deprep_slave_ports()
479 ret = sdw_write_no_pm(s_rt->slave, addr, p_rt->ch_mask); in sdw_prep_deprep_slave_ports()
481 ret = sdw_write_no_pm(s_rt->slave, addr, 0x0); in sdw_prep_deprep_slave_ports()
484 dev_err(&s_rt->slave->dev, in sdw_prep_deprep_slave_ports()
485 "Slave prep_ctrl reg write failed\n"); in sdw_prep_deprep_slave_ports()
490 port_ready = &s_rt->slave->port_ready[prep_ch.num]; in sdw_prep_deprep_slave_ports()
494 val = sdw_read_no_pm(s_rt->slave, SDW_DPN_PREPARESTATUS(p_rt->num)); in sdw_prep_deprep_slave_ports()
497 dev_err(&s_rt->slave->dev, in sdw_prep_deprep_slave_ports()
508 ret = sdw_configure_dpn_intr(s_rt->slave, p_rt->num, prep, in sdw_prep_deprep_slave_ports()
544 * Slave(s)
555 /* Prepare/De-prepare Slave port(s) */ in sdw_prep_deprep_ports()
580 * This function notifies the Master(s) and Slave(s) of the
587 struct sdw_slave *slave; in sdw_notify_config() local
597 slave = s_rt->slave; in sdw_notify_config()
599 mutex_lock(&slave->sdw_dev_lock); in sdw_notify_config()
601 if (slave->probed) { in sdw_notify_config()
602 struct device *dev = &slave->dev; in sdw_notify_config()
606 ret = drv->ops->bus_config(slave, &bus->params); in sdw_notify_config()
608 dev_err(dev, "Notify Slave: %d failed\n", in sdw_notify_config()
609 slave->dev_num); in sdw_notify_config()
610 mutex_unlock(&slave->sdw_dev_lock); in sdw_notify_config()
616 mutex_unlock(&slave->sdw_dev_lock); in sdw_notify_config()
624 * and Slave(s)
719 dev_err(bus->dev, "Slave frame_ctrl reg write failed\n"); in sdw_bank_switch()
925 static void sdw_slave_port_free(struct sdw_slave *slave, in sdw_slave_port_free() argument
934 if (s_rt->slave != slave) in sdw_slave_port_free()
945 static int sdw_slave_port_alloc(struct sdw_slave *slave, in sdw_slave_port_alloc() argument
972 static int sdw_slave_port_config(struct sdw_slave *slave, in sdw_slave_port_config() argument
984 * slave in sdw_slave_port_config()
986 ret = sdw_slave_port_is_valid_range(&slave->dev, port_config[i].num); in sdw_slave_port_config()
1048 * sdw_slave_rt_alloc() - Allocate a Slave runtime handle.
1050 * @slave: Slave handle
1056 *sdw_slave_rt_alloc(struct sdw_slave *slave, in sdw_slave_rt_alloc() argument
1066 s_rt->slave = slave; in sdw_slave_rt_alloc()
1074 * sdw_slave_rt_config() - Configure a Slave runtime handle.
1076 * @s_rt: Slave runtime handle
1090 static struct sdw_slave_runtime *sdw_slave_rt_find(struct sdw_slave *slave, in sdw_slave_rt_find() argument
1097 /* Retrieve Slave runtime handle */ in sdw_slave_rt_find()
1100 if (s_rt->slave == slave) in sdw_slave_rt_find()
1108 * sdw_slave_rt_free() - Free Slave(s) runtime handle
1110 * @slave: Slave handle.
1115 static void sdw_slave_rt_free(struct sdw_slave *slave, in sdw_slave_rt_free() argument
1120 s_rt = sdw_slave_rt_find(slave, stream); in sdw_slave_rt_free()
1214 * It frees the Master runtime handle and associated Slave(s) runtime
1216 * no effect as Slave(s) runtime handle would already be freed up.
1225 sdw_slave_port_free(s_rt->slave, stream); in sdw_master_rt_free()
1226 sdw_slave_rt_free(s_rt->slave, stream); in sdw_master_rt_free()
1242 * @is_slave: is API called from Slave or Master
1283 * sdw_get_slave_dpn_prop() - Get Slave port capabilities
1285 * @slave: Slave handle
1289 struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave, in sdw_get_slave_dpn_prop() argument
1298 num_ports = hweight32(slave->prop.source_ports); in sdw_get_slave_dpn_prop()
1299 dpn_prop = slave->prop.src_dpn_prop; in sdw_get_slave_dpn_prop()
1301 num_ports = hweight32(slave->prop.sink_ports); in sdw_get_slave_dpn_prop()
1302 dpn_prop = slave->prop.sink_dpn_prop; in sdw_get_slave_dpn_prop()
1366 /* Prepare Master(s) and Slave(s) port(s) associated with stream */ in _sdw_prepare_stream()
1486 /* Enable Master(s) and Slave(s) port(s) associated with stream */ in _sdw_enable_stream()
1893 * check if Master is already allocated (e.g. as a result of Slave adding in sdw_stream_add_master()
1976 * sdw_stream_add_slave() - Allocate and add master/slave runtime to a stream
1978 * @slave: SDW Slave instance
1984 * It is expected that Slave is added before adding Master
1988 int sdw_stream_add_slave(struct sdw_slave *slave, in sdw_stream_add_slave() argument
2001 mutex_lock(&slave->bus->bus_lock); in sdw_stream_add_slave()
2007 m_rt = sdw_master_rt_find(slave->bus, stream); in sdw_stream_add_slave()
2010 * If this API is invoked by Slave first then m_rt is not valid. in sdw_stream_add_slave()
2011 * So, allocate m_rt and add Slave to it. in sdw_stream_add_slave()
2013 m_rt = sdw_master_rt_alloc(slave->bus, stream); in sdw_stream_add_slave()
2015 dev_err(&slave->dev, "%s: Master runtime alloc failed for stream:%s\n", in sdw_stream_add_slave()
2024 s_rt = sdw_slave_rt_find(slave, stream); in sdw_stream_add_slave()
2026 s_rt = sdw_slave_rt_alloc(slave, m_rt); in sdw_stream_add_slave()
2028 dev_err(&slave->dev, "Slave runtime alloc failed for stream:%s\n", in sdw_stream_add_slave()
2038 ret = sdw_slave_port_alloc(slave, s_rt, num_ports); in sdw_stream_add_slave()
2051 ret = sdw_config_stream(&slave->dev, stream, stream_config, true); in sdw_stream_add_slave()
2055 ret = sdw_slave_port_config(slave, s_rt, port_config); in sdw_stream_add_slave()
2060 * Change stream state to CONFIGURED on first Slave add. in sdw_stream_add_slave()
2061 * Bus is not aware of number of Slave(s) in a stream at this in sdw_stream_add_slave()
2062 * point so cannot depend on all Slave(s) to be added in order to in sdw_stream_add_slave()
2077 sdw_slave_rt_free(slave, stream); in sdw_stream_add_slave()
2079 mutex_unlock(&slave->bus->bus_lock); in sdw_stream_add_slave()
2085 * sdw_stream_remove_slave() - Remove slave from sdw_stream
2087 * @slave: SDW Slave instance
2092 int sdw_stream_remove_slave(struct sdw_slave *slave, in sdw_stream_remove_slave() argument
2095 mutex_lock(&slave->bus->bus_lock); in sdw_stream_remove_slave()
2097 sdw_slave_port_free(slave, stream); in sdw_stream_remove_slave()
2098 sdw_slave_rt_free(slave, stream); in sdw_stream_remove_slave()
2100 mutex_unlock(&slave->bus->bus_lock); in sdw_stream_remove_slave()