Re: [PATCH] drm/i915/dsi: Lookup the i2c bus from ACPI NS only if CONFIG_ACPI=y

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 13 Jan 2020, Vivek Kasireddy <vivek.kasireddy@xxxxxxxxx> wrote:
> Perform the i2c bus/adapter lookup from ACPI Namespace only if
> ACPI is enabled in the kernel config. If ACPI is not enabled or if
> the lookup fails, we'll fallback to using the VBT for identiying
> the i2c bus.
>
> This fixes commit 8cbf89db2941("drm/i915/dsi: Parse the I2C element
> from the VBT MIPI sequence block (v3).")

IOW,

Fixes: 8cbf89db2941 ("drm/i915/dsi: Parse the I2C element from the VBT MIPI sequence block (v3)")

Also, please post as a fresh patch, not in reply in the middle of a
thread, to not confuse CI.

BR,
Jani.


>
> Cc: Hans de Goede <hdegoede@xxxxxxxxxx>
> Cc: Nabendu Maiti <nabendu.bikash.maiti@xxxxxxxxx>
> Cc: Matt Roper <matthew.d.roper@xxxxxxxxx>
> Cc: Bob Paauwe <bob.j.paauwe@xxxxxxxxx>
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> Cc: Zhang Xiaoxu <zhangxiaoxu5@xxxxxxxxxx>
> Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 47 +++++++++++++-------
>  1 file changed, 31 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
> index 89fb0d90b694..6ec35d975bd7 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
> +++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
> @@ -384,6 +384,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>  	return data;
>  }
>  
> +#ifdef CONFIG_ACPI
>  static int i2c_adapter_lookup(struct acpi_resource *ares, void *data)
>  {
>  	struct i2c_adapter_lookup *lookup = data;
> @@ -413,14 +414,41 @@ static int i2c_adapter_lookup(struct acpi_resource *ares, void *data)
>  	return 1;
>  }
>  
> -static const u8 *mipi_exec_i2c(struct intel_dsi *intel_dsi, const u8 *data)
> +static void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
> +				  const u16 slave_addr)
>  {
>  	struct drm_device *drm_dev = intel_dsi->base.base.dev;
>  	struct device *dev = &drm_dev->pdev->dev;
> -	struct i2c_adapter *adapter;
>  	struct acpi_device *acpi_dev;
>  	struct list_head resource_list;
>  	struct i2c_adapter_lookup lookup;
> +
> +	acpi_dev = ACPI_COMPANION(dev);
> +	if (acpi_dev) {
> +		memset(&lookup, 0, sizeof(lookup));
> +		lookup.slave_addr = slave_addr;
> +		lookup.intel_dsi = intel_dsi;
> +		lookup.dev_handle = acpi_device_handle(acpi_dev);
> +
> +		INIT_LIST_HEAD(&resource_list);
> +		acpi_dev_get_resources(acpi_dev, &resource_list,
> +				       i2c_adapter_lookup,
> +				       &lookup);
> +		acpi_dev_free_resource_list(&resource_list);
> +	}
> +}
> +#else
> +static inline void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
> +					 const u16 slave_addr)
> +{
> +}
> +#endif
> +
> +static const u8 *mipi_exec_i2c(struct intel_dsi *intel_dsi, const u8 *data)
> +{
> +	struct drm_device *drm_dev = intel_dsi->base.base.dev;
> +	struct device *dev = &drm_dev->pdev->dev;
> +	struct i2c_adapter *adapter;
>  	struct i2c_msg msg;
>  	int ret;
>  	u8 vbt_i2c_bus_num = *(data + 2);
> @@ -431,20 +459,7 @@ static const u8 *mipi_exec_i2c(struct intel_dsi *intel_dsi, const u8 *data)
>  
>  	if (intel_dsi->i2c_bus_num < 0) {
>  		intel_dsi->i2c_bus_num = vbt_i2c_bus_num;
> -
> -		acpi_dev = ACPI_COMPANION(dev);
> -		if (acpi_dev) {
> -			memset(&lookup, 0, sizeof(lookup));
> -			lookup.slave_addr = slave_addr;
> -			lookup.intel_dsi = intel_dsi;
> -			lookup.dev_handle = acpi_device_handle(acpi_dev);
> -
> -			INIT_LIST_HEAD(&resource_list);
> -			acpi_dev_get_resources(acpi_dev, &resource_list,
> -					       i2c_adapter_lookup,
> -					       &lookup);
> -			acpi_dev_free_resource_list(&resource_list);
> -		}
> +		i2c_acpi_find_adapter(intel_dsi, slave_addr);
>  	}
>  
>  	adapter = i2c_get_adapter(intel_dsi->i2c_bus_num);

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux