All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] Output problem with adcxx  on at91
Date: Wed, 01 Aug 2012 16:52:04 +0000	[thread overview]
Message-ID: <20120801165204.GA16380@roeck-us.net> (raw)
In-Reply-To: <5019526C.2030802@comconcepts.com>

On Wed, Aug 01, 2012 at 11:59:40AM -0400, John Rippetoe wrote:
> I am attempting to setup lm-sensors on an embedded platform, more
> specifically the Micromint Electrum 100.  I'm experiencing an issue
> with the output of the sensors program where the output is obviously
> bogus, especially given that all the values are identical.  Some
> basic details about the system:
> 
> - 6.04 Debian squeeze
> - Atmel AT91SAM9G20 cpu (armv5)
> - ADC128S052 SPI ADC
> - atmel_spi driver built in to pre-compiled kernel
> - hwmon, and adcxx loaded as modules later
> 
> The adcxx kernel module successfully loads and binds to the device.
> Reading the sysfs files it creates for each input, the same value of
> 52799 is seen on each.  I know the device works because I have
> tested it with some userland example code provided by the
> manufacturer and get expected values for various inputs.
> 
> I initially had an issue with getting the adcxx module to bind with
> the device, but found that the problem was because of an alias
> problem.  In ./arch/arm/mach-at91/board-electrum-100.c the ADC was
> declared with an alias as shown in the code segment below:
> 
> /static struct spi_board_info ek_spi_devices[] = {
> /  .....
> /    {    /* ADC128S052 analog inputs */
> /        .modalias    = "adc128s052",
> /        .chip_select    = 2,
> /        .max_speed_hz    = 8 * 1000 * 1000,
> /        .bus_num    = 1,
> /    },
> /  .....
> 
./arch/arm/mach-at91/board-electrum-100.c is not in mainline, so this is a bit
difficult. Given the above, it may even be that there is a separate driver for
the chip somewhere in your tree (ok, I think I found the patch, there isn't,
but that means this never worked).

Other than that, there could be many things wrong. Chip select, bus number,
clock speed, chip access mode. There is no example for a working instantiation
in the upstream kernel, so I have no idea what the valid parameters might be.
You mentioned user mode access worked - maybe you can compare it with the kernel
settings.

Guenter

> Rather than change the alias in board-electrum-100.c and have to
> recompile and install a new kernel, I opted to add the alias as
> shown above to adcxx_ids[] in adcxx.c
> 
> /static const struct spi_device_id adcxx_ids[] = {
> /    { "adcxx1s", 1 },
> /    { "adcxx2s", 2 },
> /    { "adcxx4s", 4 },
> /    { "adcxx8s", 8 },
> /    { "adc128s052", 8},   <-- added here
> /    { },
> /};
> 
> With that done, sensors starting giving me output, just not anything
> worth reading.  At this point I'm a little baffled as to what is
> causing this and crawling the internet has turned up nothing. Here
> is my output for sensors:
> 
> electrum100:~# sensors
> adcxx8s-spi-1-2
> Adapter: SPI adapter
> in0:         +52.80 V
> in1:         +52.80 V
> in2:         +52.80 V
> in3:         +52.80 V
> in4:         +52.80 V
> in5:         +52.80 V
> in6:         +52.80 V
> in7:         +52.80 V
> 
> 
> Any help would be greatly appreciated.  Thank you.
> 
>     - John
> 
> _______________________________________________
> lm-sensors mailing list
> lm-sensors@lm-sensors.org
> http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
> 

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  reply	other threads:[~2012-08-01 16:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 15:59 [lm-sensors] Output problem with adcxx on at91 John Rippetoe
2012-08-01 16:52 ` Guenter Roeck [this message]
2012-08-01 20:12 ` John Rippetoe
2012-08-01 21:56 ` Guenter Roeck
2012-08-02  3:07 ` John
2012-08-10  6:46 ` Marc Pignat
2012-08-10 12:31 ` John Rippetoe
2012-08-10 13:12 ` John Rippetoe
2012-08-10 16:34 ` Guenter Roeck
2012-08-13  6:09 ` Marc Pignat

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=20120801165204.GA16380@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=lm-sensors@vger.kernel.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.