1 // SPDX-License-Identifier: GPL-2.0
3 * otg_fsm.c - ChipIdea USB IP core OTG FSM driver
5 * Copyright (C) 2014 Freescale Semiconductor, Inc.
11 * This file mainly handles OTG fsm, it includes OTG fsm operations
19 #include <linux/usb/otg.h>
20 #include <linux/usb/gadget.h>
21 #include <linux/usb/hcd.h>
22 #include <linux/usb/chipidea.h>
23 #include <linux/regulator/consumer.h>
30 /* Add for otg: interact with user space app */
32 a_bus_req_show(struct device *dev, struct device_attribute *attr, char *buf)
36 struct ci_hdrc *ci = dev_get_drvdata(dev);
40 t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_req);
44 return PAGE_SIZE - size;
48 a_bus_req_store(struct device *dev, struct device_attribute *attr,
49 const char *buf, size_t count)
51 struct ci_hdrc *ci = dev_get_drvdata(dev);
56 mutex_lock(&ci->fsm.lock);
58 ci->fsm.a_bus_req = 0;
59 } else if (buf[0] == '1') {
60 /* If a_bus_drop is TRUE, a_bus_req can't be set */
61 if (ci->fsm.a_bus_drop) {
62 mutex_unlock(&ci->fsm.lock);
65 ci->fsm.a_bus_req = 1;
66 if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) {
67 ci->gadget.host_request_flag = 1;
68 mutex_unlock(&ci->fsm.lock);
73 ci_otg_queue_work(ci);
74 mutex_unlock(&ci->fsm.lock);
78 static DEVICE_ATTR_RW(a_bus_req);
81 a_bus_drop_show(struct device *dev, struct device_attribute *attr, char *buf)
85 struct ci_hdrc *ci = dev_get_drvdata(dev);
89 t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_drop);
93 return PAGE_SIZE - size;
97 a_bus_drop_store(struct device *dev, struct device_attribute *attr,
98 const char *buf, size_t count)
100 struct ci_hdrc *ci = dev_get_drvdata(dev);
105 mutex_lock(&ci->fsm.lock);
107 ci->fsm.a_bus_drop = 0;
108 } else if (buf[0] == '1') {
109 ci->fsm.a_bus_drop = 1;
110 ci->fsm.a_bus_req = 0;
113 ci_otg_queue_work(ci);
114 mutex_unlock(&ci->fsm.lock);
118 static DEVICE_ATTR_RW(a_bus_drop);
121 b_bus_req_show(struct device *dev, struct device_attribute *attr, char *buf)
125 struct ci_hdrc *ci = dev_get_drvdata(dev);
129 t = scnprintf(next, size, "%d\n", ci->fsm.b_bus_req);
133 return PAGE_SIZE - size;
137 b_bus_req_store(struct device *dev, struct device_attribute *attr,
138 const char *buf, size_t count)
140 struct ci_hdrc *ci = dev_get_drvdata(dev);
145 mutex_lock(&ci->fsm.lock);
147 ci->fsm.b_bus_req = 0;
148 else if (buf[0] == '1') {
149 ci->fsm.b_bus_req = 1;
150 if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) {
151 ci->gadget.host_request_flag = 1;
152 mutex_unlock(&ci->fsm.lock);
157 ci_otg_queue_work(ci);
158 mutex_unlock(&ci->fsm.lock);
162 static DEVICE_ATTR_RW(b_bus_req);
165 a_clr_err_store(struct device *dev, struct device_attribute *attr,
166 const char *buf, size_t count)
168 struct ci_hdrc *ci = dev_get_drvdata(dev);
173 mutex_lock(&ci->fsm.lock);
175 ci->fsm.a_clr_err = 1;
177 ci_otg_queue_work(ci);
178 mutex_unlock(&ci->fsm.lock);
182 static DEVICE_ATTR_WO(a_clr_err);
184 static struct attribute *inputs_attrs[] = {
185 &dev_attr_a_bus_req.attr,
186 &dev_attr_a_bus_drop.attr,
187 &dev_attr_b_bus_req.attr,
188 &dev_attr_a_clr_err.attr,
192 static const struct attribute_group inputs_attr_group = {
194 .attrs = inputs_attrs,
198 * Keep this list in the same order as timers indexed
199 * by enum otg_fsm_timer in include/linux/usb/otg-fsm.h
201 static unsigned otg_timer_ms[] = {
217 * Add timer to active timer list
219 static void ci_otg_add_timer(struct ci_hdrc *ci, enum otg_fsm_timer t)
221 unsigned long flags, timer_sec, timer_nsec;
223 if (t >= NUM_OTG_FSM_TIMERS)
226 spin_lock_irqsave(&ci->lock, flags);
227 timer_sec = otg_timer_ms[t] / MSEC_PER_SEC;
228 timer_nsec = (otg_timer_ms[t] % MSEC_PER_SEC) * NSEC_PER_MSEC;
229 ci->hr_timeouts[t] = ktime_add(ktime_get(),
230 ktime_set(timer_sec, timer_nsec));
231 ci->enabled_otg_timer_bits |= (1 << t);
232 if ((ci->next_otg_timer == NUM_OTG_FSM_TIMERS) ||
233 ktime_after(ci->hr_timeouts[ci->next_otg_timer],
234 ci->hr_timeouts[t])) {
235 ci->next_otg_timer = t;
236 hrtimer_start_range_ns(&ci->otg_fsm_hrtimer,
237 ci->hr_timeouts[t], NSEC_PER_MSEC,
240 spin_unlock_irqrestore(&ci->lock, flags);
244 * Remove timer from active timer list
246 static void ci_otg_del_timer(struct ci_hdrc *ci, enum otg_fsm_timer t)
248 unsigned long flags, enabled_timer_bits;
249 enum otg_fsm_timer cur_timer, next_timer = NUM_OTG_FSM_TIMERS;
251 if ((t >= NUM_OTG_FSM_TIMERS) ||
252 !(ci->enabled_otg_timer_bits & (1 << t)))
255 spin_lock_irqsave(&ci->lock, flags);
256 ci->enabled_otg_timer_bits &= ~(1 << t);
257 if (ci->next_otg_timer == t) {
258 if (ci->enabled_otg_timer_bits == 0) {
259 spin_unlock_irqrestore(&ci->lock, flags);
260 /* No enabled timers after delete it */
261 hrtimer_cancel(&ci->otg_fsm_hrtimer);
262 spin_lock_irqsave(&ci->lock, flags);
263 ci->next_otg_timer = NUM_OTG_FSM_TIMERS;
265 /* Find the next timer */
266 enabled_timer_bits = ci->enabled_otg_timer_bits;
267 for_each_set_bit(cur_timer, &enabled_timer_bits,
268 NUM_OTG_FSM_TIMERS) {
269 if ((next_timer == NUM_OTG_FSM_TIMERS) ||
270 ktime_before(ci->hr_timeouts[next_timer],
271 ci->hr_timeouts[cur_timer]))
272 next_timer = cur_timer;
276 if (next_timer != NUM_OTG_FSM_TIMERS) {
277 ci->next_otg_timer = next_timer;
278 hrtimer_start_range_ns(&ci->otg_fsm_hrtimer,
279 ci->hr_timeouts[next_timer], NSEC_PER_MSEC,
282 spin_unlock_irqrestore(&ci->lock, flags);
285 /* OTG FSM timer handlers */
286 static int a_wait_vrise_tmout(struct ci_hdrc *ci)
288 ci->fsm.a_wait_vrise_tmout = 1;
292 static int a_wait_vfall_tmout(struct ci_hdrc *ci)
294 ci->fsm.a_wait_vfall_tmout = 1;
298 static int a_wait_bcon_tmout(struct ci_hdrc *ci)
300 ci->fsm.a_wait_bcon_tmout = 1;
304 static int a_aidl_bdis_tmout(struct ci_hdrc *ci)
306 ci->fsm.a_aidl_bdis_tmout = 1;
310 static int b_ase0_brst_tmout(struct ci_hdrc *ci)
312 ci->fsm.b_ase0_brst_tmout = 1;
316 static int a_bidl_adis_tmout(struct ci_hdrc *ci)
318 ci->fsm.a_bidl_adis_tmout = 1;
322 static int b_aidl_bdis_tmout(struct ci_hdrc *ci)
324 ci->fsm.a_bus_suspend = 1;
328 static int b_se0_srp_tmout(struct ci_hdrc *ci)
330 ci->fsm.b_se0_srp = 1;
334 static int b_srp_fail_tmout(struct ci_hdrc *ci)
336 ci->fsm.b_srp_done = 1;
340 static int b_data_pls_tmout(struct ci_hdrc *ci)
342 ci->fsm.b_srp_done = 1;
343 ci->fsm.b_bus_req = 0;
344 if (ci->fsm.power_up)
345 ci->fsm.power_up = 0;
346 hw_write_otgsc(ci, OTGSC_HABA, 0);
347 pm_runtime_put(ci->dev);
351 static int b_ssend_srp_tmout(struct ci_hdrc *ci)
353 ci->fsm.b_ssend_srp = 1;
354 /* only vbus fall below B_sess_vld in b_idle state */
355 if (ci->fsm.otg->state == OTG_STATE_B_IDLE)
362 * Keep this list in the same order as timers indexed
363 * by enum otg_fsm_timer in include/linux/usb/otg-fsm.h
365 static int (*otg_timer_handlers[])(struct ci_hdrc *) = {
366 a_wait_vrise_tmout, /* A_WAIT_VRISE */
367 a_wait_vfall_tmout, /* A_WAIT_VFALL */
368 a_wait_bcon_tmout, /* A_WAIT_BCON */
369 a_aidl_bdis_tmout, /* A_AIDL_BDIS */
370 b_ase0_brst_tmout, /* B_ASE0_BRST */
371 a_bidl_adis_tmout, /* A_BIDL_ADIS */
372 b_aidl_bdis_tmout, /* B_AIDL_BDIS */
373 b_se0_srp_tmout, /* B_SE0_SRP */
374 b_srp_fail_tmout, /* B_SRP_FAIL */
375 NULL, /* A_WAIT_ENUM */
376 b_data_pls_tmout, /* B_DATA_PLS */
377 b_ssend_srp_tmout, /* B_SSEND_SRP */
381 * Enable the next nearest enabled timer if have
383 static enum hrtimer_restart ci_otg_hrtimer_func(struct hrtimer *t)
385 struct ci_hdrc *ci = container_of(t, struct ci_hdrc, otg_fsm_hrtimer);
386 ktime_t now, *timeout;
387 unsigned long enabled_timer_bits;
389 enum otg_fsm_timer cur_timer, next_timer = NUM_OTG_FSM_TIMERS;
392 spin_lock_irqsave(&ci->lock, flags);
393 enabled_timer_bits = ci->enabled_otg_timer_bits;
394 ci->next_otg_timer = NUM_OTG_FSM_TIMERS;
397 for_each_set_bit(cur_timer, &enabled_timer_bits, NUM_OTG_FSM_TIMERS) {
398 if (ktime_compare(now, ci->hr_timeouts[cur_timer]) >= 0) {
399 ci->enabled_otg_timer_bits &= ~(1 << cur_timer);
400 if (otg_timer_handlers[cur_timer])
401 ret = otg_timer_handlers[cur_timer](ci);
403 if ((next_timer == NUM_OTG_FSM_TIMERS) ||
404 ktime_before(ci->hr_timeouts[cur_timer],
405 ci->hr_timeouts[next_timer]))
406 next_timer = cur_timer;
409 /* Enable the next nearest timer */
410 if (next_timer < NUM_OTG_FSM_TIMERS) {
411 timeout = &ci->hr_timeouts[next_timer];
412 hrtimer_start_range_ns(&ci->otg_fsm_hrtimer, *timeout,
413 NSEC_PER_MSEC, HRTIMER_MODE_ABS);
414 ci->next_otg_timer = next_timer;
416 spin_unlock_irqrestore(&ci->lock, flags);
419 ci_otg_queue_work(ci);
421 return HRTIMER_NORESTART;
424 /* Initialize timers */
425 static int ci_otg_init_timers(struct ci_hdrc *ci)
427 hrtimer_init(&ci->otg_fsm_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
428 ci->otg_fsm_hrtimer.function = ci_otg_hrtimer_func;
433 /* -------------------------------------------------------------*/
434 /* Operations that will be called from OTG Finite State Machine */
435 /* -------------------------------------------------------------*/
436 static void ci_otg_fsm_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer t)
438 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
440 if (t < NUM_OTG_FSM_TIMERS)
441 ci_otg_add_timer(ci, t);
445 static void ci_otg_fsm_del_timer(struct otg_fsm *fsm, enum otg_fsm_timer t)
447 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
449 if (t < NUM_OTG_FSM_TIMERS)
450 ci_otg_del_timer(ci, t);
455 * A-device drive vbus: turn on vbus regulator and enable port power
456 * Data pulse irq should be disabled while vbus is on.
458 static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on)
461 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
465 hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_PP,
467 if (ci->platdata->reg_vbus) {
468 ret = regulator_enable(ci->platdata->reg_vbus);
471 "Failed to enable vbus regulator, ret=%d\n",
477 if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL)
478 usb_phy_vbus_on(ci->usb_phy);
480 /* Disable data pulse irq */
481 hw_write_otgsc(ci, OTGSC_DPIE, 0);
486 if (ci->platdata->reg_vbus)
487 regulator_disable(ci->platdata->reg_vbus);
489 if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL)
490 usb_phy_vbus_off(ci->usb_phy);
498 * Control data line by Run Stop bit.
500 static void ci_otg_loc_conn(struct otg_fsm *fsm, int on)
502 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
505 hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
507 hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
511 * Generate SOF by host.
512 * In host mode, controller will automatically send SOF.
513 * Suspend will block the data on the port.
515 * This is controlled through usbcore by usb autosuspend,
516 * so the usb device class driver need support autosuspend,
517 * otherwise the bus suspend will not happen.
519 static void ci_otg_loc_sof(struct otg_fsm *fsm, int on)
521 struct usb_device *udev;
526 udev = usb_hub_find_child(fsm->otg->host->root_hub, 1);
531 usb_disable_autosuspend(udev);
533 pm_runtime_set_autosuspend_delay(&udev->dev, 0);
534 usb_enable_autosuspend(udev);
539 * Start SRP pulsing by data-line pulsing,
540 * no v-bus pulsing followed
542 static void ci_otg_start_pulse(struct otg_fsm *fsm)
544 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
546 /* Hardware Assistant Data pulse */
547 hw_write_otgsc(ci, OTGSC_HADP, OTGSC_HADP);
549 pm_runtime_get(ci->dev);
550 ci_otg_add_timer(ci, B_DATA_PLS);
553 static int ci_otg_start_host(struct otg_fsm *fsm, int on)
555 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
559 ci_role_start(ci, CI_ROLE_HOST);
562 ci_role_start(ci, CI_ROLE_GADGET);
567 static int ci_otg_start_gadget(struct otg_fsm *fsm, int on)
569 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
572 usb_gadget_vbus_connect(&ci->gadget);
574 usb_gadget_vbus_disconnect(&ci->gadget);
579 static struct otg_fsm_ops ci_otg_ops = {
580 .drv_vbus = ci_otg_drv_vbus,
581 .loc_conn = ci_otg_loc_conn,
582 .loc_sof = ci_otg_loc_sof,
583 .start_pulse = ci_otg_start_pulse,
584 .add_timer = ci_otg_fsm_add_timer,
585 .del_timer = ci_otg_fsm_del_timer,
586 .start_host = ci_otg_start_host,
587 .start_gadget = ci_otg_start_gadget,
590 int ci_otg_fsm_work(struct ci_hdrc *ci)
593 * Don't do fsm transition for B device
594 * when there is no gadget class driver
596 if (ci->fsm.id && !(ci->driver) &&
597 ci->fsm.otg->state < OTG_STATE_A_IDLE)
600 pm_runtime_get_sync(ci->dev);
601 if (otg_statemachine(&ci->fsm)) {
602 if (ci->fsm.otg->state == OTG_STATE_A_IDLE) {
604 * Further state change for cases:
605 * a_idle to b_idle; or
606 * a_idle to a_wait_vrise due to ID change(1->0), so
607 * B-dev becomes A-dev can try to start new session
609 * a_idle to a_wait_vrise when power up
611 if ((ci->fsm.id) || (ci->id_event) ||
612 (ci->fsm.power_up)) {
613 ci_otg_queue_work(ci);
615 /* Enable data pulse irq */
616 hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS |
618 hw_write_otgsc(ci, OTGSC_DPIS, OTGSC_DPIS);
619 hw_write_otgsc(ci, OTGSC_DPIE, OTGSC_DPIE);
622 ci->id_event = false;
623 } else if (ci->fsm.otg->state == OTG_STATE_B_IDLE) {
624 if (ci->fsm.b_sess_vld) {
625 ci->fsm.power_up = 0;
627 * Further transite to b_periphearl state
628 * when register gadget driver with vbus on
630 ci_otg_queue_work(ci);
632 } else if (ci->fsm.otg->state == OTG_STATE_A_HOST) {
633 pm_runtime_mark_last_busy(ci->dev);
634 pm_runtime_put_autosuspend(ci->dev);
638 pm_runtime_put_sync(ci->dev);
643 * Update fsm variables in each state if catching expected interrupts,
644 * called by otg fsm isr.
646 static void ci_otg_fsm_event(struct ci_hdrc *ci)
648 u32 intr_sts, otg_bsess_vld, port_conn;
649 struct otg_fsm *fsm = &ci->fsm;
651 intr_sts = hw_read_intr_status(ci);
652 otg_bsess_vld = hw_read_otgsc(ci, OTGSC_BSV);
653 port_conn = hw_read(ci, OP_PORTSC, PORTSC_CCS);
655 switch (ci->fsm.otg->state) {
656 case OTG_STATE_A_WAIT_BCON:
660 ci_otg_queue_work(ci);
663 case OTG_STATE_B_IDLE:
664 if (otg_bsess_vld && (intr_sts & USBi_PCI) && port_conn) {
666 ci_otg_queue_work(ci);
669 case OTG_STATE_B_PERIPHERAL:
670 if ((intr_sts & USBi_SLI) && port_conn && otg_bsess_vld) {
671 ci_otg_add_timer(ci, B_AIDL_BDIS);
672 } else if (intr_sts & USBi_PCI) {
673 ci_otg_del_timer(ci, B_AIDL_BDIS);
674 if (fsm->a_bus_suspend == 1)
675 fsm->a_bus_suspend = 0;
678 case OTG_STATE_B_HOST:
679 if ((intr_sts & USBi_PCI) && !port_conn) {
682 ci_otg_queue_work(ci);
685 case OTG_STATE_A_PERIPHERAL:
686 if (intr_sts & USBi_SLI) {
687 fsm->b_bus_suspend = 1;
689 * Init a timer to know how long this suspend
690 * will continue, if time out, indicates B no longer
691 * wants to be host role
693 ci_otg_add_timer(ci, A_BIDL_ADIS);
696 if (intr_sts & USBi_URI)
697 ci_otg_del_timer(ci, A_BIDL_ADIS);
699 if (intr_sts & USBi_PCI) {
700 if (fsm->b_bus_suspend == 1) {
701 ci_otg_del_timer(ci, A_BIDL_ADIS);
702 fsm->b_bus_suspend = 0;
706 case OTG_STATE_A_SUSPEND:
707 if ((intr_sts & USBi_PCI) && !port_conn) {
710 /* if gadget driver is binded */
712 /* A device to be peripheral mode */
713 ci->gadget.is_a_peripheral = 1;
715 ci_otg_queue_work(ci);
718 case OTG_STATE_A_HOST:
719 if ((intr_sts & USBi_PCI) && !port_conn) {
721 ci_otg_queue_work(ci);
724 case OTG_STATE_B_WAIT_ACON:
725 if ((intr_sts & USBi_PCI) && port_conn) {
727 ci_otg_queue_work(ci);
736 * ci_otg_irq - otg fsm related irq handling
737 * and also update otg fsm variable by monitoring usb host and udc
738 * state change interrupts.
741 irqreturn_t ci_otg_fsm_irq(struct ci_hdrc *ci)
743 irqreturn_t retval = IRQ_NONE;
744 u32 otgsc, otg_int_src = 0;
745 struct otg_fsm *fsm = &ci->fsm;
747 otgsc = hw_read_otgsc(ci, ~0);
748 otg_int_src = otgsc & OTGSC_INT_STATUS_BITS & (otgsc >> 8);
749 fsm->id = (otgsc & OTGSC_ID) ? 1 : 0;
752 if (otg_int_src & OTGSC_DPIS) {
753 hw_write_otgsc(ci, OTGSC_DPIS, OTGSC_DPIS);
756 } else if (otg_int_src & OTGSC_IDIS) {
757 hw_write_otgsc(ci, OTGSC_IDIS, OTGSC_IDIS);
763 } else if (otg_int_src & OTGSC_BSVIS) {
764 hw_write_otgsc(ci, OTGSC_BSVIS, OTGSC_BSVIS);
765 if (otgsc & OTGSC_BSV) {
767 ci_otg_del_timer(ci, B_SSEND_SRP);
768 ci_otg_del_timer(ci, B_SRP_FAIL);
769 fsm->b_ssend_srp = 0;
773 ci_otg_add_timer(ci, B_SSEND_SRP);
775 } else if (otg_int_src & OTGSC_AVVIS) {
776 hw_write_otgsc(ci, OTGSC_AVVIS, OTGSC_AVVIS);
777 if (otgsc & OTGSC_AVV) {
784 ci_otg_queue_work(ci);
788 ci_otg_fsm_event(ci);
793 void ci_hdrc_otg_fsm_start(struct ci_hdrc *ci)
795 ci_otg_queue_work(ci);
798 int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci)
803 ci->otg.phy = ci->phy;
805 ci->otg.usb_phy = ci->usb_phy;
807 ci->otg.gadget = &ci->gadget;
808 ci->fsm.otg = &ci->otg;
809 ci->fsm.power_up = 1;
810 ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0;
811 ci->fsm.otg->state = OTG_STATE_UNDEFINED;
812 ci->fsm.ops = &ci_otg_ops;
813 ci->gadget.hnp_polling_support = 1;
814 ci->fsm.host_req_flag = devm_kzalloc(ci->dev, 1, GFP_KERNEL);
815 if (!ci->fsm.host_req_flag)
818 mutex_init(&ci->fsm.lock);
820 retval = ci_otg_init_timers(ci);
822 dev_err(ci->dev, "Couldn't init OTG timers\n");
825 ci->enabled_otg_timer_bits = 0;
826 ci->next_otg_timer = NUM_OTG_FSM_TIMERS;
828 retval = sysfs_create_group(&ci->dev->kobj, &inputs_attr_group);
831 "Can't register sysfs attr group: %d\n", retval);
835 /* Enable A vbus valid irq */
836 hw_write_otgsc(ci, OTGSC_AVVIE, OTGSC_AVVIE);
839 ci->fsm.b_ssend_srp =
840 hw_read_otgsc(ci, OTGSC_BSV) ? 0 : 1;
842 hw_read_otgsc(ci, OTGSC_BSV) ? 1 : 0;
844 hw_write_otgsc(ci, OTGSC_BSVIE, OTGSC_BSVIE);
850 void ci_hdrc_otg_fsm_remove(struct ci_hdrc *ci)
852 sysfs_remove_group(&ci->dev->kobj, &inputs_attr_group);