From: Rohit Kumar <rohitkr@codeaurora.org>
To: Vinod <vkoul@kernel.org>
Cc: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org,
mark.rutland@arm.com, plai@codeaurora.org,
bgoswami@codeaurora.org, perex@perex.cz,
srinivas.kandagatla@linaro.org, tiwai@suse.com,
alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
Date: Mon, 9 Jul 2018 16:16:45 +0530 [thread overview]
Message-ID: <c1766ce9-060f-32d8-46fa-b0a6ac42538b@codeaurora.org> (raw)
In-Reply-To: <20180709074835.GB22377@vkoul-mobl>
Thanks Vinod for reviewing.
On 7/9/2018 1:18 PM, Vinod wrote:
> On 06-07-18, 15:13, Rohit kumar wrote:
>
>> +static void sdm845_init_supplies(struct device *dev)
>> +{
>> + struct snd_soc_card *card = dev_get_drvdata(dev);
>> + struct sdm845_snd_data *data = snd_soc_card_get_drvdata(card);
>> +
>> + data->vdd_supply = regulator_get(dev, "cdc-vdd");
>> + if (IS_ERR(data->vdd_supply)) {
>> + dev_err(dev, "Unable to get regulator supplies\n");
>> + data->vdd_supply = NULL;
>> + return;
>> + }
>> +
>> + if (regulator_enable(data->vdd_supply))
>> + dev_err(dev, "Unable to enable vdd supply\n");
>> +}
>> +
>> +static void sdm845_deinit_supplies(struct device *dev)
>> +{
>> + struct snd_soc_card *card = dev_get_drvdata(dev);
>> + struct sdm845_snd_data *data = snd_soc_card_get_drvdata(card);
>> +
>> + if (!data->vdd_supply)
>> + return;
>> +
>> + regulator_disable(data->vdd_supply);
>> + regulator_put(data->vdd_supply);
>> +}
> these two can be made generic, cant we make these common when we have
> supplies present?
Actually we need to move it to codec driver as suggested by Rob in v2
patchset.
I will remove this in next spin.
>> +static int sdm845_bind(struct device *dev)
>> +{
>> + struct snd_soc_card *card;
>> + struct sdm845_snd_data *data;
>> + int ret;
>> +
>> + card = kzalloc(sizeof(*card), GFP_KERNEL);
>> + if (!card)
>> + return -ENOMEM;
>> +
>> + /* Allocate the private data */
>> + data = kzalloc(sizeof(*data), GFP_KERNEL);
>> + if (!data)
>> + return -ENOMEM;
>> +
>> + ret = component_bind_all(dev, card);
>> + if (ret) {
>> + dev_err(dev, "Audio components bind failed: %d\n", ret);
>> + goto bind_fail;
>> + }
>> +
>> + dev_set_drvdata(dev, card);
>> + card->dev = dev;
>> + ret = qcom_snd_parse_of(card);
>> + if (ret) {
>> + dev_err(dev, "Error parsing OF data\n");
>> + goto parse_dt_fail;
>> + }
>> +
>> + data->card = card;
>> + snd_soc_card_set_drvdata(card, data);
>> +
>> + sdm845_add_be_ops(card);
>> +
>> + sdm845_init_supplies(dev);
>> +
>> + ret = snd_soc_register_card(card);
>> + if (ret) {
>> + dev_err(dev, "Sound card registration failed\n");
>> + goto register_card_fail;
>> + }
>> + return ret;
>> +
>> +register_card_fail:
>> + sdm845_deinit_supplies(dev);
>> + kfree(card->dai_link);
>> +parse_dt_fail:
>> + component_unbind_all(dev, card);
>> +bind_fail:
>> + kfree(data);
>> + kfree(card);
>> + return ret;
>> +}
> I would make a case for this to be moved into common too :)
There are few platform specific APIs and structs here like struct
sdm845_snd_data,
sdm845_add_be_ops() which needs to be initialized and assigned before
soundcard
registration. Moving this complete API to common will restrict it.
Please suggest.
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2018-07-09 10:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-06 9:43 [PATCH v3 0/5] Add support for audio on SDM845 SoC Rohit kumar
2018-07-06 9:43 ` [PATCH v3 1/5] ASoC: qcom: dt-bindings: Add sdm845 machine bindings Rohit kumar
2018-07-11 15:31 ` Rob Herring
2018-07-06 9:43 ` [PATCH v3 2/5] ASoC: qcom: Add support to parse common audio device nodes Rohit kumar
2018-07-06 17:51 ` Srinivas Kandagatla
2018-07-09 7:43 ` [alsa-devel] " Vinod
2018-07-06 9:43 ` [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support Rohit kumar
2018-07-09 7:48 ` [alsa-devel] " Vinod
2018-07-09 10:46 ` Rohit Kumar [this message]
2018-07-09 14:45 ` Vinod
2018-07-09 9:06 ` Srinivas Kandagatla
2018-07-09 11:14 ` Mark Brown
[not found] ` <2110bdcf-96ad-deb5-a5cb-767d7b2e242d@codeaurora.org>
2018-07-09 12:03 ` [alsa-devel] " Mark Brown
2018-07-09 12:34 ` Srinivas Kandagatla
2018-07-09 12:41 ` Mark Brown
2018-07-09 12:47 ` Srinivas Kandagatla
2018-07-09 14:02 ` Srinivas Kandagatla
2018-07-09 16:33 ` Mark Brown
2018-07-10 10:59 ` Srinivas Kandagatla
2018-07-06 9:43 ` [PATCH v3 4/5] ASoC: dt-bindings: Update dt binding name for apq8096 Rohit kumar
2018-07-06 17:51 ` Srinivas Kandagatla
2018-07-11 15:31 ` Rob Herring
2018-07-06 9:43 ` [PATCH v3 5/5] ASoC: qcom: apq8096: Use common APIs to parse device nodes Rohit kumar
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=c1766ce9-060f-32d8-46fa-b0a6ac42538b@codeaurora.org \
--to=rohitkr@codeaurora.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@codeaurora.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=perex@perex.cz \
--cc=plai@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
--cc=vkoul@kernel.org \
/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).