[alsa-devel] [PATCH 06/10] mfd: Add core driver for AD242x A2B transceivers

Luca Ceresoli luca at lucaceresoli.net
Wed Dec 18 12:20:58 CET 2019


Hi Daniel,

On 17/12/19 20:24, Daniel Mack wrote:
>>> +++ b/drivers/mfd/ad242x-bus.c
>>> @@ -0,0 +1,42 @@
>>> +// SPDX-License-Identifier: GPL-2.0-only
>>> +
>>> +#include <linux/i2c.h>
>>> +#include <linux/init.h>
>>> +#include <linux/mfd/ad242x.h>
>>> +#include <linux/module.h>
>>> +#include <linux/of.h>
>>> +
>>> +static int ad242x_bus_i2c_probe(struct i2c_client *i2c,
>>> +                const struct i2c_device_id *id)
>>> +{
>>> +    dev_set_drvdata(&i2c->dev, i2c);
>>> +    i2c_set_clientdata(i2c, &i2c->dev);
>>
>> Please explain to me what you think is happening here.
>>
>>> +    return 0;
>>> +}
>>
>> What does this driver do?  Seems kinda pointless?
> 
> As explained in the commit log, these devices expose two addresses on
> the i2c bus, and each of which exists for a distinct purpose. The
> primary one is used to access registers on the master node itself, the
> second one is proxying traffic to remote nodes.
> 
> Now, the question is how to support that, and the approach chosen here
> is to have a dummy driver sitting on the 2nd address, and to reach out
> to it via a DT phandle from the master node. I don't like that much
> either, but I'm not aware of a cleaner way to bind two addresses with
> one driver. If there is any, I'd be happy to change that.

Have a look at i2c_new_dummy_device(), perhaps it is what you need here.

-- 
Luca



More information about the Alsa-devel mailing list