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:
Neil Armstrong 2019-07-01 06:47:02 -04:00 коммит произвёл Mauro Carvalho Chehab
Родитель 9bef0d1d05
Коммит aef5f47c99
1 изменённых файлов: 35 добавлений и 1 удалений

Просмотреть файл

@ -121,6 +121,9 @@
#define CECB_CTRL_TYPE_NEXT 2 #define CECB_CTRL_TYPE_NEXT 2
#define CECB_CTRL2 0x01 #define CECB_CTRL2 0x01
#define CECB_CTRL2_RISE_DEL_MAX GENMASK(4, 0)
#define CECB_INTR_MASK 0x02 #define CECB_INTR_MASK 0x02
#define CECB_LADD_LOW 0x05 #define CECB_LADD_LOW 0x05
#define CECB_LADD_HIGH 0x06 #define CECB_LADD_HIGH 0x06
@ -165,6 +168,11 @@
#define CECB_WAKEUPCTRL 0x31 #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 meson_ao_cec_g12a_device {
struct platform_device *pdev; struct platform_device *pdev;
struct regmap *regmap; struct regmap *regmap;
@ -175,6 +183,7 @@ struct meson_ao_cec_g12a_device {
struct cec_msg rx_msg; struct cec_msg rx_msg;
struct clk *oscin; struct clk *oscin;
struct clk *core; struct clk *core;
const struct meson_ao_cec_g12a_data *data;
}; };
static const struct regmap_config meson_ao_cec_g12a_regmap_conf = { 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, regmap_update_bits(ao_cec->regmap, CECB_GEN_CNTL_REG,
CECB_GEN_CNTL_RESET, 0); 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); meson_ao_cec_g12a_irq_setup(ao_cec, true);
return 0; return 0;
@ -632,6 +645,12 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev)
if (!ao_cec) if (!ao_cec)
return -ENOMEM; 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); spin_lock_init(&ao_cec->cec_reg_lock);
ao_cec->pdev = pdev; ao_cec->pdev = pdev;
@ -740,8 +759,23 @@ static int meson_ao_cec_g12a_remove(struct platform_device *pdev)
return 0; 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[] = { 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 */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, meson_ao_cec_g12a_of_match); MODULE_DEVICE_TABLE(of, meson_ao_cec_g12a_of_match);