| 1 | /* |
| 2 | * arch/ubicom32/mach-ip7k/board-ip7500wspkr.c |
| 3 | * Support for IP7500 Wireless Speaker board. |
| 4 | * |
| 5 | * This file supports the IP7500 Wireless Speaker board: |
| 6 | * 8007-1210 Rev 1.0 |
| 7 | * |
| 8 | * (C) Copyright 2009, Ubicom, Inc. |
| 9 | * |
| 10 | * This file is part of the Ubicom32 Linux Kernel Port. |
| 11 | * |
| 12 | * The Ubicom32 Linux Kernel Port is free software: you can redistribute |
| 13 | * it and/or modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation, either version 2 of the |
| 15 | * License, or (at your option) any later version. |
| 16 | * |
| 17 | * The Ubicom32 Linux Kernel Port is distributed in the hope that it |
| 18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
| 19 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 20 | * the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with the Ubicom32 Linux Kernel Port. If not, |
| 24 | * see <http://www.gnu.org/licenses/>. |
| 25 | */ |
| 26 | #include <linux/device.h> |
| 27 | #include <linux/gpio.h> |
| 28 | #include <asm/board.h> |
| 29 | |
| 30 | #include <linux/platform_device.h> |
| 31 | #include <asm/audio.h> |
| 32 | #include <linux/i2c.h> |
| 33 | #include <linux/i2c-gpio.h> |
| 34 | |
| 35 | static struct i2c_board_info __initdata ip7500wspkr_i2c_board_info[] = { |
| 36 | /* |
| 37 | * U6, CS4350 DAC, address 0x4B |
| 38 | */ |
| 39 | { |
| 40 | .type = "cs4350", |
| 41 | .addr = 0x4B, |
| 42 | }, |
| 43 | }; |
| 44 | |
| 45 | /* |
| 46 | * I2C bus on the board, SDA PE4, SCL PE5 |
| 47 | */ |
| 48 | static struct i2c_gpio_platform_data ip7500wspkr_i2c_data = { |
| 49 | .sda_pin = GPIO_RD_5, |
| 50 | .scl_pin = GPIO_RD_6, |
| 51 | .sda_is_open_drain = 0, |
| 52 | .scl_is_open_drain = 0, |
| 53 | .udelay = 50, |
| 54 | }; |
| 55 | |
| 56 | static struct platform_device ip7500wspkr_i2c_device = { |
| 57 | .name = "i2c-gpio", |
| 58 | .id = 0, |
| 59 | .dev = { |
| 60 | .platform_data = &ip7500wspkr_i2c_data, |
| 61 | }, |
| 62 | }; |
| 63 | |
| 64 | static struct platform_device *ip7500wspkr_devices[] __initdata = { |
| 65 | &ip7500wspkr_i2c_device, |
| 66 | }; |
| 67 | |
| 68 | /* |
| 69 | * ip7500wspkr_init |
| 70 | * Called to add the devices which we have on this board |
| 71 | */ |
| 72 | static int __init ip7500wspkr_init(void) |
| 73 | { |
| 74 | struct platform_device *audio_dev; |
| 75 | struct platform_device *audio_dev2; |
| 76 | |
| 77 | board_init(); |
| 78 | |
| 79 | ubi_gpio_init(); |
| 80 | |
| 81 | platform_add_devices(ip7500wspkr_devices, ARRAY_SIZE(ip7500wspkr_devices)); |
| 82 | |
| 83 | audio_dev = audio_device_alloc("snd-ubi32-cs4350", "audio", "audio-i2sout", 0); |
| 84 | if (audio_dev) { |
| 85 | ip7500wspkr_i2c_board_info[0].platform_data = audio_dev; |
| 86 | } |
| 87 | |
| 88 | audio_dev2 = audio_device_alloc("snd-ubi32-generic", "audio", "audio-spdifout", 0); |
| 89 | if (audio_dev2) { |
| 90 | platform_device_register(audio_dev2); |
| 91 | } |
| 92 | |
| 93 | printk(KERN_INFO "%s: registering i2c resources\n", __FUNCTION__); |
| 94 | i2c_register_board_info(0, ip7500wspkr_i2c_board_info, ARRAY_SIZE(ip7500wspkr_i2c_board_info)); |
| 95 | |
| 96 | printk(KERN_INFO "IP7500 Wireless Speaker Board\n"); |
| 97 | |
| 98 | return 0; |
| 99 | } |
| 100 | |
| 101 | arch_initcall(ip7500wspkr_init); |
| 102 | |