154907957f
Combination of the following changes: Mon, 23 Feb 2009 14:21:10 +0100 (CET) firedtv: reinstate debug logging option Henrik Kurelid tells me that FCP debug logging (which I removed during cleanups) is still useful when working on driver issues together with end users. So bring it back in an updated form with only 60% of the original code footprint. Logging can be enabled with # echo -1 > /sys/module/firedtv/parameters/debug 1 instead of -1 enables only FCP header logging, 2 instead of -1 enables only hexdumps of the entire FCP frames. 0 switches logging off again. Fri, 20 Feb 2009 20:54:27 +0100 (CET) firedtv: build fix for INPUT=m and DVB_FIREDTV=y Thu, 19 Feb 2009 20:40:39 +0100 firedtv: use msecs_to_jiffies Pointed out by Mauro Carvalho Chehab. Sun Feb 15 20:50:46 CET 2009 firedtv: some more housekeeping Fix an old checkpatch warning and a new compiler warning. Sun Feb 15 15:33:17 CET 2009 firedtv: rename a file once more At the moment, about a third of avc.c is specific to FireDTVs rather than generic AV/C code. Rename it to firedtv-avc.c. Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: more compact channels backing store Replace struct firedtv_channel { bool active; int pid; } channel[16]; by unsigned long channel_active; u16 channel_pid[16];. Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: some simplifications c->active was unnecessarily cleared twice. Also, by marking the channel inactive before the for loop, the loop becomes identical with fdtv_channel_collect(). Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: remove a bogus loop This loop is unnecessary because - only active channel[].pid's will be sent to the device, - when a channel is activated, its pid is set to dvbdmxfeed->pid. Perhaps the original code was there because it was initially not fully covered by the fdtv->demux_mutex. Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: fix mutex protection fdtv_start_feed() accessed the channel list unsafely. Fully serialize it with itself and fdtv_stop_feed(). Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: fix missing braces Original code was: ... case DMX_TS_PES_OTHER: //Dirty fix to keep firesat->channel pid-list up to date for(k=0;k<16;k++){ if(firesat->channel[k].active == 0) firesat->channel[k].pid = dvbdmxfeed->pid; break; } channel = firesat_channel_allocate(firesat); break; default: ... Looks bogus in several respects. For now let's just add braces to the if because that seems to be what the author meant. Sun Feb 15 15:33:17 CET 2009 firedtv: allow build without input subsystem !CONFIG_INPUT is very unlikely on systems on which firedtv is of interest. But we can easily support it. Sun Feb 15 15:33:17 CET 2009 firedtv: replace EXTRA_CFLAGS by ccflags The former are deprecated. The latter can depend on Kconfig variables. Sun Feb 15 15:33:17 CET 2009 firedtv: concentrate ieee1394 dependencies Move the entire interface with drivers/ieee1394 to firedtv-1394.c. Move 1394-independent module initialization code to firedtv-dvb.c. This prepares interfacing with drivers/firewire. Sun Feb 15 15:33:17 CET 2009 firedtv: amend Kconfig menu prompt Sun Feb 15 15:33:17 CET 2009 firedtv: remove kernel version compatibility macro Sun Feb 15 15:33:17 CET 2009 firedtv: combine header files avc.h and firedtv-*.h are small and currently not shared with other drivers, hence concatenate them all into firedtv.h. Sun Feb 15 15:33:17 CET 2009 firedtv: misc style touch-ups Standardize on lower-case hexadecimal constants. Adjust whitespace. Omit unnecessary pointer type casts and an unnecessary list head initialization. Use dev_printk. Wed Feb 11 21:21:04 CET 2009 firedtv: avc, ci: remove unused constants Wed Feb 11 21:21:04 CET 2009 firedtv: avc: remove bitfields from read descriptor response operands Don't use bitfields in struct types of on-the-wire data. Wed Feb 11 21:21:04 CET 2009 firedtv: avc: remove bitfields from DSD command operands Don't use bitfields in struct types of on-the-wire data. Wed Feb 11 21:21:04 CET 2009 firedtv: avc: header file cleanup Remove unused constants and declarations. Move privately used constants into .c files. Wed Feb 11 21:21:04 CET 2009 firedtv: avc: remove bitfields from FCP frame types Don't use bitfields in struct types of on-the-wire data. Also move many privately used constants from avc.h to avc.c and remove some unused constants. Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: avc: fix offset in avc_tuner_get_ts The parentheses were wrong. It didn't matter though because this code only writes a 0 into an area which is already initialized to 0. Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: avc: reduce stack usage, remove two typedefs It is safe to share a memory buffer for command frame and response frame because the response data come in after the command frame was last used. Even less stack would be required if only the actual required frame size instead of the entire FCP register size was allocated. Also, rename the defined types AVCCmdFrm and AVCRspFrm to struct avc_command_frame and struct avc_response_frame. TODO: Remove the bitfields in these types. Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: cmp: move code to avc Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: iso: move code to firedtv-1394 Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: iso: remove unnecessary struct type definitions Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: iso: style changes and fixlets Add cleanup after failure in setup_iso_channel. Replace printk() by dv_err(). Decrease indentation level in rawiso_activity_cb(). Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
190 lines
3.8 KiB
C
190 lines
3.8 KiB
C
/*
|
|
* FireDTV driver (formerly known as FireSAT)
|
|
*
|
|
* Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; either version 2 of
|
|
* the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#include <linux/bitops.h>
|
|
#include <linux/input.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/string.h>
|
|
#include <linux/types.h>
|
|
|
|
#include "firedtv.h"
|
|
|
|
/* fixed table with older keycodes, geared towards MythTV */
|
|
const static u16 oldtable[] = {
|
|
|
|
/* code from device: 0x4501...0x451f */
|
|
|
|
KEY_ESC,
|
|
KEY_F9,
|
|
KEY_1,
|
|
KEY_2,
|
|
KEY_3,
|
|
KEY_4,
|
|
KEY_5,
|
|
KEY_6,
|
|
KEY_7,
|
|
KEY_8,
|
|
KEY_9,
|
|
KEY_I,
|
|
KEY_0,
|
|
KEY_ENTER,
|
|
KEY_RED,
|
|
KEY_UP,
|
|
KEY_GREEN,
|
|
KEY_F10,
|
|
KEY_SPACE,
|
|
KEY_F11,
|
|
KEY_YELLOW,
|
|
KEY_DOWN,
|
|
KEY_BLUE,
|
|
KEY_Z,
|
|
KEY_P,
|
|
KEY_PAGEDOWN,
|
|
KEY_LEFT,
|
|
KEY_W,
|
|
KEY_RIGHT,
|
|
KEY_P,
|
|
KEY_M,
|
|
|
|
/* code from device: 0x4540...0x4542 */
|
|
|
|
KEY_R,
|
|
KEY_V,
|
|
KEY_C,
|
|
};
|
|
|
|
/* user-modifiable table for a remote as sold in 2008 */
|
|
const static u16 keytable[] = {
|
|
|
|
/* code from device: 0x0300...0x031f */
|
|
|
|
[0x00] = KEY_POWER,
|
|
[0x01] = KEY_SLEEP,
|
|
[0x02] = KEY_STOP,
|
|
[0x03] = KEY_OK,
|
|
[0x04] = KEY_RIGHT,
|
|
[0x05] = KEY_1,
|
|
[0x06] = KEY_2,
|
|
[0x07] = KEY_3,
|
|
[0x08] = KEY_LEFT,
|
|
[0x09] = KEY_4,
|
|
[0x0a] = KEY_5,
|
|
[0x0b] = KEY_6,
|
|
[0x0c] = KEY_UP,
|
|
[0x0d] = KEY_7,
|
|
[0x0e] = KEY_8,
|
|
[0x0f] = KEY_9,
|
|
[0x10] = KEY_DOWN,
|
|
[0x11] = KEY_TITLE, /* "OSD" - fixme */
|
|
[0x12] = KEY_0,
|
|
[0x13] = KEY_F20, /* "16:9" - fixme */
|
|
[0x14] = KEY_SCREEN, /* "FULL" - fixme */
|
|
[0x15] = KEY_MUTE,
|
|
[0x16] = KEY_SUBTITLE,
|
|
[0x17] = KEY_RECORD,
|
|
[0x18] = KEY_TEXT,
|
|
[0x19] = KEY_AUDIO,
|
|
[0x1a] = KEY_RED,
|
|
[0x1b] = KEY_PREVIOUS,
|
|
[0x1c] = KEY_REWIND,
|
|
[0x1d] = KEY_PLAYPAUSE,
|
|
[0x1e] = KEY_NEXT,
|
|
[0x1f] = KEY_VOLUMEUP,
|
|
|
|
/* code from device: 0x0340...0x0354 */
|
|
|
|
[0x20] = KEY_CHANNELUP,
|
|
[0x21] = KEY_F21, /* "4:3" - fixme */
|
|
[0x22] = KEY_TV,
|
|
[0x23] = KEY_DVD,
|
|
[0x24] = KEY_VCR,
|
|
[0x25] = KEY_AUX,
|
|
[0x26] = KEY_GREEN,
|
|
[0x27] = KEY_YELLOW,
|
|
[0x28] = KEY_BLUE,
|
|
[0x29] = KEY_CHANNEL, /* "CH.LIST" */
|
|
[0x2a] = KEY_VENDOR, /* "CI" - fixme */
|
|
[0x2b] = KEY_VOLUMEDOWN,
|
|
[0x2c] = KEY_CHANNELDOWN,
|
|
[0x2d] = KEY_LAST,
|
|
[0x2e] = KEY_INFO,
|
|
[0x2f] = KEY_FORWARD,
|
|
[0x30] = KEY_LIST,
|
|
[0x31] = KEY_FAVORITES,
|
|
[0x32] = KEY_MENU,
|
|
[0x33] = KEY_EPG,
|
|
[0x34] = KEY_EXIT,
|
|
};
|
|
|
|
int fdtv_register_rc(struct firedtv *fdtv, struct device *dev)
|
|
{
|
|
struct input_dev *idev;
|
|
int i, err;
|
|
|
|
idev = input_allocate_device();
|
|
if (!idev)
|
|
return -ENOMEM;
|
|
|
|
fdtv->remote_ctrl_dev = idev;
|
|
idev->name = "FireDTV remote control";
|
|
idev->dev.parent = dev;
|
|
idev->evbit[0] = BIT_MASK(EV_KEY);
|
|
idev->keycode = kmemdup(keytable, sizeof(keytable), GFP_KERNEL);
|
|
if (!idev->keycode) {
|
|
err = -ENOMEM;
|
|
goto fail;
|
|
}
|
|
idev->keycodesize = sizeof(keytable[0]);
|
|
idev->keycodemax = ARRAY_SIZE(keytable);
|
|
|
|
for (i = 0; i < ARRAY_SIZE(keytable); i++)
|
|
set_bit(keytable[i], idev->keybit);
|
|
|
|
err = input_register_device(idev);
|
|
if (err)
|
|
goto fail_free_keymap;
|
|
|
|
return 0;
|
|
|
|
fail_free_keymap:
|
|
kfree(idev->keycode);
|
|
fail:
|
|
input_free_device(idev);
|
|
return err;
|
|
}
|
|
|
|
void fdtv_unregister_rc(struct firedtv *fdtv)
|
|
{
|
|
kfree(fdtv->remote_ctrl_dev->keycode);
|
|
input_unregister_device(fdtv->remote_ctrl_dev);
|
|
}
|
|
|
|
void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code)
|
|
{
|
|
u16 *keycode = fdtv->remote_ctrl_dev->keycode;
|
|
|
|
if (code >= 0x0300 && code <= 0x031f)
|
|
code = keycode[code - 0x0300];
|
|
else if (code >= 0x0340 && code <= 0x0354)
|
|
code = keycode[code - 0x0320];
|
|
else if (code >= 0x4501 && code <= 0x451f)
|
|
code = oldtable[code - 0x4501];
|
|
else if (code >= 0x4540 && code <= 0x4542)
|
|
code = oldtable[code - 0x4521];
|
|
else {
|
|
printk(KERN_DEBUG "firedtv: invalid key code 0x%04x "
|
|
"from remote control\n", code);
|
|
return;
|
|
}
|
|
|
|
input_report_key(fdtv->remote_ctrl_dev, code, 1);
|
|
input_report_key(fdtv->remote_ctrl_dev, code, 0);
|
|
}
|