/* 88pm80x chips have same definition for chip id register. */ #define PM80X_CHIP_ID (0x00) #define PM80X_CHIP_ID_NUM(x) (((x) >> 5) & 0x7) #define PM80X_CHIP_ID_REVISION(x) ((x) & 0x1F)
struct pm80x_chip_mapping { unsignedint id; int type;
};
staticstruct pm80x_chip_mapping chip_mapping[] = { /* 88PM800 chip id number */
{0x3, CHIP_PM800}, /* 88PM805 chip id number */
{0x0, CHIP_PM805}, /* 88PM860 chip id number */
{0x4, CHIP_PM860},
};
/* * workaround: some registers needed by pm805 are defined in pm800, so * need to use this global variable to maintain the relation between * pm800 and pm805. would remove it after HW chip fixes the issue.
*/ staticstruct pm80x_chip *g_pm80x_chip;
ret = regmap_read(chip->regmap, PM80X_CHIP_ID, &val); if (ret < 0) {
dev_err(chip->dev, "Failed to read CHIP ID: %d\n", ret); return ret;
}
for (i = 0; i < ARRAY_SIZE(chip_mapping); i++) { if (chip_mapping[i].id == PM80X_CHIP_ID_NUM(val)) {
chip->type = chip_mapping[i].type; break;
}
}
if (i == ARRAY_SIZE(chip_mapping)) {
dev_err(chip->dev, "Failed to detect Marvell 88PM800:ChipID[0x%x]\n", val); return -EINVAL;
}
device_init_wakeup(&client->dev, 1);
/* * workaround: set g_pm80x_chip to the first probed chip. if the * second chip is probed, just point to the companion to each * other so that pm805 can access those specific register. would * remove it after HW chip fixes the issue.
*/ if (!g_pm80x_chip)
g_pm80x_chip = chip; else {
chip->companion = g_pm80x_chip->client;
g_pm80x_chip->companion = chip->client;
}
return 0;
}
EXPORT_SYMBOL_GPL(pm80x_init);
int pm80x_deinit(void)
{ /* * workaround: clear the dependency between pm800 and pm805. * would remove it after HW chip fixes the issue.
*/ if (g_pm80x_chip->companion)
g_pm80x_chip->companion = NULL; else
g_pm80x_chip = NULL; return 0;
}
EXPORT_SYMBOL_GPL(pm80x_deinit);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.