led: pca9633: remove non-DTS support

Now that all I2C bus drivers support DTS we can remove the non-DTS
driver support.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2019-10-23 12:05:49 -05:00 committed by Kumar Gala
commit 613b77a761
2 changed files with 10 additions and 39 deletions

View file

@ -12,26 +12,3 @@ config PCA9633
PCA9633 LED driver has 4 channels each with multi-programmable
states. Each channel can drive up to 25 mA per LED.
if !HAS_DTS_I2C
config PCA9633_DEV_NAME
string "PCA9633 device name"
default "PCA9633"
help
Device name for PCA9633 LED driver.
config PCA9633_I2C_ADDRESS
hex "PCA9633 I2C slave address"
default 0x62
help
Specify the I2C slave address for the PCA9633 LED driver.
config PCA9633_I2C_MASTER_DEV_NAME
string "I2C master where PCA9633 is connected"
default "I2C_1"
help
Specify the device name of the I2C master device to which
PCA9633 is connected.
endif

View file

@ -18,12 +18,6 @@
#include <logging/log.h>
LOG_MODULE_REGISTER(pca9633);
#ifdef CONFIG_HAS_DTS_I2C
#define CONFIG_PCA9633_DEV_NAME DT_INST_0_NXP_PCA9633_LABEL
#define CONFIG_PCA9633_I2C_ADDRESS DT_INST_0_NXP_PCA9633_BASE_ADDRESS
#define CONFIG_PCA9633_I2C_MASTER_DEV_NAME DT_INST_0_NXP_PCA9633_BUS_NAME
#endif
#include "led_context.h"
/* PCA9633 select registers determine the source that drives LED outputs */
@ -71,7 +65,7 @@ static int pca9633_led_blink(struct device *dev, u32_t led,
* GDC = ((time_on * 256) / period)
*/
gdc = delay_on * 256U / period;
if (i2c_reg_write_byte(data->i2c, CONFIG_PCA9633_I2C_ADDRESS,
if (i2c_reg_write_byte(data->i2c, DT_INST_0_NXP_PCA9633_BASE_ADDRESS,
PCA9633_GRPPWM,
gdc)) {
LOG_ERR("LED reg write failed");
@ -85,7 +79,7 @@ static int pca9633_led_blink(struct device *dev, u32_t led,
* GFRQ = ((period * 24 / 1000) - 1)
*/
gfrq = (period * 24U / 1000) - 1;
if (i2c_reg_write_byte(data->i2c, CONFIG_PCA9633_I2C_ADDRESS,
if (i2c_reg_write_byte(data->i2c, DT_INST_0_NXP_PCA9633_BASE_ADDRESS,
PCA9633_GRPFREQ,
gfrq)) {
LOG_ERR("LED reg write failed");
@ -93,7 +87,7 @@ static int pca9633_led_blink(struct device *dev, u32_t led,
}
/* Enable blinking mode */
if (i2c_reg_update_byte(data->i2c, CONFIG_PCA9633_I2C_ADDRESS,
if (i2c_reg_update_byte(data->i2c, DT_INST_0_NXP_PCA9633_BASE_ADDRESS,
PCA9633_MODE2,
PCA9633_MODE2_DMBLNK,
PCA9633_MODE2_DMBLNK)) {
@ -102,7 +96,7 @@ static int pca9633_led_blink(struct device *dev, u32_t led,
}
/* Select the GRPPWM source to drive the LED outpout */
if (i2c_reg_update_byte(data->i2c, CONFIG_PCA9633_I2C_ADDRESS,
if (i2c_reg_update_byte(data->i2c, DT_INST_0_NXP_PCA9633_BASE_ADDRESS,
PCA9633_LEDOUT,
PCA9633_MASK << (led << 1),
PCA9633_LED_GRP_PWM << (led << 1))) {
@ -127,7 +121,7 @@ static int pca9633_led_set_brightness(struct device *dev, u32_t led,
/* Set the LED brightness value */
val = (value * 255U) / dev_data->max_brightness;
if (i2c_reg_write_byte(data->i2c, CONFIG_PCA9633_I2C_ADDRESS,
if (i2c_reg_write_byte(data->i2c, DT_INST_0_NXP_PCA9633_BASE_ADDRESS,
PCA9633_PWM_BASE + led,
val)) {
LOG_ERR("LED reg write failed");
@ -135,7 +129,7 @@ static int pca9633_led_set_brightness(struct device *dev, u32_t led,
}
/* Set the LED driver to be controlled through its PWMx register. */
if (i2c_reg_update_byte(data->i2c, CONFIG_PCA9633_I2C_ADDRESS,
if (i2c_reg_update_byte(data->i2c, DT_INST_0_NXP_PCA9633_BASE_ADDRESS,
PCA9633_LEDOUT,
PCA9633_MASK << (led << 1),
PCA9633_LED_PWM << (led << 1))) {
@ -151,7 +145,7 @@ static inline int pca9633_led_on(struct device *dev, u32_t led)
struct pca9633_data *data = dev->driver_data;
/* Set LED state to ON */
if (i2c_reg_update_byte(data->i2c, CONFIG_PCA9633_I2C_ADDRESS,
if (i2c_reg_update_byte(data->i2c, DT_INST_0_NXP_PCA9633_BASE_ADDRESS,
PCA9633_LEDOUT,
PCA9633_MASK << (led << 1),
PCA9633_LED_ON << (led << 1))) {
@ -167,7 +161,7 @@ static inline int pca9633_led_off(struct device *dev, u32_t led)
struct pca9633_data *data = dev->driver_data;
/* Set LED state to OFF */
if (i2c_reg_update_byte(data->i2c, CONFIG_PCA9633_I2C_ADDRESS,
if (i2c_reg_update_byte(data->i2c, DT_INST_0_NXP_PCA9633_BASE_ADDRESS,
PCA9633_LEDOUT,
PCA9633_MASK << (led << 1),
PCA9633_LED_OFF)) {
@ -183,7 +177,7 @@ static int pca9633_led_init(struct device *dev)
struct pca9633_data *data = dev->driver_data;
struct led_data *dev_data = &data->dev_data;
data->i2c = device_get_binding(CONFIG_PCA9633_I2C_MASTER_DEV_NAME);
data->i2c = device_get_binding(DT_INST_0_NXP_PCA9633_BUS_NAME);
if (data->i2c == NULL) {
LOG_DBG("Failed to get I2C device");
return -EINVAL;
@ -207,7 +201,7 @@ static const struct led_driver_api pca9633_led_api = {
.off = pca9633_led_off,
};
DEVICE_AND_API_INIT(pca9633_led, CONFIG_PCA9633_DEV_NAME,
DEVICE_AND_API_INIT(pca9633_led, DT_INST_0_NXP_PCA9633_LABEL,
&pca9633_led_init, &pca9633_led_data,
NULL, POST_KERNEL, CONFIG_LED_INIT_PRIORITY,
&pca9633_led_api);