regulator: Fixes for v7.1
A couple of fixes here, one very minor Kconfig fix and a fix for a nasty issue with error reporting in the tps65219 driver. -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmoQOVsACgkQJNaLcl1U h9BsEgf+NbodkfOh8KPtRrAto3B89pXrwXpT6Q7d+J0w1cPJa6+VC8yMtDx4IJ2C FfDU3V0H9W5Dfgeq4942r7v4E9ZOXcI5MLSwg1GPo5c9ynvbK+mhVbrtd+83IeKE KtQmXmhnlAPhx6yuFnjb0FDKaAq+DJemXKQfA/Qf+meQIo8Eg4HMjrO+sKLvwDOB o48KdpxdLig/v5K3kfab7QfqB3pDMpA8ryCYCgrrNWyqi3dD0/uC0eyKZjTOOmtG Rj1iHFzxCyOBgEIo7LmUTPUQIqzOWK3SOE9hGPcwvEuq6BhF7heMzffJYpwbWokM wguAsloFxce18XG3n+bBiHWFRoW/4Q== =e7Zg -----END PGP SIGNATURE----- Merge tag 'regulator-fix-v7.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator fixes from Mark Brown: "A couple of fixes here, one very minor Kconfig fix and a fix for a nasty issue with error reporting in the tps65219 driver" * tag 'regulator-fix-v7.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: tps65219: fix irq_data.rdev not being assigned regulator: Kconfig: fix a typo in helpmaster
commit
ddae1043d8
|
|
@ -757,7 +757,7 @@ config REGULATOR_MAX20086
|
|||
select REGMAP_I2C
|
||||
help
|
||||
This driver controls a Maxim MAX20086-MAX20089 camera power
|
||||
protectorvia I2C bus. The regulator has 2 or 4 outputs depending on
|
||||
protector via I2C bus. The regulator has 2 or 4 outputs depending on
|
||||
the device model. This driver is only capable to turn on/off them.
|
||||
|
||||
config REGULATOR_MAX20411
|
||||
|
|
|
|||
|
|
@ -346,8 +346,9 @@ static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
regulator_notifier_call_chain(irq_data->rdev,
|
||||
irq_data->type->event, NULL);
|
||||
if (irq_data->rdev)
|
||||
regulator_notifier_call_chain(irq_data->rdev,
|
||||
irq_data->type->event, NULL);
|
||||
|
||||
dev_err(irq_data->dev, "Error IRQ trap %s for %s\n",
|
||||
irq_data->type->event_name, irq_data->type->regulator_name);
|
||||
|
|
@ -398,14 +399,65 @@ static struct tps65219_chip_data chip_info_table[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static int tps65219_regulator_probe(struct platform_device *pdev)
|
||||
static bool tps65219_is_regulator_name(const struct tps65219_chip_data *pmic,
|
||||
const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pmic->common_rdesc_size; i++)
|
||||
if (!strcmp(pmic->common_rdesc[i].name, name))
|
||||
return true;
|
||||
for (i = 0; i < pmic->rdesc_size; i++)
|
||||
if (!strcmp(pmic->rdesc[i].name, name))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int tps65219_register_irqs(struct platform_device *pdev,
|
||||
struct tps65219 *tps,
|
||||
struct regulator_dev *rdev,
|
||||
struct tps65219_regulator_irq_type *irq_types,
|
||||
int nirqs,
|
||||
const char *regulator_name)
|
||||
{
|
||||
struct tps65219_regulator_irq_data *irq_data;
|
||||
int i, irq, error;
|
||||
|
||||
for (i = 0; i < nirqs; i++) {
|
||||
if (strcmp(irq_types[i].regulator_name, regulator_name))
|
||||
continue;
|
||||
|
||||
irq = platform_get_irq_byname(pdev, irq_types[i].irq_name);
|
||||
if (irq < 0)
|
||||
return -EINVAL;
|
||||
|
||||
irq_data = devm_kmalloc(tps->dev, sizeof(*irq_data), GFP_KERNEL);
|
||||
if (!irq_data)
|
||||
return -ENOMEM;
|
||||
|
||||
irq_data->dev = tps->dev;
|
||||
irq_data->type = &irq_types[i];
|
||||
irq_data->rdev = rdev;
|
||||
|
||||
error = devm_request_threaded_irq(tps->dev, irq, NULL,
|
||||
tps65219_regulator_irq_handler,
|
||||
IRQF_ONESHOT,
|
||||
irq_types[i].irq_name,
|
||||
irq_data);
|
||||
if (error)
|
||||
return dev_err_probe(tps->dev, error,
|
||||
"Failed to request %s IRQ %d\n",
|
||||
irq_types[i].irq_name, irq);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tps65219_regulator_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct tps65219_regulator_irq_type *irq_type;
|
||||
struct tps65219_chip_data *pmic;
|
||||
struct regulator_dev *rdev;
|
||||
int error;
|
||||
int irq;
|
||||
int i;
|
||||
|
||||
struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent);
|
||||
|
|
@ -425,6 +477,19 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
|
|||
return dev_err_probe(tps->dev, PTR_ERR(rdev),
|
||||
"Failed to register %s regulator\n",
|
||||
pmic->common_rdesc[i].name);
|
||||
|
||||
error = tps65219_register_irqs(pdev, tps, rdev,
|
||||
pmic->common_irq_types,
|
||||
pmic->common_irq_size,
|
||||
pmic->common_rdesc[i].name);
|
||||
if (error)
|
||||
return error;
|
||||
error = tps65219_register_irqs(pdev, tps, rdev,
|
||||
pmic->irq_types,
|
||||
pmic->dev_irq_size,
|
||||
pmic->common_rdesc[i].name);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
||||
for (i = 0; i < pmic->rdesc_size; i++) {
|
||||
|
|
@ -434,52 +499,42 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
|
|||
return dev_err_probe(tps->dev, PTR_ERR(rdev),
|
||||
"Failed to register %s regulator\n",
|
||||
pmic->rdesc[i].name);
|
||||
|
||||
error = tps65219_register_irqs(pdev, tps, rdev,
|
||||
pmic->common_irq_types,
|
||||
pmic->common_irq_size,
|
||||
pmic->rdesc[i].name);
|
||||
if (error)
|
||||
return error;
|
||||
error = tps65219_register_irqs(pdev, tps, rdev,
|
||||
pmic->irq_types,
|
||||
pmic->dev_irq_size,
|
||||
pmic->rdesc[i].name);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Register non-regulator IRQs (TIMEOUT, SENSOR) with rdev=NULL */
|
||||
for (i = 0; i < pmic->common_irq_size; ++i) {
|
||||
irq_type = &pmic->common_irq_types[i];
|
||||
irq = platform_get_irq_byname(pdev, irq_type->irq_name);
|
||||
if (irq < 0)
|
||||
return -EINVAL;
|
||||
|
||||
irq_data = devm_kmalloc(tps->dev, sizeof(*irq_data), GFP_KERNEL);
|
||||
if (!irq_data)
|
||||
return -ENOMEM;
|
||||
|
||||
irq_data->dev = tps->dev;
|
||||
irq_data->type = irq_type;
|
||||
error = devm_request_threaded_irq(tps->dev, irq, NULL,
|
||||
tps65219_regulator_irq_handler,
|
||||
IRQF_ONESHOT,
|
||||
irq_type->irq_name,
|
||||
irq_data);
|
||||
if (tps65219_is_regulator_name(pmic, irq_type->regulator_name))
|
||||
continue;
|
||||
error = tps65219_register_irqs(pdev, tps, NULL,
|
||||
irq_type, 1,
|
||||
irq_type->regulator_name);
|
||||
if (error)
|
||||
return dev_err_probe(tps->dev, error,
|
||||
"Failed to request %s IRQ %d\n",
|
||||
irq_type->irq_name, irq);
|
||||
return error;
|
||||
}
|
||||
|
||||
for (i = 0; i < pmic->dev_irq_size; ++i) {
|
||||
irq_type = &pmic->irq_types[i];
|
||||
irq = platform_get_irq_byname(pdev, irq_type->irq_name);
|
||||
if (irq < 0)
|
||||
return -EINVAL;
|
||||
|
||||
irq_data = devm_kmalloc(tps->dev, sizeof(*irq_data), GFP_KERNEL);
|
||||
if (!irq_data)
|
||||
return -ENOMEM;
|
||||
|
||||
irq_data->dev = tps->dev;
|
||||
irq_data->type = irq_type;
|
||||
error = devm_request_threaded_irq(tps->dev, irq, NULL,
|
||||
tps65219_regulator_irq_handler,
|
||||
IRQF_ONESHOT,
|
||||
irq_type->irq_name,
|
||||
irq_data);
|
||||
if (tps65219_is_regulator_name(pmic, irq_type->regulator_name))
|
||||
continue;
|
||||
error = tps65219_register_irqs(pdev, tps, NULL,
|
||||
irq_type, 1,
|
||||
irq_type->regulator_name);
|
||||
if (error)
|
||||
return dev_err_probe(tps->dev, error,
|
||||
"Failed to request %s IRQ %d\n",
|
||||
irq_type->irq_name, irq);
|
||||
return error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue