From: plagnioj@jcrosoft.com (Jean-Christophe PLAGNIOL-VILLARD)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] [media] at91: add Atmel Image Sensor Interface (ISI) support
Date: Fri, 13 May 2011 03:25:20 +0200 [thread overview]
Message-ID: <20110513012520.GL18952@game.jcrosoft.org> (raw)
In-Reply-To: <4DCC5040.6050300@bluewatersys.com>
> > +
> > +/* Constants for RGB_CFG(ISI_V2) */
> > +#define ISI_V2_RGB_CFG_DEFAULT 0
> > +#define ISI_V2_RGB_CFG_MODE_1 1
> > +#define ISI_V2_RGB_CFG_MODE_2 2
> > +#define ISI_V2_RGB_CFG_MODE_3 3
> > +
> > +/* Bit manipulation macros */
> > +#define ISI_BIT(name) \
> > + (1 << ISI_##name##_OFFSET)
> > +#define ISI_BF(name, value) \
> > + (((value) & ((1 << ISI_##name##_SIZE) - 1)) \
> > + << ISI_##name##_OFFSET)
> > +#define ISI_BFEXT(name, value) \
> > + (((value) >> ISI_##name##_OFFSET) \
> > + & ((1 << ISI_##name##_SIZE) - 1))
> > +#define ISI_BFINS(name, value, old) \
> > + (((old) & ~(((1 << ISI_##name##_SIZE) - 1) \
> > + << ISI_##name##_OFFSET))\
> > + | ISI_BF(name, value))
>
> I really dislike this kind of register access magic. Not sure how others
> feel about it. These macros are really ugly.
>
> > +/* Register access macros */
> > +#define isi_readl(port, reg) \
> > + __raw_readl((port)->regs + ISI_##reg)
> > +#define isi_writel(port, reg, value) \
> > + __raw_writel((value), (port)->regs + ISI_##reg)
>
> If the token pasting stuff gets dropped then these can be static inline
> functions which is preferred.
Sorry this make the C code much readable
and this can not be done as a inline
so please keep it as is
>
> > +
> > +#define ATMEL_V4L2_VID_FLAGS (V4L2_CAP_VIDEO_OUTPUT)
> > +
> > +struct atmel_isi;
> > +
> > +enum atmel_isi_pixfmt {
> > + ATMEL_ISI_PIXFMT_GREY, /* Greyscale */
> > + dev_info(&pdev->dev,
> > + "No config available using default values\n");
> > + pdata = &isi_default_data;
> > + }
> > +
> > + isi->pdata = pdata;
> > + isi->platform_flags = pdata->flags;
> > + if (isi->platform_flags == 0)
> > + isi->platform_flags = ISI_DATAWIDTH_8;
>
> We could be mean here an require that people get the flags correct, e.g.
>
> if (!((isi->platform_flags & ISI_DATA_WIDTH_8) ||
> (isi->platform_flags & ISI_DATA_WIDTH_8))) {
> dev_err(&pdev->dev, "No data width specified\n");
> err = -ENOMEM;
> goto fail;
> }
>
> Which discourages sloppy coding in the board files.
if this means default configuration so not need to have all board to set it
>
> > +
> > + isi_writel(isi, V2_CTRL, ISI_BIT(V2_DIS));
> > + /* Check if module disable */
> > + while (isi_readl(isi, V2_STATUS) & ISI_BIT(V2_DIS))
> > + cpu_relax();
> > +
> > + irq = platform_get_irq(pdev, 0);
Best Regards,
J.
WARNING: multiple messages have this Message-ID (diff)
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Ryan Mallon <ryan@bluewatersys.com>
Cc: Josh Wu <josh.wu@atmel.com>,
mchehab@redhat.com, linux-kernel@vger.kernel.org,
lars.haring@atmel.com, g.liakhovetski@gmx.de,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH] [media] at91: add Atmel Image Sensor Interface (ISI) support
Date: Fri, 13 May 2011 03:25:20 +0200 [thread overview]
Message-ID: <20110513012520.GL18952@game.jcrosoft.org> (raw)
In-Reply-To: <4DCC5040.6050300@bluewatersys.com>
> > +
> > +/* Constants for RGB_CFG(ISI_V2) */
> > +#define ISI_V2_RGB_CFG_DEFAULT 0
> > +#define ISI_V2_RGB_CFG_MODE_1 1
> > +#define ISI_V2_RGB_CFG_MODE_2 2
> > +#define ISI_V2_RGB_CFG_MODE_3 3
> > +
> > +/* Bit manipulation macros */
> > +#define ISI_BIT(name) \
> > + (1 << ISI_##name##_OFFSET)
> > +#define ISI_BF(name, value) \
> > + (((value) & ((1 << ISI_##name##_SIZE) - 1)) \
> > + << ISI_##name##_OFFSET)
> > +#define ISI_BFEXT(name, value) \
> > + (((value) >> ISI_##name##_OFFSET) \
> > + & ((1 << ISI_##name##_SIZE) - 1))
> > +#define ISI_BFINS(name, value, old) \
> > + (((old) & ~(((1 << ISI_##name##_SIZE) - 1) \
> > + << ISI_##name##_OFFSET))\
> > + | ISI_BF(name, value))
>
> I really dislike this kind of register access magic. Not sure how others
> feel about it. These macros are really ugly.
>
> > +/* Register access macros */
> > +#define isi_readl(port, reg) \
> > + __raw_readl((port)->regs + ISI_##reg)
> > +#define isi_writel(port, reg, value) \
> > + __raw_writel((value), (port)->regs + ISI_##reg)
>
> If the token pasting stuff gets dropped then these can be static inline
> functions which is preferred.
Sorry this make the C code much readable
and this can not be done as a inline
so please keep it as is
>
> > +
> > +#define ATMEL_V4L2_VID_FLAGS (V4L2_CAP_VIDEO_OUTPUT)
> > +
> > +struct atmel_isi;
> > +
> > +enum atmel_isi_pixfmt {
> > + ATMEL_ISI_PIXFMT_GREY, /* Greyscale */
> > + dev_info(&pdev->dev,
> > + "No config available using default values\n");
> > + pdata = &isi_default_data;
> > + }
> > +
> > + isi->pdata = pdata;
> > + isi->platform_flags = pdata->flags;
> > + if (isi->platform_flags == 0)
> > + isi->platform_flags = ISI_DATAWIDTH_8;
>
> We could be mean here an require that people get the flags correct, e.g.
>
> if (!((isi->platform_flags & ISI_DATA_WIDTH_8) ||
> (isi->platform_flags & ISI_DATA_WIDTH_8))) {
> dev_err(&pdev->dev, "No data width specified\n");
> err = -ENOMEM;
> goto fail;
> }
>
> Which discourages sloppy coding in the board files.
if this means default configuration so not need to have all board to set it
>
> > +
> > + isi_writel(isi, V2_CTRL, ISI_BIT(V2_DIS));
> > + /* Check if module disable */
> > + while (isi_readl(isi, V2_STATUS) & ISI_BIT(V2_DIS))
> > + cpu_relax();
> > +
> > + irq = platform_get_irq(pdev, 0);
Best Regards,
J.
next prev parent reply other threads:[~2011-05-13 1:25 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-12 7:42 [PATCH] [media] at91: add Atmel Image Sensor Interface (ISI) support Josh Wu
2011-05-12 7:42 ` Josh Wu
2011-05-12 7:47 ` Russell King - ARM Linux
2011-05-12 7:47 ` Russell King - ARM Linux
2011-05-12 9:26 ` [PATCH] [media] at91: add Atmel Image Sensor Interface (ISI)support Wu, Josh
2011-05-12 9:26 ` Wu, Josh
2011-05-12 9:32 ` Guennadi Liakhovetski
2011-05-12 9:32 ` Guennadi Liakhovetski
2011-05-12 9:56 ` Wu, Josh
2011-05-12 9:56 ` Wu, Josh
2011-05-27 12:06 ` Wu, Josh
2011-05-27 12:06 ` Wu, Josh
2011-05-12 9:34 ` [PATCH] [media] at91: add Atmel Image Sensor Interface (ISI) support Russell King - ARM Linux
2011-05-12 9:34 ` Russell King - ARM Linux
2011-05-13 4:57 ` [PATCH] [media] at91: add Atmel Image Sensor Interface (ISI)support Wu, Josh
2011-05-13 4:57 ` Wu, Josh
2011-05-12 11:45 ` [PATCH] [media] at91: add Atmel Image Sensor Interface (ISI) support Jean-Christophe PLAGNIOL-VILLARD
2011-05-12 11:45 ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-12 12:14 ` Guennadi Liakhovetski
2011-05-12 12:14 ` Guennadi Liakhovetski
2011-05-12 21:29 ` Ryan Mallon
2011-05-12 21:29 ` Ryan Mallon
2011-05-17 6:35 ` Wu, Josh
2011-05-17 6:35 ` Wu, Josh
2011-05-12 21:25 ` Ryan Mallon
2011-05-12 21:25 ` Ryan Mallon
2011-05-13 1:25 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-05-13 1:25 ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-17 8:59 ` Wu, Josh
2011-05-17 8:59 ` Wu, Josh
2011-05-17 20:58 ` Ryan Mallon
2011-05-17 20:58 ` Ryan Mallon
2011-05-18 4:58 ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-18 4:58 ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-13 13:50 ` Guennadi Liakhovetski
2011-05-13 13:50 ` Guennadi Liakhovetski
2011-05-13 20:35 ` Sylwester Nawrocki
2011-05-13 20:35 ` Sylwester Nawrocki
2011-05-13 20:43 ` Guennadi Liakhovetski
2011-05-13 20:43 ` Guennadi Liakhovetski
2011-05-13 19:18 ` Arnd Bergmann
2011-05-13 19:18 ` Arnd Bergmann
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=20110513012520.GL18952@game.jcrosoft.org \
--to=plagnioj@jcrosoft.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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.