3 #include <asm/ic/ssi.h>
6 static void ds1722_select(int dev)
8 ssi_set_interface(4096, 0, 0, 0);
16 u8 ds1722_read(int dev, int addr)
30 void ds1722_write(int dev, int addr, u8 data)
34 ssi_tx_byte(0x80|addr);
41 u16 ds1722_temp(int dev, int resolution)
43 static int useconds[] = {
44 75000, 150000, 300000, 600000, 1200000
50 /* set up the desired resulotion ... */
51 ds1722_write(dev, 0, 0xe0 | (resolution << 1));
53 /* wait while the chip measures the tremperature */
54 udelay(useconds[resolution]);
56 res = (temp = ds1722_read(dev, 2)) << 8;
59 temp = (16 - (ds1722_read(dev, 1) >> 4)) & 0x0f;
61 temp = (ds1722_read(dev, 1) >> 4);
133 int ds1722_probe(int dev)
135 u16 temp = ds1722_temp(dev, DS1722_RESOLUTION_12BIT);
136 printf("%d.%d deg C\n\n", (char)(temp >> 8), temp & 0xff);