| @@ -74,39 +74,47 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN | | | @@ -74,39 +74,47 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN |
74 | #define CH7xxx_PM_DVIL (1<<6) | | 74 | #define CH7xxx_PM_DVIL (1<<6) |
75 | #define CH7xxx_PM_DVIP (1<<7) | | 75 | #define CH7xxx_PM_DVIP (1<<7) |
76 | | | 76 | |
77 | #define CH7301_SYNC_POLARITY 0x56 | | 77 | #define CH7301_SYNC_POLARITY 0x56 |
78 | #define CH7301_SYNC_RGB_YUV (1<<0) | | 78 | #define CH7301_SYNC_RGB_YUV (1<<0) |
79 | #define CH7301_SYNC_POL_DVI (1<<5) | | 79 | #define CH7301_SYNC_POL_DVI (1<<5) |
80 | | | 80 | |
81 | /** @file | | 81 | /** @file |
82 | * driver for the Chrontel 7xxx DVI chip over DVO. | | 82 | * driver for the Chrontel 7xxx DVI chip over DVO. |
83 | */ | | 83 | */ |
84 | | | 84 | |
85 | static struct ch7xxx_id_struct { | | 85 | static struct ch7xxx_id_struct { |
86 | uint8_t vid; | | 86 | uint8_t vid; |
| | | 87 | #ifdef __NetBSD__ |
| | | 88 | const char *name; |
| | | 89 | #else |
87 | char *name; | | 90 | char *name; |
| | | 91 | #endif |
88 | } ch7xxx_ids[] = { | | 92 | } ch7xxx_ids[] = { |
89 | { CH7011_VID, "CH7011" }, | | 93 | { CH7011_VID, "CH7011" }, |
90 | { CH7009A_VID, "CH7009A" }, | | 94 | { CH7009A_VID, "CH7009A" }, |
91 | { CH7009B_VID, "CH7009B" }, | | 95 | { CH7009B_VID, "CH7009B" }, |
92 | { CH7301_VID, "CH7301" }, | | 96 | { CH7301_VID, "CH7301" }, |
93 | }; | | 97 | }; |
94 | | | 98 | |
95 | struct ch7xxx_priv { | | 99 | struct ch7xxx_priv { |
96 | bool quiet; | | 100 | bool quiet; |
97 | }; | | 101 | }; |
98 | | | 102 | |
| | | 103 | #ifdef __NetBSD__ |
| | | 104 | static const char *ch7xxx_get_id(uint8_t vid) |
| | | 105 | #else |
99 | static char *ch7xxx_get_id(uint8_t vid) | | 106 | static char *ch7xxx_get_id(uint8_t vid) |
| | | 107 | #endif |
100 | { | | 108 | { |
101 | int i; | | 109 | int i; |
102 | | | 110 | |
103 | for (i = 0; i < ARRAY_SIZE(ch7xxx_ids); i++) { | | 111 | for (i = 0; i < ARRAY_SIZE(ch7xxx_ids); i++) { |
104 | if (ch7xxx_ids[i].vid == vid) | | 112 | if (ch7xxx_ids[i].vid == vid) |
105 | return ch7xxx_ids[i].name; | | 113 | return ch7xxx_ids[i].name; |
106 | } | | 114 | } |
107 | | | 115 | |
108 | return NULL; | | 116 | return NULL; |
109 | } | | 117 | } |
110 | | | 118 | |
111 | /** Reads an 8 bit register */ | | 119 | /** Reads an 8 bit register */ |
112 | static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) | | 120 | static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) |
| @@ -169,27 +177,31 @@ static bool ch7xxx_writeb(struct intel_d | | | @@ -169,27 +177,31 @@ static bool ch7xxx_writeb(struct intel_d |
169 | DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d.\n", | | 177 | DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d.\n", |
170 | addr, adapter->name, dvo->slave_addr); | | 178 | addr, adapter->name, dvo->slave_addr); |
171 | } | | 179 | } |
172 | | | 180 | |
173 | return false; | | 181 | return false; |
174 | } | | 182 | } |
175 | | | 183 | |
176 | static bool ch7xxx_init(struct intel_dvo_device *dvo, | | 184 | static bool ch7xxx_init(struct intel_dvo_device *dvo, |
177 | struct i2c_adapter *adapter) | | 185 | struct i2c_adapter *adapter) |
178 | { | | 186 | { |
179 | /* this will detect the CH7xxx chip on the specified i2c bus */ | | 187 | /* this will detect the CH7xxx chip on the specified i2c bus */ |
180 | struct ch7xxx_priv *ch7xxx; | | 188 | struct ch7xxx_priv *ch7xxx; |
181 | uint8_t vendor, device; | | 189 | uint8_t vendor, device; |
| | | 190 | #ifdef __NetBSD__ |
| | | 191 | const char *name; |
| | | 192 | #else |
182 | char *name; | | 193 | char *name; |
| | | 194 | #endif |
183 | | | 195 | |
184 | ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL); | | 196 | ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL); |
185 | if (ch7xxx == NULL) | | 197 | if (ch7xxx == NULL) |
186 | return false; | | 198 | return false; |
187 | | | 199 | |
188 | dvo->i2c_bus = adapter; | | 200 | dvo->i2c_bus = adapter; |
189 | dvo->dev_priv = ch7xxx; | | 201 | dvo->dev_priv = ch7xxx; |
190 | ch7xxx->quiet = true; | | 202 | ch7xxx->quiet = true; |
191 | | | 203 | |
192 | if (!ch7xxx_readb(dvo, CH7xxx_REG_VID, &vendor)) | | 204 | if (!ch7xxx_readb(dvo, CH7xxx_REG_VID, &vendor)) |
193 | goto out; | | 205 | goto out; |
194 | | | 206 | |
195 | name = ch7xxx_get_id(vendor); | | 207 | name = ch7xxx_get_id(vendor); |