X86 platform drivers
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Mark Gross <markgross@kernel.org>,
	Andy Shevchenko <andy@infradead.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] platform/x86: x86-android-tablets: New driver for x86 Android tablets
Date: Tue, 21 Dec 2021 20:05:33 +0100	[thread overview]
Message-ID: <74a71e6c-1ee3-20ce-4ac6-0abfccda79dc@redhat.com> (raw)
In-Reply-To: <CAHp75Ve8NP4FQO1R6tsRV7G4rSmch-dX5ADKCb7E7Q83zqKyew@mail.gmail.com>

Hi,

On 12/21/21 16:39, Andy Shevchenko wrote:
> On Tue, Dec 21, 2021 at 5:13 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> x86 tablets which ship with Android as (part of) the factory image
>> typically have various problems with their DSDTs. The factory kernels
>> shipped on these devices typically have device addresses and GPIOs
>> hardcoded in the kernel, rather then specified in their DSDT.
>>
>> With the DSDT containing a random collection of devices which may or
>> may not actually be present as well as missing devices which are
>> actually present.
>>
>> This driver, which loads only on affected models based on DMI matching,
>> adds DMI based instantiating of kernel devices for devices which are
>> missing from the DSDT, fixing e.g. battery monitoring, touchpads and/or
>> accelerometers not working.
>>
>> Note the Kconfig help text also refers to "various fixes" ATM there are
>> no such fixes, but there are also known cases where entries are present
>> in the DSDT but they contain bugs, such as missing/wrong GPIOs. The plan
>> is to also add fixes for things like this here in the future.
>>
>> This is the least ugly option to get these devices to fully work and to
>> do so without adding any extra code to the main kernel image (vmlinuz)
>> when built as a module.
> 
> ...
> 
>> +config X86_ANDROID_TABLETS
>> +       tristate "X86 Android tablet support"
>> +       depends on I2C && ACPI
>> +       help
>> +         X86 tablets which ship with Android as (part of) the factory image
>> +         typically have various problems with their DSDTs. The factory kernels
>> +         shipped on these devices typically have device addresses and GPIOs
>> +         hardcoded in the kernel, rather then specified in their DSDT.
> 
> than

Fixed.

> 
>> +
>> +         With the DSDT containing a random collection of devices which may or
>> +         may not actually be present. This driver contains various fixes for
>> +         such tablets, including instantiating kernel devices for devices which
>> +         are missing from the DSDT.
> 
> ...
> 
>> +static const char * const chuwi_hi8_mount_matrix[] = {
>> +       "1", "0", "0",
>> +       "0", "-1", "0",
>> +       "0", "0", "1"
> 
> + comma?

This is a 3x3 matrix, there are never going to be extra entries
added, so no I don't think so.

> 
>> +};
> 
> ...
> 
>> +       int ret = 0;
> 
>> +       board_info.irq = x86_acpi_irq_helper_get(&client_info->irq_data);
>> +       if (board_info.irq < 0) {
>> +               ret = board_info.irq;
>> +               goto out;
>> +       }
> 
> Can we rather use
> ret = ...
> if (ret < 0)
>  goto
> .irq = ret;
> 
> ?

Ack, fixed.

> 
> ...
> 
>> +       i2c_clients[idx] = i2c_new_client_device(adap, &board_info);
>> +       if (IS_ERR(i2c_clients[idx])) {
> 
>> +               ret = PTR_ERR(i2c_clients[idx]);
>> +               pr_err("Error creating I2C-client %d: %d\n", idx, ret);
> 
> dev_err_probe()? (device of the adapter)

Ack, fixed.


> 
>> +       }
> 
> ...
> 
>> +out:
> 
> out_put_device: ?

I've gone with out_put_adap instead.

Regards,

Hans


> 
>> +       put_device(&adap->dev);
>> +       return ret;
> 
> ...
> 
>> +       int i, ret = 0;
> 
> Do you need this assignment? See below.
> 
> ...
> 
>> +       for (i = 0; i < dev_info->i2c_client_count; i++) {
>> +               ret = x86_instantiate_i2c_client(dev_info, i);
>> +               if (ret < 0) {
>> +                       x86_android_tablet_cleanup();
> 
>> +                       break;
> 
> return ret; ?
> 
>> +               }
>> +       }
> 
>> +       return ret;
> 
> return 0; ?
> 


  reply	other threads:[~2021-12-21 19:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 15:12 [PATCH v2 1/2] platform/x86: Add x86-acpi-irq-helpers.h Hans de Goede
2021-12-21 15:12 ` [PATCH v2 2/2] platform/x86: x86-android-tablets: New driver for x86 Android tablets Hans de Goede
2021-12-21 15:39   ` Andy Shevchenko
2021-12-21 19:05     ` Hans de Goede [this message]
2021-12-21 19:12       ` Hans de Goede
2021-12-21 15:27 ` [PATCH v2 1/2] platform/x86: Add x86-acpi-irq-helpers.h Andy Shevchenko
2021-12-21 18:58   ` Hans de Goede
2021-12-22 12:45     ` Mika Westerberg
2021-12-22 12:49       ` Andy Shevchenko
2021-12-23 17:26       ` Hans de Goede

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=74a71e6c-1ee3-20ce-4ac6-0abfccda79dc@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@infradead.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox