aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAzael Avalos <coproscefalo@gmail.com>2014-03-25 22:38:29 -0400
committerMatthew Garrett <matthew.garrett@nebula.com>2014-04-06 12:58:13 -0400
commit84a6273f04fd19cad189c8327d0c3c17a053ab8b (patch)
treea2ae8339f91befac3d636faf5fd563799aa5d455
parent119f449866ad18785b0445adaf0d2859c6dbdaa3 (diff)
toshiba_acpi: Add System Configuration Interface
SCI stands for System Configuration Interface, which aim is to conceal differences in hardware between different models. This patch introduces four new calls: sci_open, sci_close, sci_read and sci_write, along with its definitions and return codes which will be used by later patches. More information about the SCI can be found at Jonathan Buzzard's website [1]. [1] http://www.buzzard.me.uk/toshiba/docs.html Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
-rw-r--r--drivers/platform/x86/toshiba_acpi.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 90dd7645a9e5..c4680037bbfd 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -77,6 +77,9 @@ MODULE_LICENSE("GPL");
77 * However the ACPI methods seem to be incomplete in some areas (for 77 * However the ACPI methods seem to be incomplete in some areas (for
78 * example they allow setting, but not reading, the LCD brightness value), 78 * example they allow setting, but not reading, the LCD brightness value),
79 * so this is still useful. 79 * so this is still useful.
80 *
81 * SCI stands for "System Configuration Interface" which aim is to
82 * conceal differences in hardware between different models.
80 */ 83 */
81 84
82#define HCI_WORDS 6 85#define HCI_WORDS 6
@@ -84,12 +87,20 @@ MODULE_LICENSE("GPL");
84/* operations */ 87/* operations */
85#define HCI_SET 0xff00 88#define HCI_SET 0xff00
86#define HCI_GET 0xfe00 89#define HCI_GET 0xfe00
90#define SCI_OPEN 0xf100
91#define SCI_CLOSE 0xf200
92#define SCI_GET 0xf300
93#define SCI_SET 0xf400
87 94
88/* return codes */ 95/* return codes */
89#define HCI_SUCCESS 0x0000 96#define HCI_SUCCESS 0x0000
90#define HCI_FAILURE 0x1000 97#define HCI_FAILURE 0x1000
91#define HCI_NOT_SUPPORTED 0x8000 98#define HCI_NOT_SUPPORTED 0x8000
92#define HCI_EMPTY 0x8c00 99#define HCI_EMPTY 0x8c00
100#define SCI_OPEN_CLOSE_OK 0x0044
101#define SCI_ALREADY_OPEN 0x8100
102#define SCI_NOT_OPENED 0x8200
103#define SCI_NOT_PRESENT 0x8600
93 104
94/* registers */ 105/* registers */
95#define HCI_FAN 0x0004 106#define HCI_FAN 0x0004
@@ -280,6 +291,74 @@ static acpi_status hci_read2(struct toshiba_acpi_dev *dev, u32 reg,
280 return status; 291 return status;
281} 292}
282 293
294/* common sci tasks
295 */
296
297static int sci_open(struct toshiba_acpi_dev *dev)
298{
299 u32 in[HCI_WORDS] = { SCI_OPEN, 0, 0, 0, 0, 0 };
300 u32 out[HCI_WORDS];
301 acpi_status status;
302
303 status = hci_raw(dev, in, out);
304 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) {
305 pr_err("ACPI call to open SCI failed\n");
306 return 0;
307 }
308
309 if (out[0] == SCI_OPEN_CLOSE_OK) {
310 return 1;
311 } else if (out[0] == SCI_ALREADY_OPEN) {
312 pr_info("Toshiba SCI already opened\n");
313 return 1;
314 } else if (out[0] == SCI_NOT_PRESENT) {
315 pr_info("Toshiba SCI is not present\n");
316 }
317
318 return 0;
319}
320
321static void sci_close(struct toshiba_acpi_dev *dev)
322{
323 u32 in[HCI_WORDS] = { SCI_CLOSE, 0, 0, 0, 0, 0 };
324 u32 out[HCI_WORDS];
325 acpi_status status;
326
327 status = hci_raw(dev, in, out);
328 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) {
329 pr_err("ACPI call to close SCI failed\n");
330 return;
331 }
332
333 if (out[0] == SCI_OPEN_CLOSE_OK)
334 return;
335 else if (out[0] == SCI_NOT_OPENED)
336 pr_info("Toshiba SCI not opened\n");
337 else if (out[0] == SCI_NOT_PRESENT)
338 pr_info("Toshiba SCI is not present\n");
339}
340
341static acpi_status sci_read(struct toshiba_acpi_dev *dev, u32 reg,
342 u32 *out1, u32 *result)
343{
344 u32 in[HCI_WORDS] = { SCI_GET, reg, 0, 0, 0, 0 };
345 u32 out[HCI_WORDS];
346 acpi_status status = hci_raw(dev, in, out);
347 *out1 = out[2];
348 *result = (ACPI_SUCCESS(status)) ? out[0] : HCI_FAILURE;
349 return status;
350}
351
352static acpi_status sci_write(struct toshiba_acpi_dev *dev, u32 reg,
353 u32 in1, u32 *result)
354{
355 u32 in[HCI_WORDS] = { SCI_SET, reg, in1, 0, 0, 0 };
356 u32 out[HCI_WORDS];
357 acpi_status status = hci_raw(dev, in, out);
358 *result = (ACPI_SUCCESS(status)) ? out[0] : HCI_FAILURE;
359 return status;
360}
361
283/* Illumination support */ 362/* Illumination support */
284static int toshiba_illumination_available(struct toshiba_acpi_dev *dev) 363static int toshiba_illumination_available(struct toshiba_acpi_dev *dev)
285{ 364{