mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: tanure@linux.com, linux-amlogic@lists.infradead.org
Subject: Re: VIM3 - A311D - I2C AO Clock Questions
Date: Mon, 7 Mar 2022 09:29:15 +0100	[thread overview]
Message-ID: <35db71b9-6574-b517-9687-33a826647821@baylibre.com> (raw)
In-Reply-To: <CAJX_Q+0Gvf88EW6s6-pLoA_mwhwKCf==qyxmNnFt=S24TPN0xw@mail.gmail.com>

Hi,

On 06/03/2022 11:23, Lucas Tanure wrote:
> Hi,
> 
> I am trying to integrate an I2C device into VIM3 using the I2C_AO bus.
> My device uses a 100000Hz clock, but after changing
> meson-g12b-a311d-khadas-vim3.dts to add my I2C node the driver could
> not properly read its registers.
> 
> It reads 0x9100, but the correct data should be 0xcb58.
> The first thing I saw on the bus was that the frequency I requested by
> the device tree was being set after the probe of my driver already
> failed.
> For that, I sent "i2c: meson: Fix wrong speed use from probe" which
> fixes that issue.
> 
> But I still get the wrong data, so my next guess is that the clock
> duty cycle is 30%, and I think should be 50%.
> Here is an image of the signals of the bus:
> https://pasteboard.co/TEoxQucsXUUD.png
> 
> I have tested other frequencies and all of them uses a 30% duty cycle,
> where SCL is up 30% and low for 70% of the period.

Indeed it seems by default the duty cycle is for Fast Mode, but standard mode should
be around 50%. Did you try 400khz ?

Amlogic did some changes on their off-tree linux fork, please look around:
https://github.com/khadas/linux/blob/khadas-vims-5.4.y-fc/drivers/i2c/busses/i2c-meson.c#L143

I'm unsure when REG_SLAVE_ADDR BIT(28) appeared, but if you try to port this upstream,
we'll be happy to review it for inclusion.

Neil

> 
> Is possible to configure the clock to be 100000Hz, but with a 50% duty
> cycle for this I2C bus on A3111D?
> 
> Thanks
> Lucas Tanure
> 
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2022-03-07  8:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJX_Q+2zibb_ABAjT=k=hbW_Xa9knOy5hcN5Ma2B6Z+h-3=FsQ@mail.gmail.com>
2022-03-06 10:23 ` Lucas Tanure
2022-03-07  8:29   ` Neil Armstrong [this message]
2022-03-08  6:49     ` Lucas Tanure
2022-03-09  9:39       ` Lucas Tanure
2022-03-21 10:08         ` Lucas Tanure
2022-03-25 12:22           ` Jian Hu

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=35db71b9-6574-b517-9687-33a826647821@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=tanure@linux.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

all inboxes | Powered by JetHome®