From 3d60fec28561524f6c7d17f8920f7a09f5d8ea94 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=AE=B8=E7=9B=9B=E9=A3=9E?= Date: Tue, 21 Jan 2014 18:47:26 +0800 Subject: [PATCH] pwm-bl: change some warning --- arch/arm/boot/dts/rk3188-pinctrl.dtsi | 8 ++++---- arch/arm/boot/dts/rk3188-tb.dts | 2 +- arch/arm/boot/dts/rk3188.dtsi | 22 +++++++++------------- drivers/video/backlight/pwm_bl.c | 12 +++++++----- include/linux/pwm_backlight.h | 2 +- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/arch/arm/boot/dts/rk3188-pinctrl.dtsi b/arch/arm/boot/dts/rk3188-pinctrl.dtsi index 4a6819fb7c7a..8a3579dbfb55 100755 --- a/arch/arm/boot/dts/rk3188-pinctrl.dtsi +++ b/arch/arm/boot/dts/rk3188-pinctrl.dtsi @@ -443,7 +443,7 @@ }; gpio3_pwm { - pwm0:pwm0 { + pwm0_pin:pwm0 { rockchip,pins = ; rockchip,pull = ; //rockchip,voltage = ; @@ -453,7 +453,7 @@ }; - pwm1:pwm1 { + pwm1_pin:pwm1 { rockchip,pins = ; rockchip,pull = ; //rockchip,voltage = ; @@ -462,7 +462,7 @@ }; - pwm2:pwm2 { + pwm2_pin:pwm2 { rockchip,pins = ; rockchip,pull = ; //rockchip,voltage = ; @@ -471,7 +471,7 @@ }; - pwm3:pwm3 { + pwm3_pin:pwm3 { rockchip,pins = ; rockchip,pull = ; //rockchip,voltage = ; diff --git a/arch/arm/boot/dts/rk3188-tb.dts b/arch/arm/boot/dts/rk3188-tb.dts index 261ad7d20553..34bf60416b22 100644 --- a/arch/arm/boot/dts/rk3188-tb.dts +++ b/arch/arm/boot/dts/rk3188-tb.dts @@ -57,7 +57,7 @@ &lcdc1 { status = "okay"; }; -&rk_pwm3 { +&pwm3 { status = "okay"; }; diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi index 92c1ded932fb..3896aeab3bf7 100755 --- a/arch/arm/boot/dts/rk3188.dtsi +++ b/arch/arm/boot/dts/rk3188.dtsi @@ -21,10 +21,6 @@ i2c4 = &i2c4; lcdc0 = &lcdc0; lcdc1 = &lcdc1; - pwm0 = &rk_pwm0; - pwm1 = &rk_pwm1; - pmw2 = &rk_pwm2; - pwm3 = &rk_pwm3; }; cpus { @@ -351,48 +347,48 @@ status = "disabled"; }; - rk_pwm0: pwm@20030000{ + pwm0: pwm@20030000{ compatible = "rockchip,pwm"; reg = <0x20030000 0x10>; /*0x20030000*/ #pwm-cells = <2>; pinctrl-names = "default"; - pinctrl-0 = <&pwm0>; + pinctrl-0 = <&pwm0_pin>; status = "disabled"; }; - rk_pwm1: pwm@20030010{ + pwm1: pwm@20030010{ compatible = "rockchip,pwm"; reg = <0x20030010 0x10>; /*0x20030000*/ #pwm-cells = <2>; pinctrl-names = "default"; - pinctrl-0 = <&pwm1>; + pinctrl-0 = <&pwm1_pin>; status = "disabled"; }; - rk_pwm2: pwm@20050020{ + pwm2: pwm@20050020{ compatible = "rockchip,pwm"; reg = <0x20050020 0x10>; /*0x20030000*/ #pwm-cells = <2>; pinctrl-names = "default"; - pinctrl-0 = <&pwm2>; + pinctrl-0 = <&pwm2_pin>; status = "disabled"; }; - rk_pwm3: pwm@20050030{ + pwm3: pwm@20050030{ compatible = "rockchip,pwm"; reg = <0x20050030 0x10>; /*0x20030000*/ #pwm-cells = <2>; pinctrl-names = "default"; - pinctrl-0 = <&pwm3>; + pinctrl-0 = <&pwm3_pin>; status = "disabled"; }; backlight { compatible = "pwm-backlight"; - pwms = <&rk_pwm3 0 5000000>; + pwms = <&pwm3 0 5000000>; brightness-levels = <0 4 8 16 32 64 128 255>; default-brightness-level = <6>; gpios = <&gpio0 GPIO_A2 GPIO_ACTIVE_LOW>; diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index e87db838c86e..07cb9aa119e4 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -103,6 +103,8 @@ static int pwm_backlight_parse_dt(struct device *dev, int length; u32 value; int gpio,ret; + enum of_gpio_flags flags; + if (!node) return -ENODEV; @@ -134,20 +136,20 @@ static int pwm_backlight_parse_dt(struct device *dev, &value); if (ret < 0) return ret; - data->gpios = devm_kzalloc(dev, + data->gpio = devm_kzalloc(dev, sizeof(struct gpio) * 1, GFP_KERNEL); - gpio = of_get_named_gpio(node, "gpios", 0); - data->gpios->gpio = gpio; + gpio = of_get_named_gpio_flags(node, "gpios", 0, &flags); + data->gpio->gpio = gpio; if (gpio != -1) { ret = devm_gpio_request(dev, gpio, "gpio_pwm_bl_en"); if(ret){ - data->gpios->gpio = -1; + data->gpio->gpio = -1; goto err_free_pwm; } - ret = gpio_direction_output(data->gpios->gpio , 1); + ret = gpio_direction_output(data->gpio->gpio , flags); if(ret){ goto err_free_pwm; } diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index 710a5c1b3a3f..0e80289481f5 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h @@ -14,7 +14,7 @@ struct platform_pwm_backlight_data { unsigned int pwm_period_ns; unsigned int *levels; - struct gpio *gpios; + struct gpio *gpio; int (*init)(struct device *dev); int (*notify)(struct device *dev, int brightness); -- 2.34.1