kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* two kernel modules for the same device address in dts
@ 2020-04-07 13:26 Tomek The Messenger
  2020-04-10  9:46 ` Ezra Buehler
  0 siblings, 1 reply; 2+ messages in thread
From: Tomek The Messenger @ 2020-04-07 13:26 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 1113 bytes --]

Hi
I am trying to design some functionality and I wonder if something like
that is supported in dts and linux:

&i2c1 {
default_device: default_device@75 {
    compatible = "some-name-never-mind";
     reg = <0x75>;
};
my_device: my_device@0 {
compatible = "my-device-which-do-only-some-minor-part";
reg = <0x75>;
};
};

You know what I mean, is it possible to declare in dts two kernel modules
for the same device with the same address? I don't want to extend
default_device functionality, I want put my functionality in separate
kernel module. I am currently in the middle of implementation but I wonder
if it has sense. Both kernel modules will have in fact:
probe(struct i2c_client *client, ...), I wonder if probe won't fail. At
least in user space shell "i2cdetect -r 1" returns UU for address 0x75 when
kernel module is loaded. So that is why I suspect probe might fail.

Another story is what in case somebody asks for access to device at the
same time from two kernel modules. I hope function:
i2c_smbus_write_byte_data
has some kind of spinlock, mutexes and just wait till bus is free, but who
knows.:)

[-- Attachment #1.2: Type: text/html, Size: 1359 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: two kernel modules for the same device address in dts
  2020-04-07 13:26 two kernel modules for the same device address in dts Tomek The Messenger
@ 2020-04-10  9:46 ` Ezra Buehler
  0 siblings, 0 replies; 2+ messages in thread
From: Ezra Buehler @ 2020-04-10  9:46 UTC (permalink / raw)
  To: Tomek The Messenger; +Cc: kernelnewbies

Hi Tomek,

On 7 Apr 2020, at 15:26, Tomek The Messenger <tomekthemessenger@gmail.com> wrote:
> &i2c1 {
> default_device: default_device@75 {
>     compatible = "some-name-never-mind";
>      reg = <0x75>;
> };
> my_device: my_device@0 {
> compatible = "my-device-which-do-only-some-minor-part";
> reg = <0x75>;
> };
> };

I am not an expert here, I do not know what the best practice is.
But, I would do following:

/ {
(...)

    my_device: my_device@0 {
        default-device = <&default_device>;
    }

(...)
};

&i2c1 {
    default_device: default_device@75 {
        compatible = "some-name-never-mind";
        reg = <0x75>;
    };
};

Cheers,
Ezra.
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-10  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 13:26 two kernel modules for the same device address in dts Tomek The Messenger
2020-04-10  9:46 ` Ezra Buehler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).