From: Vinod Koul <vkoul@kernel.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org, tiwai@suse.de,
gregkh@linuxfoundation.org, broonie@kernel.org,
srinivas.kandagatla@linaro.org,
Bard liao <yung-chuan.liao@linux.intel.com>,
Rander Wang <rander.wang@linux.intel.com>
Subject: Re: [PATCH v2 1/2] soundwire: bus: add enumerated Slave device to device list
Date: Fri, 18 Sep 2020 17:35:02 +0530 [thread overview]
Message-ID: <20200918120502.GR2968@vkoul-mobl> (raw)
In-Reply-To: <20200917160007.153106-2-pierre-louis.bossart@linux.intel.com>
On 17-09-20, 11:00, Pierre-Louis Bossart wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>
> Currently Slave devices are only added on startup, either from Device
> Tree or ACPI entries. However Slave devices that are physically
> present on the bus, but not described in platform firmware, will never
> be added to the device list. The user/integrator can only know the
> list of devices by looking a dynamic debug logs.
>
> This patch suggests adding a Slave device eveb there is no matching DT or
> ACPI entry, so that we can see this in sysfs entry.
>
> Initial code from Srinivas. Comments, fixes for ACPI probe and edits
> of commit message by Pierre.
You should add yours as Co-developed. That is the standard tag for these
things
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
> drivers/soundwire/bus.c | 9 +++++++++
> drivers/soundwire/bus.h | 2 ++
> drivers/soundwire/bus_type.c | 9 +++++++++
> drivers/soundwire/slave.c | 4 ++--
> 4 files changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index 02574b4bb179..81807b332a12 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -741,6 +741,15 @@ static int sdw_program_device_num(struct sdw_bus *bus)
>
> if (!found) {
> /* TODO: Park this device in Group 13 */
> +
> + /*
> + * add Slave device even if there is no platform
> + * firmware description. There will be no driver probe
> + * but the user/integration will be able to see the
> + * device, enumeration status and device number in sysfs
> + */
> + sdw_slave_add(bus, &id, NULL);
> +
> dev_err(bus->dev, "Slave Entry not found\n");
> }
>
> diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h
> index c53345fbc4c7..fd251c1eb925 100644
> --- a/drivers/soundwire/bus.h
> +++ b/drivers/soundwire/bus.h
> @@ -19,6 +19,8 @@ static inline int sdw_acpi_find_slaves(struct sdw_bus *bus)
> int sdw_of_find_slaves(struct sdw_bus *bus);
> void sdw_extract_slave_id(struct sdw_bus *bus,
> u64 addr, struct sdw_slave_id *id);
> +int sdw_slave_add(struct sdw_bus *bus, struct sdw_slave_id *id,
> + struct fwnode_handle *fwnode);
> int sdw_master_device_add(struct sdw_bus *bus, struct device *parent,
> struct fwnode_handle *fwnode);
> int sdw_master_device_del(struct sdw_bus *bus);
> diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c
> index 6fba55898cf0..575b9bad99d5 100644
> --- a/drivers/soundwire/bus_type.c
> +++ b/drivers/soundwire/bus_type.c
> @@ -84,6 +84,15 @@ static int sdw_drv_probe(struct device *dev)
> const struct sdw_device_id *id;
> int ret;
>
> + /*
> + * fw description is mandatory to bind
> + */
> + if (!dev->fwnode)
> + return -ENODEV;
> +
> + if (!IS_ENABLED(CONFIG_ACPI) && !dev->of_node)
> + return -ENODEV;
> +
> id = sdw_get_device_id(slave, drv);
> if (!id)
> return -ENODEV;
> diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c
> index 4a250d33de5d..19b012310c29 100644
> --- a/drivers/soundwire/slave.c
> +++ b/drivers/soundwire/slave.c
> @@ -20,8 +20,8 @@ struct device_type sdw_slave_type = {
> .uevent = sdw_slave_uevent,
> };
>
> -static int sdw_slave_add(struct sdw_bus *bus,
> - struct sdw_slave_id *id, struct fwnode_handle *fwnode)
> +int sdw_slave_add(struct sdw_bus *bus,
> + struct sdw_slave_id *id, struct fwnode_handle *fwnode)
> {
> struct sdw_slave *slave;
> int ret;
> --
> 2.25.1
--
~Vinod
next prev parent reply other threads:[~2020-09-18 12:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 16:00 [PATCH v2 0/2] soundwire: sysfs: expose device number and status Pierre-Louis Bossart
2020-09-17 16:00 ` [PATCH v2 1/2] soundwire: bus: add enumerated Slave device to device list Pierre-Louis Bossart
2020-09-18 12:05 ` Vinod Koul [this message]
2020-09-18 13:54 ` Pierre-Louis Bossart
2020-09-19 11:13 ` Vinod Koul
2020-09-17 16:00 ` [PATCH v2 2/2] soundwire: sysfs: add slave status and device number before probe Pierre-Louis Bossart
2020-09-17 16:36 ` Greg KH
2020-09-18 12:16 ` Vinod Koul
2020-09-18 14:21 ` Pierre-Louis Bossart
2020-09-19 11:19 ` Vinod Koul
2020-09-21 14:34 ` Pierre-Louis Bossart
2020-09-23 10:03 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200918120502.GR2968@vkoul-mobl \
--to=vkoul@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rander.wang@linux.intel.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.de \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).