1 | /* $NetBSD: au8522var.h,v 1.4 2011/07/10 00:47:34 jmcneill Exp $ */ |
2 | |
3 | /*- |
4 | * Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca> |
5 | * All rights reserved. |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions |
9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. |
15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
28 | |
29 | #ifndef _AU8522VAR_H |
30 | #define _AU8522VAR_H |
31 | |
32 | #include <dev/i2c/i2cvar.h> |
33 | #include <dev/dtv/dtvio.h> |
34 | |
35 | struct au8522 { |
36 | device_t parent; |
37 | i2c_tag_t i2c; |
38 | i2c_addr_t i2c_addr; |
39 | |
40 | unsigned int if_freq; |
41 | |
42 | fe_modulation_t current_modulation; |
43 | }; |
44 | |
45 | typedef enum { |
46 | AU8522_VINPUT_UNCONF = -1, |
47 | AU8522_VINPUT_NONE = 0, |
48 | AU8522_VINPUT_CVBS, |
49 | AU8522_VINPUT_CVBS_TUNER, |
50 | AU8522_VINPUT_SVIDEO, |
51 | } au8522_vinput_t; |
52 | |
53 | typedef enum { |
54 | AU8522_AINPUT_UNCONF = -1, |
55 | AU8522_AINPUT_NONE = 0, |
56 | AU8522_AINPUT_SIF, |
57 | } au8522_ainput_t; |
58 | |
59 | struct au8522 * au8522_open(device_t, i2c_tag_t, i2c_addr_t, unsigned int); |
60 | void au8522_close(struct au8522 *); |
61 | |
62 | void au8522_enable(struct au8522 *, bool); |
63 | void au8522_set_input(struct au8522 *, |
64 | au8522_vinput_t, au8522_ainput_t); |
65 | int au8522_get_signal(struct au8522 *); |
66 | void au8522_set_audio(struct au8522 *, bool); |
67 | int au8522_set_modulation(struct au8522 *, fe_modulation_t); |
68 | void au8522_set_gate(struct au8522 *, bool); |
69 | fe_status_t au8522_get_dtv_status(struct au8522 *); |
70 | uint16_t au8522_get_snr(struct au8522 *); |
71 | |
72 | #endif /* !_AU8522VAR_H */ |
73 | |