All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] help with ads1015
@ 2012-03-01 11:35 Pierantonio Tabaro
  2012-03-01 11:48 ` Jean Delvare
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Pierantonio Tabaro @ 2012-03-01 11:35 UTC (permalink / raw)
  To: lm-sensors

Hi,
i have a arm mx28 board with a couple of ads1015,
i have ported the driver from:  
"[PATCH v4] hwmon: Add support for Texas Instruments ADS1015"
to my kernel 2.6.35.3

when i boot the board and probe the two modules hwmon.ko and ads1015.ko nothing 
happens.

with i2cdump i see the chips,i am sure of this because the default values for 
some registers are 0x8583, 0x8000 and 0x7fff. 

sample output for one chip:

root@picomaster ~$ i2cdump 0 0x48 w
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0, address 0x48, mode word
Continue? [Y/n] 
     0,8  1,9  2,a  3,b  4,c  5,d  6,e  7,f
00: 0000 8385 0080 ff7f 0000 8385 0080 XXXX 
08: 0000 8385 0080 ff7f 0000 8385 0080 XXXX 

On sysfs i see this:

root@picomaster ~$ find /sys/ | grep ads1015
/sys/bus/i2c/drivers/ads1015
/sys/bus/i2c/drivers/ads1015/module
/sys/bus/i2c/drivers/ads1015/uevent
/sys/bus/i2c/drivers/ads1015/unbind
/sys/bus/i2c/drivers/ads1015/bind
/sys/module/hwmon/holders/ads1015
/sys/module/ads1015
/sys/module/ads1015/holders
/sys/module/ads1015/initstate
/sys/module/ads1015/refcnt
/sys/module/ads1015/sections
/sys/module/ads1015/sections/.text
/sys/module/ads1015/sections/.exit.text
/sys/module/ads1015/sections/.init.text
/sys/module/ads1015/sections/.rodata
/sys/module/ads1015/sections/.rodata.str1.1
/sys/module/ads1015/sections/.data
/sys/module/ads1015/sections/.gnu.linkonce.this_module
/sys/module/ads1015/sections/.note.gnu.build-id
/sys/module/ads1015/sections/.symtab
/sys/module/ads1015/sections/.strtab
/sys/module/ads1015/notes
/sys/module/ads1015/notes/.note.gnu.build-id
/sys/module/ads1015/drivers
/sys/module/ads1015/drivers/i2c:ads1015

root@picomaster ~$ find /sys/module/hwmon/
/sys/module/hwmon/
/sys/module/hwmon/holders
/sys/module/hwmon/holders/ads1015
/sys/module/hwmon/initstate
/sys/module/hwmon/refcnt
/sys/module/hwmon/sections
/sys/module/hwmon/sections/.text
/sys/module/hwmon/sections/.exit.text
/sys/module/hwmon/sections/.init.text
/sys/module/hwmon/sections/__ksymtab_strings
/sys/module/hwmon/sections/__kcrctab_gpl
/sys/module/hwmon/sections/.rodata.str1.1
/sys/module/hwmon/sections/__ksymtab_gpl
/sys/module/hwmon/sections/.gnu.linkonce.this_module
/sys/module/hwmon/sections/.note.gnu.build-id
/sys/module/hwmon/sections/.bss
/sys/module/hwmon/sections/.symtab
/sys/module/hwmon/sections/.strtab
/sys/module/hwmon/notes
/sys/module/hwmon/notes/.note.gnu.build-id

I expect to have the inputs value to sysfs, according to source something like 
that: /sys/.../ads1015/in_0_input

Maybe i am missing something, please help me.

Thanks, Pierantonio.



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

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

* Re: [lm-sensors] help with ads1015
  2012-03-01 11:35 [lm-sensors] help with ads1015 Pierantonio Tabaro
@ 2012-03-01 11:48 ` Jean Delvare
  2012-03-01 11:53 ` Guenter Roeck
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jean Delvare @ 2012-03-01 11:48 UTC (permalink / raw)
  To: lm-sensors

On Thu, 1 Mar 2012 11:35:29 +0000 (UTC), Pierantonio Tabaro wrote:
> Hi,
> i have a arm mx28 board with a couple of ads1015,
> i have ported the driver from:  
> "[PATCH v4] hwmon: Add support for Texas Instruments ADS1015"
> to my kernel 2.6.35.3
> 
> when i boot the board and probe the two modules hwmon.ko and ads1015.ko nothing 
> happens.
> 
> with i2cdump i see the chips,i am sure of this because the default values for 
> some registers are 0x8583, 0x8000 and 0x7fff. 
> 
> sample output for one chip:
> 
> root@picomaster ~$ i2cdump 0 0x48 w
> WARNING! This program can confuse your I2C bus, cause data loss and worse!
> I will probe file /dev/i2c-0, address 0x48, mode word
> Continue? [Y/n] 
>      0,8  1,9  2,a  3,b  4,c  5,d  6,e  7,f
> 00: 0000 8385 0080 ff7f 0000 8385 0080 XXXX 
> 08: 0000 8385 0080 ff7f 0000 8385 0080 XXXX 
> 
> On sysfs i see this:
> 
> root@picomaster ~$ find /sys/ | grep ads1015
> /sys/bus/i2c/drivers/ads1015
> /sys/bus/i2c/drivers/ads1015/module
> /sys/bus/i2c/drivers/ads1015/uevent
> /sys/bus/i2c/drivers/ads1015/unbind
> /sys/bus/i2c/drivers/ads1015/bind
> /sys/module/hwmon/holders/ads1015
> /sys/module/ads1015
> /sys/module/ads1015/holders
> /sys/module/ads1015/initstate
> /sys/module/ads1015/refcnt
> /sys/module/ads1015/sections
> /sys/module/ads1015/sections/.text
> /sys/module/ads1015/sections/.exit.text
> /sys/module/ads1015/sections/.init.text
> /sys/module/ads1015/sections/.rodata
> /sys/module/ads1015/sections/.rodata.str1.1
> /sys/module/ads1015/sections/.data
> /sys/module/ads1015/sections/.gnu.linkonce.this_module
> /sys/module/ads1015/sections/.note.gnu.build-id
> /sys/module/ads1015/sections/.symtab
> /sys/module/ads1015/sections/.strtab
> /sys/module/ads1015/notes
> /sys/module/ads1015/notes/.note.gnu.build-id
> /sys/module/ads1015/drivers
> /sys/module/ads1015/drivers/i2c:ads1015
> 
> root@picomaster ~$ find /sys/module/hwmon/
> /sys/module/hwmon/
> /sys/module/hwmon/holders
> /sys/module/hwmon/holders/ads1015
> /sys/module/hwmon/initstate
> /sys/module/hwmon/refcnt
> /sys/module/hwmon/sections
> /sys/module/hwmon/sections/.text
> /sys/module/hwmon/sections/.exit.text
> /sys/module/hwmon/sections/.init.text
> /sys/module/hwmon/sections/__ksymtab_strings
> /sys/module/hwmon/sections/__kcrctab_gpl
> /sys/module/hwmon/sections/.rodata.str1.1
> /sys/module/hwmon/sections/__ksymtab_gpl
> /sys/module/hwmon/sections/.gnu.linkonce.this_module
> /sys/module/hwmon/sections/.note.gnu.build-id
> /sys/module/hwmon/sections/.bss
> /sys/module/hwmon/sections/.symtab
> /sys/module/hwmon/sections/.strtab
> /sys/module/hwmon/notes
> /sys/module/hwmon/notes/.note.gnu.build-id
> 
> I expect to have the inputs value to sysfs, according to source something like 
> that: /sys/.../ads1015/in_0_input

Yes, you are missing something. Please read:
Documentation/i2c/instantiating-devices
Method 3 is not implemented by the ads1015 driver because the devices
it supports have no identification registers, so you'll have to use one
of the three other methods.

-- 
Jean Delvare

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

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

* Re: [lm-sensors] help with ads1015
  2012-03-01 11:35 [lm-sensors] help with ads1015 Pierantonio Tabaro
  2012-03-01 11:48 ` Jean Delvare
