diff mbox

[v3,2/5] ASoC: tas571x: chip type detection via I2C name

Message ID 1459425241-21941-2-git-send-email-petr@barix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Petr Kulhavy March 31, 2016, 11:53 a.m. UTC
The chip selection was relying only on DT. It was not possible to use the
driver without DT.
This adds the chip type detection from the I2C name, which
allows to use the driver from the platform driver without DT.

Signed-off-by: Petr Kulhavy <petr@barix.com>
Reviewed-by: Kevin Cernekee <cernekee@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
v1: <initial>
v2: <no change>
v3: <no change>

 sound/soc/codecs/tas571x.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Mark Brown March 31, 2016, 3:36 p.m. UTC | #1
On Thu, Mar 31, 2016 at 01:53:58PM +0200, Petr Kulhavy wrote:
> The chip selection was relying only on DT. It was not possible to use the
> driver without DT.
> This adds the chip type detection from the I2C name, which
> allows to use the driver from the platform driver without DT.
> 
> Signed-off-by: Petr Kulhavy <petr@barix.com>
> Reviewed-by: Kevin Cernekee <cernekee@chromium.org>
> Signed-off-by: Mark Brown <broonie@kernel.org>

Don't resubmit already applied patches, as covered in SubmittingPatches
you should submit against the latest development tree.  Please resend
with just the new stuff, if any changes are needed in already applied
patches send incremental fixes.
Petr Kulhavy March 31, 2016, 4:32 p.m. UTC | #2
On 31.03.2016 17:36, Mark Brown wrote:
> On Thu, Mar 31, 2016 at 01:53:58PM +0200, Petr Kulhavy wrote:
>> The chip selection was relying only on DT. It was not possible to use the
>> driver without DT.
>> This adds the chip type detection from the I2C name, which
>> allows to use the driver from the platform driver without DT.
>>
>> Signed-off-by: Petr Kulhavy <petr@barix.com>
>> Reviewed-by: Kevin Cernekee <cernekee@chromium.org>
>> Signed-off-by: Mark Brown <broonie@kernel.org>
> Don't resubmit already applied patches, as covered in SubmittingPatches
> you should submit against the latest development tree.  Please resend
> with just the new stuff, if any changes are needed in already applied
> patches send incremental fixes.
Thanks for the remainder, I'm sorry, didn't know that.
I will resubmit them right now.

Petr
diff mbox

Patch

diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c
index d255d65..2107322 100644
--- a/sound/soc/codecs/tas571x.c
+++ b/sound/soc/codecs/tas571x.c
@@ -414,11 +414,10 @@  static int tas571x_i2c_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, priv);
 
 	of_id = of_match_device(tas571x_of_match, dev);
-	if (!of_id) {
-		dev_err(dev, "Unknown device type\n");
-		return -EINVAL;
-	}
-	priv->chip = of_id->data;
+	if (of_id)
+		priv->chip = of_id->data;
+	else
+		priv->chip = (void *) id->driver_data;
 
 	priv->mclk = devm_clk_get(dev, "mclk");
 	if (IS_ERR(priv->mclk) && PTR_ERR(priv->mclk) != -ENOENT) {
@@ -519,9 +518,9 @@  static const struct of_device_id tas571x_of_match[] = {
 MODULE_DEVICE_TABLE(of, tas571x_of_match);
 
 static const struct i2c_device_id tas571x_i2c_id[] = {
-	{ "tas5711", 0 },
-	{ "tas5717", 0 },
-	{ "tas5719", 0 },
+	{ "tas5711", (kernel_ulong_t) &tas5711_chip },
+	{ "tas5717", (kernel_ulong_t) &tas5717_chip },
+	{ "tas5719", (kernel_ulong_t) &tas5717_chip },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, tas571x_i2c_id);