* SSM2518 Device Tree support ?
@ 2015-08-13 12:12 Ricard Wanderlof
2015-08-13 12:21 ` Lars-Peter Clausen
0 siblings, 1 reply; 5+ messages in thread
From: Ricard Wanderlof @ 2015-08-13 12:12 UTC (permalink / raw)
To: alsa-devel@alsa-project.org
We needed DT support in the SSM2518 codec driver, and I noticed that there
is already a set of bindings specified in Documentation/devicetree,
however, there doesn't seem to be any DT support in the driver itself. I
don't know if this is the result of a missing commit ?
Documentation/devicetree/bindings/sound/ssm2518.c seems to have been added
in May 2013.
I've added rudimentary support for at least the compatible property so
that the driver can be used in a system with DT configuration (sent as a
separate email).
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SSM2518 Device Tree support ?
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
0 siblings, 1 reply; 5+ messages in thread
From: Lars-Peter Clausen @ 2015-08-13 12:21 UTC (permalink / raw)
To: Ricard Wanderlof, alsa-devel@alsa-project.org
On 08/13/2015 02:12 PM, Ricard Wanderlof wrote:
>
> We needed DT support in the SSM2518 codec driver, and I noticed that there
> is already a set of bindings specified in Documentation/devicetree,
> however, there doesn't seem to be any DT support in the driver itself. I
> don't know if this is the result of a missing commit ?
There is DT support in the driver. E.g. see the of_get_gpio() call.
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. But,
yes, it is better to add a explicit OF table to indicate that this works.
>
> Documentation/devicetree/bindings/sound/ssm2518.c seems to have been added
> in May 2013.
>
> I've added rudimentary support for at least the compatible property so
> that the driver can be used in a system with DT configuration (sent as a
> separate email).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SSM2518 Device Tree support ?
2015-08-13 12:21 ` Lars-Peter Clausen
@ 2015-09-01 7:06 ` Ricard Wanderlof
2015-09-01 7:51 ` Lars-Peter Clausen
0 siblings, 1 reply; 5+ messages in thread
From: Ricard Wanderlof @ 2015-09-01 7:06 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: alsa-devel@alsa-project.org
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.
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: SSM2518 Device Tree support ?
2015-09-01 7:06 ` Ricard Wanderlof
@ 2015-09-01 7:51 ` Lars-Peter Clausen
2015-09-01 12:39 ` Ricard Wanderlof
0 siblings, 1 reply; 5+ messages in thread
From: Lars-Peter Clausen @ 2015-09-01 7:51 UTC (permalink / raw)
To: Ricard Wanderlof; +Cc: alsa-devel@alsa-project.org
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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: SSM2518 Device Tree support ?
2015-09-01 7:51 ` Lars-Peter Clausen
@ 2015-09-01 12:39 ` Ricard Wanderlof
0 siblings, 0 replies; 5+ messages in thread
From: Ricard Wanderlof @ 2015-09-01 12:39 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: alsa-devel@alsa-project.org
On Tue, 1 Sep 2015, Lars-Peter Clausen wrote:
> > 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().
Thanks Lars-Peter, that put be on the right track! (In my case it turns
out the I2C driver was not properly enabled, so it's probe function never
got called and consequently not the corresponding devices on the
corresponding I2C bus).
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-01 12:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-09-01 12:39 ` Ricard Wanderlof
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox