summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlokilee73 <changjoo.lee@samsung.com>2021-01-15 19:55:13 +0900
committerlokilee73 <changjoo.lee@samsung.com>2021-01-18 12:34:15 +0900
commit581dd2a1c9cf9c1c1ae6fa843e7b233b1321c7c9 (patch)
treec70a48bb13657838c99fc8b057ca1e23c09f0ec5
parentb21c1ac8761115ece5c790f1515bf53d921100dc (diff)
downloaddevice-tm1-581dd2a1c9cf9c1c1ae6fa843e7b233b1321c7c9.tar.gz
device-tm1-581dd2a1c9cf9c1c1ae6fa843e7b233b1321c7c9.tar.bz2
device-tm1-581dd2a1c9cf9c1c1ae6fa843e7b233b1321c7c9.zip
Rework led hal
Change-Id: I22edb80dbd4a936068c0960cc618cd1762c17bc0 Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
-rw-r--r--hw/led/led.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/hw/led/led.c b/hw/led/led.c
index 84b6efc..70850ea 100644
--- a/hw/led/led.c
+++ b/hw/led/led.c
@@ -32,12 +32,12 @@
#define CAMERA_BACK_PATH "/sys/class/leds/torch-sec1"
#endif
-static int camera_back_set_state(struct led_state *state)
+static int camera_back_set_state(enum led_device_type type, struct led_state *state)
{
static int max = -1;
int brt, r;
- if (!state) {
+ if ((type != CAMERA_BACK) || !state) {
_E("wrong parameter");
return -EINVAL;
}
@@ -69,25 +69,45 @@ static int camera_back_set_state(struct led_state *state)
static int led_init(void **data)
{
- hal_backend_led_funcs *led_funcs;
+ hal_backend_led_funcs *led_device;
- led_funcs = calloc(1, sizeof(hal_backend_led_funcs));
- if (!led_funcs)
+ led_device = calloc(1, sizeof(hal_backend_led_funcs));
+ if (!led_device)
return -ENOMEM;
- led_funcs->set_state = camera_back_set_state;
+ led_device->camera_front = NULL;
+ led_device->notification = NULL;
+ led_device->touch_key = NULL;
+ led_device->camera_back = calloc(1, sizeof(struct led_funcs));
+ if (!led_device->camera_back) {
+ free(led_device);
+ return -ENOMEM;
+ }
+
+ led_device->camera_back->set_state = camera_back_set_state;
+ led_device->camera_back->get_state = NULL;
+ led_device->camera_back->get_number = NULL;
+ led_device->camera_back->set_num = NULL;
+ led_device->camera_back->get_max_num = NULL;
+ led_device->camera_back->keyled_set_state = NULL;
+ led_device->camera_back->keyled_get_state = NULL;
- *data = (void *)led_funcs;
+ *data = (void *)led_device;
return 0;
}
static int led_exit(void *data)
{
+ hal_backend_led_funcs *led_device;
+
if (!data)
return 0;
- free(data);
+ led_device = (hal_backend_led_funcs *)data;
+ free(led_device->camera_back);
+ free(led_device);
+
return 0;
}