Skip to contentSkip to conversation

w1-dev

lm-sensors [email protected] 2 participants 4 messages Jun 14, 2005 – Jun 19, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Evgeniy,

I've been toying with a dev interface for the w1 bus to allow a user-space program to talk directly to a w1 slave.
The w1 slave that I am using it with is the DS2433 (family 23 4kb EEPROM). The examples in the documentation refer to that chip.

The dev interface accepts a string as a series of w1 commands. You then read back the results.
Documentation is included in the patch.

Although it works, I don't think it is quite ready to be considered 'done'. There are a few areas that I am not comfortable with: locking, reference counts, etc.

If you (or anyone else) would like to play with it, feel free to do so.

The patch is against the latest set of w1 changes that we did.

Thanks,
Ben
-------------- next part --------------

drivers/w1/Kconfig +9 -0
@@ -11,6 +11,15 @@
 	  This W1 support can also be built as a module.  If so, the module
 	  will be called wire.ko.
 
+config W1_DEV
+	tristate "w1 master character device"
+	depends on W1
+	help
+	  Enables a char device interface to the w1 bus.
+
+	  This can also be built as a module.  If so, the module
+	  will be called w1_dev.
+
 config W1_MATROX
 	tristate "Matrox G400 transport layer for 1-wire"
 	depends on W1 && PCI
drivers/w1/Makefile +2 -0
@@ -18,3 +18,5 @@
 
 obj-$(CONFIG_W1_DS9490_BRIDGE)	+= ds_w1_bridge.o
 
+obj-$(CONFIG_W1_DEV)		+= w1_dev.o 
+
drivers/w1/w1_int.h +8 -0
@@ -27,6 +27,14 @@
 
 #include "w1.h"
 
+struct w1_notify_ops
+{
+	void	(*notify_add)(struct w1_master *master);
+	void	(*notify_remove)(struct w1_master *master);
+};
+int w1_add_notify(struct w1_notify_ops *ops);
+int w1_remove_notify(struct w1_notify_ops *ops);
+
 int w1_add_master_device(struct w1_bus_master *);
 void w1_remove_master_device(struct w1_bus_master *);
 void __w1_remove_master_device(struct w1_master *);
drivers/w1/w1_int.c +50 -0

85 lines not on this page · raw message

drivers/w1/w1_dev.c +536 -0

536 lines not on this page · raw message

Documentation/w1/w1.dev +103 -0

103 lines not on this page · raw message

#1 lore raw
Quoted 1 line · On Tue, 14 Jun 2005 12:39:28 -0500 [email protected] wrote:

Hi Evgeniy,

Hello, Ben.

Quoted 9 lines

I've been toying with a dev interface for the w1 bus to allow a user-space program to talk directly to a w1 slave.
The w1 slave that I am using it with is the DS2433 (family 23 4kb EEPROM). The examples in the documentation refer to that chip.

The dev interface accepts a string as a series of w1 commands. You then read back the results.
Documentation is included in the patch.

Quoted 7 lines

Although it works, I don't think it is quite ready to be considered 'done'. There are a few areas that I am not comfortable with: locking, reference counts, etc.

If you (or anyone else) would like to play with it, feel free to do so.

The patch is against the latest set of w1 changes that we did.

Sorry for long delay.

I did not studied it quite enough yet to say about locking, though access to notify methods is suspicious.

And I have at least three comments:
- there is kernel policy to not include new functionality without
it's users, so you need to push eeprom driver into w1 subsystem :)
- I want to move w1 notifications to kernel connector, when it will be
put into mainline (if it will be), so notification part of w1 and new dev interface could be much simplified with it.
- I personally hate strings :), I do not insist, but why
strings, but not binary data, like i2c does?

Quoted 2 lines

Thanks,
Ben

Evgeniy Polyakov

Only failure makes us experts. -- Theo de Raadt

#2 lore raw
In reply to [email protected]

Hi Evgeniy,

<quote>
- there is kernel policy to not include new functionality without
it's users, so you need to push eeprom driver into w1 subsystem :) </quote>

I plan on doing that eventually.
The family 23 driver will need a 512 byte eeprom sysfs entry, and I'd like to cache the data.

I'll need to make these changes to the w1 family stuff:
1. The family drivers need private storage in each slave
2. Add optional add/remove functions when a slave is added. This is needed to add sysfs entries and allocate private memory.

<quote>
- I want to move w1 notifications to kernel connector, when it will be
put into mainline (if it will be), so notification part of w1 and new dev interface could be much simplified with it. </quote>

I didn't find any examples of using the connector code in 2.6.12-rc5-mm2 on-line.
Would you point me to an example of how to use that feature?

<quote>
- I personally hate strings :), I do not insist, but why
strings, but not binary data, like i2c does? </quote>

I agree. Switching to binary would eliminate a fair amount of code. Once I figure out that connector/netlink stuff, I'll change that.

I just need to find some time to work on it. =)

Thanks,
Ben

#3 lore raw
In reply to [email protected]
Quoted 7 lines · On Fri, 17 Jun 2005 11:03:39 -0400 <[email protected]> wrote:

Hi Evgeniy,

<quote>
- there is kernel policy to not include new functionality without
it's users, so you need to push eeprom driver into w1 subsystem :) </quote>

Quoted 8 lines

I plan on doing that eventually.
The family 23 driver will need a 512 byte eeprom sysfs entry, and I'd like to cache the data.

I'll need to make these changes to the w1 family stuff:
1. The family drivers need private storage in each slave
2. Add optional add/remove functions when a slave is added. This is needed to add sysfs entries and allocate private memory.

This looks ok to me.

Quoted 10 lines

<quote>
- I want to move w1 notifications to kernel connector, when it will be
put into mainline (if it will be), so notification part of w1 and new dev interface could be much simplified with it. </quote>

I didn't find any examples of using the connector code in 2.6.12-rc5-mm2 on-line.
Would you point me to an example of how to use that feature?

You can find example test module and some design and interface documentation in Documentation/connector/.

Quoted 9 lines

<quote>
- I personally hate strings :), I do not insist, but why
strings, but not binary data, like i2c does? </quote>

I agree. Switching to binary would eliminate a fair amount of code. Once I figure out that connector/netlink stuff, I'll change that.

I just need to find some time to work on it. =)

Ok :)

Quoted 3 lines

Thanks,
Ben

Evgeniy Polyakov

Only failure makes us experts. -- Theo de Raadt