Skip to content

Draft: media: i2c: Add driver for LC898219XI VCM

Hi. This is my driver for the VCM controlling the focus on the rear camera of google-sargo and probably also google-bonito.

I need some help figuring out how to write this driver correctly. The version I am submitting here can set the focus but I haven't figured how the value written corresponds to the actual focus. Data from downstream suggests it may be an 12-bit signed integer but even then it's a bit weird.

Here's the values android writes to reg 132 I've extracted while playing around with it a bit: reg_132_vals The lower values < 550 seem to correspond to focus near and the higher values > 3500 are focus far.

The second thing I need help with is initializing the device in the correct position. I thought lc898219xi_runtime_resume would be right but it seems that is called twice at boot and not when starting to use the camera as I would expect. At boot communicating with the device fails so I assume there's something else that needs to be done to drive the device. It works if the initialization code is run while the camera is active so I've moved it into lc898219xi_set_dac for now to have a usable driver.

I plan to send this code upstream once it is finished but I need some help to get it into a polished state, hence this merge request.

Edit: Oh yeah this work is heavily based on (not to say shamelessly copied from) Vasiliy Doylov's PR for the focus actuator on the Oneplus 6T here sdm845-mainline/linux!114 (closed)

Edited by Frieder Hannenheim

Merge request reports

Loading