diff --git a/bcwc_hw.c b/bcwc_hw.c index 572159e..68ac35a 100644 --- a/bcwc_hw.c +++ b/bcwc_hw.c @@ -754,6 +754,12 @@ int bcwc_hw_init(struct bcwc_private *dev_priv) /* Save our working configuration */ bcwc_hw_ddr_phy_save_regs(dev_priv); + BCWC_S2_REG_WRITE(0x8, S2_D108); + BCWC_S2_REG_WRITE(0xc, S2_D104); + + BCWC_ISP_REG_WRITE(0, ISP_REG_40004); + + isp_init(dev_priv); out: return ret; diff --git a/bcwc_reg.h b/bcwc_reg.h index addbbb2..ada85d3 100644 --- a/bcwc_reg.h +++ b/bcwc_reg.h @@ -20,6 +20,10 @@ #define S2_PCIE_LINK_D128 0xd128 #define S2_PCIE_LINK_D12C 0xd12c +/* Unknown */ +#define S2_D104 0xd104 +#define S2_D108 0xd108 + /* These are written to 0x203 before DDR soc init */ #define S2_DDR_REG_1100 0x1100 #define S2_DDR_REG_1104 0x1104 diff --git a/isp.c b/isp.c index bb85cc3..c1425c1 100644 --- a/isp.c +++ b/isp.c @@ -11,11 +11,57 @@ */ #include +#include #include "bcwc_drv.h" #include "bcwc_hw.h" #include "bcwc_reg.h" #include "isp.h" +int isp_acpi_set_power(struct bcwc_private *dev_priv, int power) +{ + acpi_status status; + acpi_handle handle; + struct acpi_object_list arg_list; + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + union acpi_object args[1]; + union acpi_object *result; + int ret = 0; + + status = acpi_get_handle(NULL, "\\_SB.PCI0.RP02.CMRA.CMPE", &handle); + if (ACPI_FAILURE(status)) { + dev_err(&dev_priv->pdev->dev, + "Failed to get S2 CMPE ACPI handle\n"); + ret = -ENODEV; + goto out; + } + + args[0].type = ACPI_TYPE_INTEGER; + args[0].integer.value = power; + + arg_list.count = 1; + arg_list.pointer = args; + + status = acpi_evaluate_object(handle, NULL, &arg_list, &buffer); + if (ACPI_FAILURE(status)) { + dev_err(&dev_priv->pdev->dev, + "Failed to execute S2 CMPE ACPI method\n"); + ret = -ENODEV; + goto out; + } + + result = buffer.pointer; + + if (result->type != ACPI_TYPE_INTEGER || result->integer.value != 0) { + dev_err(&dev_priv->pdev->dev, + "Invalid ACPI response (len: %Ld)\n", buffer.length); + ret = -EINVAL; + } + +out: + kfree(buffer.pointer); + return ret; +} + int isp_init(struct bcwc_private *dev_priv) { u32 num_channels, queue_size;