@ 2012-03-01 11:53 ` Guenter Roeck
  2012-03-01 12:01 ` Pierantonio Tabaro
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2012-03-01 11:53 UTC (permalink / raw)
  To: lm-sensors

On Thu, Mar 01, 2012 at 06:35:29AM -0500, Pierantonio Tabaro wrote:
> Hi,
> i have a arm mx28 board with a couple of ads1015,
> i have ported the driver from:  
> "[PATCH v4] hwmon: Add support for Texas Instruments ADS1015"
> to my kernel 2.6.35.3
> 
> when i boot the board and probe the two modules hwmon.ko and ads1015.ko nothing 
> happens.
> 
> with i2cdump i see the chips,i am sure of this because the default values for 
> some registers are 0x8583, 0x8000 and 0x7fff. 
> 
> sample output for one chip:
> 
> root@picomaster ~$ i2cdump 0 0x48 w
> WARNING! This program can confuse your I2C bus, cause data loss and worse!
> I will probe file /dev/i2c-0, address 0x48, mode word
> Continue? [Y/n] 
>      0,8  1,9  2,a  3,b  4,c  5,d  6,e  7,f
> 00: 0000 8385 0080 ff7f 0000 8385 0080 XXXX 
> 08: 0000 8385 0080 ff7f 0000 8385 0080 XXXX 
> 
ads1015 does not have a detect function, so you have to enter:

echo ads1015 0x48 > /sys/class/i2c-adapter/i2c-0/new_device

modprobe etc. is not necessary.

Guenter

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

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

* Re: [lm-sensors] help with ads1015
  2012-03-01 11:35 [lm-sensors] help with ads1015 Pierantonio Tabaro
  2012-03-01 11:48 ` Jean Delvare
  2012-03-01 11:53 ` Guenter Roeck
@ 2012-03-01 12:01 ` Pierantonio Tabaro
  2012-03-01 13:38 ` Jean Delvare
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Pierantonio Tabaro @ 2012-03-01 12:01 UTC (permalink / raw)
  To: lm-sensors

Jean Delvare <khali <at> linux-fr.org> writes:

> 
> Yes, you are missing something. Please read:
> Documentation/i2c/instantiating-devices
> Method 3 is not implemented by the ads1015 driver because the devices
> it supports have no identification registers, so you'll have to use one
> of the three other methods.
> 

I have read the doc before posting ;-), i hope to be using method 1:

static struct at24_platform_data picomaster_i2c_eeprom_info = {
	.byte_len	= SZ_256K / 8,
	.page_size	= 64,
	.flags		= AT24_FLAG_ADDR16,
//	.setup		= davinci_get_mac_addr,
//	.context	= (void *)0x7f00,
};

struct ads1015_platform_data picomaster_i2c_ads1015_info = {
	.exported_channels = (1 << 2) | (1 << 4)
};

static struct i2c_board_info __initdata mxs_i2c_device[] = {
	//{ I2C_BOARD_INFO("sgtl5000-i2c", 0xa), .flags = I2C_M_TEN }
	{
		I2C_BOARD_INFO("rtc-ds1307", 0x68),
		.type	= "ds1339",
	},
	{
		I2C_BOARD_INFO("eeprom-24c256", 0x50),
		.platform_data = &picomaster_i2c_eeprom_info,
	},
	{
		I2C_BOARD_INFO("adc-ads1015", 0x48),
		//.platform_data = &picomaster_i2c_ads1015_info,
	},
	{
		I2C_BOARD_INFO("adc-ads1015", 0x49),
		//.platform_data = &picomaster_i2c_ads1015_info,
	},
};

static void __init i2c_device_init(void)
{
	printk("%s\n", __func__);
	i2c_register_board_info(0, mxs_i2c_device, ARRAY_SIZE(mxs_i2c_device));
}




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

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

* Re: [lm-sensors] help with ads1015
  2012-03-01 11:35 [lm-sensors] help with ads1015 Pierantonio Tabaro
                   ` (2 preceding siblings ...)
  2012-03-01 12:01 ` Pierantonio Tabaro
@ 2012-03-01 13:38 ` Jean Delvare
  2012-03-01 14:34 ` Pierantonio Tabaro
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jean Delvare @ 2012-03-01 13:38 UTC (permalink / raw)
  To: lm-sensors

On Thu, 1 Mar 2012 12:01:26 +0000 (UTC), Pierantonio Tabaro wrote:
> Jean Delvare <khali <at> linux-fr.org> writes:
> 
> > 
> > Yes, you are missing something. Please read:
> > Documentation/i2c/instantiating-devices
> > Method 3 is not implemented by the ads1015 driver because the devices
> > it supports have no identification registers, so you'll have to use one
> > of the three other methods.
> > 
> 
> I have read the doc before posting ;-), i hope to be using method 1:
> 
> static struct at24_platform_data picomaster_i2c_eeprom_info = {
> 	.byte_len	= SZ_256K / 8,
> 	.page_size	= 64,
> 	.flags		= AT24_FLAG_ADDR16,
> //	.setup		= davinci_get_mac_addr,
> //	.context	= (void *)0x7f00,
> };
> 
> struct ads1015_platform_data picomaster_i2c_ads1015_info = {
> 	.exported_channels = (1 << 2) | (1 << 4)
> };
> 
> static struct i2c_board_info __initdata mxs_i2c_device[] = {
> 	//{ I2C_BOARD_INFO("sgtl5000-i2c", 0xa), .flags = I2C_M_TEN }
> 	{
> 		I2C_BOARD_INFO("rtc-ds1307", 0x68),
> 		.type	= "ds1339",
> 	},
> 	{
> 		I2C_BOARD_INFO("eeprom-24c256", 0x50),
> 		.platform_data = &picomaster_i2c_eeprom_info,
> 	},
> 	{
> 		I2C_BOARD_INFO("adc-ads1015", 0x48),
> 		//.platform_data = &picomaster_i2c_ads1015_info,
> 	},
> 	{
> 		I2C_BOARD_INFO("adc-ads1015", 0x49),
> 		//.platform_data = &picomaster_i2c_ads1015_info,
> 	},

The driver wants "ads1015" not "adc-ads1015".

-- 
Jean Delvare

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

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

* Re: [lm-sensors] help with ads1015
  2012-03-01 11:35 [lm-sensors] help with ads1015 Pierantonio Tabaro
                   ` (3 preceding siblings ...)
  2012-03-01 13:38 ` Jean Delvare
@ 2012-03-01 14:34 ` Pierantonio Tabaro
  2012-03-01 14:45 ` Guenter Roeck
  2012-03-02  7:50 ` Jean Delvare
  6 siblings, 0 replies; 8+ messages in thread
From: Pierantonio Tabaro @ 2012-03-01 14:34 UTC (permalink / raw)
  To: lm-sensors

Jean Delvare <khali <at> linux-fr.org> writes:

> 
> On Thu, 1 Mar 2012 12:01:26 +0000 (UTC), Pierantonio Tabaro wrote:
> > Jean Delvare <khali <at> linux-fr.org> writes:
> > 
> > > 
> > > Yes, you are missing something. Please read:
> > > Documentation/i2c/instantiating-devices
> > > Method 3 is not implemented by the ads1015 driver because the devices
> > > it supports have no identification registers, so you'll have to use one
> > > of the three other methods.
> > > 
> > 
> > I have read the doc before posting , i hope to be using method 1:
> > 
> > static struct at24_platform_data picomaster_i2c_eeprom_info = {
> > 	.byte_len	= SZ_256K / 8,
> > 	.page_size	= 64,
> > 	.flags		= AT24_FLAG_ADDR16,
> > //	.setup		= davinci_get_mac_addr,
> > //	.context	= (void *)0x7f00,
> > };
> > 
> > struct ads1015_platform_data picomaster_i2c_ads1015_info = {
> > 	.exported_channels = (1 << 2) | (1 << 4)
> > };
> > 
> > static struct i2c_board_info __initdata mxs_i2c_device[] = {
> > 	//{ I2C_BOARD_INFO("sgtl5000-i2c", 0xa), .flags = I2C_M_TEN }
> > 	{
> > 		I2C_BOARD_INFO("rtc-ds1307", 0x68),
> > 		.type	= "ds1339",
> > 	},
> > 	{
> > 		I2C_BOARD_INFO("eeprom-24c256", 0x50),
> > 		.platform_data = &picomaster_i2c_eeprom_info,
> > 	},
> > 	{
> > 		I2C_BOARD_INFO("adc-ads1015", 0x48),
> > 		//.platform_data = &picomaster_i2c_ads1015_info,
> > 	},
> > 	{
> > 		I2C_BOARD_INFO("adc-ads1015", 0x49),
> > 		//.platform_data = &picomaster_i2c_ads1015_info,
> > 	},
> 
> The driver wants "ads1015" not "adc-ads1015".
> 

Thank you, this is the solution!, now is working well:

root@picomaster ~$ cat /sys/devices/platform/mxs-i2c.0/i2c-0/0-004[89]/in?_input
-2
0
1
1
943
946
946
945
0
-4
-3
0
944
945
948
949

And also i have fixed the code for eeprom:

-		I2C_BOARD_INFO("eeprom-24c256", 0x50),
+		I2C_BOARD_INFO("24c256", 0x50),

root@picomaster ~$ echo "lm-sensors is great!" > /sys/devices/platform/mxs-
i2c.0/
i2c-0/0-0050/eeprom
root@picomaster ~$ cat  /sys/devices/platform/mxs-i2c.0/i2c-0/0-0050/eeprom     
lm-sensors is great!   

You helped my to fix 2 bug at once!

Another off-topic question:
I need to write a driver for and AD5337 i2c Dac, i searched something in 
internet but without success.
I would like to use one existing driver, there is on linux support for DAC's?
Some suggestion?




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

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

* Re: [lm-sensors] help with ads1015
  2012-03-01 11:35 [lm-sensors] help with ads1015 Pierantonio Tabaro
                   ` (4 preceding siblings ...)
  2012-03-01 14:34 ` Pierantonio Tabaro
@ 2012-03-01 14:45 ` Guenter Roeck
  2012-03-02  7:50 ` Jean Delvare
  6 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2012-03-01 14:45 UTC (permalink / raw)
  To: lm-sensors

On Thu, Mar 01, 2012 at 08:38:01AM -0500, Jean Delvare wrote:
> On Thu, 1 Mar 2012 12:01:26 +0000 (UTC), Pierantonio Tabaro wrote:
> > Jean Delvare <khali <at> linux-fr.org> writes:
> > 
> > > 
> > > Yes, you are missing something. Please read:
> > > Documentation/i2c/instantiating-devices
> > > Method 3 is not implemented by the ads1015 driver because the devices
> > > it supports have no identification registers, so you'll have to use one
> > > of the three other methods.
> > > 
> > 
> > I have read the doc before posting ;-), i hope to be using method 1:
> > 
> > static struct at24_platform_data picomaster_i2c_eeprom_info = {
> > 	.byte_len	= SZ_256K / 8,
> > 	.page_size	= 64,
> > 	.flags		= AT24_FLAG_ADDR16,
> > //	.setup		= davinci_get_mac_addr,
> > //	.context	= (void *)0x7f00,
> > };
> > 
> > struct ads1015_platform_data picomaster_i2c_ads1015_info = {
> > 	.exported_channels = (1 << 2) | (1 << 4)
> > };
> > 
> > static struct i2c_board_info __initdata mxs_i2c_device[] = {
> > 	//{ I2C_BOARD_INFO("sgtl5000-i2c", 0xa), .flags = I2C_M_TEN }
> > 	{
> > 		I2C_BOARD_INFO("rtc-ds1307", 0x68),
> > 		.type	= "ds1339",
> > 	},
> > 	{
> > 		I2C_BOARD_INFO("eeprom-24c256", 0x50),
> > 		.platform_data = &picomaster_i2c_eeprom_info,
> > 	},
> > 	{
> > 		I2C_BOARD_INFO("adc-ads1015", 0x48),
> > 		//.platform_data = &picomaster_i2c_ads1015_info,
> > 	},
> > 	{
> > 		I2C_BOARD_INFO("adc-ads1015", 0x49),
> > 		//.platform_data = &picomaster_i2c_ads1015_info,
> > 	},
> 
> The driver wants "ads1015" not "adc-ads1015".
> 
Also probably "eeprom" or "24c256" instead of "eeprom-24c256",
and "sgtl5000" instead of ""sgtl5000-i2c".

Guenter

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

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

* Re: [lm-sensors] help with ads1015
  2012-03-01 11:35 [lm-sensors] help with ads1015 Pierantonio Tabaro
                   ` (5 preceding siblings ...)
  2012-03-01 14:45 ` Guenter Roeck
@ 2012-03-02  7:50 ` Jean Delvare
  6 siblings, 0 replies; 8+ messages in thread
From: Jean Delvare @ 2012-03-02  7:50 UTC (permalink / raw)
  To: lm-sensors

On Thu, 1 Mar 2012 14:34:03 +0000 (UTC), Pierantonio Tabaro wrote:
> Another off-topic question:
> I need to write a driver for and AD5337 i2c Dac, i searched something in 
> internet but without success.
> I would like to use one existing driver, there is on linux support for DAC's?
> Some suggestion?

No idea, sorry, and this discussion is somewhat off-topic for the
lm-sensors list.

-- 
Jean Delvare

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

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

end of thread, other threads:[~2012-03-02  7:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-01 11:35 [lm-sensors] help with ads1015 Pierantonio Tabaro
2012-03-01 11:48 ` Jean Delvare
2012-03-01 11:53 ` Guenter Roeck
2012-03-01 12:01 ` Pierantonio Tabaro
2012-03-01 13:38 ` Jean Delvare
2012-03-01 14:34 ` Pierantonio Tabaro
2012-03-01 14:45 ` Guenter Roeck
2012-03-02  7:50 ` Jean Delvare

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.