Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

backlight: sky81452: Privatize platform data

The only way the platform data for the SKY81452 ever gets populated
is through the device tree.

The MFD device is bothered with this for no reason at all. Just
allocate the platform data in the driver and be happy.

Cc: Gyungoh Yoo <jack.yoo@skyworksinc.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Linus Walleij and committed by
Lee Jones
08bf73a6 e1915eec

+27 -48
-2
drivers/mfd/sky81452.c
··· 47 47 memset(cells, 0, sizeof(cells)); 48 48 cells[0].name = "sky81452-backlight"; 49 49 cells[0].of_compatible = "skyworks,sky81452-backlight"; 50 - cells[0].platform_data = pdata->bl_pdata; 51 - cells[0].pdata_size = sizeof(*pdata->bl_pdata); 52 50 cells[1].name = "sky81452-regulator"; 53 51 cells[1].platform_data = pdata->regulator_init_data; 54 52 cells[1].pdata_size = sizeof(*pdata->regulator_init_data);
+27 -7
drivers/video/backlight/sky81452-backlight.c
··· 15 15 #include <linux/of.h> 16 16 #include <linux/platform_device.h> 17 17 #include <linux/regmap.h> 18 - #include <linux/platform_data/sky81452-backlight.h> 19 18 #include <linux/slab.h> 20 19 21 20 /* registers */ ··· 39 40 40 41 #define SKY81452_DEFAULT_NAME "lcd-backlight" 41 42 #define SKY81452_MAX_BRIGHTNESS (SKY81452_CS + 1) 43 + 44 + /** 45 + * struct sky81452_platform_data 46 + * @name: backlight driver name. 47 + If it is not defined, default name is lcd-backlight. 48 + * @gpios_enable:GPIO descriptor which control EN pin 49 + * @enable: Enable mask for current sink channel 1, 2, 3, 4, 5 and 6. 50 + * @ignore_pwm: true if DPWMI should be ignored. 51 + * @dpwm_mode: true is DPWM dimming mode, otherwise Analog dimming mode. 52 + * @phase_shift:true is phase shift mode. 53 + * @short_detecion_threshold: It should be one of 4, 5, 6 and 7V. 54 + * @boost_current_limit: It should be one of 2300, 2750mA. 55 + */ 56 + struct sky81452_bl_platform_data { 57 + const char *name; 58 + struct gpio_desc *gpiod_enable; 59 + unsigned int enable; 60 + bool ignore_pwm; 61 + bool dpwm_mode; 62 + bool phase_shift; 63 + unsigned int short_detection_threshold; 64 + unsigned int boost_current_limit; 65 + }; 42 66 43 67 #define CTZ(b) __builtin_ctz(b) 44 68 ··· 273 251 { 274 252 struct device *dev = &pdev->dev; 275 253 struct regmap *regmap = dev_get_drvdata(dev->parent); 276 - struct sky81452_bl_platform_data *pdata = dev_get_platdata(dev); 254 + struct sky81452_bl_platform_data *pdata; 277 255 struct backlight_device *bd; 278 256 struct backlight_properties props; 279 257 const char *name; 280 258 int ret; 281 259 282 - if (!pdata) { 283 - pdata = sky81452_bl_parse_dt(dev); 284 - if (IS_ERR(pdata)) 285 - return PTR_ERR(pdata); 286 - } 260 + pdata = sky81452_bl_parse_dt(dev); 261 + if (IS_ERR(pdata)) 262 + return PTR_ERR(pdata); 287 263 288 264 ret = sky81452_bl_init_device(regmap, pdata); 289 265 if (ret < 0) {
-2
include/linux/mfd/sky81452.h
··· 9 9 #ifndef _SKY81452_H 10 10 #define _SKY81452_H 11 11 12 - #include <linux/platform_data/sky81452-backlight.h> 13 12 #include <linux/regulator/machine.h> 14 13 15 14 struct sky81452_platform_data { 16 - struct sky81452_bl_platform_data *bl_pdata; 17 15 struct regulator_init_data *regulator_init_data; 18 16 }; 19 17
-37
include/linux/platform_data/sky81452-backlight.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * sky81452.h SKY81452 backlight driver 4 - * 5 - * Copyright 2014 Skyworks Solutions Inc. 6 - * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com> 7 - */ 8 - 9 - #ifndef _SKY81452_BACKLIGHT_H 10 - #define _SKY81452_BACKLIGHT_H 11 - 12 - #include <linux/gpio/consumer.h> 13 - 14 - /** 15 - * struct sky81452_platform_data 16 - * @name: backlight driver name. 17 - If it is not defined, default name is lcd-backlight. 18 - * @gpios_enable:GPIO descriptor which control EN pin 19 - * @enable: Enable mask for current sink channel 1, 2, 3, 4, 5 and 6. 20 - * @ignore_pwm: true if DPWMI should be ignored. 21 - * @dpwm_mode: true is DPWM dimming mode, otherwise Analog dimming mode. 22 - * @phase_shift:true is phase shift mode. 23 - * @short_detecion_threshold: It should be one of 4, 5, 6 and 7V. 24 - * @boost_current_limit: It should be one of 2300, 2750mA. 25 - */ 26 - struct sky81452_bl_platform_data { 27 - const char *name; 28 - struct gpio_desc *gpiod_enable; 29 - unsigned int enable; 30 - bool ignore_pwm; 31 - bool dpwm_mode; 32 - bool phase_shift; 33 - unsigned int short_detection_threshold; 34 - unsigned int boost_current_limit; 35 - }; 36 - 37 - #endif