drm/i915: Get the i2c bus number from the ACPI
Subsystems (2)
PATCH 1/1 drm/i915: Get the i2c bus number from the ACPI
Currently for executing the i2c MIPI sequence, we are relaying on the i2c bus bunmber which is specified in the VBT.
--- drivers/gpu/drm/i915/i915_dma.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 7 ++++++ drivers/gpu/drm/i915/intel_acpi.c | 49 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +2 -0
@@ -387,6 +387,8 @@ static int i915_load_modeset_init(struct drm_device *dev)intel_register_dsm_handler (); +intel_acpi_find_i2c (dev_priv); + ret =vga_switcheroo_register_client (dev->pdev, &i915_switcheroo_ops, false);if (ret) goto cleanup_vga_client;
drivers/gpu/drm/i915/i915_drv.h +7 -0
@@ -47,6 +47,7 @@#include <drm/intel-gtt.h> #include <drm/drm_legacy.h> /* for struct drm_dma_handle */ #include <drm/drm_gem.h> +#include <linux/acpi.h> #include <linux/backlight.h> #include <linux/hashtable.h> #include <linux/intel-iommu.h>
@@ -1880,6 +1881,11 @@ struct drm_i915_private {struct i915_workarounds workarounds; +struct { +int i2c_bus_number; +int i2c_slave_address; + } acpi_data; +/* Reclocking support */ bool render_reclock_avail;
@@ -3426,6 +3432,7 @@ intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)#ifdef CONFIG_ACPI extern void intel_register_dsm_handler (void );extern void intel_unregister_dsm_handler (void ); +extern acpi_status intel_acpi_find_i2c (struct drm_i915_private *dev_priv);#else static inline void intel_register_dsm_handler (void ) {return ; }static inline void intel_unregister_dsm_handler (void ) {return ; }
drivers/gpu/drm/i915/intel_acpi.c +49 -0
55 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
This patch reads the i2c bus number from the _CRS table of the display module of the ACPI, which will be updated by the BIOS with the i2c info which is used for this module.
Quoted 124 lines
-----Original Message-----
From: Deepak, M
Sent: Friday, February 19, 2016 7:26 PM
To: [email protected]
Cc: Deepak, M <[email protected]>
Subject: [PATCH] drm/i915: Get the i2c bus number from the ACPICurrently for executing the i2c MIPI sequence, we are relaying on the i2c bus bunmber which is specified in the VBT.
Signed-off-by Deepak M <[email protected]>--- drivers/gpu/drm/i915/i915_dma.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 7 ++++++ drivers/gpu/drm/i915/intel_acpi.c | 49 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_dma.cindex 1c6d227..8cd1d9d 100644drivers/gpu/drm/i915/i915_dma.c +2
-0@@ -387,6 +387,8 @@ static int i915_load_modeset_init(struct drm_device *dev)intel_register_dsm_handler (); +intel_acpi_find_i2c (dev_priv); + ret =vga_switcheroo_register_client (dev->pdev, &i915_switcheroo_ops, false);drivers/gpu/drm/i915/i915_dma.c +0
-0if (ret) goto cleanup_vga_client;(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_drv.hindex 6644c2e..6fe8b64 100644drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -47,6 +47,7 @@#include <drm/intel-gtt.h> #include <drm/drm_legacy.h> /* for struct drm_dma_handle */ #include<
drm/drm_gem.h>drivers/gpu/drm/i915/i915_drv.h +6
-0+#include <linux/acpi.h> #include <linux/backlight.h> #include <linux/hashtable.h> #include <linux/intel-iommu.h> @@ -1880,6 +1881,11 @@ struct drm_i915_private {struct i915_workarounds workarounds; +struct { +int i2c_bus_number; +int i2c_slave_address; + } acpi_data; +/* Reclocking support */ bool render_reclock_avail;@@ -3426,6 +3432,7 @@ intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state) #ifdef CONFIG_ACPI extern void
intel_register_dsm_handler(void); extern voidintel_unregister_dsm_handler(void);drivers/gpu/drm/i915/i915_drv.h +2
-0+extern acpi_status intel_acpi_find_i2c (struct drm_i915_private +*dev_priv);#else static inline void intel_register_dsm_handler(void) { return; } static inlinevoid
intel_unregister_dsm_handler(void){ return; } diff --gita/drivers/gpu/drm/i915/intel_acpi.cb/drivers/gpu/drm/i915/intel_acpi.cindex eb638a1..f62be5c 100644drivers/gpu/drm/i915/intel_acpi.c +47
-1@@ -110,6 +110,55 @@ static void intel_dsm_platform_mux_info(void)ACPI_FREE (pkg); } +static int i2c_acpi_get_name (struct acpi_resource *ares,void *data) { +struct drm_i915_private *dev_priv = data; +struct acpi_resource_i2c_serialbus *sb; +unsigned int val; +char *resource; +int error; + +if (ares->type ==ACPI_RESOURCE_TYPE_SERIAL_BUS ) { + sb = &ares->data.i2c_serial_bus; + +if (sb->type ==ACPI_RESOURCE_SERIAL_TYPE_I2C ) { + resource = sb->resource_source.string_ptr; + resource =strstr (resource,"I2C" ); + error =kstrtouint (resource+3 ,0 , &val); +if (error) +return error; + dev_priv->acpi_data.i2c_bus_number = val; + dev_priv->acpi_data.i2c_slave_address = + sb->slave_address; + } + } +return 1 ; +} + +acpi_status intel_acpi_find_i2c (struct drm_i915_private *dev_priv) { +struct pci_dev *pdev = dev_priv->dev->pdev; +struct list_head resource_list; +struct acpi_device *adev; +acpi_handle dhandle; + + dhandle =ACPI_HANDLE (&pdev->dev); +if (!dhandle) +return false; + +if (acpi_bus_get_device (dhandle, &adev)) +return AE_OK ; +if (acpi_bus_get_status (adev) || !adev->status.present) +return AE_OK ; + +INIT_LIST_HEAD (&resource_list); +acpi_dev_get_resources (adev, &resource_list, + i2c_acpi_get_name, dev_priv); +acpi_dev_free_resource_list (&resource_list); + +return AE_OK ; +} +static bool intel_dsm_pci_probe (struct pci_dev *pdev) {acpi_handle dhandle; --
Quoted 1 line
1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 37 lines · Deepak M
Currently for executing the i2c MIPI sequence, we are relaying on the i2c bus bunmber which is specified in the VBT.
Signed-off-by Deepak M <[email protected]>--- drivers/gpu/drm/i915/i915_dma.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 7 ++++++ drivers/gpu/drm/i915/intel_acpi.c | 49 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+)drivers/gpu/drm/i915/i915_dma.c +2
-0@@ -387,6 +387,8 @@ static int i915_load_modeset_init(struct drm_device *dev)intel_register_dsm_handler (); +intel_acpi_find_i2c (dev_priv); + ret =vga_switcheroo_register_client (dev->pdev, &i915_switcheroo_ops, false);if (ret) goto cleanup_vga_client;drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -47,6 +47,7 @@#include <drm/intel-gtt.h> #include <drm/drm_legacy.h> /* for struct drm_dma_handle */ #include <drm/drm_gem.h> +#include <linux/acpi.h> #include <linux/backlight.h> #include <linux/hashtable.h> #include <linux/intel-iommu.h>
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 1887
Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.h +4
-0@@ -1880,6 +1881,11 @@ struct drm_i915_private {struct i915_workarounds workarounds; +struct { +int i2c_bus_number; +int i2c_slave_address; + } acpi_data;
The naming is rather vague. i2c bus for what?
Also is one bus always enough? The VBT i2c stuff could use multiple i2c busses. Also how do we map this to the bus number that the VBT has?
Quoted 79 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+/* Reclocking support */ bool render_reclock_avail;@@ -3426,6 +3432,7 @@ intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)#ifdef CONFIG_ACPI extern void intel_register_dsm_handler (void );extern void intel_unregister_dsm_handler (void ); +extern acpi_status intel_acpi_find_i2c (struct drm_i915_private *dev_priv);#else static inline void intel_register_dsm_handler (void ) {return ; }static inline void intel_unregister_dsm_handler (void ) {return ; }drivers/gpu/drm/i915/intel_acpi.c +49
-0@@ -110,6 +110,55 @@ static void intel_dsm_platform_mux_info(void)ACPI_FREE (pkg); } +static int i2c_acpi_get_name (struct acpi_resource *ares,void *data) +{ +struct drm_i915_private *dev_priv = data; +struct acpi_resource_i2c_serialbus *sb; +unsigned int val; +char *resource; +int error; + +if (ares->type ==ACPI_RESOURCE_TYPE_SERIAL_BUS ) { + sb = &ares->data.i2c_serial_bus; + +if (sb->type ==ACPI_RESOURCE_SERIAL_TYPE_I2C ) { + resource = sb->resource_source.string_ptr; + resource =strstr (resource,"I2C" ); + error =kstrtouint (resource+3 ,0 , &val); +if (error) +return error; + dev_priv->acpi_data.i2c_bus_number = val; + dev_priv->acpi_data.i2c_slave_address = + sb->slave_address; + } + } +return 1 ; +} + +acpi_status intel_acpi_find_i2c (struct drm_i915_private *dev_priv) +{ +struct pci_dev *pdev = dev_priv->dev->pdev; +struct list_head resource_list; +struct acpi_device *adev; +acpi_handle dhandle; + + dhandle =ACPI_HANDLE (&pdev->dev); +if (!dhandle) +return false; + +if (acpi_bus_get_device (dhandle, &adev)) +return AE_OK ; +if (acpi_bus_get_status (adev) || !adev->status.present) +return AE_OK ; + +INIT_LIST_HEAD (&resource_list); +acpi_dev_get_resources (adev, &resource_list, + i2c_acpi_get_name, dev_priv); +acpi_dev_free_resource_list (&resource_list); + +return AE_OK ; +} +static bool intel_dsm_pci_probe (struct pci_dev *pdev) {acpi_handle dhandle;Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 60 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, February 19, 2016 7:38 PM
To: Deepak, M <[email protected]>
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Get the i2c bus number from the ACPIQuoted 16 lines · Deepak M
Currently for executing the i2c MIPI sequence, we are relaying on the i2c bus bunmber which is specified in the VBT.
Signed-off-by Deepak M <[email protected]>--- drivers/gpu/drm/i915/i915_dma.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 7 ++++++ drivers/gpu/drm/i915/intel_acpi.c | 49 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_dma.cindex 1c6d227..8cd1d9d 100644drivers/gpu/drm/i915/i915_dma.c static int i915_load_modeset_init(struct · line 393
Quoted 7 lines
drivers/gpu/drm/i915/i915_dma.c +2
-0@@ -387,6 +387,8 @@ static int i915_load_modeset_init(struct drm_device *dev)intel_register_dsm_handler (); +intel_acpi_find_i2c (dev_priv); + ret = vga_switcheroo_register_client(dev->pdev,
&i915_switcheroo_ops, false);Quoted 15 lines
drivers/gpu/drm/i915/i915_dma.c +0
-0if (ret)drivers/gpu/drm/i915/i915_dma.c +0
-0goto cleanup_vga_client;(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_drv.hindex 6644c2e..6fe8b64 100644drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -47,6 +47,7 @@#include <drm/intel-gtt.h> #include <drm/drm_legacy.h> /* for struct drm_dma_handle */ #include<
drm/drm_gem.h>drivers/gpu/drm/i915/i915_drv.h +1
-0+#include <linux/acpi.h> #include <linux/backlight.h> #include <linux/hashtable.h> #include <linux/intel-iommu.h> drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 1887
Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.h +4
-0@@ -1880,6 +1881,11 @@ struct drm_i915_private {struct i915_workarounds workarounds; +struct { +int i2c_bus_number; +int i2c_slave_address; + } acpi_data;The naming is rather vague. i2c bus for what?
Quoted 3 lines
Also is one bus always enough? The VBT i2c stuff could use multiple i2c busses. Also how do we map this to the bus number that the VBT has?
[Deepak, M] Most of the cases I have seen only one i2c being used, If there are multiple i2c busses used then need to check which i2c is used for what purpose and is there a protocol which is followed by BIOS team when more than one i2c bus is used.
Quoted 76 lines
drivers/gpu/drm/i915/i915_drv.h intel_opregion_notify_adapter(struct
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0+/* Reclocking support */ bool render_reclock_avail;@@ -3426,6 +3432,7 @@ intel_opregion_notify_adapter(struct
drm_deviceQuoted 70 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0*dev, pci_power_t state) #ifdef CONFIG_ACPI extern void
intel_register_dsm_handler(void); extern voidintel_unregister_dsm_handler(void);drivers/gpu/drm/i915/i915_drv.h +2
-0+extern acpi_status intel_acpi_find_i2c (struct drm_i915_private +*dev_priv);#else static inline void intel_register_dsm_handler (void ) {return ; }static inline void
intel_unregister_dsm_handler(void){ return; } diff --gita/drivers/gpu/drm/i915/intel_acpi.cb/drivers/gpu/drm/i915/intel_acpi.c
index eb638a1..f62be5c 100644drivers/gpu/drm/i915/intel_acpi.c +48
-1@@ -110,6 +110,55 @@ static void intel_dsm_platform_mux_info(void)ACPI_FREE (pkg); } +static int i2c_acpi_get_name (struct acpi_resource *ares,void *data) +{ +struct drm_i915_private *dev_priv = data; +struct acpi_resource_i2c_serialbus *sb; +unsigned int val; +char *resource; +int error; + +if (ares->type ==ACPI_RESOURCE_TYPE_SERIAL_BUS ) { + sb = &ares->data.i2c_serial_bus; + +if (sb->type ==ACPI_RESOURCE_SERIAL_TYPE_I2C ) { + resource = sb->resource_source.string_ptr; + resource =strstr (resource,"I2C" ); + error =kstrtouint (resource+3 ,0 , &val); +if (error) +return error; + dev_priv->acpi_data.i2c_bus_number = val; + dev_priv->acpi_data.i2c_slave_address = + sb->slave_address; + } + } +return 1 ; +} + +acpi_status intel_acpi_find_i2c (struct drm_i915_private *dev_priv) { +struct pci_dev *pdev = dev_priv->dev->pdev; +struct list_head resource_list; +struct acpi_device *adev; +acpi_handle dhandle; + + dhandle =ACPI_HANDLE (&pdev->dev); +if (!dhandle) +return false; + +if (acpi_bus_get_device (dhandle, &adev)) +return AE_OK ; +if (acpi_bus_get_status (adev) || !adev->status.present) +return AE_OK ; + +INIT_LIST_HEAD (&resource_list); +acpi_dev_get_resources (adev, &resource_list, + i2c_acpi_get_name, dev_priv); +acpi_dev_free_resource_list (&resource_list); + +return AE_OK ; +} +static bool intel_dsm_pci_probe (struct pci_dev *pdev) {acpi_handle dhandle; --1.9.1
Quoted 8 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Get the i2c bus number from the ACPI
In reply to Deepak M== Summary ==
== Summary ==
Series 3628v1 drm/i915: Get the i2c bus number from the ACPI
http://patchwork.freedesktop.org/api/1.0/series/3628/revisions/1/mbox/
Test kms_flip:
Subgroup basic-flip-vs-dpms:
incomplete -> PASS (ilk-hp8440p) UNSTABLE
Test kms_force_connector_basic:
Subgroup force-load-detect:
dmesg-fail -> FAIL (snb-dellxps)
Test pm_rpm:
Subgroup basic-pci-d3-state:
dmesg-warn -> PASS (bsw-nuc-2)bdw-nuci7 total:164 pass:153 dwarn:0 dfail:0 fail:0 skip:11 bdw-ultra total:167 pass:153 dwarn:0 dfail:0 fail:0 skip:14 bsw-nuc-2 total:167 pass:137 dwarn:0 dfail:0 fail:0 skip:30 byt-nuc total:167 pass:142 dwarn:0 dfail:0 fail:0 skip:25 hsw-gt2 total:167 pass:156 dwarn:0 dfail:1 fail:0 skip:10 ilk-hp8440p total:167 pass:118 dwarn:0 dfail:0 fail:1 skip:48 ivb-t430s total:167 pass:152 dwarn:0 dfail:0 fail:1 skip:14 skl-i5k-2 total:167 pass:150 dwarn:1 dfail:0 fail:0 skip:16 snb-dellxps total:167 pass:144 dwarn:0 dfail:0 fail:1 skip:22
Results at /archive/results/CI_IGT_test/Patchwork_1446/
e7d04bf9d65001191a0b64e322bffa713280d132 drm-intel-nightly: 2016y-02m-19d-13h-11m-43s UTC integration manifest f588a24f4da1bd06f8cd905f97eeaee8163712dc drm/i915: Get the i2c bus number from the ACPI
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx