Commit 10d8f308 authored by Hans Verkuil's avatar Hans Verkuil

cec: add cec_adapter to cec_notifier_cec_adap_unregister()

It is possible for one HDMI connector to have multiple CEC adapters. The
typical real-world scenario is that where one adapter is used when the
device is in standby, and one that's better/smarter when the device is
powered up.

The cec-notifier changes were made with that in mind, but I missed that in
order to support this you need to tell cec_notifier_cec_adap_unregister()
which adapter you are unregistering from the notifier.

Add this additional argument. It is currently unused, but once all drivers
use this, the CEC core will be adapted for these use-cases.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/e9fc8740-6be6-43a7-beee-ce2d7b54936e@xs4all.nl
parent 83931350
......@@ -285,7 +285,7 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev)
ret = cec_register_adapter(cec->adap, pdev->dev.parent);
if (ret < 0) {
cec_notifier_cec_adap_unregister(cec->notify);
cec_notifier_cec_adap_unregister(cec->notify, cec->adap);
return ret;
}
......@@ -302,7 +302,7 @@ static int dw_hdmi_cec_remove(struct platform_device *pdev)
{
struct dw_hdmi_cec *cec = platform_get_drvdata(pdev);
cec_notifier_cec_adap_unregister(cec->notify);
cec_notifier_cec_adap_unregister(cec->notify, cec->adap);
cec_unregister_adapter(cec->adap);
return 0;
......
......@@ -465,7 +465,7 @@ static int tda9950_probe(struct i2c_client *client,
ret = cec_register_adapter(priv->adap, priv->hdmi);
if (ret < 0) {
cec_notifier_cec_adap_unregister(priv->notify);
cec_notifier_cec_adap_unregister(priv->notify, priv->adap);
return ret;
}
......@@ -482,7 +482,7 @@ static int tda9950_remove(struct i2c_client *client)
{
struct tda9950_priv *priv = i2c_get_clientdata(client);
cec_notifier_cec_adap_unregister(priv->notify);
cec_notifier_cec_adap_unregister(priv->notify, priv->adap);
cec_unregister_adapter(priv->adap);
return 0;
......
......@@ -153,13 +153,14 @@ cec_notifier_cec_adap_register(struct device *hdmi_dev, const char *conn_name,
}
EXPORT_SYMBOL_GPL(cec_notifier_cec_adap_register);
void cec_notifier_cec_adap_unregister(struct cec_notifier *n)
void cec_notifier_cec_adap_unregister(struct cec_notifier *n,
struct cec_adapter *adap)
{
if (!n)
return;
mutex_lock(&n->lock);
n->cec_adap->notifier = NULL;
adap->notifier = NULL;
n->cec_adap = NULL;
n->callback = NULL;
mutex_unlock(&n->lock);
......
......@@ -314,7 +314,8 @@ static int cros_ec_cec_probe(struct platform_device *pdev)
return 0;
out_probe_notify:
cec_notifier_cec_adap_unregister(cros_ec_cec->notify);
cec_notifier_cec_adap_unregister(cros_ec_cec->notify,
cros_ec_cec->adap);
out_probe_adapter:
cec_delete_adapter(cros_ec_cec->adap);
return ret;
......@@ -335,7 +336,8 @@ static int cros_ec_cec_remove(struct platform_device *pdev)
return ret;
}
cec_notifier_cec_adap_unregister(cros_ec_cec->notify);
cec_notifier_cec_adap_unregister(cros_ec_cec->notify,
cros_ec_cec->adap);
cec_unregister_adapter(cros_ec_cec->adap);
return 0;
......
......@@ -736,7 +736,7 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev)
clk_disable_unprepare(ao_cec->core);
out_probe_notify:
cec_notifier_cec_adap_unregister(ao_cec->notify);
cec_notifier_cec_adap_unregister(ao_cec->notify, ao_cec->adap);
out_probe_adapter:
cec_delete_adapter(ao_cec->adap);
......@@ -752,7 +752,7 @@ static int meson_ao_cec_g12a_remove(struct platform_device *pdev)
clk_disable_unprepare(ao_cec->core);
cec_notifier_cec_adap_unregister(ao_cec->notify);
cec_notifier_cec_adap_unregister(ao_cec->notify, ao_cec->adap);
cec_unregister_adapter(ao_cec->adap);
......
......@@ -688,7 +688,7 @@ static int meson_ao_cec_probe(struct platform_device *pdev)
clk_disable_unprepare(ao_cec->core);
out_probe_notify:
cec_notifier_cec_adap_unregister(ao_cec->notify);
cec_notifier_cec_adap_unregister(ao_cec->notify, ao_cec->adap);
out_probe_adapter:
cec_delete_adapter(ao_cec->adap);
......@@ -704,7 +704,7 @@ static int meson_ao_cec_remove(struct platform_device *pdev)
clk_disable_unprepare(ao_cec->core);
cec_notifier_cec_adap_unregister(ao_cec->notify);
cec_notifier_cec_adap_unregister(ao_cec->notify, ao_cec->adap);
cec_unregister_adapter(ao_cec->adap);
return 0;
......
......@@ -239,7 +239,7 @@ static int s5p_cec_probe(struct platform_device *pdev)
return 0;
err_notifier:
cec_notifier_cec_adap_unregister(cec->notifier);
cec_notifier_cec_adap_unregister(cec->notifier, cec->adap);
err_delete_adapter:
cec_delete_adapter(cec->adap);
......@@ -250,7 +250,7 @@ static int s5p_cec_remove(struct platform_device *pdev)
{
struct s5p_cec_dev *cec = platform_get_drvdata(pdev);
cec_notifier_cec_adap_unregister(cec->notifier);
cec_notifier_cec_adap_unregister(cec->notifier, cec->adap);
cec_unregister_adapter(cec->adap);
pm_runtime_disable(&pdev->dev);
return 0;
......
......@@ -671,7 +671,7 @@ static int secocec_probe(struct platform_device *pdev)
return ret;
err_notifier:
cec_notifier_cec_adap_unregister(secocec->notifier);
cec_notifier_cec_adap_unregister(secocec->notifier, secocec->cec_adap);
err_delete_adapter:
cec_delete_adapter(secocec->cec_adap);
err:
......@@ -692,7 +692,7 @@ static int secocec_remove(struct platform_device *pdev)
dev_dbg(&pdev->dev, "IR disabled");
}
cec_notifier_cec_adap_unregister(secocec->notifier);
cec_notifier_cec_adap_unregister(secocec->notifier, secocec->cec_adap);
cec_unregister_adapter(secocec->cec_adap);
release_region(BRA_SMB_BASE_ADDR, 7);
......
......@@ -359,7 +359,7 @@ static int stih_cec_probe(struct platform_device *pdev)
return 0;
err_notifier:
cec_notifier_cec_adap_unregister(cec->notifier);
cec_notifier_cec_adap_unregister(cec->notifier, cec->adap);
err_delete_adapter:
cec_delete_adapter(cec->adap);
......@@ -370,7 +370,7 @@ static int stih_cec_remove(struct platform_device *pdev)
{
struct stih_cec *cec = platform_get_drvdata(pdev);
cec_notifier_cec_adap_unregister(cec->notifier);
cec_notifier_cec_adap_unregister(cec->notifier, cec->adap);
cec_unregister_adapter(cec->adap);
return 0;
......
......@@ -409,7 +409,7 @@ static int tegra_cec_probe(struct platform_device *pdev)
return 0;
err_notifier:
cec_notifier_cec_adap_unregister(cec->notifier);
cec_notifier_cec_adap_unregister(cec->notifier, cec->adap);
err_adapter:
cec_delete_adapter(cec->adap);
err_clk:
......@@ -423,7 +423,7 @@ static int tegra_cec_remove(struct platform_device *pdev)
clk_disable_unprepare(cec->clk);
cec_notifier_cec_adap_unregister(cec->notifier);
cec_notifier_cec_adap_unregister(cec->notifier, cec->adap);
cec_unregister_adapter(cec->adap);
return 0;
......
......@@ -93,8 +93,10 @@ cec_notifier_cec_adap_register(struct device *hdmi_dev, const char *conn_name,
* cec_notifier_cec_adap_unregister - decrease refcount and delete when the
* refcount reaches 0.
* @n: notifier. If NULL, then this function does nothing.
* @adap: the cec adapter that registered this notifier.
*/
void cec_notifier_cec_adap_unregister(struct cec_notifier *n);
void cec_notifier_cec_adap_unregister(struct cec_notifier *n,
struct cec_adapter *adap);
/**
* cec_notifier_set_phys_addr - set a new physical address.
......@@ -160,7 +162,8 @@ cec_notifier_cec_adap_register(struct device *hdmi_dev, const char *conn_name,
return (struct cec_notifier *)0xdeadfeed;
}
static inline void cec_notifier_cec_adap_unregister(struct cec_notifier *n)
static inline void cec_notifier_cec_adap_unregister(struct cec_notifier *n,
struct cec_adapter *adap)
{
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment