mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-06 02:24:14 +08:00
media: platform: meson-ao-cec-g12a: add support for SM1
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> [hverkuil-cisco@xs4all.nl: dropped spurious newline] Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
9bef0d1d05
commit
aef5f47c99
@ -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 = {
|
||||
@ -605,6 +614,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;
|
||||
@ -632,6 +645,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;
|
||||
|
||||
@ -740,8 +759,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);
|
||||
|
Loading…
Reference in New Issue
Block a user