Lines Matching +full:clk +full:- +full:out +full:- +full:frequency +full:- +full:hz

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright 2010-2014 Imagination Technologies Ltd.
7 * This ties into the input subsystem using the RC-core. Protocol support is
14 #include <linux/clk.h>
18 #include <media/rc-core.h>
19 #include "img-ir.h"
68 if (range->max < range->min) in img_ir_timing_preprocess()
69 range->max = range->min; in img_ir_timing_preprocess()
72 range->min = (range->min*unit)/1000; in img_ir_timing_preprocess()
73 range->max = (range->max*unit + 999)/1000; /* round up */ in img_ir_timing_preprocess()
80 img_ir_timing_preprocess(&timing->pulse, unit); in img_ir_symbol_timing_preprocess()
81 img_ir_timing_preprocess(&timing->space, unit); in img_ir_symbol_timing_preprocess()
87 img_ir_symbol_timing_preprocess(&timings->ldr, unit); in img_ir_timings_preprocess()
88 img_ir_symbol_timing_preprocess(&timings->s00, unit); in img_ir_timings_preprocess()
89 img_ir_symbol_timing_preprocess(&timings->s01, unit); in img_ir_timings_preprocess()
90 img_ir_symbol_timing_preprocess(&timings->s10, unit); in img_ir_timings_preprocess()
91 img_ir_symbol_timing_preprocess(&timings->s11, unit); in img_ir_timings_preprocess()
95 timings->ft.ft_min = (timings->ft.ft_min*unit + 999)/1000; in img_ir_timings_preprocess()
103 if (!range->min) in img_ir_timing_defaults()
104 range->min = defaults->min; in img_ir_timing_defaults()
105 if (!range->max) in img_ir_timing_defaults()
106 range->max = defaults->max; in img_ir_timing_defaults()
112 img_ir_timing_defaults(&timing->pulse, &defaults->pulse); in img_ir_symbol_timing_defaults()
113 img_ir_timing_defaults(&timing->space, &defaults->space); in img_ir_symbol_timing_defaults()
119 img_ir_symbol_timing_defaults(&timings->ldr, &defaults->ldr); in img_ir_timings_defaults()
120 img_ir_symbol_timing_defaults(&timings->s00, &defaults->s00); in img_ir_timings_defaults()
121 img_ir_symbol_timing_defaults(&timings->s01, &defaults->s01); in img_ir_timings_defaults()
122 img_ir_symbol_timing_defaults(&timings->s10, &defaults->s10); in img_ir_timings_defaults()
123 img_ir_symbol_timing_defaults(&timings->s11, &defaults->s11); in img_ir_timings_defaults()
124 if (!timings->ft.ft_min) in img_ir_timings_defaults()
125 timings->ft.ft_min = defaults->ft.ft_min; in img_ir_timings_defaults()
131 * img_ir_control() - Convert control struct to control register value.
138 u32 ctrl = control->code_type << IMG_IR_CODETYPE_SHIFT; in img_ir_control()
139 if (control->decoden) in img_ir_control()
141 if (control->hdrtog) in img_ir_control()
143 if (control->ldrdec) in img_ir_control()
145 if (control->decodinpol) in img_ir_control()
147 if (control->bitorien) in img_ir_control()
149 if (control->d1validsel) in img_ir_control()
151 if (control->bitinv) in img_ir_control()
153 if (control->decodend2) in img_ir_control()
155 if (control->bitoriend2) in img_ir_control()
157 if (control->bitinvd2) in img_ir_control()
163 * img_ir_timing_range_convert() - Convert microsecond range.
164 * @out: Output timing range in clock cycles with a shift.
167 * @clock_hz: IR clock rate in Hz.
172 * Note that in and out can safely be the same object.
174 static void img_ir_timing_range_convert(struct img_ir_timing_range *out, in img_ir_timing_range_convert() argument
180 unsigned int min = in->min; in img_ir_timing_range_convert()
181 unsigned int max = in->max; in img_ir_timing_range_convert()
183 min = min - (min*tolerance >> 7); in img_ir_timing_range_convert()
189 out->min = min >> shift; in img_ir_timing_range_convert()
190 out->max = (max + ((1 << shift) - 1)) >> shift; /* round up */ in img_ir_timing_range_convert()
194 * img_ir_symbol_timing() - Convert symbol timing struct to register value.
196 * @tolerance: Timing tolerance where 0-128 represents 0-100%
197 * @clock_hz: Frequency of source clock in Hz
211 hw_period.min = timing->pulse.min + timing->space.min; in img_ir_symbol_timing()
212 hw_period.max = timing->pulse.max + timing->space.max; in img_ir_symbol_timing()
215 img_ir_timing_range_convert(&hw_pulse, &timing->pulse, in img_ir_symbol_timing()
225 * img_ir_free_timing() - Convert free time timing struct to register value.
227 * @clock_hz: Source clock frequency in Hz
236 if (timing->minlen < 30) in img_ir_free_timing()
237 minlen = timing->minlen & -2; in img_ir_free_timing()
241 if (timing->maxlen < 48) in img_ir_free_timing()
242 maxlen = (timing->maxlen + 1) & -2; in img_ir_free_timing()
246 ft_min = (timing->ft_min*clock_hz + 999999) / 1000000; in img_ir_free_timing()
255 * img_ir_free_timing_dynamic() - Update free time register value.
266 newminlen = filter->minlen & -2; in img_ir_free_timing_dynamic()
267 newmaxlen = (filter->maxlen + 1) & -2; in img_ir_free_timing_dynamic()
284 * img_ir_timings_convert() - Convert timings to register values
287 * @tolerance: Timing tolerance where 0-128 represents 0-100%
288 * @clock_hz: Source clock frequency in Hz
296 regs->ldr = img_ir_symbol_timing(&timings->ldr, tolerance, clock_hz, in img_ir_timings_convert()
299 regs->s00 = img_ir_symbol_timing(&timings->s00, tolerance, clock_hz, in img_ir_timings_convert()
301 regs->s01 = img_ir_symbol_timing(&timings->s01, tolerance, clock_hz, in img_ir_timings_convert()
303 regs->s10 = img_ir_symbol_timing(&timings->s10, tolerance, clock_hz, in img_ir_timings_convert()
305 regs->s11 = img_ir_symbol_timing(&timings->s11, tolerance, clock_hz, in img_ir_timings_convert()
307 regs->ft = img_ir_free_timing(&timings->ft, clock_hz); in img_ir_timings_convert()
311 * img_ir_decoder_preprocess() - Preprocess timings in decoder.
320 if (!decoder->tolerance) in img_ir_decoder_preprocess()
321 decoder->tolerance = 10; /* percent */ in img_ir_decoder_preprocess()
322 /* and convert tolerance to fraction out of 128 */ in img_ir_decoder_preprocess()
323 decoder->tolerance = decoder->tolerance * 128 / 100; in img_ir_decoder_preprocess()
326 img_ir_timings_preprocess(&decoder->timings, decoder->unit); in img_ir_decoder_preprocess()
329 if (decoder->repeat) { in img_ir_decoder_preprocess()
330 img_ir_timings_preprocess(&decoder->rtimings, decoder->unit); in img_ir_decoder_preprocess()
331 img_ir_timings_defaults(&decoder->rtimings, &decoder->timings); in img_ir_decoder_preprocess()
336 * img_ir_decoder_convert() - Generate internal timings in decoder.
339 * @clock_hz: IR clock rate in Hz.
341 * Fills out the repeat timings and timing register values for a specific clock
349 reg_timings->ctrl = img_ir_control(&decoder->control); in img_ir_decoder_convert()
352 img_ir_timings_convert(&reg_timings->timings, &decoder->timings, in img_ir_decoder_convert()
353 decoder->tolerance, clock_hz); in img_ir_decoder_convert()
356 if (decoder->repeat) in img_ir_decoder_convert()
357 img_ir_timings_convert(&reg_timings->rtimings, in img_ir_decoder_convert()
358 &decoder->rtimings, decoder->tolerance, in img_ir_decoder_convert()
363 * img_ir_write_timings() - Write timings to the hardware now
376 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_write_timings()
379 u32 ft = regs->ft; in img_ir_write_timings()
380 if (hw->flags & BIT(type)) in img_ir_write_timings()
381 ft = img_ir_free_timing_dynamic(regs->ft, &hw->filters[type]); in img_ir_write_timings()
383 img_ir_write(priv, IMG_IR_LEAD_SYMB_TIMING, regs->ldr); in img_ir_write_timings()
384 img_ir_write(priv, IMG_IR_S00_SYMB_TIMING, regs->s00); in img_ir_write_timings()
385 img_ir_write(priv, IMG_IR_S01_SYMB_TIMING, regs->s01); in img_ir_write_timings()
386 img_ir_write(priv, IMG_IR_S10_SYMB_TIMING, regs->s10); in img_ir_write_timings()
387 img_ir_write(priv, IMG_IR_S11_SYMB_TIMING, regs->s11); in img_ir_write_timings()
389 dev_dbg(priv->dev, "timings: ldr=%#x, s=[%#x, %#x, %#x, %#x], ft=%#x\n", in img_ir_write_timings()
390 regs->ldr, regs->s00, regs->s01, regs->s10, regs->s11, ft); in img_ir_write_timings()
397 dev_dbg(priv->dev, "IR filter=%016llx & %016llx\n", in img_ir_write_filter()
398 (unsigned long long)filter->data, in img_ir_write_filter()
399 (unsigned long long)filter->mask); in img_ir_write_filter()
400 img_ir_write(priv, IMG_IR_IRQ_MSG_DATA_LW, (u32)filter->data); in img_ir_write_filter()
401 img_ir_write(priv, IMG_IR_IRQ_MSG_DATA_UP, (u32)(filter->data in img_ir_write_filter()
403 img_ir_write(priv, IMG_IR_IRQ_MSG_MASK_LW, (u32)filter->mask); in img_ir_write_filter()
404 img_ir_write(priv, IMG_IR_IRQ_MSG_MASK_UP, (u32)(filter->mask in img_ir_write_filter()
407 dev_dbg(priv->dev, "IR clearing filter\n"); in img_ir_write_filter()
417 struct img_ir_priv_hw *hw = &priv->hw; in _img_ir_set_filter()
423 hw->filters[RC_FILTER_NORMAL] = *filter; in _img_ir_set_filter()
424 hw->flags |= IMG_IR_F_FILTER; in _img_ir_set_filter()
429 hw->flags &= ~IMG_IR_F_FILTER; in _img_ir_set_filter()
445 struct img_ir_priv_hw *hw = &priv->hw; in _img_ir_set_wake_filter()
448 hw->filters[RC_FILTER_WAKEUP] = *filter; in _img_ir_set_wake_filter()
449 hw->flags |= IMG_IR_F_WAKE; in _img_ir_set_wake_filter()
452 hw->flags &= ~IMG_IR_F_WAKE; in _img_ir_set_wake_filter()
460 struct img_ir_priv *priv = dev->priv; in img_ir_set_filter()
461 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_set_filter()
465 dev_dbg(priv->dev, "IR scancode %sfilter=%08x & %08x\n", in img_ir_set_filter()
467 sc_filter->data, in img_ir_set_filter()
468 sc_filter->mask); in img_ir_set_filter()
470 spin_lock_irq(&priv->lock); in img_ir_set_filter()
473 if (!sc_filter->mask) { in img_ir_set_filter()
479 if (!hw->decoder || !hw->decoder->filter) { in img_ir_set_filter()
480 ret = -EINVAL; in img_ir_set_filter()
489 ret = hw->decoder->filter(sc_filter, &filter, in img_ir_set_filter()
490 dev->enabled_protocols); in img_ir_set_filter()
493 ret = hw->decoder->filter(sc_filter, &filter, in img_ir_set_filter()
494 1ULL << dev->wakeup_protocol); in img_ir_set_filter()
498 dev_dbg(priv->dev, "IR raw %sfilter=%016llx & %016llx\n", in img_ir_set_filter()
513 ret = -EINVAL; in img_ir_set_filter()
517 spin_unlock_irq(&priv->lock); in img_ir_set_filter()
534 * img_ir_set_decoder() - Set the current decoder.
537 * @proto: Protocol bitmap (or 0 to use decoder->type).
543 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_set_decoder()
544 struct rc_dev *rdev = hw->rdev; in img_ir_set_decoder()
546 spin_lock_irq(&priv->lock); in img_ir_set_decoder()
552 hw->stopping = true; in img_ir_set_decoder()
558 spin_unlock_irq(&priv->lock); in img_ir_set_decoder()
559 del_timer_sync(&hw->end_timer); in img_ir_set_decoder()
560 del_timer_sync(&hw->suspend_timer); in img_ir_set_decoder()
561 spin_lock_irq(&priv->lock); in img_ir_set_decoder()
563 hw->stopping = false; in img_ir_set_decoder()
583 hw->mode = IMG_IR_M_NORMAL; in img_ir_set_decoder()
586 rdev->scancode_wakeup_filter.data = 0; in img_ir_set_decoder()
587 rdev->scancode_wakeup_filter.mask = 0; in img_ir_set_decoder()
588 rdev->wakeup_protocol = RC_PROTO_UNKNOWN; in img_ir_set_decoder()
595 hw->enabled_protocols = 0; in img_ir_set_decoder()
598 hw->decoder = decoder; in img_ir_set_decoder()
604 proto = decoder->type; in img_ir_set_decoder()
605 hw->enabled_protocols = proto; in img_ir_set_decoder()
608 img_ir_decoder_convert(decoder, &hw->reg_timings, hw->clk_hz); in img_ir_set_decoder()
609 img_ir_write_timings(priv, &hw->reg_timings.timings, RC_FILTER_NORMAL); in img_ir_set_decoder()
612 img_ir_write(priv, IMG_IR_CONTROL, hw->reg_timings.ctrl); in img_ir_set_decoder()
616 spin_unlock_irq(&priv->lock); in img_ir_set_decoder()
620 * img_ir_decoder_compatible() - Find whether a decoder will work with a device.
632 ct = dec->control.code_type; in img_ir_decoder_compatible()
633 if (priv->hw.ct_quirks[ct] & IMG_IR_QUIRK_CODE_BROKEN) in img_ir_decoder_compatible()
640 * img_ir_allowed_protos() - Get allowed protocols from global decoder list.
653 protos |= dec->type; in img_ir_allowed_protos()
661 struct img_ir_priv *priv = dev->priv; in img_ir_change_protocol()
662 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_change_protocol()
663 struct rc_dev *rdev = hw->rdev; in img_ir_change_protocol()
676 if (*ir_type & dec->type) { in img_ir_change_protocol()
677 *ir_type &= dec->type; in img_ir_change_protocol()
682 return -EINVAL; in img_ir_change_protocol()
690 if (!hw->decoder || !hw->decoder->filter) in img_ir_change_protocol()
692 rdev->allowed_wakeup_protocols = wakeup_protocols; in img_ir_change_protocol()
696 /* Changes ir-core protocol device attribute */
699 struct rc_dev *rdev = priv->hw.rdev; in img_ir_set_protocol()
701 mutex_lock(&rdev->lock); in img_ir_set_protocol()
702 rdev->enabled_protocols = proto; in img_ir_set_protocol()
703 rdev->allowed_wakeup_protocols = proto; in img_ir_set_protocol()
704 mutex_unlock(&rdev->lock); in img_ir_set_protocol()
723 * img_ir_enable_wake() - Switch to wake mode.
726 * Returns: non-zero if the IR can wake the system.
730 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_enable_wake()
733 spin_lock_irq(&priv->lock); in img_ir_enable_wake()
734 if (hw->flags & IMG_IR_F_WAKE) { in img_ir_enable_wake()
736 hw->suspend_irqen = img_ir_read(priv, IMG_IR_IRQ_ENABLE); in img_ir_enable_wake()
738 img_ir_write_filter(priv, &hw->filters[RC_FILTER_WAKEUP]); in img_ir_enable_wake()
739 img_ir_write_timings(priv, &hw->reg_timings.timings, in img_ir_enable_wake()
741 hw->mode = IMG_IR_M_WAKE; in img_ir_enable_wake()
744 spin_unlock_irq(&priv->lock); in img_ir_enable_wake()
749 * img_ir_disable_wake() - Switch out of wake mode.
757 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_disable_wake()
760 spin_lock_irq(&priv->lock); in img_ir_disable_wake()
761 if (hw->flags & IMG_IR_F_WAKE) { in img_ir_disable_wake()
763 if (hw->flags & IMG_IR_F_FILTER) { in img_ir_disable_wake()
765 (hw->suspend_irqen & IMG_IR_IRQ_EDGE) | in img_ir_disable_wake()
768 &hw->filters[RC_FILTER_NORMAL]); in img_ir_disable_wake()
771 (hw->suspend_irqen & IMG_IR_IRQ_EDGE) | in img_ir_disable_wake()
776 img_ir_write_timings(priv, &hw->reg_timings.timings, in img_ir_disable_wake()
778 hw->mode = IMG_IR_M_NORMAL; in img_ir_disable_wake()
781 spin_unlock_irq(&priv->lock); in img_ir_disable_wake()
789 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_begin_repeat()
790 if (hw->mode == IMG_IR_M_NORMAL) { in img_ir_begin_repeat()
793 hw->mode = IMG_IR_M_REPEATING; in img_ir_begin_repeat()
794 img_ir_write_timings(priv, &hw->reg_timings.rtimings, in img_ir_begin_repeat()
796 img_ir_write(priv, IMG_IR_CONTROL, hw->reg_timings.ctrl); in img_ir_begin_repeat()
803 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_end_repeat()
804 if (hw->mode == IMG_IR_M_REPEATING) { in img_ir_end_repeat()
807 hw->mode = IMG_IR_M_NORMAL; in img_ir_end_repeat()
808 img_ir_write_timings(priv, &hw->reg_timings.timings, in img_ir_end_repeat()
810 img_ir_write(priv, IMG_IR_CONTROL, hw->reg_timings.ctrl); in img_ir_end_repeat()
817 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_handle_data()
818 const struct img_ir_decoder *dec = hw->decoder; in img_ir_handle_data()
825 if (dec->scancode) in img_ir_handle_data()
826 ret = dec->scancode(len, raw, hw->enabled_protocols, &request); in img_ir_handle_data()
830 request.scancode = (u32)raw & ((1 << len)-1); in img_ir_handle_data()
831 dev_dbg(priv->dev, "data (%u bits) = %#llx\n", in img_ir_handle_data()
834 dev_dbg(priv->dev, "decoded scan code %#x, toggle %u\n", in img_ir_handle_data()
836 rc_keydown(hw->rdev, request.protocol, request.scancode, in img_ir_handle_data()
840 if (hw->mode == IMG_IR_M_REPEATING) { in img_ir_handle_data()
841 dev_dbg(priv->dev, "decoded repeat code\n"); in img_ir_handle_data()
842 rc_repeat(hw->rdev); in img_ir_handle_data()
844 dev_dbg(priv->dev, "decoded unexpected repeat code, ignoring\n"); in img_ir_handle_data()
847 dev_dbg(priv->dev, "decode failed (%d)\n", ret); in img_ir_handle_data()
853 if (dec->repeat && !hw->stopping) { in img_ir_handle_data()
859 interval = dec->repeat + (dec->repeat >> 3); in img_ir_handle_data()
860 mod_timer(&hw->end_timer, in img_ir_handle_data()
870 spin_lock_irq(&priv->lock); in img_ir_end_timer()
872 spin_unlock_irq(&priv->lock); in img_ir_end_timer()
876 * Timer function to re-enable the current protocol after it had been
878 * img-ir decoder.
884 spin_lock_irq(&priv->lock); in img_ir_suspend_timer()
889 if ((priv->hw.quirk_suspend_irq & IMG_IR_IRQ_EDGE) == in img_ir_suspend_timer()
892 priv->hw.quirk_suspend_irq); in img_ir_suspend_timer()
894 img_ir_write(priv, IMG_IR_CONTROL, priv->hw.reg_timings.ctrl); in img_ir_suspend_timer()
895 spin_unlock_irq(&priv->lock); in img_ir_suspend_timer()
902 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_change_frequency()
904 dev_dbg(priv->dev, "clk changed %lu HZ -> %lu HZ\n", in img_ir_change_frequency()
905 change->old_rate, change->new_rate); in img_ir_change_frequency()
907 spin_lock_irq(&priv->lock); in img_ir_change_frequency()
908 if (hw->clk_hz == change->new_rate) in img_ir_change_frequency()
910 hw->clk_hz = change->new_rate; in img_ir_change_frequency()
912 if (hw->decoder) { in img_ir_change_frequency()
913 img_ir_decoder_convert(hw->decoder, &hw->reg_timings, in img_ir_change_frequency()
914 hw->clk_hz); in img_ir_change_frequency()
915 switch (hw->mode) { in img_ir_change_frequency()
917 img_ir_write_timings(priv, &hw->reg_timings.timings, in img_ir_change_frequency()
921 img_ir_write_timings(priv, &hw->reg_timings.rtimings, in img_ir_change_frequency()
926 img_ir_write_timings(priv, &hw->reg_timings.timings, in img_ir_change_frequency()
933 spin_unlock_irq(&priv->lock); in img_ir_change_frequency()
952 /* called with priv->lock held */
955 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_isr_hw()
960 if (!hw->decoder) in img_ir_isr_hw()
963 ct = hw->decoder->control.code_type; in img_ir_isr_hw()
967 if (!(priv->hw.ct_quirks[ct] & IMG_IR_QUIRK_CODE_IRQ) || in img_ir_isr_hw()
968 hw->stopping) in img_ir_isr_hw()
977 * rapidly generated. only way to get out of this loop is to in img_ir_isr_hw()
981 hw->quirk_suspend_irq = img_ir_read(priv, IMG_IR_IRQ_ENABLE); in img_ir_isr_hw()
983 hw->quirk_suspend_irq & IMG_IR_IRQ_EDGE); in img_ir_isr_hw()
985 /* Timer activated to re-enable the protocol. */ in img_ir_isr_hw()
986 mod_timer(&hw->suspend_timer, in img_ir_isr_hw()
995 if (hw->ct_quirks[ct] & IMG_IR_QUIRK_CODE_LEN_INCR) in img_ir_isr_hw()
1007 if (!priv->hw.rdev) in img_ir_setup_hw()
1014 img_ir_set_protocol(priv, dec->type); in img_ir_setup_hw()
1023 * img_ir_probe_hw_caps() - Probe capabilities of the hardware.
1028 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_probe_hw_caps()
1033 hw->ct_quirks[IMG_IR_CODETYPE_PULSELEN] in img_ir_probe_hw_caps()
1035 hw->ct_quirks[IMG_IR_CODETYPE_BIPHASE] in img_ir_probe_hw_caps()
1037 hw->ct_quirks[IMG_IR_CODETYPE_2BITPULSEPOS] in img_ir_probe_hw_caps()
1043 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_probe_hw()
1054 timer_setup(&hw->end_timer, img_ir_end_timer, 0); in img_ir_probe_hw()
1055 timer_setup(&hw->suspend_timer, img_ir_suspend_timer, 0); in img_ir_probe_hw()
1058 if (!IS_ERR(priv->clk)) { in img_ir_probe_hw()
1059 hw->clk_hz = clk_get_rate(priv->clk); in img_ir_probe_hw()
1061 hw->clk_nb.notifier_call = img_ir_clk_notify; in img_ir_probe_hw()
1062 error = clk_notifier_register(priv->clk, &hw->clk_nb); in img_ir_probe_hw()
1064 dev_warn(priv->dev, in img_ir_probe_hw()
1068 hw->clk_hz = 32768; in img_ir_probe_hw()
1072 hw->rdev = rdev = rc_allocate_device(RC_DRIVER_SCANCODE); in img_ir_probe_hw()
1074 dev_err(priv->dev, "cannot allocate input device\n"); in img_ir_probe_hw()
1075 error = -ENOMEM; in img_ir_probe_hw()
1078 rdev->priv = priv; in img_ir_probe_hw()
1079 rdev->map_name = RC_MAP_EMPTY; in img_ir_probe_hw()
1080 rdev->allowed_protocols = img_ir_allowed_protos(priv); in img_ir_probe_hw()
1081 rdev->device_name = "IMG Infrared Decoder"; in img_ir_probe_hw()
1082 rdev->s_filter = img_ir_set_normal_filter; in img_ir_probe_hw()
1083 rdev->s_wakeup_filter = img_ir_set_wakeup_filter; in img_ir_probe_hw()
1088 dev_err(priv->dev, "failed to register IR input device\n"); in img_ir_probe_hw()
1096 rdev->change_protocol = img_ir_change_protocol; in img_ir_probe_hw()
1098 device_init_wakeup(priv->dev, 1); in img_ir_probe_hw()
1104 hw->rdev = NULL; in img_ir_probe_hw()
1108 if (!IS_ERR(priv->clk)) in img_ir_probe_hw()
1109 clk_notifier_unregister(priv->clk, &hw->clk_nb); in img_ir_probe_hw()
1116 struct img_ir_priv_hw *hw = &priv->hw; in img_ir_remove_hw()
1117 struct rc_dev *rdev = hw->rdev; in img_ir_remove_hw()
1121 hw->rdev = NULL; in img_ir_remove_hw()
1124 if (!IS_ERR(priv->clk)) in img_ir_remove_hw()
1125 clk_notifier_unregister(priv->clk, &hw->clk_nb); in img_ir_remove_hw()
1135 enable_irq_wake(priv->irq); in img_ir_suspend()
1144 disable_irq_wake(priv->irq); in img_ir_resume()