Lines Matching +full:tx +full:- +full:sec

1 // SPDX-License-Identifier: GPL-2.0
8 #define pr_fmt(fmt) "SCMI Notifications BBM - " fmt
99 ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0, sizeof(*attr), &t); in scmi_imx_bbm_attributes_get()
103 attr = t->rx.buf; in scmi_imx_bbm_attributes_get()
105 ret = ph->xops->do_xfer(ph, t); in scmi_imx_bbm_attributes_get()
107 pi->nr_rtc = GET_RTCS_NR(attr->attributes); in scmi_imx_bbm_attributes_get()
108 pi->nr_gpr = GET_GPRS_NR(attr->attributes); in scmi_imx_bbm_attributes_get()
111 ph->xops->xfer_put(ph, t); in scmi_imx_bbm_attributes_get()
125 ret = ph->xops->xfer_get_init(ph, message_id, in scmi_imx_bbm_notify()
130 rtc_notify = t->tx.buf; in scmi_imx_bbm_notify()
131 rtc_notify->rtc_id = cpu_to_le32(0); in scmi_imx_bbm_notify()
132 rtc_notify->flags = in scmi_imx_bbm_notify()
137 ret = ph->xops->xfer_get_init(ph, message_id, in scmi_imx_bbm_notify()
142 button_notify = t->tx.buf; in scmi_imx_bbm_notify()
143 button_notify->flags = cpu_to_le32(enable ? 1 : 0); in scmi_imx_bbm_notify()
145 return -EINVAL; in scmi_imx_bbm_notify()
148 ret = ph->xops->do_xfer(ph, t); in scmi_imx_bbm_notify()
150 ph->xops->xfer_put(ph, t); in scmi_imx_bbm_notify()
165 return -EINVAL; in scmi_imx_bbm_set_notify_enabled()
170 pr_debug("FAIL_ENABLED - evt[%X] dom[%d] - ret:%d\n", in scmi_imx_bbm_set_notify_enabled()
188 r->is_rtc = true; in scmi_imx_bbm_fill_custom_report()
189 r->is_button = false; in scmi_imx_bbm_fill_custom_report()
190 r->timestamp = timestamp; in scmi_imx_bbm_fill_custom_report()
191 r->rtc_id = le32_get_bits(p->flags, SCMI_IMX_BBM_EVENT_RTC_MASK); in scmi_imx_bbm_fill_custom_report()
192 r->rtc_evt = le32_get_bits(p->flags, SCMI_IMX_BBM_NOTIFY_RTC_FLAG); in scmi_imx_bbm_fill_custom_report()
193 dev_dbg(ph->dev, "RTC: %d evt: %x\n", r->rtc_id, r->rtc_evt); in scmi_imx_bbm_fill_custom_report()
194 *src_id = r->rtc_evt; in scmi_imx_bbm_fill_custom_report()
196 r->is_rtc = false; in scmi_imx_bbm_fill_custom_report()
197 r->is_button = true; in scmi_imx_bbm_fill_custom_report()
198 r->timestamp = timestamp; in scmi_imx_bbm_fill_custom_report()
199 dev_dbg(ph->dev, "BBM Button\n"); in scmi_imx_bbm_fill_custom_report()
236 u32 rtc_id, u64 sec) in scmi_imx_bbm_rtc_time_set() argument
238 struct scmi_imx_bbm_info *pi = ph->get_priv(ph); in scmi_imx_bbm_rtc_time_set()
243 if (rtc_id >= pi->nr_rtc) in scmi_imx_bbm_rtc_time_set()
244 return -EINVAL; in scmi_imx_bbm_rtc_time_set()
246 ret = ph->xops->xfer_get_init(ph, IMX_BBM_RTC_TIME_SET, sizeof(*cfg), 0, &t); in scmi_imx_bbm_rtc_time_set()
250 cfg = t->tx.buf; in scmi_imx_bbm_rtc_time_set()
251 cfg->id = cpu_to_le32(rtc_id); in scmi_imx_bbm_rtc_time_set()
252 cfg->flags = 0; in scmi_imx_bbm_rtc_time_set()
253 cfg->value_low = cpu_to_le32(lower_32_bits(sec)); in scmi_imx_bbm_rtc_time_set()
254 cfg->value_high = cpu_to_le32(upper_32_bits(sec)); in scmi_imx_bbm_rtc_time_set()
256 ret = ph->xops->do_xfer(ph, t); in scmi_imx_bbm_rtc_time_set()
258 ph->xops->xfer_put(ph, t); in scmi_imx_bbm_rtc_time_set()
266 struct scmi_imx_bbm_info *pi = ph->get_priv(ph); in scmi_imx_bbm_rtc_time_get()
271 if (rtc_id >= pi->nr_rtc) in scmi_imx_bbm_rtc_time_get()
272 return -EINVAL; in scmi_imx_bbm_rtc_time_get()
274 ret = ph->xops->xfer_get_init(ph, IMX_BBM_RTC_TIME_GET, sizeof(*cfg), in scmi_imx_bbm_rtc_time_get()
279 cfg = t->tx.buf; in scmi_imx_bbm_rtc_time_get()
280 cfg->id = cpu_to_le32(rtc_id); in scmi_imx_bbm_rtc_time_get()
281 cfg->flags = 0; in scmi_imx_bbm_rtc_time_get()
283 ret = ph->xops->do_xfer(ph, t); in scmi_imx_bbm_rtc_time_get()
285 *value = get_unaligned_le64(t->rx.buf); in scmi_imx_bbm_rtc_time_get()
287 ph->xops->xfer_put(ph, t); in scmi_imx_bbm_rtc_time_get()
293 u32 rtc_id, bool enable, u64 sec) in scmi_imx_bbm_rtc_alarm_set() argument
295 struct scmi_imx_bbm_info *pi = ph->get_priv(ph); in scmi_imx_bbm_rtc_alarm_set()
300 if (rtc_id >= pi->nr_rtc) in scmi_imx_bbm_rtc_alarm_set()
301 return -EINVAL; in scmi_imx_bbm_rtc_alarm_set()
303 ret = ph->xops->xfer_get_init(ph, IMX_BBM_RTC_ALARM_SET, sizeof(*cfg), 0, &t); in scmi_imx_bbm_rtc_alarm_set()
307 cfg = t->tx.buf; in scmi_imx_bbm_rtc_alarm_set()
308 cfg->id = cpu_to_le32(rtc_id); in scmi_imx_bbm_rtc_alarm_set()
309 cfg->flags = enable ? in scmi_imx_bbm_rtc_alarm_set()
311 cfg->value_low = cpu_to_le32(lower_32_bits(sec)); in scmi_imx_bbm_rtc_alarm_set()
312 cfg->value_high = cpu_to_le32(upper_32_bits(sec)); in scmi_imx_bbm_rtc_alarm_set()
314 ret = ph->xops->do_xfer(ph, t); in scmi_imx_bbm_rtc_alarm_set()
316 ph->xops->xfer_put(ph, t); in scmi_imx_bbm_rtc_alarm_set()
326 ret = ph->xops->xfer_get_init(ph, IMX_BBM_BUTTON_GET, 0, sizeof(u32), &t); in scmi_imx_bbm_button_get()
330 ret = ph->xops->do_xfer(ph, t); in scmi_imx_bbm_button_get()
332 *state = get_unaligned_le32(t->rx.buf); in scmi_imx_bbm_button_get()
334 ph->xops->xfer_put(ph, t); in scmi_imx_bbm_button_get()
352 ret = ph->xops->version_get(ph, &version); in scmi_imx_bbm_protocol_init()
356 dev_info(ph->dev, "NXP SM BBM Version %d.%d\n", in scmi_imx_bbm_protocol_init()
359 binfo = devm_kzalloc(ph->dev, sizeof(*binfo), GFP_KERNEL); in scmi_imx_bbm_protocol_init()
361 return -ENOMEM; in scmi_imx_bbm_protocol_init()
367 return ph->set_priv(ph, binfo, version); in scmi_imx_bbm_protocol_init()