All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Vivek Kasireddy <vivek.kasireddy@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Hulk Robot <hulkci@huawei.com>, Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/dsi: Lookup the i2c bus from ACPI NS only if CONFIG_ACPI=y (v3)
Date: Fri, 17 Jan 2020 13:24:26 +0200	[thread overview]
Message-ID: <8736ceiavp.fsf@intel.com> (raw)
In-Reply-To: <20200115205704.22674-1-vivek.kasireddy@intel.com>

On Wed, 15 Jan 2020, Vivek Kasireddy <vivek.kasireddy@intel.com> 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.
>
> v2: Clearly identify the commit this patch is fixing (Jani)
>
> v3: Remove the i2c_bus_num >= 0 check from the adapter lookup function
> as this would prevent ACPI bus number override. This check was mainly
> there to return early if the bus number has already been found but we
> anyway return in the next line if the slave address does not match.
>
> Fixes: 8cbf89db2941 ("drm/i915/dsi: Parse the I2C element from the VBT MIPI sequence block (v3)")
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: Bob Paauwe <bob.j.paauwe@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 50 +++++++++++++-------
>  1 file changed, 32 insertions(+), 18 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..04f953ba8f00 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;
> @@ -393,8 +394,7 @@ static int i2c_adapter_lookup(struct acpi_resource *ares, void *data)
>  	acpi_handle adapter_handle;
>  	acpi_status status;
>  
> -	if (intel_dsi->i2c_bus_num >= 0 ||
> -	    !i2c_acpi_get_i2c_resource(ares, &sb))
> +	if (!i2c_acpi_get_i2c_resource(ares, &sb))
>  		return 1;

The above hunk turns v3 of the patch from a straightforward build fix
into a functional change. They *must* be separate.

I've pushed v2 into drm-intel-next-queued, please send the above change
as a standalone fix that it rightly is, with its own commit message and
rationale.

BR,
Jani.



>  
>  	if (lookup->slave_addr != sb->slave_address)
> @@ -413,14 +413,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 +458,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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-01-17 11:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15  1:23 [Intel-gfx] [PATCH] drm/i915/dsi: Lookup the i2c bus from ACPI NS only if CONFIG_ACPI=y (v2) Vivek Kasireddy
2020-01-15  2:15 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-01-15  2:15 ` [Intel-gfx] ✗ Fi.CI.BUILD: warning " Patchwork
2020-01-15  8:53 ` [Intel-gfx] [PATCH] " Jani Nikula
2020-01-15 20:57   ` [Intel-gfx] [PATCH] drm/i915/dsi: Lookup the i2c bus from ACPI NS only if CONFIG_ACPI=y (v3) Vivek Kasireddy
2020-01-17 11:24     ` Jani Nikula [this message]
2020-01-15 22:31 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/dsi: Lookup the i2c bus from ACPI NS only if CONFIG_ACPI=y (v2) (rev2) Patchwork
2020-01-15 22:31 ` [Intel-gfx] ✗ Fi.CI.BUILD: warning " Patchwork
2020-01-17  7:17 ` [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/dsi: Lookup the i2c bus from ACPI NS only if CONFIG_ACPI=y (v2) Patchwork
2020-01-18 12:10 ` [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/dsi: Lookup the i2c bus from ACPI NS only if CONFIG_ACPI=y (v2) (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736ceiavp.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=hulkci@huawei.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=vivek.kasireddy@intel.com \
    --cc=zhangxiaoxu5@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.