Re: [PATCH v4 5/5] pwm-pca9685: enable ACPI device found on Galileo Gen2
From: Andy Shevchenko
Date: Mon Nov 09 2015 - 08:53:44 EST
On Fri, 2015-10-23 at 12:16 +0300, Andy Shevchenko wrote:
> There is a chip connected to i2c bus on Intel Galileo Gen2 board.
> Enable it via
> ACPI ID INT3492.
Thierry, ping?
>
> Cc: Thierry Reding <thierry.reding@xxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
> Âdrivers/pwm/KconfigÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/pwm/pwm-pca9685.c | 20 ++++++++++++++++----
> Â2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index 062630a..bb114ef 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -242,7 +242,7 @@ config PWM_MXS
> Â
> Âconfig PWM_PCA9685
> Â tristate "NXP PCA9685 PWM driver"
> - depends on OF && I2C
> + depends on I2C
> Â select REGMAP_I2C
> Â help
> Â ÂÂGeneric PWM framework driver for NXP PCA9685 LED
> controller.
> diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c
> index 70448a6..117fccf 100644
> --- a/drivers/pwm/pwm-pca9685.c
> +++ b/drivers/pwm/pwm-pca9685.c
> @@ -19,9 +19,11 @@
> Â * this program.ÂÂIf not, see <http://www.gnu.org/licenses/>.
> Â */
> Â
> +#include <linux/acpi.h>
> Â#include <linux/i2c.h>
> Â#include <linux/module.h>
> Â#include <linux/platform_device.h>
> +#include <linux/property.h>
> Â#include <linux/pwm.h>
> Â#include <linux/regmap.h>
> Â#include <linux/slab.h>
> @@ -297,7 +299,6 @@ static const struct regmap_config
> pca9685_regmap_i2c_config = {
> Âstatic int pca9685_pwm_probe(struct i2c_client *client,
> Â const struct i2c_device_id *id)
> Â{
> - struct device_node *np = client->dev.of_node;
> Â struct pca9685 *pca;
> Â int ret;
> Â int mode2;
> @@ -320,12 +321,12 @@ static int pca9685_pwm_probe(struct i2c_client
> *client,
> Â
> Â regmap_read(pca->regmap, PCA9685_MODE2, &mode2);
> Â
> - if (of_property_read_bool(np, "invert"))
> + if (device_property_read_bool(&client->dev, "invert"))
> Â mode2 |= MODE2_INVRT;
> Â else
> Â mode2 &= ~MODE2_INVRT;
> Â
> - if (of_property_read_bool(np, "open-drain"))
> + if (device_property_read_bool(&client->dev, "open-drain"))
> Â mode2 &= ~MODE2_OUTDRV;
> Â else
> Â mode2 |= MODE2_OUTDRV;
> @@ -363,16 +364,27 @@ static const struct i2c_device_id pca9685_id[]
> = {
> Â};
> ÂMODULE_DEVICE_TABLE(i2c, pca9685_id);
> Â
> +#ifdef CONFIG_ACPI
> +static const struct acpi_device_id pca9685_acpi_ids[] = {
> + { "INT3492", 0 },
> + { /* sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(acpi, pca9685_acpi_ids);
> +#endif
> +
> +#ifdef CONFIG_OF
> Âstatic const struct of_device_id pca9685_dt_ids[] = {
> Â { .compatible = "nxp,pca9685-pwm", },
> Â { /* sentinel */ }
> Â};
> ÂMODULE_DEVICE_TABLE(of, pca9685_dt_ids);
> +#endif
> Â
> Âstatic struct i2c_driver pca9685_i2c_driver = {
> Â .driver = {
> Â .name = "pca9685-pwm",
> - .of_match_table = pca9685_dt_ids,
> + .acpi_match_table = ACPI_PTR(pca9685_acpi_ids),
> + .of_match_table = of_match_ptr(pca9685_dt_ids),
> Â },
> Â .probe = pca9685_pwm_probe,
> Â .remove = pca9685_pwm_remove,
--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/