Skip to contentSkip to conversation

help with ads1015

lm-sensors Pierantonio Tabaro 3 participants 8 messages Mar 1, 2012 – Mar 2, 2012

lore
Share & tools
lore
#0 lore raw

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw
Quoted 73 lines · Pierantonio Tabaro

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

Quoted 2 lines

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.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Pierantonio Tabaro
Quoted 14 lines · Pierantonio Tabaro

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:

Quoted 8 lines

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw
In reply to Pierantonio Tabaro
Quoted 7 lines · 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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw
In reply to Pierantonio Tabaro
Quoted 34 lines · Pierantonio Tabaro
Quoted 7 lines · 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,
	},
Quoted 8 lines
	{
		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".

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#5 lore raw
In reply to Pierantonio Tabaro
Quoted 45 lines · Jean Delvare <khali <at> linux-fr.org> writes:
Quoted 34 lines · Pierantonio Tabaro
Quoted 7 lines · 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,
	},
Quoted 8 lines
	{
		I2C_BOARD_INFO("adc-ads1015", 0x48),
		//.platform_data = &picomaster_i2c_ads1015_info,
	},
	{
		I2C_BOARD_INFO("adc-ads1015", 0x49),
		//.platform_data = &picomaster_i2c_ads1015_info,
	},
Quoted 2 lines

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#6 lore raw
In reply to Pierantonio Tabaro
Quoted 44 lines · Jean Delvare
Quoted 34 lines · Pierantonio Tabaro
Quoted 7 lines · 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,
	},
Quoted 8 lines
	{
		I2C_BOARD_INFO("adc-ads1015", 0x48),
		//.platform_data = &picomaster_i2c_ads1015_info,
	},
	{
		I2C_BOARD_INFO("adc-ads1015", 0x49),
		//.platform_data = &picomaster_i2c_ads1015_info,
	},
Quoted 2 lines

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#7 lore raw
In reply to Pierantonio Tabaro
Quoted 5 lines · Pierantonio Tabaro

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.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors