mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
- Bug Fixes
- Fix broken support for BananaPi-r2 -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAl2xWJYACgkQUa+KL4f8 d2GakA//WJmARBjABDoeLTso4pc57eny7PyzjNGxg2Y1lqPJr3unMjt2f8TC1A/Y N+KedwtB2dnW64uQDNEIx5F5HYwDN5R3Lh73naCOdNwkh53hxDMx1/aFvRSeW4eQ SMwEPA6dphxB3x09um8Vharo30ZJPLmfzJwqIktlaThRqCRlzURlsB3LqcU8oVrv fhC0zFuhRyySDfSfUacL305usQymuhd+ubAR2gbk0tgWzHXeVV7ptnDpun5HUUCV ZjNNoVv+bk8XK63rqOtpGar14rih65L4gWeLZR2QtA8SUPNcAddz5IKGzjc/cf1m hPnYl3XJ+o3SIxh9/kOuxHQo83QmKkLTEndu7SS40STgJNTaXUosGtCxQ3b7I/R7 a155YZRewp3+OXlh2k01Fb3I7wSBcH0Oh+wcvk4Bk9zqtDNCPvZyQ/K1R7RICtgu B72D0bwTrtq3v2lf9hAQrfCqx8hUWfUZO9aV7SeQ0/EHUQnU6ZUmWmqE8t6GHLAl EUinT6FA2Qg488bXKrkf6TbvK+bMGMRvW+i53FJS+Ukox0/fGpQnS9RzAC9uAMHi QtFdZTlU55L4JvjqKr5XsFkgO0A7EunYmVHdmJ3F59vJnWvKuhgymm7VsNdqrFwA GLQ7rlZ9TUQGi2zt+Iy1yF4gvatp/Bgho4CDaVfghwuIdW9KH4M= =Asi8 -----END PGP SIGNATURE----- Merge tag 'mfd-fixes-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD fix from Lee Jones: "Fix broken support for BananaPi-r2" * tag 'mfd-fixes-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: mfd: mt6397: Fix probe after changing mt6397-core
This commit is contained in:
commit
f116b96685
1 changed files with 40 additions and 24 deletions
|
@ -129,11 +129,27 @@ static int mt6397_irq_resume(struct device *dev)
|
|||
static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_irq_suspend,
|
||||
mt6397_irq_resume);
|
||||
|
||||
struct chip_data {
|
||||
u32 cid_addr;
|
||||
u32 cid_shift;
|
||||
};
|
||||
|
||||
static const struct chip_data mt6323_core = {
|
||||
.cid_addr = MT6323_CID,
|
||||
.cid_shift = 0,
|
||||
};
|
||||
|
||||
static const struct chip_data mt6397_core = {
|
||||
.cid_addr = MT6397_CID,
|
||||
.cid_shift = 0,
|
||||
};
|
||||
|
||||
static int mt6397_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
unsigned int id;
|
||||
struct mt6397_chip *pmic;
|
||||
const struct chip_data *pmic_core;
|
||||
|
||||
pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
|
||||
if (!pmic)
|
||||
|
@ -149,28 +165,30 @@ static int mt6397_probe(struct platform_device *pdev)
|
|||
if (!pmic->regmap)
|
||||
return -ENODEV;
|
||||
|
||||
platform_set_drvdata(pdev, pmic);
|
||||
pmic_core = of_device_get_match_data(&pdev->dev);
|
||||
if (!pmic_core)
|
||||
return -ENODEV;
|
||||
|
||||
ret = regmap_read(pmic->regmap, MT6397_CID, &id);
|
||||
ret = regmap_read(pmic->regmap, pmic_core->cid_addr, &id);
|
||||
if (ret) {
|
||||
dev_err(pmic->dev, "Failed to read chip id: %d\n", ret);
|
||||
dev_err(&pdev->dev, "Failed to read chip id: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pmic->chip_id = (id >> pmic_core->cid_shift) & 0xff;
|
||||
|
||||
platform_set_drvdata(pdev, pmic);
|
||||
|
||||
pmic->irq = platform_get_irq(pdev, 0);
|
||||
if (pmic->irq <= 0)
|
||||
return pmic->irq;
|
||||
|
||||
switch (id & 0xff) {
|
||||
case MT6323_CHIP_ID:
|
||||
pmic->int_con[0] = MT6323_INT_CON0;
|
||||
pmic->int_con[1] = MT6323_INT_CON1;
|
||||
pmic->int_status[0] = MT6323_INT_STATUS0;
|
||||
pmic->int_status[1] = MT6323_INT_STATUS1;
|
||||
ret = mt6397_irq_init(pmic);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
switch (pmic->chip_id) {
|
||||
case MT6323_CHIP_ID:
|
||||
ret = devm_mfd_add_devices(&pdev->dev, -1, mt6323_devs,
|
||||
ARRAY_SIZE(mt6323_devs), NULL,
|
||||
0, pmic->irq_domain);
|
||||
|
@ -178,21 +196,13 @@ static int mt6397_probe(struct platform_device *pdev)
|
|||
|
||||
case MT6391_CHIP_ID:
|
||||
case MT6397_CHIP_ID:
|
||||
pmic->int_con[0] = MT6397_INT_CON0;
|
||||
pmic->int_con[1] = MT6397_INT_CON1;
|
||||
pmic->int_status[0] = MT6397_INT_STATUS0;
|
||||
pmic->int_status[1] = MT6397_INT_STATUS1;
|
||||
ret = mt6397_irq_init(pmic);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = devm_mfd_add_devices(&pdev->dev, -1, mt6397_devs,
|
||||
ARRAY_SIZE(mt6397_devs), NULL,
|
||||
0, pmic->irq_domain);
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_err(&pdev->dev, "unsupported chip: %d\n", id);
|
||||
dev_err(&pdev->dev, "unsupported chip: %d\n", pmic->chip_id);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -205,9 +215,15 @@ static int mt6397_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
static const struct of_device_id mt6397_of_match[] = {
|
||||
{ .compatible = "mediatek,mt6397" },
|
||||
{ .compatible = "mediatek,mt6323" },
|
||||
{ }
|
||||
{
|
||||
.compatible = "mediatek,mt6323",
|
||||
.data = &mt6323_core,
|
||||
}, {
|
||||
.compatible = "mediatek,mt6397",
|
||||
.data = &mt6397_core,
|
||||
}, {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, mt6397_of_match);
|
||||
|
||||
|
|
Loading…
Reference in a new issue