Skip to contentSkip to conversation

rtc-ds3232 driver

DISCUSSION Anthony Drake 3 participants 5 messages Mar 1, 2012 – Mar 2, 2012 2 messages not in the archive I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

Group,

I've built and insmod'd rtc-ds3232.ko, but I do not know how to access the functionality of the driver. I think there should be a device special file such as /dev/rtc1 or something like it, but I don't know what it is. I suspect that since this is a type of i2c driver there must be a way to access the driver at a higher level but I do not know how. Is there any information to help?

I can access the ds3232 from user space application, using i2c-dev model. I would also like to be able to read the status register from a lkm. Thank you in advance.

Thanks, Drake.

#2 lore raw
In reply to a message not in the archive
Quoted 7 lines

I've built and insmod'd rtc-ds3232.ko, but I do not know how to access the functionality of the driver. I think there should be a device special file such as /dev/rtc1 or something like it, but I don't know what it is. I suspect that since this is a type of i2c driver there must be a way to access the driver at a higher level but I do not know how. Is there any information to help?

Documentation/rtc.txt

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw

On Thu, 1 Mar 2012 20:12:00 +0100,
Wolfram Sang <[email protected]> wrote

Quoted 4 lines

Documentation/rtc.txt

--=20

Thank you. I am familiar with the /dev/rtc0 character device special file interface, and can access it well. My problem is that there is no device special file created for rtc-ds3232 module. I know how to mknod a character device, but I do not know the major/minor number for rtc-ds3232.ko, it does not appear in /proc/devices. I do have /dev/i2c-1, 2, & 3 in my system.

I think I just do not know how to access i2c driver services, one that is added in the following way, from rtc-ds3232.c:

static int __init ds3232_init(void)

{
	printk("adding ds3232 driver: %s\n", ds3232_driver.driver.name);
	return i2c_add_driver(&ds3232_driver);
}

ds3232_driver defined:

static struct i2c_driver ds3232_driver = {
	.driver = {
		.name = "rtc-ds3232",
		.owner = THIS_MODULE,
	},
	.probe = ds3232_probe,
	.remove = __devexit_p(ds3232_remove),
	.id_table = ds3232_id,
};
#5 lore raw
In reply to a message not in the archive
Quoted 10 lines · Anthony Drake

On Thu, 1 Mar 2012 20:12:00 +0100,
Wolfram Sang <[email protected]> wrote

Quoted 4 lines

Documentation/rtc.txt

--=20

Thank you. I am familiar with the /dev/rtc0 character device special file interface, and can access it well. My problem is that there is no device special file created for rtc-ds3232 module.

Odds are that the underlying I2C slave device was not instantiated. Please read:
Documentation/i2c/instantiating-devices

Note that the rtc-ds3232 driver doesn't support method 3 (presumably the device lacks identification and thus can't be autodetected.

Signature · 1 line
Jean Delvare
#6 lore raw

On Thu, 1 Mar 2012 21:34:14 +0100,
Jean Delvare <[email protected]> wrote in message

Quoted 5 lines

Odds are that the underlying I2C slave device was not instantiated. Please read:
Documentation/i2c/instantiating-devices

Thank you very much! It works! after using method 4 with the name ("ds3232") from the i2c_device_id array, the kernel autoloads the module, creates /dev/rtc1. I've modified my userspace app to use the driver instead of raw i2c read/write, all working well.