Re: [PATCH 1/2] Input: goodix - support gt1151 touchpanel

From
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date
2017-10-19 00:47:41
Also in
linux-devicetree
Reply to
Marcin Niestroj, 2017-10-17
On Tue, Oct 17, 2017 at 11:40:01AM +0200, Marcin Niestroj wrote:
Hi,
Thanks everyone for review!

On 14.10.2017 00:58, Dmitry Torokhov wrote:
quoted
<...snip...>
My preference would be to assign constant chip data, such as register,
to the relevant device ID structure (I2C or OF or ACPI) and reference it
form where it is needed.

struct goodix_chip_data {
	u16	config_addr;
};

...

struct goodix_ts_data {
	...
	const struct goodix_chip_data *chip;
	...
};

...

static const goodix_chip_data gt1x_chip_data = {
	.config_addr	= GOODIX_GT1X_REG_CONFIG_DATA,
};

static const goodix_chip_data gt9x_chip_data = {
	.config_addr	= GOODIX_GT9X_REG_CONFIG_DATA,
};

static const struct of_device_id goodix_of_match[] = {
	{ .compatible = "goodix,gt1151", .data = &gt1x_chip_data },
	...
};

and so on...

Thanks.
This looks good to me. Together with config_addr I would put config_len
to struct goodix_chip_data (and remove cfg_len member from struct
goodix_ts_data).

The main problem I have is how to assign goodix_chip_data to a ACPI
device (I have very little knowledge about ACPI). I do not know from
where comes 'GDIX1001' ACPI ID and how it corresponds to OF compatible
strings. Can you help me with that?
Hmm, wait a second... Looking at the driver we can fetch the product ID
form the chip, so we do not really need to put this into OF or ACPI
tables, but rather set up the "chip" pointer dynamically when we probe
the device.

Thanks.

-- 
Dmitry
Thread (5 messages) 5 messages, 4 authors, last reply 2017-10-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help