[PATCH v12 3/6] media: platform: synopsys: Add support for HDMI input driver
Dmitry Osipenko
dmitry.osipenko at collabora.com
Wed Feb 26 22:20:03 PST 2025
On 2/27/25 08:50, Dmitry Osipenko wrote:
> +struct hdmirx_cec *snps_hdmirx_cec_register(struct hdmirx_cec_data *data)
> +{
> + struct hdmirx_cec *cec;
> + unsigned int irqs;
> + int ret;
> +
> + /*
> + * Our device is just a convenience - we want to link to the real
> + * hardware device here, so that userspace can see the association
> + * between the HDMI hardware and its associated CEC chardev.
> + */
> + cec = devm_kzalloc(data->dev, sizeof(*cec), GFP_KERNEL);
> + if (!cec)
> + return ERR_PTR(-ENOMEM);
> +
> + cec->dev = data->dev;
> + cec->irq = data->irq;
> + cec->ops = data->ops;
> + cec->hdmirx = data->hdmirx;
> +
> + hdmirx_cec_update_bits(cec, GLOBAL_SWENABLE, CEC_ENABLE, CEC_ENABLE);
> + hdmirx_cec_update_bits(cec, CEC_CONFIG, RX_AUTO_DRIVE_ACKNOWLEDGE,
> + RX_AUTO_DRIVE_ACKNOWLEDGE);
> +
> + hdmirx_cec_write(cec, CEC_TX_COUNT, 0);
> + hdmirx_cec_write(cec, CEC_INT_MASK_N, 0);
> + hdmirx_cec_write(cec, CEC_INT_CLEAR, ~0);
> +
> + cec->adap = cec_allocate_adapter(&hdmirx_cec_ops, cec, "snps-hdmirx",
> + CEC_CAP_DEFAULTS | CEC_CAP_MONITOR_ALL,
> + CEC_MAX_LOG_ADDRS);
> + if (IS_ERR(cec->adap)) {
> + dev_err(cec->dev, "cec adapter allocation failed\n");
> + return ERR_CAST(cec->adap);
> + }
> +
> + /* override the module pointer */
> + cec->adap->owner = THIS_MODULE;
> +
> + ret = devm_add_action(cec->dev, hdmirx_cec_del, cec);
> + if (ret) {
> + cec_delete_adapter(cec->adap);
> + return ERR_PTR(ret);
> + }
> +
> + irq_set_status_flags(cec->irq, IRQ_NOAUTOEN);
> +
> + ret = devm_request_threaded_irq(cec->dev, cec->irq,
> + hdmirx_cec_hardirq,
> + hdmirx_cec_thread, IRQF_ONESHOT,
> + "rk_hdmirx_cec", cec->adap);
> + if (ret) {
> + dev_err(cec->dev, "cec irq request failed\n");
> + return ERR_PTR(ret);
> + }
> +
> + cec->notify = cec_notifier_cec_adap_register(cec->dev,
> + NULL, cec->adap);
It now occurred to me that this cec->notify also should be not needed
for this driver and *everything* related to CEC notifiers should be
removed. Hans, is this correct or I'm missing something?
--
Best regards,
Dmitry
More information about the Linux-rockchip
mailing list