Commit a479ebb2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull soundwire updates from Vinod Koul:
 "A couple of small core changes and an Intel driver change:

   - sdw_assign_device_num() logic simplification, using internal slave
     id for irqs and optimizing computing of port params in specific
     stream states

   - Intel driver updates for ACE3+ microphone privacy status reporting
     and enabling the status in HDA Intel driver"

* tag 'soundwire-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
  soundwire: only compute port params in specific stream states
  ASoC: SOF: Intel: hda: Set the mic_privacy flag for soundwire with ACE3+
  soundwire: intel: Add awareness of ACE3+ microphone privacy
  soundwire: bus: Add internal slave ID and use for IRQs
  soundwire: bus: Simplify sdw_assign_device_num()
parents ec7714e4 62ada17a
Loading
Loading
Loading
Loading
+14 −17
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
		return ret;
	}

	ida_init(&bus->slave_ida);

	ret = sdw_master_device_add(bus, parent, fwnode);
	if (ret < 0) {
		dev_err(parent, "Failed to add master device at link %d\n",
@@ -751,41 +753,36 @@ static int sdw_get_device_num(struct sdw_slave *slave)
static int sdw_assign_device_num(struct sdw_slave *slave)
{
	struct sdw_bus *bus = slave->bus;
	int ret, dev_num;
	bool new_device = false;
	struct device *dev = bus->dev;
	int ret;

	/* check first if device number is assigned, if so reuse that */
	if (!slave->dev_num) {
		if (!slave->dev_num_sticky) {
			int dev_num;

			mutex_lock(&slave->bus->bus_lock);
			dev_num = sdw_get_device_num(slave);
			mutex_unlock(&slave->bus->bus_lock);
			if (dev_num < 0) {
				dev_err(bus->dev, "Get dev_num failed: %d\n",
					dev_num);
				dev_err(dev, "Get dev_num failed: %d\n", dev_num);
				return dev_num;
			}
			slave->dev_num = dev_num;

			slave->dev_num_sticky = dev_num;
			new_device = true;
		} else {
			slave->dev_num = slave->dev_num_sticky;
			dev_dbg(dev, "Slave already registered, reusing dev_num: %d\n",
				slave->dev_num_sticky);
		}
	}

	if (!new_device)
		dev_dbg(bus->dev,
			"Slave already registered, reusing dev_num:%d\n",
			slave->dev_num);

	/* Clear the slave->dev_num to transfer message on device 0 */
	dev_num = slave->dev_num;
	slave->dev_num = 0;

	ret = sdw_write_no_pm(slave, SDW_SCP_DEVNUMBER, dev_num);
	ret = sdw_write_no_pm(slave, SDW_SCP_DEVNUMBER, slave->dev_num_sticky);
	if (ret < 0) {
		dev_err(bus->dev, "Program device_num %d failed: %d\n",
			dev_num, ret);
		dev_err(dev, "Program device_num %d failed: %d\n",
			slave->dev_num_sticky, ret);
		return ret;
	}

@@ -793,7 +790,7 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
	slave->dev_num = slave->dev_num_sticky;

	if (bus->ops && bus->ops->new_peripheral_assigned)
		bus->ops->new_peripheral_assigned(bus, slave, dev_num);
		bus->ops->new_peripheral_assigned(bus, slave, slave->dev_num);

	return 0;
}
+10 −0
Original line number Diff line number Diff line
@@ -105,9 +105,17 @@ static int sdw_drv_probe(struct device *dev)
	if (ret)
		return ret;

	ret = ida_alloc_max(&slave->bus->slave_ida, SDW_FW_MAX_DEVICES, GFP_KERNEL);
	if (ret < 0) {
		dev_err(dev, "Failed to allocated ID: %d\n", ret);
		return ret;
	}
	slave->index = ret;

	ret = drv->probe(slave, id);
	if (ret) {
		dev_pm_domain_detach(dev, false);
		ida_free(&slave->bus->slave_ida, slave->index);
		return ret;
	}

@@ -174,6 +182,8 @@ static int sdw_drv_remove(struct device *dev)

	dev_pm_domain_detach(dev, false);

	ida_free(&slave->bus->slave_ida, slave->index);

	return ret;
}

+7 −0
Original line number Diff line number Diff line
@@ -204,6 +204,13 @@ static void _sdw_compute_port_params(struct sdw_bus *bus,
			port_bo = 1;

			list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
				/*
				 * Only runtimes with CONFIGURED, PREPARED, ENABLED, and DISABLED
				 * states should be included in the bandwidth calculation.
				 */
				if (m_rt->stream->state > SDW_STREAM_DISABLED ||
				    m_rt->stream->state < SDW_STREAM_CONFIGURED)
					continue;
				sdw_compute_master_ports(m_rt, &params[i], &port_bo, hstop);
			}

+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ struct hdac_bus;
 * @shim_lock: mutex to handle access to shared SHIM registers
 * @shim_mask: global pointer to check SHIM register initialization
 * @clock_stop_quirks: mask defining requested behavior on pm_suspend
 * @mic_privacy: ACE version supports microphone privacy
 * @link_mask: global mask needed for power-up/down sequences
 * @cdns: Cadence master descriptor
 * @list: used to walk-through all masters exposed by the same controller
@@ -42,6 +43,7 @@ struct sdw_intel_link_res {
	struct mutex *shim_lock; /* protect shared registers */
	u32 *shim_mask;
	u32 clock_stop_quirks;
	bool mic_privacy;
	u32 link_mask;
	struct sdw_cdns *cdns;
	struct list_head list;
+6 −0
Original line number Diff line number Diff line
@@ -76,6 +76,12 @@ static int intel_reg_show(struct seq_file *s_file, void *data)
	ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_IOCTL);
	ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_ACTMCTL);

	if (sdw->link_res->mic_privacy) {
		ret += scnprintf(buf + ret, RD_BUF - ret, "\nVS PVCCS\n");
		ret += intel_sprintf(vs_s, false, buf, ret,
				     SDW_SHIM2_INTEL_VS_PVCCS);
	}

	seq_printf(s_file, "%s", buf);
	kfree(buf);

Loading