Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * dm355evm_msp.c - driver for MSP430 firmware on DM355EVM board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2008 David Brownell
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/clk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/leds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/mfd/dm355evm_msp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * The DM355 is a DaVinci chip with video support but no C64+ DSP.  Its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * EVM board has an MSP430 programmed with firmware for various board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * support functions.  This driver exposes some of them directly, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * supports other drivers (e.g. RTC, input) for more complex access.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * Because this firmware is entirely board-specific, this file embeds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * knowledge that would be passed as platform_data in a generic driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * This driver was tested with firmware revision A4.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #if IS_ENABLED(CONFIG_INPUT_DM355EVM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define msp_has_keyboard()	true
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define msp_has_keyboard()	false
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #if IS_ENABLED(CONFIG_LEDS_GPIO)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define msp_has_leds()		true
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define msp_has_leds()		false
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #if IS_ENABLED(CONFIG_RTC_DRV_DM355EVM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define msp_has_rtc()		true
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define msp_has_rtc()		false
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #if IS_ENABLED(CONFIG_VIDEO_TVP514X)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define msp_has_tvp()		true
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #define msp_has_tvp()		false
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) /*----------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) /* REVISIT for paranoia's sake, retry reads/writes on error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) static struct i2c_client *msp430;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * dm355evm_msp_write - Writes a register in dm355evm_msp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * @value: the value to be written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * @reg: register address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * Returns result of operation - 0 is success, else negative errno
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) int dm355evm_msp_write(u8 value, u8 reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	return i2c_smbus_write_byte_data(msp430, reg, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) EXPORT_SYMBOL(dm355evm_msp_write);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  * dm355evm_msp_read - Reads a register from dm355evm_msp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * @reg: register address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  * Returns result of operation - value, or negative errno
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) int dm355evm_msp_read(u8 reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	return i2c_smbus_read_byte_data(msp430, reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) EXPORT_SYMBOL(dm355evm_msp_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) /*----------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * Many of the msp430 pins are just used as fixed-direction GPIOs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * We could export a few more of them this way, if we wanted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #define MSP_GPIO(bit, reg)	((DM355EVM_MSP_ ## reg) << 3 | (bit))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static const u8 msp_gpios[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	/* eight leds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	MSP_GPIO(0, LED), MSP_GPIO(1, LED),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	MSP_GPIO(2, LED), MSP_GPIO(3, LED),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	MSP_GPIO(4, LED), MSP_GPIO(5, LED),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	MSP_GPIO(6, LED), MSP_GPIO(7, LED),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	/* SW6 and the NTSC/nPAL jumper */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	MSP_GPIO(0, SWITCH1), MSP_GPIO(1, SWITCH1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	MSP_GPIO(2, SWITCH1), MSP_GPIO(3, SWITCH1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	MSP_GPIO(4, SWITCH1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	/* switches on MMC/SD sockets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	 * Note: EVMDM355_ECP_VA4.pdf suggests that Bit 2 and 4 should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	 * checked for card detection. However on the EVM bit 1 and 3 gives
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	 * this status, for 0 and 1 instance respectively. The pdf also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	 * suggests that Bit 1 and 3 should be checked for write protection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	 * However on the EVM bit 2 and 4 gives this status,for 0 and 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	 * instance respectively.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	MSP_GPIO(2, SDMMC), MSP_GPIO(1, SDMMC),	/* mmc0 WP, nCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	MSP_GPIO(4, SDMMC), MSP_GPIO(3, SDMMC),	/* mmc1 WP, nCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) static struct gpio_led evm_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	{ .name = "dm355evm::ds14",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	  .default_trigger = "heartbeat", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	{ .name = "dm355evm::ds15",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	  .default_trigger = "mmc0", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	{ .name = "dm355evm::ds16",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	  /* could also be a CE-ATA drive */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	  .default_trigger = "mmc1", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	{ .name = "dm355evm::ds17",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	  .default_trigger = "nand-disk", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	{ .name = "dm355evm::ds18", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	{ .name = "dm355evm::ds19", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	{ .name = "dm355evm::ds20", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	{ .name = "dm355evm::ds21", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static struct gpio_led_platform_data evm_led_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	.num_leds	= ARRAY_SIZE(evm_leds),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	.leds		= evm_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) static struct gpiod_lookup_table evm_leds_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	.dev_id = "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	.table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		 * These GPIOs are on the dm355evm_msp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		 * GPIO chip at index 0..7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		GPIO_LOOKUP_IDX("dm355evm_msp", 0, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 				0, GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		GPIO_LOOKUP_IDX("dm355evm_msp", 1, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 				1, GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		GPIO_LOOKUP_IDX("dm355evm_msp", 2, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 				2, GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		GPIO_LOOKUP_IDX("dm355evm_msp", 3, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 				3, GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		GPIO_LOOKUP_IDX("dm355evm_msp", 4, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 				4, GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		GPIO_LOOKUP_IDX("dm355evm_msp", 5, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 				5, GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		GPIO_LOOKUP_IDX("dm355evm_msp", 6, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 				6, GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		GPIO_LOOKUP_IDX("dm355evm_msp", 7, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 				7, GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		{ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) #define MSP_GPIO_REG(offset)	(msp_gpios[(offset)] >> 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) #define MSP_GPIO_MASK(offset)	BIT(msp_gpios[(offset)] & 0x07)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static int msp_gpio_in(struct gpio_chip *chip, unsigned offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	switch (MSP_GPIO_REG(offset)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	case DM355EVM_MSP_SWITCH1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	case DM355EVM_MSP_SWITCH2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	case DM355EVM_MSP_SDMMC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static u8 msp_led_cache;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) static int msp_gpio_get(struct gpio_chip *chip, unsigned offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	int reg, status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	reg = MSP_GPIO_REG(offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	status = dm355evm_msp_read(reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	if (status < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		return status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	if (reg == DM355EVM_MSP_LED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		msp_led_cache = status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	return !!(status & MSP_GPIO_MASK(offset));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) static int msp_gpio_out(struct gpio_chip *chip, unsigned offset, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	int mask, bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	/* NOTE:  there are some other signals that could be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	 * packaged as output GPIOs, but they aren't as useful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	 * as the LEDs ... so for now we don't.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	if (MSP_GPIO_REG(offset) != DM355EVM_MSP_LED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	mask = MSP_GPIO_MASK(offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	bits = msp_led_cache;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	bits &= ~mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	if (value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		bits |= mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	msp_led_cache = bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	return dm355evm_msp_write(bits, DM355EVM_MSP_LED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) static void msp_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	msp_gpio_out(chip, offset, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) static struct gpio_chip dm355evm_msp_gpio = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	.label			= "dm355evm_msp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	.owner			= THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	.direction_input	= msp_gpio_in,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	.get			= msp_gpio_get,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	.direction_output	= msp_gpio_out,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	.set			= msp_gpio_set,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	.base			= -EINVAL,		/* dynamic assignment */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	.ngpio			= ARRAY_SIZE(msp_gpios),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	.can_sleep		= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) /*----------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) static struct device *add_child(struct i2c_client *client, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		void *pdata, unsigned pdata_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		bool can_wakeup, int irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	struct platform_device	*pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	int			status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	pdev = platform_device_alloc(name, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	if (!pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 		return ERR_PTR(-ENOMEM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	device_init_wakeup(&pdev->dev, can_wakeup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	pdev->dev.parent = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	if (pdata) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		status = platform_device_add_data(pdev, pdata, pdata_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		if (status < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 			dev_dbg(&pdev->dev, "can't add platform_data\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 			goto put_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	if (irq) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		struct resource r = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 			.start = irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 			.flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 		status = platform_device_add_resources(pdev, &r, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		if (status < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 			dev_dbg(&pdev->dev, "can't add irq\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 			goto put_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	status = platform_device_add(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	if (status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		goto put_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	return &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) put_device:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	platform_device_put(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	dev_err(&client->dev, "failed to add device %s\n", name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	return ERR_PTR(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) static int add_children(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	static const struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 		int offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 		char *label;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	} config_inputs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 		/* 8 == right after the LEDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 		{ 8 + 0, "sw6_1", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 		{ 8 + 1, "sw6_2", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 		{ 8 + 2, "sw6_3", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 		{ 8 + 3, "sw6_4", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 		{ 8 + 4, "NTSC/nPAL", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	struct device	*child;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	int		status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	int		i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	/* GPIO-ish stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	dm355evm_msp_gpio.parent = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	status = gpiochip_add_data(&dm355evm_msp_gpio, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	if (status < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 		return status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	/* LED output */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	if (msp_has_leds()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 		gpiod_add_lookup_table(&evm_leds_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 		/* NOTE:  these are the only fully programmable LEDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 		 * on the board, since GPIO-61/ds22 (and many signals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 		 * going to DC7) must be used for AEMIF address lines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 		 * unless the top 1 GB of NAND is unused...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		child = add_child(client, "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 				&evm_led_data, sizeof(evm_led_data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 				false, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 		if (IS_ERR(child))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 			return PTR_ERR(child);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	/* configuration inputs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	for (i = 0; i < ARRAY_SIZE(config_inputs); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 		int gpio = dm355evm_msp_gpio.base + config_inputs[i].offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 		gpio_request_one(gpio, GPIOF_IN, config_inputs[i].label);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 		/* make it easy for userspace to see these */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 		gpio_export(gpio, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	/* MMC/SD inputs -- right after the last config input */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	if (dev_get_platdata(&client->dev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 		void (*mmcsd_setup)(unsigned) = dev_get_platdata(&client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 		mmcsd_setup(dm355evm_msp_gpio.base + 8 + 5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	/* RTC is a 32 bit counter, no alarm */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	if (msp_has_rtc()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 		child = add_child(client, "rtc-dm355evm",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 				NULL, 0, false, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		if (IS_ERR(child))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 			return PTR_ERR(child);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	/* input from buttons and IR remote (uses the IRQ) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	if (msp_has_keyboard()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 		child = add_child(client, "dm355evm_keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 				NULL, 0, true, client->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 		if (IS_ERR(child))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 			return PTR_ERR(child);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) /*----------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) static void dm355evm_command(unsigned command)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	int status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	status = dm355evm_msp_write(command, DM355EVM_MSP_COMMAND);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	if (status < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 		dev_err(&msp430->dev, "command %d failure %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 				command, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) static void dm355evm_power_off(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	dm355evm_command(MSP_COMMAND_POWEROFF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) static int dm355evm_msp_remove(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	pm_power_off = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	msp430 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) dm355evm_msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	int		status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	const char	*video = msp_has_tvp() ? "TVP5146" : "imager";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	if (msp430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 		return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	msp430 = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	/* display revision status; doubles as sanity check */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	status = dm355evm_msp_read(DM355EVM_MSP_FIRMREV);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	if (status < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 		goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	dev_info(&client->dev, "firmware v.%02X, %s as video-in\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 			status, video);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	/* mux video input:  either tvp5146 or some external imager */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	status = dm355evm_msp_write(msp_has_tvp() ? 0 : MSP_VIDEO_IMAGER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 			DM355EVM_MSP_VIDEO_IN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	if (status < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 		dev_warn(&client->dev, "error %d muxing %s as video-in\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 			status, video);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	/* init LED cache, and turn off the LEDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	msp_led_cache = 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	dm355evm_msp_write(msp_led_cache, DM355EVM_MSP_LED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	/* export capabilities we support */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	status = add_children(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	if (status < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 		goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	/* PM hookup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	pm_power_off = dm355evm_power_off;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) fail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	/* FIXME remove children ... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	dm355evm_msp_remove(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	return status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) static const struct i2c_device_id dm355evm_msp_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 	{ "dm355evm_msp", 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 	{ /* end of list */ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) MODULE_DEVICE_TABLE(i2c, dm355evm_msp_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) static struct i2c_driver dm355evm_msp_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	.driver.name	= "dm355evm_msp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 	.id_table	= dm355evm_msp_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	.probe		= dm355evm_msp_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	.remove		= dm355evm_msp_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) static int __init dm355evm_msp_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	return i2c_add_driver(&dm355evm_msp_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) subsys_initcall(dm355evm_msp_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) static void __exit dm355evm_msp_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	i2c_del_driver(&dm355evm_msp_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) module_exit(dm355evm_msp_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) MODULE_DESCRIPTION("Interface to MSP430 firmware on DM355EVM");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) MODULE_LICENSE("GPL");