diff mbox

[3/8] ASoC: uda134x: Optionally initialize L3 ops to default GPIO ops

Message ID 1470317928-25365-4-git-send-email-s.nawrocki@samsung.com (mailing list archive)
State Accepted
Commit 15a1bf0a7d3d7e6b351cac472ca4b6bc3746eb2e
Headers show

Commit Message

The GPIO ops can be selected by platform_data which allows the
codec platform device to probe without the sound card's driver
intervention.

The downside is that it will request GPIOs on behalf of the codec
device and thus allow only one user on the bus, but it desn't seem
to be a limitation with current code and usage of the GPIO ops is
optional anyway.
The proper approach would presumably be to create a proper Linux
bus driver for L3, should this rather ancient bus specification
suddenly gain more interest.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 sound/soc/codecs/uda134x.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Mark Brown Aug. 4, 2016, 9:03 p.m. UTC | #1
On Thu, Aug 04, 2016 at 03:38:43PM +0200, Sylwester Nawrocki wrote:

> The downside is that it will request GPIOs on behalf of the codec
> device and thus allow only one user on the bus, but it desn't seem
> to be a limitation with current code and usage of the GPIO ops is
> optional anyway.

Does L3 actually support multiple devices?
On 08/04/2016 11:03 PM, Mark Brown wrote:
> Does L3 actually support multiple devices?

From the bus operation description in a few datasheets of the Philips'
UDA13XX codecs I have checked I would say it's possible to have multiple
devices working on same bus.  The slave devices are selectable by 6
most significant bits of the address byte and the device addresses
seem to be unique at first sight.

"In the event that the UDA1341TS receives a different address, it will
deselect its microcontroller interface logic." (ch. 7.19 [1])

However I can't answer yes for sure, I've never seen multiple device
operation mentioned explicitly in the datasheets nor such an hardware
configuration.

[1] http://www.nxp.com/documents/data_sheet/UDA1341TS.pdf
diff mbox

Patch

diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index e4c694c..b72c925 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -544,6 +544,7 @@  static int uda134x_codec_probe(struct platform_device *pdev)
 {
 	struct uda134x_platform_data *pd = pdev->dev.platform_data;
 	struct uda134x_priv *uda134x;
+	int ret;
 
 	if (!pd) {
 		dev_err(&pdev->dev, "Missing L3 bitbang function\n");
@@ -557,6 +558,12 @@  static int uda134x_codec_probe(struct platform_device *pdev)
 	uda134x->pd = pd;
 	platform_set_drvdata(pdev, uda134x);
 
+	if (pd->l3.use_gpios) {
+		ret = l3_set_gpio_ops(&pdev->dev, &uda134x->pd->l3);
+		if (ret < 0)
+			return ret;
+	}
+
 	uda134x->regmap = devm_regmap_init(&pdev->dev, NULL, pd,
 		&uda134x_regmap_config);
 	if (IS_ERR(uda134x->regmap))