mirror of https://gitee.com/openkylin/linux.git
media: seco-cec: use cec_notifier_cec_adap_(un)register
Use cec_notifier_cec_adap_(un)register instead of cec_notifier_get_conn, 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: Ettore Chimenti <ek5.chimenti@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
e677768940
commit
276c821f77
|
@ -507,10 +507,10 @@ static irqreturn_t secocec_irq_handler(int irq, void *priv)
|
|||
}
|
||||
|
||||
struct cec_dmi_match {
|
||||
char *sys_vendor;
|
||||
char *product_name;
|
||||
char *devname;
|
||||
char *conn;
|
||||
const char *sys_vendor;
|
||||
const char *product_name;
|
||||
const char *devname;
|
||||
const char *conn;
|
||||
};
|
||||
|
||||
static const struct cec_dmi_match secocec_dmi_match_table[] = {
|
||||
|
@ -518,7 +518,8 @@ static const struct cec_dmi_match secocec_dmi_match_table[] = {
|
|||
{ "SECO", "UDOO x86", "0000:00:02.0", "Port B" },
|
||||
};
|
||||
|
||||
static int secocec_cec_get_notifier(struct cec_notifier **notify)
|
||||
static struct device *secocec_cec_find_hdmi_dev(struct device *dev,
|
||||
const char **conn)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -533,16 +534,15 @@ static int secocec_cec_get_notifier(struct cec_notifier **notify)
|
|||
d = bus_find_device_by_name(&pci_bus_type, NULL,
|
||||
m->devname);
|
||||
if (!d)
|
||||
return -EPROBE_DEFER;
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
|
||||
*notify = cec_notifier_get_conn(d, m->conn);
|
||||
put_device(d);
|
||||
|
||||
return 0;
|
||||
*conn = m->conn;
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static int secocec_acpi_probe(struct secocec_data *sdev)
|
||||
|
@ -573,9 +573,15 @@ static int secocec_probe(struct platform_device *pdev)
|
|||
{
|
||||
struct secocec_data *secocec;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device *hdmi_dev;
|
||||
const char *conn = NULL;
|
||||
int ret;
|
||||
u16 val;
|
||||
|
||||
hdmi_dev = secocec_cec_find_hdmi_dev(&pdev->dev, &conn);
|
||||
if (IS_ERR(hdmi_dev))
|
||||
return PTR_ERR(hdmi_dev);
|
||||
|
||||
secocec = devm_kzalloc(dev, sizeof(*secocec), GFP_KERNEL);
|
||||
if (!secocec)
|
||||
return -ENOMEM;
|
||||
|
@ -617,12 +623,6 @@ static int secocec_probe(struct platform_device *pdev)
|
|||
goto err;
|
||||
}
|
||||
|
||||
ret = secocec_cec_get_notifier(&secocec->notifier);
|
||||
if (ret) {
|
||||
dev_err(dev, "no CEC notifier available\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = devm_request_threaded_irq(dev,
|
||||
secocec->irq,
|
||||
NULL,
|
||||
|
@ -640,7 +640,8 @@ static int secocec_probe(struct platform_device *pdev)
|
|||
secocec->cec_adap = cec_allocate_adapter(&secocec_cec_adap_ops,
|
||||
secocec,
|
||||
dev_name(dev),
|
||||
CEC_CAP_DEFAULTS,
|
||||
CEC_CAP_DEFAULTS |
|
||||
CEC_CAP_CONNECTOR_INFO,
|
||||
SECOCEC_MAX_ADDRS);
|
||||
|
||||
if (IS_ERR(secocec->cec_adap)) {
|
||||
|
@ -648,16 +649,20 @@ static int secocec_probe(struct platform_device *pdev)
|
|||
goto err;
|
||||
}
|
||||
|
||||
secocec->notifier = cec_notifier_cec_adap_register(hdmi_dev, conn,
|
||||
secocec->cec_adap);
|
||||
if (!secocec->notifier) {
|
||||
ret = -ENOMEM;
|
||||
goto err_delete_adapter;
|
||||
}
|
||||
|
||||
ret = cec_register_adapter(secocec->cec_adap, dev);
|
||||
if (ret)
|
||||
goto err_delete_adapter;
|
||||
|
||||
if (secocec->notifier)
|
||||
cec_register_cec_notifier(secocec->cec_adap, secocec->notifier);
|
||||
goto err_notifier;
|
||||
|
||||
ret = secocec_ir_probe(secocec);
|
||||
if (ret)
|
||||
goto err_delete_adapter;
|
||||
goto err_notifier;
|
||||
|
||||
platform_set_drvdata(pdev, secocec);
|
||||
|
||||
|
@ -665,6 +670,8 @@ static int secocec_probe(struct platform_device *pdev)
|
|||
|
||||
return ret;
|
||||
|
||||
err_notifier:
|
||||
cec_notifier_cec_adap_unregister(secocec->notifier);
|
||||
err_delete_adapter:
|
||||
cec_delete_adapter(secocec->cec_adap);
|
||||
err:
|
||||
|
@ -685,11 +692,9 @@ static int secocec_remove(struct platform_device *pdev)
|
|||
|
||||
dev_dbg(&pdev->dev, "IR disabled");
|
||||
}
|
||||
cec_notifier_cec_adap_unregister(secocec->notifier);
|
||||
cec_unregister_adapter(secocec->cec_adap);
|
||||
|
||||
if (secocec->notifier)
|
||||
cec_notifier_put(secocec->notifier);
|
||||
|
||||
release_region(BRA_SMB_BASE_ADDR, 7);
|
||||
|
||||
dev_dbg(&pdev->dev, "CEC device removed");
|
||||
|
|
Loading…
Reference in New Issue