diff mbox series

[3/4] soundwire: extend parameters of new_peripheral_assigned() callback

Message ID 20230531033736.792464-4-yung-chuan.liao@linux.intel.com
State New
Headers show
Series soundwire: allow for more than 8 devices, keep IDA for wake-capable devices | expand

Commit Message

Liao, Bard May 31, 2023, 3:37 a.m. UTC
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

The parameters are only the bus and the device number, manager ops may
need additional details on the type of peripheral connected, such as
whether it is wake-capable or not.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/bus.c             | 2 +-
 drivers/soundwire/intel_auxdevice.c | 4 +++-
 include/linux/soundwire/sdw.h       | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

Comments

Vinod Koul June 8, 2023, 7:07 a.m. UTC | #1
On 31-05-23, 11:37, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> The parameters are only the bus and the device number, manager ops may
> need additional details on the type of peripheral connected, such as
> whether it is wake-capable or not.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Reviewed-by: Rander Wang <rander.wang@intel.com>
> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> ---
>  drivers/soundwire/bus.c             | 2 +-
>  drivers/soundwire/intel_auxdevice.c | 4 +++-
>  include/linux/soundwire/sdw.h       | 4 +++-
>  3 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index 6f465cce8369..17b9a8bdf234 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -786,7 +786,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, dev_num);
> +		bus->ops->new_peripheral_assigned(bus, slave, dev_num);
>  
>  	return 0;
>  }
> diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
> index 30f3d2ab80fd..c1df6f014e6b 100644
> --- a/drivers/soundwire/intel_auxdevice.c
> +++ b/drivers/soundwire/intel_auxdevice.c
> @@ -60,7 +60,9 @@ static int generic_post_bank_switch(struct sdw_bus *bus)
>  	return sdw->link_res->hw_ops->post_bank_switch(sdw);
>  }
>  
> -static void generic_new_peripheral_assigned(struct sdw_bus *bus, int dev_num)
> +static void generic_new_peripheral_assigned(struct sdw_bus *bus,
> +					    struct sdw_slave *slave,
> +					    int dev_num)
>  {
>  	struct sdw_cdns *cdns = bus_to_cdns(bus);
>  	struct sdw_intel *sdw = cdns_to_intel(cdns);
> diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
> index 8a7541ac735e..41a856bedf1e 100644
> --- a/include/linux/soundwire/sdw.h
> +++ b/include/linux/soundwire/sdw.h
> @@ -861,7 +861,9 @@ struct sdw_master_ops {
>  	int (*pre_bank_switch)(struct sdw_bus *bus);
>  	int (*post_bank_switch)(struct sdw_bus *bus);
>  	u32 (*read_ping_status)(struct sdw_bus *bus);
> -	void (*new_peripheral_assigned)(struct sdw_bus *bus, int dev_num);
> +	void (*new_peripheral_assigned)(struct sdw_bus *bus,
> +					struct sdw_slave *slave,

maybe better, drop the bus and pass slave (which contains bus)
Pierre-Louis Bossart June 8, 2023, 1:24 p.m. UTC | #2
>> -static void generic_new_peripheral_assigned(struct sdw_bus *bus, int dev_num)
>> +static void generic_new_peripheral_assigned(struct sdw_bus *bus,
>> +					    struct sdw_slave *slave,
>> +					    int dev_num)
>>  {
>>  	struct sdw_cdns *cdns = bus_to_cdns(bus);
>>  	struct sdw_intel *sdw = cdns_to_intel(cdns);
>> diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
>> index 8a7541ac735e..41a856bedf1e 100644
>> --- a/include/linux/soundwire/sdw.h
>> +++ b/include/linux/soundwire/sdw.h
>> @@ -861,7 +861,9 @@ struct sdw_master_ops {
>>  	int (*pre_bank_switch)(struct sdw_bus *bus);
>>  	int (*post_bank_switch)(struct sdw_bus *bus);
>>  	u32 (*read_ping_status)(struct sdw_bus *bus);
>> -	void (*new_peripheral_assigned)(struct sdw_bus *bus, int dev_num);
>> +	void (*new_peripheral_assigned)(struct sdw_bus *bus,
>> +					struct sdw_slave *slave,
> 
> maybe better, drop the bus and pass slave (which contains bus)

I kept it for consistency, all callbacks for sdw_master_ops start with
the bus parameter.
diff mbox series

Patch

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 6f465cce8369..17b9a8bdf234 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -786,7 +786,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, dev_num);
+		bus->ops->new_peripheral_assigned(bus, slave, dev_num);
 
 	return 0;
 }
diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
index 30f3d2ab80fd..c1df6f014e6b 100644
--- a/drivers/soundwire/intel_auxdevice.c
+++ b/drivers/soundwire/intel_auxdevice.c
@@ -60,7 +60,9 @@  static int generic_post_bank_switch(struct sdw_bus *bus)
 	return sdw->link_res->hw_ops->post_bank_switch(sdw);
 }
 
-static void generic_new_peripheral_assigned(struct sdw_bus *bus, int dev_num)
+static void generic_new_peripheral_assigned(struct sdw_bus *bus,
+					    struct sdw_slave *slave,
+					    int dev_num)
 {
 	struct sdw_cdns *cdns = bus_to_cdns(bus);
 	struct sdw_intel *sdw = cdns_to_intel(cdns);
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index 8a7541ac735e..41a856bedf1e 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -861,7 +861,9 @@  struct sdw_master_ops {
 	int (*pre_bank_switch)(struct sdw_bus *bus);
 	int (*post_bank_switch)(struct sdw_bus *bus);
 	u32 (*read_ping_status)(struct sdw_bus *bus);
-	void (*new_peripheral_assigned)(struct sdw_bus *bus, int dev_num);
+	void (*new_peripheral_assigned)(struct sdw_bus *bus,
+					struct sdw_slave *slave,
+					int dev_num);
 };
 
 /**