media: tegra-cec: use cec_notifier_cec_adap_(un)register

Use cec_notifier_cec_adap_(un)register instead of
cec_notifier_get, cec_notifier_put and cec_register_cec_notifier.

Also enable the CEC_CAP_CONNECTOR_INFO capability.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Hans Verkuil 2019-07-15 06:09:06 -04:00 committed by Mauro Carvalho Chehab
parent 72a171d72a
commit ebe15c7679
1 changed files with 18 additions and 17 deletions

View File

@ -380,38 +380,39 @@ static int tegra_cec_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"Unable to request interrupt for device\n");
goto clk_error;
}
cec->notifier = cec_notifier_get(hdmi_dev);
if (!cec->notifier) {
ret = -ENOMEM;
goto clk_error;
goto err_clk;
}
cec->adap = cec_allocate_adapter(&tegra_cec_ops, cec, TEGRA_CEC_NAME,
CEC_CAP_DEFAULTS | CEC_CAP_MONITOR_ALL,
CEC_CAP_DEFAULTS | CEC_CAP_MONITOR_ALL |
CEC_CAP_CONNECTOR_INFO,
CEC_MAX_LOG_ADDRS);
if (IS_ERR(cec->adap)) {
ret = -ENOMEM;
dev_err(&pdev->dev, "Couldn't create cec adapter\n");
goto cec_error;
goto err_clk;
}
cec->notifier = cec_notifier_cec_adap_register(hdmi_dev, NULL,
cec->adap);
if (!cec->notifier) {
ret = -ENOMEM;
goto err_adapter;
}
ret = cec_register_adapter(cec->adap, &pdev->dev);
if (ret) {
dev_err(&pdev->dev, "Couldn't register device\n");
goto cec_error;
goto err_notifier;
}
cec_register_cec_notifier(cec->adap, cec->notifier);
return 0;
cec_error:
if (cec->notifier)
cec_notifier_put(cec->notifier);
err_notifier:
cec_notifier_cec_adap_unregister(cec->notifier);
err_adapter:
cec_delete_adapter(cec->adap);
clk_error:
err_clk:
clk_disable_unprepare(cec->clk);
return ret;
}
@ -422,8 +423,8 @@ static int tegra_cec_remove(struct platform_device *pdev)
clk_disable_unprepare(cec->clk);
cec_notifier_cec_adap_unregister(cec->notifier);
cec_unregister_adapter(cec->adap);
cec_notifier_put(cec->notifier);
return 0;
}