[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140402054549.GW17250@pengutronix.de>
Date: Wed, 2 Apr 2014 07:45:49 +0200
From: Sascha Hauer <s.hauer@...gutronix.de>
To: Lothar Waßmann <LW@...O-electronics.de>
Cc: Thierry Reding <thierry.reding@...il.com>,
linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org,
Shawn Guo <shawn.guo@...aro.org>,
Sascha Hauer <kernel@...gutronix.de>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCHv3 3/3] pwm: imx: support output polarity inversion
Hi Lothar,
On Fri, Mar 28, 2014 at 09:49:00AM +0100, Lothar Waßmann wrote:
> static struct pwm_ops imx_pwm_ops = {
> .enable = imx_pwm_enable,
> .disable = imx_pwm_disable,
> @@ -210,6 +228,7 @@ struct imx_pwm_data {
> int (*config)(struct pwm_chip *chip,
> struct pwm_device *pwm, int duty_ns, int period_ns);
> void (*set_enable)(struct pwm_chip *chip, bool enable);
> + unsigned output_polarity:1;
> };
>
> static struct imx_pwm_data imx_pwm_data_v1 = {
> @@ -220,6 +239,7 @@ static struct imx_pwm_data imx_pwm_data_v1 = {
> static struct imx_pwm_data imx_pwm_data_v2 = {
> .config = imx_pwm_config_v2,
> .set_enable = imx_pwm_set_enable_v2,
> + .output_polarity = 1,
> };
>
> static const struct of_device_id imx_pwm_dt_ids[] = {
> @@ -272,6 +292,11 @@ static int imx_pwm_probe(struct platform_device *pdev)
> return PTR_ERR(imx->mmio_base);
>
> data = of_id->data;
> + if (data->output_polarity) {
> + dev_dbg(&pdev->dev, "PWM supports output inversion\n");
> + imx_pwm_ops.set_polarity = imx_pwm_set_polarity;
> + }
You shouldn't modify imx_pwm_ops in the probe function, it's not good
style and prevents us from making the ops const.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists