leds: pca9532 - Indent using tabs, not spaces.
Indent using tabs, not spaces. Signed-off-by: Antonio Ospite <ospite@studenti.unina.it> Acked-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
parent
34abdf2526
commit
07172d2bfa
|
@ -35,7 +35,7 @@ struct pca9532_data {
|
||||||
struct pca9532_led leds[16];
|
struct pca9532_led leds[16];
|
||||||
struct mutex update_lock;
|
struct mutex update_lock;
|
||||||
struct input_dev *idev;
|
struct input_dev *idev;
|
||||||
struct work_struct work;
|
struct work_struct work;
|
||||||
u8 pwm[2];
|
u8 pwm[2];
|
||||||
u8 psc[2];
|
u8 psc[2];
|
||||||
};
|
};
|
||||||
|
@ -87,14 +87,14 @@ static int pca9532_calcpwm(struct i2c_client *client, int pwm, int blink,
|
||||||
if (b > 0xFF)
|
if (b > 0xFF)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
data->pwm[pwm] = b;
|
data->pwm[pwm] = b;
|
||||||
data->psc[pwm] = blink;
|
data->psc[pwm] = blink;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pca9532_setpwm(struct i2c_client *client, int pwm)
|
static int pca9532_setpwm(struct i2c_client *client, int pwm)
|
||||||
{
|
{
|
||||||
struct pca9532_data *data = i2c_get_clientdata(client);
|
struct pca9532_data *data = i2c_get_clientdata(client);
|
||||||
mutex_lock(&data->update_lock);
|
mutex_lock(&data->update_lock);
|
||||||
i2c_smbus_write_byte_data(client, PCA9532_REG_PWM(pwm),
|
i2c_smbus_write_byte_data(client, PCA9532_REG_PWM(pwm),
|
||||||
data->pwm[pwm]);
|
data->pwm[pwm]);
|
||||||
i2c_smbus_write_byte_data(client, PCA9532_REG_PSC(pwm),
|
i2c_smbus_write_byte_data(client, PCA9532_REG_PSC(pwm),
|
||||||
|
@ -132,11 +132,11 @@ static void pca9532_set_brightness(struct led_classdev *led_cdev,
|
||||||
led->state = PCA9532_ON;
|
led->state = PCA9532_ON;
|
||||||
else {
|
else {
|
||||||
led->state = PCA9532_PWM0; /* Thecus: hardcode one pwm */
|
led->state = PCA9532_PWM0; /* Thecus: hardcode one pwm */
|
||||||
err = pca9532_calcpwm(led->client, 0, 0, value);
|
err = pca9532_calcpwm(led->client, 0, 0, value);
|
||||||
if (err)
|
if (err)
|
||||||
return; /* XXX: led api doesn't allow error code? */
|
return; /* XXX: led api doesn't allow error code? */
|
||||||
}
|
}
|
||||||
schedule_work(&led->work);
|
schedule_work(&led->work);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pca9532_set_blink(struct led_classdev *led_cdev,
|
static int pca9532_set_blink(struct led_classdev *led_cdev,
|
||||||
|
@ -145,7 +145,7 @@ static int pca9532_set_blink(struct led_classdev *led_cdev,
|
||||||
struct pca9532_led *led = ldev_to_led(led_cdev);
|
struct pca9532_led *led = ldev_to_led(led_cdev);
|
||||||
struct i2c_client *client = led->client;
|
struct i2c_client *client = led->client;
|
||||||
int psc;
|
int psc;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (*delay_on == 0 && *delay_off == 0) {
|
if (*delay_on == 0 && *delay_off == 0) {
|
||||||
/* led subsystem ask us for a blink rate */
|
/* led subsystem ask us for a blink rate */
|
||||||
|
@ -157,11 +157,11 @@ static int pca9532_set_blink(struct led_classdev *led_cdev,
|
||||||
|
|
||||||
/* Thecus specific: only use PSC/PWM 0 */
|
/* Thecus specific: only use PSC/PWM 0 */
|
||||||
psc = (*delay_on * 152-1)/1000;
|
psc = (*delay_on * 152-1)/1000;
|
||||||
err = pca9532_calcpwm(client, 0, psc, led_cdev->brightness);
|
err = pca9532_calcpwm(client, 0, psc, led_cdev->brightness);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
schedule_work(&led->work);
|
schedule_work(&led->work);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pca9532_event(struct input_dev *dev, unsigned int type,
|
static int pca9532_event(struct input_dev *dev, unsigned int type,
|
||||||
|
@ -178,15 +178,15 @@ static int pca9532_event(struct input_dev *dev, unsigned int type,
|
||||||
else
|
else
|
||||||
data->pwm[1] = 0;
|
data->pwm[1] = 0;
|
||||||
|
|
||||||
schedule_work(&data->work);
|
schedule_work(&data->work);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pca9532_input_work(struct work_struct *work)
|
static void pca9532_input_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct pca9532_data *data;
|
struct pca9532_data *data;
|
||||||
data = container_of(work, struct pca9532_data, work);
|
data = container_of(work, struct pca9532_data, work);
|
||||||
mutex_lock(&data->update_lock);
|
mutex_lock(&data->update_lock);
|
||||||
i2c_smbus_write_byte_data(data->client, PCA9532_REG_PWM(1),
|
i2c_smbus_write_byte_data(data->client, PCA9532_REG_PWM(1),
|
||||||
data->pwm[1]);
|
data->pwm[1]);
|
||||||
|
@ -195,11 +195,11 @@ static void pca9532_input_work(struct work_struct *work)
|
||||||
|
|
||||||
static void pca9532_led_work(struct work_struct *work)
|
static void pca9532_led_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct pca9532_led *led;
|
struct pca9532_led *led;
|
||||||
led = container_of(work, struct pca9532_led, work);
|
led = container_of(work, struct pca9532_led, work);
|
||||||
if (led->state == PCA9532_PWM0)
|
if (led->state == PCA9532_PWM0)
|
||||||
pca9532_setpwm(led->client, 0);
|
pca9532_setpwm(led->client, 0);
|
||||||
pca9532_setled(led);
|
pca9532_setled(led);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pca9532_configure(struct i2c_client *client,
|
static int pca9532_configure(struct i2c_client *client,
|
||||||
|
@ -232,7 +232,7 @@ static int pca9532_configure(struct i2c_client *client,
|
||||||
led->ldev.brightness = LED_OFF;
|
led->ldev.brightness = LED_OFF;
|
||||||
led->ldev.brightness_set = pca9532_set_brightness;
|
led->ldev.brightness_set = pca9532_set_brightness;
|
||||||
led->ldev.blink_set = pca9532_set_blink;
|
led->ldev.blink_set = pca9532_set_blink;
|
||||||
INIT_WORK(&led->work, pca9532_led_work);
|
INIT_WORK(&led->work, pca9532_led_work);
|
||||||
err = led_classdev_register(&client->dev, &led->ldev);
|
err = led_classdev_register(&client->dev, &led->ldev);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(&client->dev,
|
dev_err(&client->dev,
|
||||||
|
@ -262,11 +262,11 @@ static int pca9532_configure(struct i2c_client *client,
|
||||||
BIT_MASK(SND_TONE);
|
BIT_MASK(SND_TONE);
|
||||||
data->idev->event = pca9532_event;
|
data->idev->event = pca9532_event;
|
||||||
input_set_drvdata(data->idev, data);
|
input_set_drvdata(data->idev, data);
|
||||||
INIT_WORK(&data->work, pca9532_input_work);
|
INIT_WORK(&data->work, pca9532_input_work);
|
||||||
err = input_register_device(data->idev);
|
err = input_register_device(data->idev);
|
||||||
if (err) {
|
if (err) {
|
||||||
input_free_device(data->idev);
|
input_free_device(data->idev);
|
||||||
cancel_work_sync(&data->work);
|
cancel_work_sync(&data->work);
|
||||||
data->idev = NULL;
|
data->idev = NULL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -283,13 +283,13 @@ exit:
|
||||||
break;
|
break;
|
||||||
case PCA9532_TYPE_LED:
|
case PCA9532_TYPE_LED:
|
||||||
led_classdev_unregister(&data->leds[i].ldev);
|
led_classdev_unregister(&data->leds[i].ldev);
|
||||||
cancel_work_sync(&data->leds[i].work);
|
cancel_work_sync(&data->leds[i].work);
|
||||||
break;
|
break;
|
||||||
case PCA9532_TYPE_N2100_BEEP:
|
case PCA9532_TYPE_N2100_BEEP:
|
||||||
if (data->idev != NULL) {
|
if (data->idev != NULL) {
|
||||||
input_unregister_device(data->idev);
|
input_unregister_device(data->idev);
|
||||||
input_free_device(data->idev);
|
input_free_device(data->idev);
|
||||||
cancel_work_sync(&data->work);
|
cancel_work_sync(&data->work);
|
||||||
data->idev = NULL;
|
data->idev = NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -340,13 +340,13 @@ static int pca9532_remove(struct i2c_client *client)
|
||||||
break;
|
break;
|
||||||
case PCA9532_TYPE_LED:
|
case PCA9532_TYPE_LED:
|
||||||
led_classdev_unregister(&data->leds[i].ldev);
|
led_classdev_unregister(&data->leds[i].ldev);
|
||||||
cancel_work_sync(&data->leds[i].work);
|
cancel_work_sync(&data->leds[i].work);
|
||||||
break;
|
break;
|
||||||
case PCA9532_TYPE_N2100_BEEP:
|
case PCA9532_TYPE_N2100_BEEP:
|
||||||
if (data->idev != NULL) {
|
if (data->idev != NULL) {
|
||||||
input_unregister_device(data->idev);
|
input_unregister_device(data->idev);
|
||||||
input_free_device(data->idev);
|
input_free_device(data->idev);
|
||||||
cancel_work_sync(&data->work);
|
cancel_work_sync(&data->work);
|
||||||
data->idev = NULL;
|
data->idev = NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue