diff options
author | Mike Isely <isely@pobox.com> | 2008-04-22 13:45:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:48 -0400 |
commit | 40381cb02fb7fc0b46c55e3a71325b5d930580fa (patch) | |
tree | a2654ff76b947f1aa3dcee9bc4ad77e7504d022b /drivers/media/video/pvrusb2/pvrusb2-hdw.c | |
parent | c55a97d7538d5f3abbee5486e37e56e896478fbd (diff) |
V4L/DVB (7313): pvrusb2: Make LED control into a device-specific attribute
The pvrusb2 driver has used hardcoded logic to control the LED on the
device. However this is really Hauppauge-specific behavior. This
change defines a new device attribute for LED control and sets things
up appropriately for Hauppauge devices.
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 9b1e22f2e555..c51c5cef82dd 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -3357,24 +3357,48 @@ static void pvr2_hdw_cmd_modeswitch(struct pvr2_hdw *hdw,int digitalFl) | |||
3357 | } | 3357 | } |
3358 | 3358 | ||
3359 | 3359 | ||
3360 | /* Toggle LED */ | 3360 | void pvr2_led_ctrl_hauppauge(struct pvr2_hdw *hdw, int onoff) |
3361 | int pvr2_led_ctrl(struct pvr2_hdw *hdw, int onoff) | ||
3362 | { | 3361 | { |
3363 | /* change some GPIO data | 3362 | /* change some GPIO data |
3364 | * | 3363 | * |
3365 | * note: bit d7 of dir appears to control the LED, | 3364 | * note: bit d7 of dir appears to control the LED, |
3366 | * so we shut it off here. | 3365 | * so we shut it off here. |
3367 | * | 3366 | * |
3368 | * FIXME: is this device-specific? | ||
3369 | */ | 3367 | */ |
3370 | if (onoff) | 3368 | if (onoff) { |
3371 | pvr2_hdw_gpio_chg_dir(hdw, 0xffffffff, 0x00000481); | 3369 | pvr2_hdw_gpio_chg_dir(hdw, 0xffffffff, 0x00000481); |
3372 | else | 3370 | } else { |
3373 | pvr2_hdw_gpio_chg_dir(hdw, 0xffffffff, 0x00000401); | 3371 | pvr2_hdw_gpio_chg_dir(hdw, 0xffffffff, 0x00000401); |
3374 | 3372 | } | |
3375 | pvr2_hdw_gpio_chg_out(hdw, 0xffffffff, 0x00000000); | 3373 | pvr2_hdw_gpio_chg_out(hdw, 0xffffffff, 0x00000000); |
3374 | } | ||
3376 | 3375 | ||
3377 | return 0; | 3376 | |
3377 | typedef void (*led_method_func)(struct pvr2_hdw *,int); | ||
3378 | |||
3379 | static led_method_func led_methods[] = { | ||
3380 | [PVR2_LED_SCHEME_HAUPPAUGE] = pvr2_led_ctrl_hauppauge, | ||
3381 | }; | ||
3382 | |||
3383 | |||
3384 | /* Toggle LED */ | ||
3385 | static void pvr2_led_ctrl(struct pvr2_hdw *hdw,int onoff) | ||
3386 | { | ||
3387 | unsigned int scheme_id; | ||
3388 | led_method_func fp; | ||
3389 | |||
3390 | if ((!onoff) == (!hdw->led_on)) return; | ||
3391 | |||
3392 | hdw->led_on = onoff != 0; | ||
3393 | |||
3394 | scheme_id = hdw->hdw_desc->led_scheme; | ||
3395 | if (scheme_id < ARRAY_SIZE(led_methods)) { | ||
3396 | fp = led_methods[scheme_id]; | ||
3397 | } else { | ||
3398 | fp = NULL; | ||
3399 | } | ||
3400 | |||
3401 | if (fp) (*fp)(hdw,onoff); | ||
3378 | } | 3402 | } |
3379 | 3403 | ||
3380 | 3404 | ||
@@ -3871,6 +3895,7 @@ static int pvr2_hdw_state_eval(struct pvr2_hdw *hdw) | |||
3871 | "Device state change from %s to %s", | 3895 | "Device state change from %s to %s", |
3872 | pvr2_get_state_name(hdw->master_state), | 3896 | pvr2_get_state_name(hdw->master_state), |
3873 | pvr2_get_state_name(st)); | 3897 | pvr2_get_state_name(st)); |
3898 | pvr2_led_ctrl(hdw,st == PVR2_STATE_RUN); | ||
3874 | hdw->master_state = st; | 3899 | hdw->master_state = st; |
3875 | state_updated = !0; | 3900 | state_updated = !0; |
3876 | callback_flag = !0; | 3901 | callback_flag = !0; |