fujitsu-laptop: ACPI-related cleanups
Subsystems (3)
cover fujitsu-laptop: ACPI-related cleanups
In preparation for splitting fujitsu-laptop into two separate modules, I prepared two more cleanup series to minimize the amount of code being moved around. This first series contains all patches that touch ACPI in some way, which is why I am CCing linux-acpi as per Rafael's previous advice.
This patch series was based on platform-driver-x86/for-next and tested on a Lifebook S7020.
drivers/platform/x86/Kconfig | 10 -- drivers/platform/x86/fujitsu-laptop.c | 187 +++++++++------------------------- 2 files changed, 48 insertions(+), 149 deletions(-)
Signature · 1 line
2.13.1
PATCH 1/7 platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
All ACPI device notify callbacks are invoked using acpi_os_execute(), which causes the supplied callback to be queued to a static workqueue which always executes on CPU 0. This means that there is no possibility for any ACPI device notify callback to be concurrently executed on multiple CPUs, which in the case of fujitsu-laptop means that using a locked kfifo for handling hotkeys is redundant: as hotkey scancodes are only pushed and popped from within acpi_fujitsu_laptop_notify(), no risk of concurrent pushing and popping exists.
Instead of a kfifo, use a fixed-size integer table for storing pushed scancodes and an associated variable holding the number of scancodes currently stored in that table. Change debug messages so that they no longer contain the term "ringbuffer".
In order to simplify implementation, hotkey input device behavior is slightly changed (from FIFO to LIFO). The order of release events generated by the input device should not matter from end user perspective as upon releasing any hotkey the firmware only produces a single event which means "all hotkeys were released".
--- drivers/platform/x86/fujitsu-laptop.c | 54 +++++++++-------------------------- 1 file changed, 14 insertions(+), 40 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +14 -40
@@ -58,7 +58,6 @@#include <linux/fb.h> #include <linux/input.h> #include <linux/input/sparse-keymap.h> -#include <linux/kfifo.h> #include <linux/leds.h> #include <linux/platform_device.h> #include <linux/slab.h>
@@ -110,7 +109,6 @@#define KEY5_CODE 0x420#define MAX_HOTKEY_RINGBUFFER_SIZE 100 -#define RINGBUFFERSIZE 40/* Debugging */ #define FUJLAPTOP_DBG_ERROR 0x0001
@@ -146,8 +144,8 @@ struct fujitsu_laptop {struct input_dev *input;char phys[32 ];struct platform_device *pf_device; -struct kfifo fifo; -spinlock_t fifo_lock; +int scancode_buf[40 ]; +int scancode_count;int flags_supported;int flags_state; };
@@ -813,23 +811,14 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)sprintf (acpi_device_class (device),"%s" ,ACPI_FUJITSU_CLASS ); device->driver_data = priv; -/* kfifo */ -spin_lock_init (&priv->fifo_lock); - error =kfifo_alloc (&priv->fifo,RINGBUFFERSIZE *sizeof (int ), -GFP_KERNEL ); -if (error) { -pr_err ("kfifo_alloc failed\n" ); - goto err_stop; - } - error =acpi_fujitsu_laptop_input_setup (device);if (error) - goto err_free_fifo; +return error; error =acpi_bus_update_power (device->handle, &state);if (error) {pr_err ("Error reading power state\n" ); - goto err_free_fifo; +return error; } pr_info("ACPI: %s [%s] (%s)\n",
@@ -877,62 +866,47 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) error =acpi_fujitsu_laptop_leds_register (device);if (error) - goto err_free_fifo; +return error; error =fujitsu_laptop_platform_add (device);if (error) - goto err_free_fifo; +return error;return 0 ; - -err_free_fifo: -kfifo_free (&priv->fifo); -err_stop: -return error; }static int acpi_fujitsu_laptop_remove (struct acpi_device *device) { -struct fujitsu_laptop *priv =acpi_driver_data (device); -fujitsu_laptop_platform_remove (device); -kfifo_free (&priv->fifo); -return 0 ; }static void acpi_fujitsu_laptop_press (struct acpi_device *device,int scancode) {struct fujitsu_laptop *priv =acpi_driver_data (device); -int status; - status =kfifo_in_locked (&priv->fifo, (unsigned char *)&scancode, -sizeof (scancode), &priv->fifo_lock); -if (status !=sizeof (scancode)) { +if (priv->scancode_count ==ARRAY_SIZE (priv->scancode_buf)) {vdbg_printk (FUJLAPTOP_DBG_WARN ,"Could not push scancode [0x%x]\n" , scancode);return ; } + priv->scancode_buf[priv->scancode_count++] = scancode;sparse_keymap_report_event (priv->input, scancode,1 , false);vdbg_printk (FUJLAPTOP_DBG_TRACE , -"Push scancode into ringbuffer [0x%x]\n" , scancode); +"Push scancode into buffer [0x%x]\n" , scancode); }static void acpi_fujitsu_laptop_release (struct acpi_device *device) {struct fujitsu_laptop *priv =acpi_driver_data (device); -int scancode, status; - -while (true) { - status =kfifo_out_locked (&priv->fifo, - (unsigned char *)&scancode, -sizeof (scancode), &priv->fifo_lock); -if (status !=sizeof (scancode)) -return ; +int scancode; + +while (priv->scancode_count >0 ) { + scancode = priv->scancode_buf[--priv->scancode_count];sparse_keymap_report_event (priv->input, scancode,0 , false);vdbg_printk (FUJLAPTOP_DBG_TRACE , -"Pop scancode from ringbuffer [0x%x]\n" , scancode); +"Pop scancode from buffer [0x%x]\n" , scancode); } }
Signature · 1 line
2.13.1
PATCH 2/7 platform/x86: fujitsu-laptop: remove redundant safety checks
In reply to Michał KępieńDo not check whether the pointer passed to ACPI add callbacks is NULL as it is earlier dereferenced anyway in the bus-level probe callback, acpi_device_probe().
Do not check the value of acpi_disabled in fujitsu_init(), because it is already done by acpi_bus_register_driver(), which is the first function called by fujitsu_init().
--- drivers/platform/x86/fujitsu-laptop.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +0 -9
@@ -406,9 +406,6 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device)if (acpi_video_get_backlight_type () != acpi_backlight_vendor)return -ENODEV ; -if (!device) -return -EINVAL ; - priv =devm_kzalloc (&device->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;
@@ -796,9 +793,6 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)int error;int i; -if (!device) -return -EINVAL ; - priv =devm_kzalloc (&device->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;
@@ -993,9 +987,6 @@ static int __init fujitsu_init(void) {int ret; -if (acpi_disabled) -return -ENODEV ; - ret =acpi_bus_register_driver (&acpi_fujitsu_bl_driver);if (ret)return ret;
Signature · 1 line
2.13.1
PATCH 3/7 platform/x86: fujitsu-laptop: use strcpy to set ACPI device names and classes
In reply to Michał KępieńNo formatting is needed when setting ACPI device name and class, so switch to using strcpy() for this purpose.
--- drivers/platform/x86/fujitsu-laptop.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +4 -5
@@ -411,8 +411,8 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device)return -ENOMEM ; fujitsu_bl = priv; -sprintf (acpi_device_name (device),"%s" ,ACPI_FUJITSU_BL_DEVICE_NAME ); -sprintf (acpi_device_class (device),"%s" ,ACPI_FUJITSU_CLASS ); +strcpy (acpi_device_name (device),ACPI_FUJITSU_BL_DEVICE_NAME ); +strcpy (acpi_device_class (device),ACPI_FUJITSU_CLASS ); device->driver_data = priv; error =acpi_fujitsu_bl_input_setup (device);
@@ -800,9 +800,8 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)WARN_ONCE (fext,"More than one FUJ02E3 ACPI device was found. Driver may not work as intended." ); fext = device; -sprintf (acpi_device_name (device),"%s" , -ACPI_FUJITSU_LAPTOP_DEVICE_NAME ); -sprintf (acpi_device_class (device),"%s" ,ACPI_FUJITSU_CLASS ); +strcpy (acpi_device_name (device),ACPI_FUJITSU_LAPTOP_DEVICE_NAME ); +strcpy (acpi_device_class (device),ACPI_FUJITSU_CLASS ); device->driver_data = priv; error =acpi_fujitsu_laptop_input_setup (device);
Signature · 1 line
2.13.1
PATCH 4/7 platform/x86: fujitsu-laptop: sanitize hotkey input device identification
In reply to Michał KępieńIn the case of brightness-related FUJ02B1 ACPI device, initializing the input device associated with it identically as acpi-video initializes its input device makes sense. However, using the same data for the input device associated with the FUJ02E3 ACPI device makes little sense, because the latter has nothing to do with video and assigning an arbitrary product ID to it is redundant.
--- drivers/platform/x86/fujitsu-laptop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +1 -2
@@ -555,13 +555,12 @@ static int acpi_fujitsu_laptop_input_setup(struct acpi_device *device)if (!priv->input)return -ENOMEM ; -snprintf (priv->phys,sizeof (priv->phys),"%s/video/input0" , +snprintf (priv->phys,sizeof (priv->phys),"%s/input0" ,acpi_device_hid (device)); priv->input->name =acpi_device_name (device); priv->input->phys = priv->phys; priv->input->id.bustype =BUS_HOST ; - priv->input->id.product =0x06 ;dmi_check_system (fujitsu_laptop_dmi_table); ret =sparse_keymap_setup (priv->input, keymap,NULL );
Signature · 1 line
2.13.1
PATCH 5/7 platform/x86: fujitsu-laptop: do not update ACPI device power status
In reply to Michał KępieńCalling acpi_bus_update_power() for ACPI devices FUJ02B1 and FUJ02E3 is pointless as they are not power manageable (neither _PS0 nor _PR0 is defined for any of them), which causes their power state to be inherited from their parent devices. Given the ACPI paths of these two devices (\_SB.PCI0.LPCB.FJEX, \_SB.FEXT), their parent devices are also not power manageable. These parent devices will thus have their power state initialized to ACPI_STATE_D0, which in turn causes the power state for both FUJ02B1 and FUJ02E3 to always be ACPI_STATE_D0 ("on").
Remove relevant acpi_bus_update_power() calls along with parts of debug messages that they were supposed to have an effect on.
--- drivers/platform/x86/fujitsu-laptop.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +4 -20
@@ -400,7 +400,6 @@ static int fujitsu_backlight_register(struct acpi_device *device)static int acpi_fujitsu_bl_add (struct acpi_device *device) {struct fujitsu_bl *priv; -int state =0 ;int error;if (acpi_video_get_backlight_type () != acpi_backlight_vendor)
@@ -419,15 +418,8 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device)if (error)return error; - error =acpi_bus_update_power (device->handle, &state); -if (error) { -pr_err ("Error reading power state\n" ); -return error; - } - -pr_info ("ACPI: %s [%s] (%s)\n" , -acpi_device_name (device),acpi_device_bid (device), - !device->power.state ?"on" :"off" ); +pr_info ("ACPI: %s [%s]\n" , +acpi_device_name (device),acpi_device_bid (device));if (acpi_has_method (device->handle,METHOD_NAME__INI )) {vdbg_printk (FUJLAPTOP_DBG_INFO ,"Invoking _INI\n" );
@@ -788,7 +780,6 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)static int acpi_fujitsu_laptop_add (struct acpi_device *device) {struct fujitsu_laptop *priv; -int state =0 ;int error;int i;
@@ -807,15 +798,8 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)if (error)return error; - error =acpi_bus_update_power (device->handle, &state); -if (error) { -pr_err ("Error reading power state\n" ); -return error; - } - -pr_info ("ACPI: %s [%s] (%s)\n" , -acpi_device_name (device),acpi_device_bid (device), - !device->power.state ?"on" :"off" ); +pr_info ("ACPI: %s [%s]\n" , +acpi_device_name (device),acpi_device_bid (device));if (acpi_has_method (device->handle,METHOD_NAME__INI )) {vdbg_printk (FUJLAPTOP_DBG_INFO ,"Invoking _INI\n" );
Signature · 1 line
2.13.1
PATCH 6/7 platform/x86: fujitsu-laptop: do not evaluate ACPI _INI methods
In reply to Michał Kępieńacpi_ns_initialize_devices(), which is called during system-wide ACPI initialization, already detects and calls all _INI methods belonging to objects present in ACPI tables. There is no need to call these methods again every time the module is loaded because they only initialize status flags and hotkey-related variables; status flags are effectively constants, hotkey-related variables may be assigned non-zero values before acpi_fujitsu_laptop_add() is called, but that does not really matter as we drain the scancodes queued in the firmware's ring buffer before doing anything else.
Remove sections of code which invoke and check evaluation status of the _INI methods belonging to the ACPI devices handled by the driver.
--- drivers/platform/x86/fujitsu-laptop.c | 16 ---------------- 1 file changed, 16 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +0 -16
@@ -421,14 +421,6 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device)pr_info ("ACPI: %s [%s]\n" ,acpi_device_name (device),acpi_device_bid (device)); -if (acpi_has_method (device->handle,METHOD_NAME__INI )) { -vdbg_printk (FUJLAPTOP_DBG_INFO ,"Invoking _INI\n" ); -if (ACPI_FAILURE - (acpi_evaluate_object - (device->handle,METHOD_NAME__INI ,NULL ,NULL ))) -pr_err ("_INI Method failed\n" ); - } -if (get_max_brightness (device) <=0 ) priv->max_brightness =FUJITSU_LCD_N_LEVELS ;get_lcd_level (device);
@@ -801,14 +793,6 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)pr_info ("ACPI: %s [%s]\n" ,acpi_device_name (device),acpi_device_bid (device)); -if (acpi_has_method (device->handle,METHOD_NAME__INI )) { -vdbg_printk (FUJLAPTOP_DBG_INFO ,"Invoking _INI\n" ); -if (ACPI_FAILURE - (acpi_evaluate_object - (device->handle,METHOD_NAME__INI ,NULL ,NULL ))) -pr_err ("_INI Method failed\n" ); - } - i =0 ;while (call_fext_func (device,FUNC_BUTTONS ,0x1 ,0x0 ,0x0 ) !=0 && (i++) <MAX_HOTKEY_RINGBUFFER_SIZE )
Signature · 1 line
2.13.1
PATCH 7/7 platform/x86: fujitsu-laptop: rework debugging
In reply to Michał KępieńUsing a dedicated Kconfig option for enabling debugging means the user may be forced to recompile their kernel in order to gather debugging information, which is inconvenient. Replace custom debugging infrastructure with standard logging functions, taking advantage of dynamic debug. Replace a pr_info() call inside an ACPI callback with an acpi_handle_info() call.
The following mapping was used:
- FUJLAPTOP_DBG_ERROR -> acpi_handle_err()
- FUJLAPTOP_DBG_WARN -> acpi_handle_info() / dev_info()
- FUJLAPTOP_DBG_INFO -> acpi_handle_debug()
- FUJLAPTOP_DBG_TRACE -> acpi_handle_debug() / dev_dbg()
This means that some events which used to only be logged when the user explicitly requested it will now be logged by default:
- ACPI method evaluation errors,
- unknown ACPI notification codes,
- unknown hotkey scancodes.
The first type of events should happen rarely, if ever at all. The rest is interesting from driver development perspective as their presence in the logs will mean the driver is unaware of certain events, handling of which should be implemented.
--- drivers/platform/x86/Kconfig | 10 ----- drivers/platform/x86/fujitsu-laptop.c | 78 +++++++++++++---------------------- 2 files changed, 28 insertions(+), 60 deletions(-)
drivers/platform/x86/Kconfig +0 -10
@@ -195,16 +195,6 @@ config FUJITSU_LAPTOP If you have a Fujitsu laptop, say Y or M here. -config FUJITSU_LAPTOP_DEBUG - bool "Verbose debug mode for Fujitsu Laptop Extras" - depends on FUJITSU_LAPTOP - default n - ---help--- - Enables extra debug output from the fujitsu extras driver, at the - expense of a slight increase in driver size. - - If you are not sure, say N here. - config FUJITSU_TABLET tristate "Fujitsu Tablet Extras" depends on ACPI
drivers/platform/x86/fujitsu-laptop.c +28 -50
181 lines not on this page · raw message
Signature · 1 line
2.13.1
Hi Michel
Quoted 8 lines · Micha?? K??pie??
In preparation for splitting fujitsu-laptop into two separate modules, I prepared two more cleanup series to minimize the amount of code being moved around. This first series contains all patches that touch ACPI in some way, which is why I am CCing linux-acpi as per Rafael's previous advice.
This patch series was based on platform-driver-x86/for-next and tested on a Lifebook S7020.
As far as I can tell this series looks good. It is, as you said, another step towards the splitting of this driver into two separate modules. I have a few brief comments.
Patch 1:
- The argument for this change assumes that the execution methodology of the acpi_os_execute() remains as is, since this is what guarantees the absence of concurrency concerns. If it is fair to assume that we don't have to worry about such things which may never happen then there's no problem with this patch.
Patch 2:
- No problem.
Patch 3:
- No problem.
Patch 4:
- Presumedly the change in device path doesn't count as an API change. Given that, I have no objection since the argument put forward makes sense.
Patch 5:
- I am not overly familiar with the power management infrastructure within the ACPI subsystem, but the presented argument seems sensible to me. This patch is therefore fine if the given assumptions hold.
Patch 6:
- This seems fair.
Patch 7:
- The motivations which lead to the creation of the debug Kconfig option are now moot. The elimination of this and the custom logging code is therefore entirely justified.
To summarise, I see no major issues with this patch set so long as the minor details noted above are of no consequence. Applying this will assist with the end-goal of splitting the driver into two modules since it will minimise the changes needed at the time the split is carried out.
Regards
jonathan
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
In reply to Michał KępieńQuoted 8 lines · Michał Kępień
All ACPI device notify callbacks are invoked using
acpi_os_execute(), which causes the supplied callback to be queued to a static workqueue which always executes on CPU 0. This means that there is no possibility for any ACPI device notify callback to be concurrently executed on multiple CPUs, which in the case of fujitsu-laptop means that using a locked kfifo for handling hotkeys is redundant: as hotkey scancodes are only pushed and popped from withinacpi_fujitsu_laptop_notify(), no risk of concurrent pushing and popping exists.
Was the kfifo causing a problem currently or for the migration to separate modules? Is this purely a simplification?
Rafael, the above rationale appears sound to me. Do you have any concerns?
...
drivers/platform/x86/fujitsu-laptop.c struct fujitsu_laptop { · line 147
Quoted 11 lines
drivers/platform/x86/fujitsu-laptop.c +1
-3-#define RINGBUFFERSIZE 40/* Debugging */ #define FUJLAPTOP_DBG_ERROR 0x0001@@ -146,8 +144,8 @@ struct fujitsu_laptop {struct input_dev *input;char phys[32 ];struct platform_device *pf_device; -struct kfifo fifo; -spinlock_t fifo_lock; +int scancode_buf[40 ];
Do we know why 40 was used here? A single use magic number is fine, but it would be good to document why it is what it is if we know.
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Re: [PATCH 5/7] platform/x86: fujitsu-laptop: do not update ACPI device power status
In reply to Michał KępieńQuoted 9 lines · Michał Kępień
Calling
acpi_bus_update_power()for ACPI devices FUJ02B1 and FUJ02E3 is pointless as they are not power manageable (neither_PS0nor_PR0is defined for any of them), which causes their power state to be inherited from their parent devices. Given the ACPI paths of these two devices (\_SB.PCI0.LPCB.FJEX, \_SB.FEXT), their parent devices are also not power manageable. These parent devices will thus have their power state initialized toACPI_STATE_D0, which in turn causes the power state for both FUJ02B1 and FUJ02E3 to always beACPI_STATE_D0("on").
How confident are we that all implementations of these two ACPI devices lack _PS0 and _PR0 ?
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Jonathan Woithe
maintainerRe: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
In reply to Darren HartQuoted 15 lines · Darren Hart
drivers/platform/x86/fujitsu-laptop.c struct fujitsu_laptop { · line 147
Quoted 11 lines · Micha?? K??pie??
drivers/platform/x86/fujitsu-laptop.c +1
-3-#define RINGBUFFERSIZE 40/* Debugging */ #define FUJLAPTOP_DBG_ERROR 0x0001@@ -146,8 +144,8 @@ struct fujitsu_laptop {struct input_dev *input;char phys[32 ];struct platform_device *pf_device; -struct kfifo fifo; -spinlock_t fifo_lock; +int scancode_buf[40 ];Do we know why 40 was used here? A single use magic number is fine, but it would be good to document why it is what it is if we know.
I am unsure as to why 40 was chosen as the size. The support for the hotkeys was contributed by Peter Gruber in 2008 who had a Fujitsu laptop which featured this functionality (mine doesn't). I obviously can't speak for Peter but I suspect that he simply picked a number which seemed reasonable at the time. I am unaware of any specific reason why the size was set at 40, and to be honest never throught to ask at the time the patch was proposed.
If we need a reason to justify the value of 40, I guess the best option is "because it seems reasonable".
I think the buffer size could probably be reduced a little without impacting on functionality. I suspect the value was chosen so as to be well above the number of events which could be generated ahead of a button release (which effectively releases all buttons held at that stage). The number of hot keys is limited (I don't think any model has more than 5), so reducing the buffer somewhat appears safe (perhaps to 32 if there were any advantages to having the size be a power of two). There seems little point doing this in the name of memory saving since the amount saved is trivially small.
Looking through my correspondance with Peter from 2008 (which was largely off-list for reasons I do not recall), it seems the reason the kfifo was used was due to Peter's concern about concurrent processing of mulitple events across different CPUs. Since at the time we couldn't determine whether this was a real issue Peter took the safe route and used a kfifo. If the assumption that it cannot happen is known to hold in all cases there is clearly no need for the more complex construct (at least on the basis of concurrency arguments).
I've given some more thought to the following point (from the original patch submission):
Quoted 5 lines
In order to simplify implementation, hotkey input device behavior is slightly changed (from FIFO to LIFO). The order of release events generated by the input device should not matter from end user perspective as upon releasing any hotkey the firmware only produces a single event which means "all hotkeys were released".
This will effectively alter the order the button events are seen by userspace though, won't it? It would mean that (for example) a user who presses (and holds) the "media" key before "email" will end up with "email" being acted on first. This may surprise them. Then again, I suppose it could be argued that such usage is unusual and therefore is likely to be rare - and therefore not worth bothering about.
Regards
jonathan
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
Quoted 25 lines · Jonathan Woithe
Quoted 15 lines · Darren Hart
drivers/platform/x86/fujitsu-laptop.c struct fujitsu_laptop { · line 147
Quoted 11 lines · Micha?? K??pie??
drivers/platform/x86/fujitsu-laptop.c +1
-3-#define RINGBUFFERSIZE 40/* Debugging */ #define FUJLAPTOP_DBG_ERROR 0x0001@@ -146,8 +144,8 @@ struct fujitsu_laptop {struct input_dev *input;char phys[32 ];struct platform_device *pf_device; -struct kfifo fifo; -spinlock_t fifo_lock; +int scancode_buf[40 ];Do we know why 40 was used here? A single use magic number is fine, but it would be good to document why it is what it is if we know.
I am unsure as to why 40 was chosen as the size. The support for the hotkeys was contributed by Peter Gruber in 2008 who had a Fujitsu laptop which featured this functionality (mine doesn't). I obviously can't speak for Peter but I suspect that he simply picked a number which seemed reasonable at the time. I am unaware of any specific reason why the size was set at 40, and to be honest never throught to ask at the time the patch was proposed.
Quoted 2 lines
If we need a reason to justify the value of 40, I guess the best option is "because it seems reasonable".
That's not surprising, and it's fine. If we know, it's worth documenting. If not, well, we do what we can :-)
Quoted 10 lines
I think the buffer size could probably be reduced a little without impacting on functionality. I suspect the value was chosen so as to be well above the number of events which could be generated ahead of a button release (which effectively releases all buttons held at that stage). The number of hot keys is limited (I don't think any model has more than 5), so reducing the buffer somewhat appears safe (perhaps to 32 if there were any advantages to having the size be a power of two). There seems little point doing this in the name of memory saving since the amount saved is trivially small.
It's not a problem as far as I'm concerned. Plenty more lower hanging fruit if people want to reduce memory footprint.
Quoted 17 lines
Looking through my correspondance with Peter from 2008 (which was largely off-list for reasons I do not recall), it seems the reason the kfifo was used was due to Peter's concern about concurrent processing of mulitple events across different CPUs. Since at the time we couldn't determine whether this was a real issue Peter took the safe route and used a kfifo. If the assumption that it cannot happen is known to hold in all cases there is clearly no need for the more complex construct (at least on the basis of concurrency arguments).
I've given some more thought to the following point (from the original patch submission):
Quoted 5 lines
In order to simplify implementation, hotkey input device behavior is slightly changed (from FIFO to LIFO). The order of release events generated by the input device should not matter from end user perspective as upon releasing any hotkey the firmware only produces a single event which means "all hotkeys were released".
Quoted 6 lines
This will effectively alter the order the button events are seen by userspace though, won't it? It would mean that (for example) a user who presses (and holds) the "media" key before "email" will end up with "email" being acted on first. This may surprise them. Then again, I suppose it could be argued that such usage is unusual and therefore is likely to be rare - and therefore not worth bothering about.
Michal noted there is only one event to release all keys so the order wouldn't be noticed in userspace. Has this been confirmed with testing?
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Jonathan Woithe
maintainerRe: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
Hi Darren
Quoted 11 lines · Darren Hart
Quoted 8 lines
I think the buffer size could probably be reduced a little without impacting on functionality. I suspect the value was chosen so as to be well above the number of events which could be generated ahead of a button release (which effectively releases all buttons held at that stage). The number of hot keys is limited (I don't think any model has more than 5), so reducing the buffer somewhat appears safe (perhaps to 32 if there were any advantages to having the size be a power of two). There seems little point doing this in the name of memory saving since the amount saved is trivially small.
It's not a problem as far as I'm concerned. Plenty more lower hanging fruit if people want to reduce memory footprint.
Indeed. I'm happy to leave it at 40.
Quoted 15 lines
Quoted 8 lines
I've given some more thought to the following point (from the original patch submission):
Quoted 5 lines
In order to simplify implementation, hotkey input device behavior is slightly changed (from FIFO to LIFO). The order of release events generated by the input device should not matter from end user perspective as upon releasing any hotkey the firmware only produces a single event which means "all hotkeys were released".
Quoted 6 lines
This will effectively alter the order the button events are seen by userspace though, won't it? It would mean that (for example) a user who presses (and holds) the "media" key before "email" will end up with "email" being acted on first. This may surprise them. Then again, I suppose it could be argued that such usage is unusual and therefore is likely to be rare - and therefore not worth bothering about.
Quoted 2 lines
Michal noted there is only one event to release all keys so the order wouldn't be noticed in userspace. Has this been confirmed with testing?
I can't test this because my Fujitsu doesn't have these hotkeys.
Regarding the order, the original code sent "press" events to userspace in the order that the keys were pressed. When the single "release all keys" event is received, a "release" event ws sent to userspace for each button which was pressed, in the order they were pressed.
If userspace acted on the button release event then the order of the synthesised "release" events could be significant to userspace, even if they are all generated at the same time in response to the first "release" event.
By way of example, let's say there are two hotkeys, "A" and "B". Let us also say that the user does the following:
- Press and hold hotkey "A"
- Press and hold hotkey "B"
- Release one of these hotkeys
The events seen by userspace with the original code would be "A-press", "B-press", "A-release", "B-release". With the revised code the order of the release events would be reversed compared to the previous behaviour. That is, unless I've misunderstood how sparse_keymap_report_event() works.
Regards
jonathan
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
In reply to Darren HartQuoted 10 lines · Michał Kępień
Quoted 8 lines
All ACPI device notify callbacks are invoked using
acpi_os_execute(), which causes the supplied callback to be queued to a static workqueue which always executes on CPU 0. This means that there is no possibility for any ACPI device notify callback to be concurrently executed on multiple CPUs, which in the case of fujitsu-laptop means that using a locked kfifo for handling hotkeys is redundant: as hotkey scancodes are only pushed and popped from withinacpi_fujitsu_laptop_notify(), no risk of concurrent pushing and popping exists.
Quoted 2 lines
Was the kfifo causing a problem currently or for the migration to separate modules? Is this purely a simplification?
It is just another step in stripping fujitsu-laptop down to its bare essentials. If my reasoning quoted above is correct, using a locked kfifo needlessly suggests potential concurrency issues, but it is definitely not an error.
Signature · 2 lines
Best regards, Michał Kępień
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
In reply to Jonathan WoitheQuoted 12 lines
Hi Darren
Quoted 9 lines · Darren Hart
Quoted 8 lines
I think the buffer size could probably be reduced a little without impacting on functionality. I suspect the value was chosen so as to be well above the number of events which could be generated ahead of a button release (which effectively releases all buttons held at that stage). The number of hot keys is limited (I don't think any model has more than 5), so reducing the buffer somewhat appears safe (perhaps to 32 if there were any advantages to having the size be a power of two). There seems little point doing this in the name of memory saving since the amount saved is trivially small.
Quoted 22 lines
Quoted 2 lines
It's not a problem as far as I'm concerned. Plenty more lower hanging fruit if people want to reduce memory footprint.
Indeed. I'm happy to leave it at 40.
Quoted 17 lines
Quoted 8 lines
I've given some more thought to the following point (from the original patch submission):
Quoted 5 lines
In order to simplify implementation, hotkey input device behavior is slightly changed (from FIFO to LIFO). The order of release events generated by the input device should not matter from end user perspective as upon releasing any hotkey the firmware only produces a single event which means "all hotkeys were released".
Quoted 6 lines
This will effectively alter the order the button events are seen by userspace though, won't it? It would mean that (for example) a user who presses (and holds) the "media" key before "email" will end up with "email" being acted on first. This may surprise them. Then again, I suppose it could be argued that such usage is unusual and therefore is likely to be rare - and therefore not worth bothering about.
Michal noted there is only one event to release all keys so the order wouldn't be noticed in userspace. Has this been confirmed with testing?
I may have worded this in a confusing way, sorry for that. What I wanted to convey is that the driver currently produces release events in FIFO order, but that order is not imposed by the firmware.
Quoted 18 lines
I can't test this because my Fujitsu doesn't have these hotkeys.
Regarding the order, the original code sent "press" events to userspace in the order that the keys were pressed. When the single "release all keys" event is received, a "release" event ws sent to userspace for each button which was pressed, in the order they were pressed.
If userspace acted on the button release event then the order of the synthesised "release" events could be significant to userspace, even if they are all generated at the same time in response to the first "release" event.
By way of example, let's say there are two hotkeys, "A" and "B". Let us also say that the user does the following:
- Press and hold hotkey "A"
- Press and hold hotkey "B"
- Release one of these hotkeys
Quoted 4 lines
The events seen by userspace with the original code would be "A-press", "B-press", "A-release", "B-release". With the revised code the order of the release events would be reversed compared to the previous behaviour. That is, unless I've misunderstood how
sparse_keymap_report_event()works.
All you wrote above is correct and this patch does change the order of release events sent to userspace when multiple hotkeys are pressed simultaneously. The question is: is it relevant for any practical scenario?
Anyway, I find this matter to be of secondary importance. The primary objective of this patch is to get rid of the kfifo. If anyone has strong feelings about the change in event ordering, I will be happy to revert to FIFO in v2.
Signature · 2 lines
Best regards, Michał Kępień
Re: [PATCH 5/7] platform/x86: fujitsu-laptop: do not update ACPI device power status
In reply to Darren HartQuoted 11 lines · Michał Kępień
Quoted 9 lines
Calling
acpi_bus_update_power()for ACPI devices FUJ02B1 and FUJ02E3 is pointless as they are not power manageable (neither_PS0nor_PR0is defined for any of them), which causes their power state to be inherited from their parent devices. Given the ACPI paths of these two devices (\_SB.PCI0.LPCB.FJEX, \_SB.FEXT), their parent devices are also not power manageable. These parent devices will thus have their power state initialized toACPI_STATE_D0, which in turn causes the power state for both FUJ02B1 and FUJ02E3 to always beACPI_STATE_D0("on").
Quoted 2 lines
How confident are we that all implementations of these two ACPI devices lack
_PS0and_PR0?
I looked at DSDT dumps of four different Fujitsu laptops released in the past ten years or so for which at least one of these two ACPI devices is present and found no traces of either of these methods being defined for them. I do not think we have a way of ensuring that the above holds true for every other model out there, but I will point out that fujitsu-laptop is the only user of acpi_bus_update_power() outside of drivers/acpi.
Signature · 2 lines
Best regards, Michał Kępień
Quoted 8 lines · Michał Kępień
In preparation for splitting fujitsu-laptop into two separate modules, I prepared two more cleanup series to minimize the amount of code being moved around. This first series contains all patches that touch ACPI in some way, which is why I am CCing linux-acpi as per Rafael's previous advice.
This patch series was based on platform-driver-x86/for-next and tested on a Lifebook S7020.
I'm satisfied with the responses to all questions on this series. Queued to testing. Thanks Michal and Jonathan.
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
In reply to Michał KępieńQuoted 10 lines · Michał Kępień
Quoted 4 lines
The events seen by userspace with the original code would be "A-press", "B-press", "A-release", "B-release". With the revised code the order of the release events would be reversed compared to the previous behaviour. That is, unless I've misunderstood how
sparse_keymap_report_event()works.All you wrote above is correct and this patch does change the order of release events sent to userspace when multiple hotkeys are pressed simultaneously. The question is: is it relevant for any practical scenario?
Quoted 4 lines
Anyway, I find this matter to be of secondary importance. The primary objective of this patch is to get rid of the kfifo. If anyone has strong feelings about the change in event ordering, I will be happy to revert to FIFO in v2.
This all looks reasonable to me, I don't see anything requiring a respin.
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Re: [PATCH 5/7] platform/x86: fujitsu-laptop: do not update ACPI device power status
In reply to Michał KępieńQuoted 14 lines · Michał Kępień
Quoted 11 lines · Michał Kępień
Quoted 9 lines
Calling
acpi_bus_update_power()for ACPI devices FUJ02B1 and FUJ02E3 is pointless as they are not power manageable (neither_PS0nor_PR0is defined for any of them), which causes their power state to be inherited from their parent devices. Given the ACPI paths of these two devices (\_SB.PCI0.LPCB.FJEX, \_SB.FEXT), their parent devices are also not power manageable. These parent devices will thus have their power state initialized toACPI_STATE_D0, which in turn causes the power state for both FUJ02B1 and FUJ02E3 to always beACPI_STATE_D0("on").Quoted 2 lines
How confident are we that all implementations of these two ACPI devices lack
_PS0and_PR0?
Quoted 7 lines
I looked at DSDT dumps of four different Fujitsu laptops released in the past ten years or so for which at least one of these two ACPI devices is present and found no traces of either of these methods being defined for them. I do not think we have a way of ensuring that the above holds true for every other model out there, but I will point out that fujitsu-laptop is the only user of
acpi_bus_update_power()outside ofdrivers/acpi.
OK, thanks. Queueing to testing.
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Jonathan Woithe
maintainerRe: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
In reply to Darren HartQuoted 11 lines · Darren Hart
Quoted 10 lines · Micha?? K??pie??
Quoted 4 lines
The events seen by userspace with the original code would be "A-press", "B-press", "A-release", "B-release". With the revised code the order of the release events would be reversed compared to the previous behaviour. That is, unless I've misunderstood how
sparse_keymap_report_event()works.All you wrote above is correct and this patch does change the order of release events sent to userspace when multiple hotkeys are pressed simultaneously. The question is: is it relevant for any practical scenario?
Quoted 6 lines
Quoted 4 lines
Anyway, I find this matter to be of secondary importance. The primary objective of this patch is to get rid of the kfifo. If anyone has strong feelings about the change in event ordering, I will be happy to revert to FIFO in v2.
This all looks reasonable to me, I don't see anything requiring a respin.
I agree it is of seconary importance. To me, using LIFO release order is counter-intuitive, but it's the sort of question that if put to 100 people you'll get a 50/50 split of opinions.
Especially since the whole "multiple buttons held at once" scenario is rather unusual we can go with switching the order if others don't see a problem with the behavioural change.
Regards
jonathan
Jonathan Woithe
maintainerRe: [PATCH 5/7] platform/x86: fujitsu-laptop: do not update ACPI device power status
In reply to Darren HartQuoted 23 lines · Darren Hart
Quoted 14 lines · Micha?? K??pie??
Quoted 11 lines · Micha?? K??pie??
Quoted 9 lines
Calling
acpi_bus_update_power()for ACPI devices FUJ02B1 and FUJ02E3 is pointless as they are not power manageable (neither_PS0nor_PR0is defined for any of them), which causes their power state to be inherited from their parent devices. Given the ACPI paths of these two devices (\_SB.PCI0.LPCB.FJEX, \_SB.FEXT), their parent devices are also not power manageable. These parent devices will thus have their power state initialized toACPI_STATE_D0, which in turn causes the power state for both FUJ02B1 and FUJ02E3 to always beACPI_STATE_D0("on").Quoted 2 lines
How confident are we that all implementations of these two ACPI devices lack
_PS0and_PR0?Quoted 7 lines
I looked at DSDT dumps of four different Fujitsu laptops released in the past ten years or so for which at least one of these two ACPI devices is present and found no traces of either of these methods being defined for them. I do not think we have a way of ensuring that the above holds true for every other model out there, but I will point out that fujitsu-laptop is the only user of
acpi_bus_update_power()outside ofdrivers/acpi.
Quoted 1 line
OK, thanks. Queueing to testing.
Thanks. In case it was missed, I supplied my reviewed-by message and sign-off in an earlier post.
Regards
jonathan
Re: [PATCH 5/7] platform/x86: fujitsu-laptop: do not update ACPI device power status
Quoted 2 lines · Jonathan Woithe
Thanks. In case it was missed, I supplied my reviewed-by message and sign-off in an earlier post.
Yup, got it - thanks!
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
In reply to Jonathan WoitheQuoted 19 lines · Jonathan Woithe
Quoted 11 lines · Darren Hart
Quoted 10 lines · Micha?? K??pie??
Quoted 4 lines
The events seen by userspace with the original code would be "A-press", "B-press", "A-release", "B-release". With the revised code the order of the release events would be reversed compared to the previous behaviour. That is, unless I've misunderstood how
sparse_keymap_report_event()works.All you wrote above is correct and this patch does change the order of release events sent to userspace when multiple hotkeys are pressed simultaneously. The question is: is it relevant for any practical scenario?
Quoted 6 lines
Quoted 4 lines
Anyway, I find this matter to be of secondary importance. The primary objective of this patch is to get rid of the kfifo. If anyone has strong feelings about the change in event ordering, I will be happy to revert to FIFO in v2.
This all looks reasonable to me, I don't see anything requiring a respin.
Quoted 7 lines
I agree it is of seconary importance. To me, using LIFO release order is counter-intuitive, but it's the sort of question that if put to 100 people you'll get a 50/50 split of opinions.
Especially since the whole "multiple buttons held at once" scenario is rather unusual we can go with switching the order if others don't see a problem with the behavioural change.
Yes. If anyone notices the implementation difference, I'll be rather surprised. If they do, we can convert back to FIFO as you say.
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
In reply to Darren HartQuoted 10 lines · Darren Hart
Quoted 8 lines · Michał Kępień
All ACPI device notify callbacks are invoked using
acpi_os_execute(), which causes the supplied callback to be queued to a static workqueue which always executes on CPU 0. This means that there is no possibility for any ACPI device notify callback to be concurrently executed on multiple CPUs, which in the case of fujitsu-laptop means that using a locked kfifo for handling hotkeys is redundant: as hotkey scancodes are only pushed and popped from withinacpi_fujitsu_laptop_notify(), no risk of concurrent pushing and popping exists.
Quoted 4 lines
Was the kfifo causing a problem currently or for the migration to separate modules? Is this purely a simplification?
Rafael, the above rationale appears sound to me. Do you have any concerns?
I actually do.
While this is the case today, making the driver code depend on it in a hard way sort of makes it difficult to change in the future if need be.
Thanks,
Rafael
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
Quoted 14 lines · Rafael Wysocki
Quoted 13 lines · Darren Hart
Quoted 8 lines · Michał Kępień
All ACPI device notify callbacks are invoked using
acpi_os_execute(), which causes the supplied callback to be queued to a static workqueue which always executes on CPU 0. This means that there is no possibility for any ACPI device notify callback to be concurrently executed on multiple CPUs, which in the case of fujitsu-laptop means that using a locked kfifo for handling hotkeys is redundant: as hotkey scancodes are only pushed and popped from withinacpi_fujitsu_laptop_notify(), no risk of concurrent pushing and popping exists.Was the kfifo causing a problem currently or for the migration to separate modules? Is this purely a simplification?
Quoted 6 lines
Quoted 1 line
Rafael, the above rationale appears sound to me. Do you have any concerns?
I actually do.
While this is the case today, making the driver code depend on it in a hard way sort of makes it difficult to change in the future if need be.
OK, if we aren't guaranteed for this to run on CPU 0 in the future, and this will be annoying to debug if it does changes, let's skip the kfifo change.
I have removed this patch, and fixed up the merge conflicts of the remaining 6 patches here:
http://git.infradead.org/linux-platform-drivers-x86.git/shortlog/refs/heads/fujitsu
Michal / Jonathan, would you please review and let me know if this is what you would have done / approve the rebase?
Thanks,
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Jonathan Woithe
maintainerRe: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
Quoted 12 lines · Darren Hart
Quoted 6 lines · Rafael Wysocki
Quoted 1 line
Rafael, the above rationale appears sound to me. Do you have any concerns?
I actually do.
While this is the case today, making the driver code depend on it in a hard way sort of makes it difficult to change in the future if need be.
OK, if we aren't guaranteed for this to run on CPU 0 in the future, and this will be annoying to debug if it does changes, let's skip the kfifo change.
Quoted 7 lines
I have removed this patch, and fixed up the merge conflicts of the remaining 6 patches here:
http://git.infradead.org/linux-platform-drivers-x86.git/shortlog/refs/heads/fujitsu
Michal / Jonathan, would you please review and let me know if this is what you would have done / approve the rebase?
The rebase looks reasonable to me.
Regards
jonathan
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
In reply to Darren HartQuoted 25 lines · Rafael Wysocki
Quoted 14 lines · Darren Hart
Quoted 13 lines · Michał Kępień
Quoted 8 lines
All ACPI device notify callbacks are invoked using
acpi_os_execute(), which causes the supplied callback to be queued to a static workqueue which always executes on CPU 0. This means that there is no possibility for any ACPI device notify callback to be concurrently executed on multiple CPUs, which in the case of fujitsu-laptop means that using a locked kfifo for handling hotkeys is redundant: as hotkey scancodes are only pushed and popped from withinacpi_fujitsu_laptop_notify(), no risk of concurrent pushing and popping exists.Was the kfifo causing a problem currently or for the migration to separate modules? Is this purely a simplification?
Quoted 6 lines
Quoted 1 line
Rafael, the above rationale appears sound to me. Do you have any concerns?
I actually do.
While this is the case today, making the driver code depend on it in a hard way sort of makes it difficult to change in the future if need be.
OK, if we aren't guaranteed for this to run on CPU 0 in the future, and this will be annoying to debug if it does changes, let's skip the kfifo change.
Quoted 7 lines
I have removed this patch, and fixed up the merge conflicts of the remaining 6 patches here:
http://git.infradead.org/linux-platform-drivers-x86.git/shortlog/refs/heads/fujitsu
Michal / Jonathan, would you please review and let me know if this is what you would have done / approve the rebase?
The only issue I can see is that the push/pop debug messages in the last patch contain the word "buffer" instead of the original "ringbuffer". The dropped kfifo patch changed the wording from "ringbuffer" to "buffer" as applying it means there is no ringbuffer any more, but since it was not applied in the end, I guess the original wording should stay in place.
The rest looks good to me.
Signature · 2 lines
Best regards, Michał Kępień
Re: [PATCH 1/7] platform/x86: fujitsu-laptop: do not use kfifo for storing hotkey scancodes
Quoted 33 lines · Michał Kępień
Quoted 25 lines · Rafael Wysocki
Quoted 14 lines · Darren Hart
Quoted 13 lines · Michał Kępień
Quoted 8 lines
All ACPI device notify callbacks are invoked using
acpi_os_execute(), which causes the supplied callback to be queued to a static workqueue which always executes on CPU 0. This means that there is no possibility for any ACPI device notify callback to be concurrently executed on multiple CPUs, which in the case of fujitsu-laptop means that using a locked kfifo for handling hotkeys is redundant: as hotkey scancodes are only pushed and popped from withinacpi_fujitsu_laptop_notify(), no risk of concurrent pushing and popping exists.Was the kfifo causing a problem currently or for the migration to separate modules? Is this purely a simplification?
Quoted 6 lines
Quoted 1 line
Rafael, the above rationale appears sound to me. Do you have any concerns?
I actually do.
While this is the case today, making the driver code depend on it in a hard way sort of makes it difficult to change in the future if need be.
OK, if we aren't guaranteed for this to run on CPU 0 in the future, and this will be annoying to debug if it does changes, let's skip the kfifo change.
Quoted 7 lines
I have removed this patch, and fixed up the merge conflicts of the remaining 6 patches here:
http://git.infradead.org/linux-platform-drivers-x86.git/shortlog/refs/heads/fujitsu
Michal / Jonathan, would you please review and let me know if this is what you would have done / approve the rebase?
Quoted 8 lines
The only issue I can see is that the push/pop debug messages in the last patch contain the word "buffer" instead of the original "ringbuffer". The dropped kfifo patch changed the wording from "ringbuffer" to "buffer" as applying it means there is no ringbuffer any more, but since it was not applied in the end, I guess the original wording should stay in place.
The rest looks good to me.
Good catch, thank you. The testing branch has been rebased to reflect these changes.
Signature · 2 lines
Darren Hart VMware Open Source Technology Center