diff options
73 files changed, 983 insertions, 439 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 3523ab000f1f..bd07f6c1890f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -5667,7 +5667,6 @@ F: drivers/media/video/*7146* | |||
5667 | F: include/media/*7146* | 5667 | F: include/media/*7146* |
5668 | 5668 | ||
5669 | SAMSUNG AUDIO (ASoC) DRIVERS | 5669 | SAMSUNG AUDIO (ASoC) DRIVERS |
5670 | M: Jassi Brar <jassisinghbrar@gmail.com> | ||
5671 | M: Sangbeom Kim <sbkim73@samsung.com> | 5670 | M: Sangbeom Kim <sbkim73@samsung.com> |
5672 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 5671 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
5673 | S: Supported | 5672 | S: Supported |
diff --git a/arch/powerpc/boot/dts/p1023rds.dts b/arch/powerpc/boot/dts/p1023rds.dts index d9b776740a67..d3b478242ea9 100644 --- a/arch/powerpc/boot/dts/p1023rds.dts +++ b/arch/powerpc/boot/dts/p1023rds.dts | |||
@@ -449,6 +449,7 @@ | |||
449 | interrupt-parent = <&mpic>; | 449 | interrupt-parent = <&mpic>; |
450 | interrupts = <16 2>; | 450 | interrupts = <16 2>; |
451 | interrupt-map-mask = <0xf800 0 0 7>; | 451 | interrupt-map-mask = <0xf800 0 0 7>; |
452 | /* IRQ[0:3] are pulled up on board, set to active-low */ | ||
452 | interrupt-map = < | 453 | interrupt-map = < |
453 | /* IDSEL 0x0 */ | 454 | /* IDSEL 0x0 */ |
454 | 0000 0 0 1 &mpic 0 1 | 455 | 0000 0 0 1 &mpic 0 1 |
@@ -488,11 +489,15 @@ | |||
488 | interrupt-parent = <&mpic>; | 489 | interrupt-parent = <&mpic>; |
489 | interrupts = <16 2>; | 490 | interrupts = <16 2>; |
490 | interrupt-map-mask = <0xf800 0 0 7>; | 491 | interrupt-map-mask = <0xf800 0 0 7>; |
492 | /* | ||
493 | * IRQ[4:6] only for PCIe, set to active-high, | ||
494 | * IRQ[7] is pulled up on board, set to active-low | ||
495 | */ | ||
491 | interrupt-map = < | 496 | interrupt-map = < |
492 | /* IDSEL 0x0 */ | 497 | /* IDSEL 0x0 */ |
493 | 0000 0 0 1 &mpic 4 1 | 498 | 0000 0 0 1 &mpic 4 2 |
494 | 0000 0 0 2 &mpic 5 1 | 499 | 0000 0 0 2 &mpic 5 2 |
495 | 0000 0 0 3 &mpic 6 1 | 500 | 0000 0 0 3 &mpic 6 2 |
496 | 0000 0 0 4 &mpic 7 1 | 501 | 0000 0 0 4 &mpic 7 1 |
497 | >; | 502 | >; |
498 | ranges = <0x2000000 0x0 0xa0000000 | 503 | ranges = <0x2000000 0x0 0xa0000000 |
@@ -527,12 +532,16 @@ | |||
527 | interrupt-parent = <&mpic>; | 532 | interrupt-parent = <&mpic>; |
528 | interrupts = <16 2>; | 533 | interrupts = <16 2>; |
529 | interrupt-map-mask = <0xf800 0 0 7>; | 534 | interrupt-map-mask = <0xf800 0 0 7>; |
535 | /* | ||
536 | * IRQ[8:10] are pulled up on board, set to active-low | ||
537 | * IRQ[11] only for PCIe, set to active-high, | ||
538 | */ | ||
530 | interrupt-map = < | 539 | interrupt-map = < |
531 | /* IDSEL 0x0 */ | 540 | /* IDSEL 0x0 */ |
532 | 0000 0 0 1 &mpic 8 1 | 541 | 0000 0 0 1 &mpic 8 1 |
533 | 0000 0 0 2 &mpic 9 1 | 542 | 0000 0 0 2 &mpic 9 1 |
534 | 0000 0 0 3 &mpic 10 1 | 543 | 0000 0 0 3 &mpic 10 1 |
535 | 0000 0 0 4 &mpic 11 1 | 544 | 0000 0 0 4 &mpic 11 2 |
536 | >; | 545 | >; |
537 | ranges = <0x2000000 0x0 0x80000000 | 546 | ranges = <0x2000000 0x0 0x80000000 |
538 | 0x2000000 0x0 0x80000000 | 547 | 0x2000000 0x0 0x80000000 |
diff --git a/arch/powerpc/configs/ppc44x_defconfig b/arch/powerpc/configs/ppc44x_defconfig index 6cdf1c0d2c8a..3b98d7354341 100644 --- a/arch/powerpc/configs/ppc44x_defconfig +++ b/arch/powerpc/configs/ppc44x_defconfig | |||
@@ -52,6 +52,8 @@ CONFIG_MTD_CFI=y | |||
52 | CONFIG_MTD_JEDECPROBE=y | 52 | CONFIG_MTD_JEDECPROBE=y |
53 | CONFIG_MTD_CFI_AMDSTD=y | 53 | CONFIG_MTD_CFI_AMDSTD=y |
54 | CONFIG_MTD_PHYSMAP_OF=y | 54 | CONFIG_MTD_PHYSMAP_OF=y |
55 | CONFIG_MTD_NAND=m | ||
56 | CONFIG_MTD_NAND_NDFC=m | ||
55 | CONFIG_MTD_UBI=m | 57 | CONFIG_MTD_UBI=m |
56 | CONFIG_MTD_UBI_GLUEBI=m | 58 | CONFIG_MTD_UBI_GLUEBI=m |
57 | CONFIG_PROC_DEVICETREE=y | 59 | CONFIG_PROC_DEVICETREE=y |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 5964371303ac..8558b572e55d 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/of_fdt.h> | 15 | #include <linux/of_fdt.h> |
16 | #include <linux/memblock.h> | 16 | #include <linux/memblock.h> |
17 | #include <linux/bootmem.h> | 17 | #include <linux/bootmem.h> |
18 | #include <linux/moduleparam.h> | ||
18 | #include <asm/pgtable.h> | 19 | #include <asm/pgtable.h> |
19 | #include <asm/pgalloc.h> | 20 | #include <asm/pgalloc.h> |
20 | #include <asm/tlb.h> | 21 | #include <asm/tlb.h> |
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index 45023e26aea3..d7946be298b6 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig | |||
@@ -203,7 +203,7 @@ config P3060_QDS | |||
203 | select PPC_E500MC | 203 | select PPC_E500MC |
204 | select PHYS_64BIT | 204 | select PHYS_64BIT |
205 | select SWIOTLB | 205 | select SWIOTLB |
206 | select MPC8xxx_GPIO | 206 | select GPIO_MPC8XXX |
207 | select HAS_RAPIDIO | 207 | select HAS_RAPIDIO |
208 | select PPC_EPAPR_HV_PIC | 208 | select PPC_EPAPR_HV_PIC |
209 | help | 209 | help |
diff --git a/arch/powerpc/platforms/85xx/p3060_qds.c b/arch/powerpc/platforms/85xx/p3060_qds.c index 01dcf44871e9..081cf4ac1881 100644 --- a/arch/powerpc/platforms/85xx/p3060_qds.c +++ b/arch/powerpc/platforms/85xx/p3060_qds.c | |||
@@ -70,7 +70,7 @@ define_machine(p3060_qds) { | |||
70 | .power_save = e500_idle, | 70 | .power_save = e500_idle, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | machine_device_initcall(p3060_qds, declare_of_platform_devices); | 73 | machine_device_initcall(p3060_qds, corenet_ds_publish_devices); |
74 | 74 | ||
75 | #ifdef CONFIG_SWIOTLB | 75 | #ifdef CONFIG_SWIOTLB |
76 | machine_arch_initcall(p3060_qds, swiotlb_setup_bus_notifier); | 76 | machine_arch_initcall(p3060_qds, swiotlb_setup_bus_notifier); |
diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c index af1a5df46b3e..b6731e4a6646 100644 --- a/arch/powerpc/sysdev/ehv_pic.c +++ b/arch/powerpc/sysdev/ehv_pic.c | |||
@@ -280,6 +280,7 @@ void __init ehv_pic_init(void) | |||
280 | 280 | ||
281 | if (!ehv_pic->irqhost) { | 281 | if (!ehv_pic->irqhost) { |
282 | of_node_put(np); | 282 | of_node_put(np); |
283 | kfree(ehv_pic); | ||
283 | return; | 284 | return; |
284 | } | 285 | } |
285 | 286 | ||
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index c4d96fa32ba5..d5c3c90ee698 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c | |||
@@ -328,6 +328,7 @@ static int __devinit fsl_lbc_ctrl_probe(struct platform_device *dev) | |||
328 | err: | 328 | err: |
329 | iounmap(fsl_lbc_ctrl_dev->regs); | 329 | iounmap(fsl_lbc_ctrl_dev->regs); |
330 | kfree(fsl_lbc_ctrl_dev); | 330 | kfree(fsl_lbc_ctrl_dev); |
331 | fsl_lbc_ctrl_dev = NULL; | ||
331 | return ret; | 332 | return ret; |
332 | } | 333 | } |
333 | 334 | ||
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 3363fbc964f8..ceb09cbd2329 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
@@ -216,7 +216,7 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier) | |||
216 | /* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says | 216 | /* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says |
217 | that the BRG divisor must be even if you're not using divide-by-16 | 217 | that the BRG divisor must be even if you're not using divide-by-16 |
218 | mode. */ | 218 | mode. */ |
219 | if (!div16 && (divisor & 1)) | 219 | if (!div16 && (divisor & 1) && (divisor > 3)) |
220 | divisor++; | 220 | divisor++; |
221 | 221 | ||
222 | tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | | 222 | tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | |
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 127408069ca7..631b9477b99c 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
@@ -932,7 +932,8 @@ static int erst_check_table(struct acpi_table_erst *erst_tab) | |||
932 | static int erst_open_pstore(struct pstore_info *psi); | 932 | static int erst_open_pstore(struct pstore_info *psi); |
933 | static int erst_close_pstore(struct pstore_info *psi); | 933 | static int erst_close_pstore(struct pstore_info *psi); |
934 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, | 934 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, |
935 | struct timespec *time, struct pstore_info *psi); | 935 | struct timespec *time, char **buf, |
936 | struct pstore_info *psi); | ||
936 | static int erst_writer(enum pstore_type_id type, u64 *id, unsigned int part, | 937 | static int erst_writer(enum pstore_type_id type, u64 *id, unsigned int part, |
937 | size_t size, struct pstore_info *psi); | 938 | size_t size, struct pstore_info *psi); |
938 | static int erst_clearer(enum pstore_type_id type, u64 id, | 939 | static int erst_clearer(enum pstore_type_id type, u64 id, |
@@ -986,17 +987,23 @@ static int erst_close_pstore(struct pstore_info *psi) | |||
986 | } | 987 | } |
987 | 988 | ||
988 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, | 989 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, |
989 | struct timespec *time, struct pstore_info *psi) | 990 | struct timespec *time, char **buf, |
991 | struct pstore_info *psi) | ||
990 | { | 992 | { |
991 | int rc; | 993 | int rc; |
992 | ssize_t len = 0; | 994 | ssize_t len = 0; |
993 | u64 record_id; | 995 | u64 record_id; |
994 | struct cper_pstore_record *rcd = (struct cper_pstore_record *) | 996 | struct cper_pstore_record *rcd; |
995 | (erst_info.buf - sizeof(*rcd)); | 997 | size_t rcd_len = sizeof(*rcd) + erst_info.bufsize; |
996 | 998 | ||
997 | if (erst_disable) | 999 | if (erst_disable) |
998 | return -ENODEV; | 1000 | return -ENODEV; |
999 | 1001 | ||
1002 | rcd = kmalloc(rcd_len, GFP_KERNEL); | ||
1003 | if (!rcd) { | ||
1004 | rc = -ENOMEM; | ||
1005 | goto out; | ||
1006 | } | ||
1000 | skip: | 1007 | skip: |
1001 | rc = erst_get_record_id_next(&reader_pos, &record_id); | 1008 | rc = erst_get_record_id_next(&reader_pos, &record_id); |
1002 | if (rc) | 1009 | if (rc) |
@@ -1004,22 +1011,27 @@ skip: | |||
1004 | 1011 | ||
1005 | /* no more record */ | 1012 | /* no more record */ |
1006 | if (record_id == APEI_ERST_INVALID_RECORD_ID) { | 1013 | if (record_id == APEI_ERST_INVALID_RECORD_ID) { |
1007 | rc = -1; | 1014 | rc = -EINVAL; |
1008 | goto out; | 1015 | goto out; |
1009 | } | 1016 | } |
1010 | 1017 | ||
1011 | len = erst_read(record_id, &rcd->hdr, sizeof(*rcd) + | 1018 | len = erst_read(record_id, &rcd->hdr, rcd_len); |
1012 | erst_info.bufsize); | ||
1013 | /* The record may be cleared by others, try read next record */ | 1019 | /* The record may be cleared by others, try read next record */ |
1014 | if (len == -ENOENT) | 1020 | if (len == -ENOENT) |
1015 | goto skip; | 1021 | goto skip; |
1016 | else if (len < 0) { | 1022 | else if (len < sizeof(*rcd)) { |
1017 | rc = -1; | 1023 | rc = -EIO; |
1018 | goto out; | 1024 | goto out; |
1019 | } | 1025 | } |
1020 | if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0) | 1026 | if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0) |
1021 | goto skip; | 1027 | goto skip; |
1022 | 1028 | ||
1029 | *buf = kmalloc(len, GFP_KERNEL); | ||
1030 | if (*buf == NULL) { | ||
1031 | rc = -ENOMEM; | ||
1032 | goto out; | ||
1033 | } | ||
1034 | memcpy(*buf, rcd->data, len - sizeof(*rcd)); | ||
1023 | *id = record_id; | 1035 | *id = record_id; |
1024 | if (uuid_le_cmp(rcd->sec_hdr.section_type, | 1036 | if (uuid_le_cmp(rcd->sec_hdr.section_type, |
1025 | CPER_SECTION_TYPE_DMESG) == 0) | 1037 | CPER_SECTION_TYPE_DMESG) == 0) |
@@ -1037,6 +1049,7 @@ skip: | |||
1037 | time->tv_nsec = 0; | 1049 | time->tv_nsec = 0; |
1038 | 1050 | ||
1039 | out: | 1051 | out: |
1052 | kfree(rcd); | ||
1040 | return (rc < 0) ? rc : (len - sizeof(*rcd)); | 1053 | return (rc < 0) ? rc : (len - sizeof(*rcd)); |
1041 | } | 1054 | } |
1042 | 1055 | ||
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index 5c6f56f21443..dcd8babae9eb 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c | |||
@@ -343,11 +343,13 @@ static void mv_process_hash_current(int first_block) | |||
343 | else | 343 | else |
344 | op.config |= CFG_MID_FRAG; | 344 | op.config |= CFG_MID_FRAG; |
345 | 345 | ||
346 | writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A); | 346 | if (first_block) { |
347 | writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B); | 347 | writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A); |
348 | writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C); | 348 | writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B); |
349 | writel(req_ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D); | 349 | writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C); |
350 | writel(req_ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E); | 350 | writel(req_ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D); |
351 | writel(req_ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E); | ||
352 | } | ||
351 | } | 353 | } |
352 | 354 | ||
353 | memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config)); | 355 | memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config)); |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 8af8e864a9cf..73464a62adf7 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
@@ -1128,7 +1128,7 @@ static struct of_device_id mpc85xx_mc_err_of_match[] = { | |||
1128 | { .compatible = "fsl,p1020-memory-controller", }, | 1128 | { .compatible = "fsl,p1020-memory-controller", }, |
1129 | { .compatible = "fsl,p1021-memory-controller", }, | 1129 | { .compatible = "fsl,p1021-memory-controller", }, |
1130 | { .compatible = "fsl,p2020-memory-controller", }, | 1130 | { .compatible = "fsl,p2020-memory-controller", }, |
1131 | { .compatible = "fsl,p4080-memory-controller", }, | 1131 | { .compatible = "fsl,qoriq-memory-controller", }, |
1132 | {}, | 1132 | {}, |
1133 | }; | 1133 | }; |
1134 | MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match); | 1134 | MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match); |
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 8370f72d87ff..b0a81173a268 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -457,7 +457,8 @@ static int efi_pstore_close(struct pstore_info *psi) | |||
457 | } | 457 | } |
458 | 458 | ||
459 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | 459 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, |
460 | struct timespec *timespec, struct pstore_info *psi) | 460 | struct timespec *timespec, |
461 | char **buf, struct pstore_info *psi) | ||
461 | { | 462 | { |
462 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; | 463 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; |
463 | struct efivars *efivars = psi->data; | 464 | struct efivars *efivars = psi->data; |
@@ -478,7 +479,11 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | |||
478 | timespec->tv_nsec = 0; | 479 | timespec->tv_nsec = 0; |
479 | get_var_data_locked(efivars, &efivars->walk_entry->var); | 480 | get_var_data_locked(efivars, &efivars->walk_entry->var); |
480 | size = efivars->walk_entry->var.DataSize; | 481 | size = efivars->walk_entry->var.DataSize; |
481 | memcpy(psi->buf, efivars->walk_entry->var.Data, size); | 482 | *buf = kmalloc(size, GFP_KERNEL); |
483 | if (*buf == NULL) | ||
484 | return -ENOMEM; | ||
485 | memcpy(*buf, efivars->walk_entry->var.Data, | ||
486 | size); | ||
482 | efivars->walk_entry = list_entry(efivars->walk_entry->list.next, | 487 | efivars->walk_entry = list_entry(efivars->walk_entry->list.next, |
483 | struct efivar_entry, list); | 488 | struct efivar_entry, list); |
484 | return size; | 489 | return size; |
@@ -576,7 +581,8 @@ static int efi_pstore_close(struct pstore_info *psi) | |||
576 | } | 581 | } |
577 | 582 | ||
578 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | 583 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, |
579 | struct timespec *time, struct pstore_info *psi) | 584 | struct timespec *timespec, |
585 | char **buf, struct pstore_info *psi) | ||
580 | { | 586 | { |
581 | return -1; | 587 | return -1; |
582 | } | 588 | } |
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 147df8ae79db..d3f3e8f54561 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c | |||
@@ -546,7 +546,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip) | |||
546 | * Translate OpenFirmware node properties into platform_data | 546 | * Translate OpenFirmware node properties into platform_data |
547 | * WARNING: This is DEPRECATED and will be removed eventually! | 547 | * WARNING: This is DEPRECATED and will be removed eventually! |
548 | */ | 548 | */ |
549 | void | 549 | static void |
550 | pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) | 550 | pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) |
551 | { | 551 | { |
552 | struct device_node *node; | 552 | struct device_node *node; |
@@ -574,7 +574,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) | |||
574 | *invert = *val; | 574 | *invert = *val; |
575 | } | 575 | } |
576 | #else | 576 | #else |
577 | void | 577 | static void |
578 | pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) | 578 | pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) |
579 | { | 579 | { |
580 | *gpio_base = -1; | 580 | *gpio_base = -1; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 6f8afea94fc9..2bb07bca511a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c | |||
@@ -27,82 +27,84 @@ | |||
27 | #include "drm.h" | 27 | #include "drm.h" |
28 | 28 | ||
29 | #include "exynos_drm_drv.h" | 29 | #include "exynos_drm_drv.h" |
30 | #include "exynos_drm_gem.h" | ||
30 | #include "exynos_drm_buf.h" | 31 | #include "exynos_drm_buf.h" |
31 | 32 | ||
32 | static DEFINE_MUTEX(exynos_drm_buf_lock); | ||
33 | |||
34 | static int lowlevel_buffer_allocate(struct drm_device *dev, | 33 | static int lowlevel_buffer_allocate(struct drm_device *dev, |
35 | struct exynos_drm_buf_entry *entry) | 34 | struct exynos_drm_gem_buf *buffer) |
36 | { | 35 | { |
37 | DRM_DEBUG_KMS("%s\n", __FILE__); | 36 | DRM_DEBUG_KMS("%s\n", __FILE__); |
38 | 37 | ||
39 | entry->vaddr = dma_alloc_writecombine(dev->dev, entry->size, | 38 | buffer->kvaddr = dma_alloc_writecombine(dev->dev, buffer->size, |
40 | (dma_addr_t *)&entry->paddr, GFP_KERNEL); | 39 | &buffer->dma_addr, GFP_KERNEL); |
41 | if (!entry->paddr) { | 40 | if (!buffer->kvaddr) { |
42 | DRM_ERROR("failed to allocate buffer.\n"); | 41 | DRM_ERROR("failed to allocate buffer.\n"); |
43 | return -ENOMEM; | 42 | return -ENOMEM; |
44 | } | 43 | } |
45 | 44 | ||
46 | DRM_DEBUG_KMS("allocated : vaddr(0x%x), paddr(0x%x), size(0x%x)\n", | 45 | DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", |
47 | (unsigned int)entry->vaddr, entry->paddr, entry->size); | 46 | (unsigned long)buffer->kvaddr, |
47 | (unsigned long)buffer->dma_addr, | ||
48 | buffer->size); | ||
48 | 49 | ||
49 | return 0; | 50 | return 0; |
50 | } | 51 | } |
51 | 52 | ||
52 | static void lowlevel_buffer_deallocate(struct drm_device *dev, | 53 | static void lowlevel_buffer_deallocate(struct drm_device *dev, |
53 | struct exynos_drm_buf_entry *entry) | 54 | struct exynos_drm_gem_buf *buffer) |
54 | { | 55 | { |
55 | DRM_DEBUG_KMS("%s.\n", __FILE__); | 56 | DRM_DEBUG_KMS("%s.\n", __FILE__); |
56 | 57 | ||
57 | if (entry->paddr && entry->vaddr && entry->size) | 58 | if (buffer->dma_addr && buffer->size) |
58 | dma_free_writecombine(dev->dev, entry->size, entry->vaddr, | 59 | dma_free_writecombine(dev->dev, buffer->size, buffer->kvaddr, |
59 | entry->paddr); | 60 | (dma_addr_t)buffer->dma_addr); |
60 | else | 61 | else |
61 | DRM_DEBUG_KMS("entry data is null.\n"); | 62 | DRM_DEBUG_KMS("buffer data are invalid.\n"); |
62 | } | 63 | } |
63 | 64 | ||
64 | struct exynos_drm_buf_entry *exynos_drm_buf_create(struct drm_device *dev, | 65 | struct exynos_drm_gem_buf *exynos_drm_buf_create(struct drm_device *dev, |
65 | unsigned int size) | 66 | unsigned int size) |
66 | { | 67 | { |
67 | struct exynos_drm_buf_entry *entry; | 68 | struct exynos_drm_gem_buf *buffer; |
68 | 69 | ||
69 | DRM_DEBUG_KMS("%s.\n", __FILE__); | 70 | DRM_DEBUG_KMS("%s.\n", __FILE__); |
71 | DRM_DEBUG_KMS("desired size = 0x%x\n", size); | ||
70 | 72 | ||
71 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 73 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); |
72 | if (!entry) { | 74 | if (!buffer) { |
73 | DRM_ERROR("failed to allocate exynos_drm_buf_entry.\n"); | 75 | DRM_ERROR("failed to allocate exynos_drm_gem_buf.\n"); |
74 | return ERR_PTR(-ENOMEM); | 76 | return ERR_PTR(-ENOMEM); |
75 | } | 77 | } |
76 | 78 | ||
77 | entry->size = size; | 79 | buffer->size = size; |
78 | 80 | ||
79 | /* | 81 | /* |
80 | * allocate memory region with size and set the memory information | 82 | * allocate memory region with size and set the memory information |
81 | * to vaddr and paddr of a entry object. | 83 | * to vaddr and dma_addr of a buffer object. |
82 | */ | 84 | */ |
83 | if (lowlevel_buffer_allocate(dev, entry) < 0) { | 85 | if (lowlevel_buffer_allocate(dev, buffer) < 0) { |
84 | kfree(entry); | 86 | kfree(buffer); |
85 | entry = NULL; | 87 | buffer = NULL; |
86 | return ERR_PTR(-ENOMEM); | 88 | return ERR_PTR(-ENOMEM); |
87 | } | 89 | } |
88 | 90 | ||
89 | return entry; | 91 | return buffer; |
90 | } | 92 | } |
91 | 93 | ||
92 | void exynos_drm_buf_destroy(struct drm_device *dev, | 94 | void exynos_drm_buf_destroy(struct drm_device *dev, |
93 | struct exynos_drm_buf_entry *entry) | 95 | struct exynos_drm_gem_buf *buffer) |
94 | { | 96 | { |
95 | DRM_DEBUG_KMS("%s.\n", __FILE__); | 97 | DRM_DEBUG_KMS("%s.\n", __FILE__); |
96 | 98 | ||
97 | if (!entry) { | 99 | if (!buffer) { |
98 | DRM_DEBUG_KMS("entry is null.\n"); | 100 | DRM_DEBUG_KMS("buffer is null.\n"); |
99 | return; | 101 | return; |
100 | } | 102 | } |
101 | 103 | ||
102 | lowlevel_buffer_deallocate(dev, entry); | 104 | lowlevel_buffer_deallocate(dev, buffer); |
103 | 105 | ||
104 | kfree(entry); | 106 | kfree(buffer); |
105 | entry = NULL; | 107 | buffer = NULL; |
106 | } | 108 | } |
107 | 109 | ||
108 | MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>"); | 110 | MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.h b/drivers/gpu/drm/exynos/exynos_drm_buf.h index 045d59eab01a..6e91f9caa5db 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.h +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.h | |||
@@ -26,28 +26,15 @@ | |||
26 | #ifndef _EXYNOS_DRM_BUF_H_ | 26 | #ifndef _EXYNOS_DRM_BUF_H_ |
27 | #define _EXYNOS_DRM_BUF_H_ | 27 | #define _EXYNOS_DRM_BUF_H_ |
28 | 28 | ||
29 | /* | ||
30 | * exynos drm buffer entry structure. | ||
31 | * | ||
32 | * @paddr: physical address of allocated memory. | ||
33 | * @vaddr: kernel virtual address of allocated memory. | ||
34 | * @size: size of allocated memory. | ||
35 | */ | ||
36 | struct exynos_drm_buf_entry { | ||
37 | dma_addr_t paddr; | ||
38 | void __iomem *vaddr; | ||
39 | unsigned int size; | ||
40 | }; | ||
41 | |||
42 | /* allocate physical memory. */ | 29 | /* allocate physical memory. */ |
43 | struct exynos_drm_buf_entry *exynos_drm_buf_create(struct drm_device *dev, | 30 | struct exynos_drm_gem_buf *exynos_drm_buf_create(struct drm_device *dev, |
44 | unsigned int size); | 31 | unsigned int size); |
45 | 32 | ||
46 | /* get physical memory information of a drm framebuffer. */ | 33 | /* get memory information of a drm framebuffer. */ |
47 | struct exynos_drm_buf_entry *exynos_drm_fb_get_buf(struct drm_framebuffer *fb); | 34 | struct exynos_drm_gem_buf *exynos_drm_fb_get_buf(struct drm_framebuffer *fb); |
48 | 35 | ||
49 | /* remove allocated physical memory. */ | 36 | /* remove allocated physical memory. */ |
50 | void exynos_drm_buf_destroy(struct drm_device *dev, | 37 | void exynos_drm_buf_destroy(struct drm_device *dev, |
51 | struct exynos_drm_buf_entry *entry); | 38 | struct exynos_drm_gem_buf *buffer); |
52 | 39 | ||
53 | #endif | 40 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 985d9e768728..d620b0784257 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c | |||
@@ -37,6 +37,8 @@ | |||
37 | 37 | ||
38 | struct exynos_drm_connector { | 38 | struct exynos_drm_connector { |
39 | struct drm_connector drm_connector; | 39 | struct drm_connector drm_connector; |
40 | uint32_t encoder_id; | ||
41 | struct exynos_drm_manager *manager; | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | /* convert exynos_video_timings to drm_display_mode */ | 44 | /* convert exynos_video_timings to drm_display_mode */ |
@@ -47,6 +49,7 @@ convert_to_display_mode(struct drm_display_mode *mode, | |||
47 | DRM_DEBUG_KMS("%s\n", __FILE__); | 49 | DRM_DEBUG_KMS("%s\n", __FILE__); |
48 | 50 | ||
49 | mode->clock = timing->pixclock / 1000; | 51 | mode->clock = timing->pixclock / 1000; |
52 | mode->vrefresh = timing->refresh; | ||
50 | 53 | ||
51 | mode->hdisplay = timing->xres; | 54 | mode->hdisplay = timing->xres; |
52 | mode->hsync_start = mode->hdisplay + timing->left_margin; | 55 | mode->hsync_start = mode->hdisplay + timing->left_margin; |
@@ -57,6 +60,12 @@ convert_to_display_mode(struct drm_display_mode *mode, | |||
57 | mode->vsync_start = mode->vdisplay + timing->upper_margin; | 60 | mode->vsync_start = mode->vdisplay + timing->upper_margin; |
58 | mode->vsync_end = mode->vsync_start + timing->vsync_len; | 61 | mode->vsync_end = mode->vsync_start + timing->vsync_len; |
59 | mode->vtotal = mode->vsync_end + timing->lower_margin; | 62 | mode->vtotal = mode->vsync_end + timing->lower_margin; |
63 | |||
64 | if (timing->vmode & FB_VMODE_INTERLACED) | ||
65 | mode->flags |= DRM_MODE_FLAG_INTERLACE; | ||
66 | |||
67 | if (timing->vmode & FB_VMODE_DOUBLE) | ||
68 | mode->flags |= DRM_MODE_FLAG_DBLSCAN; | ||
60 | } | 69 | } |
61 | 70 | ||
62 | /* convert drm_display_mode to exynos_video_timings */ | 71 | /* convert drm_display_mode to exynos_video_timings */ |
@@ -69,7 +78,7 @@ convert_to_video_timing(struct fb_videomode *timing, | |||
69 | memset(timing, 0, sizeof(*timing)); | 78 | memset(timing, 0, sizeof(*timing)); |
70 | 79 | ||
71 | timing->pixclock = mode->clock * 1000; | 80 | timing->pixclock = mode->clock * 1000; |
72 | timing->refresh = mode->vrefresh; | 81 | timing->refresh = drm_mode_vrefresh(mode); |
73 | 82 | ||
74 | timing->xres = mode->hdisplay; | 83 | timing->xres = mode->hdisplay; |
75 | timing->left_margin = mode->hsync_start - mode->hdisplay; | 84 | timing->left_margin = mode->hsync_start - mode->hdisplay; |
@@ -92,15 +101,16 @@ convert_to_video_timing(struct fb_videomode *timing, | |||
92 | 101 | ||
93 | static int exynos_drm_connector_get_modes(struct drm_connector *connector) | 102 | static int exynos_drm_connector_get_modes(struct drm_connector *connector) |
94 | { | 103 | { |
95 | struct exynos_drm_manager *manager = | 104 | struct exynos_drm_connector *exynos_connector = |
96 | exynos_drm_get_manager(connector->encoder); | 105 | to_exynos_connector(connector); |
97 | struct exynos_drm_display *display = manager->display; | 106 | struct exynos_drm_manager *manager = exynos_connector->manager; |
107 | struct exynos_drm_display_ops *display_ops = manager->display_ops; | ||
98 | unsigned int count; | 108 | unsigned int count; |
99 | 109 | ||
100 | DRM_DEBUG_KMS("%s\n", __FILE__); | 110 | DRM_DEBUG_KMS("%s\n", __FILE__); |
101 | 111 | ||
102 | if (!display) { | 112 | if (!display_ops) { |
103 | DRM_DEBUG_KMS("display is null.\n"); | 113 | DRM_DEBUG_KMS("display_ops is null.\n"); |
104 | return 0; | 114 | return 0; |
105 | } | 115 | } |
106 | 116 | ||
@@ -112,7 +122,7 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
112 | * P.S. in case of lcd panel, count is always 1 if success | 122 | * P.S. in case of lcd panel, count is always 1 if success |
113 | * because lcd panel has only one mode. | 123 | * because lcd panel has only one mode. |
114 | */ | 124 | */ |
115 | if (display->get_edid) { | 125 | if (display_ops->get_edid) { |
116 | int ret; | 126 | int ret; |
117 | void *edid; | 127 | void *edid; |
118 | 128 | ||
@@ -122,7 +132,7 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
122 | return 0; | 132 | return 0; |
123 | } | 133 | } |
124 | 134 | ||
125 | ret = display->get_edid(manager->dev, connector, | 135 | ret = display_ops->get_edid(manager->dev, connector, |
126 | edid, MAX_EDID); | 136 | edid, MAX_EDID); |
127 | if (ret < 0) { | 137 | if (ret < 0) { |
128 | DRM_ERROR("failed to get edid data.\n"); | 138 | DRM_ERROR("failed to get edid data.\n"); |
@@ -140,8 +150,8 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
140 | struct drm_display_mode *mode = drm_mode_create(connector->dev); | 150 | struct drm_display_mode *mode = drm_mode_create(connector->dev); |
141 | struct fb_videomode *timing; | 151 | struct fb_videomode *timing; |
142 | 152 | ||
143 | if (display->get_timing) | 153 | if (display_ops->get_timing) |
144 | timing = display->get_timing(manager->dev); | 154 | timing = display_ops->get_timing(manager->dev); |
145 | else { | 155 | else { |
146 | drm_mode_destroy(connector->dev, mode); | 156 | drm_mode_destroy(connector->dev, mode); |
147 | return 0; | 157 | return 0; |
@@ -162,9 +172,10 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
162 | static int exynos_drm_connector_mode_valid(struct drm_connector *connector, | 172 | static int exynos_drm_connector_mode_valid(struct drm_connector *connector, |
163 | struct drm_display_mode *mode) | 173 | struct drm_display_mode *mode) |
164 | { | 174 | { |
165 | struct exynos_drm_manager *manager = | 175 | struct exynos_drm_connector *exynos_connector = |
166 | exynos_drm_get_manager(connector->encoder); | 176 | to_exynos_connector(connector); |
167 | struct exynos_drm_display *display = manager->display; | 177 | struct exynos_drm_manager *manager = exynos_connector->manager; |
178 | struct exynos_drm_display_ops *display_ops = manager->display_ops; | ||
168 | struct fb_videomode timing; | 179 | struct fb_videomode timing; |
169 | int ret = MODE_BAD; | 180 | int ret = MODE_BAD; |
170 | 181 | ||
@@ -172,8 +183,8 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector, | |||
172 | 183 | ||
173 | convert_to_video_timing(&timing, mode); | 184 | convert_to_video_timing(&timing, mode); |
174 | 185 | ||
175 | if (display && display->check_timing) | 186 | if (display_ops && display_ops->check_timing) |
176 | if (!display->check_timing(manager->dev, (void *)&timing)) | 187 | if (!display_ops->check_timing(manager->dev, (void *)&timing)) |
177 | ret = MODE_OK; | 188 | ret = MODE_OK; |
178 | 189 | ||
179 | return ret; | 190 | return ret; |
@@ -181,9 +192,25 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector, | |||
181 | 192 | ||
182 | struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector) | 193 | struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector) |
183 | { | 194 | { |
195 | struct drm_device *dev = connector->dev; | ||
196 | struct exynos_drm_connector *exynos_connector = | ||
197 | to_exynos_connector(connector); | ||
198 | struct drm_mode_object *obj; | ||
199 | struct drm_encoder *encoder; | ||
200 | |||
184 | DRM_DEBUG_KMS("%s\n", __FILE__); | 201 | DRM_DEBUG_KMS("%s\n", __FILE__); |
185 | 202 | ||
186 | return connector->encoder; | 203 | obj = drm_mode_object_find(dev, exynos_connector->encoder_id, |
204 | DRM_MODE_OBJECT_ENCODER); | ||
205 | if (!obj) { | ||
206 | DRM_DEBUG_KMS("Unknown ENCODER ID %d\n", | ||
207 | exynos_connector->encoder_id); | ||
208 | return NULL; | ||
209 | } | ||
210 | |||
211 | encoder = obj_to_encoder(obj); | ||
212 | |||
213 | return encoder; | ||
187 | } | 214 | } |
188 | 215 | ||
189 | static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { | 216 | static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { |
@@ -196,15 +223,17 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { | |||
196 | static enum drm_connector_status | 223 | static enum drm_connector_status |
197 | exynos_drm_connector_detect(struct drm_connector *connector, bool force) | 224 | exynos_drm_connector_detect(struct drm_connector *connector, bool force) |
198 | { | 225 | { |
199 | struct exynos_drm_manager *manager = | 226 | struct exynos_drm_connector *exynos_connector = |
200 | exynos_drm_get_manager(connector->encoder); | 227 | to_exynos_connector(connector); |
201 | struct exynos_drm_display *display = manager->display; | 228 | struct exynos_drm_manager *manager = exynos_connector->manager; |
229 | struct exynos_drm_display_ops *display_ops = | ||
230 | manager->display_ops; | ||
202 | enum drm_connector_status status = connector_status_disconnected; | 231 | enum drm_connector_status status = connector_status_disconnected; |
203 | 232 | ||
204 | DRM_DEBUG_KMS("%s\n", __FILE__); | 233 | DRM_DEBUG_KMS("%s\n", __FILE__); |
205 | 234 | ||
206 | if (display && display->is_connected) { | 235 | if (display_ops && display_ops->is_connected) { |
207 | if (display->is_connected(manager->dev)) | 236 | if (display_ops->is_connected(manager->dev)) |
208 | status = connector_status_connected; | 237 | status = connector_status_connected; |
209 | else | 238 | else |
210 | status = connector_status_disconnected; | 239 | status = connector_status_disconnected; |
@@ -251,9 +280,11 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, | |||
251 | 280 | ||
252 | connector = &exynos_connector->drm_connector; | 281 | connector = &exynos_connector->drm_connector; |
253 | 282 | ||
254 | switch (manager->display->type) { | 283 | switch (manager->display_ops->type) { |
255 | case EXYNOS_DISPLAY_TYPE_HDMI: | 284 | case EXYNOS_DISPLAY_TYPE_HDMI: |
256 | type = DRM_MODE_CONNECTOR_HDMIA; | 285 | type = DRM_MODE_CONNECTOR_HDMIA; |
286 | connector->interlace_allowed = true; | ||
287 | connector->polled = DRM_CONNECTOR_POLL_HPD; | ||
257 | break; | 288 | break; |
258 | default: | 289 | default: |
259 | type = DRM_MODE_CONNECTOR_Unknown; | 290 | type = DRM_MODE_CONNECTOR_Unknown; |
@@ -267,7 +298,10 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, | |||
267 | if (err) | 298 | if (err) |
268 | goto err_connector; | 299 | goto err_connector; |
269 | 300 | ||
301 | exynos_connector->encoder_id = encoder->base.id; | ||
302 | exynos_connector->manager = manager; | ||
270 | connector->encoder = encoder; | 303 | connector->encoder = encoder; |
304 | |||
271 | err = drm_mode_connector_attach_encoder(connector, encoder); | 305 | err = drm_mode_connector_attach_encoder(connector, encoder); |
272 | if (err) { | 306 | if (err) { |
273 | DRM_ERROR("failed to attach a connector to a encoder\n"); | 307 | DRM_ERROR("failed to attach a connector to a encoder\n"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 9337e5e2dbb6..ee43cc220853 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -29,36 +29,17 @@ | |||
29 | #include "drmP.h" | 29 | #include "drmP.h" |
30 | #include "drm_crtc_helper.h" | 30 | #include "drm_crtc_helper.h" |
31 | 31 | ||
32 | #include "exynos_drm_crtc.h" | ||
32 | #include "exynos_drm_drv.h" | 33 | #include "exynos_drm_drv.h" |
33 | #include "exynos_drm_fb.h" | 34 | #include "exynos_drm_fb.h" |
34 | #include "exynos_drm_encoder.h" | 35 | #include "exynos_drm_encoder.h" |
36 | #include "exynos_drm_gem.h" | ||
35 | #include "exynos_drm_buf.h" | 37 | #include "exynos_drm_buf.h" |
36 | 38 | ||
37 | #define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc,\ | 39 | #define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc,\ |
38 | drm_crtc) | 40 | drm_crtc) |
39 | 41 | ||
40 | /* | 42 | /* |
41 | * Exynos specific crtc postion structure. | ||
42 | * | ||
43 | * @fb_x: offset x on a framebuffer to be displyed | ||
44 | * - the unit is screen coordinates. | ||
45 | * @fb_y: offset y on a framebuffer to be displayed | ||
46 | * - the unit is screen coordinates. | ||
47 | * @crtc_x: offset x on hardware screen. | ||
48 | * @crtc_y: offset y on hardware screen. | ||
49 | * @crtc_w: width of hardware screen. | ||
50 | * @crtc_h: height of hardware screen. | ||
51 | */ | ||
52 | struct exynos_drm_crtc_pos { | ||
53 | unsigned int fb_x; | ||
54 | unsigned int fb_y; | ||
55 | unsigned int crtc_x; | ||
56 | unsigned int crtc_y; | ||
57 | unsigned int crtc_w; | ||
58 | unsigned int crtc_h; | ||
59 | }; | ||
60 | |||
61 | /* | ||
62 | * Exynos specific crtc structure. | 43 | * Exynos specific crtc structure. |
63 | * | 44 | * |
64 | * @drm_crtc: crtc object. | 45 | * @drm_crtc: crtc object. |
@@ -85,30 +66,31 @@ static void exynos_drm_crtc_apply(struct drm_crtc *crtc) | |||
85 | 66 | ||
86 | exynos_drm_fn_encoder(crtc, overlay, | 67 | exynos_drm_fn_encoder(crtc, overlay, |
87 | exynos_drm_encoder_crtc_mode_set); | 68 | exynos_drm_encoder_crtc_mode_set); |
88 | exynos_drm_fn_encoder(crtc, NULL, exynos_drm_encoder_crtc_commit); | 69 | exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, |
70 | exynos_drm_encoder_crtc_commit); | ||
89 | } | 71 | } |
90 | 72 | ||
91 | static int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay, | 73 | int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay, |
92 | struct drm_framebuffer *fb, | 74 | struct drm_framebuffer *fb, |
93 | struct drm_display_mode *mode, | 75 | struct drm_display_mode *mode, |
94 | struct exynos_drm_crtc_pos *pos) | 76 | struct exynos_drm_crtc_pos *pos) |
95 | { | 77 | { |
96 | struct exynos_drm_buf_entry *entry; | 78 | struct exynos_drm_gem_buf *buffer; |
97 | unsigned int actual_w; | 79 | unsigned int actual_w; |
98 | unsigned int actual_h; | 80 | unsigned int actual_h; |
99 | 81 | ||
100 | entry = exynos_drm_fb_get_buf(fb); | 82 | buffer = exynos_drm_fb_get_buf(fb); |
101 | if (!entry) { | 83 | if (!buffer) { |
102 | DRM_LOG_KMS("entry is null.\n"); | 84 | DRM_LOG_KMS("buffer is null.\n"); |
103 | return -EFAULT; | 85 | return -EFAULT; |
104 | } | 86 | } |
105 | 87 | ||
106 | overlay->paddr = entry->paddr; | 88 | overlay->dma_addr = buffer->dma_addr; |
107 | overlay->vaddr = entry->vaddr; | 89 | overlay->vaddr = buffer->kvaddr; |
108 | 90 | ||
109 | DRM_DEBUG_KMS("vaddr = 0x%lx, paddr = 0x%lx\n", | 91 | DRM_DEBUG_KMS("vaddr = 0x%lx, dma_addr = 0x%lx\n", |
110 | (unsigned long)overlay->vaddr, | 92 | (unsigned long)overlay->vaddr, |
111 | (unsigned long)overlay->paddr); | 93 | (unsigned long)overlay->dma_addr); |
112 | 94 | ||
113 | actual_w = min((mode->hdisplay - pos->crtc_x), pos->crtc_w); | 95 | actual_w = min((mode->hdisplay - pos->crtc_x), pos->crtc_w); |
114 | actual_h = min((mode->vdisplay - pos->crtc_y), pos->crtc_h); | 96 | actual_h = min((mode->vdisplay - pos->crtc_y), pos->crtc_h); |
@@ -171,9 +153,26 @@ static int exynos_drm_crtc_update(struct drm_crtc *crtc) | |||
171 | 153 | ||
172 | static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) | 154 | static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) |
173 | { | 155 | { |
174 | DRM_DEBUG_KMS("%s\n", __FILE__); | 156 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
175 | 157 | ||
176 | /* TODO */ | 158 | DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode); |
159 | |||
160 | switch (mode) { | ||
161 | case DRM_MODE_DPMS_ON: | ||
162 | exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, | ||
163 | exynos_drm_encoder_crtc_commit); | ||
164 | break; | ||
165 | case DRM_MODE_DPMS_STANDBY: | ||
166 | case DRM_MODE_DPMS_SUSPEND: | ||
167 | case DRM_MODE_DPMS_OFF: | ||
168 | /* TODO */ | ||
169 | exynos_drm_fn_encoder(crtc, NULL, | ||
170 | exynos_drm_encoder_crtc_disable); | ||
171 | break; | ||
172 | default: | ||
173 | DRM_DEBUG_KMS("unspecified mode %d\n", mode); | ||
174 | break; | ||
175 | } | ||
177 | } | 176 | } |
178 | 177 | ||
179 | static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) | 178 | static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) |
@@ -185,9 +184,12 @@ static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) | |||
185 | 184 | ||
186 | static void exynos_drm_crtc_commit(struct drm_crtc *crtc) | 185 | static void exynos_drm_crtc_commit(struct drm_crtc *crtc) |
187 | { | 186 | { |
187 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); | ||
188 | |||
188 | DRM_DEBUG_KMS("%s\n", __FILE__); | 189 | DRM_DEBUG_KMS("%s\n", __FILE__); |
189 | 190 | ||
190 | /* drm framework doesn't check NULL. */ | 191 | exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, |
192 | exynos_drm_encoder_crtc_commit); | ||
191 | } | 193 | } |
192 | 194 | ||
193 | static bool | 195 | static bool |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h index c584042d6d2c..25f72a62cb88 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h | |||
@@ -35,4 +35,29 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr); | |||
35 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); | 35 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); |
36 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); | 36 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); |
37 | 37 | ||
38 | /* | ||
39 | * Exynos specific crtc postion structure. | ||
40 | * | ||
41 | * @fb_x: offset x on a framebuffer to be displyed | ||
42 | * - the unit is screen coordinates. | ||
43 | * @fb_y: offset y on a framebuffer to be displayed | ||
44 | * - the unit is screen coordinates. | ||
45 | * @crtc_x: offset x on hardware screen. | ||
46 | * @crtc_y: offset y on hardware screen. | ||
47 | * @crtc_w: width of hardware screen. | ||
48 | * @crtc_h: height of hardware screen. | ||
49 | */ | ||
50 | struct exynos_drm_crtc_pos { | ||
51 | unsigned int fb_x; | ||
52 | unsigned int fb_y; | ||
53 | unsigned int crtc_x; | ||
54 | unsigned int crtc_y; | ||
55 | unsigned int crtc_w; | ||
56 | unsigned int crtc_h; | ||
57 | }; | ||
58 | |||
59 | int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay, | ||
60 | struct drm_framebuffer *fb, | ||
61 | struct drm_display_mode *mode, | ||
62 | struct exynos_drm_crtc_pos *pos); | ||
38 | #endif | 63 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 83810cbe3c17..53e2216de61d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include "drmP.h" | 28 | #include "drmP.h" |
29 | #include "drm.h" | 29 | #include "drm.h" |
30 | #include "drm_crtc_helper.h" | ||
30 | 31 | ||
31 | #include <drm/exynos_drm.h> | 32 | #include <drm/exynos_drm.h> |
32 | 33 | ||
@@ -61,6 +62,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) | |||
61 | 62 | ||
62 | drm_mode_config_init(dev); | 63 | drm_mode_config_init(dev); |
63 | 64 | ||
65 | /* init kms poll for handling hpd */ | ||
66 | drm_kms_helper_poll_init(dev); | ||
67 | |||
64 | exynos_drm_mode_config_init(dev); | 68 | exynos_drm_mode_config_init(dev); |
65 | 69 | ||
66 | /* | 70 | /* |
@@ -116,6 +120,7 @@ static int exynos_drm_unload(struct drm_device *dev) | |||
116 | exynos_drm_fbdev_fini(dev); | 120 | exynos_drm_fbdev_fini(dev); |
117 | exynos_drm_device_unregister(dev); | 121 | exynos_drm_device_unregister(dev); |
118 | drm_vblank_cleanup(dev); | 122 | drm_vblank_cleanup(dev); |
123 | drm_kms_helper_poll_fini(dev); | ||
119 | drm_mode_config_cleanup(dev); | 124 | drm_mode_config_cleanup(dev); |
120 | kfree(dev->dev_private); | 125 | kfree(dev->dev_private); |
121 | 126 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index c03683f2ae72..5e02e6ecc2e0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #ifndef _EXYNOS_DRM_DRV_H_ | 29 | #ifndef _EXYNOS_DRM_DRV_H_ |
30 | #define _EXYNOS_DRM_DRV_H_ | 30 | #define _EXYNOS_DRM_DRV_H_ |
31 | 31 | ||
32 | #include <linux/module.h> | ||
32 | #include "drm.h" | 33 | #include "drm.h" |
33 | 34 | ||
34 | #define MAX_CRTC 2 | 35 | #define MAX_CRTC 2 |
@@ -79,8 +80,8 @@ struct exynos_drm_overlay_ops { | |||
79 | * @scan_flag: interlace or progressive way. | 80 | * @scan_flag: interlace or progressive way. |
80 | * (it could be DRM_MODE_FLAG_*) | 81 | * (it could be DRM_MODE_FLAG_*) |
81 | * @bpp: pixel size.(in bit) | 82 | * @bpp: pixel size.(in bit) |
82 | * @paddr: bus(accessed by dma) physical memory address to this overlay | 83 | * @dma_addr: bus(accessed by dma) address to the memory region allocated |
83 | * and this is physically continuous. | 84 | * for a overlay. |
84 | * @vaddr: virtual memory addresss to this overlay. | 85 | * @vaddr: virtual memory addresss to this overlay. |
85 | * @default_win: a window to be enabled. | 86 | * @default_win: a window to be enabled. |
86 | * @color_key: color key on or off. | 87 | * @color_key: color key on or off. |
@@ -108,7 +109,7 @@ struct exynos_drm_overlay { | |||
108 | unsigned int scan_flag; | 109 | unsigned int scan_flag; |
109 | unsigned int bpp; | 110 | unsigned int bpp; |
110 | unsigned int pitch; | 111 | unsigned int pitch; |
111 | dma_addr_t paddr; | 112 | dma_addr_t dma_addr; |
112 | void __iomem *vaddr; | 113 | void __iomem *vaddr; |
113 | 114 | ||
114 | bool default_win; | 115 | bool default_win; |
@@ -130,7 +131,7 @@ struct exynos_drm_overlay { | |||
130 | * @check_timing: check if timing is valid or not. | 131 | * @check_timing: check if timing is valid or not. |
131 | * @power_on: display device on or off. | 132 | * @power_on: display device on or off. |
132 | */ | 133 | */ |
133 | struct exynos_drm_display { | 134 | struct exynos_drm_display_ops { |
134 | enum exynos_drm_output_type type; | 135 | enum exynos_drm_output_type type; |
135 | bool (*is_connected)(struct device *dev); | 136 | bool (*is_connected)(struct device *dev); |
136 | int (*get_edid)(struct device *dev, struct drm_connector *connector, | 137 | int (*get_edid)(struct device *dev, struct drm_connector *connector, |
@@ -146,12 +147,14 @@ struct exynos_drm_display { | |||
146 | * @mode_set: convert drm_display_mode to hw specific display mode and | 147 | * @mode_set: convert drm_display_mode to hw specific display mode and |
147 | * would be called by encoder->mode_set(). | 148 | * would be called by encoder->mode_set(). |
148 | * @commit: set current hw specific display mode to hw. | 149 | * @commit: set current hw specific display mode to hw. |
150 | * @disable: disable hardware specific display mode. | ||
149 | * @enable_vblank: specific driver callback for enabling vblank interrupt. | 151 | * @enable_vblank: specific driver callback for enabling vblank interrupt. |
150 | * @disable_vblank: specific driver callback for disabling vblank interrupt. | 152 | * @disable_vblank: specific driver callback for disabling vblank interrupt. |
151 | */ | 153 | */ |
152 | struct exynos_drm_manager_ops { | 154 | struct exynos_drm_manager_ops { |
153 | void (*mode_set)(struct device *subdrv_dev, void *mode); | 155 | void (*mode_set)(struct device *subdrv_dev, void *mode); |
154 | void (*commit)(struct device *subdrv_dev); | 156 | void (*commit)(struct device *subdrv_dev); |
157 | void (*disable)(struct device *subdrv_dev); | ||
155 | int (*enable_vblank)(struct device *subdrv_dev); | 158 | int (*enable_vblank)(struct device *subdrv_dev); |
156 | void (*disable_vblank)(struct device *subdrv_dev); | 159 | void (*disable_vblank)(struct device *subdrv_dev); |
157 | }; | 160 | }; |
@@ -178,7 +181,7 @@ struct exynos_drm_manager { | |||
178 | int pipe; | 181 | int pipe; |
179 | struct exynos_drm_manager_ops *ops; | 182 | struct exynos_drm_manager_ops *ops; |
180 | struct exynos_drm_overlay_ops *overlay_ops; | 183 | struct exynos_drm_overlay_ops *overlay_ops; |
181 | struct exynos_drm_display *display; | 184 | struct exynos_drm_display_ops *display_ops; |
182 | }; | 185 | }; |
183 | 186 | ||
184 | /* | 187 | /* |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 7cf6fa86a67e..153061415baf 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c | |||
@@ -53,15 +53,36 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
53 | struct drm_device *dev = encoder->dev; | 53 | struct drm_device *dev = encoder->dev; |
54 | struct drm_connector *connector; | 54 | struct drm_connector *connector; |
55 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); | 55 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); |
56 | struct exynos_drm_manager_ops *manager_ops = manager->ops; | ||
56 | 57 | ||
57 | DRM_DEBUG_KMS("%s, encoder dpms: %d\n", __FILE__, mode); | 58 | DRM_DEBUG_KMS("%s, encoder dpms: %d\n", __FILE__, mode); |
58 | 59 | ||
60 | switch (mode) { | ||
61 | case DRM_MODE_DPMS_ON: | ||
62 | if (manager_ops && manager_ops->commit) | ||
63 | manager_ops->commit(manager->dev); | ||
64 | break; | ||
65 | case DRM_MODE_DPMS_STANDBY: | ||
66 | case DRM_MODE_DPMS_SUSPEND: | ||
67 | case DRM_MODE_DPMS_OFF: | ||
68 | /* TODO */ | ||
69 | if (manager_ops && manager_ops->disable) | ||
70 | manager_ops->disable(manager->dev); | ||
71 | break; | ||
72 | default: | ||
73 | DRM_ERROR("unspecified mode %d\n", mode); | ||
74 | break; | ||
75 | } | ||
76 | |||
59 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 77 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
60 | if (connector->encoder == encoder) { | 78 | if (connector->encoder == encoder) { |
61 | struct exynos_drm_display *display = manager->display; | 79 | struct exynos_drm_display_ops *display_ops = |
80 | manager->display_ops; | ||
62 | 81 | ||
63 | if (display && display->power_on) | 82 | DRM_DEBUG_KMS("connector[%d] dpms[%d]\n", |
64 | display->power_on(manager->dev, mode); | 83 | connector->base.id, mode); |
84 | if (display_ops && display_ops->power_on) | ||
85 | display_ops->power_on(manager->dev, mode); | ||
65 | } | 86 | } |
66 | } | 87 | } |
67 | } | 88 | } |
@@ -116,15 +137,11 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder) | |||
116 | { | 137 | { |
117 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); | 138 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); |
118 | struct exynos_drm_manager_ops *manager_ops = manager->ops; | 139 | struct exynos_drm_manager_ops *manager_ops = manager->ops; |
119 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; | ||
120 | 140 | ||
121 | DRM_DEBUG_KMS("%s\n", __FILE__); | 141 | DRM_DEBUG_KMS("%s\n", __FILE__); |
122 | 142 | ||
123 | if (manager_ops && manager_ops->commit) | 143 | if (manager_ops && manager_ops->commit) |
124 | manager_ops->commit(manager->dev); | 144 | manager_ops->commit(manager->dev); |
125 | |||
126 | if (overlay_ops && overlay_ops->commit) | ||
127 | overlay_ops->commit(manager->dev); | ||
128 | } | 145 | } |
129 | 146 | ||
130 | static struct drm_crtc * | 147 | static struct drm_crtc * |
@@ -208,10 +225,23 @@ void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data, | |||
208 | { | 225 | { |
209 | struct drm_device *dev = crtc->dev; | 226 | struct drm_device *dev = crtc->dev; |
210 | struct drm_encoder *encoder; | 227 | struct drm_encoder *encoder; |
228 | struct exynos_drm_private *private = dev->dev_private; | ||
229 | struct exynos_drm_manager *manager; | ||
211 | 230 | ||
212 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | 231 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
213 | if (encoder->crtc != crtc) | 232 | /* |
214 | continue; | 233 | * if crtc is detached from encoder, check pipe, |
234 | * otherwise check crtc attached to encoder | ||
235 | */ | ||
236 | if (!encoder->crtc) { | ||
237 | manager = to_exynos_encoder(encoder)->manager; | ||
238 | if (manager->pipe < 0 || | ||
239 | private->crtc[manager->pipe] != crtc) | ||
240 | continue; | ||
241 | } else { | ||
242 | if (encoder->crtc != crtc) | ||
243 | continue; | ||
244 | } | ||
215 | 245 | ||
216 | fn(encoder, data); | 246 | fn(encoder, data); |
217 | } | 247 | } |
@@ -250,8 +280,18 @@ void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data) | |||
250 | struct exynos_drm_manager *manager = | 280 | struct exynos_drm_manager *manager = |
251 | to_exynos_encoder(encoder)->manager; | 281 | to_exynos_encoder(encoder)->manager; |
252 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; | 282 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; |
283 | int crtc = *(int *)data; | ||
284 | |||
285 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
286 | |||
287 | /* | ||
288 | * when crtc is detached from encoder, this pipe is used | ||
289 | * to select manager operation | ||
290 | */ | ||
291 | manager->pipe = crtc; | ||
253 | 292 | ||
254 | overlay_ops->commit(manager->dev); | 293 | if (overlay_ops && overlay_ops->commit) |
294 | overlay_ops->commit(manager->dev); | ||
255 | } | 295 | } |
256 | 296 | ||
257 | void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data) | 297 | void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data) |
@@ -261,7 +301,28 @@ void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data) | |||
261 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; | 301 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; |
262 | struct exynos_drm_overlay *overlay = data; | 302 | struct exynos_drm_overlay *overlay = data; |
263 | 303 | ||
264 | overlay_ops->mode_set(manager->dev, overlay); | 304 | if (overlay_ops && overlay_ops->mode_set) |
305 | overlay_ops->mode_set(manager->dev, overlay); | ||
306 | } | ||
307 | |||
308 | void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data) | ||
309 | { | ||
310 | struct exynos_drm_manager *manager = | ||
311 | to_exynos_encoder(encoder)->manager; | ||
312 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; | ||
313 | |||
314 | DRM_DEBUG_KMS("\n"); | ||
315 | |||
316 | if (overlay_ops && overlay_ops->disable) | ||
317 | overlay_ops->disable(manager->dev); | ||
318 | |||
319 | /* | ||
320 | * crtc is already detached from encoder and last | ||
321 | * function for detaching is properly done, so | ||
322 | * clear pipe from manager to prevent repeated call | ||
323 | */ | ||
324 | if (!encoder->crtc) | ||
325 | manager->pipe = -1; | ||
265 | } | 326 | } |
266 | 327 | ||
267 | MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>"); | 328 | MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h b/drivers/gpu/drm/exynos/exynos_drm_encoder.h index 5ecd645d06a9..a22acfbf0e4e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h | |||
@@ -41,5 +41,6 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data); | |||
41 | void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data); | 41 | void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data); |
42 | void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data); | 42 | void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data); |
43 | void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data); | 43 | void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data); |
44 | void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data); | ||
44 | 45 | ||
45 | #endif | 46 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 48d29cfd5240..5bf4a1ac7f82 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c | |||
@@ -29,7 +29,9 @@ | |||
29 | #include "drmP.h" | 29 | #include "drmP.h" |
30 | #include "drm_crtc.h" | 30 | #include "drm_crtc.h" |
31 | #include "drm_crtc_helper.h" | 31 | #include "drm_crtc_helper.h" |
32 | #include "drm_fb_helper.h" | ||
32 | 33 | ||
34 | #include "exynos_drm_drv.h" | ||
33 | #include "exynos_drm_fb.h" | 35 | #include "exynos_drm_fb.h" |
34 | #include "exynos_drm_buf.h" | 36 | #include "exynos_drm_buf.h" |
35 | #include "exynos_drm_gem.h" | 37 | #include "exynos_drm_gem.h" |
@@ -41,14 +43,14 @@ | |||
41 | * | 43 | * |
42 | * @fb: drm framebuffer obejct. | 44 | * @fb: drm framebuffer obejct. |
43 | * @exynos_gem_obj: exynos specific gem object containing a gem object. | 45 | * @exynos_gem_obj: exynos specific gem object containing a gem object. |
44 | * @entry: pointer to exynos drm buffer entry object. | 46 | * @buffer: pointer to exynos_drm_gem_buffer object. |
45 | * - containing only the information to physically continuous memory | 47 | * - contain the memory information to memory region allocated |
46 | * region allocated at default framebuffer creation. | 48 | * at default framebuffer creation. |
47 | */ | 49 | */ |
48 | struct exynos_drm_fb { | 50 | struct exynos_drm_fb { |
49 | struct drm_framebuffer fb; | 51 | struct drm_framebuffer fb; |
50 | struct exynos_drm_gem_obj *exynos_gem_obj; | 52 | struct exynos_drm_gem_obj *exynos_gem_obj; |
51 | struct exynos_drm_buf_entry *entry; | 53 | struct exynos_drm_gem_buf *buffer; |
52 | }; | 54 | }; |
53 | 55 | ||
54 | static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) | 56 | static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) |
@@ -63,8 +65,8 @@ static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) | |||
63 | * default framebuffer has no gem object so | 65 | * default framebuffer has no gem object so |
64 | * a buffer of the default framebuffer should be released at here. | 66 | * a buffer of the default framebuffer should be released at here. |
65 | */ | 67 | */ |
66 | if (!exynos_fb->exynos_gem_obj && exynos_fb->entry) | 68 | if (!exynos_fb->exynos_gem_obj && exynos_fb->buffer) |
67 | exynos_drm_buf_destroy(fb->dev, exynos_fb->entry); | 69 | exynos_drm_buf_destroy(fb->dev, exynos_fb->buffer); |
68 | 70 | ||
69 | kfree(exynos_fb); | 71 | kfree(exynos_fb); |
70 | exynos_fb = NULL; | 72 | exynos_fb = NULL; |
@@ -143,29 +145,29 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, | |||
143 | */ | 145 | */ |
144 | if (!mode_cmd->handle) { | 146 | if (!mode_cmd->handle) { |
145 | if (!file_priv) { | 147 | if (!file_priv) { |
146 | struct exynos_drm_buf_entry *entry; | 148 | struct exynos_drm_gem_buf *buffer; |
147 | 149 | ||
148 | /* | 150 | /* |
149 | * in case that file_priv is NULL, it allocates | 151 | * in case that file_priv is NULL, it allocates |
150 | * only buffer and this buffer would be used | 152 | * only buffer and this buffer would be used |
151 | * for default framebuffer. | 153 | * for default framebuffer. |
152 | */ | 154 | */ |
153 | entry = exynos_drm_buf_create(dev, size); | 155 | buffer = exynos_drm_buf_create(dev, size); |
154 | if (IS_ERR(entry)) { | 156 | if (IS_ERR(buffer)) { |
155 | ret = PTR_ERR(entry); | 157 | ret = PTR_ERR(buffer); |
156 | goto err_buffer; | 158 | goto err_buffer; |
157 | } | 159 | } |
158 | 160 | ||
159 | exynos_fb->entry = entry; | 161 | exynos_fb->buffer = buffer; |
160 | 162 | ||
161 | DRM_LOG_KMS("default fb: paddr = 0x%lx, size = 0x%x\n", | 163 | DRM_LOG_KMS("default: dma_addr = 0x%lx, size = 0x%x\n", |
162 | (unsigned long)entry->paddr, size); | 164 | (unsigned long)buffer->dma_addr, size); |
163 | 165 | ||
164 | goto out; | 166 | goto out; |
165 | } else { | 167 | } else { |
166 | exynos_gem_obj = exynos_drm_gem_create(file_priv, dev, | 168 | exynos_gem_obj = exynos_drm_gem_create(dev, file_priv, |
167 | size, | 169 | &mode_cmd->handle, |
168 | &mode_cmd->handle); | 170 | size); |
169 | if (IS_ERR(exynos_gem_obj)) { | 171 | if (IS_ERR(exynos_gem_obj)) { |
170 | ret = PTR_ERR(exynos_gem_obj); | 172 | ret = PTR_ERR(exynos_gem_obj); |
171 | goto err_buffer; | 173 | goto err_buffer; |
@@ -189,10 +191,10 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, | |||
189 | * so that default framebuffer has no its own gem object, | 191 | * so that default framebuffer has no its own gem object, |
190 | * only its own buffer object. | 192 | * only its own buffer object. |
191 | */ | 193 | */ |
192 | exynos_fb->entry = exynos_gem_obj->entry; | 194 | exynos_fb->buffer = exynos_gem_obj->buffer; |
193 | 195 | ||
194 | DRM_LOG_KMS("paddr = 0x%lx, size = 0x%x, gem object = 0x%x\n", | 196 | DRM_LOG_KMS("dma_addr = 0x%lx, size = 0x%x, gem object = 0x%x\n", |
195 | (unsigned long)exynos_fb->entry->paddr, size, | 197 | (unsigned long)exynos_fb->buffer->dma_addr, size, |
196 | (unsigned int)&exynos_gem_obj->base); | 198 | (unsigned int)&exynos_gem_obj->base); |
197 | 199 | ||
198 | out: | 200 | out: |
@@ -220,26 +222,36 @@ struct drm_framebuffer *exynos_drm_fb_create(struct drm_device *dev, | |||
220 | return exynos_drm_fb_init(file_priv, dev, mode_cmd); | 222 | return exynos_drm_fb_init(file_priv, dev, mode_cmd); |
221 | } | 223 | } |
222 | 224 | ||
223 | struct exynos_drm_buf_entry *exynos_drm_fb_get_buf(struct drm_framebuffer *fb) | 225 | struct exynos_drm_gem_buf *exynos_drm_fb_get_buf(struct drm_framebuffer *fb) |
224 | { | 226 | { |
225 | struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); | 227 | struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); |
226 | struct exynos_drm_buf_entry *entry; | 228 | struct exynos_drm_gem_buf *buffer; |
227 | 229 | ||
228 | DRM_DEBUG_KMS("%s\n", __FILE__); | 230 | DRM_DEBUG_KMS("%s\n", __FILE__); |
229 | 231 | ||
230 | entry = exynos_fb->entry; | 232 | buffer = exynos_fb->buffer; |
231 | if (!entry) | 233 | if (!buffer) |
232 | return NULL; | 234 | return NULL; |
233 | 235 | ||
234 | DRM_DEBUG_KMS("vaddr = 0x%lx, paddr = 0x%lx\n", | 236 | DRM_DEBUG_KMS("vaddr = 0x%lx, dma_addr = 0x%lx\n", |
235 | (unsigned long)entry->vaddr, | 237 | (unsigned long)buffer->kvaddr, |
236 | (unsigned long)entry->paddr); | 238 | (unsigned long)buffer->dma_addr); |
237 | 239 | ||
238 | return entry; | 240 | return buffer; |
241 | } | ||
242 | |||
243 | static void exynos_drm_output_poll_changed(struct drm_device *dev) | ||
244 | { | ||
245 | struct exynos_drm_private *private = dev->dev_private; | ||
246 | struct drm_fb_helper *fb_helper = private->fb_helper; | ||
247 | |||
248 | if (fb_helper) | ||
249 | drm_fb_helper_hotplug_event(fb_helper); | ||
239 | } | 250 | } |
240 | 251 | ||
241 | static struct drm_mode_config_funcs exynos_drm_mode_config_funcs = { | 252 | static struct drm_mode_config_funcs exynos_drm_mode_config_funcs = { |
242 | .fb_create = exynos_drm_fb_create, | 253 | .fb_create = exynos_drm_fb_create, |
254 | .output_poll_changed = exynos_drm_output_poll_changed, | ||
243 | }; | 255 | }; |
244 | 256 | ||
245 | void exynos_drm_mode_config_init(struct drm_device *dev) | 257 | void exynos_drm_mode_config_init(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 1f4b3d1a7713..836f41008187 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include "exynos_drm_drv.h" | 34 | #include "exynos_drm_drv.h" |
35 | #include "exynos_drm_fb.h" | 35 | #include "exynos_drm_fb.h" |
36 | #include "exynos_drm_gem.h" | ||
36 | #include "exynos_drm_buf.h" | 37 | #include "exynos_drm_buf.h" |
37 | 38 | ||
38 | #define MAX_CONNECTOR 4 | 39 | #define MAX_CONNECTOR 4 |
@@ -85,15 +86,13 @@ static struct fb_ops exynos_drm_fb_ops = { | |||
85 | }; | 86 | }; |
86 | 87 | ||
87 | static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, | 88 | static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, |
88 | struct drm_framebuffer *fb, | 89 | struct drm_framebuffer *fb) |
89 | unsigned int fb_width, | ||
90 | unsigned int fb_height) | ||
91 | { | 90 | { |
92 | struct fb_info *fbi = helper->fbdev; | 91 | struct fb_info *fbi = helper->fbdev; |
93 | struct drm_device *dev = helper->dev; | 92 | struct drm_device *dev = helper->dev; |
94 | struct exynos_drm_fbdev *exynos_fb = to_exynos_fbdev(helper); | 93 | struct exynos_drm_fbdev *exynos_fb = to_exynos_fbdev(helper); |
95 | struct exynos_drm_buf_entry *entry; | 94 | struct exynos_drm_gem_buf *buffer; |
96 | unsigned int size = fb_width * fb_height * (fb->bits_per_pixel >> 3); | 95 | unsigned int size = fb->width * fb->height * (fb->bits_per_pixel >> 3); |
97 | unsigned long offset; | 96 | unsigned long offset; |
98 | 97 | ||
99 | DRM_DEBUG_KMS("%s\n", __FILE__); | 98 | DRM_DEBUG_KMS("%s\n", __FILE__); |
@@ -101,20 +100,20 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, | |||
101 | exynos_fb->fb = fb; | 100 | exynos_fb->fb = fb; |
102 | 101 | ||
103 | drm_fb_helper_fill_fix(fbi, fb->pitch, fb->depth); | 102 | drm_fb_helper_fill_fix(fbi, fb->pitch, fb->depth); |
104 | drm_fb_helper_fill_var(fbi, helper, fb_width, fb_height); | 103 | drm_fb_helper_fill_var(fbi, helper, fb->width, fb->height); |
105 | 104 | ||
106 | entry = exynos_drm_fb_get_buf(fb); | 105 | buffer = exynos_drm_fb_get_buf(fb); |
107 | if (!entry) { | 106 | if (!buffer) { |
108 | DRM_LOG_KMS("entry is null.\n"); | 107 | DRM_LOG_KMS("buffer is null.\n"); |
109 | return -EFAULT; | 108 | return -EFAULT; |
110 | } | 109 | } |
111 | 110 | ||
112 | offset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); | 111 | offset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); |
113 | offset += fbi->var.yoffset * fb->pitch; | 112 | offset += fbi->var.yoffset * fb->pitch; |
114 | 113 | ||
115 | dev->mode_config.fb_base = entry->paddr; | 114 | dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; |
116 | fbi->screen_base = entry->vaddr + offset; | 115 | fbi->screen_base = buffer->kvaddr + offset; |
117 | fbi->fix.smem_start = entry->paddr + offset; | 116 | fbi->fix.smem_start = (unsigned long)(buffer->dma_addr + offset); |
118 | fbi->screen_size = size; | 117 | fbi->screen_size = size; |
119 | fbi->fix.smem_len = size; | 118 | fbi->fix.smem_len = size; |
120 | 119 | ||
@@ -171,8 +170,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, | |||
171 | goto out; | 170 | goto out; |
172 | } | 171 | } |
173 | 172 | ||
174 | ret = exynos_drm_fbdev_update(helper, helper->fb, sizes->fb_width, | 173 | ret = exynos_drm_fbdev_update(helper, helper->fb); |
175 | sizes->fb_height); | ||
176 | if (ret < 0) | 174 | if (ret < 0) |
177 | fb_dealloc_cmap(&fbi->cmap); | 175 | fb_dealloc_cmap(&fbi->cmap); |
178 | 176 | ||
@@ -235,8 +233,7 @@ static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper, | |||
235 | } | 233 | } |
236 | 234 | ||
237 | helper->fb = exynos_fbdev->fb; | 235 | helper->fb = exynos_fbdev->fb; |
238 | return exynos_drm_fbdev_update(helper, helper->fb, sizes->fb_width, | 236 | return exynos_drm_fbdev_update(helper, helper->fb); |
239 | sizes->fb_height); | ||
240 | } | 237 | } |
241 | 238 | ||
242 | static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, | 239 | static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, |
@@ -405,6 +402,18 @@ int exynos_drm_fbdev_reinit(struct drm_device *dev) | |||
405 | fb_helper = private->fb_helper; | 402 | fb_helper = private->fb_helper; |
406 | 403 | ||
407 | if (fb_helper) { | 404 | if (fb_helper) { |
405 | struct list_head temp_list; | ||
406 | |||
407 | INIT_LIST_HEAD(&temp_list); | ||
408 | |||
409 | /* | ||
410 | * fb_helper is reintialized but kernel fb is reused | ||
411 | * so kernel_fb_list need to be backuped and restored | ||
412 | */ | ||
413 | if (!list_empty(&fb_helper->kernel_fb_list)) | ||
414 | list_replace_init(&fb_helper->kernel_fb_list, | ||
415 | &temp_list); | ||
416 | |||
408 | drm_fb_helper_fini(fb_helper); | 417 | drm_fb_helper_fini(fb_helper); |
409 | 418 | ||
410 | ret = drm_fb_helper_init(dev, fb_helper, | 419 | ret = drm_fb_helper_init(dev, fb_helper, |
@@ -414,6 +423,9 @@ int exynos_drm_fbdev_reinit(struct drm_device *dev) | |||
414 | return ret; | 423 | return ret; |
415 | } | 424 | } |
416 | 425 | ||
426 | if (!list_empty(&temp_list)) | ||
427 | list_replace(&temp_list, &fb_helper->kernel_fb_list); | ||
428 | |||
417 | ret = drm_fb_helper_single_add_all_connectors(fb_helper); | 429 | ret = drm_fb_helper_single_add_all_connectors(fb_helper); |
418 | if (ret < 0) { | 430 | if (ret < 0) { |
419 | DRM_ERROR("failed to add fb helper to connectors\n"); | 431 | DRM_ERROR("failed to add fb helper to connectors\n"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 4659c88cdd9b..db3b3d9e731d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -64,7 +64,7 @@ struct fimd_win_data { | |||
64 | unsigned int fb_width; | 64 | unsigned int fb_width; |
65 | unsigned int fb_height; | 65 | unsigned int fb_height; |
66 | unsigned int bpp; | 66 | unsigned int bpp; |
67 | dma_addr_t paddr; | 67 | dma_addr_t dma_addr; |
68 | void __iomem *vaddr; | 68 | void __iomem *vaddr; |
69 | unsigned int buf_offsize; | 69 | unsigned int buf_offsize; |
70 | unsigned int line_size; /* bytes */ | 70 | unsigned int line_size; /* bytes */ |
@@ -124,7 +124,7 @@ static int fimd_display_power_on(struct device *dev, int mode) | |||
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | static struct exynos_drm_display fimd_display = { | 127 | static struct exynos_drm_display_ops fimd_display_ops = { |
128 | .type = EXYNOS_DISPLAY_TYPE_LCD, | 128 | .type = EXYNOS_DISPLAY_TYPE_LCD, |
129 | .is_connected = fimd_display_is_connected, | 129 | .is_connected = fimd_display_is_connected, |
130 | .get_timing = fimd_get_timing, | 130 | .get_timing = fimd_get_timing, |
@@ -177,6 +177,40 @@ static void fimd_commit(struct device *dev) | |||
177 | writel(val, ctx->regs + VIDCON0); | 177 | writel(val, ctx->regs + VIDCON0); |
178 | } | 178 | } |
179 | 179 | ||
180 | static void fimd_disable(struct device *dev) | ||
181 | { | ||
182 | struct fimd_context *ctx = get_fimd_context(dev); | ||
183 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | ||
184 | struct drm_device *drm_dev = subdrv->drm_dev; | ||
185 | struct exynos_drm_manager *manager = &subdrv->manager; | ||
186 | u32 val; | ||
187 | |||
188 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
189 | |||
190 | /* fimd dma off */ | ||
191 | val = readl(ctx->regs + VIDCON0); | ||
192 | val &= ~(VIDCON0_ENVID | VIDCON0_ENVID_F); | ||
193 | writel(val, ctx->regs + VIDCON0); | ||
194 | |||
195 | /* | ||
196 | * if vblank is enabled status with dma off then | ||
197 | * it disables vsync interrupt. | ||
198 | */ | ||
199 | if (drm_dev->vblank_enabled[manager->pipe] && | ||
200 | atomic_read(&drm_dev->vblank_refcount[manager->pipe])) { | ||
201 | drm_vblank_put(drm_dev, manager->pipe); | ||
202 | |||
203 | /* | ||
204 | * if vblank_disable_allowed is 0 then disable | ||
205 | * vsync interrupt right now else the vsync interrupt | ||
206 | * would be disabled by drm timer once a current process | ||
207 | * gives up ownershop of vblank event. | ||
208 | */ | ||
209 | if (!drm_dev->vblank_disable_allowed) | ||
210 | drm_vblank_off(drm_dev, manager->pipe); | ||
211 | } | ||
212 | } | ||
213 | |||
180 | static int fimd_enable_vblank(struct device *dev) | 214 | static int fimd_enable_vblank(struct device *dev) |
181 | { | 215 | { |
182 | struct fimd_context *ctx = get_fimd_context(dev); | 216 | struct fimd_context *ctx = get_fimd_context(dev); |
@@ -220,6 +254,7 @@ static void fimd_disable_vblank(struct device *dev) | |||
220 | 254 | ||
221 | static struct exynos_drm_manager_ops fimd_manager_ops = { | 255 | static struct exynos_drm_manager_ops fimd_manager_ops = { |
222 | .commit = fimd_commit, | 256 | .commit = fimd_commit, |
257 | .disable = fimd_disable, | ||
223 | .enable_vblank = fimd_enable_vblank, | 258 | .enable_vblank = fimd_enable_vblank, |
224 | .disable_vblank = fimd_disable_vblank, | 259 | .disable_vblank = fimd_disable_vblank, |
225 | }; | 260 | }; |
@@ -251,7 +286,7 @@ static void fimd_win_mode_set(struct device *dev, | |||
251 | win_data->ovl_height = overlay->crtc_height; | 286 | win_data->ovl_height = overlay->crtc_height; |
252 | win_data->fb_width = overlay->fb_width; | 287 | win_data->fb_width = overlay->fb_width; |
253 | win_data->fb_height = overlay->fb_height; | 288 | win_data->fb_height = overlay->fb_height; |
254 | win_data->paddr = overlay->paddr + offset; | 289 | win_data->dma_addr = overlay->dma_addr + offset; |
255 | win_data->vaddr = overlay->vaddr + offset; | 290 | win_data->vaddr = overlay->vaddr + offset; |
256 | win_data->bpp = overlay->bpp; | 291 | win_data->bpp = overlay->bpp; |
257 | win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) * | 292 | win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) * |
@@ -263,7 +298,7 @@ static void fimd_win_mode_set(struct device *dev, | |||
263 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", | 298 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", |
264 | win_data->ovl_width, win_data->ovl_height); | 299 | win_data->ovl_width, win_data->ovl_height); |
265 | DRM_DEBUG_KMS("paddr = 0x%lx, vaddr = 0x%lx\n", | 300 | DRM_DEBUG_KMS("paddr = 0x%lx, vaddr = 0x%lx\n", |
266 | (unsigned long)win_data->paddr, | 301 | (unsigned long)win_data->dma_addr, |
267 | (unsigned long)win_data->vaddr); | 302 | (unsigned long)win_data->vaddr); |
268 | DRM_DEBUG_KMS("fb_width = %d, crtc_width = %d\n", | 303 | DRM_DEBUG_KMS("fb_width = %d, crtc_width = %d\n", |
269 | overlay->fb_width, overlay->crtc_width); | 304 | overlay->fb_width, overlay->crtc_width); |
@@ -376,16 +411,16 @@ static void fimd_win_commit(struct device *dev) | |||
376 | writel(val, ctx->regs + SHADOWCON); | 411 | writel(val, ctx->regs + SHADOWCON); |
377 | 412 | ||
378 | /* buffer start address */ | 413 | /* buffer start address */ |
379 | val = win_data->paddr; | 414 | val = (unsigned long)win_data->dma_addr; |
380 | writel(val, ctx->regs + VIDWx_BUF_START(win, 0)); | 415 | writel(val, ctx->regs + VIDWx_BUF_START(win, 0)); |
381 | 416 | ||
382 | /* buffer end address */ | 417 | /* buffer end address */ |
383 | size = win_data->fb_width * win_data->ovl_height * (win_data->bpp >> 3); | 418 | size = win_data->fb_width * win_data->ovl_height * (win_data->bpp >> 3); |
384 | val = win_data->paddr + size; | 419 | val = (unsigned long)(win_data->dma_addr + size); |
385 | writel(val, ctx->regs + VIDWx_BUF_END(win, 0)); | 420 | writel(val, ctx->regs + VIDWx_BUF_END(win, 0)); |
386 | 421 | ||
387 | DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", | 422 | DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", |
388 | (unsigned long)win_data->paddr, val, size); | 423 | (unsigned long)win_data->dma_addr, val, size); |
389 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", | 424 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", |
390 | win_data->ovl_width, win_data->ovl_height); | 425 | win_data->ovl_width, win_data->ovl_height); |
391 | 426 | ||
@@ -447,7 +482,6 @@ static void fimd_win_commit(struct device *dev) | |||
447 | static void fimd_win_disable(struct device *dev) | 482 | static void fimd_win_disable(struct device *dev) |
448 | { | 483 | { |
449 | struct fimd_context *ctx = get_fimd_context(dev); | 484 | struct fimd_context *ctx = get_fimd_context(dev); |
450 | struct fimd_win_data *win_data; | ||
451 | int win = ctx->default_win; | 485 | int win = ctx->default_win; |
452 | u32 val; | 486 | u32 val; |
453 | 487 | ||
@@ -456,8 +490,6 @@ static void fimd_win_disable(struct device *dev) | |||
456 | if (win < 0 || win > WINDOWS_NR) | 490 | if (win < 0 || win > WINDOWS_NR) |
457 | return; | 491 | return; |
458 | 492 | ||
459 | win_data = &ctx->win_data[win]; | ||
460 | |||
461 | /* protect windows */ | 493 | /* protect windows */ |
462 | val = readl(ctx->regs + SHADOWCON); | 494 | val = readl(ctx->regs + SHADOWCON); |
463 | val |= SHADOWCON_WINx_PROTECT(win); | 495 | val |= SHADOWCON_WINx_PROTECT(win); |
@@ -528,6 +560,16 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | |||
528 | /* VSYNC interrupt */ | 560 | /* VSYNC interrupt */ |
529 | writel(VIDINTCON1_INT_FRAME, ctx->regs + VIDINTCON1); | 561 | writel(VIDINTCON1_INT_FRAME, ctx->regs + VIDINTCON1); |
530 | 562 | ||
563 | /* | ||
564 | * in case that vblank_disable_allowed is 1, it could induce | ||
565 | * the problem that manager->pipe could be -1 because with | ||
566 | * disable callback, vsync interrupt isn't disabled and at this moment, | ||
567 | * vsync interrupt could occur. the vsync interrupt would be disabled | ||
568 | * by timer handler later. | ||
569 | */ | ||
570 | if (manager->pipe == -1) | ||
571 | return IRQ_HANDLED; | ||
572 | |||
531 | drm_handle_vblank(drm_dev, manager->pipe); | 573 | drm_handle_vblank(drm_dev, manager->pipe); |
532 | fimd_finish_pageflip(drm_dev, manager->pipe); | 574 | fimd_finish_pageflip(drm_dev, manager->pipe); |
533 | 575 | ||
@@ -548,13 +590,6 @@ static int fimd_subdrv_probe(struct drm_device *drm_dev, struct device *dev) | |||
548 | */ | 590 | */ |
549 | drm_dev->irq_enabled = 1; | 591 | drm_dev->irq_enabled = 1; |
550 | 592 | ||
551 | /* | ||
552 | * with vblank_disable_allowed = 1, vblank interrupt will be disabled | ||
553 | * by drm timer once a current process gives up ownership of | ||
554 | * vblank event.(drm_vblank_put function was called) | ||
555 | */ | ||
556 | drm_dev->vblank_disable_allowed = 1; | ||
557 | |||
558 | return 0; | 593 | return 0; |
559 | } | 594 | } |
560 | 595 | ||
@@ -731,7 +766,7 @@ static int __devinit fimd_probe(struct platform_device *pdev) | |||
731 | subdrv->manager.pipe = -1; | 766 | subdrv->manager.pipe = -1; |
732 | subdrv->manager.ops = &fimd_manager_ops; | 767 | subdrv->manager.ops = &fimd_manager_ops; |
733 | subdrv->manager.overlay_ops = &fimd_overlay_ops; | 768 | subdrv->manager.overlay_ops = &fimd_overlay_ops; |
734 | subdrv->manager.display = &fimd_display; | 769 | subdrv->manager.display_ops = &fimd_display_ops; |
735 | subdrv->manager.dev = dev; | 770 | subdrv->manager.dev = dev; |
736 | 771 | ||
737 | platform_set_drvdata(pdev, ctx); | 772 | platform_set_drvdata(pdev, ctx); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index a8e7a88906ed..aba0fe47f7ea 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
@@ -62,40 +62,28 @@ static unsigned int get_gem_mmap_offset(struct drm_gem_object *obj) | |||
62 | return (unsigned int)obj->map_list.hash.key << PAGE_SHIFT; | 62 | return (unsigned int)obj->map_list.hash.key << PAGE_SHIFT; |
63 | } | 63 | } |
64 | 64 | ||
65 | struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_file *file_priv, | 65 | static struct exynos_drm_gem_obj |
66 | struct drm_device *dev, unsigned int size, | 66 | *exynos_drm_gem_init(struct drm_device *drm_dev, |
67 | unsigned int *handle) | 67 | struct drm_file *file_priv, unsigned int *handle, |
68 | unsigned int size) | ||
68 | { | 69 | { |
69 | struct exynos_drm_gem_obj *exynos_gem_obj; | 70 | struct exynos_drm_gem_obj *exynos_gem_obj; |
70 | struct exynos_drm_buf_entry *entry; | ||
71 | struct drm_gem_object *obj; | 71 | struct drm_gem_object *obj; |
72 | int ret; | 72 | int ret; |
73 | 73 | ||
74 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
75 | |||
76 | size = roundup(size, PAGE_SIZE); | ||
77 | |||
78 | exynos_gem_obj = kzalloc(sizeof(*exynos_gem_obj), GFP_KERNEL); | 74 | exynos_gem_obj = kzalloc(sizeof(*exynos_gem_obj), GFP_KERNEL); |
79 | if (!exynos_gem_obj) { | 75 | if (!exynos_gem_obj) { |
80 | DRM_ERROR("failed to allocate exynos gem object.\n"); | 76 | DRM_ERROR("failed to allocate exynos gem object.\n"); |
81 | return ERR_PTR(-ENOMEM); | 77 | return ERR_PTR(-ENOMEM); |
82 | } | 78 | } |
83 | 79 | ||
84 | /* allocate the new buffer object and memory region. */ | ||
85 | entry = exynos_drm_buf_create(dev, size); | ||
86 | if (!entry) { | ||
87 | kfree(exynos_gem_obj); | ||
88 | return ERR_PTR(-ENOMEM); | ||
89 | } | ||
90 | |||
91 | exynos_gem_obj->entry = entry; | ||
92 | |||
93 | obj = &exynos_gem_obj->base; | 80 | obj = &exynos_gem_obj->base; |
94 | 81 | ||
95 | ret = drm_gem_object_init(dev, obj, size); | 82 | ret = drm_gem_object_init(drm_dev, obj, size); |
96 | if (ret < 0) { | 83 | if (ret < 0) { |
97 | DRM_ERROR("failed to initailize gem object.\n"); | 84 | DRM_ERROR("failed to initialize gem object.\n"); |
98 | goto err_obj_init; | 85 | ret = -EINVAL; |
86 | goto err_object_init; | ||
99 | } | 87 | } |
100 | 88 | ||
101 | DRM_DEBUG_KMS("created file object = 0x%x\n", (unsigned int)obj->filp); | 89 | DRM_DEBUG_KMS("created file object = 0x%x\n", (unsigned int)obj->filp); |
@@ -127,24 +115,50 @@ err_handle_create: | |||
127 | err_create_mmap_offset: | 115 | err_create_mmap_offset: |
128 | drm_gem_object_release(obj); | 116 | drm_gem_object_release(obj); |
129 | 117 | ||
130 | err_obj_init: | 118 | err_object_init: |
131 | exynos_drm_buf_destroy(dev, exynos_gem_obj->entry); | ||
132 | |||
133 | kfree(exynos_gem_obj); | 119 | kfree(exynos_gem_obj); |
134 | 120 | ||
135 | return ERR_PTR(ret); | 121 | return ERR_PTR(ret); |
136 | } | 122 | } |
137 | 123 | ||
124 | struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | ||
125 | struct drm_file *file_priv, | ||
126 | unsigned int *handle, unsigned long size) | ||
127 | { | ||
128 | |||
129 | struct exynos_drm_gem_obj *exynos_gem_obj = NULL; | ||
130 | struct exynos_drm_gem_buf *buffer; | ||
131 | |||
132 | size = roundup(size, PAGE_SIZE); | ||
133 | |||
134 | DRM_DEBUG_KMS("%s: size = 0x%lx\n", __FILE__, size); | ||
135 | |||
136 | buffer = exynos_drm_buf_create(dev, size); | ||
137 | if (IS_ERR(buffer)) { | ||
138 | return ERR_CAST(buffer); | ||
139 | } | ||
140 | |||
141 | exynos_gem_obj = exynos_drm_gem_init(dev, file_priv, handle, size); | ||
142 | if (IS_ERR(exynos_gem_obj)) { | ||
143 | exynos_drm_buf_destroy(dev, buffer); | ||
144 | return exynos_gem_obj; | ||
145 | } | ||
146 | |||
147 | exynos_gem_obj->buffer = buffer; | ||
148 | |||
149 | return exynos_gem_obj; | ||
150 | } | ||
151 | |||
138 | int exynos_drm_gem_create_ioctl(struct drm_device *dev, void *data, | 152 | int exynos_drm_gem_create_ioctl(struct drm_device *dev, void *data, |
139 | struct drm_file *file_priv) | 153 | struct drm_file *file_priv) |
140 | { | 154 | { |
141 | struct drm_exynos_gem_create *args = data; | 155 | struct drm_exynos_gem_create *args = data; |
142 | struct exynos_drm_gem_obj *exynos_gem_obj; | 156 | struct exynos_drm_gem_obj *exynos_gem_obj = NULL; |
143 | 157 | ||
144 | DRM_DEBUG_KMS("%s : size = 0x%x\n", __FILE__, args->size); | 158 | DRM_DEBUG_KMS("%s\n", __FILE__); |
145 | 159 | ||
146 | exynos_gem_obj = exynos_drm_gem_create(file_priv, dev, args->size, | 160 | exynos_gem_obj = exynos_drm_gem_create(dev, file_priv, |
147 | &args->handle); | 161 | &args->handle, args->size); |
148 | if (IS_ERR(exynos_gem_obj)) | 162 | if (IS_ERR(exynos_gem_obj)) |
149 | return PTR_ERR(exynos_gem_obj); | 163 | return PTR_ERR(exynos_gem_obj); |
150 | 164 | ||
@@ -175,7 +189,7 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp, | |||
175 | { | 189 | { |
176 | struct drm_gem_object *obj = filp->private_data; | 190 | struct drm_gem_object *obj = filp->private_data; |
177 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); | 191 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); |
178 | struct exynos_drm_buf_entry *entry; | 192 | struct exynos_drm_gem_buf *buffer; |
179 | unsigned long pfn, vm_size; | 193 | unsigned long pfn, vm_size; |
180 | 194 | ||
181 | DRM_DEBUG_KMS("%s\n", __FILE__); | 195 | DRM_DEBUG_KMS("%s\n", __FILE__); |
@@ -187,20 +201,20 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp, | |||
187 | 201 | ||
188 | vm_size = vma->vm_end - vma->vm_start; | 202 | vm_size = vma->vm_end - vma->vm_start; |
189 | /* | 203 | /* |
190 | * a entry contains information to physically continuous memory | 204 | * a buffer contains information to physically continuous memory |
191 | * allocated by user request or at framebuffer creation. | 205 | * allocated by user request or at framebuffer creation. |
192 | */ | 206 | */ |
193 | entry = exynos_gem_obj->entry; | 207 | buffer = exynos_gem_obj->buffer; |
194 | 208 | ||
195 | /* check if user-requested size is valid. */ | 209 | /* check if user-requested size is valid. */ |
196 | if (vm_size > entry->size) | 210 | if (vm_size > buffer->size) |
197 | return -EINVAL; | 211 | return -EINVAL; |
198 | 212 | ||
199 | /* | 213 | /* |
200 | * get page frame number to physical memory to be mapped | 214 | * get page frame number to physical memory to be mapped |
201 | * to user space. | 215 | * to user space. |
202 | */ | 216 | */ |
203 | pfn = exynos_gem_obj->entry->paddr >> PAGE_SHIFT; | 217 | pfn = ((unsigned long)exynos_gem_obj->buffer->dma_addr) >> PAGE_SHIFT; |
204 | 218 | ||
205 | DRM_DEBUG_KMS("pfn = 0x%lx\n", pfn); | 219 | DRM_DEBUG_KMS("pfn = 0x%lx\n", pfn); |
206 | 220 | ||
@@ -281,7 +295,7 @@ void exynos_drm_gem_free_object(struct drm_gem_object *gem_obj) | |||
281 | 295 | ||
282 | exynos_gem_obj = to_exynos_gem_obj(gem_obj); | 296 | exynos_gem_obj = to_exynos_gem_obj(gem_obj); |
283 | 297 | ||
284 | exynos_drm_buf_destroy(gem_obj->dev, exynos_gem_obj->entry); | 298 | exynos_drm_buf_destroy(gem_obj->dev, exynos_gem_obj->buffer); |
285 | 299 | ||
286 | kfree(exynos_gem_obj); | 300 | kfree(exynos_gem_obj); |
287 | } | 301 | } |
@@ -302,8 +316,8 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, | |||
302 | args->pitch = args->width * args->bpp >> 3; | 316 | args->pitch = args->width * args->bpp >> 3; |
303 | args->size = args->pitch * args->height; | 317 | args->size = args->pitch * args->height; |
304 | 318 | ||
305 | exynos_gem_obj = exynos_drm_gem_create(file_priv, dev, args->size, | 319 | exynos_gem_obj = exynos_drm_gem_create(dev, file_priv, &args->handle, |
306 | &args->handle); | 320 | args->size); |
307 | if (IS_ERR(exynos_gem_obj)) | 321 | if (IS_ERR(exynos_gem_obj)) |
308 | return PTR_ERR(exynos_gem_obj); | 322 | return PTR_ERR(exynos_gem_obj); |
309 | 323 | ||
@@ -360,7 +374,8 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
360 | 374 | ||
361 | mutex_lock(&dev->struct_mutex); | 375 | mutex_lock(&dev->struct_mutex); |
362 | 376 | ||
363 | pfn = (exynos_gem_obj->entry->paddr >> PAGE_SHIFT) + page_offset; | 377 | pfn = (((unsigned long)exynos_gem_obj->buffer->dma_addr) >> |
378 | PAGE_SHIFT) + page_offset; | ||
364 | 379 | ||
365 | ret = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, pfn); | 380 | ret = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, pfn); |
366 | 381 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index e5fc0148277b..ef8797334e6d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h | |||
@@ -30,13 +30,29 @@ | |||
30 | struct exynos_drm_gem_obj, base) | 30 | struct exynos_drm_gem_obj, base) |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * exynos drm gem buffer structure. | ||
34 | * | ||
35 | * @kvaddr: kernel virtual address to allocated memory region. | ||
36 | * @dma_addr: bus address(accessed by dma) to allocated memory region. | ||
37 | * - this address could be physical address without IOMMU and | ||
38 | * device address with IOMMU. | ||
39 | * @size: size of allocated memory region. | ||
40 | */ | ||
41 | struct exynos_drm_gem_buf { | ||
42 | void __iomem *kvaddr; | ||
43 | dma_addr_t dma_addr; | ||
44 | unsigned long size; | ||
45 | }; | ||
46 | |||
47 | /* | ||
33 | * exynos drm buffer structure. | 48 | * exynos drm buffer structure. |
34 | * | 49 | * |
35 | * @base: a gem object. | 50 | * @base: a gem object. |
36 | * - a new handle to this gem object would be created | 51 | * - a new handle to this gem object would be created |
37 | * by drm_gem_handle_create(). | 52 | * by drm_gem_handle_create(). |
38 | * @entry: pointer to exynos drm buffer entry object. | 53 | * @buffer: a pointer to exynos_drm_gem_buffer object. |
39 | * - containing the information to physically | 54 | * - contain the information to memory region allocated |
55 | * by user request or at framebuffer creation. | ||
40 | * continuous memory region allocated by user request | 56 | * continuous memory region allocated by user request |
41 | * or at framebuffer creation. | 57 | * or at framebuffer creation. |
42 | * | 58 | * |
@@ -45,13 +61,13 @@ | |||
45 | */ | 61 | */ |
46 | struct exynos_drm_gem_obj { | 62 | struct exynos_drm_gem_obj { |
47 | struct drm_gem_object base; | 63 | struct drm_gem_object base; |
48 | struct exynos_drm_buf_entry *entry; | 64 | struct exynos_drm_gem_buf *buffer; |
49 | }; | 65 | }; |
50 | 66 | ||
51 | /* create a new buffer and get a new gem handle. */ | 67 | /* create a new buffer and get a new gem handle. */ |
52 | struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_file *file_priv, | 68 | struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, |
53 | struct drm_device *dev, unsigned int size, | 69 | struct drm_file *file_priv, |
54 | unsigned int *handle); | 70 | unsigned int *handle, unsigned long size); |
55 | 71 | ||
56 | /* | 72 | /* |
57 | * request gem object creation and buffer allocation as the size | 73 | * request gem object creation and buffer allocation as the size |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 2f91acccb7db..8873c6e6fb96 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1827,7 +1827,8 @@ static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip) | |||
1827 | } | 1827 | } |
1828 | 1828 | ||
1829 | /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */ | 1829 | /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */ |
1830 | REG_WRITE(ah, AR_WA, ah->WARegVal & ~AR_WA_D3_L1_DISABLE); | 1830 | if (AR_SREV_9300_20_OR_LATER(ah)) |
1831 | REG_WRITE(ah, AR_WA, ah->WARegVal & ~AR_WA_D3_L1_DISABLE); | ||
1831 | } | 1832 | } |
1832 | 1833 | ||
1833 | /* | 1834 | /* |
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c index 26564094e33b..aec9311b108c 100644 --- a/drivers/staging/iio/industrialio-core.c +++ b/drivers/staging/iio/industrialio-core.c | |||
@@ -242,25 +242,24 @@ static const struct file_operations iio_event_chrdev_fileops = { | |||
242 | 242 | ||
243 | static int iio_event_getfd(struct iio_dev *indio_dev) | 243 | static int iio_event_getfd(struct iio_dev *indio_dev) |
244 | { | 244 | { |
245 | struct iio_event_interface *ev_int = indio_dev->event_interface; | ||
245 | int fd; | 246 | int fd; |
246 | 247 | ||
247 | if (indio_dev->event_interface == NULL) | 248 | if (ev_int == NULL) |
248 | return -ENODEV; | 249 | return -ENODEV; |
249 | 250 | ||
250 | mutex_lock(&indio_dev->event_interface->event_list_lock); | 251 | mutex_lock(&ev_int->event_list_lock); |
251 | if (test_and_set_bit(IIO_BUSY_BIT_POS, | 252 | if (test_and_set_bit(IIO_BUSY_BIT_POS, &ev_int->flags)) { |
252 | &indio_dev->event_interface->flags)) { | 253 | mutex_unlock(&ev_int->event_list_lock); |
253 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | ||
254 | return -EBUSY; | 254 | return -EBUSY; |
255 | } | 255 | } |
256 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | 256 | mutex_unlock(&ev_int->event_list_lock); |
257 | fd = anon_inode_getfd("iio:event", | 257 | fd = anon_inode_getfd("iio:event", |
258 | &iio_event_chrdev_fileops, | 258 | &iio_event_chrdev_fileops, ev_int, O_RDONLY); |
259 | indio_dev->event_interface, O_RDONLY); | ||
260 | if (fd < 0) { | 259 | if (fd < 0) { |
261 | mutex_lock(&indio_dev->event_interface->event_list_lock); | 260 | mutex_lock(&ev_int->event_list_lock); |
262 | clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); | 261 | clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); |
263 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | 262 | mutex_unlock(&ev_int->event_list_lock); |
264 | } | 263 | } |
265 | return fd; | 264 | return fd; |
266 | } | 265 | } |
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 55f91d9ab00b..29577bf1f559 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
@@ -116,6 +116,7 @@ | |||
116 | /* Clock registers available only on Version 2 */ | 116 | /* Clock registers available only on Version 2 */ |
117 | #define LCD_CLK_ENABLE_REG 0x6c | 117 | #define LCD_CLK_ENABLE_REG 0x6c |
118 | #define LCD_CLK_RESET_REG 0x70 | 118 | #define LCD_CLK_RESET_REG 0x70 |
119 | #define LCD_CLK_MAIN_RESET BIT(3) | ||
119 | 120 | ||
120 | #define LCD_NUM_BUFFERS 2 | 121 | #define LCD_NUM_BUFFERS 2 |
121 | 122 | ||
@@ -244,6 +245,10 @@ static inline void lcd_enable_raster(void) | |||
244 | { | 245 | { |
245 | u32 reg; | 246 | u32 reg; |
246 | 247 | ||
248 | /* Bring LCDC out of reset */ | ||
249 | if (lcd_revision == LCD_VERSION_2) | ||
250 | lcdc_write(0, LCD_CLK_RESET_REG); | ||
251 | |||
247 | reg = lcdc_read(LCD_RASTER_CTRL_REG); | 252 | reg = lcdc_read(LCD_RASTER_CTRL_REG); |
248 | if (!(reg & LCD_RASTER_ENABLE)) | 253 | if (!(reg & LCD_RASTER_ENABLE)) |
249 | lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | 254 | lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); |
@@ -257,6 +262,10 @@ static inline void lcd_disable_raster(void) | |||
257 | reg = lcdc_read(LCD_RASTER_CTRL_REG); | 262 | reg = lcdc_read(LCD_RASTER_CTRL_REG); |
258 | if (reg & LCD_RASTER_ENABLE) | 263 | if (reg & LCD_RASTER_ENABLE) |
259 | lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | 264 | lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); |
265 | |||
266 | if (lcd_revision == LCD_VERSION_2) | ||
267 | /* Write 1 to reset LCDC */ | ||
268 | lcdc_write(LCD_CLK_MAIN_RESET, LCD_CLK_RESET_REG); | ||
260 | } | 269 | } |
261 | 270 | ||
262 | static void lcd_blit(int load_mode, struct da8xx_fb_par *par) | 271 | static void lcd_blit(int load_mode, struct da8xx_fb_par *par) |
@@ -584,8 +593,12 @@ static void lcd_reset(struct da8xx_fb_par *par) | |||
584 | lcdc_write(0, LCD_DMA_CTRL_REG); | 593 | lcdc_write(0, LCD_DMA_CTRL_REG); |
585 | lcdc_write(0, LCD_RASTER_CTRL_REG); | 594 | lcdc_write(0, LCD_RASTER_CTRL_REG); |
586 | 595 | ||
587 | if (lcd_revision == LCD_VERSION_2) | 596 | if (lcd_revision == LCD_VERSION_2) { |
588 | lcdc_write(0, LCD_INT_ENABLE_SET_REG); | 597 | lcdc_write(0, LCD_INT_ENABLE_SET_REG); |
598 | /* Write 1 to reset */ | ||
599 | lcdc_write(LCD_CLK_MAIN_RESET, LCD_CLK_RESET_REG); | ||
600 | lcdc_write(0, LCD_CLK_RESET_REG); | ||
601 | } | ||
589 | } | 602 | } |
590 | 603 | ||
591 | static void lcd_calc_clk_divider(struct da8xx_fb_par *par) | 604 | static void lcd_calc_clk_divider(struct da8xx_fb_par *par) |
diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c index 0ccd7adf47bb..6f61e781f15a 100644 --- a/drivers/video/omap/dispc.c +++ b/drivers/video/omap/dispc.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/module.h> | ||
22 | #include <linux/dma-mapping.h> | 23 | #include <linux/dma-mapping.h> |
23 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
24 | #include <linux/vmalloc.h> | 25 | #include <linux/vmalloc.h> |
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 3532782551cb..5c81533eacaa 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -1720,12 +1720,11 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane, | |||
1720 | const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); | 1720 | const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); |
1721 | unsigned long fclk = 0; | 1721 | unsigned long fclk = 0; |
1722 | 1722 | ||
1723 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) { | 1723 | if (width == out_width && height == out_height) |
1724 | if (width != out_width || height != out_height) | 1724 | return 0; |
1725 | return -EINVAL; | 1725 | |
1726 | else | 1726 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) |
1727 | return 0; | 1727 | return -EINVAL; |
1728 | } | ||
1729 | 1728 | ||
1730 | if (out_width < width / maxdownscale || | 1729 | if (out_width < width / maxdownscale || |
1731 | out_width > width * 8) | 1730 | out_width > width * 8) |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 3262f0f1fa35..c56378c555b0 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -269,7 +269,7 @@ static void update_hdmi_timings(struct hdmi_config *cfg, | |||
269 | unsigned long hdmi_get_pixel_clock(void) | 269 | unsigned long hdmi_get_pixel_clock(void) |
270 | { | 270 | { |
271 | /* HDMI Pixel Clock in Mhz */ | 271 | /* HDMI Pixel Clock in Mhz */ |
272 | return hdmi.ip_data.cfg.timings.timings.pixel_clock * 10000; | 272 | return hdmi.ip_data.cfg.timings.timings.pixel_clock * 1000; |
273 | } | 273 | } |
274 | 274 | ||
275 | static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, | 275 | static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, |
diff --git a/drivers/video/via/share.h b/drivers/video/via/share.h index 69d882cbe709..c01c1c162726 100644 --- a/drivers/video/via/share.h +++ b/drivers/video/via/share.h | |||
@@ -559,8 +559,8 @@ | |||
559 | #define M1200X720_R60_VSP POSITIVE | 559 | #define M1200X720_R60_VSP POSITIVE |
560 | 560 | ||
561 | /* 1200x900@60 Sync Polarity (DCON) */ | 561 | /* 1200x900@60 Sync Polarity (DCON) */ |
562 | #define M1200X900_R60_HSP NEGATIVE | 562 | #define M1200X900_R60_HSP POSITIVE |
563 | #define M1200X900_R60_VSP NEGATIVE | 563 | #define M1200X900_R60_VSP POSITIVE |
564 | 564 | ||
565 | /* 1280x600@60 Sync Polarity (GTF Mode) */ | 565 | /* 1280x600@60 Sync Polarity (GTF Mode) */ |
566 | #define M1280x600_R60_HSP NEGATIVE | 566 | #define M1280x600_R60_HSP NEGATIVE |
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 2bd620f0d796..57bbf9078ac8 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c | |||
@@ -167,6 +167,7 @@ int pstore_register(struct pstore_info *psi) | |||
167 | } | 167 | } |
168 | 168 | ||
169 | psinfo = psi; | 169 | psinfo = psi; |
170 | mutex_init(&psinfo->read_mutex); | ||
170 | spin_unlock(&pstore_lock); | 171 | spin_unlock(&pstore_lock); |
171 | 172 | ||
172 | if (owner && !try_module_get(owner)) { | 173 | if (owner && !try_module_get(owner)) { |
@@ -195,30 +196,32 @@ EXPORT_SYMBOL_GPL(pstore_register); | |||
195 | void pstore_get_records(int quiet) | 196 | void pstore_get_records(int quiet) |
196 | { | 197 | { |
197 | struct pstore_info *psi = psinfo; | 198 | struct pstore_info *psi = psinfo; |
199 | char *buf = NULL; | ||
198 | ssize_t size; | 200 | ssize_t size; |
199 | u64 id; | 201 | u64 id; |
200 | enum pstore_type_id type; | 202 | enum pstore_type_id type; |
201 | struct timespec time; | 203 | struct timespec time; |
202 | int failed = 0, rc; | 204 | int failed = 0, rc; |
203 | unsigned long flags; | ||
204 | 205 | ||
205 | if (!psi) | 206 | if (!psi) |
206 | return; | 207 | return; |
207 | 208 | ||
208 | spin_lock_irqsave(&psinfo->buf_lock, flags); | 209 | mutex_lock(&psi->read_mutex); |
209 | rc = psi->open(psi); | 210 | rc = psi->open(psi); |
210 | if (rc) | 211 | if (rc) |
211 | goto out; | 212 | goto out; |
212 | 213 | ||
213 | while ((size = psi->read(&id, &type, &time, psi)) > 0) { | 214 | while ((size = psi->read(&id, &type, &time, &buf, psi)) > 0) { |
214 | rc = pstore_mkfile(type, psi->name, id, psi->buf, (size_t)size, | 215 | rc = pstore_mkfile(type, psi->name, id, buf, (size_t)size, |
215 | time, psi); | 216 | time, psi); |
217 | kfree(buf); | ||
218 | buf = NULL; | ||
216 | if (rc && (rc != -EEXIST || !quiet)) | 219 | if (rc && (rc != -EEXIST || !quiet)) |
217 | failed++; | 220 | failed++; |
218 | } | 221 | } |
219 | psi->close(psi); | 222 | psi->close(psi); |
220 | out: | 223 | out: |
221 | spin_unlock_irqrestore(&psinfo->buf_lock, flags); | 224 | mutex_unlock(&psi->read_mutex); |
222 | 225 | ||
223 | if (failed) | 226 | if (failed) |
224 | printk(KERN_WARNING "pstore: failed to load %d record(s) from '%s'\n", | 227 | printk(KERN_WARNING "pstore: failed to load %d record(s) from '%s'\n", |
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index 1d161cb3aca5..12050434d57a 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h | |||
@@ -32,17 +32,16 @@ | |||
32 | /** | 32 | /** |
33 | * User-desired buffer creation information structure. | 33 | * User-desired buffer creation information structure. |
34 | * | 34 | * |
35 | * @size: requested size for the object. | 35 | * @size: user-desired memory allocation size. |
36 | * - this size value would be page-aligned internally. | 36 | * - this size value would be page-aligned internally. |
37 | * @flags: user request for setting memory type or cache attributes. | 37 | * @flags: user request for setting memory type or cache attributes. |
38 | * @handle: returned handle for the object. | 38 | * @handle: returned a handle to created gem object. |
39 | * @pad: just padding to be 64-bit aligned. | 39 | * - this handle will be set by gem module of kernel side. |
40 | */ | 40 | */ |
41 | struct drm_exynos_gem_create { | 41 | struct drm_exynos_gem_create { |
42 | unsigned int size; | 42 | uint64_t size; |
43 | unsigned int flags; | 43 | unsigned int flags; |
44 | unsigned int handle; | 44 | unsigned int handle; |
45 | unsigned int pad; | ||
46 | }; | 45 | }; |
47 | 46 | ||
48 | /** | 47 | /** |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 139c4db55f17..c86c940d1de3 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -156,6 +156,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc, | |||
156 | * @mult: cycle to nanosecond multiplier | 156 | * @mult: cycle to nanosecond multiplier |
157 | * @shift: cycle to nanosecond divisor (power of two) | 157 | * @shift: cycle to nanosecond divisor (power of two) |
158 | * @max_idle_ns: max idle time permitted by the clocksource (nsecs) | 158 | * @max_idle_ns: max idle time permitted by the clocksource (nsecs) |
159 | * @maxadj maximum adjustment value to mult (~11%) | ||
159 | * @flags: flags describing special properties | 160 | * @flags: flags describing special properties |
160 | * @archdata: arch-specific data | 161 | * @archdata: arch-specific data |
161 | * @suspend: suspend function for the clocksource, if necessary | 162 | * @suspend: suspend function for the clocksource, if necessary |
@@ -172,7 +173,7 @@ struct clocksource { | |||
172 | u32 mult; | 173 | u32 mult; |
173 | u32 shift; | 174 | u32 shift; |
174 | u64 max_idle_ns; | 175 | u64 max_idle_ns; |
175 | 176 | u32 maxadj; | |
176 | #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA | 177 | #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA |
177 | struct arch_clocksource_data archdata; | 178 | struct arch_clocksource_data archdata; |
178 | #endif | 179 | #endif |
diff --git a/include/linux/pstore.h b/include/linux/pstore.h index ea567321ae3c..2ca8cde5459d 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h | |||
@@ -35,10 +35,12 @@ struct pstore_info { | |||
35 | spinlock_t buf_lock; /* serialize access to 'buf' */ | 35 | spinlock_t buf_lock; /* serialize access to 'buf' */ |
36 | char *buf; | 36 | char *buf; |
37 | size_t bufsize; | 37 | size_t bufsize; |
38 | struct mutex read_mutex; /* serialize open/read/close */ | ||
38 | int (*open)(struct pstore_info *psi); | 39 | int (*open)(struct pstore_info *psi); |
39 | int (*close)(struct pstore_info *psi); | 40 | int (*close)(struct pstore_info *psi); |
40 | ssize_t (*read)(u64 *id, enum pstore_type_id *type, | 41 | ssize_t (*read)(u64 *id, enum pstore_type_id *type, |
41 | struct timespec *time, struct pstore_info *psi); | 42 | struct timespec *time, char **buf, |
43 | struct pstore_info *psi); | ||
42 | int (*write)(enum pstore_type_id type, u64 *id, | 44 | int (*write)(enum pstore_type_id type, u64 *id, |
43 | unsigned int part, size_t size, struct pstore_info *psi); | 45 | unsigned int part, size_t size, struct pstore_info *psi); |
44 | int (*erase)(enum pstore_type_id type, u64 id, | 46 | int (*erase)(enum pstore_type_id type, u64 id, |
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 5e828a2ca8e6..213c0351dad8 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c | |||
@@ -153,6 +153,13 @@ static void freezer_destroy(struct cgroup_subsys *ss, | |||
153 | kfree(cgroup_freezer(cgroup)); | 153 | kfree(cgroup_freezer(cgroup)); |
154 | } | 154 | } |
155 | 155 | ||
156 | /* task is frozen or will freeze immediately when next it gets woken */ | ||
157 | static bool is_task_frozen_enough(struct task_struct *task) | ||
158 | { | ||
159 | return frozen(task) || | ||
160 | (task_is_stopped_or_traced(task) && freezing(task)); | ||
161 | } | ||
162 | |||
156 | /* | 163 | /* |
157 | * The call to cgroup_lock() in the freezer.state write method prevents | 164 | * The call to cgroup_lock() in the freezer.state write method prevents |
158 | * a write to that file racing against an attach, and hence the | 165 | * a write to that file racing against an attach, and hence the |
@@ -231,7 +238,7 @@ static void update_if_frozen(struct cgroup *cgroup, | |||
231 | cgroup_iter_start(cgroup, &it); | 238 | cgroup_iter_start(cgroup, &it); |
232 | while ((task = cgroup_iter_next(cgroup, &it))) { | 239 | while ((task = cgroup_iter_next(cgroup, &it))) { |
233 | ntotal++; | 240 | ntotal++; |
234 | if (frozen(task)) | 241 | if (is_task_frozen_enough(task)) |
235 | nfrozen++; | 242 | nfrozen++; |
236 | } | 243 | } |
237 | 244 | ||
@@ -284,7 +291,7 @@ static int try_to_freeze_cgroup(struct cgroup *cgroup, struct freezer *freezer) | |||
284 | while ((task = cgroup_iter_next(cgroup, &it))) { | 291 | while ((task = cgroup_iter_next(cgroup, &it))) { |
285 | if (!freeze_task(task, true)) | 292 | if (!freeze_task(task, true)) |
286 | continue; | 293 | continue; |
287 | if (frozen(task)) | 294 | if (is_task_frozen_enough(task)) |
288 | continue; | 295 | continue; |
289 | if (!freezing(task) && !freezer_should_skip(task)) | 296 | if (!freezing(task) && !freezer_should_skip(task)) |
290 | num_cant_freeze_now++; | 297 | num_cant_freeze_now++; |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 422e567eecf6..ae34bf51682b 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -885,10 +885,13 @@ static void __remove_hrtimer(struct hrtimer *timer, | |||
885 | struct hrtimer_clock_base *base, | 885 | struct hrtimer_clock_base *base, |
886 | unsigned long newstate, int reprogram) | 886 | unsigned long newstate, int reprogram) |
887 | { | 887 | { |
888 | struct timerqueue_node *next_timer; | ||
888 | if (!(timer->state & HRTIMER_STATE_ENQUEUED)) | 889 | if (!(timer->state & HRTIMER_STATE_ENQUEUED)) |
889 | goto out; | 890 | goto out; |
890 | 891 | ||
891 | if (&timer->node == timerqueue_getnext(&base->active)) { | 892 | next_timer = timerqueue_getnext(&base->active); |
893 | timerqueue_del(&base->active, &timer->node); | ||
894 | if (&timer->node == next_timer) { | ||
892 | #ifdef CONFIG_HIGH_RES_TIMERS | 895 | #ifdef CONFIG_HIGH_RES_TIMERS |
893 | /* Reprogram the clock event device. if enabled */ | 896 | /* Reprogram the clock event device. if enabled */ |
894 | if (reprogram && hrtimer_hres_active()) { | 897 | if (reprogram && hrtimer_hres_active()) { |
@@ -901,7 +904,6 @@ static void __remove_hrtimer(struct hrtimer *timer, | |||
901 | } | 904 | } |
902 | #endif | 905 | #endif |
903 | } | 906 | } |
904 | timerqueue_del(&base->active, &timer->node); | ||
905 | if (!timerqueue_getnext(&base->active)) | 907 | if (!timerqueue_getnext(&base->active)) |
906 | base->cpu_base->active_bases &= ~(1 << base->index); | 908 | base->cpu_base->active_bases &= ~(1 << base->index); |
907 | out: | 909 | out: |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 67ce837ae52c..0e2b179bc7b3 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -1596,7 +1596,7 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler, | |||
1596 | return -ENOMEM; | 1596 | return -ENOMEM; |
1597 | 1597 | ||
1598 | action->handler = handler; | 1598 | action->handler = handler; |
1599 | action->flags = IRQF_PERCPU; | 1599 | action->flags = IRQF_PERCPU | IRQF_NO_SUSPEND; |
1600 | action->name = devname; | 1600 | action->name = devname; |
1601 | action->percpu_dev_id = dev_id; | 1601 | action->percpu_dev_id = dev_id; |
1602 | 1602 | ||
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index b5f4742693c0..dc813a948be2 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c | |||
@@ -84,7 +84,9 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force) | |||
84 | */ | 84 | */ |
85 | action = desc->action; | 85 | action = desc->action; |
86 | if (!action || !(action->flags & IRQF_SHARED) || | 86 | if (!action || !(action->flags & IRQF_SHARED) || |
87 | (action->flags & __IRQF_TIMER) || !action->next) | 87 | (action->flags & __IRQF_TIMER) || |
88 | (action->handler(irq, action->dev_id) == IRQ_HANDLED) || | ||
89 | !action->next) | ||
88 | goto out; | 90 | goto out; |
89 | 91 | ||
90 | /* Already running on another processor */ | 92 | /* Already running on another processor */ |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index cf52fda2e096..cfc65e1eb9fb 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -492,6 +492,22 @@ void clocksource_touch_watchdog(void) | |||
492 | } | 492 | } |
493 | 493 | ||
494 | /** | 494 | /** |
495 | * clocksource_max_adjustment- Returns max adjustment amount | ||
496 | * @cs: Pointer to clocksource | ||
497 | * | ||
498 | */ | ||
499 | static u32 clocksource_max_adjustment(struct clocksource *cs) | ||
500 | { | ||
501 | u64 ret; | ||
502 | /* | ||
503 | * We won't try to correct for more then 11% adjustments (110,000 ppm), | ||
504 | */ | ||
505 | ret = (u64)cs->mult * 11; | ||
506 | do_div(ret,100); | ||
507 | return (u32)ret; | ||
508 | } | ||
509 | |||
510 | /** | ||
495 | * clocksource_max_deferment - Returns max time the clocksource can be deferred | 511 | * clocksource_max_deferment - Returns max time the clocksource can be deferred |
496 | * @cs: Pointer to clocksource | 512 | * @cs: Pointer to clocksource |
497 | * | 513 | * |
@@ -503,25 +519,28 @@ static u64 clocksource_max_deferment(struct clocksource *cs) | |||
503 | /* | 519 | /* |
504 | * Calculate the maximum number of cycles that we can pass to the | 520 | * Calculate the maximum number of cycles that we can pass to the |
505 | * cyc2ns function without overflowing a 64-bit signed result. The | 521 | * cyc2ns function without overflowing a 64-bit signed result. The |
506 | * maximum number of cycles is equal to ULLONG_MAX/cs->mult which | 522 | * maximum number of cycles is equal to ULLONG_MAX/(cs->mult+cs->maxadj) |
507 | * is equivalent to the below. | 523 | * which is equivalent to the below. |
508 | * max_cycles < (2^63)/cs->mult | 524 | * max_cycles < (2^63)/(cs->mult + cs->maxadj) |
509 | * max_cycles < 2^(log2((2^63)/cs->mult)) | 525 | * max_cycles < 2^(log2((2^63)/(cs->mult + cs->maxadj))) |
510 | * max_cycles < 2^(log2(2^63) - log2(cs->mult)) | 526 | * max_cycles < 2^(log2(2^63) - log2(cs->mult + cs->maxadj)) |
511 | * max_cycles < 2^(63 - log2(cs->mult)) | 527 | * max_cycles < 2^(63 - log2(cs->mult + cs->maxadj)) |
512 | * max_cycles < 1 << (63 - log2(cs->mult)) | 528 | * max_cycles < 1 << (63 - log2(cs->mult + cs->maxadj)) |
513 | * Please note that we add 1 to the result of the log2 to account for | 529 | * Please note that we add 1 to the result of the log2 to account for |
514 | * any rounding errors, ensure the above inequality is satisfied and | 530 | * any rounding errors, ensure the above inequality is satisfied and |
515 | * no overflow will occur. | 531 | * no overflow will occur. |
516 | */ | 532 | */ |
517 | max_cycles = 1ULL << (63 - (ilog2(cs->mult) + 1)); | 533 | max_cycles = 1ULL << (63 - (ilog2(cs->mult + cs->maxadj) + 1)); |
518 | 534 | ||
519 | /* | 535 | /* |
520 | * The actual maximum number of cycles we can defer the clocksource is | 536 | * The actual maximum number of cycles we can defer the clocksource is |
521 | * determined by the minimum of max_cycles and cs->mask. | 537 | * determined by the minimum of max_cycles and cs->mask. |
538 | * Note: Here we subtract the maxadj to make sure we don't sleep for | ||
539 | * too long if there's a large negative adjustment. | ||
522 | */ | 540 | */ |
523 | max_cycles = min_t(u64, max_cycles, (u64) cs->mask); | 541 | max_cycles = min_t(u64, max_cycles, (u64) cs->mask); |
524 | max_nsecs = clocksource_cyc2ns(max_cycles, cs->mult, cs->shift); | 542 | max_nsecs = clocksource_cyc2ns(max_cycles, cs->mult - cs->maxadj, |
543 | cs->shift); | ||
525 | 544 | ||
526 | /* | 545 | /* |
527 | * To ensure that the clocksource does not wrap whilst we are idle, | 546 | * To ensure that the clocksource does not wrap whilst we are idle, |
@@ -640,7 +659,6 @@ static void clocksource_enqueue(struct clocksource *cs) | |||
640 | void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq) | 659 | void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq) |
641 | { | 660 | { |
642 | u64 sec; | 661 | u64 sec; |
643 | |||
644 | /* | 662 | /* |
645 | * Calc the maximum number of seconds which we can run before | 663 | * Calc the maximum number of seconds which we can run before |
646 | * wrapping around. For clocksources which have a mask > 32bit | 664 | * wrapping around. For clocksources which have a mask > 32bit |
@@ -661,6 +679,20 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq) | |||
661 | 679 | ||
662 | clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, | 680 | clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, |
663 | NSEC_PER_SEC / scale, sec * scale); | 681 | NSEC_PER_SEC / scale, sec * scale); |
682 | |||
683 | /* | ||
684 | * for clocksources that have large mults, to avoid overflow. | ||
685 | * Since mult may be adjusted by ntp, add an safety extra margin | ||
686 | * | ||
687 | */ | ||
688 | cs->maxadj = clocksource_max_adjustment(cs); | ||
689 | while ((cs->mult + cs->maxadj < cs->mult) | ||
690 | || (cs->mult - cs->maxadj > cs->mult)) { | ||
691 | cs->mult >>= 1; | ||
692 | cs->shift--; | ||
693 | cs->maxadj = clocksource_max_adjustment(cs); | ||
694 | } | ||
695 | |||
664 | cs->max_idle_ns = clocksource_max_deferment(cs); | 696 | cs->max_idle_ns = clocksource_max_deferment(cs); |
665 | } | 697 | } |
666 | EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale); | 698 | EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale); |
@@ -701,6 +733,12 @@ EXPORT_SYMBOL_GPL(__clocksource_register_scale); | |||
701 | */ | 733 | */ |
702 | int clocksource_register(struct clocksource *cs) | 734 | int clocksource_register(struct clocksource *cs) |
703 | { | 735 | { |
736 | /* calculate max adjustment for given mult/shift */ | ||
737 | cs->maxadj = clocksource_max_adjustment(cs); | ||
738 | WARN_ONCE(cs->mult + cs->maxadj < cs->mult, | ||
739 | "Clocksource %s might overflow on 11%% adjustment\n", | ||
740 | cs->name); | ||
741 | |||
704 | /* calculate max idle time permitted for this clocksource */ | 742 | /* calculate max idle time permitted for this clocksource */ |
705 | cs->max_idle_ns = clocksource_max_deferment(cs); | 743 | cs->max_idle_ns = clocksource_max_deferment(cs); |
706 | 744 | ||
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 2b021b0e8507..237841378c03 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -249,6 +249,8 @@ ktime_t ktime_get(void) | |||
249 | secs = xtime.tv_sec + wall_to_monotonic.tv_sec; | 249 | secs = xtime.tv_sec + wall_to_monotonic.tv_sec; |
250 | nsecs = xtime.tv_nsec + wall_to_monotonic.tv_nsec; | 250 | nsecs = xtime.tv_nsec + wall_to_monotonic.tv_nsec; |
251 | nsecs += timekeeping_get_ns(); | 251 | nsecs += timekeeping_get_ns(); |
252 | /* If arch requires, add in gettimeoffset() */ | ||
253 | nsecs += arch_gettimeoffset(); | ||
252 | 254 | ||
253 | } while (read_seqretry(&xtime_lock, seq)); | 255 | } while (read_seqretry(&xtime_lock, seq)); |
254 | /* | 256 | /* |
@@ -280,6 +282,8 @@ void ktime_get_ts(struct timespec *ts) | |||
280 | *ts = xtime; | 282 | *ts = xtime; |
281 | tomono = wall_to_monotonic; | 283 | tomono = wall_to_monotonic; |
282 | nsecs = timekeeping_get_ns(); | 284 | nsecs = timekeeping_get_ns(); |
285 | /* If arch requires, add in gettimeoffset() */ | ||
286 | nsecs += arch_gettimeoffset(); | ||
283 | 287 | ||
284 | } while (read_seqretry(&xtime_lock, seq)); | 288 | } while (read_seqretry(&xtime_lock, seq)); |
285 | 289 | ||
@@ -802,14 +806,44 @@ static void timekeeping_adjust(s64 offset) | |||
802 | s64 error, interval = timekeeper.cycle_interval; | 806 | s64 error, interval = timekeeper.cycle_interval; |
803 | int adj; | 807 | int adj; |
804 | 808 | ||
809 | /* | ||
810 | * The point of this is to check if the error is greater then half | ||
811 | * an interval. | ||
812 | * | ||
813 | * First we shift it down from NTP_SHIFT to clocksource->shifted nsecs. | ||
814 | * | ||
815 | * Note we subtract one in the shift, so that error is really error*2. | ||
816 | * This "saves" dividing(shifting) intererval twice, but keeps the | ||
817 | * (error > interval) comparision as still measuring if error is | ||
818 | * larger then half an interval. | ||
819 | * | ||
820 | * Note: It does not "save" on aggrivation when reading the code. | ||
821 | */ | ||
805 | error = timekeeper.ntp_error >> (timekeeper.ntp_error_shift - 1); | 822 | error = timekeeper.ntp_error >> (timekeeper.ntp_error_shift - 1); |
806 | if (error > interval) { | 823 | if (error > interval) { |
824 | /* | ||
825 | * We now divide error by 4(via shift), which checks if | ||
826 | * the error is greater then twice the interval. | ||
827 | * If it is greater, we need a bigadjust, if its smaller, | ||
828 | * we can adjust by 1. | ||
829 | */ | ||
807 | error >>= 2; | 830 | error >>= 2; |
831 | /* | ||
832 | * XXX - In update_wall_time, we round up to the next | ||
833 | * nanosecond, and store the amount rounded up into | ||
834 | * the error. This causes the likely below to be unlikely. | ||
835 | * | ||
836 | * The properfix is to avoid rounding up by using | ||
837 | * the high precision timekeeper.xtime_nsec instead of | ||
838 | * xtime.tv_nsec everywhere. Fixing this will take some | ||
839 | * time. | ||
840 | */ | ||
808 | if (likely(error <= interval)) | 841 | if (likely(error <= interval)) |
809 | adj = 1; | 842 | adj = 1; |
810 | else | 843 | else |
811 | adj = timekeeping_bigadjust(error, &interval, &offset); | 844 | adj = timekeeping_bigadjust(error, &interval, &offset); |
812 | } else if (error < -interval) { | 845 | } else if (error < -interval) { |
846 | /* See comment above, this is just switched for the negative */ | ||
813 | error >>= 2; | 847 | error >>= 2; |
814 | if (likely(error >= -interval)) { | 848 | if (likely(error >= -interval)) { |
815 | adj = -1; | 849 | adj = -1; |
@@ -817,9 +851,65 @@ static void timekeeping_adjust(s64 offset) | |||
817 | offset = -offset; | 851 | offset = -offset; |
818 | } else | 852 | } else |
819 | adj = timekeeping_bigadjust(error, &interval, &offset); | 853 | adj = timekeeping_bigadjust(error, &interval, &offset); |
820 | } else | 854 | } else /* No adjustment needed */ |
821 | return; | 855 | return; |
822 | 856 | ||
857 | WARN_ONCE(timekeeper.clock->maxadj && | ||
858 | (timekeeper.mult + adj > timekeeper.clock->mult + | ||
859 | timekeeper.clock->maxadj), | ||
860 | "Adjusting %s more then 11%% (%ld vs %ld)\n", | ||
861 | timekeeper.clock->name, (long)timekeeper.mult + adj, | ||
862 | (long)timekeeper.clock->mult + | ||
863 | timekeeper.clock->maxadj); | ||
864 | /* | ||
865 | * So the following can be confusing. | ||
866 | * | ||
867 | * To keep things simple, lets assume adj == 1 for now. | ||
868 | * | ||
869 | * When adj != 1, remember that the interval and offset values | ||
870 | * have been appropriately scaled so the math is the same. | ||
871 | * | ||
872 | * The basic idea here is that we're increasing the multiplier | ||
873 | * by one, this causes the xtime_interval to be incremented by | ||
874 | * one cycle_interval. This is because: | ||
875 | * xtime_interval = cycle_interval * mult | ||
876 | * So if mult is being incremented by one: | ||
877 | * xtime_interval = cycle_interval * (mult + 1) | ||
878 | * Its the same as: | ||
879 | * xtime_interval = (cycle_interval * mult) + cycle_interval | ||
880 | * Which can be shortened to: | ||
881 | * xtime_interval += cycle_interval | ||
882 | * | ||
883 | * So offset stores the non-accumulated cycles. Thus the current | ||
884 | * time (in shifted nanoseconds) is: | ||
885 | * now = (offset * adj) + xtime_nsec | ||
886 | * Now, even though we're adjusting the clock frequency, we have | ||
887 | * to keep time consistent. In other words, we can't jump back | ||
888 | * in time, and we also want to avoid jumping forward in time. | ||
889 | * | ||
890 | * So given the same offset value, we need the time to be the same | ||
891 | * both before and after the freq adjustment. | ||
892 | * now = (offset * adj_1) + xtime_nsec_1 | ||
893 | * now = (offset * adj_2) + xtime_nsec_2 | ||
894 | * So: | ||
895 | * (offset * adj_1) + xtime_nsec_1 = | ||
896 | * (offset * adj_2) + xtime_nsec_2 | ||
897 | * And we know: | ||
898 | * adj_2 = adj_1 + 1 | ||
899 | * So: | ||
900 | * (offset * adj_1) + xtime_nsec_1 = | ||
901 | * (offset * (adj_1+1)) + xtime_nsec_2 | ||
902 | * (offset * adj_1) + xtime_nsec_1 = | ||
903 | * (offset * adj_1) + offset + xtime_nsec_2 | ||
904 | * Canceling the sides: | ||
905 | * xtime_nsec_1 = offset + xtime_nsec_2 | ||
906 | * Which gives us: | ||
907 | * xtime_nsec_2 = xtime_nsec_1 - offset | ||
908 | * Which simplfies to: | ||
909 | * xtime_nsec -= offset | ||
910 | * | ||
911 | * XXX - TODO: Doc ntp_error calculation. | ||
912 | */ | ||
823 | timekeeper.mult += adj; | 913 | timekeeper.mult += adj; |
824 | timekeeper.xtime_interval += interval; | 914 | timekeeper.xtime_interval += interval; |
825 | timekeeper.xtime_nsec -= offset; | 915 | timekeeper.xtime_nsec -= offset; |
diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c index ea534960a04b..12a48a88c0d8 100644 --- a/mm/percpu-vm.c +++ b/mm/percpu-vm.c | |||
@@ -50,14 +50,13 @@ static struct page **pcpu_get_pages_and_bitmap(struct pcpu_chunk *chunk, | |||
50 | 50 | ||
51 | if (!pages || !bitmap) { | 51 | if (!pages || !bitmap) { |
52 | if (may_alloc && !pages) | 52 | if (may_alloc && !pages) |
53 | pages = pcpu_mem_alloc(pages_size); | 53 | pages = pcpu_mem_zalloc(pages_size); |
54 | if (may_alloc && !bitmap) | 54 | if (may_alloc && !bitmap) |
55 | bitmap = pcpu_mem_alloc(bitmap_size); | 55 | bitmap = pcpu_mem_zalloc(bitmap_size); |
56 | if (!pages || !bitmap) | 56 | if (!pages || !bitmap) |
57 | return NULL; | 57 | return NULL; |
58 | } | 58 | } |
59 | 59 | ||
60 | memset(pages, 0, pages_size); | ||
61 | bitmap_copy(bitmap, chunk->populated, pcpu_unit_pages); | 60 | bitmap_copy(bitmap, chunk->populated, pcpu_unit_pages); |
62 | 61 | ||
63 | *bitmapp = bitmap; | 62 | *bitmapp = bitmap; |
@@ -143,8 +142,8 @@ static void pcpu_pre_unmap_flush(struct pcpu_chunk *chunk, | |||
143 | int page_start, int page_end) | 142 | int page_start, int page_end) |
144 | { | 143 | { |
145 | flush_cache_vunmap( | 144 | flush_cache_vunmap( |
146 | pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start), | 145 | pcpu_chunk_addr(chunk, pcpu_low_unit_cpu, page_start), |
147 | pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end)); | 146 | pcpu_chunk_addr(chunk, pcpu_high_unit_cpu, page_end)); |
148 | } | 147 | } |
149 | 148 | ||
150 | static void __pcpu_unmap_pages(unsigned long addr, int nr_pages) | 149 | static void __pcpu_unmap_pages(unsigned long addr, int nr_pages) |
@@ -206,8 +205,8 @@ static void pcpu_post_unmap_tlb_flush(struct pcpu_chunk *chunk, | |||
206 | int page_start, int page_end) | 205 | int page_start, int page_end) |
207 | { | 206 | { |
208 | flush_tlb_kernel_range( | 207 | flush_tlb_kernel_range( |
209 | pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start), | 208 | pcpu_chunk_addr(chunk, pcpu_low_unit_cpu, page_start), |
210 | pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end)); | 209 | pcpu_chunk_addr(chunk, pcpu_high_unit_cpu, page_end)); |
211 | } | 210 | } |
212 | 211 | ||
213 | static int __pcpu_map_pages(unsigned long addr, struct page **pages, | 212 | static int __pcpu_map_pages(unsigned long addr, struct page **pages, |
@@ -284,8 +283,8 @@ static void pcpu_post_map_flush(struct pcpu_chunk *chunk, | |||
284 | int page_start, int page_end) | 283 | int page_start, int page_end) |
285 | { | 284 | { |
286 | flush_cache_vmap( | 285 | flush_cache_vmap( |
287 | pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start), | 286 | pcpu_chunk_addr(chunk, pcpu_low_unit_cpu, page_start), |
288 | pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end)); | 287 | pcpu_chunk_addr(chunk, pcpu_high_unit_cpu, page_end)); |
289 | } | 288 | } |
290 | 289 | ||
291 | /** | 290 | /** |
diff --git a/mm/percpu.c b/mm/percpu.c index bf80e55dbed7..3bb810a72006 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -116,9 +116,9 @@ static int pcpu_atom_size __read_mostly; | |||
116 | static int pcpu_nr_slots __read_mostly; | 116 | static int pcpu_nr_slots __read_mostly; |
117 | static size_t pcpu_chunk_struct_size __read_mostly; | 117 | static size_t pcpu_chunk_struct_size __read_mostly; |
118 | 118 | ||
119 | /* cpus with the lowest and highest unit numbers */ | 119 | /* cpus with the lowest and highest unit addresses */ |
120 | static unsigned int pcpu_first_unit_cpu __read_mostly; | 120 | static unsigned int pcpu_low_unit_cpu __read_mostly; |
121 | static unsigned int pcpu_last_unit_cpu __read_mostly; | 121 | static unsigned int pcpu_high_unit_cpu __read_mostly; |
122 | 122 | ||
123 | /* the address of the first chunk which starts with the kernel static area */ | 123 | /* the address of the first chunk which starts with the kernel static area */ |
124 | void *pcpu_base_addr __read_mostly; | 124 | void *pcpu_base_addr __read_mostly; |
@@ -273,11 +273,11 @@ static void __maybe_unused pcpu_next_pop(struct pcpu_chunk *chunk, | |||
273 | (rs) = (re) + 1, pcpu_next_pop((chunk), &(rs), &(re), (end))) | 273 | (rs) = (re) + 1, pcpu_next_pop((chunk), &(rs), &(re), (end))) |
274 | 274 | ||
275 | /** | 275 | /** |
276 | * pcpu_mem_alloc - allocate memory | 276 | * pcpu_mem_zalloc - allocate memory |
277 | * @size: bytes to allocate | 277 | * @size: bytes to allocate |
278 | * | 278 | * |
279 | * Allocate @size bytes. If @size is smaller than PAGE_SIZE, | 279 | * Allocate @size bytes. If @size is smaller than PAGE_SIZE, |
280 | * kzalloc() is used; otherwise, vmalloc() is used. The returned | 280 | * kzalloc() is used; otherwise, vzalloc() is used. The returned |
281 | * memory is always zeroed. | 281 | * memory is always zeroed. |
282 | * | 282 | * |
283 | * CONTEXT: | 283 | * CONTEXT: |
@@ -286,7 +286,7 @@ static void __maybe_unused pcpu_next_pop(struct pcpu_chunk *chunk, | |||
286 | * RETURNS: | 286 | * RETURNS: |
287 | * Pointer to the allocated area on success, NULL on failure. | 287 | * Pointer to the allocated area on success, NULL on failure. |
288 | */ | 288 | */ |
289 | static void *pcpu_mem_alloc(size_t size) | 289 | static void *pcpu_mem_zalloc(size_t size) |
290 | { | 290 | { |
291 | if (WARN_ON_ONCE(!slab_is_available())) | 291 | if (WARN_ON_ONCE(!slab_is_available())) |
292 | return NULL; | 292 | return NULL; |
@@ -302,7 +302,7 @@ static void *pcpu_mem_alloc(size_t size) | |||
302 | * @ptr: memory to free | 302 | * @ptr: memory to free |
303 | * @size: size of the area | 303 | * @size: size of the area |
304 | * | 304 | * |
305 | * Free @ptr. @ptr should have been allocated using pcpu_mem_alloc(). | 305 | * Free @ptr. @ptr should have been allocated using pcpu_mem_zalloc(). |
306 | */ | 306 | */ |
307 | static void pcpu_mem_free(void *ptr, size_t size) | 307 | static void pcpu_mem_free(void *ptr, size_t size) |
308 | { | 308 | { |
@@ -384,7 +384,7 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc) | |||
384 | size_t old_size = 0, new_size = new_alloc * sizeof(new[0]); | 384 | size_t old_size = 0, new_size = new_alloc * sizeof(new[0]); |
385 | unsigned long flags; | 385 | unsigned long flags; |
386 | 386 | ||
387 | new = pcpu_mem_alloc(new_size); | 387 | new = pcpu_mem_zalloc(new_size); |
388 | if (!new) | 388 | if (!new) |
389 | return -ENOMEM; | 389 | return -ENOMEM; |
390 | 390 | ||
@@ -604,11 +604,12 @@ static struct pcpu_chunk *pcpu_alloc_chunk(void) | |||
604 | { | 604 | { |
605 | struct pcpu_chunk *chunk; | 605 | struct pcpu_chunk *chunk; |
606 | 606 | ||
607 | chunk = pcpu_mem_alloc(pcpu_chunk_struct_size); | 607 | chunk = pcpu_mem_zalloc(pcpu_chunk_struct_size); |
608 | if (!chunk) | 608 | if (!chunk) |
609 | return NULL; | 609 | return NULL; |
610 | 610 | ||
611 | chunk->map = pcpu_mem_alloc(PCPU_DFL_MAP_ALLOC * sizeof(chunk->map[0])); | 611 | chunk->map = pcpu_mem_zalloc(PCPU_DFL_MAP_ALLOC * |
612 | sizeof(chunk->map[0])); | ||
612 | if (!chunk->map) { | 613 | if (!chunk->map) { |
613 | kfree(chunk); | 614 | kfree(chunk); |
614 | return NULL; | 615 | return NULL; |
@@ -977,6 +978,17 @@ bool is_kernel_percpu_address(unsigned long addr) | |||
977 | * address. The caller is responsible for ensuring @addr stays valid | 978 | * address. The caller is responsible for ensuring @addr stays valid |
978 | * until this function finishes. | 979 | * until this function finishes. |
979 | * | 980 | * |
981 | * percpu allocator has special setup for the first chunk, which currently | ||
982 | * supports either embedding in linear address space or vmalloc mapping, | ||
983 | * and, from the second one, the backing allocator (currently either vm or | ||
984 | * km) provides translation. | ||
985 | * | ||
986 | * The addr can be tranlated simply without checking if it falls into the | ||
987 | * first chunk. But the current code reflects better how percpu allocator | ||
988 | * actually works, and the verification can discover both bugs in percpu | ||
989 | * allocator itself and per_cpu_ptr_to_phys() callers. So we keep current | ||
990 | * code. | ||
991 | * | ||
980 | * RETURNS: | 992 | * RETURNS: |
981 | * The physical address for @addr. | 993 | * The physical address for @addr. |
982 | */ | 994 | */ |
@@ -984,19 +996,19 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr) | |||
984 | { | 996 | { |
985 | void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr); | 997 | void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr); |
986 | bool in_first_chunk = false; | 998 | bool in_first_chunk = false; |
987 | unsigned long first_start, first_end; | 999 | unsigned long first_low, first_high; |
988 | unsigned int cpu; | 1000 | unsigned int cpu; |
989 | 1001 | ||
990 | /* | 1002 | /* |
991 | * The following test on first_start/end isn't strictly | 1003 | * The following test on unit_low/high isn't strictly |
992 | * necessary but will speed up lookups of addresses which | 1004 | * necessary but will speed up lookups of addresses which |
993 | * aren't in the first chunk. | 1005 | * aren't in the first chunk. |
994 | */ | 1006 | */ |
995 | first_start = pcpu_chunk_addr(pcpu_first_chunk, pcpu_first_unit_cpu, 0); | 1007 | first_low = pcpu_chunk_addr(pcpu_first_chunk, pcpu_low_unit_cpu, 0); |
996 | first_end = pcpu_chunk_addr(pcpu_first_chunk, pcpu_last_unit_cpu, | 1008 | first_high = pcpu_chunk_addr(pcpu_first_chunk, pcpu_high_unit_cpu, |
997 | pcpu_unit_pages); | 1009 | pcpu_unit_pages); |
998 | if ((unsigned long)addr >= first_start && | 1010 | if ((unsigned long)addr >= first_low && |
999 | (unsigned long)addr < first_end) { | 1011 | (unsigned long)addr < first_high) { |
1000 | for_each_possible_cpu(cpu) { | 1012 | for_each_possible_cpu(cpu) { |
1001 | void *start = per_cpu_ptr(base, cpu); | 1013 | void *start = per_cpu_ptr(base, cpu); |
1002 | 1014 | ||
@@ -1233,7 +1245,9 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | |||
1233 | 1245 | ||
1234 | for (cpu = 0; cpu < nr_cpu_ids; cpu++) | 1246 | for (cpu = 0; cpu < nr_cpu_ids; cpu++) |
1235 | unit_map[cpu] = UINT_MAX; | 1247 | unit_map[cpu] = UINT_MAX; |
1236 | pcpu_first_unit_cpu = NR_CPUS; | 1248 | |
1249 | pcpu_low_unit_cpu = NR_CPUS; | ||
1250 | pcpu_high_unit_cpu = NR_CPUS; | ||
1237 | 1251 | ||
1238 | for (group = 0, unit = 0; group < ai->nr_groups; group++, unit += i) { | 1252 | for (group = 0, unit = 0; group < ai->nr_groups; group++, unit += i) { |
1239 | const struct pcpu_group_info *gi = &ai->groups[group]; | 1253 | const struct pcpu_group_info *gi = &ai->groups[group]; |
@@ -1253,9 +1267,13 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | |||
1253 | unit_map[cpu] = unit + i; | 1267 | unit_map[cpu] = unit + i; |
1254 | unit_off[cpu] = gi->base_offset + i * ai->unit_size; | 1268 | unit_off[cpu] = gi->base_offset + i * ai->unit_size; |
1255 | 1269 | ||
1256 | if (pcpu_first_unit_cpu == NR_CPUS) | 1270 | /* determine low/high unit_cpu */ |
1257 | pcpu_first_unit_cpu = cpu; | 1271 | if (pcpu_low_unit_cpu == NR_CPUS || |
1258 | pcpu_last_unit_cpu = cpu; | 1272 | unit_off[cpu] < unit_off[pcpu_low_unit_cpu]) |
1273 | pcpu_low_unit_cpu = cpu; | ||
1274 | if (pcpu_high_unit_cpu == NR_CPUS || | ||
1275 | unit_off[cpu] > unit_off[pcpu_high_unit_cpu]) | ||
1276 | pcpu_high_unit_cpu = cpu; | ||
1259 | } | 1277 | } |
1260 | } | 1278 | } |
1261 | pcpu_nr_units = unit; | 1279 | pcpu_nr_units = unit; |
@@ -1889,7 +1907,7 @@ void __init percpu_init_late(void) | |||
1889 | 1907 | ||
1890 | BUILD_BUG_ON(size > PAGE_SIZE); | 1908 | BUILD_BUG_ON(size > PAGE_SIZE); |
1891 | 1909 | ||
1892 | map = pcpu_mem_alloc(size); | 1910 | map = pcpu_mem_zalloc(size); |
1893 | BUG_ON(!map); | 1911 | BUG_ON(!map); |
1894 | 1912 | ||
1895 | spin_lock_irqsave(&pcpu_lock, flags); | 1913 | spin_lock_irqsave(&pcpu_lock, flags); |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 2d78d95955ab..55472c48825e 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -496,7 +496,7 @@ static int xs_nospace(struct rpc_task *task) | |||
496 | struct rpc_rqst *req = task->tk_rqstp; | 496 | struct rpc_rqst *req = task->tk_rqstp; |
497 | struct rpc_xprt *xprt = req->rq_xprt; | 497 | struct rpc_xprt *xprt = req->rq_xprt; |
498 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); | 498 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); |
499 | int ret = 0; | 499 | int ret = -EAGAIN; |
500 | 500 | ||
501 | dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", | 501 | dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", |
502 | task->tk_pid, req->rq_slen - req->rq_bytes_sent, | 502 | task->tk_pid, req->rq_slen - req->rq_bytes_sent, |
@@ -508,7 +508,6 @@ static int xs_nospace(struct rpc_task *task) | |||
508 | /* Don't race with disconnect */ | 508 | /* Don't race with disconnect */ |
509 | if (xprt_connected(xprt)) { | 509 | if (xprt_connected(xprt)) { |
510 | if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) { | 510 | if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) { |
511 | ret = -EAGAIN; | ||
512 | /* | 511 | /* |
513 | * Notify TCP that we're limited by the application | 512 | * Notify TCP that we're limited by the application |
514 | * window size | 513 | * window size |
diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index e083122ca55a..dbf94b189e75 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c | |||
@@ -148,7 +148,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au, | |||
148 | struct cs5535audio_dma_desc *desc = | 148 | struct cs5535audio_dma_desc *desc = |
149 | &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i]; | 149 | &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i]; |
150 | desc->addr = cpu_to_le32(addr); | 150 | desc->addr = cpu_to_le32(addr); |
151 | desc->size = cpu_to_le32(period_bytes); | 151 | desc->size = cpu_to_le16(period_bytes); |
152 | desc->ctlreserved = cpu_to_le16(PRD_EOP); | 152 | desc->ctlreserved = cpu_to_le16(PRD_EOP); |
153 | desc_addr += sizeof(struct cs5535audio_dma_desc); | 153 | desc_addr += sizeof(struct cs5535audio_dma_desc); |
154 | addr += period_bytes; | 154 | addr += period_bytes; |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index e44b107fdc75..4562e9de6a1a 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -4046,9 +4046,9 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | |||
4046 | 4046 | ||
4047 | /* Search for codec ID */ | 4047 | /* Search for codec ID */ |
4048 | for (q = tbl; q->subvendor; q++) { | 4048 | for (q = tbl; q->subvendor; q++) { |
4049 | unsigned long vendorid = (q->subdevice) | (q->subvendor << 16); | 4049 | unsigned int mask = 0xffff0000 | q->subdevice_mask; |
4050 | 4050 | unsigned int id = (q->subdevice | (q->subvendor << 16)) & mask; | |
4051 | if (vendorid == codec->subsystem_id) | 4051 | if ((codec->subsystem_id & mask) == id) |
4052 | break; | 4052 | break; |
4053 | } | 4053 | } |
4054 | 4054 | ||
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 7ae7578bdcc0..c1da422e085a 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -347,18 +347,28 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
347 | 347 | ||
348 | for (i = 0; i < size; i++) { | 348 | for (i = 0; i < size; i++) { |
349 | unsigned int val = hdmi_get_eld_data(codec, nid, i); | 349 | unsigned int val = hdmi_get_eld_data(codec, nid, i); |
350 | /* | ||
351 | * Graphics driver might be writing to ELD buffer right now. | ||
352 | * Just abort. The caller will repoll after a while. | ||
353 | */ | ||
350 | if (!(val & AC_ELDD_ELD_VALID)) { | 354 | if (!(val & AC_ELDD_ELD_VALID)) { |
351 | if (!i) { | ||
352 | snd_printd(KERN_INFO | ||
353 | "HDMI: invalid ELD data\n"); | ||
354 | ret = -EINVAL; | ||
355 | goto error; | ||
356 | } | ||
357 | snd_printd(KERN_INFO | 355 | snd_printd(KERN_INFO |
358 | "HDMI: invalid ELD data byte %d\n", i); | 356 | "HDMI: invalid ELD data byte %d\n", i); |
359 | val = 0; | 357 | ret = -EINVAL; |
360 | } else | 358 | goto error; |
361 | val &= AC_ELDD_ELD_DATA; | 359 | } |
360 | val &= AC_ELDD_ELD_DATA; | ||
361 | /* | ||
362 | * The first byte cannot be zero. This can happen on some DVI | ||
363 | * connections. Some Intel chips may also need some 250ms delay | ||
364 | * to return non-zero ELD data, even when the graphics driver | ||
365 | * correctly writes ELD content before setting ELD_valid bit. | ||
366 | */ | ||
367 | if (!val && !i) { | ||
368 | snd_printdd(KERN_INFO "HDMI: 0 ELD data\n"); | ||
369 | ret = -EINVAL; | ||
370 | goto error; | ||
371 | } | ||
362 | buf[i] = val; | 372 | buf[i] = val; |
363 | } | 373 | } |
364 | 374 | ||
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 2fbab8e29576..70a7abda7e22 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -58,6 +58,8 @@ struct cs_spec { | |||
58 | unsigned int gpio_mask; | 58 | unsigned int gpio_mask; |
59 | unsigned int gpio_dir; | 59 | unsigned int gpio_dir; |
60 | unsigned int gpio_data; | 60 | unsigned int gpio_data; |
61 | unsigned int gpio_eapd_hp; /* EAPD GPIO bit for headphones */ | ||
62 | unsigned int gpio_eapd_speaker; /* EAPD GPIO bit for speakers */ | ||
61 | 63 | ||
62 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 64 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
63 | 65 | ||
@@ -76,6 +78,7 @@ enum { | |||
76 | CS420X_MBP53, | 78 | CS420X_MBP53, |
77 | CS420X_MBP55, | 79 | CS420X_MBP55, |
78 | CS420X_IMAC27, | 80 | CS420X_IMAC27, |
81 | CS420X_APPLE, | ||
79 | CS420X_AUTO, | 82 | CS420X_AUTO, |
80 | CS420X_MODELS | 83 | CS420X_MODELS |
81 | }; | 84 | }; |
@@ -928,10 +931,9 @@ static void cs_automute(struct hda_codec *codec) | |||
928 | spdif_present ? 0 : PIN_OUT); | 931 | spdif_present ? 0 : PIN_OUT); |
929 | } | 932 | } |
930 | } | 933 | } |
931 | if (spec->board_config == CS420X_MBP53 || | 934 | if (spec->gpio_eapd_hp) { |
932 | spec->board_config == CS420X_MBP55 || | 935 | unsigned int gpio = hp_present ? |
933 | spec->board_config == CS420X_IMAC27) { | 936 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; |
934 | unsigned int gpio = hp_present ? 0x02 : 0x08; | ||
935 | snd_hda_codec_write(codec, 0x01, 0, | 937 | snd_hda_codec_write(codec, 0x01, 0, |
936 | AC_VERB_SET_GPIO_DATA, gpio); | 938 | AC_VERB_SET_GPIO_DATA, gpio); |
937 | } | 939 | } |
@@ -1276,6 +1278,7 @@ static const char * const cs420x_models[CS420X_MODELS] = { | |||
1276 | [CS420X_MBP53] = "mbp53", | 1278 | [CS420X_MBP53] = "mbp53", |
1277 | [CS420X_MBP55] = "mbp55", | 1279 | [CS420X_MBP55] = "mbp55", |
1278 | [CS420X_IMAC27] = "imac27", | 1280 | [CS420X_IMAC27] = "imac27", |
1281 | [CS420X_APPLE] = "apple", | ||
1279 | [CS420X_AUTO] = "auto", | 1282 | [CS420X_AUTO] = "auto", |
1280 | }; | 1283 | }; |
1281 | 1284 | ||
@@ -1285,7 +1288,13 @@ static const struct snd_pci_quirk cs420x_cfg_tbl[] = { | |||
1285 | SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), | 1288 | SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), |
1286 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), | 1289 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), |
1287 | SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), | 1290 | SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), |
1288 | SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27), | 1291 | /* this conflicts with too many other models */ |
1292 | /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/ | ||
1293 | {} /* terminator */ | ||
1294 | }; | ||
1295 | |||
1296 | static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = { | ||
1297 | SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), | ||
1289 | {} /* terminator */ | 1298 | {} /* terminator */ |
1290 | }; | 1299 | }; |
1291 | 1300 | ||
@@ -1367,6 +1376,10 @@ static int patch_cs420x(struct hda_codec *codec) | |||
1367 | spec->board_config = | 1376 | spec->board_config = |
1368 | snd_hda_check_board_config(codec, CS420X_MODELS, | 1377 | snd_hda_check_board_config(codec, CS420X_MODELS, |
1369 | cs420x_models, cs420x_cfg_tbl); | 1378 | cs420x_models, cs420x_cfg_tbl); |
1379 | if (spec->board_config < 0) | ||
1380 | spec->board_config = | ||
1381 | snd_hda_check_board_codec_sid_config(codec, | ||
1382 | CS420X_MODELS, NULL, cs420x_codec_cfg_tbl); | ||
1370 | if (spec->board_config >= 0) | 1383 | if (spec->board_config >= 0) |
1371 | fix_pincfg(codec, spec->board_config, cs_pincfgs); | 1384 | fix_pincfg(codec, spec->board_config, cs_pincfgs); |
1372 | 1385 | ||
@@ -1374,10 +1387,11 @@ static int patch_cs420x(struct hda_codec *codec) | |||
1374 | case CS420X_IMAC27: | 1387 | case CS420X_IMAC27: |
1375 | case CS420X_MBP53: | 1388 | case CS420X_MBP53: |
1376 | case CS420X_MBP55: | 1389 | case CS420X_MBP55: |
1377 | /* GPIO1 = headphones */ | 1390 | case CS420X_APPLE: |
1378 | /* GPIO3 = speakers */ | 1391 | spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ |
1379 | spec->gpio_mask = 0x0a; | 1392 | spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ |
1380 | spec->gpio_dir = 0x0a; | 1393 | spec->gpio_mask = spec->gpio_dir = |
1394 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; | ||
1381 | break; | 1395 | break; |
1382 | } | 1396 | } |
1383 | 1397 | ||
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 9850c5b481ea..c505fd5d338c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -69,6 +69,7 @@ struct hdmi_spec_per_pin { | |||
69 | struct hda_codec *codec; | 69 | struct hda_codec *codec; |
70 | struct hdmi_eld sink_eld; | 70 | struct hdmi_eld sink_eld; |
71 | struct delayed_work work; | 71 | struct delayed_work work; |
72 | int repoll_count; | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | struct hdmi_spec { | 75 | struct hdmi_spec { |
@@ -748,7 +749,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, | |||
748 | * Unsolicited events | 749 | * Unsolicited events |
749 | */ | 750 | */ |
750 | 751 | ||
751 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry); | 752 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); |
752 | 753 | ||
753 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | 754 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) |
754 | { | 755 | { |
@@ -766,7 +767,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
766 | if (pin_idx < 0) | 767 | if (pin_idx < 0) |
767 | return; | 768 | return; |
768 | 769 | ||
769 | hdmi_present_sense(&spec->pins[pin_idx], true); | 770 | hdmi_present_sense(&spec->pins[pin_idx], 1); |
770 | } | 771 | } |
771 | 772 | ||
772 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | 773 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) |
@@ -960,7 +961,7 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx) | |||
960 | return 0; | 961 | return 0; |
961 | } | 962 | } |
962 | 963 | ||
963 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry) | 964 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) |
964 | { | 965 | { |
965 | struct hda_codec *codec = per_pin->codec; | 966 | struct hda_codec *codec = per_pin->codec; |
966 | struct hdmi_eld *eld = &per_pin->sink_eld; | 967 | struct hdmi_eld *eld = &per_pin->sink_eld; |
@@ -989,7 +990,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry) | |||
989 | if (eld_valid) { | 990 | if (eld_valid) { |
990 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) | 991 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) |
991 | snd_hdmi_show_eld(eld); | 992 | snd_hdmi_show_eld(eld); |
992 | else if (retry) { | 993 | else if (repoll) { |
993 | queue_delayed_work(codec->bus->workq, | 994 | queue_delayed_work(codec->bus->workq, |
994 | &per_pin->work, | 995 | &per_pin->work, |
995 | msecs_to_jiffies(300)); | 996 | msecs_to_jiffies(300)); |
@@ -1004,7 +1005,10 @@ static void hdmi_repoll_eld(struct work_struct *work) | |||
1004 | struct hdmi_spec_per_pin *per_pin = | 1005 | struct hdmi_spec_per_pin *per_pin = |
1005 | container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); | 1006 | container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); |
1006 | 1007 | ||
1007 | hdmi_present_sense(per_pin, false); | 1008 | if (per_pin->repoll_count++ > 6) |
1009 | per_pin->repoll_count = 0; | ||
1010 | |||
1011 | hdmi_present_sense(per_pin, per_pin->repoll_count); | ||
1008 | } | 1012 | } |
1009 | 1013 | ||
1010 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | 1014 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) |
@@ -1235,7 +1239,7 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) | |||
1235 | if (err < 0) | 1239 | if (err < 0) |
1236 | return err; | 1240 | return err; |
1237 | 1241 | ||
1238 | hdmi_present_sense(per_pin, false); | 1242 | hdmi_present_sense(per_pin, 0); |
1239 | return 0; | 1243 | return 0; |
1240 | } | 1244 | } |
1241 | 1245 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 336d14eb72af..cbde019d3d52 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -277,6 +277,12 @@ static bool alc_dyn_adc_pcm_resetup(struct hda_codec *codec, int cur) | |||
277 | return false; | 277 | return false; |
278 | } | 278 | } |
279 | 279 | ||
280 | static inline hda_nid_t get_capsrc(struct alc_spec *spec, int idx) | ||
281 | { | ||
282 | return spec->capsrc_nids ? | ||
283 | spec->capsrc_nids[idx] : spec->adc_nids[idx]; | ||
284 | } | ||
285 | |||
280 | /* select the given imux item; either unmute exclusively or select the route */ | 286 | /* select the given imux item; either unmute exclusively or select the route */ |
281 | static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | 287 | static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, |
282 | unsigned int idx, bool force) | 288 | unsigned int idx, bool force) |
@@ -303,8 +309,7 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
303 | adc_idx = spec->dyn_adc_idx[idx]; | 309 | adc_idx = spec->dyn_adc_idx[idx]; |
304 | } | 310 | } |
305 | 311 | ||
306 | nid = spec->capsrc_nids ? | 312 | nid = get_capsrc(spec, adc_idx); |
307 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | ||
308 | 313 | ||
309 | /* no selection? */ | 314 | /* no selection? */ |
310 | num_conns = snd_hda_get_conn_list(codec, nid, NULL); | 315 | num_conns = snd_hda_get_conn_list(codec, nid, NULL); |
@@ -1054,8 +1059,19 @@ static bool alc_rebuild_imux_for_auto_mic(struct hda_codec *codec) | |||
1054 | spec->imux_pins[2] = spec->dock_mic_pin; | 1059 | spec->imux_pins[2] = spec->dock_mic_pin; |
1055 | for (i = 0; i < 3; i++) { | 1060 | for (i = 0; i < 3; i++) { |
1056 | strcpy(imux->items[i].label, texts[i]); | 1061 | strcpy(imux->items[i].label, texts[i]); |
1057 | if (spec->imux_pins[i]) | 1062 | if (spec->imux_pins[i]) { |
1063 | hda_nid_t pin = spec->imux_pins[i]; | ||
1064 | int c; | ||
1065 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
1066 | hda_nid_t cap = get_capsrc(spec, c); | ||
1067 | int idx = get_connection_index(codec, cap, pin); | ||
1068 | if (idx >= 0) { | ||
1069 | imux->items[i].index = idx; | ||
1070 | break; | ||
1071 | } | ||
1072 | } | ||
1058 | imux->num_items = i + 1; | 1073 | imux->num_items = i + 1; |
1074 | } | ||
1059 | } | 1075 | } |
1060 | spec->num_mux_defs = 1; | 1076 | spec->num_mux_defs = 1; |
1061 | spec->input_mux = imux; | 1077 | spec->input_mux = imux; |
@@ -1957,10 +1973,8 @@ static int alc_build_controls(struct hda_codec *codec) | |||
1957 | if (!kctl) | 1973 | if (!kctl) |
1958 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 1974 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
1959 | for (i = 0; kctl && i < kctl->count; i++) { | 1975 | for (i = 0; kctl && i < kctl->count; i++) { |
1960 | const hda_nid_t *nids = spec->capsrc_nids; | 1976 | err = snd_hda_add_nid(codec, kctl, i, |
1961 | if (!nids) | 1977 | get_capsrc(spec, i)); |
1962 | nids = spec->adc_nids; | ||
1963 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | ||
1964 | if (err < 0) | 1978 | if (err < 0) |
1965 | return err; | 1979 | return err; |
1966 | } | 1980 | } |
@@ -2747,8 +2761,7 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec) | |||
2747 | } | 2761 | } |
2748 | 2762 | ||
2749 | for (c = 0; c < num_adcs; c++) { | 2763 | for (c = 0; c < num_adcs; c++) { |
2750 | hda_nid_t cap = spec->capsrc_nids ? | 2764 | hda_nid_t cap = get_capsrc(spec, c); |
2751 | spec->capsrc_nids[c] : spec->adc_nids[c]; | ||
2752 | idx = get_connection_index(codec, cap, pin); | 2765 | idx = get_connection_index(codec, cap, pin); |
2753 | if (idx >= 0) { | 2766 | if (idx >= 0) { |
2754 | spec->imux_pins[imux->num_items] = pin; | 2767 | spec->imux_pins[imux->num_items] = pin; |
@@ -3694,8 +3707,7 @@ static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) | |||
3694 | if (!pin) | 3707 | if (!pin) |
3695 | return 0; | 3708 | return 0; |
3696 | for (i = 0; i < spec->num_adc_nids; i++) { | 3709 | for (i = 0; i < spec->num_adc_nids; i++) { |
3697 | hda_nid_t cap = spec->capsrc_nids ? | 3710 | hda_nid_t cap = get_capsrc(spec, i); |
3698 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
3699 | int idx; | 3711 | int idx; |
3700 | 3712 | ||
3701 | idx = get_connection_index(codec, cap, pin); | 3713 | idx = get_connection_index(codec, cap, pin); |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 470f6f286e81..f3658658548e 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1641,6 +1641,8 @@ static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { | |||
1641 | "Alienware M17x", STAC_ALIENWARE_M17X), | 1641 | "Alienware M17x", STAC_ALIENWARE_M17X), |
1642 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, | 1642 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, |
1643 | "Alienware M17x", STAC_ALIENWARE_M17X), | 1643 | "Alienware M17x", STAC_ALIENWARE_M17X), |
1644 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, | ||
1645 | "Alienware M17x", STAC_ALIENWARE_M17X), | ||
1644 | {} /* terminator */ | 1646 | {} /* terminator */ |
1645 | }; | 1647 | }; |
1646 | 1648 | ||
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 431c0d417eeb..b5137629f8e9 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -208,6 +208,7 @@ struct via_spec { | |||
208 | /* work to check hp jack state */ | 208 | /* work to check hp jack state */ |
209 | struct hda_codec *codec; | 209 | struct hda_codec *codec; |
210 | struct delayed_work vt1708_hp_work; | 210 | struct delayed_work vt1708_hp_work; |
211 | int hp_work_active; | ||
211 | int vt1708_jack_detect; | 212 | int vt1708_jack_detect; |
212 | int vt1708_hp_present; | 213 | int vt1708_hp_present; |
213 | 214 | ||
@@ -305,27 +306,35 @@ enum { | |||
305 | static void analog_low_current_mode(struct hda_codec *codec); | 306 | static void analog_low_current_mode(struct hda_codec *codec); |
306 | static bool is_aa_path_mute(struct hda_codec *codec); | 307 | static bool is_aa_path_mute(struct hda_codec *codec); |
307 | 308 | ||
308 | static void vt1708_start_hp_work(struct via_spec *spec) | 309 | #define hp_detect_with_aa(codec) \ |
310 | (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1 && \ | ||
311 | !is_aa_path_mute(codec)) | ||
312 | |||
313 | static void vt1708_stop_hp_work(struct via_spec *spec) | ||
309 | { | 314 | { |
310 | if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) | 315 | if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) |
311 | return; | 316 | return; |
312 | snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, | 317 | if (spec->hp_work_active) { |
313 | !spec->vt1708_jack_detect); | 318 | snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 1); |
314 | if (!delayed_work_pending(&spec->vt1708_hp_work)) | 319 | cancel_delayed_work_sync(&spec->vt1708_hp_work); |
315 | schedule_delayed_work(&spec->vt1708_hp_work, | 320 | spec->hp_work_active = 0; |
316 | msecs_to_jiffies(100)); | 321 | } |
317 | } | 322 | } |
318 | 323 | ||
319 | static void vt1708_stop_hp_work(struct via_spec *spec) | 324 | static void vt1708_update_hp_work(struct via_spec *spec) |
320 | { | 325 | { |
321 | if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) | 326 | if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) |
322 | return; | 327 | return; |
323 | if (snd_hda_get_bool_hint(spec->codec, "analog_loopback_hp_detect") == 1 | 328 | if (spec->vt1708_jack_detect && |
324 | && !is_aa_path_mute(spec->codec)) | 329 | (spec->active_streams || hp_detect_with_aa(spec->codec))) { |
325 | return; | 330 | if (!spec->hp_work_active) { |
326 | snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, | 331 | snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 0); |
327 | !spec->vt1708_jack_detect); | 332 | schedule_delayed_work(&spec->vt1708_hp_work, |
328 | cancel_delayed_work_sync(&spec->vt1708_hp_work); | 333 | msecs_to_jiffies(100)); |
334 | spec->hp_work_active = 1; | ||
335 | } | ||
336 | } else if (!hp_detect_with_aa(spec->codec)) | ||
337 | vt1708_stop_hp_work(spec); | ||
329 | } | 338 | } |
330 | 339 | ||
331 | static void set_widgets_power_state(struct hda_codec *codec) | 340 | static void set_widgets_power_state(struct hda_codec *codec) |
@@ -343,12 +352,7 @@ static int analog_input_switch_put(struct snd_kcontrol *kcontrol, | |||
343 | 352 | ||
344 | set_widgets_power_state(codec); | 353 | set_widgets_power_state(codec); |
345 | analog_low_current_mode(snd_kcontrol_chip(kcontrol)); | 354 | analog_low_current_mode(snd_kcontrol_chip(kcontrol)); |
346 | if (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1) { | 355 | vt1708_update_hp_work(codec->spec); |
347 | if (is_aa_path_mute(codec)) | ||
348 | vt1708_start_hp_work(codec->spec); | ||
349 | else | ||
350 | vt1708_stop_hp_work(codec->spec); | ||
351 | } | ||
352 | return change; | 356 | return change; |
353 | } | 357 | } |
354 | 358 | ||
@@ -1154,7 +1158,7 @@ static int via_playback_multi_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1154 | spec->cur_dac_stream_tag = stream_tag; | 1158 | spec->cur_dac_stream_tag = stream_tag; |
1155 | spec->cur_dac_format = format; | 1159 | spec->cur_dac_format = format; |
1156 | mutex_unlock(&spec->config_mutex); | 1160 | mutex_unlock(&spec->config_mutex); |
1157 | vt1708_start_hp_work(spec); | 1161 | vt1708_update_hp_work(spec); |
1158 | return 0; | 1162 | return 0; |
1159 | } | 1163 | } |
1160 | 1164 | ||
@@ -1174,7 +1178,7 @@ static int via_playback_hp_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1174 | spec->cur_hp_stream_tag = stream_tag; | 1178 | spec->cur_hp_stream_tag = stream_tag; |
1175 | spec->cur_hp_format = format; | 1179 | spec->cur_hp_format = format; |
1176 | mutex_unlock(&spec->config_mutex); | 1180 | mutex_unlock(&spec->config_mutex); |
1177 | vt1708_start_hp_work(spec); | 1181 | vt1708_update_hp_work(spec); |
1178 | return 0; | 1182 | return 0; |
1179 | } | 1183 | } |
1180 | 1184 | ||
@@ -1188,7 +1192,7 @@ static int via_playback_multi_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
1188 | snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | 1192 | snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
1189 | spec->active_streams &= ~STREAM_MULTI_OUT; | 1193 | spec->active_streams &= ~STREAM_MULTI_OUT; |
1190 | mutex_unlock(&spec->config_mutex); | 1194 | mutex_unlock(&spec->config_mutex); |
1191 | vt1708_stop_hp_work(spec); | 1195 | vt1708_update_hp_work(spec); |
1192 | return 0; | 1196 | return 0; |
1193 | } | 1197 | } |
1194 | 1198 | ||
@@ -1203,7 +1207,7 @@ static int via_playback_hp_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
1203 | snd_hda_codec_setup_stream(codec, spec->hp_dac_nid, 0, 0, 0); | 1207 | snd_hda_codec_setup_stream(codec, spec->hp_dac_nid, 0, 0, 0); |
1204 | spec->active_streams &= ~STREAM_INDEP_HP; | 1208 | spec->active_streams &= ~STREAM_INDEP_HP; |
1205 | mutex_unlock(&spec->config_mutex); | 1209 | mutex_unlock(&spec->config_mutex); |
1206 | vt1708_stop_hp_work(spec); | 1210 | vt1708_update_hp_work(spec); |
1207 | return 0; | 1211 | return 0; |
1208 | } | 1212 | } |
1209 | 1213 | ||
@@ -1645,7 +1649,8 @@ static void via_hp_automute(struct hda_codec *codec) | |||
1645 | int nums; | 1649 | int nums; |
1646 | struct via_spec *spec = codec->spec; | 1650 | struct via_spec *spec = codec->spec; |
1647 | 1651 | ||
1648 | if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0]) | 1652 | if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] && |
1653 | (spec->codec_type != VT1708 || spec->vt1708_jack_detect)) | ||
1649 | present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); | 1654 | present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); |
1650 | 1655 | ||
1651 | if (spec->smart51_enabled) | 1656 | if (spec->smart51_enabled) |
@@ -2612,8 +2617,6 @@ static int vt1708_jack_detect_get(struct snd_kcontrol *kcontrol, | |||
2612 | 2617 | ||
2613 | if (spec->codec_type != VT1708) | 2618 | if (spec->codec_type != VT1708) |
2614 | return 0; | 2619 | return 0; |
2615 | spec->vt1708_jack_detect = | ||
2616 | !((snd_hda_codec_read(codec, 0x1, 0, 0xf84, 0) >> 8) & 0x1); | ||
2617 | ucontrol->value.integer.value[0] = spec->vt1708_jack_detect; | 2620 | ucontrol->value.integer.value[0] = spec->vt1708_jack_detect; |
2618 | return 0; | 2621 | return 0; |
2619 | } | 2622 | } |
@@ -2623,18 +2626,22 @@ static int vt1708_jack_detect_put(struct snd_kcontrol *kcontrol, | |||
2623 | { | 2626 | { |
2624 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2625 | struct via_spec *spec = codec->spec; | 2628 | struct via_spec *spec = codec->spec; |
2626 | int change; | 2629 | int val; |
2627 | 2630 | ||
2628 | if (spec->codec_type != VT1708) | 2631 | if (spec->codec_type != VT1708) |
2629 | return 0; | 2632 | return 0; |
2630 | spec->vt1708_jack_detect = ucontrol->value.integer.value[0]; | 2633 | val = !!ucontrol->value.integer.value[0]; |
2631 | change = (0x1 & (snd_hda_codec_read(codec, 0x1, 0, 0xf84, 0) >> 8)) | 2634 | if (spec->vt1708_jack_detect == val) |
2632 | == !spec->vt1708_jack_detect; | 2635 | return 0; |
2633 | if (spec->vt1708_jack_detect) { | 2636 | spec->vt1708_jack_detect = val; |
2637 | if (spec->vt1708_jack_detect && | ||
2638 | snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") != 1) { | ||
2634 | mute_aa_path(codec, 1); | 2639 | mute_aa_path(codec, 1); |
2635 | notify_aa_path_ctls(codec); | 2640 | notify_aa_path_ctls(codec); |
2636 | } | 2641 | } |
2637 | return change; | 2642 | via_hp_automute(codec); |
2643 | vt1708_update_hp_work(spec); | ||
2644 | return 1; | ||
2638 | } | 2645 | } |
2639 | 2646 | ||
2640 | static const struct snd_kcontrol_new vt1708_jack_detect_ctl = { | 2647 | static const struct snd_kcontrol_new vt1708_jack_detect_ctl = { |
@@ -2771,6 +2778,7 @@ static int via_init(struct hda_codec *codec) | |||
2771 | via_auto_init_unsol_event(codec); | 2778 | via_auto_init_unsol_event(codec); |
2772 | 2779 | ||
2773 | via_hp_automute(codec); | 2780 | via_hp_automute(codec); |
2781 | vt1708_update_hp_work(spec); | ||
2774 | 2782 | ||
2775 | return 0; | 2783 | return 0; |
2776 | } | 2784 | } |
@@ -2787,7 +2795,9 @@ static void vt1708_update_hp_jack_state(struct work_struct *work) | |||
2787 | spec->vt1708_hp_present ^= 1; | 2795 | spec->vt1708_hp_present ^= 1; |
2788 | via_hp_automute(spec->codec); | 2796 | via_hp_automute(spec->codec); |
2789 | } | 2797 | } |
2790 | vt1708_start_hp_work(spec); | 2798 | if (spec->vt1708_jack_detect) |
2799 | schedule_delayed_work(&spec->vt1708_hp_work, | ||
2800 | msecs_to_jiffies(100)); | ||
2791 | } | 2801 | } |
2792 | 2802 | ||
2793 | static int get_mux_nids(struct hda_codec *codec) | 2803 | static int get_mux_nids(struct hda_codec *codec) |
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c index 5c8717e29eeb..8c3e7fcefd99 100644 --- a/sound/pci/lx6464es/lx_core.c +++ b/sound/pci/lx6464es/lx_core.c | |||
@@ -78,10 +78,15 @@ unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port) | |||
78 | return ioread32(address); | 78 | return ioread32(address); |
79 | } | 79 | } |
80 | 80 | ||
81 | void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, u32 len) | 81 | static void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, |
82 | u32 len) | ||
82 | { | 83 | { |
83 | void __iomem *address = lx_dsp_register(chip, port); | 84 | u32 __iomem *address = lx_dsp_register(chip, port); |
84 | memcpy_fromio(data, address, len*sizeof(u32)); | 85 | int i; |
86 | |||
87 | /* we cannot use memcpy_fromio */ | ||
88 | for (i = 0; i != len; ++i) | ||
89 | data[i] = ioread32(address + i); | ||
85 | } | 90 | } |
86 | 91 | ||
87 | 92 | ||
@@ -91,11 +96,15 @@ void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data) | |||
91 | iowrite32(data, address); | 96 | iowrite32(data, address); |
92 | } | 97 | } |
93 | 98 | ||
94 | void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, const u32 *data, | 99 | static void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, |
95 | u32 len) | 100 | const u32 *data, u32 len) |
96 | { | 101 | { |
97 | void __iomem *address = lx_dsp_register(chip, port); | 102 | u32 __iomem *address = lx_dsp_register(chip, port); |
98 | memcpy_toio(address, data, len*sizeof(u32)); | 103 | int i; |
104 | |||
105 | /* we cannot use memcpy_to */ | ||
106 | for (i = 0; i != len; ++i) | ||
107 | iowrite32(data[i], address + i); | ||
99 | } | 108 | } |
100 | 109 | ||
101 | 110 | ||
diff --git a/sound/pci/lx6464es/lx_core.h b/sound/pci/lx6464es/lx_core.h index 1dd562980b6c..4d7ff797a646 100644 --- a/sound/pci/lx6464es/lx_core.h +++ b/sound/pci/lx6464es/lx_core.h | |||
@@ -72,10 +72,7 @@ enum { | |||
72 | }; | 72 | }; |
73 | 73 | ||
74 | unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port); | 74 | unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port); |
75 | void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, u32 len); | ||
76 | void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data); | 75 | void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data); |
77 | void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, const u32 *data, | ||
78 | u32 len); | ||
79 | 76 | ||
80 | /* plx register access */ | 77 | /* plx register access */ |
81 | enum { | 78 | enum { |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index e760adad9523..19ee2203cbb5 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -6518,7 +6518,7 @@ static int __devinit snd_hdspm_create(struct snd_card *card, | |||
6518 | hdspm->io_type = AES32; | 6518 | hdspm->io_type = AES32; |
6519 | hdspm->card_name = "RME AES32"; | 6519 | hdspm->card_name = "RME AES32"; |
6520 | hdspm->midiPorts = 2; | 6520 | hdspm->midiPorts = 2; |
6521 | } else if ((hdspm->firmware_rev == 0xd5) || | 6521 | } else if ((hdspm->firmware_rev == 0xd2) || |
6522 | ((hdspm->firmware_rev >= 0xc8) && | 6522 | ((hdspm->firmware_rev >= 0xc8) && |
6523 | (hdspm->firmware_rev <= 0xcf))) { | 6523 | (hdspm->firmware_rev <= 0xcf))) { |
6524 | hdspm->io_type = MADI; | 6524 | hdspm->io_type = MADI; |
diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index 1ccf8dd47576..45c63028b40d 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c | |||
@@ -245,7 +245,7 @@ static const char *adau1373_bass_hpf_cutoff_text[] = { | |||
245 | }; | 245 | }; |
246 | 246 | ||
247 | static const unsigned int adau1373_bass_tlv[] = { | 247 | static const unsigned int adau1373_bass_tlv[] = { |
248 | TLV_DB_RANGE_HEAD(4), | 248 | TLV_DB_RANGE_HEAD(3), |
249 | 0, 2, TLV_DB_SCALE_ITEM(-600, 600, 1), | 249 | 0, 2, TLV_DB_SCALE_ITEM(-600, 600, 1), |
250 | 3, 4, TLV_DB_SCALE_ITEM(950, 250, 0), | 250 | 3, 4, TLV_DB_SCALE_ITEM(950, 250, 0), |
251 | 5, 7, TLV_DB_SCALE_ITEM(1400, 150, 0), | 251 | 5, 7, TLV_DB_SCALE_ITEM(1400, 150, 0), |
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index 23d1bd5dadda..69fde1506fe1 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c | |||
@@ -434,7 +434,8 @@ static int cs4271_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg) | |||
434 | { | 434 | { |
435 | int ret; | 435 | int ret; |
436 | /* Set power-down bit */ | 436 | /* Set power-down bit */ |
437 | ret = snd_soc_update_bits(codec, CS4271_MODE2, 0, CS4271_MODE2_PDN); | 437 | ret = snd_soc_update_bits(codec, CS4271_MODE2, CS4271_MODE2_PDN, |
438 | CS4271_MODE2_PDN); | ||
438 | if (ret < 0) | 439 | if (ret < 0) |
439 | return ret; | 440 | return ret; |
440 | return 0; | 441 | return 0; |
@@ -501,8 +502,9 @@ static int cs4271_probe(struct snd_soc_codec *codec) | |||
501 | return ret; | 502 | return ret; |
502 | } | 503 | } |
503 | 504 | ||
504 | ret = snd_soc_update_bits(codec, CS4271_MODE2, 0, | 505 | ret = snd_soc_update_bits(codec, CS4271_MODE2, |
505 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN); | 506 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN, |
507 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN); | ||
506 | if (ret < 0) | 508 | if (ret < 0) |
507 | return ret; | 509 | return ret; |
508 | ret = snd_soc_update_bits(codec, CS4271_MODE2, CS4271_MODE2_PDN, 0); | 510 | ret = snd_soc_update_bits(codec, CS4271_MODE2, CS4271_MODE2_PDN, 0); |
diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index 27a078cbb6eb..4646e808b90a 100644 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c | |||
@@ -177,7 +177,7 @@ static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -95625, 375, 0); | |||
177 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); | 177 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); |
178 | /* {0, +20, +24, +30, +35, +40, +44, +50, +52}dB */ | 178 | /* {0, +20, +24, +30, +35, +40, +44, +50, +52}dB */ |
179 | static unsigned int mic_bst_tlv[] = { | 179 | static unsigned int mic_bst_tlv[] = { |
180 | TLV_DB_RANGE_HEAD(6), | 180 | TLV_DB_RANGE_HEAD(7), |
181 | 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), | 181 | 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), |
182 | 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), | 182 | 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), |
183 | 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0), | 183 | 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0), |
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index d15695d1c273..bbcf921166f7 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -365,7 +365,7 @@ static const DECLARE_TLV_DB_SCALE(capture_6db_attenuate, -600, 600, 0); | |||
365 | 365 | ||
366 | /* tlv for mic gain, 0db 20db 30db 40db */ | 366 | /* tlv for mic gain, 0db 20db 30db 40db */ |
367 | static const unsigned int mic_gain_tlv[] = { | 367 | static const unsigned int mic_gain_tlv[] = { |
368 | TLV_DB_RANGE_HEAD(4), | 368 | TLV_DB_RANGE_HEAD(2), |
369 | 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), | 369 | 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), |
370 | 1, 3, TLV_DB_SCALE_ITEM(2000, 1000, 0), | 370 | 1, 3, TLV_DB_SCALE_ITEM(2000, 1000, 0), |
371 | }; | 371 | }; |
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index bb82408ab8e1..d2f37152f940 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c | |||
@@ -76,6 +76,8 @@ struct sta32x_priv { | |||
76 | 76 | ||
77 | unsigned int mclk; | 77 | unsigned int mclk; |
78 | unsigned int format; | 78 | unsigned int format; |
79 | |||
80 | u32 coef_shadow[STA32X_COEF_COUNT]; | ||
79 | }; | 81 | }; |
80 | 82 | ||
81 | static const DECLARE_TLV_DB_SCALE(mvol_tlv, -12700, 50, 1); | 83 | static const DECLARE_TLV_DB_SCALE(mvol_tlv, -12700, 50, 1); |
@@ -227,6 +229,7 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol, | |||
227 | struct snd_ctl_elem_value *ucontrol) | 229 | struct snd_ctl_elem_value *ucontrol) |
228 | { | 230 | { |
229 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 231 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
232 | struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); | ||
230 | int numcoef = kcontrol->private_value >> 16; | 233 | int numcoef = kcontrol->private_value >> 16; |
231 | int index = kcontrol->private_value & 0xffff; | 234 | int index = kcontrol->private_value & 0xffff; |
232 | unsigned int cfud; | 235 | unsigned int cfud; |
@@ -239,6 +242,11 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol, | |||
239 | snd_soc_write(codec, STA32X_CFUD, cfud); | 242 | snd_soc_write(codec, STA32X_CFUD, cfud); |
240 | 243 | ||
241 | snd_soc_write(codec, STA32X_CFADDR2, index); | 244 | snd_soc_write(codec, STA32X_CFADDR2, index); |
245 | for (i = 0; i < numcoef && (index + i < STA32X_COEF_COUNT); i++) | ||
246 | sta32x->coef_shadow[index + i] = | ||
247 | (ucontrol->value.bytes.data[3 * i] << 16) | ||
248 | | (ucontrol->value.bytes.data[3 * i + 1] << 8) | ||
249 | | (ucontrol->value.bytes.data[3 * i + 2]); | ||
242 | for (i = 0; i < 3 * numcoef; i++) | 250 | for (i = 0; i < 3 * numcoef; i++) |
243 | snd_soc_write(codec, STA32X_B1CF1 + i, | 251 | snd_soc_write(codec, STA32X_B1CF1 + i, |
244 | ucontrol->value.bytes.data[i]); | 252 | ucontrol->value.bytes.data[i]); |
@@ -252,6 +260,48 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol, | |||
252 | return 0; | 260 | return 0; |
253 | } | 261 | } |
254 | 262 | ||
263 | int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) | ||
264 | { | ||
265 | struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); | ||
266 | unsigned int cfud; | ||
267 | int i; | ||
268 | |||
269 | /* preserve reserved bits in STA32X_CFUD */ | ||
270 | cfud = snd_soc_read(codec, STA32X_CFUD) & 0xf0; | ||
271 | |||
272 | for (i = 0; i < STA32X_COEF_COUNT; i++) { | ||
273 | snd_soc_write(codec, STA32X_CFADDR2, i); | ||
274 | snd_soc_write(codec, STA32X_B1CF1, | ||
275 | (sta32x->coef_shadow[i] >> 16) & 0xff); | ||
276 | snd_soc_write(codec, STA32X_B1CF2, | ||
277 | (sta32x->coef_shadow[i] >> 8) & 0xff); | ||
278 | snd_soc_write(codec, STA32X_B1CF3, | ||
279 | (sta32x->coef_shadow[i]) & 0xff); | ||
280 | /* chip documentation does not say if the bits are | ||
281 | * self-clearing, so do it explicitly */ | ||
282 | snd_soc_write(codec, STA32X_CFUD, cfud); | ||
283 | snd_soc_write(codec, STA32X_CFUD, cfud | 0x01); | ||
284 | } | ||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | int sta32x_cache_sync(struct snd_soc_codec *codec) | ||
289 | { | ||
290 | unsigned int mute; | ||
291 | int rc; | ||
292 | |||
293 | if (!codec->cache_sync) | ||
294 | return 0; | ||
295 | |||
296 | /* mute during register sync */ | ||
297 | mute = snd_soc_read(codec, STA32X_MMUTE); | ||
298 | snd_soc_write(codec, STA32X_MMUTE, mute | STA32X_MMUTE_MMUTE); | ||
299 | sta32x_sync_coef_shadow(codec); | ||
300 | rc = snd_soc_cache_sync(codec); | ||
301 | snd_soc_write(codec, STA32X_MMUTE, mute); | ||
302 | return rc; | ||
303 | } | ||
304 | |||
255 | #define SINGLE_COEF(xname, index) \ | 305 | #define SINGLE_COEF(xname, index) \ |
256 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 306 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
257 | .info = sta32x_coefficient_info, \ | 307 | .info = sta32x_coefficient_info, \ |
@@ -661,7 +711,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec, | |||
661 | return ret; | 711 | return ret; |
662 | } | 712 | } |
663 | 713 | ||
664 | snd_soc_cache_sync(codec); | 714 | sta32x_cache_sync(codec); |
665 | } | 715 | } |
666 | 716 | ||
667 | /* Power up to mute */ | 717 | /* Power up to mute */ |
@@ -790,6 +840,17 @@ static int sta32x_probe(struct snd_soc_codec *codec) | |||
790 | STA32X_CxCFG_OM_MASK, | 840 | STA32X_CxCFG_OM_MASK, |
791 | 2 << STA32X_CxCFG_OM_SHIFT); | 841 | 2 << STA32X_CxCFG_OM_SHIFT); |
792 | 842 | ||
843 | /* initialize coefficient shadow RAM with reset values */ | ||
844 | for (i = 4; i <= 49; i += 5) | ||
845 | sta32x->coef_shadow[i] = 0x400000; | ||
846 | for (i = 50; i <= 54; i++) | ||
847 | sta32x->coef_shadow[i] = 0x7fffff; | ||
848 | sta32x->coef_shadow[55] = 0x5a9df7; | ||
849 | sta32x->coef_shadow[56] = 0x7fffff; | ||
850 | sta32x->coef_shadow[59] = 0x7fffff; | ||
851 | sta32x->coef_shadow[60] = 0x400000; | ||
852 | sta32x->coef_shadow[61] = 0x400000; | ||
853 | |||
793 | sta32x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 854 | sta32x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
794 | /* Bias level configuration will have done an extra enable */ | 855 | /* Bias level configuration will have done an extra enable */ |
795 | regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); | 856 | regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); |
diff --git a/sound/soc/codecs/sta32x.h b/sound/soc/codecs/sta32x.h index b97ee5a75667..d8e32a6262ee 100644 --- a/sound/soc/codecs/sta32x.h +++ b/sound/soc/codecs/sta32x.h | |||
@@ -19,6 +19,7 @@ | |||
19 | /* STA326 register addresses */ | 19 | /* STA326 register addresses */ |
20 | 20 | ||
21 | #define STA32X_REGISTER_COUNT 0x2d | 21 | #define STA32X_REGISTER_COUNT 0x2d |
22 | #define STA32X_COEF_COUNT 62 | ||
22 | 23 | ||
23 | #define STA32X_CONFA 0x00 | 24 | #define STA32X_CONFA 0x00 |
24 | #define STA32X_CONFB 0x01 | 25 | #define STA32X_CONFB 0x01 |
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 7e5ec03f6f8d..a7c9ae17fc7e 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -453,6 +453,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, | |||
453 | snd_soc_write(codec, WM8731_PWR, 0xffff); | 453 | snd_soc_write(codec, WM8731_PWR, 0xffff); |
454 | regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), | 454 | regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), |
455 | wm8731->supplies); | 455 | wm8731->supplies); |
456 | codec->cache_sync = 1; | ||
456 | break; | 457 | break; |
457 | } | 458 | } |
458 | codec->dapm.bias_level = level; | 459 | codec->dapm.bias_level = level; |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index a9504710bb69..3a629d0d690e 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -190,6 +190,9 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol, | |||
190 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 190 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
191 | u16 ioctl; | 191 | u16 ioctl; |
192 | 192 | ||
193 | if (wm8753->dai_func == ucontrol->value.integer.value[0]) | ||
194 | return 0; | ||
195 | |||
193 | if (codec->active) | 196 | if (codec->active) |
194 | return -EBUSY; | 197 | return -EBUSY; |
195 | 198 | ||
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 91d3c6dbeba3..53edd9a8c758 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -1973,7 +1973,7 @@ static int wm8962_reset(struct snd_soc_codec *codec) | |||
1973 | static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); | 1973 | static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); |
1974 | static const DECLARE_TLV_DB_SCALE(mixin_tlv, -1500, 300, 0); | 1974 | static const DECLARE_TLV_DB_SCALE(mixin_tlv, -1500, 300, 0); |
1975 | static const unsigned int mixinpga_tlv[] = { | 1975 | static const unsigned int mixinpga_tlv[] = { |
1976 | TLV_DB_RANGE_HEAD(7), | 1976 | TLV_DB_RANGE_HEAD(5), |
1977 | 0, 1, TLV_DB_SCALE_ITEM(0, 600, 0), | 1977 | 0, 1, TLV_DB_SCALE_ITEM(0, 600, 0), |
1978 | 2, 2, TLV_DB_SCALE_ITEM(1300, 1300, 0), | 1978 | 2, 2, TLV_DB_SCALE_ITEM(1300, 1300, 0), |
1979 | 3, 4, TLV_DB_SCALE_ITEM(1800, 200, 0), | 1979 | 3, 4, TLV_DB_SCALE_ITEM(1800, 200, 0), |
@@ -1988,7 +1988,7 @@ static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0); | |||
1988 | static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); | 1988 | static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); |
1989 | static const DECLARE_TLV_DB_SCALE(hp_tlv, -700, 100, 0); | 1989 | static const DECLARE_TLV_DB_SCALE(hp_tlv, -700, 100, 0); |
1990 | static const unsigned int classd_tlv[] = { | 1990 | static const unsigned int classd_tlv[] = { |
1991 | TLV_DB_RANGE_HEAD(7), | 1991 | TLV_DB_RANGE_HEAD(2), |
1992 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), | 1992 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), |
1993 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), | 1993 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), |
1994 | }; | 1994 | }; |
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index eec8e1435116..d1a142f48b09 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
@@ -512,7 +512,7 @@ static const DECLARE_TLV_DB_SCALE(drc_comp_threash, -4500, 75, 0); | |||
512 | static const DECLARE_TLV_DB_SCALE(drc_comp_amp, -2250, 75, 0); | 512 | static const DECLARE_TLV_DB_SCALE(drc_comp_amp, -2250, 75, 0); |
513 | static const DECLARE_TLV_DB_SCALE(drc_min_tlv, -1800, 600, 0); | 513 | static const DECLARE_TLV_DB_SCALE(drc_min_tlv, -1800, 600, 0); |
514 | static const unsigned int drc_max_tlv[] = { | 514 | static const unsigned int drc_max_tlv[] = { |
515 | TLV_DB_RANGE_HEAD(4), | 515 | TLV_DB_RANGE_HEAD(2), |
516 | 0, 2, TLV_DB_SCALE_ITEM(1200, 600, 0), | 516 | 0, 2, TLV_DB_SCALE_ITEM(1200, 600, 0), |
517 | 3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0), | 517 | 3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0), |
518 | }; | 518 | }; |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 3cd35a02c28c..4a398c3bfe84 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -807,7 +807,6 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
807 | mdelay(100); | 807 | mdelay(100); |
808 | 808 | ||
809 | /* Normal bias enable & soft start off */ | 809 | /* Normal bias enable & soft start off */ |
810 | reg |= WM9081_BIAS_ENA; | ||
811 | reg &= ~WM9081_VMID_RAMP; | 810 | reg &= ~WM9081_VMID_RAMP; |
812 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); | 811 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); |
813 | 812 | ||
@@ -818,7 +817,7 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
818 | } | 817 | } |
819 | 818 | ||
820 | /* VMID 2*240k */ | 819 | /* VMID 2*240k */ |
821 | reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); | 820 | reg = snd_soc_read(codec, WM9081_VMID_CONTROL); |
822 | reg &= ~WM9081_VMID_SEL_MASK; | 821 | reg &= ~WM9081_VMID_SEL_MASK; |
823 | reg |= 0x04; | 822 | reg |= 0x04; |
824 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); | 823 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); |
@@ -830,14 +829,15 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
830 | break; | 829 | break; |
831 | 830 | ||
832 | case SND_SOC_BIAS_OFF: | 831 | case SND_SOC_BIAS_OFF: |
833 | /* Startup bias source */ | 832 | /* Startup bias source and disable bias */ |
834 | reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); | 833 | reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); |
835 | reg |= WM9081_BIAS_SRC; | 834 | reg |= WM9081_BIAS_SRC; |
835 | reg &= ~WM9081_BIAS_ENA; | ||
836 | snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); | 836 | snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); |
837 | 837 | ||
838 | /* Disable VMID and biases with soft ramping */ | 838 | /* Disable VMID with soft ramping */ |
839 | reg = snd_soc_read(codec, WM9081_VMID_CONTROL); | 839 | reg = snd_soc_read(codec, WM9081_VMID_CONTROL); |
840 | reg &= ~(WM9081_VMID_SEL_MASK | WM9081_BIAS_ENA); | 840 | reg &= ~WM9081_VMID_SEL_MASK; |
841 | reg |= WM9081_VMID_RAMP; | 841 | reg |= WM9081_VMID_RAMP; |
842 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); | 842 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); |
843 | 843 | ||
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 2b5252c9e377..f94c06057c64 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c | |||
@@ -177,19 +177,19 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec) | |||
177 | } | 177 | } |
178 | 178 | ||
179 | static const unsigned int in_tlv[] = { | 179 | static const unsigned int in_tlv[] = { |
180 | TLV_DB_RANGE_HEAD(6), | 180 | TLV_DB_RANGE_HEAD(3), |
181 | 0, 0, TLV_DB_SCALE_ITEM(-600, 0, 0), | 181 | 0, 0, TLV_DB_SCALE_ITEM(-600, 0, 0), |
182 | 1, 3, TLV_DB_SCALE_ITEM(-350, 350, 0), | 182 | 1, 3, TLV_DB_SCALE_ITEM(-350, 350, 0), |
183 | 4, 6, TLV_DB_SCALE_ITEM(600, 600, 0), | 183 | 4, 6, TLV_DB_SCALE_ITEM(600, 600, 0), |
184 | }; | 184 | }; |
185 | static const unsigned int mix_tlv[] = { | 185 | static const unsigned int mix_tlv[] = { |
186 | TLV_DB_RANGE_HEAD(4), | 186 | TLV_DB_RANGE_HEAD(2), |
187 | 0, 2, TLV_DB_SCALE_ITEM(-1200, 300, 0), | 187 | 0, 2, TLV_DB_SCALE_ITEM(-1200, 300, 0), |
188 | 3, 3, TLV_DB_SCALE_ITEM(0, 0, 0), | 188 | 3, 3, TLV_DB_SCALE_ITEM(0, 0, 0), |
189 | }; | 189 | }; |
190 | static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); | 190 | static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); |
191 | static const unsigned int spkboost_tlv[] = { | 191 | static const unsigned int spkboost_tlv[] = { |
192 | TLV_DB_RANGE_HEAD(7), | 192 | TLV_DB_RANGE_HEAD(2), |
193 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), | 193 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), |
194 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), | 194 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), |
195 | }; | 195 | }; |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 84f33d4ea2cd..48e61e912400 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -40,7 +40,7 @@ static const DECLARE_TLV_DB_SCALE(outmix_tlv, -2100, 300, 0); | |||
40 | static const DECLARE_TLV_DB_SCALE(spkmixout_tlv, -1800, 600, 1); | 40 | static const DECLARE_TLV_DB_SCALE(spkmixout_tlv, -1800, 600, 1); |
41 | static const DECLARE_TLV_DB_SCALE(outpga_tlv, -5700, 100, 0); | 41 | static const DECLARE_TLV_DB_SCALE(outpga_tlv, -5700, 100, 0); |
42 | static const unsigned int spkboost_tlv[] = { | 42 | static const unsigned int spkboost_tlv[] = { |
43 | TLV_DB_RANGE_HEAD(7), | 43 | TLV_DB_RANGE_HEAD(2), |
44 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), | 44 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), |
45 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), | 45 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), |
46 | }; | 46 | }; |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 0268cf989736..83c4bd5b2dd7 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -694,6 +694,7 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev) | |||
694 | 694 | ||
695 | /* Initialize the the device_attribute structure */ | 695 | /* Initialize the the device_attribute structure */ |
696 | dev_attr = &ssi_private->dev_attr; | 696 | dev_attr = &ssi_private->dev_attr; |
697 | sysfs_attr_init(&dev_attr->attr); | ||
697 | dev_attr->attr.name = "statistics"; | 698 | dev_attr->attr.name = "statistics"; |
698 | dev_attr->attr.mode = S_IRUGO; | 699 | dev_attr->attr.mode = S_IRUGO; |
699 | dev_attr->show = fsl_sysfs_ssi_show; | 700 | dev_attr->show = fsl_sysfs_ssi_show; |