All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: jbrunet@baylibre.com, khilman@baylibre.com, linux-media@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
	Neil Armstrong <narmstrong@baylibre.com>
Subject: [RFC 08/11] media: platform: meson-ao-cec-g12a: add support for SM1
Date: Mon,  1 Jul 2019 12:47:02 +0200	[thread overview]
Message-ID: <20190701104705.18271-9-narmstrong@baylibre.com> (raw)
In-Reply-To: <20190701104705.18271-1-narmstrong@baylibre.com>

Add support for the Amlogic SM1 SoC Family to the G12A AO-CECB
derivative.

It only adds a single init register.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/media/platform/meson/ao-cec-g12a.c | 37 +++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/meson/ao-cec-g12a.c b/drivers/media/platform/meson/ao-cec-g12a.c
index 3620a1e310f5..1c696a126ee8 100644
--- a/drivers/media/platform/meson/ao-cec-g12a.c
+++ b/drivers/media/platform/meson/ao-cec-g12a.c
@@ -121,6 +121,9 @@
 #define CECB_CTRL_TYPE_NEXT	2
 
 #define CECB_CTRL2		0x01
+
+#define CECB_CTRL2_RISE_DEL_MAX	GENMASK(4, 0)
+
 #define CECB_INTR_MASK		0x02
 #define CECB_LADD_LOW		0x05
 #define CECB_LADD_HIGH		0x06
@@ -165,6 +168,11 @@
 
 #define CECB_WAKEUPCTRL		0x31
 
+struct meson_ao_cec_g12a_data {
+	/* Setup the internal CECB_CTRL2 register */
+	bool				ctrl2_setup;
+};
+
 struct meson_ao_cec_g12a_device {
 	struct platform_device		*pdev;
 	struct regmap			*regmap;
@@ -175,6 +183,7 @@ struct meson_ao_cec_g12a_device {
 	struct cec_msg			rx_msg;
 	struct clk			*oscin;
 	struct clk			*core;
+	const struct meson_ao_cec_g12a_data *data;
 };
 
 static const struct regmap_config meson_ao_cec_g12a_regmap_conf = {
@@ -620,6 +629,10 @@ static int meson_ao_cec_g12a_adap_enable(struct cec_adapter *adap, bool enable)
 	regmap_update_bits(ao_cec->regmap, CECB_GEN_CNTL_REG,
 			   CECB_GEN_CNTL_RESET, 0);
 
+	if (ao_cec->data->ctrl2_setup)
+		regmap_write(ao_cec->regmap_cec, CECB_CTRL2,
+			     FIELD_PREP(CECB_CTRL2_RISE_DEL_MAX, 2));
+
 	meson_ao_cec_g12a_irq_setup(ao_cec, true);
 
 	return 0;
@@ -639,6 +652,7 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev)
 	void __iomem *base;
 	int ret, irq;
 
+
 	hdmi_dev = cec_notifier_parse_hdmi_phandle(&pdev->dev);
 	if (IS_ERR(hdmi_dev))
 		return PTR_ERR(hdmi_dev);
@@ -647,6 +661,12 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev)
 	if (!ao_cec)
 		return -ENOMEM;
 
+	ao_cec->data = of_device_get_match_data(&pdev->dev);
+	if (!ao_cec->data) {
+		dev_err(&pdev->dev, "failed to get match data\n");
+		return -ENODEV;
+	}
+
 	spin_lock_init(&ao_cec->cec_reg_lock);
 	ao_cec->pdev = pdev;
 
