linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Eddie James <eajames@linux.vnet.ibm.com>,
	Eddie James <eajames@linux.ibm.com>,
	linux-kernel@vger.kernel.org
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	linux-aspeed@lists.ozlabs.org, andrew@aj.id.au,
	openbmc@lists.ozlabs.org, robh+dt@kernel.org, mchehab@kernel.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v3 2/2] media: platform: Add Aspeed Video Engine driver
Date: Thu, 4 Oct 2018 15:02:02 +0200	[thread overview]
Message-ID: <d7c82025-5c9a-6a64-75e0-f0d84d149dde@xs4all.nl> (raw)
In-Reply-To: <8ca47483-5347-c40d-0d01-4f13e88f8cde@linux.vnet.ibm.com>

On 10/03/18 22:26, Eddie James wrote:
> 
> 
> On 09/28/2018 06:30 AM, Hans Verkuil wrote:
>> On 09/25/2018 09:27 PM, Eddie James wrote:
>>> The Video Engine (VE) embedded in the Aspeed AST2400 and AST2500 SOCs
>>> can capture and compress video data from digital or analog sources. With
>>> the Aspeed chip acting a service processor, the Video Engine can capture
>>> the host processor graphics output.
>>>
>>> Add a V4L2 driver to capture video data and compress it to JPEG images.
>>> Make the video frames available through the V4L2 streaming interface.
>>>
>>> +		memcpy(&table[base], aspeed_video_jpeg_dct[i],
>>> +		       sizeof(aspeed_video_jpeg_dct[i]));
>>> +
>>> +		base += ASPEED_VIDEO_JPEG_DCT_SIZE;
>>> +		memcpy(&table[base], aspeed_video_jpeg_quant,
>>> +		       sizeof(aspeed_video_jpeg_quant));
>>> +
>>> +		if (yuv420)
>>> +			table[base + 2] = 0x00220103;
>>> +	}
>>> +}
>>> +
>>> +static void aspeed_video_update(struct aspeed_video *video, u32 reg,
>>> +				unsigned long mask, u32 bits)
>> You probably want to use u32 for the mask.
> 
> Using a u32 there results in:
> 
> warning: large integer implicitly truncated to unsigned type [-Woverflow]
> 
> everywhere I call aspeed_video_update. Not sure what the deal is. Any 
> suggestions?

The BIT and GENMASK macros produce unsigned long values.

I think it is easier if instead of passing a mask (i.e. the bits you want
to keep) you pass the bits you want to clear and replace with new ones.

So 'u32 clear' instead of 'unsigned long mask'.

The problem occurs because e.g. ~BIT(10) expands to an unsigned long with
all bits except for bit 10 set to 1. And passing that to an u32 will obviously
fail.

But just passing BIT(10) is fine since that fits in an u32.

Regards,

	Hans

> 
> Thanks,
> Eddie
> 
>>
>>> +{
>>> +	u32 t = readl(video->base + reg);
>>> +	u32 before = t;
>>> +
>>> +	t &= mask;
>>> +	t |= bits;
>>> +	writel(t, video->base + reg);
>>> +	dev_dbg(video->dev, "update %03x[%08x -> %08x]\n", reg, before,
>>>
>>> +
>>> +module_platform_driver(aspeed_video_driver);
>>> +
>>> +MODULE_DESCRIPTION("ASPEED Video Engine Driver");
>>> +MODULE_AUTHOR("Eddie James");
>>> +MODULE_LICENSE("GPL v2");
>>>
>> Regards,
>>
>> 	Hans
>>
> 


  reply	other threads:[~2018-10-04 13:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 19:27 [PATCH v3 0/2] media: platform: Add Aspeed Video Engine Driver Eddie James
2018-09-25 19:27 ` [PATCH v3 1/2] dt-bindings: media: Add Aspeed Video Engine binding documentation Eddie James
2018-09-27 19:54   ` Rob Herring
2018-10-01 13:08   ` Joel Stanley
2018-10-01 15:20     ` Eddie James
2018-09-25 19:27 ` [PATCH v3 2/2] media: platform: Add Aspeed Video Engine driver Eddie James
2018-09-28 11:30   ` Hans Verkuil
2018-09-28 16:06     ` Eddie James
2018-10-03 20:26     ` Eddie James
2018-10-04 13:02       ` Hans Verkuil [this message]
2018-10-03 20:43     ` Eddie James
2018-10-04 13:12       ` Hans Verkuil
2018-10-05 20:03         ` Eddie James
2018-09-26 12:03 ` [PATCH v3 0/2] media: platform: Add Aspeed Video Engine Driver Hans Verkuil
2018-09-26 18:05   ` Eddie James
2018-09-28 11:29     ` Hans Verkuil
2018-09-28 11:45 ` Hans Verkuil
2018-09-28 16:09   ` Eddie James

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=d7c82025-5c9a-6a64-75e0-f0d84d149dde@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=andrew@aj.id.au \
    --cc=devicetree@vger.kernel.org \
    --cc=eajames@linux.ibm.com \
    --cc=eajames@linux.vnet.ibm.com \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mchehab@kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=robh+dt@kernel.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 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).