public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Ricard Wanderlof <ricard.wanderlof@axis.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: SSM2518 Device Tree support ?
Date: Tue, 01 Sep 2015 09:51:50 +0200	[thread overview]
Message-ID: <55E55916.50004@metafoo.de> (raw)
In-Reply-To: <alpine.DEB.2.02.1508311753050.4816@lnxricardw1.se.axis.com>

On 09/01/2015 09:06 AM, Ricard Wanderlof wrote:
> 
> Bringing up an old thread becuase i have a similar issue with the 
> adau1761-i2c.c driver which should be configurable in the same way - it 
> links into the I2C driver framework too. I know my ssm2518.c patch was 
> recently applied, but using this driver (prior to the patch) as an 
> example as Lars-Peter mentioned that it should be able to work this way.
> 
> On Thu, 13 Aug 2015, Lars-Peter Clausen wrote:
> 
>> [ ... device tree support in ssm2518.c ... ]
>> What's not in the driver is a explicit of match table. It will work without
>> since the I2C subsystem supports matching based on the I2C ID table.
> 
> How does this actually work? I've tried to figure it out but haven't 
> gotten anywhere.
> 
> From:
> 
> http://wiki.analog.com/resources/tools-software/linux-drivers/sound/ssm2518 :
> 
> 
> i2s: i2c@41600000 {
> 	compatible = "...;
> 	...
> 
> 	#size-cells = <0>;
> 	#address-cells = <1>;
>             
> 	ssm2518: ssm2518@34 {
> 		compatible = "adi,ssm2518";
> 		reg = <0x34>;
> 		gpios = <&gpio 5 0>;
> 	};
> };
> 
> 
> In codecs/ssm2518.c:
> 
> 
> static const struct i2c_device_id ssm2518_i2c_ids[] = {
>         { "ssm2518", 0 },
>         { }
> };
> MODULE_DEVICE_TABLE(i2c, ssm2518_i2c_ids);
> 
> static struct i2c_driver ssm2518_driver = {
>         .driver = {
>                 .name = "ssm2518",
>                 .owner = THIS_MODULE,
>         },
>         .probe = ssm2518_i2c_probe,
>         .remove = ssm2518_i2c_remove,
>         .id_table = ssm2518_i2c_ids,
> };
> module_i2c_driver(ssm2518_driver);
> 
> 
> So how does the i2c framework ultimately get the ssm2518 probe function to 
> be called? The only real ID here are the strings "ssm2518" but they don't 
> show up in the DT entry, except as part of the ssm2518 compatible string.

It splits the compatible string at the comma and then looks for a driver
that matches the later part. Have a look at of_modalias_node().

- Lars

  reply	other threads:[~2015-09-01  7:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 12:12 SSM2518 Device Tree support ? Ricard Wanderlof
2015-08-13 12:21 ` Lars-Peter Clausen
2015-09-01  7:06   ` Ricard Wanderlof
2015-09-01  7:51     ` Lars-Peter Clausen [this message]
2015-09-01 12:39       ` Ricard Wanderlof

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=55E55916.50004@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=ricard.wanderlof@axis.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