@@ -757,8 +777,23 @@ static int meson_ao_cec_g12a_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct meson_ao_cec_g12a_data ao_cec_g12a_data = {
+	.ctrl2_setup = false,
+};
+
+static const struct meson_ao_cec_g12a_data ao_cec_sm1_data = {
+	.ctrl2_setup = true,
+};
+
 static const struct of_device_id meson_ao_cec_g12a_of_match[] = {
-	{ .compatible = "amlogic,meson-g12a-ao-cec", },
+	{
+		.compatible = "amlogic,meson-g12a-ao-cec",
+		.data = &ao_cec_g12a_data,
+	},
+	{
+		.compatible = "amlogic,meson-sm1-ao-cec",
+		.data = &ao_cec_sm1_data,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, meson_ao_cec_g12a_of_match);
-- 
2.21.0


WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: jbrunet@baylibre.com, khilman@baylibre.com, linux-media@vger.kernel.org
Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Neil Armstrong <narmstrong@baylibre.com>
Subject: [RFC 08/11] media: platform: meson-ao-cec-g12a: add support for SM1
Date: Mon,  1 Jul 2019 12:47:02 +0200	[thread overview]
Message-ID: <20190701104705.18271-9-narmstrong@baylibre.com> (raw)
In-Reply-To: <20190701104705.18271-1-narmstrong@baylibre.com>

Add support for the Amlogic SM1 SoC Family to the G12A AO-CECB
derivative.

It only adds a single init register.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/media/platform/meson/ao-cec-g12a.c | 37 +++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/meson/ao-cec-g12a.c b/drivers/media/platform/meson/ao-cec-g12a.c
index 3620a1e310f5..1c696a126ee8 100644
--- a/drivers/media/platform/meson/ao-cec-g12a.c
+++ b/drivers/media/platform/meson/ao-cec-g12a.c
@@ -121,6 +121,9 @@
 #define CECB_CTRL_TYPE_NEXT	2
 
 #define CECB_CTRL2		0x01
+
+#define CECB_CTRL2_RISE_DEL_MAX	GENMASK(4, 0)
+
 #define CECB_INTR_MASK		0x02
 #define CECB_LADD_LOW		0x05
 #define CECB_LADD_HIGH		0x06
@@ -165,6 +168,11 @@
 
 #define CECB_WAKEUPCTRL		0x31
 
+struct meson_ao_cec_g12a_data {
+	/* Setup the internal CECB_CTRL2 register */
+	bool				ctrl2_setup;
+};
+
 struct meson_ao_cec_g12a_device {
 	struct platform_device		*pdev;
 	struct regmap			*regmap;
@@ -175,6 +183,7 @@ struct meson_ao_cec_g12a_device {
 	struct cec_msg			rx_msg;
 	struct clk			*oscin;
 	struct clk			*core;
+	const struct meson_ao_cec_g12a_data *data;
 };
 
 static const struct regmap_config meson_ao_cec_g12a_regmap_conf = {
@@ -620,6 +629,10 @@ static int meson_ao_cec_g12a_adap_enable(struct cec_adapter *adap, bool enable)
 	regmap_update_bits(ao_cec->regmap, CECB_GEN_CNTL_REG,
 			   CECB_GEN_CNTL_RESET, 0);
 
+	if (ao_cec->data->ctrl2_setup)
+		regmap_write(ao_cec->regmap_cec, CECB_CTRL2,
+			     FIELD_PREP(CECB_CTRL2_RISE_DEL_MAX, 2));
+
 	meson_ao_cec_g12a_irq_setup(ao_cec, true);
 
 	return 0;
@@ -639,6 +652,7 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev)
 	void __iomem *base;
 	int ret, irq;
 
+
 	hdmi_dev = cec_notifier_parse_hdmi_phandle(&pdev->dev);
 	if (IS_ERR(hdmi_dev))
 		return PTR_ERR(hdmi_dev);
@@ -647,6 +661,12 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev)
 	if (!ao_cec)
 		return -ENOMEM;
 
+	ao_cec->data = of_device_get_match_data(&pdev->dev);
+	if (!ao_cec->data) {
+		dev_err(&pdev->dev, "failed to get match data\n");
+		return -ENODEV;
+	}
+
 	spin_lock_init(&ao_cec->cec_reg_lock);
 	ao_cec->pdev = pdev;
 
@@ -757,8 +777,23 @@ static int meson_ao_cec_g12a_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct meson_ao_cec_g12a_data ao_cec_g12a_data = {
+	.ctrl2_setup = false,
+};
+
+static const struct meson_ao_cec_g12a_data ao_cec_sm1_data = {
+	.ctrl2_setup = true,
+};
+
 static const struct of_device_id meson_ao_cec_g12a_of_match[] = {
-	{ .compatible = "amlogic,meson-g12a-ao-cec", },
+	{
+		.compatible = "amlogic,meson-g12a-ao-cec",
+		.data = &ao_cec_g12a_data,
+	},
+	{
+		.compatible = "amlogic,meson-sm1-ao-cec",
+		.data = &ao_cec_sm1_data,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, meson_ao_cec_g12a_of_match);
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: jbrunet@baylibre.com, khilman@baylibre.com, linux-media@vger.kernel.org
Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Neil Armstrong <narmstrong@baylibre.com>
Subject: [RFC 08/11] media: platform: meson-ao-cec-g12a: add support for SM1
Date: Mon,  1 Jul 2019 12:47:02 +0200	[thread overview]
Message-ID: <20190701104705.18271-9-narmstrong@baylibre.com> (raw)
In-Reply-To: <20190701104705.18271-1-narmstrong@baylibre.com>

Add support for the Amlogic SM1 SoC Family to the G12A AO-CECB
derivative.

It only adds a single init register.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/media/platform/meson/ao-cec-g12a.c | 37 +++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/meson/ao-cec-g12a.c b/drivers/media/platform/meson/ao-cec-g12a.c
index 3620a1e310f5..1c696a126ee8 100644
--- a/drivers/media/platform/meson/ao-cec-g12a.c
+++ b/drivers/media/platform/meson/ao-cec-g12a.c
@@ -121,6 +121,9 @@
 #define CECB_CTRL_TYPE_NEXT	2
 
 #define CECB_CTRL2		0x01
+
+#define CECB_CTRL2_RISE_DEL_MAX	GENMASK(4, 0)
+
 #define CECB_INTR_MASK		0x02
 #define CECB_LADD_LOW		0x05
 #define CECB_LADD_HIGH		0x06
@@ -165,6 +168,11 @@
 
 #define CECB_WAKEUPCTRL		0x31
 
+struct meson_ao_cec_g12a_data {
+	/* Setup the internal CECB_CTRL2 register */
+	bool				ctrl2_setup;
+};
+
 struct meson_ao_cec_g12a_device {
 	struct platform_device		*pdev;
 	struct regmap			*regmap;
@@ -175,6 +183,7 @@ struct meson_ao_cec_g12a_device {
 	struct cec_msg			rx_msg;
 	struct clk			*oscin;
 	struct clk			*core;
+	const struct meson_ao_cec_g12a_data *data;
 };
 
 static const struct regmap_config meson_ao_cec_g12a_regmap_conf = {
@@ -620,6 +629,10 @@ static int meson_ao_cec_g12a_adap_enable(struct cec_adapter *adap, bool enable)
 	regmap_update_bits(ao_cec->regmap, CECB_GEN_CNTL_REG,
 			   CECB_GEN_CNTL_RESET, 0);
 
+	if (ao_cec->data->ctrl2_setup)
+		regmap_write(ao_cec->regmap_cec, CECB_CTRL2,
+			     FIELD_PREP(CECB_CTRL2_RISE_DEL_MAX, 2));
+
 	meson_ao_cec_g12a_irq_setup(ao_cec, true);
 
 	return 0;
@@ -639,6 +652,7 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev)
 	void __iomem *base;
 	int ret, irq;
 
+
 	hdmi_dev = cec_notifier_parse_hdmi_phandle(&pdev->dev);
 	if (IS_ERR(hdmi_dev))
 		return PTR_ERR(hdmi_dev);
@@ -647,6 +661,12 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev)
 	if (!ao_cec)
 		return -ENOMEM;
 
+	ao_cec->data = of_device_get_match_data(&pdev->dev);
+	if (!ao_cec->data) {
+		dev_err(&pdev->dev, "failed to get match data\n");
+		return -ENODEV;
+	}
+
 	spin_lock_init(&ao_cec->cec_reg_lock);
 	ao_cec->pdev = pdev;
 
@@ -757,8 +777,23 @@ static int meson_ao_cec_g12a_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct meson_ao_cec_g12a_data ao_cec_g12a_data = {
+	.ctrl2_setup = false,
+};
+
+static const struct meson_ao_cec_g12a_data ao_cec_sm1_data = {
+	.ctrl2_setup = true,
+};
+
 static const struct of_device_id meson_ao_cec_g12a_of_match[] = {
-	{ .compatible = "amlogic,meson-g12a-ao-cec", },
+	{
+		.compatible = "amlogic,meson-g12a-ao-cec",
+		.data = &ao_cec_g12a_data,
+	},
+	{
+		.compatible = "amlogic,meson-sm1-ao-cec",
+		.data = &ao_cec_sm1_data,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, meson_ao_cec_g12a_of_match);
-- 
2.21.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  parent reply	other threads:[~2019-07-01 10:47 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01 10:46 [RFC 00/11] arm64: Add support for Amlogic SM1 SoC Family Neil Armstrong
2019-07-01 10:46 ` Neil Armstrong
2019-07-01 10:46 ` Neil Armstrong
2019-07-01 10:46 ` [RFC 01/11] soc: amlogic: meson-gx-socinfo: Add SM1 and S905X3 IDs Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-07-02  9:51   ` Jerome Brunet
2019-07-02  9:51     ` Jerome Brunet
2019-07-02  9:51     ` Jerome Brunet
2019-07-02 23:11   ` Martin Blumenstingl
2019-07-02 23:11     ` Martin Blumenstingl
2019-07-02 23:11     ` Martin Blumenstingl
2019-07-01 10:46 ` [RFC 02/11] dt-bindings: power: amlogic, meson-gx-pwrc: Add SM1 bindings Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-07-03  0:00   ` Martin Blumenstingl
2019-07-03  0:00     ` Martin Blumenstingl
2019-07-03  0:00     ` Martin Blumenstingl
2019-07-03  0:00     ` Martin Blumenstingl
2019-08-20  0:05     ` Kevin Hilman
2019-08-20  0:05       ` Kevin Hilman
2019-08-20  0:05       ` Kevin Hilman
2019-08-20  5:45       ` Martin Blumenstingl
2019-08-20  5:45         ` Martin Blumenstingl
2019-08-20  5:45         ` Martin Blumenstingl
2019-07-01 10:46 ` [RFC 03/11] soc: amlogic: gx-pwrc-vpu: add SM1 support Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-07-01 10:46 ` [RFC 04/11] soc: amlogic: Add support for SM1 power controller Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-08-19 23:56   ` Kevin Hilman
2019-08-19 23:56     ` Kevin Hilman
2019-08-19 23:56     ` Kevin Hilman
2019-08-20 14:55     ` Neil Armstrong
2019-08-20 14:55       ` Neil Armstrong
2019-08-20 14:55       ` Neil Armstrong
2019-08-20 19:19       ` Kevin Hilman
2019-08-20 19:19         ` Kevin Hilman
2019-08-20 19:19         ` Kevin Hilman
2019-07-01 10:46 ` [RFC 05/11] dt-bindings: soc: amlogic: clk-measure: Add SM1 compatible Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-07-01 10:46   ` Neil Armstrong
2019-07-03  0:01   ` Martin Blumenstingl
2019-07-03  0:01     ` Martin Blumenstingl
2019-07-03  0:01     ` Martin Blumenstingl
2019-07-03  0:01     ` Martin Blumenstingl
2019-07-22 22:10   ` Rob Herring
2019-07-22 22:10     ` Rob Herring
2019-07-22 22:10     ` Rob Herring
2019-07-22 22:10     ` Rob Herring
2019-07-01 10:47 ` [RFC 06/11] soc: amlogic: clk-measure: Add support for SM1 Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-02 23:51   ` Martin Blumenstingl
2019-07-02 23:51     ` Martin Blumenstingl
2019-07-02 23:51     ` Martin Blumenstingl
2019-07-03 11:44     ` Neil Armstrong
2019-07-03 11:44       ` Neil Armstrong
2019-07-03 11:44       ` Neil Armstrong
2019-07-01 10:47 ` [RFC 07/11] dt-bindings: media: meson-ao-cec: add SM1 compatible Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-22 22:11   ` Rob Herring
2019-07-22 22:11     ` Rob Herring
2019-07-22 22:11     ` Rob Herring
2019-07-22 22:11     ` Rob Herring
2019-07-01 10:47 ` Neil Armstrong [this message]
2019-07-01 10:47   ` [RFC 08/11] media: platform: meson-ao-cec-g12a: add support for SM1 Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-01 10:47 ` [RFC 09/11] dt-bindings: arm: amlogic: add SM1 bindings Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-01 10:47 ` [RFC 10/11] dt-bindings: arm: amlogic: add SEI Robotics SEI610 bindings Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-01 10:47 ` [RFC 11/11] arm64: dts: add support for SM1 based SEI Robotics SEI610 Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-07-01 10:47   ` Neil Armstrong
2019-08-20 13:16 ` [RFC 00/11] arm64: Add support for Amlogic SM1 SoC Family Neil Armstrong
2019-08-20 13:16   ` Neil Armstrong
2019-08-20 13:16   ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190701104705.18271-9-narmstrong@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.