Lines Matching refs:tm
114 static int msm6242_read_time(struct device *dev, struct rtc_time *tm) in msm6242_read_time() argument
120 tm->tm_sec = msm6242_read(priv, MSM6242_SECOND10) * 10 + in msm6242_read_time()
122 tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 + in msm6242_read_time()
124 tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) & in msm6242_read_time()
127 tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 + in msm6242_read_time()
129 tm->tm_wday = msm6242_read(priv, MSM6242_WEEK); in msm6242_read_time()
130 tm->tm_mon = msm6242_read(priv, MSM6242_MONTH10) * 10 + in msm6242_read_time()
132 tm->tm_year = msm6242_read(priv, MSM6242_YEAR10) * 10 + in msm6242_read_time()
134 if (tm->tm_year <= 69) in msm6242_read_time()
135 tm->tm_year += 100; in msm6242_read_time()
140 if (!pm && tm->tm_hour == 12) in msm6242_read_time()
141 tm->tm_hour = 0; in msm6242_read_time()
142 else if (pm && tm->tm_hour != 12) in msm6242_read_time()
143 tm->tm_hour += 12; in msm6242_read_time()
151 static int msm6242_set_time(struct device *dev, struct rtc_time *tm) in msm6242_set_time() argument
157 msm6242_write(priv, tm->tm_sec / 10, MSM6242_SECOND10); in msm6242_set_time()
158 msm6242_write(priv, tm->tm_sec % 10, MSM6242_SECOND1); in msm6242_set_time()
159 msm6242_write(priv, tm->tm_min / 10, MSM6242_MINUTE10); in msm6242_set_time()
160 msm6242_write(priv, tm->tm_min % 10, MSM6242_MINUTE1); in msm6242_set_time()
162 msm6242_write(priv, tm->tm_hour / 10, MSM6242_HOUR10); in msm6242_set_time()
163 else if (tm->tm_hour >= 12) in msm6242_set_time()
164 msm6242_write(priv, MSM6242_HOUR10_PM + (tm->tm_hour - 12) / 10, in msm6242_set_time()
167 msm6242_write(priv, tm->tm_hour / 10, MSM6242_HOUR10); in msm6242_set_time()
168 msm6242_write(priv, tm->tm_hour % 10, MSM6242_HOUR1); in msm6242_set_time()
169 msm6242_write(priv, tm->tm_mday / 10, MSM6242_DAY10); in msm6242_set_time()
170 msm6242_write(priv, tm->tm_mday % 10, MSM6242_DAY1); in msm6242_set_time()
171 if (tm->tm_wday != -1) in msm6242_set_time()
172 msm6242_write(priv, tm->tm_wday, MSM6242_WEEK); in msm6242_set_time()
173 msm6242_write(priv, (tm->tm_mon + 1) / 10, MSM6242_MONTH10); in msm6242_set_time()
174 msm6242_write(priv, (tm->tm_mon + 1) % 10, MSM6242_MONTH1); in msm6242_set_time()
175 if (tm->tm_year >= 100) in msm6242_set_time()
176 tm->tm_year -= 100; in msm6242_set_time()
177 msm6242_write(priv, tm->tm_year / 10, MSM6242_YEAR10); in msm6242_set_time()
178 msm6242_write(priv, tm->tm_year % 10, MSM6242_YEAR1); in msm6242_set_time()