Lines Matching full:ir
3 * Driver for Amlogic Meson IR remote receiver
20 #define DRIVER_NAME "meson-ir"
68 static void meson_ir_set_mask(struct meson_ir *ir, unsigned int reg, in meson_ir_set_mask() argument
73 data = readl(ir->reg + reg); in meson_ir_set_mask()
76 writel(data, ir->reg + reg); in meson_ir_set_mask()
81 struct meson_ir *ir = dev_id; in meson_ir_irq() local
85 spin_lock(&ir->lock); in meson_ir_irq()
87 duration = readl_relaxed(ir->reg + IR_DEC_REG1); in meson_ir_irq()
91 status = readl_relaxed(ir->reg + IR_DEC_STATUS); in meson_ir_irq()
94 ir_raw_event_store_with_timeout(ir->rc, &rawir); in meson_ir_irq()
96 spin_unlock(&ir->lock); in meson_ir_irq()
106 struct meson_ir *ir; in meson_ir_probe() local
109 ir = devm_kzalloc(dev, sizeof(struct meson_ir), GFP_KERNEL); in meson_ir_probe()
110 if (!ir) in meson_ir_probe()
113 ir->reg = devm_platform_ioremap_resource(pdev, 0); in meson_ir_probe()
114 if (IS_ERR(ir->reg)) in meson_ir_probe()
115 return PTR_ERR(ir->reg); in meson_ir_probe()
121 ir->rc = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW); in meson_ir_probe()
122 if (!ir->rc) { in meson_ir_probe()
127 ir->rc->priv = ir; in meson_ir_probe()
128 ir->rc->device_name = DRIVER_NAME; in meson_ir_probe()
129 ir->rc->input_phys = DRIVER_NAME "/input0"; in meson_ir_probe()
130 ir->rc->input_id.bustype = BUS_HOST; in meson_ir_probe()
132 ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY; in meson_ir_probe()
133 ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; in meson_ir_probe()
134 ir->rc->rx_resolution = MESON_TRATE; in meson_ir_probe()
135 ir->rc->min_timeout = 1; in meson_ir_probe()
136 ir->rc->timeout = IR_DEFAULT_TIMEOUT; in meson_ir_probe()
137 ir->rc->max_timeout = 10 * IR_DEFAULT_TIMEOUT; in meson_ir_probe()
138 ir->rc->driver_name = DRIVER_NAME; in meson_ir_probe()
140 spin_lock_init(&ir->lock); in meson_ir_probe()
141 platform_set_drvdata(pdev, ir); in meson_ir_probe()
143 ret = devm_rc_register_device(dev, ir->rc); in meson_ir_probe()
149 ret = devm_request_irq(dev, irq, meson_ir_irq, 0, NULL, ir); in meson_ir_probe()
156 meson_ir_set_mask(ir, IR_DEC_REG1, REG1_RESET, REG1_RESET); in meson_ir_probe()
157 meson_ir_set_mask(ir, IR_DEC_REG1, REG1_RESET, 0); in meson_ir_probe()
160 if (of_device_is_compatible(node, "amlogic,meson6-ir")) in meson_ir_probe()
161 meson_ir_set_mask(ir, IR_DEC_REG1, REG1_MODE_MASK, in meson_ir_probe()
164 meson_ir_set_mask(ir, IR_DEC_REG2, REG2_MODE_MASK, in meson_ir_probe()
168 meson_ir_set_mask(ir, IR_DEC_REG0, REG0_RATE_MASK, MESON_TRATE - 1); in meson_ir_probe()
170 meson_ir_set_mask(ir, IR_DEC_REG1, REG1_IRQSEL_MASK, in meson_ir_probe()
173 meson_ir_set_mask(ir, IR_DEC_REG1, REG1_ENABLE, REG1_ENABLE); in meson_ir_probe()
182 struct meson_ir *ir = platform_get_drvdata(pdev); in meson_ir_remove() local
186 spin_lock_irqsave(&ir->lock, flags); in meson_ir_remove()
187 meson_ir_set_mask(ir, IR_DEC_REG1, REG1_ENABLE, 0); in meson_ir_remove()
188 spin_unlock_irqrestore(&ir->lock, flags); in meson_ir_remove()
197 struct meson_ir *ir = platform_get_drvdata(pdev); in meson_ir_shutdown() local
200 spin_lock_irqsave(&ir->lock, flags); in meson_ir_shutdown()
206 if (of_device_is_compatible(node, "amlogic,meson6-ir")) in meson_ir_shutdown()
207 meson_ir_set_mask(ir, IR_DEC_REG1, REG1_MODE_MASK, in meson_ir_shutdown()
210 meson_ir_set_mask(ir, IR_DEC_REG2, REG2_MODE_MASK, in meson_ir_shutdown()
214 meson_ir_set_mask(ir, IR_DEC_REG0, REG0_RATE_MASK, 0x13); in meson_ir_shutdown()
216 spin_unlock_irqrestore(&ir->lock, flags); in meson_ir_shutdown()
220 { .compatible = "amlogic,meson6-ir" },
221 { .compatible = "amlogic,meson8b-ir" },
222 { .compatible = "amlogic,meson-gxbb-ir" },
239 MODULE_DESCRIPTION("Amlogic Meson IR remote receiver driver");