Lines Matching defs:ir_state
130 return state ? state->ir_state : NULL;
500 struct cx25840_ir_state *ir_state = to_ir_state(sd);
511 if (ir_state == NULL)
514 c = ir_state->c;
588 k = kfifo_in_locked(&ir_state->rx_kfifo,
590 &ir_state->rx_kfifo_lock);
626 spin_lock_irqsave(&ir_state->rx_kfifo_lock, flags);
627 if (kfifo_len(&ir_state->rx_kfifo) >= CX25840_IR_RX_KFIFO_SIZE / 2)
629 spin_unlock_irqrestore(&ir_state->rx_kfifo_lock, flags);
640 struct cx25840_ir_state *ir_state = to_ir_state(sd);
647 if (ir_state == NULL)
650 invert = (bool) atomic_read(&ir_state->rx_invert);
651 divider = (u16) atomic_read(&ir_state->rxclk_divider);
660 n = kfifo_out_locked(&ir_state->rx_kfifo, buf, n,
661 &ir_state->rx_kfifo_lock);
695 struct cx25840_ir_state *ir_state = to_ir_state(sd);
697 if (ir_state == NULL)
700 mutex_lock(&ir_state->rx_params_lock);
701 memcpy(p, &ir_state->rx_params,
703 mutex_unlock(&ir_state->rx_params_lock);
709 struct cx25840_ir_state *ir_state = to_ir_state(sd);
712 if (ir_state == NULL)
715 c = ir_state->c;
716 mutex_lock(&ir_state->rx_params_lock);
726 ir_state->rx_params.shutdown = true;
728 mutex_unlock(&ir_state->rx_params_lock);
735 struct cx25840_ir_state *ir_state = to_ir_state(sd);
740 if (ir_state == NULL)
749 c = ir_state->c;
750 o = &ir_state->rx_params;
752 mutex_lock(&ir_state->rx_params_lock);
792 atomic_set(&ir_state->rxclk_divider, rxclk_divider);
806 atomic_set(&ir_state->rx_invert, p->invert_level);
813 spin_lock_irqsave(&ir_state->rx_kfifo_lock, flags);
814 kfifo_reset(&ir_state->rx_kfifo);
815 spin_unlock_irqrestore(&ir_state->rx_kfifo_lock, flags);
821 mutex_unlock(&ir_state->rx_params_lock);
829 struct cx25840_ir_state *ir_state = to_ir_state(sd);
832 if (ir_state == NULL)
835 c = ir_state->c;
845 struct cx25840_ir_state *ir_state = to_ir_state(sd);
847 if (ir_state == NULL)
850 mutex_lock(&ir_state->tx_params_lock);
851 memcpy(p, &ir_state->tx_params,
853 mutex_unlock(&ir_state->tx_params_lock);
859 struct cx25840_ir_state *ir_state = to_ir_state(sd);
862 if (ir_state == NULL)
865 c = ir_state->c;
866 mutex_lock(&ir_state->tx_params_lock);
874 ir_state->tx_params.shutdown = true;
876 mutex_unlock(&ir_state->tx_params_lock);
883 struct cx25840_ir_state *ir_state = to_ir_state(sd);
888 if (ir_state == NULL)
897 c = ir_state->c;
898 o = &ir_state->tx_params;
899 mutex_lock(&ir_state->tx_params_lock);
932 atomic_set(&ir_state->txclk_divider, txclk_divider);
953 mutex_unlock(&ir_state->tx_params_lock);
1149 struct cx25840_ir_state *ir_state;
1156 ir_state = kzalloc(sizeof(struct cx25840_ir_state), GFP_KERNEL);
1157 if (ir_state == NULL)
1160 spin_lock_init(&ir_state->rx_kfifo_lock);
1161 if (kfifo_alloc(&ir_state->rx_kfifo,
1163 kfree(ir_state);
1167 ir_state->c = state->c;
1168 state->ir_state = ir_state;
1172 cx25840_write4(ir_state->c, CX25840_IR_IRQEN_REG, IRQEN_MSK);
1174 cx25840_write4(ir_state->c, CX25840_IR_IRQEN_REG, 0);
1176 mutex_init(&ir_state->rx_params_lock);
1181 mutex_init(&ir_state->tx_params_lock);
1192 struct cx25840_ir_state *ir_state = to_ir_state(sd);
1194 if (ir_state == NULL)
1200 kfifo_free(&ir_state->rx_kfifo);
1201 kfree(ir_state);
1202 state->ir_state = NULL;