2 #include <asm/ic/ssi.h>
5 static void ds1722_select(int dev)
7 ssi_set_interface(4096, 0, 0, 0);
15 u8 ds1722_read(int dev, int addr)
29 void ds1722_write(int dev, int addr, u8 data)
33 ssi_tx_byte(0x80|addr);
40 u16 ds1722_temp(int dev, int resolution)
42 static int useconds[] = {
43 75000, 150000, 300000, 600000, 1200000
49 /* set up the desired resulotion ... */
50 ds1722_write(dev, 0, 0xe0 | (resolution << 1));
52 /* wait while the chip measures the tremperature */
53 udelay(useconds[resolution]);
55 res = (temp = ds1722_read(dev, 2)) << 8;
58 temp = (16 - (ds1722_read(dev, 1) >> 4)) & 0x0f;
60 temp = (ds1722_read(dev, 1) >> 4);
132 int ds1722_probe(int dev)
134 u16 temp = ds1722_temp(dev, DS1722_RESOLUTION_12BIT);
135 printf("%d.%d deg C\n\n", (char)(temp >> 8), temp & 0xff);