[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1526337639-3568-2-git-send-email-narmstrong@baylibre.com>
Date: Tue, 15 May 2018 00:40:35 +0200
From: Neil Armstrong <narmstrong@...libre.com>
To: airlied@...ux.ie, hans.verkuil@...co.com, lee.jones@...aro.org,
olof@...om.net, seanpaul@...gle.com
Cc: Neil Armstrong <narmstrong@...libre.com>, sadolfsson@...gle.com,
felixe@...gle.com, bleung@...gle.com, darekm@...gle.com,
marcheu@...omium.org, fparent@...libre.com,
dri-devel@...ts.freedesktop.org, linux-media@...r.kernel.org,
intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [RFC PATCH 1/5] mfd: cros_ec_dev: Add CEC sub-device registration
The EC can expose a CEC bus, thus add the cros-ec-cec MFD sub-device
when the CEC feature bit is present.
Signed-off-by: Neil Armstrong <narmstrong@...libre.com>
---
drivers/mfd/cros_ec_dev.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index eafd06f..57064ec 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -383,6 +383,18 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
kfree(msg);
}
+static void cros_ec_cec_register(struct cros_ec_dev *ec)
+{
+ int ret;
+ struct mfd_cell cec_cell = {
+ .name = "cros-ec-cec",
+ };
+
+ ret = mfd_add_devices(ec->dev, 0, &cec_cell, 1, NULL, 0, NULL);
+ if (ret)
+ dev_err(ec->dev, "failed to add EC CEC\n");
+}
+
static int ec_device_probe(struct platform_device *pdev)
{
int retval = -ENOMEM;
@@ -422,6 +434,10 @@ static int ec_device_probe(struct platform_device *pdev)
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);
+ /* check whether this EC handles CEC. */
+ if (cros_ec_check_features(ec, EC_FEATURE_CEC))
+ cros_ec_cec_register(ec);
+
/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);
--
2.7.4
Powered by blists - more mailing lists