linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
To: "Jakub Kiciński" <moorray3-5tc4TXWwyLM@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: I2C device tree driver compatible strings
Date: Sun, 12 Apr 2015 09:55:05 +0200	[thread overview]
Message-ID: <CAMuHMdXM4H3FDDd8Z07ugAAPMQLfDhPC+V2FKs1bKbOtSw1AOg@mail.gmail.com> (raw)
In-Reply-To: <20150411213614.63632aff@north>

CC linux-i2c

On Sat, Apr 11, 2015 at 9:36 PM, Jakub Kiciński <moorray3-5tc4TXWwyLM@public.gmane.org> wrote:
> Hello,
>
> sc16is7xx declares two device id tables, one with OF ids:
>
> static const struct of_device_id __maybe_unused sc16is7xx_dt_ids[] = {
>         { .compatible = "nxp,sc16is740",        .data = &sc16is74x_devtype, },
>         { .compatible = "nxp,sc16is741",        .data = &sc16is74x_devtype, },
>         { .compatible = "nxp,sc16is750",        .data = &sc16is750_devtype, },
>         { .compatible = "nxp,sc16is752",        .data = &sc16is752_devtype, },
>         { .compatible = "nxp,sc16is760",        .data = &sc16is760_devtype, },
>         { .compatible = "nxp,sc16is762",        .data = &sc16is762_devtype, },
>         { }
> };
> MODULE_DEVICE_TABLE(of, sc16is7xx_dt_ids);
>
> and one with i2c ids:
>
> static const struct i2c_device_id sc16is7xx_i2c_id_table[] = {
>         { "sc16is74x",  (kernel_ulong_t)&sc16is74x_devtype, },
>         { "sc16is750",  (kernel_ulong_t)&sc16is750_devtype, },
>         { "sc16is752",  (kernel_ulong_t)&sc16is752_devtype, },
>         { "sc16is760",  (kernel_ulong_t)&sc16is760_devtype, },
>         { "sc16is762",  (kernel_ulong_t)&sc16is762_devtype, },
>         { }
> };
> MODULE_DEVICE_TABLE(i2c, sc16is7xx_i2c_id_table);
>
> I declare my device in DT under I2C controller as
>>       compatible = "nxp,sc16is740";
> However, the driver does not get loaded automatically because its
> i2c id table contains "sc16is74x" instead of "sc16is740".
>
> I have three questions:
>
> (1) What is the relation between i2c_device_id and of_device_id strings
>     and why does the driver define both?
>
> (2) What are the rules for loading i2c drivers based on DT and why is the
>     driver not loaded even though its compatible with one of the OF ids?
>
> (3) Is it OK for the driver to define incompatible strings or should I
>     correct them like this (keeping the old entry for backwards
>     compatibility):
>
> diff --git a/drivers/tty/serial/sc16is7xx.c
> b/drivers/tty/serial/sc16is7xx.c index eaf0008a39cb..efe286d00174 100644
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
> @@ -1219,6 +1219,8 @@ static int sc16is7xx_i2c_remove(struct i2c_client
> *client)
>  static const struct i2c_device_id sc16is7xx_i2c_id_table[] = {
>         { "sc16is74x",  (kernel_ulong_t)&sc16is74x_devtype, },
> +       { "sc16is740",  (kernel_ulong_t)&sc16is74x_devtype, },
> +       { "sc16is741",  (kernel_ulong_t)&sc16is74x_devtype, },
>         { "sc16is750",  (kernel_ulong_t)&sc16is750_devtype, },
>         { "sc16is752",  (kernel_ulong_t)&sc16is752_devtype, },
>         { "sc16is760",  (kernel_ulong_t)&sc16is760_devtype, },
>
>
> Thanks,
> Kuba
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

           reply	other threads:[~2015-04-12  7:55 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20150411213614.63632aff@north>]

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=CAMuHMdXM4H3FDDd8Z07ugAAPMQLfDhPC+V2FKs1bKbOtSw1AOg@mail.gmail.com \
    --to=geert-td1emuhucqxl1znqvxdv9g@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=moorray3-5tc4TXWwyLM@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).