Lines Matching refs:dev
47 static unsigned char m48t86_readb(struct device *dev, unsigned long addr) in m48t86_readb() argument
49 struct m48t86_rtc_info *info = dev_get_drvdata(dev); in m48t86_readb()
58 static void m48t86_writeb(struct device *dev, in m48t86_writeb() argument
61 struct m48t86_rtc_info *info = dev_get_drvdata(dev); in m48t86_writeb()
67 static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm) in m48t86_rtc_read_time() argument
71 reg = m48t86_readb(dev, M48T86_B); in m48t86_rtc_read_time()
75 tm->tm_sec = m48t86_readb(dev, M48T86_SEC); in m48t86_rtc_read_time()
76 tm->tm_min = m48t86_readb(dev, M48T86_MIN); in m48t86_rtc_read_time()
77 tm->tm_hour = m48t86_readb(dev, M48T86_HOUR) & 0x3f; in m48t86_rtc_read_time()
78 tm->tm_mday = m48t86_readb(dev, M48T86_DOM); in m48t86_rtc_read_time()
80 tm->tm_mon = m48t86_readb(dev, M48T86_MONTH) - 1; in m48t86_rtc_read_time()
81 tm->tm_year = m48t86_readb(dev, M48T86_YEAR) + 100; in m48t86_rtc_read_time()
82 tm->tm_wday = m48t86_readb(dev, M48T86_DOW); in m48t86_rtc_read_time()
85 tm->tm_sec = bcd2bin(m48t86_readb(dev, M48T86_SEC)); in m48t86_rtc_read_time()
86 tm->tm_min = bcd2bin(m48t86_readb(dev, M48T86_MIN)); in m48t86_rtc_read_time()
87 tm->tm_hour = bcd2bin(m48t86_readb(dev, M48T86_HOUR) & in m48t86_rtc_read_time()
89 tm->tm_mday = bcd2bin(m48t86_readb(dev, M48T86_DOM)); in m48t86_rtc_read_time()
91 tm->tm_mon = bcd2bin(m48t86_readb(dev, M48T86_MONTH)) - 1; in m48t86_rtc_read_time()
92 tm->tm_year = bcd2bin(m48t86_readb(dev, M48T86_YEAR)) + 100; in m48t86_rtc_read_time()
93 tm->tm_wday = bcd2bin(m48t86_readb(dev, M48T86_DOW)); in m48t86_rtc_read_time()
98 if (m48t86_readb(dev, M48T86_HOUR) & 0x80) in m48t86_rtc_read_time()
104 static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm) in m48t86_rtc_set_time() argument
108 reg = m48t86_readb(dev, M48T86_B); in m48t86_rtc_set_time()
112 m48t86_writeb(dev, reg, M48T86_B); in m48t86_rtc_set_time()
116 m48t86_writeb(dev, tm->tm_sec, M48T86_SEC); in m48t86_rtc_set_time()
117 m48t86_writeb(dev, tm->tm_min, M48T86_MIN); in m48t86_rtc_set_time()
118 m48t86_writeb(dev, tm->tm_hour, M48T86_HOUR); in m48t86_rtc_set_time()
119 m48t86_writeb(dev, tm->tm_mday, M48T86_DOM); in m48t86_rtc_set_time()
120 m48t86_writeb(dev, tm->tm_mon + 1, M48T86_MONTH); in m48t86_rtc_set_time()
121 m48t86_writeb(dev, tm->tm_year % 100, M48T86_YEAR); in m48t86_rtc_set_time()
122 m48t86_writeb(dev, tm->tm_wday, M48T86_DOW); in m48t86_rtc_set_time()
125 m48t86_writeb(dev, bin2bcd(tm->tm_sec), M48T86_SEC); in m48t86_rtc_set_time()
126 m48t86_writeb(dev, bin2bcd(tm->tm_min), M48T86_MIN); in m48t86_rtc_set_time()
127 m48t86_writeb(dev, bin2bcd(tm->tm_hour), M48T86_HOUR); in m48t86_rtc_set_time()
128 m48t86_writeb(dev, bin2bcd(tm->tm_mday), M48T86_DOM); in m48t86_rtc_set_time()
129 m48t86_writeb(dev, bin2bcd(tm->tm_mon + 1), M48T86_MONTH); in m48t86_rtc_set_time()
130 m48t86_writeb(dev, bin2bcd(tm->tm_year % 100), M48T86_YEAR); in m48t86_rtc_set_time()
131 m48t86_writeb(dev, bin2bcd(tm->tm_wday), M48T86_DOW); in m48t86_rtc_set_time()
136 m48t86_writeb(dev, reg, M48T86_B); in m48t86_rtc_set_time()
141 static int m48t86_rtc_proc(struct device *dev, struct seq_file *seq) in m48t86_rtc_proc() argument
145 reg = m48t86_readb(dev, M48T86_B); in m48t86_rtc_proc()
150 reg = m48t86_readb(dev, M48T86_D); in m48t86_rtc_proc()
167 struct device *dev = priv; in m48t86_nvram_read() local
171 ((u8 *)buf)[i] = m48t86_readb(dev, M48T86_NVRAM(off + i)); in m48t86_nvram_read()
179 struct device *dev = priv; in m48t86_nvram_write() local
183 m48t86_writeb(dev, ((u8 *)buf)[i], M48T86_NVRAM(off + i)); in m48t86_nvram_write()
201 tmp0 = m48t86_readb(&pdev->dev, offset0); in m48t86_verify_chip()
202 tmp1 = m48t86_readb(&pdev->dev, offset1); in m48t86_verify_chip()
204 m48t86_writeb(&pdev->dev, 0x00, offset0); in m48t86_verify_chip()
205 m48t86_writeb(&pdev->dev, 0x55, offset1); in m48t86_verify_chip()
206 if (m48t86_readb(&pdev->dev, offset1) == 0x55) { in m48t86_verify_chip()
207 m48t86_writeb(&pdev->dev, 0xaa, offset1); in m48t86_verify_chip()
208 if (m48t86_readb(&pdev->dev, offset1) == 0xaa && in m48t86_verify_chip()
209 m48t86_readb(&pdev->dev, offset0) == 0x00) { in m48t86_verify_chip()
210 m48t86_writeb(&pdev->dev, tmp0, offset0); in m48t86_verify_chip()
211 m48t86_writeb(&pdev->dev, tmp1, offset1); in m48t86_verify_chip()
231 .priv = &pdev->dev, in m48t86_rtc_probe()
234 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); in m48t86_rtc_probe()
246 dev_set_drvdata(&pdev->dev, info); in m48t86_rtc_probe()
249 dev_info(&pdev->dev, "RTC not present\n"); in m48t86_rtc_probe()
253 info->rtc = devm_rtc_allocate_device(&pdev->dev); in m48t86_rtc_probe()
266 reg = m48t86_readb(&pdev->dev, M48T86_D); in m48t86_rtc_probe()
267 dev_info(&pdev->dev, "battery %s\n", in m48t86_rtc_probe()