Lines Matching +full:meson +full:- +full:gxbb +full:- +full:reset
1 // SPDX-License-Identifier: GPL-2.0
3 * Driver for Amlogic Meson IR remote receiver
18 #include <media/rc-core.h>
20 #define DRIVER_NAME "meson-ir"
22 /* valid on all Meson platforms */
31 /* only available on Meson 8b and newer */
39 /* Meson 6b uses REG1 to configure the mode */
43 /* Meson 8b / GXBB use REG2 to configure the mode */
73 data = readl(ir->reg + reg); in meson_ir_set_mask()
76 writel(data, ir->reg + reg); in meson_ir_set_mask()
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()
103 struct device *dev = &pdev->dev; in meson_ir_probe()
104 struct device_node *node = dev->of_node; in meson_ir_probe()
112 return -ENOMEM; in meson_ir_probe()
115 ir->reg = devm_ioremap_resource(dev, res); in meson_ir_probe()
116 if (IS_ERR(ir->reg)) in meson_ir_probe()
117 return PTR_ERR(ir->reg); in meson_ir_probe()
123 ir->rc = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW); in meson_ir_probe()
124 if (!ir->rc) { in meson_ir_probe()
126 return -ENOMEM; in meson_ir_probe()
129 ir->rc->priv = ir; in meson_ir_probe()
130 ir->rc->device_name = DRIVER_NAME; in meson_ir_probe()
131 ir->rc->input_phys = DRIVER_NAME "/input0"; in meson_ir_probe()
132 ir->rc->input_id.bustype = BUS_HOST; in meson_ir_probe()
133 map_name = of_get_property(node, "linux,rc-map-name", NULL); in meson_ir_probe()
134 ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY; in meson_ir_probe()
135 ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; in meson_ir_probe()
136 ir->rc->rx_resolution = MESON_TRATE; in meson_ir_probe()
137 ir->rc->min_timeout = 1; in meson_ir_probe()
138 ir->rc->timeout = IR_DEFAULT_TIMEOUT; in meson_ir_probe()
139 ir->rc->max_timeout = 10 * IR_DEFAULT_TIMEOUT; in meson_ir_probe()
140 ir->rc->driver_name = DRIVER_NAME; in meson_ir_probe()
142 spin_lock_init(&ir->lock); in meson_ir_probe()
145 ret = devm_rc_register_device(dev, ir->rc); in meson_ir_probe()
157 /* Reset the decoder */ in meson_ir_probe()
162 if (of_device_is_compatible(node, "amlogic,meson6-ir")) in meson_ir_probe()
170 meson_ir_set_mask(ir, IR_DEC_REG0, REG0_RATE_MASK, MESON_TRATE - 1); in meson_ir_probe()
188 spin_lock_irqsave(&ir->lock, flags); in meson_ir_remove()
190 spin_unlock_irqrestore(&ir->lock, flags); in meson_ir_remove()
197 struct device *dev = &pdev->dev; in meson_ir_shutdown()
198 struct device_node *node = dev->of_node; in meson_ir_shutdown()
202 spin_lock_irqsave(&ir->lock, flags); in meson_ir_shutdown()
208 if (of_device_is_compatible(node, "amlogic,meson6-ir")) in meson_ir_shutdown()
218 spin_unlock_irqrestore(&ir->lock, flags); in meson_ir_shutdown()
222 { .compatible = "amlogic,meson6-ir" },
223 { .compatible = "amlogic,meson8b-ir" },
224 { .compatible = "amlogic,meson-gxbb-ir" },
241 MODULE_DESCRIPTION("Amlogic Meson IR remote receiver driver");