aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAzael Avalos <coproscefalo@gmail.com>2014-09-29 22:40:07 -0400
committerDarren Hart <dvhart@linux.intel.com>2014-09-30 16:51:07 -0400
commit258c590326a9340bc63a46f890e8601d37bde4d7 (patch)
tree6d81ad1a1945369e4d4178ad3dd2e593262432eb
parenta666b6ffbc9b6705a3ced704f52c3fe9ea8bf959 (diff)
toshiba_acpi: Rename hci_raw to tci_raw
The function name hci_raw was used before to reflect a raw (read/write) call to Toshiba's Hardware Configuration Interface (HCI), however, since the introduction of the System Configuration Interface (SCI), that "name" no longer applies. This patch changes the name of that function to tci_raw (for Toshiba Configuration Interface), and change the comments about it. Also, the HCI_WORDS definition was changed to TCI_RAW, to better reflect that we're no longer using pure HCI calls, but a combination of HCI and SCI, which form part of the Toshiba Configuration Interface. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
-rw-r--r--drivers/platform/x86/toshiba_acpi.c119
1 files changed, 60 insertions, 59 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index edd8f3dad6b4..ed3671cfddab 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -71,7 +71,8 @@ MODULE_LICENSE("GPL");
71/* Toshiba ACPI method paths */ 71/* Toshiba ACPI method paths */
72#define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX" 72#define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX"
73 73
74/* Toshiba HCI interface definitions 74/* The Toshiba configuration interface is composed of the HCI and the SCI,
75 * which are defined as follows:
75 * 76 *
76 * HCI is Toshiba's "Hardware Control Interface" which is supposed to 77 * HCI is Toshiba's "Hardware Control Interface" which is supposed to
77 * be uniform across all their models. Ideally we would just call 78 * be uniform across all their models. Ideally we would just call
@@ -84,7 +85,7 @@ MODULE_LICENSE("GPL");
84 * conceal differences in hardware between different models. 85 * conceal differences in hardware between different models.
85 */ 86 */
86 87
87#define HCI_WORDS 6 88#define TCI_WORDS 6
88 89
89/* operations */ 90/* operations */
90#define HCI_SET 0xff00 91#define HCI_SET 0xff00
@@ -274,22 +275,22 @@ static int write_acpi_int(const char *methodName, int val)
274 return (status == AE_OK) ? 0 : -EIO; 275 return (status == AE_OK) ? 0 : -EIO;
275} 276}
276 277
277/* Perform a raw HCI call. Here we don't care about input or output buffer 278/* Perform a raw configuration call. Here we don't care about input or output
278 * format. 279 * buffer format.
279 */ 280 */
280static acpi_status hci_raw(struct toshiba_acpi_dev *dev, 281static acpi_status tci_raw(struct toshiba_acpi_dev *dev,
281 const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) 282 const u32 in[TCI_WORDS], u32 out[TCI_WORDS])
282{ 283{
283 struct acpi_object_list params; 284 struct acpi_object_list params;
284 union acpi_object in_objs[HCI_WORDS]; 285 union acpi_object in_objs[TCI_WORDS];
285 struct acpi_buffer results; 286 struct acpi_buffer results;
286 union acpi_object out_objs[HCI_WORDS + 1]; 287 union acpi_object out_objs[TCI_WORDS + 1];
287 acpi_status status; 288 acpi_status status;
288 int i; 289 int i;
289 290
290 params.count = HCI_WORDS; 291 params.count = TCI_WORDS;
291 params.pointer = in_objs; 292 params.pointer = in_objs;
292 for (i = 0; i < HCI_WORDS; ++i) { 293 for (i = 0; i < TCI_WORDS; ++i) {
293 in_objs[i].type = ACPI_TYPE_INTEGER; 294 in_objs[i].type = ACPI_TYPE_INTEGER;
294 in_objs[i].integer.value = in[i]; 295 in_objs[i].integer.value = in[i];
295 } 296 }
@@ -300,7 +301,7 @@ static acpi_status hci_raw(struct toshiba_acpi_dev *dev,
300 status = acpi_evaluate_object(dev->acpi_dev->handle, 301 status = acpi_evaluate_object(dev->acpi_dev->handle,
301 (char *)dev->method_hci, &params, 302 (char *)dev->method_hci, &params,
302 &results); 303 &results);
303 if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) { 304 if ((status == AE_OK) && (out_objs->package.count <= TCI_WORDS)) {
304 for (i = 0; i < out_objs->package.count; ++i) { 305 for (i = 0; i < out_objs->package.count; ++i) {
305 out[i] = out_objs->package.elements[i].integer.value; 306 out[i] = out_objs->package.elements[i].integer.value;
306 } 307 }
@@ -318,9 +319,9 @@ static acpi_status hci_raw(struct toshiba_acpi_dev *dev,
318static acpi_status hci_write1(struct toshiba_acpi_dev *dev, u32 reg, 319static acpi_status hci_write1(struct toshiba_acpi_dev *dev, u32 reg,
319 u32 in1, u32 *result) 320 u32 in1, u32 *result)
320{ 321{
321 u32 in[HCI_WORDS] = { HCI_SET, reg, in1, 0, 0, 0 }; 322 u32 in[TCI_WORDS] = { HCI_SET, reg, in1, 0, 0, 0 };
322 u32 out[HCI_WORDS]; 323 u32 out[TCI_WORDS];
323 acpi_status status = hci_raw(dev, in, out); 324 acpi_status status = tci_raw(dev, in, out);
324 *result = (status == AE_OK) ? out[0] : HCI_FAILURE; 325 *result = (status == AE_OK) ? out[0] : HCI_FAILURE;
325 return status; 326 return status;
326} 327}
@@ -328,9 +329,9 @@ static acpi_status hci_write1(struct toshiba_acpi_dev *dev, u32 reg,
328static acpi_status hci_read1(struct toshiba_acpi_dev *dev, u32 reg, 329static acpi_status hci_read1(struct toshiba_acpi_dev *dev, u32 reg,
329 u32 *out1, u32 *result) 330 u32 *out1, u32 *result)
330{ 331{
331 u32 in[HCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 }; 332 u32 in[TCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 };
332 u32 out[HCI_WORDS]; 333 u32 out[TCI_WORDS];
333 acpi_status status = hci_raw(dev, in, out); 334 acpi_status status = tci_raw(dev, in, out);
334 *out1 = out[2]; 335 *out1 = out[2];
335 *result = (status == AE_OK) ? out[0] : HCI_FAILURE; 336 *result = (status == AE_OK) ? out[0] : HCI_FAILURE;
336 return status; 337 return status;
@@ -339,9 +340,9 @@ static acpi_status hci_read1(struct toshiba_acpi_dev *dev, u32 reg,
339static acpi_status hci_write2(struct toshiba_acpi_dev *dev, u32 reg, 340static acpi_status hci_write2(struct toshiba_acpi_dev *dev, u32 reg,
340 u32 in1, u32 in2, u32 *result) 341 u32 in1, u32 in2, u32 *result)
341{ 342{
342 u32 in[HCI_WORDS] = { HCI_SET, reg, in1, in2, 0, 0 }; 343 u32 in[TCI_WORDS] = { HCI_SET, reg, in1, in2, 0, 0 };
343 u32 out[HCI_WORDS]; 344 u32 out[TCI_WORDS];
344 acpi_status status = hci_raw(dev, in, out); 345 acpi_status status = tci_raw(dev, in, out);
345 *result = (status == AE_OK) ? out[0] : HCI_FAILURE; 346 *result = (status == AE_OK) ? out[0] : HCI_FAILURE;
346 return status; 347 return status;
347} 348}
@@ -349,9 +350,9 @@ static acpi_status hci_write2(struct toshiba_acpi_dev *dev, u32 reg,
349static acpi_status hci_read2(struct toshiba_acpi_dev *dev, u32 reg, 350static acpi_status hci_read2(struct toshiba_acpi_dev *dev, u32 reg,
350 u32 *out1, u32 *out2, u32 *result) 351 u32 *out1, u32 *out2, u32 *result)
351{ 352{
352 u32 in[HCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 }; 353 u32 in[TCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 };
353 u32 out[HCI_WORDS]; 354 u32 out[TCI_WORDS];
354 acpi_status status = hci_raw(dev, in, out); 355 acpi_status status = tci_raw(dev, in, out);
355 *out1 = out[2]; 356 *out1 = out[2];
356 *out2 = out[3]; 357 *out2 = out[3];
357 *result = (status == AE_OK) ? out[0] : HCI_FAILURE; 358 *result = (status == AE_OK) ? out[0] : HCI_FAILURE;
@@ -363,11 +364,11 @@ static acpi_status hci_read2(struct toshiba_acpi_dev *dev, u32 reg,
363 364
364static int sci_open(struct toshiba_acpi_dev *dev) 365static int sci_open(struct toshiba_acpi_dev *dev)
365{ 366{
366 u32 in[HCI_WORDS] = { SCI_OPEN, 0, 0, 0, 0, 0 }; 367 u32 in[TCI_WORDS] = { SCI_OPEN, 0, 0, 0, 0, 0 };
367 u32 out[HCI_WORDS]; 368 u32 out[TCI_WORDS];
368 acpi_status status; 369 acpi_status status;
369 370
370 status = hci_raw(dev, in, out); 371 status = tci_raw(dev, in, out);
371 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) { 372 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) {
372 pr_err("ACPI call to open SCI failed\n"); 373 pr_err("ACPI call to open SCI failed\n");
373 return 0; 374 return 0;
@@ -387,11 +388,11 @@ static int sci_open(struct toshiba_acpi_dev *dev)
387 388
388static void sci_close(struct toshiba_acpi_dev *dev) 389static void sci_close(struct toshiba_acpi_dev *dev)
389{ 390{
390 u32 in[HCI_WORDS] = { SCI_CLOSE, 0, 0, 0, 0, 0 }; 391 u32 in[TCI_WORDS] = { SCI_CLOSE, 0, 0, 0, 0, 0 };
391 u32 out[HCI_WORDS]; 392 u32 out[TCI_WORDS];
392 acpi_status status; 393 acpi_status status;
393 394
394 status = hci_raw(dev, in, out); 395 status = tci_raw(dev, in, out);
395 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) { 396 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) {
396 pr_err("ACPI call to close SCI failed\n"); 397 pr_err("ACPI call to close SCI failed\n");
397 return; 398 return;
@@ -408,9 +409,9 @@ static void sci_close(struct toshiba_acpi_dev *dev)
408static acpi_status sci_read(struct toshiba_acpi_dev *dev, u32 reg, 409static acpi_status sci_read(struct toshiba_acpi_dev *dev, u32 reg,
409 u32 *out1, u32 *result) 410 u32 *out1, u32 *result)
410{ 411{
411 u32 in[HCI_WORDS] = { SCI_GET, reg, 0, 0, 0, 0 }; 412 u32 in[TCI_WORDS] = { SCI_GET, reg, 0, 0, 0, 0 };
412 u32 out[HCI_WORDS]; 413 u32 out[TCI_WORDS];
413 acpi_status status = hci_raw(dev, in, out); 414 acpi_status status = tci_raw(dev, in, out);
414 *out1 = out[2]; 415 *out1 = out[2];
415 *result = (ACPI_SUCCESS(status)) ? out[0] : HCI_FAILURE; 416 *result = (ACPI_SUCCESS(status)) ? out[0] : HCI_FAILURE;
416 return status; 417 return status;
@@ -419,9 +420,9 @@ static acpi_status sci_read(struct toshiba_acpi_dev *dev, u32 reg,
419static acpi_status sci_write(struct toshiba_acpi_dev *dev, u32 reg, 420static acpi_status sci_write(struct toshiba_acpi_dev *dev, u32 reg,
420 u32 in1, u32 *result) 421 u32 in1, u32 *result)
421{ 422{
422 u32 in[HCI_WORDS] = { SCI_SET, reg, in1, 0, 0, 0 }; 423 u32 in[TCI_WORDS] = { SCI_SET, reg, in1, 0, 0, 0 };
423 u32 out[HCI_WORDS]; 424 u32 out[TCI_WORDS];
424 acpi_status status = hci_raw(dev, in, out); 425 acpi_status status = tci_raw(dev, in, out);
425 *result = (ACPI_SUCCESS(status)) ? out[0] : HCI_FAILURE; 426 *result = (ACPI_SUCCESS(status)) ? out[0] : HCI_FAILURE;
426 return status; 427 return status;
427} 428}
@@ -429,14 +430,14 @@ static acpi_status sci_write(struct toshiba_acpi_dev *dev, u32 reg,
429/* Illumination support */ 430/* Illumination support */
430static int toshiba_illumination_available(struct toshiba_acpi_dev *dev) 431static int toshiba_illumination_available(struct toshiba_acpi_dev *dev)
431{ 432{
432 u32 in[HCI_WORDS] = { SCI_GET, SCI_ILLUMINATION, 0, 0, 0, 0 }; 433 u32 in[TCI_WORDS] = { SCI_GET, SCI_ILLUMINATION, 0, 0, 0, 0 };
433 u32 out[HCI_WORDS]; 434 u32 out[TCI_WORDS];
434 acpi_status status; 435 acpi_status status;
435 436
436 if (!sci_open(dev)) 437 if (!sci_open(dev))
437 return 0; 438 return 0;
438 439
439 status = hci_raw(dev, in, out); 440 status = tci_raw(dev, in, out);
440 sci_close(dev); 441 sci_close(dev);
441 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) { 442 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) {
442 pr_err("ACPI call to query Illumination support failed\n"); 443 pr_err("ACPI call to query Illumination support failed\n");
@@ -502,14 +503,14 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)
502/* KBD Illumination */ 503/* KBD Illumination */
503static int toshiba_kbd_illum_available(struct toshiba_acpi_dev *dev) 504static int toshiba_kbd_illum_available(struct toshiba_acpi_dev *dev)
504{ 505{
505 u32 in[HCI_WORDS] = { SCI_GET, SCI_KBD_ILLUM_STATUS, 0, 0, 0, 0 }; 506 u32 in[TCI_WORDS] = { SCI_GET, SCI_KBD_ILLUM_STATUS, 0, 0, 0, 0 };
506 u32 out[HCI_WORDS]; 507 u32 out[TCI_WORDS];
507 acpi_status status; 508 acpi_status status;
508 509
509 if (!sci_open(dev)) 510 if (!sci_open(dev))
510 return 0; 511 return 0;
511 512
512 status = hci_raw(dev, in, out); 513 status = tci_raw(dev, in, out);
513 sci_close(dev); 514 sci_close(dev);
514 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { 515 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) {
515 pr_err("ACPI call to query kbd illumination support failed\n"); 516 pr_err("ACPI call to query kbd illumination support failed\n");
@@ -663,10 +664,10 @@ static int toshiba_touchpad_get(struct toshiba_acpi_dev *dev, u32 *state)
663static int toshiba_eco_mode_available(struct toshiba_acpi_dev *dev) 664static int toshiba_eco_mode_available(struct toshiba_acpi_dev *dev)
664{ 665{
665 acpi_status status; 666 acpi_status status;
666 u32 in[HCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 1, 0, 0 }; 667 u32 in[TCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 1, 0, 0 };
667 u32 out[HCI_WORDS]; 668 u32 out[TCI_WORDS];
668 669
669 status = hci_raw(dev, in, out); 670 status = tci_raw(dev, in, out);
670 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { 671 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) {
671 pr_info("ACPI call to get ECO led failed\n"); 672 pr_info("ACPI call to get ECO led failed\n");
672 return 0; 673 return 0;
@@ -679,11 +680,11 @@ static enum led_brightness toshiba_eco_mode_get_status(struct led_classdev *cdev
679{ 680{
680 struct toshiba_acpi_dev *dev = container_of(cdev, 681 struct toshiba_acpi_dev *dev = container_of(cdev,
681 struct toshiba_acpi_dev, eco_led); 682 struct toshiba_acpi_dev, eco_led);
682 u32 in[HCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 1, 0, 0 }; 683 u32 in[TCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 1, 0, 0 };
683 u32 out[HCI_WORDS]; 684 u32 out[TCI_WORDS];
684 acpi_status status; 685 acpi_status status;
685 686
686 status = hci_raw(dev, in, out); 687 status = tci_raw(dev, in, out);
687 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { 688 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) {
688 pr_err("ACPI call to get ECO led failed\n"); 689 pr_err("ACPI call to get ECO led failed\n");
689 return LED_OFF; 690 return LED_OFF;
@@ -697,13 +698,13 @@ static void toshiba_eco_mode_set_status(struct led_classdev *cdev,
697{ 698{
698 struct toshiba_acpi_dev *dev = container_of(cdev, 699 struct toshiba_acpi_dev *dev = container_of(cdev,
699 struct toshiba_acpi_dev, eco_led); 700 struct toshiba_acpi_dev, eco_led);
700 u32 in[HCI_WORDS] = { HCI_SET, HCI_ECO_MODE, 0, 1, 0, 0 }; 701 u32 in[TCI_WORDS] = { HCI_SET, HCI_ECO_MODE, 0, 1, 0, 0 };
701 u32 out[HCI_WORDS]; 702 u32 out[TCI_WORDS];
702 acpi_status status; 703 acpi_status status;
703 704
704 /* Switch the Eco Mode led on/off */ 705 /* Switch the Eco Mode led on/off */
705 in[2] = (brightness) ? 1 : 0; 706 in[2] = (brightness) ? 1 : 0;
706 status = hci_raw(dev, in, out); 707 status = tci_raw(dev, in, out);
707 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { 708 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) {
708 pr_err("ACPI call to set ECO led failed\n"); 709 pr_err("ACPI call to set ECO led failed\n");
709 return; 710 return;
@@ -713,14 +714,14 @@ static void toshiba_eco_mode_set_status(struct led_classdev *cdev,
713/* Accelerometer support */ 714/* Accelerometer support */
714static int toshiba_accelerometer_supported(struct toshiba_acpi_dev *dev) 715static int toshiba_accelerometer_supported(struct toshiba_acpi_dev *dev)
715{ 716{
716 u32 in[HCI_WORDS] = { HCI_GET, HCI_ACCELEROMETER2, 0, 0, 0, 0 }; 717 u32 in[TCI_WORDS] = { HCI_GET, HCI_ACCELEROMETER2, 0, 0, 0, 0 };
717 u32 out[HCI_WORDS]; 718 u32 out[TCI_WORDS];
718 acpi_status status; 719 acpi_status status;
719 720
720 /* Check if the accelerometer call exists, 721 /* Check if the accelerometer call exists,
721 * this call also serves as initialization 722 * this call also serves as initialization
722 */ 723 */
723 status = hci_raw(dev, in, out); 724 status = tci_raw(dev, in, out);
724 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { 725 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) {
725 pr_err("ACPI call to query the accelerometer failed\n"); 726 pr_err("ACPI call to query the accelerometer failed\n");
726 return -EIO; 727 return -EIO;
@@ -739,12 +740,12 @@ static int toshiba_accelerometer_supported(struct toshiba_acpi_dev *dev)
739static int toshiba_accelerometer_get(struct toshiba_acpi_dev *dev, 740static int toshiba_accelerometer_get(struct toshiba_acpi_dev *dev,
740 u32 *xy, u32 *z) 741 u32 *xy, u32 *z)
741{ 742{
742 u32 in[HCI_WORDS] = { HCI_GET, HCI_ACCELEROMETER, 0, 1, 0, 0 }; 743 u32 in[TCI_WORDS] = { HCI_GET, HCI_ACCELEROMETER, 0, 1, 0, 0 };
743 u32 out[HCI_WORDS]; 744 u32 out[TCI_WORDS];
744 acpi_status status; 745 acpi_status status;
745 746
746 /* Check the Accelerometer status */ 747 /* Check the Accelerometer status */
747 status = hci_raw(dev, in, out); 748 status = tci_raw(dev, in, out);
748 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { 749 if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) {
749 pr_err("ACPI call to query the accelerometer failed\n"); 750 pr_err("ACPI call to query the accelerometer failed\n");
750 return -EIO; 751 return -EIO;
@@ -925,8 +926,8 @@ static int lcd_proc_open(struct inode *inode, struct file *file)
925 926
926static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value) 927static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value)
927{ 928{
928 u32 in[HCI_WORDS] = { HCI_SET, HCI_LCD_BRIGHTNESS, 0, 0, 0, 0 }; 929 u32 in[TCI_WORDS] = { HCI_SET, HCI_LCD_BRIGHTNESS, 0, 0, 0, 0 };
929 u32 out[HCI_WORDS]; 930 u32 out[TCI_WORDS];
930 acpi_status status; 931 acpi_status status;
931 932
932 if (dev->tr_backlight_supported) { 933 if (dev->tr_backlight_supported) {
@@ -939,7 +940,7 @@ static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value)
939 } 940 }
940 941
941 in[2] = value << HCI_LCD_BRIGHTNESS_SHIFT; 942 in[2] = value << HCI_LCD_BRIGHTNESS_SHIFT;
942 status = hci_raw(dev, in, out); 943 status = tci_raw(dev, in, out);
943 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) { 944 if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) {
944 pr_err("ACPI call to set brightness failed"); 945 pr_err("ACPI call to set brightness failed");
945 return -EIO; 946 return -EIO;