From owner-freebsd-multimedia@FreeBSD.ORG Sat Apr 23 23:22:56 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6EAFC16A4CE for ; Sat, 23 Apr 2005 23:22:56 +0000 (GMT) Received: from mail231.csoft.net (resin.csoft.net [63.111.22.86]) by mx1.FreeBSD.org (Postfix) with SMTP id 01BC643D53 for ; Sat, 23 Apr 2005 23:22:55 +0000 (GMT) (envelope-from jakemsr@jakemsr.com) Received: (qmail 9429 invoked from network); 23 Apr 2005 23:28:44 -0000 Received: from unknown (HELO puff.jakemsr.gom) (63.111.27.87) by mail231.csoft.net with SMTP; 23 Apr 2005 23:28:44 -0000 Received: (from jakemsr@jakemsr.com) by puff.jakemsr.gom (mini_sendmail/1.3.5 16nov2003); Sat, 23 Apr 2005 16:22:53 PDT (sender jakemsr@puff.jakemsr.gom) Date: Sat, 23 Apr 2005 16:22:53 -0700 From: Jacob Meuser To: freebsd-multimedia@freebsd.org Message-ID: <20050423232253.GA17807@puff.jakemsr.gom> Mail-Followup-To: freebsd-multimedia@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2i Subject: patch for bktr(4): better luma notch filter ioctls X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Apr 2005 23:22:56 -0000 the current luma notch interface does not jive with the datasheet, and it really doesn't seem to work as expected. instead of changing the bahaviour of the current ioctls and potentially breaking programs, add new ioctls. -- Index: bktr_core.c =================================================================== RCS file: /home/ncvs/src/sys/dev/bktr/bktr_core.c,v retrieving revision 1.138 diff -u -r1.138 bktr_core.c --- bktr_core.c 9 Jan 2005 17:42:03 -0000 1.138 +++ bktr_core.c 23 Apr 2005 23:17:46 -0000 @@ -2160,6 +2160,23 @@ *(int *)arg = (int) ( (INB(bktr, BKTR_E_CONTROL) & 0xe0) >> 5) ; break; + /* According to the datasheet, 0, 8, 16, and 32 are only the valid + * arguments. However, 0 and 32 seem to do the same thing, and 24 + * does both 8 (low luma cutoff) and 16 (swap U and V). + */ + case BT848_SLNOTCH2: /* set luma notch */ + tmp_int = (*(int *)arg & 0x3) << 3; + OUTB(bktr, BKTR_E_CONTROL, + INB(bktr, BKTR_E_CONTROL) & ~BT848_E_CONTROL_LNOTCH); + OUTB(bktr, BKTR_O_CONTROL, + INB(bktr, BKTR_O_CONTROL) & ~BT848_O_CONTROL_LNOTCH); + OUTB(bktr, BKTR_E_CONTROL, (tmp_int | BT848_E_CONTROL_LNOTCH)); + OUTB(bktr, BKTR_O_CONTROL, (tmp_int | BT848_O_CONTROL_LNOTCH)); + + case BT848_GLNOTCH2: /* get luma notch */ + *(int *)arg = (int) ((INB(bktr, + BKTR_E_CONTROL) & ~BT848_E_CONTROL_LNOTCH) >> 3 & 0x3); + break; /* */ case BT848_SCONT: /* set contrast */ Index: ioctl_bt848.h =================================================================== RCS file: /home/ncvs/src/sys/dev/bktr/ioctl_bt848.h,v retrieving revision 1.30 diff -u -r1.30 ioctl_bt848.h --- ioctl_bt848.h 20 Dec 2003 17:12:25 -0000 1.30 +++ ioctl_bt848.h 23 Apr 2005 23:17:46 -0000 @@ -141,6 +141,9 @@ #define BT848_SLNOTCH _IOW('x', 55, int) /* set luma notch */ #define BT848_GLNOTCH _IOR('x', 56, int) /* get luma notch */ +#define BT848_SLNOTCH2 _IOW('x', 79, int) /* set luma notch */ +#define BT848_GLNOTCH2 _IOR('x', 79, int) /* get luma notch */ + /* Read/Write the BT848's I2C bus directly * b7-b0: data (read/write) * b15-b8: internal peripheral register (write)