From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com, Bard liao <yung-chuan.liao@linux.intel.com>, Rander Wang <rander.wang@linux.intel.com>, Ranjani Sridharan <ranjani.sridharan@linux.intel.com>, Hui Wang <hui.wang@canonical.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Andy Gross <agross@kernel.org>, Bjorn Andersson <bjorn.andersson@linaro.org>, Sanyog Kale <sanyog.r.kale@intel.com>, linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT) Subject: [PATCH 5/5] soundwire: qcom: add sdw_master_device support Date: Fri, 20 Mar 2020 11:29:47 -0500 [thread overview] Message-ID: <20200320162947.17663-6-pierre-louis.bossart@linux.intel.com> (raw) In-Reply-To: <20200320162947.17663-1-pierre-louis.bossart@linux.intel.com> Add new device as a child of the platform device, following the following hierarchy: platform_device sdw_master_device sdw_slave0 ... sdw_slaveN For the Qualcomm implementation no sdw_master_driver is registered so the dais have to be registered using the platform_device and likely all power management is handled at the platform device level. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> --- drivers/soundwire/qcom.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 77783ae4b71d..86b46415e50b 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -89,6 +89,7 @@ struct qcom_swrm_port_config { struct qcom_swrm_ctrl { struct sdw_bus bus; struct device *dev; + struct sdw_master_device *md; struct regmap *regmap; struct completion *comp; struct work_struct slave_work; @@ -775,14 +776,31 @@ static int qcom_swrm_probe(struct platform_device *pdev) mutex_init(&ctrl->port_lock); INIT_WORK(&ctrl->slave_work, qcom_swrm_slave_wq); - ctrl->bus.dev = dev; + /* + * add sdw_master_device. + * For the Qualcomm implementation there is no driver. + */ + ctrl->md = sdw_master_device_add(NULL, /* no driver name */ + dev, /* platform device is parent */ + dev->fwnode, + 0, /* only one link supported */ + NULL); /* no context */ + if (IS_ERR(ctrl->md)) { + dev_err(dev, "Could not create sdw_master_device\n"); + ret = PTR_ERR(ctrl->md); + goto err_clk; + } + + /* the bus uses the sdw_master_device, not the platform device */ + ctrl->bus.dev = &ctrl->md->dev; + ctrl->bus.ops = &qcom_swrm_ops; ctrl->bus.port_ops = &qcom_swrm_port_ops; ctrl->bus.compute_params = &qcom_swrm_compute_params; ret = qcom_swrm_get_port_config(ctrl); if (ret) - goto err_clk; + goto err_md; params = &ctrl->bus.params; params->max_dr_freq = DEFAULT_CLK_FREQ; @@ -809,14 +827,14 @@ static int qcom_swrm_probe(struct platform_device *pdev) "soundwire", ctrl); if (ret) { dev_err(dev, "Failed to request soundwire irq\n"); - goto err_clk; + goto err_md; } ret = sdw_add_bus_master(&ctrl->bus); if (ret) { dev_err(dev, "Failed to register Soundwire controller (%d)\n", ret); - goto err_clk; + goto err_md; } qcom_swrm_init(ctrl); @@ -832,6 +850,8 @@ static int qcom_swrm_probe(struct platform_device *pdev) err_master_add: sdw_delete_bus_master(&ctrl->bus); +err_md: + device_unregister(&ctrl->md->dev); err_clk: clk_disable_unprepare(ctrl->hclk); err_init: @@ -843,6 +863,7 @@ static int qcom_swrm_remove(struct platform_device *pdev) struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(&pdev->dev); sdw_delete_bus_master(&ctrl->bus); + device_unregister(&ctrl->md->dev); clk_disable_unprepare(ctrl->hclk); return 0; -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> To: alsa-devel@alsa-project.org Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Ranjani Sridharan <ranjani.sridharan@linux.intel.com>, Hui Wang <hui.wang@canonical.com>, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, Andy Gross <agross@kernel.org>, jank@cadence.com, "open list:ARM/QUALCOMM SUPPORT" <linux-arm-msm@vger.kernel.org>, slawomir.blauciak@intel.com, Sanyog Kale <sanyog.r.kale@intel.com>, Bjorn Andersson <bjorn.andersson@linaro.org>, Bard liao <yung-chuan.liao@linux.intel.com>, Rander Wang <rander.wang@linux.intel.com> Subject: [PATCH 5/5] soundwire: qcom: add sdw_master_device support Date: Fri, 20 Mar 2020 11:29:47 -0500 [thread overview] Message-ID: <20200320162947.17663-6-pierre-louis.bossart@linux.intel.com> (raw) In-Reply-To: <20200320162947.17663-1-pierre-louis.bossart@linux.intel.com> Add new device as a child of the platform device, following the following hierarchy: platform_device sdw_master_device sdw_slave0 ... sdw_slaveN For the Qualcomm implementation no sdw_master_driver is registered so the dais have to be registered using the platform_device and likely all power management is handled at the platform device level. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> --- drivers/soundwire/qcom.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 77783ae4b71d..86b46415e50b 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -89,6 +89,7 @@ struct qcom_swrm_port_config { struct qcom_swrm_ctrl { struct sdw_bus bus; struct device *dev; + struct sdw_master_device *md; struct regmap *regmap; struct completion *comp; struct work_struct slave_work; @@ -775,14 +776,31 @@ static int qcom_swrm_probe(struct platform_device *pdev) mutex_init(&ctrl->port_lock); INIT_WORK(&ctrl->slave_work, qcom_swrm_slave_wq); - ctrl->bus.dev = dev; + /* + * add sdw_master_device. + * For the Qualcomm implementation there is no driver. + */ + ctrl->md = sdw_master_device_add(NULL, /* no driver name */ + dev, /* platform device is parent */ + dev->fwnode, + 0, /* only one link supported */ + NULL); /* no context */ + if (IS_ERR(ctrl->md)) { + dev_err(dev, "Could not create sdw_master_device\n"); + ret = PTR_ERR(ctrl->md); + goto err_clk; + } + + /* the bus uses the sdw_master_device, not the platform device */ + ctrl->bus.dev = &ctrl->md->dev; + ctrl->bus.ops = &qcom_swrm_ops; ctrl->bus.port_ops = &qcom_swrm_port_ops; ctrl->bus.compute_params = &qcom_swrm_compute_params; ret = qcom_swrm_get_port_config(ctrl); if (ret) - goto err_clk; + goto err_md; params = &ctrl->bus.params; params->max_dr_freq = DEFAULT_CLK_FREQ; @@ -809,14 +827,14 @@ static int qcom_swrm_probe(struct platform_device *pdev) "soundwire", ctrl); if (ret) { dev_err(dev, "Failed to request soundwire irq\n"); - goto err_clk; + goto err_md; } ret = sdw_add_bus_master(&ctrl->bus); if (ret) { dev_err(dev, "Failed to register Soundwire controller (%d)\n", ret); - goto err_clk; + goto err_md; } qcom_swrm_init(ctrl); @@ -832,6 +850,8 @@ static int qcom_swrm_probe(struct platform_device *pdev) err_master_add: sdw_delete_bus_master(&ctrl->bus); +err_md: + device_unregister(&ctrl->md->dev); err_clk: clk_disable_unprepare(ctrl->hclk); err_init: @@ -843,6 +863,7 @@ static int qcom_swrm_remove(struct platform_device *pdev) struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(&pdev->dev); sdw_delete_bus_master(&ctrl->bus); + device_unregister(&ctrl->md->dev); clk_disable_unprepare(ctrl->hclk); return 0; -- 2.20.1
next prev parent reply other threads:[~2020-03-20 16:30 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-20 16:29 [PATCH 0/5] soundwire: add sdw_master_device support on Qualcomm platforms Pierre-Louis Bossart 2020-03-20 16:29 ` Pierre-Louis Bossart 2020-03-20 16:29 ` [PATCH 1/5] soundwire: bus_type: add master_device/driver support Pierre-Louis Bossart 2020-03-20 16:29 ` Pierre-Louis Bossart 2020-03-20 17:51 ` Srinivas Kandagatla 2020-03-20 17:51 ` Srinivas Kandagatla 2020-03-20 18:17 ` Pierre-Louis Bossart 2020-03-20 18:17 ` Pierre-Louis Bossart 2020-03-23 11:06 ` Srinivas Kandagatla 2020-03-23 11:06 ` Srinivas Kandagatla 2020-03-23 12:54 ` Vinod Koul 2020-03-23 12:54 ` Vinod Koul 2020-03-20 16:29 ` [PATCH 2/5] soundwire: bus_type: protect cases where no driver name is provided Pierre-Louis Bossart 2020-03-20 16:29 ` Pierre-Louis Bossart 2020-03-20 16:29 ` [PATCH 3/5] soundwire: master: use device node pointer from master device Pierre-Louis Bossart 2020-03-20 16:29 ` Pierre-Louis Bossart 2020-03-20 16:29 ` [PATCH 4/5] soundwire: qcom: fix error handling in probe Pierre-Louis Bossart 2020-03-20 16:29 ` Pierre-Louis Bossart 2020-03-20 16:29 ` Pierre-Louis Bossart [this message] 2020-03-20 16:29 ` [PATCH 5/5] soundwire: qcom: add sdw_master_device support Pierre-Louis Bossart 2020-03-20 17:01 ` Srinivas Kandagatla 2020-03-20 17:01 ` Srinivas Kandagatla 2020-03-20 17:57 ` Pierre-Louis Bossart 2020-03-23 12:52 ` Vinod Koul 2020-03-23 12:52 ` 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=20200320162947.17663-6-pierre-louis.bossart@linux.intel.com \ --to=pierre-louis.bossart@linux.intel.com \ --cc=agross@kernel.org \ --cc=alsa-devel@alsa-project.org \ --cc=bjorn.andersson@linaro.org \ --cc=broonie@kernel.org \ --cc=gregkh@linuxfoundation.org \ --cc=hui.wang@canonical.com \ --cc=jank@cadence.com \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=rander.wang@linux.intel.com \ --cc=ranjani.sridharan@linux.intel.com \ --cc=sanyog.r.kale@intel.com \ --cc=slawomir.blauciak@intel.com \ --cc=srinivas.kandagatla@linaro.org \ --cc=tiwai@suse.de \ --cc=vkoul@kernel.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.