lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CANCTEQi1OE_-_F0NJ6BAnZGME-7X2SRr08iOvidLQo=Qur2e1w@mail.gmail.com>
Date:	Tue, 16 Jun 2015 14:35:44 +0000
From:	Radoslav Kolev <radoslav.kolev@...edlynx.com>
To:	linux-kernel@...r.kernel.org
Subject: "regmap: how to handle two 'control byte' model"

Hello!

I need a driver for the tsc2004 I2C touch screen controller and I'm
trying to adapt the tsc2005 driver (same controller on SPI). Regmap
seems exactly the solution for this, but I'm completely new to it and
can't quite figure out how to handle one quirk of the chip.

The chip has 2 'control bytes' differentiated by the most significant
bit - 0 and 1. Control byte 0 has it's MSB as 0, a 4 bit register
address field, one unrelated configuration bit  and a read/write bit.
After sending this control byte with the right register address and
direction set you read/write the register value - so it mostly fits
nicely within the regmap framework concepts (excluding the one config
bit).

Control byte 1 has its MSB as 1 followed by 7 bits selecting the chips
mode of operation, resolution and a software reset.

The problem is how to fit this 2 control bytes model within the regmap
framework? From looking at the code a possible way is to set reg_bits
to 1 and val_bits to 7 to be able to access the two 'control bytes'
and then try to get the actual data registers through a regmap_range
paged/indirect access.

Currently the lowest supported value for reg_bits seems to be 2
though, and I'll also need different val_bits for the 'control bytes'
vs regular registers and I don't think that's possible. In the end the
whole thing starts to feel like abusing the paged/indirect access
feature.

Another solution could be to use two separate regmaps - one for the
'control bytes' and one for the registers, but again there's no
support for reg/val bits 1/7 and it doesn't feel optimal either.

What is the correct/preferred way to use regmap in this situation?

Cheers!
Radoslav
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