All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Tim Nelson <tnelson-f4DZ+GDyDBaakBO8gow8eQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Winbond W83L604G
Date: Thu, 7 Jul 2011 18:23:15 +0200	[thread overview]
Message-ID: <20110707182315.6e28f62a@endymion.delvare> (raw)
In-Reply-To: <19430981.80.1310052758044.JavaMail.root-N94c1vXlnCs/q/FG96+aB0EOCMrvLtNR@public.gmane.org>

Hi Tim,

On Thu, 7 Jul 2011 10:32:38 -0500 (CDT), Tim Nelson wrote:
> ----- Original Message -----
> > As pointed out by Michael already, 08h in the datasheet translates to
> > 0x08 in the Linux world.
> 
> I'm curious how this conversion translates. Is it as simple as dropping the suffix 'h', no actual math involved? Most other registers are noted with an 'h' suffix as well for this chip.

No math involved. The "h" suffix means hexadecimal. The "0x" prefix
means the same. Which one to use depends on the environment and
culture. Have fun reading:
http://en.wikipedia.org/wiki/Hexadecimal#Representing_hexadecimal

> > The correct slave address is certainly 0x19, as the datasheet says
> > that
> > the first 4 address bits are hard-set to 0011b, which means a 7-bit
> > slave address in the 0x18-0x1f range. The device at 0x4c could be a
> > thermal sensor (sensors-detect should tell.)
> 
> Yes, correct. We have an ITE super-IO sensor onboard for monitoring which is at 0x4c.

That would be relatively surprising, as ITE super-I/O chips are LPC
devices accessed with direct I/O. I think there used to be one old
model which could alternatively be accessed over the SMBus (the
monitoring block at least) but it would be at address 0x2d rather than
0x4c, and I doubt current chips still support that.

Just try sensors-detect and see what it finds.

> > Yes, with i2cget and i2cset you could do that. But I suspect that in
> > the end you will want to write a proper kernel GPIO driver, so that
> > you
> > can benefit from all the nice things gpiolib does for you (including,
> > but not limited to, clear and safe access from other kernel drivers.)
> > There are several examples of such drivers under drivers/gpio (pcf857x
> > and pca953x in particular.)
> 
> This specific implementation purely needs to exist in userland as the only use for the controller is LED status (on, off, blink).

Well, there is a framework in the kernel for this too.

> I'm now able to read from the proper register for the GP10-GP13 pins, but I'm not able to write. Example:
> 
> root@aaa:~# i2cget -y 0 0x19 0x08
> 0x00
> 
> According to the datasbeet, to set all LEDs from off to on, I'd need to set the 0x08 register to binary '10101010' which is 0xaa in hex. So:
> 
> root@aaa:~# i2cset -y 0 0x19 0x08 0xaa
> Error: Write failed
> 
> Is my binary->hex math incorrect (verified against a few online calcs...)? Am I blatantly missing something else?

Your binary->hex is correct, and the command as well, but the chip did
not like the write for some reason. You should look at the kernel logs
when it failed, there may be a hint. You could also just retry to check
if this was maybe a transient error.

To test the reliability of the SMBus you could dump the whole register
map:
# i2cdump -y -r 0x00-0x22 0 0x19
and look for XX's.

-- 
Jean Delvare

  parent reply	other threads:[~2011-07-07 16:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05 14:46 Winbond W83L604G Tim Nelson
     [not found] ` <30480104.171.1309877177809.JavaMail.root-N94c1vXlnCs/q/FG96+aB0EOCMrvLtNR@public.gmane.org>
2011-07-05 14:59   ` Zhang, Shijie
     [not found]     ` <6D7A567890E70E4BA49B8A9B365980FA12D99C14BE-QQHDSDV1ERZpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-07-05 17:06       ` Tim Nelson
     [not found]         ` <8829587.204.1309885573653.JavaMail.root-N94c1vXlnCs/q/FG96+aB0EOCMrvLtNR@public.gmane.org>
2011-07-06  7:03           ` Jean Delvare
     [not found]             ` <20110706090347.44bd4bbe-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2011-07-06 14:40               ` Tim Nelson
     [not found]                 ` <20432649.84.1309963215499.JavaMail.root-N94c1vXlnCs/q/FG96+aB0EOCMrvLtNR@public.gmane.org>
2011-07-06 15:05                   ` Jean Delvare
     [not found]                     ` <20110706170531.2f3bed19-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2011-07-06 15:10                       ` Tim Nelson
     [not found]                         ` <29201825.112.1309965025512.JavaMail.root-N94c1vXlnCs/q/FG96+aB0EOCMrvLtNR@public.gmane.org>
2011-07-06 20:30                           ` Tim Nelson
     [not found]                             ` <13595453.330.1309984221608.JavaMail.root-N94c1vXlnCs/q/FG96+aB0EOCMrvLtNR@public.gmane.org>
2011-07-07  6:43                               ` Michael Lawnick
2011-07-07  8:19                               ` Jean Delvare
     [not found]                                 ` <20110707101931.18379a23-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2011-07-07 15:32                                   ` Tim Nelson
     [not found]                                     ` <19430981.80.1310052758044.JavaMail.root-N94c1vXlnCs/q/FG96+aB0EOCMrvLtNR@public.gmane.org>
2011-07-07 16:23                                       ` Jean Delvare [this message]
     [not found]                                         ` <20110707182315.6e28f62a-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2011-07-08 21:48                                           ` Tim Nelson
     [not found]                                             ` <21511805.221.1310161730242.JavaMail.root-N94c1vXlnCs/q/FG96+aB0EOCMrvLtNR@public.gmane.org>
2011-07-09  7:23                                               ` Jean Delvare
     [not found]                                                 ` <20110709092334.566e6dcd-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2011-07-11 17:31                                                   ` Tim Nelson
     [not found]                                                     ` <2607557.175.1310405514456.JavaMail.root-N94c1vXlnCs/q/FG96+aB0EOCMrvLtNR@public.gmane.org>
2011-07-11 18:29                                                       ` Jean Delvare

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=20110707182315.6e28f62a@endymion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tnelson-f4DZ+GDyDBaakBO8gow8eQ@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.