Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/w1-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Linus Torvalds committed Jun 22, 2005
2 parents 94eb7f4 + e5c515b commit a0cd30f
Show file tree
Hide file tree
Showing 16 changed files with 716 additions and 439 deletions.
107 changes: 90 additions & 17 deletions Documentation/w1/w1.generic
Original file line number Diff line number Diff line change
@@ -1,19 +1,92 @@
Any w1 device must be connected to w1 bus master device - for example
ds9490 usb device or w1-over-GPIO or RS232 converter.
Driver for w1 bus master must provide several functions(you can find
them in struct w1_bus_master definition in w1.h) which then will be
called by w1 core to send various commands over w1 bus(by default it is
reset and search commands). When some device is found on the bus, w1 core
checks if driver for it's family is loaded.
If driver is loaded w1 core creates new w1_slave object and registers it
in the system(creates some generic sysfs files(struct w1_family_ops in
w1_family.h), notifies any registered listener and so on...).
It is device driver's business to provide any communication method
upstream.
For example w1_therm driver(ds18?20 thermal sensor family driver)
provides temperature reading function which is bound to ->rbin() method
of the above w1_family_ops structure.
w1_smem - driver for simple 64bit memory cell provides ID reading
method.
The 1-wire (w1) subsystem
------------------------------------------------------------------
The 1-wire bus is a simple master-slave bus that communicates via a single
signal wire (plus ground, so two wires).

Devices communicate on the bus by pulling the signal to ground via an open
drain output and by sampling the logic level of the signal line.

The w1 subsystem provides the framework for managing w1 masters and
communication with slaves.

All w1 slave devices must be connected to a w1 bus master device.

Example w1 master devices:
DS9490 usb device
W1-over-GPIO
DS2482 (i2c to w1 bridge)
Emulated devices, such as a RS232 converter, parallel port adapter, etc


What does the w1 subsystem do?
------------------------------------------------------------------
When a w1 master driver registers with the w1 subsystem, the following occurs:

- sysfs entries for that w1 master are created
- the w1 bus is periodically searched for new slave devices

When a device is found on the bus, w1 core checks if driver for it's family is
loaded. If so, the family driver is attached to the slave.
If there is no driver for the family, a simple sysfs entry is created
for the slave device.


W1 device families
------------------------------------------------------------------
Slave devices are handled by a driver written for a family of w1 devices.

A family driver populates a struct w1_family_ops (see w1_family.h) and
registers with the w1 subsystem.

Current family drivers:
w1_therm - (ds18?20 thermal sensor family driver)
provides temperature reading function which is bound to ->rbin() method
of the above w1_family_ops structure.

w1_smem - driver for simple 64bit memory cell provides ID reading method.

You can call above methods by reading appropriate sysfs files.


What does a w1 master driver need to implement?
------------------------------------------------------------------

The driver for w1 bus master must provide at minimum two functions.

Emulated devices must provide the ability to set the output signal level
(write_bit) and sample the signal level (read_bit).

Devices that support the 1-wire natively must provide the ability to write and
sample a bit (touch_bit) and reset the bus (reset_bus).

Most hardware provides higher-level functions that offload w1 handling.
See struct w1_bus_master definition in w1.h for details.


w1 master sysfs interface
------------------------------------------------------------------
<xx-xxxxxxxxxxxxx> - a directory for a found device. The format is family-serial
bus - (standard) symlink to the w1 bus
driver - (standard) symlink to the w1 driver
w1_master_attempts - the number of times a search was attempted
w1_master_max_slave_count
- the maximum slaves that may be attached to a master
w1_master_name - the name of the device (w1_bus_masterX)
w1_master_search - the number of searches left to do, -1=continual (default)
w1_master_slave_count
- the number of slaves found
w1_master_slaves - the names of the slaves, one per line
w1_master_timeout - the delay in seconds between searches

If you have a w1 bus that never changes (you don't add or remove devices),
you can set w1_master_search to a positive value to disable searches.


w1 slave sysfs interface
------------------------------------------------------------------
bus - (standard) symlink to the w1 bus
driver - (standard) symlink to the w1 driver
name - the device name, usually the same as the directory name
w1_slave - (optional) a binary file whose meaning depends on the
family driver

16 changes: 8 additions & 8 deletions drivers/w1/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ menu "Dallas's 1-wire bus"
config W1
tristate "Dallas's 1-wire support"
---help---
Dallas's 1-wire bus is usefull to connect slow 1-pin devices
Dallas's 1-wire bus is usefull to connect slow 1-pin devices
such as iButtons and thermal sensors.

If you want W1 support, you should say Y here.

This W1 support can also be built as a module. If so, the module
Expand All @@ -17,8 +17,8 @@ config W1_MATROX
help
Say Y here if you want to communicate with your 1-wire devices
using Matrox's G400 GPIO pins.
This support is also available as a module. If so, the module

This support is also available as a module. If so, the module
will be called matrox_w1.ko.

config W1_DS9490
Expand All @@ -27,17 +27,17 @@ config W1_DS9490
help
Say Y here if you want to have a driver for DS9490R UWB <-> W1 bridge.

This support is also available as a module. If so, the module
This support is also available as a module. If so, the module
will be called ds9490r.ko.

config W1_DS9490_BRIDGE
config W1_DS9490R_BRIDGE
tristate "DS9490R USB <-> W1 transport layer for 1-wire"
depends on W1_DS9490
help
Say Y here if you want to communicate with your 1-wire devices
using DS9490R USB bridge.

This support is also available as a module. If so, the module
This support is also available as a module. If so, the module
will be called ds_w1_bridge.ko.

config W1_THERM
Expand All @@ -51,7 +51,7 @@ config W1_SMEM
tristate "Simple 64bit memory family implementation"
depends on W1
help
Say Y here if you want to connect 1-wire
Say Y here if you want to connect 1-wire
simple 64bit memory rom(ds2401/ds2411/ds1990*) to you wire.

endmenu
4 changes: 2 additions & 2 deletions drivers/w1/ds_w1_bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ static u8 ds9490r_read_byte(unsigned long data)
return byte;
}

static void ds9490r_write_block(unsigned long data, u8 *buf, int len)
static void ds9490r_write_block(unsigned long data, const u8 *buf, int len)
{
struct ds_device *dev = (struct ds_device *)data;

ds_write_block(dev, buf, len);
ds_write_block(dev, (u8 *)buf, len);
}

static u8 ds9490r_read_block(unsigned long data, u8 *buf, int len)
Expand Down
10 changes: 5 additions & 5 deletions drivers/w1/matrox_w1.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* matrox_w1.c
* matrox_w1.c
*
* Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
*
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -59,7 +59,7 @@ static struct pci_driver matrox_w1_pci_driver = {
.remove = __devexit_p(matrox_w1_remove),
};

/*
/*
* Matrox G400 DDC registers.
*/

Expand Down Expand Up @@ -177,8 +177,8 @@ static int __devinit matrox_w1_probe(struct pci_dev *pdev, const struct pci_devi

dev->bus_master = (struct w1_bus_master *)(dev + 1);

/*
* True for G400, for some other we need resource 0, see drivers/video/matrox/matroxfb_base.c
/*
* True for G400, for some other we need resource 0, see drivers/video/matrox/matroxfb_base.c
*/

dev->phys_addr = pci_resource_start(pdev, 1);
Expand Down
Loading

0 comments on commit a0cd30f

Please sign in to comment.