From: Dave Stevenson <dave.stevenson@raspberrypi.com>
To: Adam Ford <aford173@gmail.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Tim Harvey <tharvey@gateworks.com>,
cstevens@beaconembedded.com, aford@beaconembedded.com,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] media: i2c: imx219: Create DPHY helper function
Date: Mon, 25 Apr 2022 17:07:06 +0100 [thread overview]
Message-ID: <CAPY8ntD+HqQLeb=Z4du2X==22yBzkfqpGEjo_v6=W1zFU1F2Ow@mail.gmail.com> (raw)
In-Reply-To: <20220412135534.2796158-5-aford173@gmail.com>
Hi Adam
On Tue, 12 Apr 2022 at 14:55, Adam Ford <aford173@gmail.com> wrote:
>
> In the table of modes, each mode sets the DPHY to auto.
> Create a helper function which does the same thing while
> removing the entry for auto DPHY from ever mode entry.
s/ever/every
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
> ---
> drivers/media/i2c/imx219.c | 24 ++++++++++++++++++++----
> 1 file changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> index 08e7d0e72430..bb0bc1b8d91c 100644
> --- a/drivers/media/i2c/imx219.c
> +++ b/drivers/media/i2c/imx219.c
> @@ -35,6 +35,10 @@
> #define IMX219_MODE_STANDBY 0x00
> #define IMX219_MODE_STREAMING 0x01
>
> +
> +#define IMX219_REG_DPHY_CTRL 0x0128
> +#define IMX219_DPHY_AUTO 0
> +
> /* Chip ID */
> #define IMX219_REG_CHIP_ID 0x0000
> #define IMX219_CHIP_ID 0x0219
> @@ -183,7 +187,6 @@ static const struct imx219_reg pll_clk_table[] = {
> * 3280x2464 = mode 2, 1920x1080 = mode 1, 1640x1232 = mode 4, 640x480 = mode 7.
> */
> static const struct imx219_reg mode_3280x2464_regs[] = {
> - {0x0128, 0x00},
> {0x012b, 0x00},
> {0x0164, 0x00},
> {0x0165, 0x00},
> @@ -222,7 +225,6 @@ static const struct imx219_reg mode_3280x2464_regs[] = {
> };
>
> static const struct imx219_reg mode_1920_1080_regs[] = {
> - {0x0128, 0x00},
> {0x012b, 0x00},
> {0x0162, 0x0d},
> {0x0163, 0x78},
> @@ -261,7 +263,6 @@ static const struct imx219_reg mode_1920_1080_regs[] = {
> };
>
> static const struct imx219_reg mode_1640_1232_regs[] = {
> - {0x0128, 0x00},
> {0x012b, 0x00},
> {0x0164, 0x00},
> {0x0165, 0x00},
> @@ -300,7 +301,6 @@ static const struct imx219_reg mode_1640_1232_regs[] = {
> };
>
> static const struct imx219_reg mode_640_480_regs[] = {
> - {0x0128, 0x00},
> {0x012b, 0x00},
> {0x0162, 0x0d},
> {0x0163, 0x78},
> @@ -999,6 +999,15 @@ static int imx219_get_selection(struct v4l2_subdev *sd,
> return -EINVAL;
> }
>
> +static int imx219_enable_dphy(struct imx219 *imx219, u8 mode)
> +{
> + int ret;
> +
> + ret = imx219_write_reg(imx219, IMX219_REG_DPHY_CTRL,
> + IMX219_REG_VALUE_08BIT, mode);
Is there a specific reason to extract this one register, but leave the block
{0x455e, 0x00},
{0x471e, 0x4b},
{0x4767, 0x0f},
{0x4750, 0x14},
{0x4540, 0x00},
{0x47b4, 0x14},
{0x4713, 0x30},
{0x478b, 0x10},
{0x478f, 0x10},
{0x4793, 0x10},
{0x4797, 0x0e},
{0x479b, 0x0e},
{0x0162, 0x0d},
{0x0163, 0x78},
that appear to also be common to all modes.
Other drivers break that lot out into a global registers array that is
always sent, rather than individual register writes.
Having this one register extra write as a new function is actually
likely to increase the size of the module overall, instead of reducing
it.
Dave
> + return ret;
> +};
> +
> static int imx219_configure_lanes(struct imx219 *imx219)
> {
> int ret;
> @@ -1081,6 +1090,13 @@ static int imx219_start_streaming(struct imx219 *imx219)
> goto err_rpm_put;
> }
>
> + /* Setup DPHY */
> + ret = imx219_enable_dphy(imx219, IMX219_DPHY_AUTO);
> + if (ret) {
> + dev_err(&client->dev, "%s failed to configure dphy\n", __func__);
> + goto err_rpm_put;
> + }
> +
> /* Configure clock based on reference clock frequency */
> imx219_set_exck_freq(imx219);
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-04-25 16:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 13:55 [PATCH 0/4] media: i2c: imx219: Enable variable xclk and 4-lane Adam Ford
2022-04-12 13:55 ` [PATCH 1/4] media: i2c: imx219: Split common registers from mode tables Adam Ford
2022-04-25 16:20 ` Dave Stevenson
2022-04-25 16:50 ` Adam Ford
2022-04-25 17:17 ` Dave Stevenson
2022-04-12 13:55 ` [PATCH 2/4] media: i2c: imx219: Support four-lane operation Adam Ford
2022-04-25 15:39 ` Dave Stevenson
2022-04-12 13:55 ` [PATCH 3/4] media: i2c: imx219: Enable variable XCLK Adam Ford
2022-04-25 15:58 ` Dave Stevenson
2022-04-25 16:13 ` Dave Stevenson
2022-04-25 17:28 ` Adam Ford
2022-04-25 17:57 ` Dave Stevenson
2022-04-12 13:55 ` [PATCH 4/4] media: i2c: imx219: Create DPHY helper function Adam Ford
2022-04-25 16:07 ` Dave Stevenson [this message]
2022-04-25 12:08 ` [PATCH 0/4] media: i2c: imx219: Enable variable xclk and 4-lane Adam Ford
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='CAPY8ntD+HqQLeb=Z4du2X==22yBzkfqpGEjo_v6=W1zFU1F2Ow@mail.gmail.com' \
--to=dave.stevenson@raspberrypi.com \
--cc=aford173@gmail.com \
--cc=aford@beaconembedded.com \
--cc=cstevens@beaconembedded.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=tharvey@gateworks.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.