From: Bing Bu Cao <bingbu.cao@linux.intel.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>, bingbu.cao@intel.com
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
tian.shu.qiu@intel.com, rajmohan.mani@intel.com,
tfiga@chromium.org
Subject: Re: [RESEND PATCH V2 2/2] media: ak7375: Add ak7375 lens voice coil driver
Date: Mon, 4 Jun 2018 14:36:10 +0800 [thread overview]
Message-ID: <e898d6bc-f9d3-3f0b-6e93-2e8dd99a047f@linux.intel.com> (raw)
In-Reply-To: <20180601094207.355n2vzpscsgwyc6@paasikivi.fi.intel.com>
On 2018年06月01日 17:42, Sakari Ailus wrote:
> On Fri, May 25, 2018 at 05:55:35PM +0800, bingbu.cao@intel.com wrote:
>> +static int ak7375_i2c_write(struct ak7375_device *ak7375,
>> + u8 addr, u16 data, int size)
>> +{
>> + struct i2c_client *client = v4l2_get_subdevdata(&ak7375->sd);
>> + int ret;
>> + u8 buf[3];
>> +
>> + if (size != 1 && size != 2)
>> + return -EINVAL;
>> + buf[0] = addr;
>> + buf[2] = data & 0xff;
>> + if (size == 2)
>> + buf[1] = data >> 8;
>> + ret = i2c_master_send(client, (const char *)buf, size + 1);
> I don't have a data datasheet for this thing, but it looks like buf[1] will
> be undefined for writes the size of which is 1. And this what appears to be
> written to the device as well...
I check the datasheet once again and find out that the logic here for
size==1 is
not correct, I will change it in next version. Thanks.
Here is the write section in datasheet:
------
After receiving the second byte (register address), AK7375 generates an
acknowledge then receives the third
byte. The third and the following bytes represent control data. Control
data consists of 8 bits and is based on
the MSB-first configuration.
AK7375 can write multiple bytes of data at a time. After reception of
the third byte (control data), AK7375
generates an acknowledge then receives the next data. If additional data
is received instead of the stop
condition after receiving one byte of data, the address counter inside
the LSI chip is automatically
incremented and the data is written at the next address.
------
>
>> + if (ret < 0)
>> + return ret;
>> + if (ret != size + 1)
>> + return -EIO;
>> + return 0;
>> +}
next prev parent reply other threads:[~2018-06-04 6:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-25 9:55 [RESEND PATCH V2 1/2] dt-bindings: Add bindings for AKM ak7375 voice coil lens bingbu.cao
2018-05-25 9:55 ` [RESEND PATCH V2 2/2] media: ak7375: Add ak7375 lens voice coil driver bingbu.cao
2018-06-01 9:34 ` Sakari Ailus
2018-06-01 9:54 ` Bing Bu Cao
2018-06-01 9:56 ` Sakari Ailus
2018-06-01 9:42 ` Sakari Ailus
2018-06-04 6:36 ` Bing Bu Cao [this message]
2018-05-31 3:21 ` [RESEND PATCH V2 1/2] dt-bindings: Add bindings for AKM ak7375 voice coil lens Rob Herring
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=e898d6bc-f9d3-3f0b-6e93-2e8dd99a047f@linux.intel.com \
--to=bingbu.cao@linux.intel.com \
--cc=bingbu.cao@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=rajmohan.mani@intel.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tfiga@chromium.org \
--cc=tian.shu.qiu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).