Lines Matching +full:am3352 +full:- +full:eqep
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Counter driver for Texas Instruments Enhanced Quadrature Encoder Pulse (eQEP)
18 /* 32-bit registers */
29 /* 16-bit registers */
70 /* EQEP Inputs */
101 regmap_read(priv->regmap32, QPOSCNT, &cnt); in ti_eqep_count_read()
113 regmap_read(priv->regmap32, QPOSMAX, &max); in ti_eqep_count_write()
115 return -EINVAL; in ti_eqep_count_write()
117 return regmap_write(priv->regmap32, QPOSCNT, val); in ti_eqep_count_write()
127 regmap_read(priv->regmap16, QDECCTL, &qdecctl); in ti_eqep_function_read()
169 return -EINVAL; in ti_eqep_function_write()
172 return regmap_write_bits(priv->regmap16, QDECCTL, QDECCTL_QSRC, in ti_eqep_function_write()
198 /* In direction-count mode only rising edge of QEPA is counted in ti_eqep_action_read()
201 switch (synapse->signal->id) { in ti_eqep_action_read()
210 return -EINVAL; in ti_eqep_action_read()
214 /* In up/down-count modes only QEPA is counted and QEPB is not in ti_eqep_action_read()
217 switch (synapse->signal->id) { in ti_eqep_action_read()
219 err = regmap_read(priv->regmap16, QDECCTL, &qdecctl); in ti_eqep_action_read()
233 return -EINVAL; in ti_eqep_action_read()
237 return -EINVAL; in ti_eqep_action_read()
256 regmap_read(priv->regmap32, QPOSMAX, &qposmax); in ti_eqep_position_ceiling_read()
270 return -ERANGE; in ti_eqep_position_ceiling_write()
272 regmap_write(priv->regmap32, QPOSMAX, ceiling); in ti_eqep_position_ceiling_write()
283 regmap_read(priv->regmap16, QEPCTL, &qepctl); in ti_eqep_position_enable_read()
295 regmap_write_bits(priv->regmap16, QEPCTL, QEPCTL_PHEN, enable ? -1 : 0); in ti_eqep_position_enable_write()
358 .name = "32-bit",
366 .name = "16-bit",
375 struct device *dev = &pdev->dev; in ti_eqep_probe()
383 return -ENOMEM; in ti_eqep_probe()
390 priv->regmap32 = devm_regmap_init_mmio(dev, base, in ti_eqep_probe()
392 if (IS_ERR(priv->regmap32)) in ti_eqep_probe()
393 return PTR_ERR(priv->regmap32); in ti_eqep_probe()
395 priv->regmap16 = devm_regmap_init_mmio(dev, base + 0x24, in ti_eqep_probe()
397 if (IS_ERR(priv->regmap16)) in ti_eqep_probe()
398 return PTR_ERR(priv->regmap16); in ti_eqep_probe()
400 counter->name = dev_name(dev); in ti_eqep_probe()
401 counter->parent = dev; in ti_eqep_probe()
402 counter->ops = &ti_eqep_counter_ops; in ti_eqep_probe()
403 counter->counts = ti_eqep_counts; in ti_eqep_probe()
404 counter->num_counts = ARRAY_SIZE(ti_eqep_counts); in ti_eqep_probe()
405 counter->signals = ti_eqep_signals; in ti_eqep_probe()
406 counter->num_signals = ARRAY_SIZE(ti_eqep_signals); in ti_eqep_probe()
431 struct device *dev = &pdev->dev; in ti_eqep_remove()
441 { .compatible = "ti,am3352-eqep", },
450 .name = "ti-eqep-cnt",
457 MODULE_DESCRIPTION("TI eQEP counter driver");